@lunit/design-system 1.0.0-b.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/cjs/components/Alert/index.js +1 -1
  2. package/dist/cjs/components/Alert/index.js.map +1 -1
  3. package/dist/cjs/components/Button/index.js +1 -1
  4. package/dist/cjs/components/Button/index.js.map +1 -1
  5. package/dist/cjs/components/Chip/index.js +1 -1
  6. package/dist/cjs/components/Chip/index.js.map +1 -1
  7. package/dist/cjs/components/TextField/index.js +1 -1
  8. package/dist/cjs/components/TextField/index.js.map +1 -1
  9. package/dist/cjs/components/Toggle/index.js +1 -1
  10. package/dist/cjs/components/Toggle/index.js.map +1 -1
  11. package/dist/cjs/components/ToggleButton/index.js +1 -1
  12. package/dist/cjs/components/ToggleButton/index.js.map +1 -1
  13. package/dist/cjs/index.js +1 -1
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/components/Button/Button.js +30 -6
  16. package/dist/components/Button/Button.js.map +1 -1
  17. package/dist/components/Button/Button.styled.js +1 -10
  18. package/dist/components/Button/Button.styled.js.map +1 -1
  19. package/dist/components/Chip/Chip.js +6 -5
  20. package/dist/components/Chip/Chip.js.map +1 -1
  21. package/dist/components/TextField/TextField.js +4 -4
  22. package/dist/components/TextField/TextField.js.map +1 -1
  23. package/dist/components/Toggle/Toggle.js +4 -4
  24. package/dist/components/Toggle/Toggle.js.map +1 -1
  25. package/dist/components/Toggle/Toggle.styled.js +2 -3
  26. package/dist/components/Toggle/Toggle.styled.js.map +1 -1
  27. package/dist/components/ToggleButton/ToggleButton.js +6 -5
  28. package/dist/components/ToggleButton/ToggleButton.js.map +1 -1
  29. package/dist/components/ToggleButton/ToggleButton.styled.js +9 -2
  30. package/dist/components/ToggleButton/ToggleButton.styled.js.map +1 -1
  31. package/dist/foundation/Typography/index.js +20 -2
  32. package/dist/foundation/Typography/index.js.map +1 -1
  33. package/dist/foundation/Typography/tokens.js +2 -2
  34. package/dist/foundation/colors/index.js +4 -0
  35. package/dist/foundation/colors/index.js.map +1 -1
  36. package/dist/foundation/colors/token/core.js +0 -2
  37. package/dist/foundation/colors/token/core.js.map +1 -1
  38. package/dist/foundation/index.js +1 -1
  39. package/dist/foundation/index.js.map +1 -1
  40. package/dist/types/components/Button/Button.styled.d.ts +0 -8
  41. package/dist/types/components/Button/Button.types.d.ts +8 -5
  42. package/dist/types/components/Chip/Chip.types.d.ts +7 -2
  43. package/dist/types/components/TextField/TextField.types.d.ts +8 -3
  44. package/dist/types/components/Toggle/Toggle.d.ts +1 -1
  45. package/dist/types/components/Toggle/Toggle.styled.d.ts +1 -1
  46. package/dist/types/components/Toggle/Toggle.types.d.ts +5 -5
  47. package/dist/types/components/ToggleButton/ToggleButton.d.ts +2 -2
  48. package/dist/types/components/ToggleButton/ToggleButton.styled.d.ts +4 -0
  49. package/dist/types/components/ToggleButton/ToggleButton.types.d.ts +4 -5
  50. package/dist/types/foundation/Typography/index.d.ts +21 -4
  51. package/dist/types/foundation/Typography/tokens.d.ts +2 -2
  52. package/dist/types/foundation/colors/index.d.ts +4 -0
  53. package/dist/types/foundation/index.d.ts +4 -0
  54. package/package.json +1 -1
  55. package/src/components/Button/Button.styled.ts +1 -10
  56. package/src/components/Button/Button.tsx +120 -37
  57. package/src/components/Button/Button.types.ts +8 -4
  58. package/src/components/Chip/Chip.tsx +15 -4
  59. package/src/components/Chip/Chip.types.ts +9 -2
  60. package/src/components/TextField/TextField.tsx +10 -10
  61. package/src/components/TextField/TextField.types.ts +11 -4
  62. package/src/components/Toggle/Toggle.styled.ts +4 -4
  63. package/src/components/Toggle/Toggle.tsx +28 -9
  64. package/src/components/Toggle/Toggle.types.ts +8 -8
  65. package/src/components/ToggleButton/ToggleButton.styled.ts +14 -7
  66. package/src/components/ToggleButton/ToggleButton.tsx +92 -79
  67. package/src/components/ToggleButton/ToggleButton.types.ts +5 -4
  68. package/src/foundation/Typography/index.ts +20 -2
  69. package/src/foundation/Typography/tokens.ts +2 -2
  70. package/src/foundation/colors/index.ts +4 -0
  71. package/src/foundation/colors/token/core.ts +0 -2
  72. package/src/foundation/index.ts +1 -1
  73. package/src/stories/components/Button/BasicButton.stories.tsx +11 -0
  74. package/src/stories/components/Button/IconButton.stories.tsx +11 -0
  75. package/src/stories/components/Button/Kind.stories.tsx +62 -25
  76. package/src/stories/components/Chip/Chip.stories.tsx +15 -5
  77. package/src/stories/components/SelectControl/Toggle.stories.tsx +10 -10
