@lunit/design-system 1.0.0-a.2 → 1.0.0-a.4

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.
Files changed (173) hide show
  1. package/.babelrc.json +16 -0
  2. package/dist/cjs/components/Alert/index.js +1 -1
  3. package/dist/cjs/components/Alert/index.js.map +1 -1
  4. package/dist/cjs/components/Button/index.js +1 -1
  5. package/dist/cjs/components/Button/index.js.map +1 -1
  6. package/dist/cjs/components/Chip/index.js +1 -1
  7. package/dist/cjs/components/Chip/index.js.map +1 -1
  8. package/dist/cjs/components/TextField/index.js +1 -1
  9. package/dist/cjs/components/TextField/index.js.map +1 -1
  10. package/dist/cjs/components/ToggleButton/index.js +1 -1
  11. package/dist/cjs/components/ToggleButton/index.js.map +1 -1
  12. package/dist/cjs/index.js +1 -1
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/components/Alert/Alert.js +20 -4
  15. package/dist/components/Alert/Alert.js.map +1 -1
  16. package/dist/components/Alert/Alert.styled.js +49 -0
  17. package/dist/components/Alert/Alert.styled.js.map +1 -0
  18. package/dist/components/Alert/Alert.types.js +2 -0
  19. package/dist/components/Alert/Alert.types.js.map +1 -0
  20. package/dist/components/Alert/Alert.utils.js +37 -0
  21. package/dist/components/Alert/Alert.utils.js.map +1 -0
  22. package/dist/components/Button/Button.js +1 -1
  23. package/dist/components/Button/Button.js.map +1 -1
  24. package/dist/components/Button/Button.styled.js +31 -21
  25. package/dist/components/Button/Button.styled.js.map +1 -1
  26. package/dist/components/Button/utils/getHoverStyle.js +7 -0
  27. package/dist/components/Button/utils/getHoverStyle.js.map +1 -0
  28. package/dist/components/Chip/Chip.js +1 -1
  29. package/dist/components/Chip/Chip.js.map +1 -1
  30. package/dist/components/Chip/Chip.styled.js +2 -3
  31. package/dist/components/Chip/Chip.styled.js.map +1 -1
  32. package/dist/components/TextField/TextField.js +15 -3
  33. package/dist/components/TextField/TextField.js.map +1 -1
  34. package/dist/components/TextField/TextField.style.js +245 -0
  35. package/dist/components/TextField/TextField.style.js.map +1 -0
  36. package/dist/components/TextField/TextField.types.js +2 -0
  37. package/dist/components/TextField/TextField.types.js.map +1 -0
  38. package/dist/components/TextField/TextFieldIcon.js +7 -0
  39. package/dist/components/TextField/TextFieldIcon.js.map +1 -0
  40. package/dist/components/Toast/Toast.js +26 -0
  41. package/dist/components/Toast/Toast.js.map +1 -0
  42. package/dist/components/Toast/Toast.styled.js +49 -0
  43. package/dist/components/Toast/Toast.styled.js.map +1 -0
  44. package/dist/components/Toast/Toast.types.js +2 -0
  45. package/dist/components/Toast/Toast.types.js.map +1 -0
  46. package/dist/components/Toast/Toast.utils.js +13 -0
  47. package/dist/components/Toast/Toast.utils.js.map +1 -0
  48. package/dist/components/Toast/index.js +2 -0
  49. package/dist/components/Toast/index.js.map +1 -0
  50. package/dist/foundation/colors/base/grey.js +16 -0
  51. package/dist/foundation/colors/base/grey.js.map +1 -1
  52. package/dist/foundation/colors/base/lunitGreen.js +2 -2
  53. package/dist/foundation/colors/base/lunitGreen.js.map +1 -1
  54. package/dist/foundation/colors/base/lunitTeal.js +5 -5
  55. package/dist/foundation/colors/base/lunitTeal.js.map +1 -1
  56. package/dist/foundation/colors/base/red.js +2 -2
  57. package/dist/foundation/colors/index.js +24 -4
  58. package/dist/foundation/colors/index.js.map +1 -1
  59. package/dist/foundation/colors/token/component.js +265 -291
  60. package/dist/foundation/colors/token/component.js.map +1 -1
  61. package/dist/foundation/colors/token/core.js +132 -125
  62. package/dist/foundation/colors/token/core.js.map +1 -1
  63. package/dist/index.js +1 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/theme.js +5 -0
  66. package/dist/theme.js.map +1 -1
  67. package/dist/types/components/Alert/Alert.d.ts +3 -1
  68. package/dist/types/components/Alert/Alert.styled.d.ts +6 -0
  69. package/dist/types/components/Alert/Alert.types.d.ts +9 -0
  70. package/dist/types/components/Alert/Alert.utils.d.ts +4 -0
  71. package/dist/types/components/Button/Button.d.ts +1 -1
  72. package/dist/types/components/Button/Button.styled.d.ts +26 -2
  73. package/dist/types/components/Button/Button.types.d.ts +4 -4
  74. package/dist/types/components/Button/utils/getHoverStyle.d.ts +6 -0
  75. package/dist/types/components/Checkbox/Checkbox.d.ts +1 -1
  76. package/dist/types/components/Chip/Chip.d.ts +1 -1
  77. package/dist/types/components/Chip/Chip.styled.d.ts +13 -13
  78. package/dist/types/components/Chip/Chip.types.d.ts +1 -1
  79. package/dist/types/components/DataTable/DataTable.d.ts +1 -1
  80. package/dist/types/components/DatePicker/DatePicker.d.ts +1 -1
  81. package/dist/types/components/Dropdown/Dropdown.d.ts +1 -1
  82. package/dist/types/components/FormLabel/FormLabel.d.ts +1 -1
  83. package/dist/types/components/Modal/Modal.d.ts +1 -1
  84. package/dist/types/components/Radio/Radio.d.ts +1 -1
  85. package/dist/types/components/TextField/TextField.d.ts +2 -1
  86. package/dist/types/components/TextField/TextField.style.d.ts +9 -0
  87. package/dist/types/components/TextField/TextField.types.d.ts +29 -0
  88. package/dist/types/components/TextField/TextFieldIcon.d.ts +8 -0
  89. package/dist/types/components/TextField/index.d.ts +1 -0
  90. package/dist/types/components/Toast/Toast.d.ts +4 -0
  91. package/dist/types/components/Toast/Toast.styled.d.ts +1 -0
  92. package/dist/types/components/Toast/Toast.types.d.ts +4 -0
  93. package/dist/types/components/Toast/Toast.utils.d.ts +2 -0
  94. package/dist/types/components/Toast/index.d.ts +1 -0
  95. package/dist/types/components/Toggle/Toggle.d.ts +1 -1
  96. package/dist/types/components/ToggleButton/ToggleButton.d.ts +1 -1
  97. package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +2 -2
  98. package/dist/types/components/ToggleButton/ToggleButton.types.d.ts +4 -4
  99. package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +1 -1
  100. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  101. package/dist/types/foundation/colors/base/grey.d.ts +16 -0
  102. package/dist/types/foundation/colors/base/lunitGreen.d.ts +2 -2
  103. package/dist/types/foundation/colors/base/lunitTeal.d.ts +2 -2
  104. package/dist/types/foundation/colors/index.d.ts +42 -9
  105. package/dist/types/foundation/colors/types.d.ts +1 -3
  106. package/dist/types/foundation/index.d.ts +37 -5
  107. package/dist/types/index.d.ts +1 -0
  108. package/package.json +21 -16
  109. package/src/components/Alert/Alert.styled.ts +63 -0
  110. package/src/components/Alert/Alert.tsx +47 -5
  111. package/src/components/Alert/Alert.types.ts +10 -0
  112. package/src/components/Alert/Alert.utils.ts +49 -0
  113. package/src/components/Button/Button.styled.ts +33 -21
  114. package/src/components/Button/Button.tsx +1 -5
  115. package/src/components/Button/Button.types.ts +4 -4
  116. package/src/components/Button/utils/getHoverStyle.ts +7 -0
  117. package/src/components/Chip/Chip.styled.ts +6 -4
  118. package/src/components/Chip/Chip.tsx +1 -1
  119. package/src/components/Chip/Chip.types.ts +2 -2
  120. package/src/components/TextField/TextField.style.ts +316 -0
  121. package/src/components/TextField/TextField.tsx +75 -3
  122. package/src/components/TextField/TextField.types.ts +38 -0
  123. package/src/components/TextField/TextFieldIcon.tsx +24 -0
  124. package/src/components/TextField/index.ts +6 -0
  125. package/src/components/Toast/Toast.styled.ts +49 -0
  126. package/src/components/Toast/Toast.tsx +66 -0
  127. package/src/components/Toast/Toast.types.ts +14 -0
  128. package/src/components/Toast/Toast.utils.ts +17 -0
  129. package/src/components/Toast/index.tsx +1 -0
  130. package/src/components/ToggleButton/ToggleButton.types.ts +4 -7
  131. package/src/foundation/colors/base/grey.ts +17 -0
  132. package/src/foundation/colors/base/lunitGreen.ts +2 -2
  133. package/src/foundation/colors/base/lunitTeal.ts +5 -5
  134. package/src/foundation/colors/base/red.ts +2 -2
  135. package/src/foundation/colors/index.ts +29 -8
  136. package/src/foundation/colors/token/component.ts +300 -326
  137. package/src/foundation/colors/token/core.ts +152 -145
  138. package/src/foundation/colors/types.ts +1 -3
  139. package/src/index.ts +1 -0
  140. package/src/stories/components/Alert/Alert.stories.tsx +148 -4
  141. package/src/stories/components/Button/BasicButton.stories.tsx +19 -28
  142. package/src/stories/components/Button/IconButton.stories.tsx +39 -28
  143. package/src/stories/components/Button/Kind.stories.tsx +83 -57
  144. package/src/stories/components/Chip/Chip.stories.tsx +94 -82
  145. package/src/stories/components/DataTable/DataTable.stories.tsx +6 -4
  146. package/src/stories/components/DatePicker/DatePicker.stories.tsx +6 -4
  147. package/src/stories/components/Dropdown/Dropdown.stories.tsx +12 -6
  148. package/src/stories/components/Modal/Modal.stories.tsx +6 -4
  149. package/src/stories/components/SelectControl/Checkbox.stories.tsx +31 -23
  150. package/src/stories/components/SelectControl/RadioGroup.stories.tsx +6 -5
  151. package/src/stories/components/SelectControl/RadioStatus.stories.tsx +6 -4
  152. package/src/stories/components/SelectControl/Toggle.stories.tsx +33 -19
  153. package/src/stories/components/TextField/TextFieldMulti.stories.tsx +137 -0
  154. package/src/stories/components/TextField/TextFieldSingle.stories.tsx +283 -0
  155. package/src/stories/components/TextField/TextFieldSize.stories.tsx +134 -0
  156. package/src/stories/components/Toast/Toast.stories.tsx +152 -0
  157. package/src/stories/components/ToggleButton/Basic.stories.tsx +35 -31
  158. package/src/stories/components/ToggleButton/Group.stories.tsx +21 -21
  159. package/src/stories/components/ToggleButton/ToggleButtonKind.stories.tsx +53 -43
  160. package/src/stories/components/ToggleButton/WithIcon.stories.tsx +35 -36
  161. package/src/stories/components/Tooltip/Tooltip.stories.tsx +6 -4
  162. package/src/stories/foundation/Elevation/Elevation.stories.tsx +10 -6
  163. package/src/stories/foundation/Typography/{Typography.stories.mdx → Typography.mdx} +10 -5
  164. package/src/stories/foundation/Typography/Typography.stories.tsx +46 -36
  165. package/src/stories/foundation/Typography/TypographyExamples.stories.tsx +44 -0
  166. package/src/stories/foundation/colors/Colors.stories.tsx +7 -5
  167. package/src/stories/foundation/colors/Mui.stories.tsx +18 -0
  168. package/src/stories/foundation/colors/Token.inComponent.stories.tsx +2 -2
  169. package/src/stories/foundation/colors/TokenPaletteTable.stories.tsx +28 -0
  170. package/src/stories/foundation/colors/TokenPaletteTable.tsx +127 -0
  171. package/src/theme.ts +5 -0
  172. package/src/stories/components/TextField/TextField.stories.tsx +0 -13
  173. 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 { Bell } from "@lunit/design-system-icons";
