@lunit/design-system 1.0.0-a.2 → 1.0.0-a.3
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 +16 -0
- package/dist/cjs/components/Alert/index.js +1 -1
- package/dist/cjs/components/Alert/index.js.map +1 -1
- package/dist/cjs/components/Button/index.js +1 -1
- package/dist/cjs/components/Button/index.js.map +1 -1
- package/dist/cjs/components/Chip/index.js +1 -1
- package/dist/cjs/components/Chip/index.js.map +1 -1
- package/dist/cjs/components/TextField/index.js +1 -1
- package/dist/cjs/components/TextField/index.js.map +1 -1
- package/dist/cjs/components/ToggleButton/index.js +1 -1
- package/dist/cjs/components/ToggleButton/index.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/components/Alert/Alert.js +16 -4
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Alert/Alert.styled.js +48 -0
- package/dist/components/Alert/Alert.styled.js.map +1 -0
- package/dist/components/Alert/Alert.types.js +2 -0
- package/dist/components/Alert/Alert.types.js.map +1 -0
- package/dist/components/Alert/Alert.utils..js +38 -0
- package/dist/components/Alert/Alert.utils..js.map +1 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.styled.js +31 -21
- package/dist/components/Button/Button.styled.js.map +1 -1
- package/dist/components/Button/utils/getHoverStyle.js +7 -0
- package/dist/components/Button/utils/getHoverStyle.js.map +1 -0
- package/dist/components/Chip/Chip.js +1 -1
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Chip/Chip.styled.js +2 -3
- package/dist/components/Chip/Chip.styled.js.map +1 -1
- package/dist/components/TextField/TextField.js +15 -3
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.style.js +245 -0
- package/dist/components/TextField/TextField.style.js.map +1 -0
- package/dist/components/TextField/TextField.types.js +2 -0
- package/dist/components/TextField/TextField.types.js.map +1 -0
- package/dist/components/TextField/TextFieldIcon.js +7 -0
- package/dist/components/TextField/TextFieldIcon.js.map +1 -0
- package/dist/components/Toast/Toast.js +26 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/Toast.styled.js +49 -0
- package/dist/components/Toast/Toast.styled.js.map +1 -0
- package/dist/components/Toast/Toast.types.js +2 -0
- package/dist/components/Toast/Toast.types.js.map +1 -0
- package/dist/components/Toast/Toast.utils.js +14 -0
- package/dist/components/Toast/Toast.utils.js.map +1 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Toast/index.js.map +1 -0
- package/dist/foundation/colors/base/grey.js +16 -0
- package/dist/foundation/colors/base/grey.js.map +1 -1
- package/dist/foundation/colors/base/lunitGreen.js +2 -2
- package/dist/foundation/colors/base/lunitGreen.js.map +1 -1
- package/dist/foundation/colors/base/lunitTeal.js +5 -5
- package/dist/foundation/colors/base/lunitTeal.js.map +1 -1
- package/dist/foundation/colors/base/red.js +2 -2
- package/dist/foundation/colors/index.js +24 -4
- package/dist/foundation/colors/index.js.map +1 -1
- package/dist/foundation/colors/token/component.js +265 -291
- package/dist/foundation/colors/token/component.js.map +1 -1
- package/dist/foundation/colors/token/core.js +132 -125
- package/dist/foundation/colors/token/core.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/theme.js +5 -0
- package/dist/theme.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +3 -1
- package/dist/types/components/Alert/Alert.styled.d.ts +6 -0
- package/dist/types/components/Alert/Alert.types.d.ts +9 -0
- package/dist/types/components/Alert/Alert.utils..d.ts +4 -0
- package/dist/types/components/Button/Button.d.ts +1 -1
- package/dist/types/components/Button/Button.styled.d.ts +26 -2
- package/dist/types/components/Button/Button.types.d.ts +4 -4
- package/dist/types/components/Button/utils/getHoverStyle.d.ts +6 -0
- package/dist/types/components/Chip/Chip.styled.d.ts +9 -9
- package/dist/types/components/Chip/Chip.types.d.ts +1 -1
- package/dist/types/components/TextField/TextField.d.ts +2 -1
- package/dist/types/components/TextField/TextField.style.d.ts +9 -0
- package/dist/types/components/TextField/TextField.types.d.ts +29 -0
- package/dist/types/components/TextField/TextFieldIcon.d.ts +8 -0
- package/dist/types/components/TextField/index.d.ts +1 -0
- package/dist/types/components/Toast/Toast.d.ts +4 -0
- package/dist/types/components/Toast/Toast.styled.d.ts +1 -0
- package/dist/types/components/Toast/Toast.types.d.ts +4 -0
- package/dist/types/components/Toast/Toast.utils.d.ts +2 -0
- package/dist/types/components/Toast/index.d.ts +1 -0
- package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.types.d.ts +4 -4
- package/dist/types/foundation/colors/base/grey.d.ts +16 -0
- package/dist/types/foundation/colors/base/lunitGreen.d.ts +2 -2
- package/dist/types/foundation/colors/base/lunitTeal.d.ts +2 -2
- package/dist/types/foundation/colors/index.d.ts +42 -9
- package/dist/types/foundation/colors/types.d.ts +1 -3
- package/dist/types/foundation/index.d.ts +37 -5
- package/dist/types/index.d.ts +1 -0
- package/package.json +21 -16
- package/src/components/Alert/Alert.styled.ts +60 -0
- package/src/components/Alert/Alert.tsx +49 -5
- package/src/components/Alert/Alert.types.ts +10 -0
- package/src/components/Alert/Alert.utils..ts +41 -0
- package/src/components/Button/Button.styled.ts +33 -21
- package/src/components/Button/Button.tsx +1 -5
- package/src/components/Button/Button.types.ts +4 -4
- package/src/components/Button/utils/getHoverStyle.ts +7 -0
- package/src/components/Chip/Chip.styled.ts +6 -4
- package/src/components/Chip/Chip.tsx +1 -1
- package/src/components/Chip/Chip.types.ts +2 -2
- package/src/components/TextField/TextField.style.ts +316 -0
- package/src/components/TextField/TextField.tsx +75 -3
- package/src/components/TextField/TextField.types.ts +38 -0
- package/src/components/TextField/TextFieldIcon.tsx +24 -0
- package/src/components/TextField/index.ts +6 -0
- package/src/components/Toast/Toast.styled.ts +49 -0
- package/src/components/Toast/Toast.tsx +66 -0
- package/src/components/Toast/Toast.types.ts +14 -0
- package/src/components/Toast/Toast.utils.ts +15 -0
- package/src/components/Toast/index.tsx +1 -0
- package/src/components/ToggleButton/ToggleButton.types.ts +4 -7
- package/src/foundation/colors/base/grey.ts +17 -0
- package/src/foundation/colors/base/lunitGreen.ts +2 -2
- package/src/foundation/colors/base/lunitTeal.ts +5 -5
- package/src/foundation/colors/base/red.ts +2 -2
- package/src/foundation/colors/index.ts +29 -8
- package/src/foundation/colors/token/component.ts +300 -326
- package/src/foundation/colors/token/core.ts +152 -145
- package/src/foundation/colors/types.ts +1 -3
- package/src/index.ts +1 -0
- package/src/stories/components/Alert/Alert.stories.tsx +148 -4
- package/src/stories/components/Button/BasicButton.stories.tsx +19 -28
- package/src/stories/components/Button/IconButton.stories.tsx +39 -28
- package/src/stories/components/Button/Kind.stories.tsx +83 -57
- package/src/stories/components/Chip/Chip.stories.tsx +94 -82
- package/src/stories/components/DataTable/DataTable.stories.tsx +6 -4
- package/src/stories/components/DatePicker/DatePicker.stories.tsx +6 -4
- package/src/stories/components/Dropdown/Dropdown.stories.tsx +12 -6
- package/src/stories/components/Modal/Modal.stories.tsx +6 -4
- package/src/stories/components/SelectControl/Checkbox.stories.tsx +31 -23
- package/src/stories/components/SelectControl/RadioGroup.stories.tsx +6 -5
- package/src/stories/components/SelectControl/RadioStatus.stories.tsx +6 -4
- package/src/stories/components/SelectControl/Toggle.stories.tsx +33 -19
- package/src/stories/components/TextField/TextFieldMulti.stories.tsx +137 -0
- package/src/stories/components/TextField/TextFieldSingle.stories.tsx +283 -0
- package/src/stories/components/TextField/TextFieldSize.stories.tsx +134 -0
- package/src/stories/components/Toast/Toast.stories.tsx +152 -0
- package/src/stories/components/ToggleButton/Basic.stories.tsx +35 -31
- package/src/stories/components/ToggleButton/Group.stories.tsx +21 -21
- package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +53 -43
- package/src/stories/components/ToggleButton/WithIcon.stories.tsx +35 -36
- package/src/stories/components/Tooltip/Tooltip.stories.tsx +6 -4
- package/src/stories/foundation/Elevation/Elevation.stories.tsx +10 -6
- package/src/stories/foundation/Typography/{Typography.stories.mdx → Typography.mdx} +10 -5
- package/src/stories/foundation/Typography/Typography.stories.tsx +46 -36
- package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +44 -0
- package/src/stories/foundation/colors/Colors.stories.tsx +7 -5
- package/src/stories/foundation/colors/Mui.stories.tsx +18 -0
- package/src/stories/foundation/colors/Token.inComponent.stories.tsx +2 -2
- package/src/stories/foundation/colors/TokenPaletteTable.stories.tsx +28 -0
- package/src/stories/foundation/colors/TokenPaletteTable.tsx +127 -0
- package/src/theme.ts +5 -0
- package/src/stories/components/TextField/TextField.stories.tsx +0 -13
- package/src/stories/foundation/colors/Token.stories.tsx +0 -190
|
@@ -7,33 +7,32 @@ import {
|
|
|
7
7
|
TableCell,
|
|
8
8
|
} from "@mui/material";
|
|
9
9
|
import { action } from "@storybook/addon-actions";
|
|
10
|
-
import
|
|
10
|
+
import Bell from "@lunit/design-system-icons/Bell";
|
|
11
11
|
|
|
12
12
|
import ToggleButton from "@/components/ToggleButton";
|
|
13
13
|
|
|
14
|
-
import type {
|
|
14
|
+
import type { StoryFn, Meta } from "@storybook/react";
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
17
|
title: "Components/ToggleButton",
|
|
18
18
|
component: ToggleButton,
|
|
19
|
+
args: {
|
|
20
|
+
kind: "contained",
|
|
21
|
+
color: "primary",
|
|
22
|
+
selectedColor: "primary",
|
|
23
|
+
size: "small",
|
|
24
|
+
disabled: false,
|
|
25
|
+
},
|
|
19
26
|
argTypes: {
|
|
20
27
|
icon: {
|
|
21
28
|
control: false,
|
|
22
29
|
description: `Use this prop when you want to add icon.
|
|
23
|
-
\n It is added to the left of the text criteria
|
|
24
|
-
\n and only Icon can be checked when used with hasIconOnly.`,
|
|
30
|
+
\n It is added to the left of the text criteria`,
|
|
25
31
|
table: {
|
|
26
32
|
defaultValue: { summary: "undefined" },
|
|
27
33
|
type: { summary: "React.ReactNode" },
|
|
28
34
|
},
|
|
29
35
|
},
|
|
30
|
-
hasIconOnly: {
|
|
31
|
-
description: `Option to handle so that only icons can be inserted
|
|
32
|
-
\n If set to false, you can add Text.`,
|
|
33
|
-
table: {
|
|
34
|
-
defaultValue: { summary: "false" },
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
36
|
value: {
|
|
38
37
|
control: false,
|
|
39
38
|
table: { type: { summary: "any" } },
|
|
@@ -58,7 +57,6 @@ export default {
|
|
|
58
57
|
type: "radio",
|
|
59
58
|
},
|
|
60
59
|
options: ["primary", "secondary"],
|
|
61
|
-
defaultValue: "primary",
|
|
62
60
|
description: "Button has three Kinds Contained, Ghost",
|
|
63
61
|
table: {
|
|
64
62
|
defaultValue: { summary: "primary" },
|
|
@@ -69,7 +67,6 @@ export default {
|
|
|
69
67
|
type: "radio",
|
|
70
68
|
},
|
|
71
69
|
options: ["contained", "outlined", "ghost"],
|
|
72
|
-
defaultValue: "contained",
|
|
73
70
|
table: {
|
|
74
71
|
defaultValue: { summary: "contained" },
|
|
75
72
|
},
|
|
@@ -81,7 +78,6 @@ export default {
|
|
|
81
78
|
control: {
|
|
82
79
|
type: "boolean",
|
|
83
80
|
},
|
|
84
|
-
defaultValue: false,
|
|
85
81
|
table: {
|
|
86
82
|
defaultValue: { summary: "false" },
|
|
87
83
|
},
|
|
@@ -91,7 +87,6 @@ export default {
|
|
|
91
87
|
type: "radio",
|
|
92
88
|
},
|
|
93
89
|
options: ["small", "medium", "large"],
|
|
94
|
-
defaultValue: "small",
|
|
95
90
|
table: {
|
|
96
91
|
defaultValue: { summary: "small" },
|
|
97
92
|
},
|
|
@@ -106,7 +101,6 @@ export default {
|
|
|
106
101
|
function: action("onClick"),
|
|
107
102
|
undefined: undefined,
|
|
108
103
|
},
|
|
109
|
-
defaultValue: "function",
|
|
110
104
|
description:
|
|
111
105
|
"It is a callback function that is called when the button is clicked.",
|
|
112
106
|
},
|
|
@@ -118,13 +112,8 @@ export default {
|
|
|
118
112
|
function: action("onChange"),
|
|
119
113
|
undefined: undefined,
|
|
120
114
|
},
|
|
121
|
-
defaultValue: "function",
|
|
122
115
|
},
|
|
123
116
|
},
|
|
124
|
-
args: {
|
|
125
|
-
selected: true,
|
|
126
|
-
kind: "contained",
|
|
127
|
-
},
|
|
128
117
|
parameters: {
|
|
129
118
|
controls: {
|
|
130
119
|
include: [
|
|
@@ -148,9 +137,9 @@ export default {
|
|
|
148
137
|
},
|
|
149
138
|
},
|
|
150
139
|
},
|
|
151
|
-
} as
|
|
140
|
+
} as Meta<typeof ToggleButton>;
|
|
152
141
|
|
|
153
|
-
const Template:
|
|
142
|
+
const Template: StoryFn<typeof ToggleButton> = (arg) => {
|
|
154
143
|
const [values, setValues] = useState({
|
|
155
144
|
primary: true,
|
|
156
145
|
secondary: true,
|
|
@@ -212,16 +201,23 @@ const Template: ComponentStory<typeof ToggleButton> = (arg) => {
|
|
|
212
201
|
);
|
|
213
202
|
};
|
|
214
203
|
|
|
215
|
-
export const IconStory =
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
204
|
+
export const IconStory = {
|
|
205
|
+
render: Template,
|
|
206
|
+
name: "Icon",
|
|
207
|
+
|
|
208
|
+
args: {
|
|
209
|
+
children: "Text",
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
argTypes: {
|
|
213
|
+
children: {
|
|
214
|
+
type: "string",
|
|
215
|
+
defaultValue: "text",
|
|
216
|
+
},
|
|
221
217
|
},
|
|
222
218
|
};
|
|
223
219
|
|
|
224
|
-
const IconOnlyTemplate:
|
|
220
|
+
const IconOnlyTemplate: StoryFn<typeof ToggleButton> = (arg) => {
|
|
225
221
|
const [values, setValues] = useState({
|
|
226
222
|
primary: true,
|
|
227
223
|
secondary: true,
|
|
@@ -283,11 +279,14 @@ const IconOnlyTemplate: ComponentStory<typeof ToggleButton> = (arg) => {
|
|
|
283
279
|
);
|
|
284
280
|
};
|
|
285
281
|
|
|
286
|
-
export const WithIconOnlyStory =
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
282
|
+
export const WithIconOnlyStory = {
|
|
283
|
+
render: IconOnlyTemplate,
|
|
284
|
+
name: "Icon only",
|
|
285
|
+
|
|
286
|
+
argTypes: {
|
|
287
|
+
children: {
|
|
288
|
+
type: "string",
|
|
289
|
+
controls: false,
|
|
290
|
+
},
|
|
292
291
|
},
|
|
293
292
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { StoryFn, Meta } from "@storybook/react";
|
|
3
3
|
|
|
4
4
|
import Tooltip from "@/components/Tooltip";
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
title: "Components/Tooltip",
|
|
8
8
|
component: Tooltip,
|
|
9
|
-
} as
|
|
9
|
+
} as Meta<typeof Tooltip>;
|
|
10
10
|
|
|
11
|
-
const Template:
|
|
11
|
+
const Template: StoryFn<typeof Tooltip> = () => <Tooltip />;
|
|
12
12
|
|
|
13
|
-
export const LunitChip =
|
|
13
|
+
export const LunitChip = {
|
|
14
|
+
render: Template,
|
|
15
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { StoryFn, Meta } from "@storybook/react";
|
|
3
3
|
import {
|
|
4
4
|
Alert,
|
|
5
5
|
Box,
|
|
@@ -248,17 +248,21 @@ export default {
|
|
|
248
248
|
},
|
|
249
249
|
},
|
|
250
250
|
},
|
|
251
|
-
} as
|
|
251
|
+
} as Meta<typeof Elevation>;
|
|
252
252
|
|
|
253
|
-
const ElevationBase:
|
|
253
|
+
const ElevationBase: StoryFn<typeof Elevation> = (
|
|
254
254
|
args,
|
|
255
255
|
{ globals: { theme } }
|
|
256
256
|
) => <Elevation {...args} surface={theme} isBase />;
|
|
257
257
|
|
|
258
|
-
const ElevationNesed:
|
|
258
|
+
const ElevationNesed: StoryFn<typeof Elevation> = (
|
|
259
259
|
args,
|
|
260
260
|
{ globals: { theme } }
|
|
261
261
|
) => <Elevation {...args} surface={theme} />;
|
|
262
262
|
|
|
263
|
-
export const Base =
|
|
264
|
-
|
|
263
|
+
export const Base = {
|
|
264
|
+
render: ElevationBase,
|
|
265
|
+
};
|
|
266
|
+
export const Nested = {
|
|
267
|
+
render: ElevationNesed,
|
|
268
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Meta, Canvas, Story } from "@storybook/
|
|
1
|
+
import { Meta, Canvas, Story } from "@storybook/blocks";
|
|
2
|
+
import * as TypographyStories from "./TypographyExamples.stories";
|
|
2
3
|
|
|
3
4
|
import { Typography } from "@mui/material";
|
|
4
5
|
|
|
@@ -6,7 +7,7 @@ import { variants } from "./const";
|
|
|
6
7
|
|
|
7
8
|
import TypographyGroup from "./TypographyGroup";
|
|
8
9
|
|
|
9
|
-
<Meta
|
|
10
|
+
<Meta of={TypographyStories} />
|
|
10
11
|
|
|
11
12
|
export const Template = (args) => <Typography {...args} />;
|
|
12
13
|
|
|
@@ -42,15 +43,15 @@ export const AllVariants = () => (
|
|
|
42
43
|
</>
|
|
43
44
|
);
|
|
44
45
|
|
|
45
|
-
<Story
|
|
46
|
-
<AllVariants />
|
|
47
|
-
</Story>
|
|
46
|
+
<Story of={TypographyStories.AllVariants_} />
|
|
48
47
|
|
|
49
48
|
## Usage
|
|
50
49
|
|
|
51
50
|
### Typography component
|
|
52
51
|
|
|
53
52
|
<Canvas>
|
|
53
|
+
{/* <Story id="foundation-typography--typography-component" /> is deprecated, please migrate it to <Story of={referenceToStory} /> see: https://storybook.js.org/migration-guides/7.0 */}
|
|
54
|
+
|
|
54
55
|
<Story id="foundation-typography--typography-component" />
|
|
55
56
|
</Canvas>
|
|
56
57
|
|
|
@@ -59,6 +60,8 @@ export const AllVariants = () => (
|
|
|
59
60
|
In some situations you might not be able to use the Typography component. Hopefully, you might be able to take advantage of the [typography](https://mui.com/material-ui/react-typography/#theme) keys of the theme.
|
|
60
61
|
|
|
61
62
|
<Canvas>
|
|
63
|
+
{/* <Story id="foundation-typography--styled" /> is deprecated, please migrate it to <Story of={referenceToStory} /> see: https://storybook.js.org/migration-guides/7.0 */}
|
|
64
|
+
|
|
62
65
|
<Story id="foundation-typography--styled" />
|
|
63
66
|
</Canvas>
|
|
64
67
|
|
|
@@ -67,5 +70,7 @@ In some situations you might not be able to use the Typography component. Hopefu
|
|
|
67
70
|
You can use all the variants with [the `sx` props](https://mui.com/system/getting-started/the-sx-prop/#typography).
|
|
68
71
|
|
|
69
72
|
<Canvas>
|
|
73
|
+
{/* <Story id="foundation-typography--sx-props" /> is deprecated, please migrate it to <Story of={referenceToStory} /> see: https://storybook.js.org/migration-guides/7.0 */}
|
|
74
|
+
|
|
70
75
|
<Story id="foundation-typography--sx-props" />
|
|
71
76
|
</Canvas>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { StoryFn } from "@storybook/react";
|
|
4
4
|
import { Box, Typography } from "@mui/material";
|
|
5
5
|
import { styled } from "@mui/material/styles";
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const TypographyTemplate:
|
|
20
|
+
const TypographyTemplate: StoryFn<typeof Typography> = (args) => {
|
|
21
21
|
const { variant, children } = args;
|
|
22
22
|
return (
|
|
23
23
|
<Typography variant={variant} sx={{ whiteSpace: "pre-line" }}>
|
|
@@ -26,35 +26,41 @@ const TypographyTemplate: ComponentStory<typeof Typography> = (args) => {
|
|
|
26
26
|
);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export const TypographyComponent =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
export const TypographyComponent = {
|
|
30
|
+
render: TypographyTemplate,
|
|
31
|
+
|
|
32
|
+
args: {
|
|
33
|
+
variant: "body1_16_regular",
|
|
34
|
+
children:
|
|
35
|
+
"AI will be the new standard of care. 123456789\nBy Lunit. With AI, we aim to make data-driven medicine\nthe new standard of care.",
|
|
36
|
+
},
|
|
34
37
|
};
|
|
35
38
|
|
|
36
|
-
const SXTemplate:
|
|
39
|
+
const SXTemplate: StoryFn<typeof Typography> = (args) => {
|
|
37
40
|
const { variant, children } = args;
|
|
38
41
|
return (
|
|
39
42
|
<Box sx={{ typography: variant, whiteSpace: "pre-line" }}>{children}</Box>
|
|
40
43
|
);
|
|
41
44
|
};
|
|
42
45
|
|
|
43
|
-
export const SXProps =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
export const SXProps = {
|
|
47
|
+
render: SXTemplate,
|
|
48
|
+
|
|
49
|
+
args: {
|
|
50
|
+
variant: "body1_16_regular",
|
|
51
|
+
children:
|
|
52
|
+
"AI will be the new standard of care. 123456789\nBy Lunit. With AI, we aim to make data-driven medicine\nthe new standard of care.",
|
|
53
|
+
},
|
|
48
54
|
};
|
|
49
55
|
|
|
50
56
|
const StyledBox = styled(Box, {
|
|
51
57
|
shouldForwardProp: (prop) => !["variant"].includes(prop.toString()),
|
|
52
|
-
})<{ variant: typeof variantArray[number] }>(({ theme, variant }) => ({
|
|
58
|
+
})<{ variant: (typeof variantArray)[number] }>(({ theme, variant }) => ({
|
|
53
59
|
...theme.typography[variant],
|
|
54
60
|
whiteSpace: "pre-line",
|
|
55
61
|
}));
|
|
56
62
|
|
|
57
|
-
const StyledTemplate:
|
|
63
|
+
const StyledTemplate: StoryFn<typeof StyledBox> = (args) => {
|
|
58
64
|
/**
|
|
59
65
|
const StyledBox = styled(Box)(({ theme }) => ({
|
|
60
66
|
...theme.typography.body1_16_regular,
|
|
@@ -65,27 +71,31 @@ const StyledBox = styled(Box)(({ theme }) => ({
|
|
|
65
71
|
return <StyledBox variant={variant}>{children}</StyledBox>;
|
|
66
72
|
};
|
|
67
73
|
|
|
68
|
-
export const Styled =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
82
|
-
...
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
export const Styled = {
|
|
75
|
+
render: StyledTemplate,
|
|
76
|
+
|
|
77
|
+
args: {
|
|
78
|
+
variant: "body1_16_regular",
|
|
79
|
+
children:
|
|
80
|
+
"AI will be the new standard of care. 123456789\nBy Lunit. With AI, we aim to make data-driven medicine\nthe new standard of care.",
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
parameters: {
|
|
84
|
+
docs: {
|
|
85
|
+
source: {
|
|
86
|
+
code: `
|
|
87
|
+
const StyledBox = styled(Box)(({ theme }) => ({
|
|
88
|
+
...theme.typography.body1_16_regular,
|
|
89
|
+
whiteSpace: "pre-line",
|
|
90
|
+
}));
|
|
91
|
+
...
|
|
92
|
+
return (
|
|
93
|
+
<StyledBox>AI will be the new standard of care. 123456789\nBy Lunit. With AI, we aim to make data-driven medicine\nthe new standard of care.</StyledBox>
|
|
94
|
+
);
|
|
95
|
+
`,
|
|
96
|
+
language: "tsx",
|
|
97
|
+
type: "code",
|
|
98
|
+
},
|
|
89
99
|
},
|
|
90
100
|
},
|
|
91
101
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Typography } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
import { variants } from "./const";
|
|
5
|
+
|
|
6
|
+
import TypographyGroup from "./TypographyGroup";
|
|
7
|
+
|
|
8
|
+
const AllVariants = () => (
|
|
9
|
+
<>
|
|
10
|
+
<TypographyGroup
|
|
11
|
+
heading="Headline"
|
|
12
|
+
dummy="Headline 123456789"
|
|
13
|
+
variants={variants.headline}
|
|
14
|
+
/>
|
|
15
|
+
<TypographyGroup
|
|
16
|
+
heading="Body"
|
|
17
|
+
dummy={
|
|
18
|
+
<>
|
|
19
|
+
AI will be the new standard of care. 123456789
|
|
20
|
+
<br />
|
|
21
|
+
By Lunit. With AI, we aim to make data-driven medicine
|
|
22
|
+
<br />
|
|
23
|
+
the new standard of care.
|
|
24
|
+
</>
|
|
25
|
+
}
|
|
26
|
+
variants={variants.body}
|
|
27
|
+
/>
|
|
28
|
+
<TypographyGroup
|
|
29
|
+
heading="etc"
|
|
30
|
+
dummy="NEWS & UPDATE 71456"
|
|
31
|
+
variants={variants.etc}
|
|
32
|
+
/>
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
title: "Foundation/Typography/All Variants",
|
|
38
|
+
component: Typography,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const AllVariants_ = {
|
|
42
|
+
render: () => <AllVariants />,
|
|
43
|
+
name: "all variants",
|
|
44
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { StoryFn, Meta } from "@storybook/react";
|
|
3
3
|
import { Typography, useTheme } from "@mui/material";
|
|
4
4
|
import { Color, ColorContainer, Container, PaletteContainer } from "./styled";
|
|
5
5
|
import map from "lodash/map";
|
|
@@ -55,10 +55,12 @@ export default {
|
|
|
55
55
|
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
56
56
|
title: "Foundation/Colors",
|
|
57
57
|
component: BaseColors,
|
|
58
|
-
} as
|
|
58
|
+
} as Meta<typeof BaseColors>;
|
|
59
59
|
|
|
60
60
|
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
61
|
-
const BaseTemplate:
|
|
61
|
+
const BaseTemplate: StoryFn<typeof BaseColors> = () => <BaseColors />;
|
|
62
62
|
|
|
63
|
-
export const
|
|
64
|
-
|
|
63
|
+
export const GlobalColors = {
|
|
64
|
+
render: BaseTemplate,
|
|
65
|
+
name: "Palette: Global Colors",
|
|
66
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StoryFn, Meta } from "@storybook/react";
|
|
3
|
+
import Pagination from "@mui/material/Pagination";
|
|
4
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
8
|
+
title: "Foundation/Colors/Mui",
|
|
9
|
+
component: Pagination,
|
|
10
|
+
} as Meta<typeof Pagination>;
|
|
11
|
+
|
|
12
|
+
export const MuiPagenation: StoryFn<typeof Pagination> = () => (
|
|
13
|
+
<Pagination count={10} color="primary" />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const MuiIcon: StoryFn<typeof DeleteIcon> = () => (
|
|
17
|
+
<DeleteIcon color="primary" />
|
|
18
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Meta } from "@storybook/react";
|
|
3
3
|
import { Box, styled, TextField, Typography, useTheme } from "@mui/material";
|
|
4
4
|
|
|
5
5
|
export const InComponentWithStyled = () => {
|
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
</div>
|
|
39
39
|
),
|
|
40
40
|
],
|
|
41
|
-
} as
|
|
41
|
+
} as Meta<typeof InComponentWithStyled>;
|
|
42
42
|
|
|
43
43
|
export const InComponentWithSx = () => {
|
|
44
44
|
return (
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
import TokenPaletteTable from "./TokenPaletteTable";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Foundation/Colors",
|
|
6
|
+
component: TokenPaletteTable,
|
|
7
|
+
parameters: {
|
|
8
|
+
controls: {
|
|
9
|
+
exclude: /.*/g,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
} as Meta<typeof TokenPaletteTable>;
|
|
13
|
+
|
|
14
|
+
export const CoreTokens = {
|
|
15
|
+
args: {
|
|
16
|
+
kind: "core",
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
name: "Palette: Core Tokens",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const ComponentTokens = {
|
|
23
|
+
args: {
|
|
24
|
+
kind: "component",
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
name: "Palette: Component Tokens",
|
|
28
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Table,
|
|
5
|
+
TableHead,
|
|
6
|
+
TableRow,
|
|
7
|
+
TableBody,
|
|
8
|
+
TableContainer,
|
|
9
|
+
TableCell,
|
|
10
|
+
useTheme,
|
|
11
|
+
SxProps,
|
|
12
|
+
} from "@mui/material";
|
|
13
|
+
import { StyledTypography } from "./styled";
|
|
14
|
+
import { tokenCoreColor } from "@/foundation/colors/token/core";
|
|
15
|
+
import { tokenComponentColor } from "@/foundation/colors/token/component";
|
|
16
|
+
|
|
17
|
+
import type { ColorToken } from "@/foundation/colors/types";
|
|
18
|
+
import type { ColorTokenValueBySurface } from "@/foundation/colors/token/types";
|
|
19
|
+
|
|
20
|
+
interface TokenPaletteTableProps {
|
|
21
|
+
kind: keyof ColorToken;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const TokenPaletteTable = ({ kind }: TokenPaletteTableProps) => {
|
|
25
|
+
const theme = useTheme();
|
|
26
|
+
|
|
27
|
+
const colorTokenMap = Object.entries(
|
|
28
|
+
kind === "core" ? theme.palette.token.core : theme.palette.token.component
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const TokenPaletteCell = (props: {
|
|
32
|
+
surface: keyof ColorTokenValueBySurface;
|
|
33
|
+
paletteKey: string;
|
|
34
|
+
sx?: SxProps;
|
|
35
|
+
}) => {
|
|
36
|
+
const { surface, paletteKey, sx } = props;
|
|
37
|
+
|
|
38
|
+
const tokenComponentColorFlatten = Object.values(
|
|
39
|
+
tokenComponentColor
|
|
40
|
+
).reduce((acc, cur) => {
|
|
41
|
+
return { ...acc, ...cur };
|
|
42
|
+
}, {});
|
|
43
|
+
|
|
44
|
+
const boxColorByToken =
|
|
45
|
+
kind === "core"
|
|
46
|
+
? theme.palette.token.core[paletteKey as keyof ColorToken["core"]]
|
|
47
|
+
: theme.palette.token.component[
|
|
48
|
+
paletteKey as keyof ColorToken["component"]
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
const globalColorByToken =
|
|
52
|
+
kind === "core"
|
|
53
|
+
? tokenCoreColor[paletteKey]
|
|
54
|
+
: tokenComponentColorFlatten[paletteKey];
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<TableCell
|
|
58
|
+
className={surface}
|
|
59
|
+
sx={{
|
|
60
|
+
background: theme.palette.token.core.bg_01,
|
|
61
|
+
padding: 0,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<Box
|
|
65
|
+
sx={{
|
|
66
|
+
background: boxColorByToken,
|
|
67
|
+
borderTop: "1px solid",
|
|
68
|
+
borderBottom: "1px solid",
|
|
69
|
+
borderColor: "rgba(0, 0, 0, 0.12)",
|
|
70
|
+
height: "12px",
|
|
71
|
+
...sx,
|
|
72
|
+
}}
|
|
73
|
+
></Box>
|
|
74
|
+
<StyledTypography>{globalColorByToken[surface]}</StyledTypography>
|
|
75
|
+
</TableCell>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<TableContainer>
|
|
81
|
+
<Table stickyHeader>
|
|
82
|
+
<TableHead>
|
|
83
|
+
<TableRow>
|
|
84
|
+
<TableCell colSpan={2}> </TableCell>
|
|
85
|
+
<TableCell colSpan={2}>Light</TableCell>
|
|
86
|
+
<TableCell colSpan={4}>Dark</TableCell>
|
|
87
|
+
</TableRow>
|
|
88
|
+
<TableRow>
|
|
89
|
+
<TableCell>Token name</TableCell>
|
|
90
|
+
<TableCell>Light 1</TableCell>
|
|
91
|
+
<TableCell>Light 2</TableCell>
|
|
92
|
+
<TableCell>Dark 1</TableCell>
|
|
93
|
+
<TableCell>Dark 2</TableCell>
|
|
94
|
+
<TableCell>Dark 3</TableCell>
|
|
95
|
+
<TableCell>Dark 4</TableCell>
|
|
96
|
+
</TableRow>
|
|
97
|
+
</TableHead>
|
|
98
|
+
<TableBody>
|
|
99
|
+
{colorTokenMap.map(([paletteKey, _colorVariable]) => (
|
|
100
|
+
<TableRow key={paletteKey}>
|
|
101
|
+
<TableCell sx={{ height: "72px" }}>
|
|
102
|
+
<StyledTypography>
|
|
103
|
+
{kind}.{paletteKey}
|
|
104
|
+
</StyledTypography>
|
|
105
|
+
</TableCell>
|
|
106
|
+
<TokenPaletteCell
|
|
107
|
+
surface="light1"
|
|
108
|
+
paletteKey={paletteKey}
|
|
109
|
+
sx={{
|
|
110
|
+
borderLeft: "1px solid",
|
|
111
|
+
borderLeftColor: "rgba(0, 0, 0, 0.12)",
|
|
112
|
+
}}
|
|
113
|
+
/>
|
|
114
|
+
<TokenPaletteCell surface="light2" paletteKey={paletteKey} />
|
|
115
|
+
<TokenPaletteCell surface="dark1" paletteKey={paletteKey} />
|
|
116
|
+
<TokenPaletteCell surface="dark2" paletteKey={paletteKey} />
|
|
117
|
+
<TokenPaletteCell surface="dark3" paletteKey={paletteKey} />
|
|
118
|
+
<TokenPaletteCell surface="dark4" paletteKey={paletteKey} />
|
|
119
|
+
</TableRow>
|
|
120
|
+
))}
|
|
121
|
+
</TableBody>
|
|
122
|
+
</Table>
|
|
123
|
+
</TableContainer>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export default TokenPaletteTable;
|
package/src/theme.ts
CHANGED
|
@@ -34,6 +34,11 @@ const theme = createTheme({
|
|
|
34
34
|
MuiTypography: {
|
|
35
35
|
defaultProps: typographyDefaultProps,
|
|
36
36
|
},
|
|
37
|
+
MuiButtonBase: {
|
|
38
|
+
defaultProps: {
|
|
39
|
+
disableRipple: true, // No more ripple, on the whole application 💣!
|
|
40
|
+
},
|
|
41
|
+
},
|
|
37
42
|
// @todo add any MUI components theme exported from ./components/index.ts
|
|
38
43
|
},
|
|
39
44
|
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
-
|
|
4
|
-
import TextField from "@/components/TextField";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "Components/TextField",
|
|
8
|
-
component: TextField,
|
|
9
|
-
} as ComponentMeta<typeof TextField>;
|
|
10
|
-
|
|
11
|
-
const Template: ComponentStory<typeof TextField> = () => <TextField />;
|
|
12
|
-
|
|
13
|
-
export const LunitTextField = Template.bind({});
|