Skip to content

Commit 1795b54

Browse files
committed
essential-stories
1 parent d3e30ae commit 1795b54

34 files changed

+1930
-121
lines changed

config/main.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module.exports = {
55
],
66
addons: [
77
"@storybook/addon-links",
8-
"@storybook/addon-essentials",
9-
"@storybook/addon-interactions",
8+
"@storybook/addon-essentials"
109
],
1110
};

config/preview.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
parameters: {
3+
previewTabs: {
4+
'storybook/docs/panel': {
5+
hidden: true,
6+
},
7+
},
8+
},
9+
};

dist/.gitkeep

Whitespace-only changes.

package-lock.json

Lines changed: 793 additions & 95 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"license": "MIT",
1414
"private": true,
1515
"dependencies": {
16+
"@emotion/css": "^11.7.1",
17+
"@mui/material": "^5.2.8",
1618
"react": "^17.0.1",
19+
"react-declarative": "^1.6.6",
1720
"react-dom": "^17.0.1"
1821
},
1922
"scripts": {

src/components/Breadcrumbs/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/FieldTemplate.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from 'react';
2+
3+
import { action } from '@storybook/addon-actions';
4+
import { Container, CssBaseline, Box } from '@mui/material';
5+
6+
import { OneTyped, TypedField } from 'react-declarative';
7+
8+
interface IFieldTemplateProps {
9+
field: TypedField;
10+
}
11+
12+
export const FieldTemplate = ({
13+
field,
14+
}: IFieldTemplateProps) => (
15+
<Container>
16+
<CssBaseline />
17+
<Box p={1}>
18+
<OneTyped
19+
fields={[field]}
20+
focus={action('focus')}
21+
blur={action('blur')}
22+
change={action('change')}
23+
invalidity={action('invalidity')}
24+
ready={action('ready')}
25+
fallback={action('fallback')}
26+
/>
27+
</Box>
28+
</Container>
29+
);

src/components/LayoutTemplate.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from 'react';
2+
3+
import { action } from '@storybook/addon-actions';
4+
import { Container, CssBaseline, Box } from '@mui/material';
5+
6+
import { OneTyped, TypedField } from 'react-declarative';
7+
8+
interface ILayoutTemplateProps {
9+
fields: TypedField[];
10+
}
11+
12+
export const LayoutTemplate = ({
13+
fields,
14+
}: ILayoutTemplateProps) => (
15+
<Container>
16+
<CssBaseline />
17+
<Box p={1}>
18+
<OneTyped
19+
fields={fields}
20+
focus={action('focus')}
21+
blur={action('blur')}
22+
change={action('change')}
23+
invalidity={action('invalidity')}
24+
ready={action('ready')}
25+
fallback={action('fallback')}
26+
/>
27+
</Box>
28+
</Container>
29+
);

src/components/List/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/One/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/globals.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module "*.md";
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Checkbox = FieldTemplate.bind({});
6+
7+
const checkbox: TypedField = {
8+
type: FieldType.Checkbox,
9+
title: 'Checkbox',
10+
name: 'checkbox',
11+
};
12+
13+
Checkbox.argTypes = {
14+
field: {
15+
name: 'field',
16+
defaultValue: checkbox,
17+
readonly: true,
18+
control: {
19+
type: 'object',
20+
},
21+
}
22+
};
23+
24+
export default {
25+
title: 'One/Fields',
26+
};

src/stories/Fields/Combo.stories.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Combo = FieldTemplate.bind({});
6+
7+
const combo: TypedField = {
8+
type: FieldType.Combo,
9+
title: 'Combo',
10+
name: 'combo',
11+
};
12+
13+
Combo.argTypes = {
14+
field: {
15+
name: 'field',
16+
defaultValue: combo,
17+
readonly: true,
18+
control: {
19+
type: 'object',
20+
},
21+
}
22+
};
23+
24+
export default {
25+
title: 'One/Fields',
26+
};

src/stories/Fields/Items.stories.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Items = FieldTemplate.bind({});
6+
7+
const items: TypedField = {
8+
type: FieldType.Items,
9+
title: 'Items',
10+
name: 'items',
11+
};
12+
13+
Items.argTypes = {
14+
field: {
15+
name: 'field',
16+
defaultValue: items,
17+
readonly: true,
18+
control: {
19+
type: 'object',
20+
},
21+
}
22+
};
23+
24+
export default {
25+
title: 'One/Fields',
26+
};

src/stories/Fields/Line.stories.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Line = FieldTemplate.bind({});
6+
7+
const line: TypedField = {
8+
type: FieldType.Line,
9+
title: 'Line',
10+
name: 'line',
11+
};
12+
13+
Line.argTypes = {
14+
field: {
15+
name: 'field',
16+
defaultValue: line,
17+
readonly: true,
18+
control: {
19+
type: 'object',
20+
},
21+
}
22+
};
23+
24+
export default {
25+
title: 'One/Fields',
26+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Progress = FieldTemplate.bind({});
6+
7+
const progress: TypedField = {
8+
type: FieldType.Progress,
9+
name: 'progress',
10+
};
11+
12+
Progress.argTypes = {
13+
field: {
14+
name: 'field',
15+
defaultValue: progress,
16+
readonly: true,
17+
control: {
18+
type: 'object',
19+
},
20+
}
21+
};
22+
23+
export default {
24+
title: 'One/Fields',
25+
};

src/stories/Fields/Radio.stories.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Radio = FieldTemplate.bind({});
6+
7+
const radio: TypedField = {
8+
type: FieldType.Radio,
9+
title: 'Radio',
10+
name: 'radio',
11+
radioValue: 'first-radio',
12+
};
13+
14+
Radio.argTypes = {
15+
field: {
16+
name: 'field',
17+
defaultValue: radio,
18+
readonly: true,
19+
control: {
20+
type: 'object',
21+
},
22+
}
23+
};
24+
25+
export default {
26+
title: 'One/Fields',
27+
};

src/stories/Fields/Rating.stories.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Rating = FieldTemplate.bind({});
6+
7+
const rating: TypedField = {
8+
type: FieldType.Rating,
9+
name: 'rating',
10+
};
11+
12+
Rating.argTypes = {
13+
field: {
14+
name: 'field',
15+
defaultValue: rating,
16+
readonly: true,
17+
control: {
18+
type: 'object',
19+
},
20+
}
21+
};
22+
23+
export default {
24+
title: 'One/Fields',
25+
};

src/stories/Fields/Slider.stories.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Slider = FieldTemplate.bind({});
6+
7+
const slider: TypedField = {
8+
type: FieldType.Slider,
9+
name: 'slider',
10+
};
11+
12+
Slider.argTypes = {
13+
field: {
14+
name: 'field',
15+
defaultValue: slider,
16+
readonly: true,
17+
control: {
18+
type: 'object',
19+
},
20+
}
21+
};
22+
23+
export default {
24+
title: 'One/Fields',
25+
};

src/stories/Fields/Switch.stories.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Switch = FieldTemplate.bind({});
6+
7+
const switchField: TypedField = {
8+
type: FieldType.Switch,
9+
title: 'Switch',
10+
name: 'switchField',
11+
};
12+
13+
Switch.argTypes = {
14+
field: {
15+
name: 'field',
16+
defaultValue: switchField,
17+
readonly: true,
18+
control: {
19+
type: 'object',
20+
},
21+
}
22+
};
23+
24+
export default {
25+
title: 'One/Fields',
26+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Textfield = FieldTemplate.bind({});
6+
7+
const textfield: TypedField = {
8+
type: FieldType.Text,
9+
title: 'Textfield',
10+
name: 'textfield',
11+
};
12+
13+
Textfield.argTypes = {
14+
field: {
15+
name: 'field',
16+
defaultValue: textfield,
17+
readonly: true,
18+
control: {
19+
type: 'object',
20+
},
21+
}
22+
};
23+
24+
export default {
25+
title: 'One/Fields',
26+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FieldType, TypedField } from 'react-declarative';
2+
3+
import { FieldTemplate } from '../../components/FieldTemplate';
4+
5+
export const Typography = FieldTemplate.bind({});
6+
7+
const typography: TypedField = {
8+
type: FieldType.Typography,
9+
placeholder: 'Typography',
10+
name: 'typography',
11+
};
12+
13+
Typography.argTypes = {
14+
field: {
15+
name: 'field',
16+
defaultValue: typography,
17+
readonly: true,
18+
control: {
19+
type: 'object',
20+
},
21+
}
22+
};
23+
24+
export default {
25+
title: 'One/Fields',
26+
};

0 commit comments

Comments
 (0)