10
+ import Bell from "@lunit/design-system-icons/Bell";
11
11
 
12
12
  import ToggleButton from "@/components/ToggleButton";
13
13
 
14
- import type { ComponentStory, ComponentMeta } from "@storybook/react";
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 ComponentMeta<typeof ToggleButton>;
140
+ } as Meta<typeof ToggleButton>;
152
141
 
153
- const Template: ComponentStory<typeof ToggleButton> = (arg) => {
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 = Template.bind({});
216
- IconStory.storyName = "Icon";
217
- IconStory.argTypes = {
218
- children: {
219
- type: "string",
220
- defaultValue: "text",
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: ComponentStory<typeof ToggleButton> = (arg) => {
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 = IconOnlyTemplate.bind({});
287
- WithIconOnlyStory.storyName = "Icon only";
288
- WithIconOnlyStory.argTypes = {
289
- children: {
290
- type: "string",
291
- controls: false,
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 { ComponentStory, ComponentMeta } from "@storybook/react";
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 ComponentMeta<typeof Tooltip>;
9
+ } as Meta<typeof Tooltip>;
10
10
 
11
- const Template: ComponentStory<typeof Tooltip> = () => <Tooltip />;
11
+ const Template: StoryFn<typeof Tooltip> = () => <Tooltip />;
12
12
 
13
- export const LunitChip = Template.bind({});
13
+ export const LunitChip = {
14
+ render: Template,
15
+ };
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from "react";
2
- import { ComponentStory, ComponentMeta } from "@storybook/react";
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 ComponentMeta<typeof Elevation>;
251
+ } as Meta<typeof Elevation>;
252
252
 
253
- const ElevationBase: ComponentStory<typeof Elevation> = (
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: ComponentStory<typeof Elevation> = (
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 = ElevationBase.bind({});
264
- export const Nested = ElevationNesed.bind({});
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/addon-docs";
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 title="Foundation/Typography/All Variants" component={Typography} />
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 name="all variants">
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 { ComponentStory } from "@storybook/react";
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: ComponentStory<typeof Typography> = (args) => {
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 = TypographyTemplate.bind({});
30
- TypographyComponent.args = {
31
- variant: "body1_16_regular",
32
- children:
33
- "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.",
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: ComponentStory<typeof Typography> = (args) => {
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 = SXTemplate.bind({});
44
- SXProps.args = {
45
- variant: "body1_16_regular",
46
- children:
47
- "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.",
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: ComponentStory<typeof StyledBox> = (args) => {
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 = StyledTemplate.bind({});
69
- Styled.args = {
70
- variant: "body1_16_regular",
71
- children:
72
- "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.",
73
- };
74
- Styled.parameters = {
75
- docs: {
76
- source: {
77
- code: `
78
- const StyledBox = styled(Box)(({ theme }) => ({
79
- ...theme.typography.body1_16_regular,
80
- whiteSpace: "pre-line",
81
- }));
82
- ...
83
- return (
84
- <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>
85
- );
86
- `,
87
- language: "tsx",
88
- type: "code",
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 { ComponentStory, ComponentMeta } from "@storybook/react";
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 ComponentMeta<typeof BaseColors>;
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: ComponentStory<typeof BaseColors> = () => <BaseColors />;
61
+ const BaseTemplate: StoryFn<typeof BaseColors> = () => <BaseColors />;
62
62
 
63
- export const Base = BaseTemplate.bind({});
64
- // More on args: https://storybook.js.org/docs/react/writing-stories/args
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 { ComponentMeta } from "@storybook/react";
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 ComponentMeta<typeof InComponentWithStyled>;
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({});