norma-library 0.4.9 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc.json +1 -1
- package/.husky/commit-msg +4 -0
- package/.prettierignore +11 -0
- package/.prettierrc.json +20 -0
- package/CHANGELOG.md +0 -0
- package/CONTRIBUTING.md +0 -0
- package/README.md +42 -0
- package/commitlint.config.js +1 -0
- package/dist/Button/index.d.ts +9 -0
- package/dist/Button/types.d.ts +18 -0
- package/dist/Card/Card.d.ts +3 -0
- package/dist/Card/CardHeader.d.ts +3 -0
- package/dist/Card/index.d.ts +4 -0
- package/dist/Card/styles.d.ts +546 -0
- package/dist/Card/types.d.ts +8 -0
- package/dist/esm/components/Accordion.d.ts +2 -2
- package/dist/esm/components/Accordion.js +8 -8
- package/dist/esm/components/Accordion.js.map +1 -1
- package/dist/esm/components/Avatar.d.ts +2 -2
- package/dist/esm/components/Avatar.js +7 -7
- package/dist/esm/components/Avatar.js.map +1 -1
- package/dist/esm/components/Badge.d.ts +2 -2
- package/dist/esm/components/Badge.js +5 -5
- package/dist/esm/components/Badge.js.map +1 -1
- package/dist/esm/components/Button.d.ts +2 -2
- package/dist/esm/components/Button.js +10 -10
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Card.d.ts +3 -3
- package/dist/esm/components/Card.js +8 -8
- package/dist/esm/components/Card.js.map +1 -1
- package/dist/esm/components/ChatMessage.d.ts +2 -2
- package/dist/esm/components/ChatMessage.js +35 -35
- package/dist/esm/components/ChatMessage.js.map +1 -1
- package/dist/esm/components/CheckBox.d.ts +2 -2
- package/dist/esm/components/CheckBox.js +5 -5
- package/dist/esm/components/CheckBox.js.map +1 -1
- package/dist/esm/components/DataGrid/base/dropdown.d.ts +2 -2
- package/dist/esm/components/DataGrid/base/dropdown.js +32 -32
- package/dist/esm/components/DataGrid/base/dropdown.js.map +1 -1
- package/dist/esm/components/DataGrid/base/number-filter.d.ts +2 -2
- package/dist/esm/components/DataGrid/base/number-filter.js +21 -21
- package/dist/esm/components/DataGrid/base/sorting.d.ts +2 -2
- package/dist/esm/components/DataGrid/base/sorting.js +1 -1
- package/dist/esm/components/DataGrid/base/sorting.js.map +1 -1
- package/dist/esm/components/DataGrid/icons.d.ts +1 -1
- package/dist/esm/components/DataGrid/icons.js +1 -1
- package/dist/esm/components/DataGrid/icons.js.map +1 -1
- package/dist/esm/components/DataGrid/index.d.ts +2 -2
- package/dist/esm/components/DataGrid/index.js +35 -44
- package/dist/esm/components/DataGrid/index.js.map +1 -1
- package/dist/esm/components/DataGrid/shared.d.ts +1 -1
- package/dist/esm/components/DataGrid/shared.js +19 -32
- package/dist/esm/components/DataGrid/shared.js.map +1 -1
- package/dist/esm/components/DataGrid/styled.d.ts +2 -2
- package/dist/esm/components/DataGrid/styled.js +35 -35
- package/dist/esm/components/DataGrid/styled.js.map +1 -1
- package/dist/esm/components/DatePicker.d.ts +5 -5
- package/dist/esm/components/DatePicker.js +37 -37
- package/dist/esm/components/DatePicker.js.map +1 -1
- package/dist/esm/components/DropDown.d.ts +2 -2
- package/dist/esm/components/DropDown.js +6 -6
- package/dist/esm/components/DropDown.js.map +1 -1
- package/dist/esm/components/IconButton.d.ts +2 -2
- package/dist/esm/components/IconButton.js +7 -7
- package/dist/esm/components/IconButton.js.map +1 -1
- package/dist/esm/components/Icons.d.ts +2 -2
- package/dist/esm/components/Icons.js +10 -10
- package/dist/esm/components/Icons.js.map +1 -1
- package/dist/esm/components/Modal.d.ts +2 -2
- package/dist/esm/components/Modal.js +8 -8
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/Paper.d.ts +2 -2
- package/dist/esm/components/Paper.js +5 -5
- package/dist/esm/components/Paper.js.map +1 -1
- package/dist/esm/components/ProgressBar.d.ts +2 -2
- package/dist/esm/components/ProgressBar.js +11 -11
- package/dist/esm/components/ProgressBar.js.map +1 -1
- package/dist/esm/components/RadioGroup.d.ts +2 -2
- package/dist/esm/components/RadioGroup.js +7 -7
- package/dist/esm/components/RadioGroup.js.map +1 -1
- package/dist/esm/components/RangerSlider.d.ts +2 -2
- package/dist/esm/components/RangerSlider.js +31 -31
- package/dist/esm/components/RangerSlider.js.map +1 -1
- package/dist/esm/components/Select.d.ts +2 -2
- package/dist/esm/components/Select.js +14 -14
- package/dist/esm/components/Select.js.map +1 -1
- package/dist/esm/components/Svgs.d.ts +1 -1
- package/dist/esm/components/Svgs.js +1 -1
- package/dist/esm/components/Svgs.js.map +1 -1
- package/dist/esm/components/Tabs.d.ts +2 -2
- package/dist/esm/components/Tabs.js +25 -26
- package/dist/esm/components/Tabs.js.map +1 -1
- package/dist/esm/components/Tag.d.ts +2 -2
- package/dist/esm/components/Tag.js +8 -8
- package/dist/esm/components/Tag.js.map +1 -1
- package/dist/esm/components/TextField.d.ts +2 -2
- package/dist/esm/components/TextField.js +8 -8
- package/dist/esm/components/TextField.js.map +1 -1
- package/dist/esm/components/TimeLine.d.ts +2 -2
- package/dist/esm/components/TimeLine.js +20 -20
- package/dist/esm/components/TimeLine.js.map +1 -1
- package/dist/esm/components/TimePicker.d.ts +8 -8
- package/dist/esm/components/TimePicker.js +43 -43
- package/dist/esm/components/TimePicker.js.map +1 -1
- package/dist/esm/components/index.d.ts +23 -23
- package/dist/esm/components/index.js +23 -23
- package/dist/esm/helpers/alignments.js +7 -7
- package/dist/esm/helpers/borders.js +11 -11
- package/dist/esm/helpers/colors.js +41 -41
- package/dist/esm/helpers/index.d.ts +5 -5
- package/dist/esm/helpers/index.js +5 -5
- package/dist/esm/helpers/sizes.d.ts +1 -1
- package/dist/esm/helpers/sizes.js +39 -39
- package/dist/esm/helpers/sizes.js.map +1 -1
- package/dist/esm/index.d.ts +17 -17
- package/dist/esm/index.js +17 -17
- package/dist/esm/interfaces/Accordion.d.ts +3 -3
- package/dist/esm/interfaces/Avatar.d.ts +6 -6
- package/dist/esm/interfaces/Badge.d.ts +7 -7
- package/dist/esm/interfaces/Button.d.ts +5 -5
- package/dist/esm/interfaces/Card.d.ts +3 -3
- package/dist/esm/interfaces/ChatMessage.d.ts +1 -1
- package/dist/esm/interfaces/CheckBox.d.ts +10 -10
- package/dist/esm/interfaces/DataGrid.d.ts +4 -4
- package/dist/esm/interfaces/DatePicker.d.ts +3 -3
- package/dist/esm/interfaces/DropDown.d.ts +4 -4
- package/dist/esm/interfaces/IconButton.d.ts +5 -5
- package/dist/esm/interfaces/Icons.d.ts +3 -3
- package/dist/esm/interfaces/Modal.d.ts +3 -3
- package/dist/esm/interfaces/Paper.d.ts +4 -4
- package/dist/esm/interfaces/ProgressBar.d.ts +5 -5
- package/dist/esm/interfaces/RadioGroup.d.ts +4 -4
- package/dist/esm/interfaces/RangerSlider.d.ts +8 -8
- package/dist/esm/interfaces/Select.d.ts +3 -3
- package/dist/esm/interfaces/Tabs.d.ts +3 -3
- package/dist/esm/interfaces/Tag.d.ts +5 -5
- package/dist/esm/interfaces/TextField.d.ts +12 -12
- package/dist/esm/interfaces/TimeLine.d.ts +3 -3
- package/dist/esm/interfaces/TimePicker.d.ts +3 -3
- package/dist/esm/interfaces/index.d.ts +23 -23
- package/dist/esm/interfaces/index.js +23 -23
- package/dist/esm/types/index.d.ts +41 -41
- package/dist/esm/types/index.js +2 -2
- package/dist/esm/types/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +6992 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +266 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/docs/index.md +118 -0
- package/package.json +64 -8
- package/src/components/Accordion.tsx +47 -64
- package/src/components/Avatar.tsx +22 -29
- package/src/components/Badge.tsx +19 -22
- package/src/components/Button.tsx +12 -19
- package/src/components/Card.tsx +44 -47
- package/src/components/ChatMessage.tsx +87 -89
- package/src/components/CheckBox.tsx +8 -19
- package/src/components/DataGrid/allData.json +2918 -2918
- package/src/components/DataGrid/base/dropdown.tsx +212 -235
- package/src/components/DataGrid/base/number-filter.tsx +43 -43
- package/src/components/DataGrid/base/sorting.tsx +29 -35
- package/src/components/DataGrid/icons.tsx +53 -61
- package/src/components/DataGrid/index.tsx +254 -319
- package/src/components/DataGrid/shared.ts +154 -179
- package/src/components/DataGrid/styled.ts +96 -102
- package/src/components/DataGrid/styles/dropdown.module.css +86 -86
- package/src/components/DataGrid/styles/number-filter.module.css +16 -16
- package/src/components/DataGrid/styles/styles.module.css +107 -107
- package/src/components/DatePicker.tsx +73 -84
- package/src/components/DropDown.tsx +31 -38
- package/src/components/IconButton.tsx +12 -29
- package/src/components/Icons.tsx +82 -87
- package/src/components/Modal.tsx +114 -123
- package/src/components/Paper.tsx +19 -22
- package/src/components/ProgressBar.tsx +54 -63
- package/src/components/RadioGroup.tsx +47 -55
- package/src/components/RangerSlider.tsx +70 -81
- package/src/components/Select.tsx +82 -98
- package/src/components/Svgs.tsx +498 -522
- package/src/components/Tabs.tsx +111 -140
- package/src/components/Tag.tsx +37 -45
- package/src/components/TextField.tsx +11 -22
- package/src/components/TimeLine.tsx +93 -103
- package/src/components/TimePicker.tsx +84 -95
- package/src/components/index.ts +23 -23
- package/src/helpers/alignments.ts +7 -7
- package/src/helpers/borders.ts +11 -11
- package/src/helpers/colors.ts +42 -42
- package/src/helpers/index.ts +5 -5
- package/src/helpers/sizes.ts +39 -46
- package/src/index.ts +17 -17
- package/src/interfaces/Accordion.ts +12 -12
- package/src/interfaces/Avatar.tsx +15 -18
- package/src/interfaces/Badge.ts +19 -32
- package/src/interfaces/Button.ts +5 -10
- package/src/interfaces/Card.ts +11 -11
- package/src/interfaces/ChatMessage.ts +12 -12
- package/src/interfaces/CheckBox.ts +12 -18
- package/src/interfaces/DataGrid.ts +46 -51
- package/src/interfaces/DatePicker.ts +13 -13
- package/src/interfaces/DropDown.ts +14 -14
- package/src/interfaces/IconButton.ts +5 -10
- package/src/interfaces/Icons.ts +17 -17
- package/src/interfaces/Modal.ts +15 -15
- package/src/interfaces/Paper.ts +12 -12
- package/src/interfaces/ProgressBar.ts +18 -25
- package/src/interfaces/RadioGroup.ts +22 -28
- package/src/interfaces/RangerSlider.ts +21 -32
- package/src/interfaces/Select.ts +17 -17
- package/src/interfaces/Tabs.ts +19 -24
- package/src/interfaces/Tag.ts +17 -17
- package/src/interfaces/TextField.ts +14 -34
- package/src/interfaces/TimeLine.ts +11 -16
- package/src/interfaces/TimePicker.ts +13 -13
- package/src/interfaces/index.ts +23 -23
- package/src/sample-data.json +178 -178
- package/src/stories/Accordion.stories.tsx +65 -65
- package/src/stories/Avatar.stories.tsx +123 -139
- package/src/stories/Badge.stories.tsx +39 -47
- package/src/stories/Button.stories.tsx +18 -26
- package/src/stories/Card.stories.tsx +40 -55
- package/src/stories/ChatMessage.stories.tsx +84 -85
- package/src/stories/CheckBox.stories.tsx +17 -23
- package/src/stories/DataGrid.stories.tsx +28 -28
- package/src/stories/DatePicker.stories.tsx +50 -77
- package/src/stories/DropDown.stories.tsx +57 -57
- package/src/stories/IconButton.stories.tsx +78 -114
- package/src/stories/Modal.stories.tsx +190 -190
- package/src/stories/Paper.stories.tsx +53 -53
- package/src/stories/ProgressBar.stories.tsx +95 -139
- package/src/stories/RadioGroup.stories.tsx +21 -28
- package/src/stories/RangerSlider.stories.tsx +58 -68
- package/src/stories/Select.stories.tsx +100 -128
- package/src/stories/Tabs.stories.tsx +62 -62
- package/src/stories/Tag.stories.tsx +56 -74
- package/src/stories/TextField.stories.tsx +54 -189
- package/src/stories/TimeLine.stories.tsx +35 -43
- package/src/stories/TimePicker.stories.tsx +87 -113
- package/src/types/index.ts +90 -155
- package/tsconfig.json +1 -1
- package/buildcache/front-end +0 -1
- package/norma-library.tar +0 -0
- package/postcss.config.js +0 -6
- package/tailwind.config.js +0 -58
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
3
|
-
import type { Meta, StoryObj } from
|
|
4
|
-
import { Accordion } from
|
|
5
|
-
import { DataAccordion } from
|
|
6
|
-
import { Typography } from
|
|
7
|
-
|
|
8
|
-
const data: DataAccordion[] = [
|
|
9
|
-
{
|
|
10
|
-
label:
|
|
11
|
-
id:
|
|
12
|
-
children: (
|
|
13
|
-
<Typography>
|
|
14
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
|
|
15
|
-
|
|
16
|
-
</Typography>
|
|
17
|
-
),
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
label:
|
|
21
|
-
id:
|
|
22
|
-
children: (
|
|
23
|
-
<Typography>
|
|
24
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse
|
|
25
|
-
|
|
26
|
-
</Typography>
|
|
27
|
-
),
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const meta = {
|
|
32
|
-
title:
|
|
33
|
-
component: Accordion,
|
|
34
|
-
parameters: {
|
|
35
|
-
layout:
|
|
36
|
-
},
|
|
37
|
-
tags: [
|
|
38
|
-
argTypes: {
|
|
39
|
-
data: data,
|
|
40
|
-
},
|
|
41
|
-
} satisfies Meta<typeof Accordion>;
|
|
42
|
-
|
|
43
|
-
export default meta;
|
|
44
|
-
|
|
45
|
-
type Story = StoryObj<typeof meta>;
|
|
46
|
-
|
|
47
|
-
export const AccordionBasic = () => {
|
|
48
|
-
return (
|
|
49
|
-
<div style={{ width:
|
|
50
|
-
<Accordion data={data} />
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
AccordionBasic.storyName =
|
|
56
|
-
|
|
57
|
-
export const AccordionExpanded = () => {
|
|
58
|
-
return (
|
|
59
|
-
<div style={{ width:
|
|
60
|
-
<Accordion data={data} defaultExpanded="panel-1" />
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
AccordionExpanded.storyName =
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import { Accordion } from '../components';
|
|
5
|
+
import { DataAccordion } from '../types';
|
|
6
|
+
import { Typography } from '@mui/material';
|
|
7
|
+
|
|
8
|
+
const data: DataAccordion[] = [
|
|
9
|
+
{
|
|
10
|
+
label: 'Accordion 1',
|
|
11
|
+
id: 'panel-1',
|
|
12
|
+
children: (
|
|
13
|
+
<Typography>
|
|
14
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
15
|
+
lobortis eget.
|
|
16
|
+
</Typography>
|
|
17
|
+
),
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: 'Accordion 2',
|
|
21
|
+
id: 'panel-2',
|
|
22
|
+
children: (
|
|
23
|
+
<Typography>
|
|
24
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
25
|
+
lobortis eget.
|
|
26
|
+
</Typography>
|
|
27
|
+
),
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const meta = {
|
|
32
|
+
title: 'Display/Accordion',
|
|
33
|
+
component: Accordion,
|
|
34
|
+
parameters: {
|
|
35
|
+
layout: 'centered',
|
|
36
|
+
},
|
|
37
|
+
tags: ['autodocs'],
|
|
38
|
+
argTypes: {
|
|
39
|
+
data: data,
|
|
40
|
+
},
|
|
41
|
+
} satisfies Meta<typeof Accordion>;
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
|
|
45
|
+
type Story = StoryObj<typeof meta>;
|
|
46
|
+
|
|
47
|
+
export const AccordionBasic = () => {
|
|
48
|
+
return (
|
|
49
|
+
<div style={{ width: '480px', marginBottom: 30 }}>
|
|
50
|
+
<Accordion data={data} />
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
AccordionBasic.storyName = 'Accordion Basic';
|
|
56
|
+
|
|
57
|
+
export const AccordionExpanded = () => {
|
|
58
|
+
return (
|
|
59
|
+
<div style={{ width: '480px', marginBottom: 30 }}>
|
|
60
|
+
<Accordion data={data} defaultExpanded="panel-1" />
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
AccordionExpanded.storyName = 'Accordion Expanded';
|
|
@@ -1,139 +1,123 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
3
|
-
import type { Meta } from
|
|
4
|
-
import { Avatar, Icons } from
|
|
5
|
-
import { AvatarGroup, Stack } from
|
|
6
|
-
import { green, pink } from
|
|
7
|
-
|
|
8
|
-
const meta = {
|
|
9
|
-
title:
|
|
10
|
-
component: Avatar,
|
|
11
|
-
parameters: {
|
|
12
|
-
layout:
|
|
13
|
-
},
|
|
14
|
-
tags: [
|
|
15
|
-
argTypes: {},
|
|
16
|
-
} satisfies Meta<typeof Avatar>;
|
|
17
|
-
|
|
18
|
-
export default meta;
|
|
19
|
-
|
|
20
|
-
function stringToColor(string: string) {
|
|
21
|
-
let hash = 0;
|
|
22
|
-
let i;
|
|
23
|
-
|
|
24
|
-
/* eslint-disable no-bitwise */
|
|
25
|
-
for (i = 0; i < string.length; i += 1) {
|
|
26
|
-
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let color =
|
|
30
|
-
|
|
31
|
-
for (i = 0; i < 3; i += 1) {
|
|
32
|
-
const value = (hash >> (i * 8)) & 0xff;
|
|
33
|
-
color += `00${value.toString(16)}`.slice(-2);
|
|
34
|
-
}
|
|
35
|
-
/* eslint-enable no-bitwise */
|
|
36
|
-
|
|
37
|
-
return color;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function stringAvatar(name: string) {
|
|
41
|
-
return {
|
|
42
|
-
sx: {
|
|
43
|
-
bgcolor: stringToColor(name),
|
|
44
|
-
},
|
|
45
|
-
children: `${name.split(
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export const AvatarBasic = () => {
|
|
50
|
-
return (
|
|
51
|
-
<>
|
|
52
|
-
<Avatar src="https://mui.com/static/images/avatar/2.jpg" />
|
|
53
|
-
</>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const AvatarVariants = () => {
|
|
58
|
-
return (
|
|
59
|
-
<Stack direction="row" spacing={2}>
|
|
60
|
-
<Avatar
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<Avatar
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
</
|
|
120
|
-
</Stack>
|
|
121
|
-
</>
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export const AvatarGrouped = () => {
|
|
126
|
-
return (
|
|
127
|
-
<>
|
|
128
|
-
<Stack direction="row" spacing={2}>
|
|
129
|
-
<AvatarGroup max={4}>
|
|
130
|
-
<Avatar src="https://mui.com/static/images/avatar/1.jpg" />
|
|
131
|
-
<Avatar src="https://mui.com/static/images/avatar/2.jpg" />
|
|
132
|
-
<Avatar src="https://mui.com/static/images/avatar/3.jpg" />
|
|
133
|
-
<Avatar src="https://mui.com/static/images/avatar/4.jpg" />
|
|
134
|
-
<Avatar src="https://mui.com/static/images/avatar/5.jpg" />
|
|
135
|
-
</AvatarGroup>
|
|
136
|
-
</Stack>
|
|
137
|
-
</>
|
|
138
|
-
);
|
|
139
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Meta } from '@storybook/react';
|
|
4
|
+
import { Avatar, Icons } from '../components';
|
|
5
|
+
import { AvatarGroup, Stack } from '@mui/material';
|
|
6
|
+
import { green, pink } from '@mui/material/colors';
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Display/Avatar',
|
|
10
|
+
component: Avatar,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'centered',
|
|
13
|
+
},
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
argTypes: {},
|
|
16
|
+
} satisfies Meta<typeof Avatar>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
function stringToColor(string: string) {
|
|
21
|
+
let hash = 0;
|
|
22
|
+
let i;
|
|
23
|
+
|
|
24
|
+
/* eslint-disable no-bitwise */
|
|
25
|
+
for (i = 0; i < string.length; i += 1) {
|
|
26
|
+
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let color = '#';
|
|
30
|
+
|
|
31
|
+
for (i = 0; i < 3; i += 1) {
|
|
32
|
+
const value = (hash >> (i * 8)) & 0xff;
|
|
33
|
+
color += `00${value.toString(16)}`.slice(-2);
|
|
34
|
+
}
|
|
35
|
+
/* eslint-enable no-bitwise */
|
|
36
|
+
|
|
37
|
+
return color;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function stringAvatar(name: string) {
|
|
41
|
+
return {
|
|
42
|
+
sx: {
|
|
43
|
+
bgcolor: stringToColor(name),
|
|
44
|
+
},
|
|
45
|
+
children: `${name.split(' ')[0][0]}${name.split(' ')[1][0]}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const AvatarBasic = () => {
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
<Avatar src="https://mui.com/static/images/avatar/2.jpg" />
|
|
53
|
+
</>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const AvatarVariants = () => {
|
|
58
|
+
return (
|
|
59
|
+
<Stack direction="row" spacing={2}>
|
|
60
|
+
<Avatar src="https://mui.com/static/images/avatar/1.jpg" variant="square" />
|
|
61
|
+
<Avatar src="https://mui.com/static/images/avatar/2.jpg" variant="rounded" />
|
|
62
|
+
<Avatar src="https://mui.com/static/images/avatar/3.jpg" />
|
|
63
|
+
</Stack>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const AvatarLetters = () => {
|
|
68
|
+
return (
|
|
69
|
+
<>
|
|
70
|
+
<Stack direction="row" spacing={2}>
|
|
71
|
+
<Avatar {...stringAvatar('Kent Dodds')} />
|
|
72
|
+
<Avatar {...stringAvatar('Jed Watson')} />
|
|
73
|
+
<Avatar {...stringAvatar('Tim Neutkens')} />
|
|
74
|
+
</Stack>
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const AvatarSizes = () => {
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<Stack direction="row" spacing={2}>
|
|
83
|
+
<Avatar src="https://mui.com/static/images/avatar/1.jpg" variant="square" sx={{ width: 24, height: 24 }} />
|
|
84
|
+
<Avatar src="https://mui.com/static/images/avatar/2.jpg" variant="rounded" />
|
|
85
|
+
<Avatar src="https://mui.com/static/images/avatar/3.jpg" sx={{ width: 56, height: 56 }} />
|
|
86
|
+
</Stack>
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const AvatarWidthIcons = () => {
|
|
92
|
+
return (
|
|
93
|
+
<>
|
|
94
|
+
<Stack direction="row" spacing={2}>
|
|
95
|
+
<Avatar>
|
|
96
|
+
<Icons icon="user" color="white" />
|
|
97
|
+
</Avatar>
|
|
98
|
+
<Avatar sx={{ bgcolor: pink[500] }}>
|
|
99
|
+
<Icons icon="starOutlined" color="white" />
|
|
100
|
+
</Avatar>
|
|
101
|
+
<Avatar sx={{ bgcolor: green[500] }}>
|
|
102
|
+
<Icons icon="chartBar" color="white" />
|
|
103
|
+
</Avatar>
|
|
104
|
+
</Stack>
|
|
105
|
+
</>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const AvatarGrouped = () => {
|
|
110
|
+
return (
|
|
111
|
+
<>
|
|
112
|
+
<Stack direction="row" spacing={2}>
|
|
113
|
+
<AvatarGroup max={4}>
|
|
114
|
+
<Avatar src="https://mui.com/static/images/avatar/1.jpg" />
|
|
115
|
+
<Avatar src="https://mui.com/static/images/avatar/2.jpg" />
|
|
116
|
+
<Avatar src="https://mui.com/static/images/avatar/3.jpg" />
|
|
117
|
+
<Avatar src="https://mui.com/static/images/avatar/4.jpg" />
|
|
118
|
+
<Avatar src="https://mui.com/static/images/avatar/5.jpg" />
|
|
119
|
+
</AvatarGroup>
|
|
120
|
+
</Stack>
|
|
121
|
+
</>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
@@ -1,47 +1,39 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
3
|
-
import type { Meta } from
|
|
4
|
-
import { Avatar, Badge, Icons } from
|
|
5
|
-
import { AvatarGroup, Stack } from
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
title:
|
|
9
|
-
component: Badge,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout:
|
|
12
|
-
},
|
|
13
|
-
tags: [
|
|
14
|
-
argTypes: {},
|
|
15
|
-
} satisfies Meta<typeof Badge>;
|
|
16
|
-
|
|
17
|
-
export default meta;
|
|
18
|
-
|
|
19
|
-
export const BadgeBasic = () => {
|
|
20
|
-
return (
|
|
21
|
-
<>
|
|
22
|
-
<Badge badgeContent={4} color="primary">
|
|
23
|
-
<Icons icon="user" />
|
|
24
|
-
</Badge>
|
|
25
|
-
</>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const BadgeColors = () => {
|
|
30
|
-
return (
|
|
31
|
-
<Stack direction="row" spacing={2}>
|
|
32
|
-
{[
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
].map((color, key) => (
|
|
41
|
-
<Badge badgeContent={4} color={color} key={key}>
|
|
42
|
-
<Icons icon="user" />
|
|
43
|
-
</Badge>
|
|
44
|
-
))}
|
|
45
|
-
</Stack>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Meta } from '@storybook/react';
|
|
4
|
+
import { Avatar, Badge, Icons } from '../components';
|
|
5
|
+
import { AvatarGroup, Stack } from '@mui/material';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Display/Badge',
|
|
9
|
+
component: Badge,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {},
|
|
15
|
+
} satisfies Meta<typeof Badge>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
export const BadgeBasic = () => {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<Badge badgeContent={4} color="primary">
|
|
23
|
+
<Icons icon="user" />
|
|
24
|
+
</Badge>
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const BadgeColors = () => {
|
|
30
|
+
return (
|
|
31
|
+
<Stack direction="row" spacing={2}>
|
|
32
|
+
{['primary', 'secondary', 'default', 'error', 'info', 'success', 'warning'].map((color, key) => (
|
|
33
|
+
<Badge badgeContent={4} color={color} key={key}>
|
|
34
|
+
<Icons icon="user" />
|
|
35
|
+
</Badge>
|
|
36
|
+
))}
|
|
37
|
+
</Stack>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Button } from
|
|
3
|
-
import type { Meta, StoryObj } from
|
|
4
|
-
import { ButtonVariant, SizeVariant, ColorVariant } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from '../components/Button';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import { ButtonVariant, SizeVariant, ColorVariant } from '../types';
|
|
5
5
|
|
|
6
|
-
const sizes: SizeVariant[] = [
|
|
7
|
-
const variants: ButtonVariant[] = [
|
|
8
|
-
const colors: ColorVariant[] = [
|
|
9
|
-
"inherit",
|
|
10
|
-
"primary",
|
|
11
|
-
"secondary",
|
|
12
|
-
"success",
|
|
13
|
-
"error",
|
|
14
|
-
"info",
|
|
15
|
-
"warning",
|
|
16
|
-
];
|
|
6
|
+
const sizes: SizeVariant[] = ['small', 'medium', 'large'];
|
|
7
|
+
const variants: ButtonVariant[] = ['text', 'outlined', 'contained'];
|
|
8
|
+
const colors: ColorVariant[] = ['inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning'];
|
|
17
9
|
|
|
18
10
|
const meta = {
|
|
19
|
-
title:
|
|
11
|
+
title: 'Layout/Button',
|
|
20
12
|
component: Button,
|
|
21
13
|
parameters: {
|
|
22
|
-
layout:
|
|
14
|
+
layout: 'centered',
|
|
23
15
|
},
|
|
24
|
-
tags: [
|
|
16
|
+
tags: ['autodocs'],
|
|
25
17
|
argTypes: {},
|
|
26
18
|
} satisfies Meta<typeof Button>;
|
|
27
19
|
|
|
@@ -35,10 +27,10 @@ const defaultArgs = {
|
|
|
35
27
|
|
|
36
28
|
export const Playground: Story = {
|
|
37
29
|
args: {
|
|
38
|
-
label:
|
|
39
|
-
size:
|
|
40
|
-
color:
|
|
41
|
-
variant:
|
|
30
|
+
label: 'My Button',
|
|
31
|
+
size: 'medium',
|
|
32
|
+
color: 'primary',
|
|
33
|
+
variant: 'contained',
|
|
42
34
|
},
|
|
43
35
|
};
|
|
44
36
|
|
|
@@ -50,7 +42,7 @@ export const ButtonSizes = () => (
|
|
|
50
42
|
label={`Size ${size}`}
|
|
51
43
|
size={size}
|
|
52
44
|
variant="contained"
|
|
53
|
-
style={{ marginRight:
|
|
45
|
+
style={{ marginRight: '5px' }}
|
|
54
46
|
{...defaultArgs}
|
|
55
47
|
/>
|
|
56
48
|
))}
|
|
@@ -64,7 +56,7 @@ export const ButtonVariants = () => (
|
|
|
64
56
|
key={key}
|
|
65
57
|
variant={variant}
|
|
66
58
|
label={`Variant ${variant}`}
|
|
67
|
-
style={{ marginRight:
|
|
59
|
+
style={{ marginRight: '5px' }}
|
|
68
60
|
{...defaultArgs}
|
|
69
61
|
/>
|
|
70
62
|
))}
|
|
@@ -79,7 +71,7 @@ export const ButtonColorsDefault = () => (
|
|
|
79
71
|
variant="outlined"
|
|
80
72
|
label={`Color ${color}`}
|
|
81
73
|
color={color}
|
|
82
|
-
style={{ margin:
|
|
74
|
+
style={{ margin: '2px' }}
|
|
83
75
|
{...defaultArgs}
|
|
84
76
|
/>
|
|
85
77
|
))}
|
|
@@ -90,7 +82,7 @@ export const ButtonColorsDefault = () => (
|
|
|
90
82
|
label={`Color ${color}`}
|
|
91
83
|
color={color}
|
|
92
84
|
variant="contained"
|
|
93
|
-
style={{ margin:
|
|
85
|
+
style={{ margin: '2px' }}
|
|
94
86
|
{...defaultArgs}
|
|
95
87
|
/>
|
|
96
88
|
))}
|
|
@@ -1,55 +1,40 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Card } from
|
|
3
|
-
import type { Meta, StoryObj } from
|
|
4
|
-
import { ColorVariant } from
|
|
5
|
-
|
|
6
|
-
const colors: ColorVariant[] = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export const
|
|
33
|
-
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
export const BasicBorderedColors = () => (
|
|
43
|
-
<>
|
|
44
|
-
{colors.map((color, key) => (
|
|
45
|
-
<Card
|
|
46
|
-
sx={{ minWidth: 275, marginBottom: 2 }}
|
|
47
|
-
border={true}
|
|
48
|
-
color={color}
|
|
49
|
-
key={key}
|
|
50
|
-
>
|
|
51
|
-
Card with border {color}
|
|
52
|
-
</Card>
|
|
53
|
-
))}
|
|
54
|
-
</>
|
|
55
|
-
);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Card } from '../components/Card';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import { ColorVariant } from '../types';
|
|
5
|
+
|
|
6
|
+
const colors: ColorVariant[] = ['inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning'];
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Layout/Card',
|
|
10
|
+
component: Card,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'centered',
|
|
13
|
+
},
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
argTypes: {},
|
|
16
|
+
} satisfies Meta<typeof Card>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
const defaultArgs = {};
|
|
23
|
+
|
|
24
|
+
export const BasicCard = () => <Card sx={{ minWidth: 275 }}>Content children card</Card>;
|
|
25
|
+
|
|
26
|
+
export const BasicBordered = () => (
|
|
27
|
+
<Card sx={{ minWidth: 275 }} border={true} color="primary">
|
|
28
|
+
Card with border
|
|
29
|
+
</Card>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const BasicBorderedColors = () => (
|
|
33
|
+
<>
|
|
34
|
+
{colors.map((color, key) => (
|
|
35
|
+
<Card sx={{ minWidth: 275, marginBottom: 2 }} border={true} color={color} key={key}>
|
|
36
|
+
Card with border {color}
|
|
37
|
+
</Card>
|
|
38
|
+
))}
|
|
39
|
+
</>
|
|
40
|
+
);
|