@@ -64,10 +64,28 @@ export default {
64
64
  defaultValue: { summary: "contained" },
65
65
  },
66
66
  },
67
+ variant: {
68
+ control: {
69
+ type: "radio",
70
+ },
71
+ options: ["contained", "outlined", "text", "ghost"],
72
+ description: "The variant is alias of kind.",
73
+ table: {
74
+ defaultValue: { summary: "contained" },
75
+ },
76
+ },
67
77
  },
68
78
  parameters: {
69
79
  controls: {
70
- include: ["onClick", "children", "color", "size", "disabled", "kind"],
80
+ include: [
81
+ "onClick",
82
+ "children",
83
+ "color",
84
+ "size",
85
+ "disabled",
86
+ "kind",
87
+ "variant",
88
+ ],
71
89
  },
72
90
  pseudo: {
73
91
  hover: [
@@ -92,6 +110,7 @@ export default {
92
110
  const ButtonTemplate: StoryFn<typeof Button> = ({
93
111
  kind,
94
112
  color,
113
+ variant,
95
114
  children,
96
115
  ...restProps
97
116
  }) => {
@@ -157,6 +176,7 @@ export const Kind = {
157
176
  };
158
177
 
159
178
  const ContainedButtonTemplate: StoryFn<typeof Button> = (args) => {
179
+ const { kind, variant, ...restProps } = args;
160
180
  return (
161
181
  <>
162
182
  <Table sx={{ width: 650 }}>
@@ -182,17 +202,17 @@ const ContainedButtonTemplate: StoryFn<typeof Button> = (args) => {
182
202
  Enable
183
203
  </TableCell>
184
204
  <TableCell>
185
- <Button {...args} kind="contained">
205
+ <Button {...restProps} kind="contained">
186
206
  {args.children}
187
207
  </Button>
188
208
  </TableCell>
189
209
  <TableCell>
190
- <Button {...args} kind="contained" color="secondary">
210
+ <Button {...restProps} kind="contained" color="secondary">
191
211
  {args.children}
192
212
  </Button>
193
213
  </TableCell>
194
214
  <TableCell>
195
- <Button {...args} kind="contained" color="error">
215
+ <Button {...restProps} kind="contained" color="error">
196
216
  {args.children}
197
217
  </Button>
198
218
  </TableCell>
@@ -204,17 +224,22 @@ const ContainedButtonTemplate: StoryFn<typeof Button> = (args) => {
204
224
  Hover
205
225
  </TableCell>
206
226
  <TableCell>
207
- <Button {...args} id="hover1" kind="contained">
227
+ <Button {...restProps} id="hover1" kind="contained">
208
228
  {args.children}
209
229
  </Button>
210
230
  </TableCell>
211
231
  <TableCell>
212
- <Button {...args} id="hover2" kind="contained" color="secondary">
232
+ <Button
233
+ {...restProps}
234
+ id="hover2"
235
+ kind="contained"
236
+ color="secondary"
237
+ >
213
238
  {args.children}
214
239
  </Button>
215
240
  </TableCell>
216
241
  <TableCell>
217
- <Button {...args} id="hover3" kind="contained" color="error">
242
+ <Button {...restProps} id="hover3" kind="contained" color="error">
218
243
  {args.children}
219
244
  </Button>
220
245
  </TableCell>
@@ -226,13 +251,17 @@ const ContainedButtonTemplate: StoryFn<typeof Button> = (args) => {
226
251
  Focus
227
252
  </TableCell>
228
253
  <TableCell>
229
- <Button {...args} kind="contained" className="Mui-focusVisible">
254
+ <Button
255
+ {...restProps}
256
+ kind="contained"
257
+ className="Mui-focusVisible"
258
+ >
230
259
  {args.children}
231
260
  </Button>
232
261
  </TableCell>
233
262
  <TableCell>
234
263
  <Button
235
- {...args}
264
+ {...restProps}
236
265
  kind="contained"
237
266
  color="secondary"
238
267
  className="Mui-focusVisible"
@@ -242,7 +271,7 @@ const ContainedButtonTemplate: StoryFn<typeof Button> = (args) => {
242
271
  </TableCell>
243
272
  <TableCell>
244
273
  <Button
245
- {...args}
274
+ {...restProps}
246
275
  kind="contained"
247
276
  color="error"
248
277
  className="Mui-focusVisible"
@@ -258,17 +287,22 @@ const ContainedButtonTemplate: StoryFn<typeof Button> = (args) => {
258
287
  Disabled
259
288
  </TableCell>
260
289
  <TableCell>
261
- <Button {...args} kind="contained" disabled>
290
+ <Button {...restProps} kind="contained" disabled>
262
291
  {args.children}
263
292
  </Button>
264
293
  </TableCell>
265
294
  <TableCell>
266
- <Button {...args} kind="contained" color="secondary" disabled>
295
+ <Button
296
+ {...restProps}
297
+ kind="contained"
298
+ color="secondary"
299
+ disabled
300
+ >
267
301
  {args.children}
268
302
  </Button>
269
303
  </TableCell>
270
304
  <TableCell>
271
- <Button {...args} kind="contained" color="error" disabled>
305
+ <Button {...restProps} kind="contained" color="error" disabled>
272
306
  {args.children}
273
307
  </Button>
274
308
  </TableCell>
@@ -300,6 +334,7 @@ export const KindContained = {
300
334
  };
301
335
 
302
336
  const GhostButtonTemplate: StoryFn<typeof Button> = (args) => {
337
+ const { kind, variant, ...restProps } = args;
303
338
  return (
304
339
  <>
305
340
  <Table sx={{ width: 650 }}>
@@ -325,17 +360,17 @@ const GhostButtonTemplate: StoryFn<typeof Button> = (args) => {
325
360
  Enable
326
361
  </TableCell>
327
362
  <TableCell>
328
- <Button {...args} kind="ghost">
363
+ <Button {...restProps} kind="ghost">
329
364
  {args.children}
330
365
  </Button>
331
366
  </TableCell>
332
367
  <TableCell>
333
- <Button {...args} kind="ghost" color="secondary">
368
+ <Button {...restProps} kind="ghost" color="secondary">
334
369
  {args.children}
335
370
  </Button>
336
371
  </TableCell>
337
372
  <TableCell>
338
- <Button {...args} kind="ghost" color="error">
373
+ <Button {...restProps} kind="ghost" color="error">
339
374
  {args.children}
340
375
  </Button>
341
376
  </TableCell>
@@ -347,17 +382,17 @@ const GhostButtonTemplate: StoryFn<typeof Button> = (args) => {
347
382
  Hover
348
383
  </TableCell>
349
384
  <TableCell>
350
- <Button {...args} id="hover4" kind="ghost">
385
+ <Button {...restProps} id="hover4" kind="ghost">
351
386
  {args.children}
352
387
  </Button>
353
388
  </TableCell>
354
389
  <TableCell>
355
- <Button {...args} id="hover5" kind="ghost" color="secondary">
390
+ <Button {...restProps} id="hover5" kind="ghost" color="secondary">
356
391
  {args.children}
357
392
  </Button>
358
393
  </TableCell>
359
394
  <TableCell>
360
- <Button {...args} id="hover6" kind="ghost" color="error">
395
+ <Button {...restProps} id="hover6" kind="ghost" color="error">
361
396
  {args.children}
362
397
  </Button>
363
398
  </TableCell>
@@ -369,13 +404,13 @@ const GhostButtonTemplate: StoryFn<typeof Button> = (args) => {
369
404
  Focus
370
405
  </TableCell>
371
406
  <TableCell>
372
- <Button {...args} kind="ghost" className="Mui-focusVisible">
407
+ <Button {...restProps} kind="ghost" className="Mui-focusVisible">
373
408
  {args.children}
374
409
  </Button>
375
410
  </TableCell>
376
411
  <TableCell>
377
412
  <Button
378
- {...args}
413
+ {...restProps}
379
414
  kind="ghost"
380
415
  color="secondary"
381
416
  className="Mui-focusVisible"
@@ -385,7 +420,7 @@ const GhostButtonTemplate: StoryFn<typeof Button> = (args) => {
385
420
  </TableCell>
386
421
  <TableCell>
387
422
  <Button
388
- {...args}
423
+ {...restProps}
389
424
  kind="ghost"
390
425
  color="error"
391
426
  className="Mui-focusVisible"
@@ -401,17 +436,17 @@ const GhostButtonTemplate: StoryFn<typeof Button> = (args) => {
401
436
  Disabled
402
437
  </TableCell>
403
438
  <TableCell>
404
- <Button {...args} kind="ghost" disabled>
439
+ <Button {...restProps} kind="ghost" disabled>
405
440
  {args.children}
406
441
  </Button>
407
442
  </TableCell>
408
443
  <TableCell>
409
- <Button {...args} kind="ghost" color="secondary" disabled>
444
+ <Button {...restProps} kind="ghost" color="secondary" disabled>
410
445
  {args.children}
411
446
  </Button>
412
447
  </TableCell>
413
448
  <TableCell>
414
- <Button {...args} kind="ghost" color="error" disabled>
449
+ <Button {...restProps} kind="ghost" color="error" disabled>
415
450
  {args.children}
416
451
  </Button>
417
452
  </TableCell>
@@ -445,6 +480,8 @@ export const KindGhost = {
445
480
  };
446
481
 
447
482
  const OutlinedButtonTemplate: StoryFn<typeof Button> = ({
483
+ kind,
484
+ variant,
448
485
  color,
449
486
  ...restProps
450
487
  }) => {
@@ -18,6 +18,13 @@ export default {
18
18
  kind: {
19
19
  description: `Default status of Contained or Outlined Chip is readOnly. You can pass onClick, onDelete or thumbnail to Contained Chip only.`,
20
20
  },
21
+ variant: {
22
+ description: `The variant is alias of kind. It is Filled or Outlined.`,
23
+ control: {
24
+ type: "select",
25
+ },
26
+ options: [undefined, "filled", "outlined"],
27
+ },
21
28
  onClick: {
22
29
  description: `Contained chip can have onClick event. When Chip is clickable, onDelete is disabled.`,
23
30
  control: {
@@ -80,6 +87,7 @@ export default {
80
87
  },
81
88
  args: {
82
89
  kind: "contained",
90
+ variant: "filled",
83
91
  label: "label@lunit.io",
84
92
  },
85
93
  parameters: {
@@ -116,9 +124,10 @@ export const Outlined = {
116
124
  args: {
117
125
  color: "primary",
118
126
  kind: "outlined",
127
+ variant: "outlined",
119
128
  },
120
129
 
121
- name: "Kind: Outlined",
130
+ name: "Kind(Variant): Outlined",
122
131
  };
123
132
 
124
133
  export const Contained = {
@@ -138,9 +147,10 @@ export const Contained = {
138
147
  args: {
139
148
  color: "primary",
140
149
  kind: "contained",
150
+ variant: "filled",
141
151
  },
142
152
 
143
- name: "Kind: Contained / Read Only",
153
+ name: "Kind(Variant): Contained / Read Only",
144
154
  };
145
155
 
146
156
  export const ContainedWithClick = {
@@ -161,7 +171,7 @@ export const ContainedWithClick = {
161
171
  },
162
172
  },
163
173
 
164
- name: "Kind: Contained / Enable",
174
+ name: "Kind(Variant): Contained / Enable",
165
175
  };
166
176
 
167
177
  export const ContainedWithDelete = {
@@ -182,7 +192,7 @@ export const ContainedWithDelete = {
182
192
  },
183
193
  },
184
194
 
185
- name: "Kind: Contained / Deletable",
195
+ name: "Kind(Variant): Contained / Deletable",
186
196
  };
187
197
 
188
198
  export const ContainedWithThumbnail = {
@@ -204,5 +214,5 @@ export const ContainedWithThumbnail = {
204
214
  },
205
215
  },
206
216
 
207
- name: "Kind: Contained with Thumbnail",
217
+ name: "Kind(Variant): Contained with Thumbnail",
208
218
  };
@@ -45,7 +45,7 @@ export default {
45
45
  },
46
46
  },
47
47
  args: {
48
- size: "medium",
48
+ size: "small",
49
49
  indeterminate: false,
50
50
  disabled: false,
51
51
  },
@@ -103,7 +103,7 @@ const Template: StoryFn<typeof Toggle> = (args) => (
103
103
  </TableHead>
104
104
  <TableBody>
105
105
  <TableRow>
106
- <TableCell>MEDIUM DEFAULT</TableCell>
106
+ <TableCell>SMALL DEFAULT</TableCell>
107
107
  <TableCell>
108
108
  <Toggle {...args} checked />
109
109
  </TableCell>
@@ -115,7 +115,7 @@ const Template: StoryFn<typeof Toggle> = (args) => (
115
115
  </TableCell>
116
116
  </TableRow>
117
117
  <TableRow>
118
- <TableCell>MEDIUM FOCUS</TableCell>
118
+ <TableCell>SMALL FOCUS</TableCell>
119
119
  <TableCell>
120
120
  <Toggle {...args} className="focus-test" checked />
121
121
  </TableCell>
@@ -166,15 +166,15 @@ const DisabledTemplate: StoryFn<typeof Toggle> = (args) => (
166
166
  </TableHead>
167
167
  <TableBody>
168
168
  <TableRow>
169
- <TableCell>MEDIUM DEFAULT</TableCell>
169
+ <TableCell>SMALL DEFAULT</TableCell>
170
170
  <TableCell>
171
- <Toggle {...args} checked />
171
+ <Toggle {...args} size="small" checked />
172
172
  </TableCell>
173
173
  <TableCell>
174
- <Toggle {...args} indeterminate />
174
+ <Toggle {...args} size="small" indeterminate />
175
175
  </TableCell>
176
176
  <TableCell>
177
- <Toggle {...args} />
177
+ <Toggle {...args} size="small" />
178
178
  </TableCell>
179
179
  </TableRow>
180
180
  <TableRow>
@@ -205,7 +205,7 @@ const TemplateWithLabel: StoryFn<typeof Toggle> = (args) => (
205
205
  </TableHead>
206
206
  <TableBody>
207
207
  <TableRow>
208
- <TableCell>MEDIUM DEFAULT</TableCell>
208
+ <TableCell>SMALL DEFAULT</TableCell>
209
209
  <TableCell>
210
210
  <FormLabel label="Label 1" control={<Toggle {...args} checked />} />
211
211
  </TableCell>
@@ -223,7 +223,7 @@ const TemplateWithLabel: StoryFn<typeof Toggle> = (args) => (
223
223
  </TableCell>
224
224
  </TableRow>
225
225
  <TableRow>
226
- <TableCell>MEDIUM FOCUS</TableCell>
226
+ <TableCell>SMALL FOCUS</TableCell>
227
227
  <TableCell>
228
228
  <FormLabel
229
229
  className="focus-test"
@@ -319,7 +319,7 @@ const IndeterminateTemplate: StoryFn<typeof Toggle> = (args) => {
319
319
  <Table>
320
320
  <TableHead>
321
321
  <TableRow>
322
- <TableCell>MEDIUM</TableCell>
322
+ <TableCell>SMALL</TableCell>
323
323
  <TableCell>LARGE</TableCell>
324
324
  </TableRow>
325
325
  </TableHead>