@lunit/design-system 1.0.0 → 2.0.1
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/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/Checkbox/index.js +1 -1
- package/dist/cjs/components/Checkbox/index.js.map +1 -1
- package/dist/cjs/components/Dialog/index.js +2 -0
- package/dist/cjs/components/Dialog/index.js.map +1 -0
- package/dist/cjs/components/Radio/index.js +1 -1
- package/dist/cjs/components/Radio/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/Button/Button.styled.js +1 -1
- package/dist/components/Button/Button.styled.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +9 -19
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Dialog/Dialog.js +57 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/Dialog.styled.js +146 -0
- package/dist/components/Dialog/Dialog.styled.js.map +1 -0
- package/dist/components/Dialog/components/DialogAction.js +18 -0
- package/dist/components/Dialog/components/DialogAction.js.map +1 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/Dialog/index.js.map +1 -0
- package/dist/components/Radio/Radio.js +7 -21
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.styled.js +1 -1
- package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -1
- package/dist/foundation/Elevation/index.js +1 -1
- package/dist/foundation/Elevation/index.js.map +1 -1
- package/dist/foundation/Typography/index.js +0 -6
- package/dist/foundation/Typography/index.js.map +1 -1
- package/dist/foundation/Typography/tokens.js +1 -1
- package/dist/foundation/colors/base/grey.js +3 -1
- package/dist/foundation/colors/base/grey.js.map +1 -1
- package/dist/foundation/colors/index.js +5 -6
- package/dist/foundation/colors/index.js.map +1 -1
- package/dist/foundation/colors/token/component.js +31 -115
- package/dist/foundation/colors/token/component.js.map +1 -1
- package/dist/foundation/colors/token/core.js +43 -75
- package/dist/foundation/colors/token/core.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/components/Alert/Alert.utils.d.ts +3 -3
- package/dist/types/components/Button/Button.styled.d.ts +8 -8
- package/dist/types/components/Chip/Chip.styled.d.ts +12 -12
- package/dist/types/components/Dialog/Dialog.d.ts +50 -0
- package/dist/types/components/Dialog/Dialog.styled.d.ts +12 -0
- package/dist/types/components/Dialog/components/DialogAction.d.ts +8 -0
- package/dist/types/components/Dialog/index.d.ts +2 -0
- package/dist/types/components/Toast/Toast.utils.d.ts +1 -1
- package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -2
- package/dist/types/foundation/Elevation/index.d.ts +1 -1
- package/dist/types/foundation/Typography/index.d.ts +1 -7
- package/dist/types/foundation/Typography/tokens.d.ts +1 -1
- package/dist/types/foundation/colors/base/grey.d.ts +2 -0
- package/dist/types/foundation/colors/index.d.ts +5 -6
- package/dist/types/foundation/colors/token/types.d.ts +0 -2
- package/dist/types/foundation/colors/types.d.ts +78 -76
- package/dist/types/foundation/index.d.ts +5 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.styled.ts +1 -1
- package/src/components/Checkbox/Checkbox.tsx +39 -22
- package/src/components/Dialog/Dialog.styled.ts +172 -0
- package/src/components/Dialog/Dialog.tsx +189 -0
- package/src/components/Dialog/components/DialogAction.tsx +36 -0
- package/src/components/Dialog/index.ts +14 -0
- package/src/components/Radio/Radio.tsx +37 -25
- package/src/components/ToggleButton/ToggleButton.styled.ts +1 -1
- package/src/foundation/Elevation/index.ts +1 -1
- package/src/foundation/Typography/index.ts +0 -6
- package/src/foundation/Typography/tokens.ts +1 -1
- package/src/foundation/colors/base/grey.ts +3 -1
- package/src/foundation/colors/index.ts +5 -6
- package/src/foundation/colors/token/component.ts +26 -110
- package/src/foundation/colors/token/core.ts +39 -71
- package/src/foundation/colors/token/types.ts +0 -2
- package/src/foundation/colors/types.ts +78 -75
- package/src/index.ts +1 -1
- package/src/stories/GettingStarted.mdx +88 -0
- package/src/stories/components/Button/BasicButton.stories.tsx +80 -52
- package/src/stories/components/Button/ButtonDocs.mdx +187 -0
- package/src/stories/components/Button/Color.stories.tsx +132 -0
- package/src/stories/components/Button/IconButton.stories.tsx +41 -35
- package/src/stories/components/Button/Kind.stories.tsx +13 -52
- package/src/stories/components/{SelectControl/Checkbox.stories.tsx → CheckBox/BasicCheckbox.stories.tsx} +84 -105
- package/src/stories/components/CheckBox/CheckboxDocs.mdx +85 -0
- package/src/stories/components/Chip/Chip.stories.tsx +65 -0
- package/src/stories/components/Chip/ChipDocs.mdx +132 -0
- package/src/stories/components/Dialog/Dialog.stories.tsx +320 -0
- package/src/stories/components/Dialog/DialogDocs.mdx +181 -0
- package/src/stories/components/TextField/BasicTextField.stories.tsx +214 -0
- package/src/stories/components/TextField/TextFieldDocs.mdx +140 -0
- package/src/stories/components/TextField/TextFieldSize.stories.tsx +26 -3
- package/src/stories/components/ToggleButton/Basic.stories.tsx +312 -0
- package/src/stories/components/ToggleButton/ToggleButtonDocs.mdx +180 -0
- package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +65 -0
- package/src/stories/components/ToggleButton/WithIcon.stories.tsx +138 -0
- package/src/stories/foundation/Typography/Typography.mdx +31 -46
- package/src/stories/foundation/Typography/Typography.stories.tsx +30 -1
- package/src/stories/foundation/colors/ColorSystem.tsx +86 -0
- package/src/stories/foundation/colors/Docs.mdx +225 -0
- package/src/stories/foundation/colors/TokenPaletteTable.tsx +1 -5
- package/src/components/Modal/Modal.tsx +0 -8
- package/src/components/Modal/index.ts +0 -1
- package/src/stories/components/Modal/Modal.stories.tsx +0 -15
- package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +0 -44
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
TableRow,
|
|
6
6
|
TableBody,
|
|
7
7
|
TableCell,
|
|
8
|
+
Box,
|
|
8
9
|
} from "@mui/material";
|
|
9
10
|
import { action } from "@storybook/addon-actions";
|
|
10
11
|
import Bell from "@lunit/design-system-icons/Bell";
|
|
@@ -217,6 +218,76 @@ export const IconStory = {
|
|
|
217
218
|
},
|
|
218
219
|
};
|
|
219
220
|
|
|
221
|
+
const IconDocsTemplate: StoryFn<typeof ToggleButton> = (arg) => {
|
|
222
|
+
const [values, setValues] = useState({
|
|
223
|
+
contained: false,
|
|
224
|
+
outlined: false,
|
|
225
|
+
ghost: false,
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
const handleChange = (value: keyof typeof values) => {
|
|
229
|
+
setValues({
|
|
230
|
+
...values,
|
|
231
|
+
[value]: !values[value],
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
return (
|
|
236
|
+
<Box sx={{ "& button": { marginRight: 2 } }}>
|
|
237
|
+
<ToggleButton
|
|
238
|
+
{...arg}
|
|
239
|
+
icon={<Bell />}
|
|
240
|
+
value="contained"
|
|
241
|
+
onChange={() => handleChange("contained")}
|
|
242
|
+
selected={values.contained}
|
|
243
|
+
>
|
|
244
|
+
Contained
|
|
245
|
+
</ToggleButton>
|
|
246
|
+
<ToggleButton
|
|
247
|
+
{...arg}
|
|
248
|
+
icon={<Bell />}
|
|
249
|
+
kind="outlined"
|
|
250
|
+
color="primary"
|
|
251
|
+
value="outlined"
|
|
252
|
+
onChange={() => handleChange("outlined")}
|
|
253
|
+
selected={values.outlined}
|
|
254
|
+
>
|
|
255
|
+
Outlined
|
|
256
|
+
</ToggleButton>
|
|
257
|
+
<ToggleButton
|
|
258
|
+
{...arg}
|
|
259
|
+
icon={<Bell />}
|
|
260
|
+
kind="ghost"
|
|
261
|
+
value="ghost"
|
|
262
|
+
onChange={() => handleChange("ghost")}
|
|
263
|
+
selected={values.ghost}
|
|
264
|
+
>
|
|
265
|
+
Ghost
|
|
266
|
+
</ToggleButton>
|
|
267
|
+
</Box>
|
|
268
|
+
);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export const IconDocs = {
|
|
272
|
+
render: IconDocsTemplate,
|
|
273
|
+
name: "Icon Docs",
|
|
274
|
+
args: {
|
|
275
|
+
children: "Text",
|
|
276
|
+
},
|
|
277
|
+
argTypes: {
|
|
278
|
+
children: {
|
|
279
|
+
type: "string",
|
|
280
|
+
defaultValue: "text",
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
parameters: {
|
|
284
|
+
chromatic: { disableSnapshot: true },
|
|
285
|
+
controls: {
|
|
286
|
+
include: ["color", "size", "disabled", "children"],
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
|
|
220
291
|
const IconOnlyTemplate: StoryFn<typeof ToggleButton> = (arg) => {
|
|
221
292
|
const [values, setValues] = useState({
|
|
222
293
|
primary: true,
|
|
@@ -290,3 +361,70 @@ export const WithIconOnlyStory = {
|
|
|
290
361
|
},
|
|
291
362
|
},
|
|
292
363
|
};
|
|
364
|
+
|
|
365
|
+
const IconOnlyDocsTemplate: StoryFn<typeof ToggleButton> = (arg) => {
|
|
366
|
+
const { children, ...restArg } = arg;
|
|
367
|
+
|
|
368
|
+
const [values, setValues] = useState({
|
|
369
|
+
contained: false,
|
|
370
|
+
outlined: false,
|
|
371
|
+
ghost: false,
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
const handleChange = (value: keyof typeof values) => {
|
|
375
|
+
setValues({
|
|
376
|
+
...values,
|
|
377
|
+
[value]: !values[value],
|
|
378
|
+
});
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
return (
|
|
382
|
+
<Box sx={{ "& button": { marginRight: 2 } }}>
|
|
383
|
+
<ToggleButton
|
|
384
|
+
{...restArg}
|
|
385
|
+
icon={<Bell />}
|
|
386
|
+
value="contained"
|
|
387
|
+
onChange={() => handleChange("contained")}
|
|
388
|
+
selected={values.contained}
|
|
389
|
+
/>
|
|
390
|
+
<ToggleButton
|
|
391
|
+
{...restArg}
|
|
392
|
+
icon={<Bell />}
|
|
393
|
+
kind="outlined"
|
|
394
|
+
color="primary"
|
|
395
|
+
value="outlined"
|
|
396
|
+
onChange={() => handleChange("outlined")}
|
|
397
|
+
selected={values.outlined}
|
|
398
|
+
/>
|
|
399
|
+
|
|
400
|
+
<ToggleButton
|
|
401
|
+
{...restArg}
|
|
402
|
+
icon={<Bell />}
|
|
403
|
+
kind="ghost"
|
|
404
|
+
value="ghost"
|
|
405
|
+
onChange={() => handleChange("ghost")}
|
|
406
|
+
selected={values.ghost}
|
|
407
|
+
/>
|
|
408
|
+
</Box>
|
|
409
|
+
);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
export const IconOnlyDocs = {
|
|
413
|
+
render: IconOnlyDocsTemplate,
|
|
414
|
+
name: "Icon Only Docs",
|
|
415
|
+
args: {
|
|
416
|
+
children: "Text",
|
|
417
|
+
},
|
|
418
|
+
argTypes: {
|
|
419
|
+
children: {
|
|
420
|
+
type: "string",
|
|
421
|
+
defaultValue: "text",
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
parameters: {
|
|
425
|
+
chromatic: { disableSnapshot: true },
|
|
426
|
+
controls: {
|
|
427
|
+
include: ["color", "size", "disabled", "children"],
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, Canvas, Story } from "@storybook/blocks";
|
|
2
|
-
import * as TypographyStories from "./
|
|
2
|
+
import * as TypographyStories from "./Typography.stories";
|
|
3
3
|
|
|
4
4
|
import Typography from "@/components/Typography";
|
|
5
5
|
|
|
@@ -7,70 +7,55 @@ import { variants } from "./const";
|
|
|
7
7
|
|
|
8
8
|
import TypographyGroup from "./TypographyGroup";
|
|
9
9
|
|
|
10
|
-
<Meta of={TypographyStories} />
|
|
10
|
+
<Meta name="Typography Docs" of={TypographyStories} />
|
|
11
11
|
|
|
12
12
|
export const Template = (args) => <Typography {...args} />;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
# Typography
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Use typography to present your design and content as clearly and efficiently as possible.
|
|
17
17
|
|
|
18
|
-
export const AllVariants = () => (
|
|
19
|
-
<>
|
|
20
|
-
<TypographyGroup
|
|
21
|
-
heading="Headline"
|
|
22
|
-
dummy="Headline 123456789"
|
|
23
|
-
variants={variants.headline}
|
|
24
|
-
/>
|
|
25
|
-
<TypographyGroup
|
|
26
|
-
heading="Body"
|
|
27
|
-
dummy={
|
|
28
|
-
<>
|
|
29
|
-
AI will be the new standard of care. 123456789
|
|
30
|
-
<br />
|
|
31
|
-
By Lunit. With AI, we aim to make data-driven medicine
|
|
32
|
-
<br />
|
|
33
|
-
the new standard of care.
|
|
34
|
-
</>
|
|
35
|
-
}
|
|
36
|
-
variants={variants.body}
|
|
37
|
-
/>
|
|
38
|
-
<TypographyGroup
|
|
39
|
-
heading="etc"
|
|
40
|
-
dummy="NEWS & UPDATE 71456"
|
|
41
|
-
variants={variants.etc}
|
|
42
|
-
/>
|
|
43
|
-
</>
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
<Story of={TypographyStories.AllVariants_} />
|
|
47
18
|
|
|
48
19
|
## Usage
|
|
49
20
|
|
|
50
|
-
### Typography
|
|
21
|
+
### Basic Typography
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { Typography } from "@lunit/design-system";
|
|
25
|
+
// or
|
|
26
|
+
import Typography from "@lunit/design-system/Typography";
|
|
51
27
|
|
|
52
|
-
<
|
|
53
|
-
|
|
28
|
+
<Typography>AI will be the new standard of care. 123456789</Typography>;
|
|
29
|
+
```
|
|
30
|
+
### Variant
|
|
31
|
+
|
|
32
|
+
The typography component comes with variants below:
|
|
54
33
|
|
|
55
|
-
|
|
56
|
-
|
|
34
|
+
<Canvas
|
|
35
|
+
of={TypographyStories.AllVariants}
|
|
36
|
+
sourceState="none" />
|
|
57
37
|
|
|
58
38
|
### With styled utility
|
|
59
39
|
|
|
60
40
|
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.
|
|
61
41
|
|
|
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 */}
|
|
42
|
+
<Canvas of={TypographyStories.Styled} />
|
|
64
43
|
|
|
65
|
-
<Story id="foundation-typography--styled" />
|
|
66
|
-
</Canvas>
|
|
67
44
|
|
|
68
45
|
### With the sx props
|
|
69
46
|
|
|
70
47
|
You can use all the variants with [the `sx` props](https://mui.com/system/getting-started/the-sx-prop/#typography).
|
|
71
48
|
|
|
72
|
-
<Canvas
|
|
73
|
-
|
|
49
|
+
<Canvas of={TypographyStories.SXProps} />
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Reference
|
|
53
|
+
|
|
54
|
+
- [Material-UI Typography](https://mui.com/material-ui/react-typography/)
|
|
55
|
+
- [Material-UI Typography API](https://mui.com/material-ui/api/typography/)
|
|
56
|
+
- [Lunit Design System Typography Figma](https://www.figma.com/design/oh2WsSLBuX30Yp589gyliB/Design-System_1.0.7?node-id=14801-193458&m=dev)
|
|
57
|
+
|
|
58
|
+
## Support
|
|
74
59
|
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
- Github: [Create a new issue](https://github.com/lunit-io/design-system/issues/new)
|
|
61
|
+
- Slack: #tf_design_system
|
|
@@ -6,7 +6,36 @@ import { styled } from "@mui/material/styles";
|
|
|
6
6
|
|
|
7
7
|
import Typography from "@/components/Typography";
|
|
8
8
|
|
|
9
|
-
import { variantArray } from "./const";
|
|
9
|
+
import { variantArray, variants } from "./const";
|
|
10
|
+
import TypographyGroup from "./TypographyGroup";
|
|
11
|
+
|
|
12
|
+
export const AllVariants = () => (
|
|
13
|
+
<>
|
|
14
|
+
<TypographyGroup
|
|
15
|
+
heading="Headline"
|
|
16
|
+
dummy="Headline 123456789"
|
|
17
|
+
variants={variants.headline}
|
|
18
|
+
/>
|
|
19
|
+
<TypographyGroup
|
|
20
|
+
heading="Body"
|
|
21
|
+
dummy={
|
|
22
|
+
<>
|
|
23
|
+
AI will be the new standard of care. 123456789
|
|
24
|
+
<br />
|
|
25
|
+
By Lunit. With AI, we aim to make data-driven medicine
|
|
26
|
+
<br />
|
|
27
|
+
the new standard of care.
|
|
28
|
+
</>
|
|
29
|
+
}
|
|
30
|
+
variants={variants.body}
|
|
31
|
+
/>
|
|
32
|
+
<TypographyGroup
|
|
33
|
+
heading="etc"
|
|
34
|
+
dummy="NEWS & UPDATE 71456"
|
|
35
|
+
variants={variants.etc}
|
|
36
|
+
/>
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
10
39
|
|
|
11
40
|
export default {
|
|
12
41
|
title: "Foundation/Typography",
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Grid, styled } from "@mui/material";
|
|
3
|
+
import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
|
|
4
|
+
|
|
5
|
+
const ColorBox = styled(Box)(({ theme }) => ({
|
|
6
|
+
textAlign: "center",
|
|
7
|
+
padding: "4px 0",
|
|
8
|
+
fontSize: "14px !important",
|
|
9
|
+
marginTop: "5px !important",
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
const BlockBox = styled(Box)(({ theme }) => ({
|
|
13
|
+
backgroundColor: "#d7d3d3",
|
|
14
|
+
textAlign: "center",
|
|
15
|
+
display: "flex",
|
|
16
|
+
flexDirection: "column",
|
|
17
|
+
flex: "auto",
|
|
18
|
+
padding: "10px",
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const ColorSystem = () => {
|
|
22
|
+
return (
|
|
23
|
+
<Box pb={10}>
|
|
24
|
+
<Grid container spacing={2}>
|
|
25
|
+
<Grid
|
|
26
|
+
item
|
|
27
|
+
xs={4}
|
|
28
|
+
sx={{
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: "row",
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<BlockBox>
|
|
34
|
+
<Box>Color Hex Value</Box>
|
|
35
|
+
<ColorBox bgcolor="#FFFFFF">#FFFFFF</ColorBox>
|
|
36
|
+
<ColorBox bgcolor="#00C9EA">#00C9EA</ColorBox>
|
|
37
|
+
<ColorBox bgcolor="#FFB3B8">#FFB3B8</ColorBox>
|
|
38
|
+
</BlockBox>
|
|
39
|
+
<Box
|
|
40
|
+
sx={{
|
|
41
|
+
width: "20px",
|
|
42
|
+
display: "flex",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<ArrowForwardIcon />
|
|
47
|
+
</Box>
|
|
48
|
+
</Grid>
|
|
49
|
+
<Grid
|
|
50
|
+
item
|
|
51
|
+
xs={4}
|
|
52
|
+
sx={{
|
|
53
|
+
display: "flex",
|
|
54
|
+
flexDirection: "row",
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<BlockBox>
|
|
58
|
+
<Box>Global Palette</Box>
|
|
59
|
+
<ColorBox bgcolor="#FFFFFF">grey_0</ColorBox>
|
|
60
|
+
<ColorBox bgcolor="#00C9EA">lunit_teal_40</ColorBox>
|
|
61
|
+
<ColorBox bgcolor="#FFB3B8">red_20</ColorBox>
|
|
62
|
+
</BlockBox>
|
|
63
|
+
<Box
|
|
64
|
+
sx={{
|
|
65
|
+
width: "20px",
|
|
66
|
+
display: "flex",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<ArrowForwardIcon />
|
|
71
|
+
</Box>
|
|
72
|
+
</Grid>
|
|
73
|
+
<Grid item xs={4}>
|
|
74
|
+
<BlockBox>
|
|
75
|
+
<Box>Color Token</Box>
|
|
76
|
+
<ColorBox bgcolor="#FFFFFF">bg_01</ColorBox>
|
|
77
|
+
<ColorBox bgcolor="#00C9EA">btn_primary_border</ColorBox>
|
|
78
|
+
<ColorBox bgcolor="#FFB3B8">chip_error_bg</ColorBox>
|
|
79
|
+
</BlockBox>
|
|
80
|
+
</Grid>
|
|
81
|
+
</Grid>
|
|
82
|
+
</Box>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default ColorSystem;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { Canvas, Meta } from "@storybook/blocks";
|
|
2
|
+
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Grid from '@mui/material/Grid';
|
|
5
|
+
import ColorSystem from './ColorSystem';
|
|
6
|
+
|
|
7
|
+
import * as ColorsStories from "./Colors.stories";
|
|
8
|
+
import * as TokenInComponentStories from "./Token.inComponent.stories";
|
|
9
|
+
|
|
10
|
+
<Meta of={ColorsStories} />
|
|
11
|
+
|
|
12
|
+
# Color System & Token
|
|
13
|
+
> _For the color documents, we provide both Korean and English to ensure understanding of our unique color system and tokens._
|
|
14
|
+
> _시스템의 이해를 돕기 위해 Color System 문서만 한국어와 영어를 병기하여 설명합니다._
|
|
15
|
+
|
|
16
|
+
The Lunit Design System defines a color palette to ensure explicit and consistent color usage.
|
|
17
|
+
Pre-configured palettes are provided in token form, allowing for easy application within components or pages.
|
|
18
|
+
_루닛 디자인 시스템은 명시적이고 일관된 색상 사용을 보장하기 위해 색상 팔레트를 정의한다.
|
|
19
|
+
사전 구성된 팔레트는 토큰 형태로 제공되므로 컴포넌트나 페이지 단에서 쉽게 적용 가능하다._
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Structure of Color system
|
|
23
|
+
The color system in Lunit is structured as follows.
|
|
24
|
+
_루닛의 색상 시스템은 다음과 같은 구조로 이루어져 있다._
|
|
25
|
+
|
|
26
|
+
<ColorSystem />
|
|
27
|
+
|
|
28
|
+
### Global Palette Color
|
|
29
|
+
|
|
30
|
+
> [Browse all the Global Palette Colors(link)](?path=/story/foundation-colors--global-colors)
|
|
31
|
+
- A collection of colors organized by type and shade to be used within the AK design system.
|
|
32
|
+
_루닛 디자인 시스템 안에서 사용할 색상을 종류와 밝기로 분류해 구성한 색상의 모음._
|
|
33
|
+
- The components and foundations provided by the lunit design system only utilize colors from this palette.
|
|
34
|
+
_루닛 디자인 시스템에서 제공하는 컴포넌트와 파운데이션은 이 팔레트의 색상만을 이용하고 있다._
|
|
35
|
+
- Each item in the Global Palette corresponds 1:1 with a color code (hex value).
|
|
36
|
+
_Global Palette의 각 항목은 색상 코드(hex값)와 1:1 대응한다._
|
|
37
|
+
- Color Tokens are linked to these values in the Global Palette.
|
|
38
|
+
_Color Token은 이 Global Paltte 값과 연결된다._
|
|
39
|
+
|
|
40
|
+
### Color Token
|
|
41
|
+
|
|
42
|
+
> [Browse all the Core tokens(link)](?path=/story/foundation-colors--core-tokens) <br />
|
|
43
|
+
> [Browse all the Component tokens(link)](?path=/story/foundation-colors--component-tokens)
|
|
44
|
+
|
|
45
|
+
- **Core Token**: These are color tokens universally used in UI elements, including background and text colors.
|
|
46
|
+
_**Core Token** : background, text 색상과 같이 범용적으로 적용되는 UI 에서 사용하는 컬러 토큰_
|
|
47
|
+
- **Component Token**: These are color tokens specifically utilized for certain components, such as buttons and chips.
|
|
48
|
+
_**Component Token** : button, chip 등과 같이 특정 컴포넌트 안에서만 사용하는 컬러 토큰_
|
|
49
|
+
- It is recommended to use **Color Tokens** instead of color codes or Global Colors.
|
|
50
|
+
_색상 코드나 Global Color 대신 **Color Token** 을 이용하는 것 을 권장한다._
|
|
51
|
+
- Color Tokens have colors for four themes (Light1, 2, Dark1, 2). Themes can be set using the className of the component itself or the parent element surrounding it.
|
|
52
|
+
_Color Token은 4가지 테마(Light1,2, Dark1,2) 별 색상을 가지고 있다. 테마는 해당 컴포넌트, 혹은 컴포넌트를 둘러싸고 있는 부모 엘리먼트의 className을 이용해 설정할 수 있다._
|
|
53
|
+
|
|
54
|
+
## How to set themes
|
|
55
|
+
- Types of themes: light1, light2, dark1, dark2
|
|
56
|
+
_테마의 종류 : light1, light2, dark1, dark2_
|
|
57
|
+
- The method to set themes : To assign a theme, add the theme name to the className of either the component you want to style or its surrounding parent element.
|
|
58
|
+
_테마를 설정하는 방법 : 테마를 부여하고 싶은 컴포넌트나 해당 컴포넌트를 둘러싸고 있는 부모 엘리먼트의 className에 테마 이름을 추가한다._
|
|
59
|
+
- ex)
|
|
60
|
+
```jsx
|
|
61
|
+
<div className='light1'>
|
|
62
|
+
<Button
|
|
63
|
+
sx={{
|
|
64
|
+
backgroundColor: (theme) =>
|
|
65
|
+
theme.palette.lunit_token.component.btn_primary_bg // light1 theme color
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
<div className='dark2'>
|
|
70
|
+
<Button
|
|
71
|
+
sx={{
|
|
72
|
+
backgroundColor: (theme) =>
|
|
73
|
+
theme.palette.lunit_token.component.btn_primary_bg // dark2 theme color
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
```
|
|
78
|
+
- If no theme is set, Color Tokens default to the Dark1 theme.
|
|
79
|
+
_테마를 설정하지 않으면, Color Token은 기본적으로 Dark1 테마가 적용된다._
|
|
80
|
+
- When themes are nested, Color Tokens follow the theme set at the closest level.
|
|
81
|
+
_테마 설정이 중첩되었을 때 Color Token은 가장 가까운 위치에서 설정한 테마를 따른다._
|
|
82
|
+
- ex)
|
|
83
|
+
```jsx
|
|
84
|
+
<div className='light1'>
|
|
85
|
+
<div className='dark1'>
|
|
86
|
+
<Button
|
|
87
|
+
sx={{
|
|
88
|
+
backgroundColor: (theme) =>
|
|
89
|
+
theme.palette.lunit_token.component.btn_primary_bg
|
|
90
|
+
// Since the closest theme set is dark1,
|
|
91
|
+
// the color of btn_primary_bg here will be applied as the dark1 theme color.
|
|
92
|
+
// 가장 가까운 곳에서 설정된 테마가 dark1이기 때문에, 이 곳의 btn_primary_bg 색상은 dark1 테마 색상이 적용됨
|
|
93
|
+
}}
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
The components in the Lunit design system are already developed using Color Tokens. If no custom styling is needed, simply set the theme to be used in the component.
|
|
103
|
+
Color Tokens are implemented based on the MUI theme, so the usage is similar to utilizing the MUI theme.
|
|
104
|
+
_루닛 디자인 시스템의 컴포넌트는 이미 Color Token을 이용해 개발되어 있다. 따로 스타일 커스텀이 필요없다면 컴포넌트에서 사용할 테마만 설정하면 된다._
|
|
105
|
+
_Color Token은 MUI theme 기반으로 구현되어, 사용법도 MUI theme를 이용하는 방식과 비슷하다._
|
|
106
|
+
|
|
107
|
+
### With Styled Components
|
|
108
|
+
|
|
109
|
+
<Canvas of={TokenInComponentStories.InComponentWithStyled} sourceState="none" />
|
|
110
|
+
|
|
111
|
+
```jsx
|
|
112
|
+
const StyledTextField = styled(TextField)(({ theme }) => ({
|
|
113
|
+
"& .MuiInputBase-root": {
|
|
114
|
+
backgroundColor: theme.palette.lunit_token.component.textfield_bg,
|
|
115
|
+
color: theme.palette.lunit_token.core.text_normal,
|
|
116
|
+
"& .MuiInputBase-input": {
|
|
117
|
+
padding: "8px 16px",
|
|
118
|
+
},
|
|
119
|
+
"&.Mui-focused fieldset": {
|
|
120
|
+
borderColor: theme.palette.lunit_token.core.focused,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
const InComponentWithStyled = () => {
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<div className='light1'>
|
|
129
|
+
<StyledTextField placeholder="Styled Text Field" />
|
|
130
|
+
</div>
|
|
131
|
+
<div className="dark1">
|
|
132
|
+
<StyledTextField placeholder="Styled Text Field" />
|
|
133
|
+
</div>
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### With sx prop
|
|
140
|
+
|
|
141
|
+
<Canvas of={TokenInComponentStories.InComponentWithSx} sourceState="none" />
|
|
142
|
+
|
|
143
|
+
```jsx
|
|
144
|
+
const InComponentWithSx = () => {
|
|
145
|
+
return (
|
|
146
|
+
<>
|
|
147
|
+
<div className='light1'>
|
|
148
|
+
<TextField
|
|
149
|
+
placeholder="Text Field with SX"
|
|
150
|
+
sx={{
|
|
151
|
+
"& .MuiInputBase-root": {
|
|
152
|
+
backgroundColor: (theme) =>
|
|
153
|
+
theme.palette.lunit_token.component.textfield_bg,
|
|
154
|
+
color: (theme) => theme.palette.lunit_token.core.text_normal,
|
|
155
|
+
"& .MuiInputBase-input": {
|
|
156
|
+
padding: "8px 16px",
|
|
157
|
+
},
|
|
158
|
+
"&.Mui-focused fieldset": {
|
|
159
|
+
borderColor: (theme) => theme.palette.lunit_token.core.focused,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
}}
|
|
163
|
+
/>
|
|
164
|
+
<Box width={150} height={50} bgcolor="#DFDFE2" mt={3}>
|
|
165
|
+
Hello!
|
|
166
|
+
<Box
|
|
167
|
+
sx={{
|
|
168
|
+
backgroundColor: (theme) =>
|
|
169
|
+
theme.palette.lunit_token.component.alert_info_bg,
|
|
170
|
+
color: (theme) =>
|
|
171
|
+
theme.palette.lunit_token.component.alert_info_border,
|
|
172
|
+
boxShadow: (theme) =>
|
|
173
|
+
`20px -10px 5px ${theme.palette.lunit_token.core.shadow_01}`,
|
|
174
|
+
width: 300,
|
|
175
|
+
height: 80,
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
- with alpha value
|
|
179
|
+
</Box>
|
|
180
|
+
</Box>
|
|
181
|
+
</div>
|
|
182
|
+
</>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### With useTheme for inline styling
|
|
188
|
+
|
|
189
|
+
<Canvas of={TokenInComponentStories.InComponentWithInlineStyle} sourceState="none" />
|
|
190
|
+
|
|
191
|
+
```jsx
|
|
192
|
+
const InComponentWithInlineStyle = () => {
|
|
193
|
+
const theme = useTheme();
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<>
|
|
197
|
+
<div className='light1'>
|
|
198
|
+
<TextField
|
|
199
|
+
placeholder="Inline Styled Text Field"
|
|
200
|
+
style={{
|
|
201
|
+
backgroundColor: theme.palette.lunit_token.component.textfield_bg,
|
|
202
|
+
}}
|
|
203
|
+
/>
|
|
204
|
+
</div>
|
|
205
|
+
<div className='dark1'>
|
|
206
|
+
<TextField
|
|
207
|
+
placeholder="Inline Styled Text Field"
|
|
208
|
+
style={{
|
|
209
|
+
backgroundColor: theme.palette.lunit_token.component.textfield_bg,
|
|
210
|
+
}}
|
|
211
|
+
/>
|
|
212
|
+
</div>
|
|
213
|
+
</>
|
|
214
|
+
);
|
|
215
|
+
};
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Reference
|
|
219
|
+
|
|
220
|
+
- [Lunit Design System Color Figma](https://www.figma.com/file/oh2WsSLBuX30Yp589gyliB/Design-System_1.0.7_Latest?type=design&node-id=14801-186914&mode=design&t=unSsZRlRhL3LrTRm-0)
|
|
221
|
+
|
|
222
|
+
## Support
|
|
223
|
+
|
|
224
|
+
- Github: [Create a new issue](https://github.com/lunit-io/design-system/issues/new)
|
|
225
|
+
- Slack: #tf_design_system
|
|
@@ -85,7 +85,7 @@ const TokenPaletteTable = ({ kind }: TokenPaletteTableProps) => {
|
|
|
85
85
|
<TableRow>
|
|
86
86
|
<TableCell colSpan={2}> </TableCell>
|
|
87
87
|
<TableCell colSpan={2}>Light</TableCell>
|
|
88
|
-
<TableCell colSpan={
|
|
88
|
+
<TableCell colSpan={2}>Dark</TableCell>
|
|
89
89
|
</TableRow>
|
|
90
90
|
<TableRow>
|
|
91
91
|
<TableCell>Token name</TableCell>
|
|
@@ -93,8 +93,6 @@ const TokenPaletteTable = ({ kind }: TokenPaletteTableProps) => {
|
|
|
93
93
|
<TableCell>Light 2</TableCell>
|
|
94
94
|
<TableCell>Dark 1</TableCell>
|
|
95
95
|
<TableCell>Dark 2</TableCell>
|
|
96
|
-
<TableCell>Dark 3</TableCell>
|
|
97
|
-
<TableCell>Dark 4</TableCell>
|
|
98
96
|
</TableRow>
|
|
99
97
|
</TableHead>
|
|
100
98
|
<TableBody>
|
|
@@ -116,8 +114,6 @@ const TokenPaletteTable = ({ kind }: TokenPaletteTableProps) => {
|
|
|
116
114
|
<TokenPaletteCell surface="light2" paletteKey={paletteKey} />
|
|
117
115
|
<TokenPaletteCell surface="dark1" paletteKey={paletteKey} />
|
|
118
116
|
<TokenPaletteCell surface="dark2" paletteKey={paletteKey} />
|
|
119
|
-
<TokenPaletteCell surface="dark3" paletteKey={paletteKey} />
|
|
120
|
-
<TokenPaletteCell surface="dark4" paletteKey={paletteKey} />
|
|
121
117
|
</TableRow>
|
|
122
118
|
))}
|
|
123
119
|
</TableBody>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./Modal";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StoryFn, Meta } from "@storybook/react";
|
|
3
|
-
|
|
4
|
-
import Modal from "@/components/Modal";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "Components/Modal",
|
|
8
|
-
component: Modal,
|
|
9
|
-
} as Meta<typeof Modal>;
|
|
10
|
-
|
|
11
|
-
const Template: StoryFn<typeof Modal> = () => <Modal />;
|
|
12
|
-
|
|
13
|
-
export const LunitModal = {
|
|
14
|
-
render: Template,
|
|
15
|
-
};
|