@charcoal-ui/react 3.6.0 → 3.8.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 (127) hide show
  1. package/dist/_lib/compat.d.ts +1 -0
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/components/Button/StyledButton.d.ts +13 -0
  4. package/dist/components/Button/StyledButton.d.ts.map +1 -0
  5. package/dist/components/Button/index.d.ts +3 -2
  6. package/dist/components/Button/index.d.ts.map +1 -1
  7. package/dist/components/Button/index.story.d.ts +16 -32
  8. package/dist/components/Button/index.story.d.ts.map +1 -1
  9. package/dist/components/Button/lib/variantToBackground.d.ts +3 -0
  10. package/dist/components/Button/lib/variantToBackground.d.ts.map +1 -0
  11. package/dist/components/Button/lib/variantToFont.d.ts +3 -0
  12. package/dist/components/Button/lib/variantToFont.d.ts.map +1 -0
  13. package/dist/components/Checkbox/index.d.ts.map +1 -1
  14. package/dist/components/Checkbox/index.story.d.ts +6 -16
  15. package/dist/components/Checkbox/index.story.d.ts.map +1 -1
  16. package/dist/components/Clickable/index.story.d.ts +4 -6
  17. package/dist/components/Clickable/index.story.d.ts.map +1 -1
  18. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +7 -7
  19. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -1
  20. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +6 -9
  21. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -1
  22. package/dist/components/DropdownSelector/Popover/index.story.d.ts +3 -7
  23. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -1
  24. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  25. package/dist/components/DropdownSelector/index.story.d.ts +9 -11
  26. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  27. package/dist/components/Icon/index.story.d.ts +4 -26
  28. package/dist/components/Icon/index.story.d.ts.map +1 -1
  29. package/dist/components/IconButton/index.d.ts +1 -0
  30. package/dist/components/IconButton/index.d.ts.map +1 -1
  31. package/dist/components/IconButton/index.story.d.ts +6 -25
  32. package/dist/components/IconButton/index.story.d.ts.map +1 -1
  33. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +8 -0
  34. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +1 -0
  35. package/dist/components/LoadingSpinner/index.d.ts +2 -2
  36. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  37. package/dist/components/LoadingSpinner/index.story.d.ts +4 -7
  38. package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
  39. package/dist/components/Modal/index.story.d.ts +16 -41
  40. package/dist/components/Modal/index.story.d.ts.map +1 -1
  41. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  42. package/dist/components/Radio/index.d.ts +0 -2
  43. package/dist/components/Radio/index.d.ts.map +1 -1
  44. package/dist/components/Radio/index.story.d.ts +12 -23
  45. package/dist/components/Radio/index.story.d.ts.map +1 -1
  46. package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
  47. package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
  48. package/dist/components/SegmentedControl/index.story.d.ts +5 -8
  49. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  50. package/dist/components/Switch/index.d.ts.map +1 -1
  51. package/dist/components/Switch/index.story.d.ts +7 -12
  52. package/dist/components/Switch/index.story.d.ts.map +1 -1
  53. package/dist/components/TagItem/index.d.ts.map +1 -1
  54. package/dist/components/TagItem/index.story.d.ts +14 -24
  55. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  56. package/dist/components/TextArea/TextArea.story.d.ts +7 -25
  57. package/dist/components/TextArea/TextArea.story.d.ts.map +1 -1
  58. package/dist/components/TextField/TextField.story.d.ts +13 -20
  59. package/dist/components/TextField/TextField.story.d.ts.map +1 -1
  60. package/dist/components/TextField/index.d.ts.map +1 -1
  61. package/dist/index.cjs.js +418 -206
  62. package/dist/index.cjs.js.map +1 -1
  63. package/dist/index.esm.js +387 -175
  64. package/dist/index.esm.js.map +1 -1
  65. package/dist/styled.d.ts +4 -4
  66. package/package.json +17 -20
  67. package/src/_lib/compat.ts +8 -0
  68. package/src/components/Button/StyledButton.tsx +71 -0
  69. package/src/components/Button/__snapshots__/index.story.storyshot +314 -118
  70. package/src/components/Button/index.story.tsx +141 -138
  71. package/src/components/Button/index.tsx +15 -104
  72. package/src/components/Button/lib/variantToBackground.tsx +19 -0
  73. package/src/components/Button/lib/variantToFont.tsx +19 -0
  74. package/src/components/Checkbox/__snapshots__/index.story.storyshot +12 -27
  75. package/src/components/Checkbox/index.story.tsx +82 -88
  76. package/src/components/Checkbox/index.tsx +2 -12
  77. package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
  78. package/src/components/Clickable/index.story.tsx +12 -9
  79. package/src/components/DropdownSelector/DropdownMenuItem.tsx +1 -14
  80. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +42 -37
  81. package/src/components/DropdownSelector/ListItem/index.story.tsx +8 -4
  82. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +38 -38
  83. package/src/components/DropdownSelector/MenuList/index.story.tsx +33 -27
  84. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +11 -5
  85. package/src/components/DropdownSelector/Popover/index.story.tsx +6 -6
  86. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +313 -151
  87. package/src/components/DropdownSelector/index.story.tsx +207 -171
  88. package/src/components/DropdownSelector/index.tsx +22 -22
  89. package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
  90. package/src/components/Icon/index.story.tsx +8 -12
  91. package/src/components/IconButton/__snapshots__/index.story.storyshot +130 -13
  92. package/src/components/IconButton/index.story.tsx +30 -23
  93. package/src/components/IconButton/index.tsx +32 -20
  94. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +12 -0
  95. package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +28 -0
  96. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +1 -35
  97. package/src/components/LoadingSpinner/index.story.tsx +11 -54
  98. package/src/components/LoadingSpinner/index.tsx +1 -1
  99. package/src/components/Modal/__snapshots__/index.story.storyshot +231 -194
  100. package/src/components/Modal/index.story.tsx +139 -133
  101. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +56 -4
  102. package/src/components/MultiSelect/index.tsx +3 -0
  103. package/src/components/Radio/__snapshots__/index.story.storyshot +981 -121
  104. package/src/components/Radio/index.story.tsx +128 -63
  105. package/src/components/Radio/index.tsx +10 -16
  106. package/src/components/SegmentedControl/RadioGroupContext.tsx +1 -1
  107. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +11 -11
  108. package/src/components/SegmentedControl/index.story.tsx +24 -29
  109. package/src/components/SegmentedControl/index.tsx +1 -1
  110. package/src/components/Switch/__snapshots__/index.story.storyshot +184 -26
  111. package/src/components/Switch/index.story.tsx +72 -48
  112. package/src/components/Switch/index.tsx +2 -7
  113. package/src/components/TagItem/__snapshots__/index.story.storyshot +72 -33
  114. package/src/components/TagItem/index.story.tsx +154 -159
  115. package/src/components/TagItem/index.tsx +2 -6
  116. package/src/components/TextArea/TextArea.story.tsx +29 -32
  117. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +139 -83
  118. package/src/components/TextField/TextField.story.tsx +67 -66
  119. package/src/components/TextField/__snapshots__/TextField.story.storyshot +198 -162
  120. package/src/components/TextField/index.tsx +0 -7
  121. package/dist/components/Checkbox/performance.test.d.ts +0 -4
  122. package/dist/components/Checkbox/performance.test.d.ts.map +0 -1
  123. package/dist/components/Checkbox/snapshot.test.d.ts +0 -2
  124. package/dist/components/Checkbox/snapshot.test.d.ts.map +0 -1
  125. package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +0 -1093
  126. package/src/components/Checkbox/performance.test.tsx +0 -30
  127. package/src/components/Checkbox/snapshot.test.tsx +0 -66
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Storyshots IconButton Default M 1`] = `
3
+ exports[`Storybook Tests IconButton DefaultM 1`] = `
4
4
  .c0 {
5
5
  cursor: pointer;
6
6
  -webkit-appearance: none;
@@ -67,24 +67,135 @@ exports[`Storyshots IconButton Default M 1`] = `
67
67
 
68
68
  .c1:not(:disabled):not([aria-disabled]):hover,
69
69
  .c1[aria-disabled='false']:hover {
70
- background-color: var( --charcoal-transparent-hover );
70
+ background-color: var(--charcoal-transparent-hover);
71
71
  }
72
72
 
73
73
  .c1:not(:disabled):not([aria-disabled]):active,
74
74
  .c1[aria-disabled='false']:active {
75
- background-color: var( --charcoal-transparent-press );
75
+ background-color: var(--charcoal-transparent-press);
76
76
  }
77
77
 
78
78
  .c1:not(:disabled):not([aria-disabled]):focus,
79
- .c1[aria-disabled='false']:focus,
80
- .c1:not(:disabled):not([aria-disabled]):active,
81
- .c1[aria-disabled='false']:active,
79
+ .c1[aria-disabled='false']:focus {
80
+ outline: none;
81
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
82
+ }
83
+
84
+ .c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
85
+ .c1[aria-disabled='false']:focus:not(:focus-visible) {
86
+ box-shadow: none;
87
+ }
88
+
82
89
  .c1:not(:disabled):not([aria-disabled]):focus-visible,
83
90
  .c1[aria-disabled='false']:focus-visible {
91
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
92
+ }
93
+
94
+ .c1:disabled,
95
+ .c1[aria-disabled]:not([aria-disabled='false']) {
96
+ opacity: 0.32;
97
+ }
98
+
99
+ <div
100
+ data-dark={false}
101
+ >
102
+ <button
103
+ className="c0 c1"
104
+ title="close"
105
+ >
106
+ <pixiv-icon
107
+ name="24/Close"
108
+ />
109
+ </button>
110
+ </div>
111
+ `;
112
+
113
+ exports[`Storybook Tests IconButton IsActive 1`] = `
114
+ .c0 {
115
+ cursor: pointer;
116
+ -webkit-appearance: none;
117
+ -moz-appearance: none;
118
+ appearance: none;
119
+ background: transparent;
120
+ padding: 0;
121
+ border-style: none;
122
+ outline: none;
123
+ color: inherit;
124
+ text-rendering: inherit;
125
+ -webkit-letter-spacing: inherit;
126
+ -moz-letter-spacing: inherit;
127
+ -ms-letter-spacing: inherit;
128
+ letter-spacing: inherit;
129
+ word-spacing: inherit;
130
+ -webkit-text-decoration: none;
131
+ text-decoration: none;
132
+ font: inherit;
133
+ margin: 0;
134
+ overflow: visible;
135
+ text-transform: none;
136
+ }
137
+
138
+ .c0:disabled,
139
+ .c0[aria-disabled]:not([aria-disabled=false]) {
140
+ cursor: default;
141
+ }
142
+
143
+ .c0:focus {
144
+ outline: none;
145
+ }
146
+
147
+ .c0::-moz-focus-inner {
148
+ border-style: none;
149
+ padding: 0;
150
+ }
151
+
152
+ .c1 {
153
+ -webkit-user-select: none;
154
+ -moz-user-select: none;
155
+ -ms-user-select: none;
156
+ user-select: none;
157
+ width: 40px;
158
+ height: 40px;
159
+ display: -webkit-box;
160
+ display: -webkit-flex;
161
+ display: -ms-flexbox;
162
+ display: flex;
163
+ -webkit-align-items: center;
164
+ -webkit-box-align: center;
165
+ -ms-flex-align: center;
166
+ align-items: center;
167
+ -webkit-box-pack: center;
168
+ -webkit-justify-content: center;
169
+ -ms-flex-pack: center;
170
+ justify-content: center;
171
+ color: var(--charcoal-text3);
172
+ background-color: var(--charcoal-transparent);
173
+ border-radius: 999999px;
174
+ -webkit-transition: 0.2s background-color,0.2s box-shadow;
175
+ transition: 0.2s background-color,0.2s box-shadow;
176
+ }
177
+
178
+ .c1:not(:disabled):not([aria-disabled]),
179
+ .c1[aria-disabled='false'] {
180
+ background-color: var(--charcoal-transparent-press);
181
+ }
182
+
183
+ .c1:not(:disabled):not([aria-disabled]):focus,
184
+ .c1[aria-disabled='false']:focus {
84
185
  outline: none;
85
186
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
86
187
  }
87
188
 
189
+ .c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
190
+ .c1[aria-disabled='false']:focus:not(:focus-visible) {
191
+ box-shadow: none;
192
+ }
193
+
194
+ .c1:not(:disabled):not([aria-disabled]):focus-visible,
195
+ .c1[aria-disabled='false']:focus-visible {
196
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
197
+ }
198
+
88
199
  .c1:disabled,
89
200
  .c1[aria-disabled]:not([aria-disabled='false']) {
90
201
  opacity: 0.32;
@@ -104,7 +215,7 @@ exports[`Storyshots IconButton Default M 1`] = `
104
215
  </div>
105
216
  `;
106
217
 
107
- exports[`Storyshots IconButton Overlay M 1`] = `
218
+ exports[`Storybook Tests IconButton OverlayM 1`] = `
108
219
  .c0 {
109
220
  cursor: pointer;
110
221
  -webkit-appearance: none;
@@ -171,21 +282,27 @@ exports[`Storyshots IconButton Overlay M 1`] = `
171
282
 
172
283
  .c1:not(:disabled):not([aria-disabled]):hover,
173
284
  .c1[aria-disabled='false']:hover {
174
- background-color: var( --charcoal-surface4-hover );
285
+ background-color: var(--charcoal-surface4-hover);
175
286
  }
176
287
 
177
288
  .c1:not(:disabled):not([aria-disabled]):active,
178
289
  .c1[aria-disabled='false']:active {
179
- background-color: var( --charcoal-surface4-press );
290
+ background-color: var(--charcoal-surface4-press);
180
291
  }
181
292
 
182
293
  .c1:not(:disabled):not([aria-disabled]):focus,
183
- .c1[aria-disabled='false']:focus,
184
- .c1:not(:disabled):not([aria-disabled]):active,
185
- .c1[aria-disabled='false']:active,
294
+ .c1[aria-disabled='false']:focus {
295
+ outline: none;
296
+ box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
297
+ }
298
+
299
+ .c1:not(:disabled):not([aria-disabled]):focus:not(:focus-visible),
300
+ .c1[aria-disabled='false']:focus:not(:focus-visible) {
301
+ box-shadow: none;
302
+ }
303
+
186
304
  .c1:not(:disabled):not([aria-disabled]):focus-visible,
187
305
  .c1[aria-disabled='false']:focus-visible {
188
- outline: none;
189
306
  box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
190
307
  }
191
308
 
@@ -1,7 +1,7 @@
1
- import type { Story } from '../../_lib/compat'
2
1
  import '@charcoal-ui/icons'
3
2
  import IconButton from '.'
4
3
  import type { KnownIconType } from '@charcoal-ui/icons'
4
+ import { Meta, StoryObj } from '@storybook/react'
5
5
 
6
6
  export default {
7
7
  title: 'IconButton',
@@ -19,32 +19,39 @@ export default {
19
19
  options: ['M', 'S', 'XS'],
20
20
  },
21
21
  },
22
+ isActive: {
23
+ control: {
24
+ type: 'boolean',
25
+ },
26
+ },
22
27
  },
23
- }
24
-
25
- type Props = {
26
- variant?: 'Default' | 'Overlay'
27
- size?: 'M' | 'S' | 'XS'
28
- }
28
+ render: (props) => {
29
+ const { size } = props
30
+ const icon: keyof KnownIconType = {
31
+ XS: '16/Remove' as const,
32
+ S: '24/Close' as const,
33
+ M: '24/Close' as const,
34
+ }[size ?? 'M']
35
+ return <IconButton title="close" {...props} icon={icon} />
36
+ },
37
+ } as Meta<typeof IconButton>
29
38
 
30
- const Template: Story<Props> = (props) => {
31
- const { size } = props
32
- const icon: keyof KnownIconType = {
33
- XS: '16/Remove' as const,
34
- S: '24/Close' as const,
35
- M: '24/Close' as const,
36
- }[size ?? 'M']
37
- return <IconButton title="close" {...props} icon={icon} />
39
+ export const DefaultM: StoryObj<typeof IconButton> = {
40
+ args: {
41
+ variant: 'Default',
42
+ size: 'M',
43
+ },
38
44
  }
39
45
 
40
- export const DefaultM: Story<Props> = Template.bind({})
41
- DefaultM.args = {
42
- variant: 'Default',
43
- size: 'M',
46
+ export const IsActive: StoryObj<typeof IconButton> = {
47
+ args: {
48
+ isActive: true,
49
+ },
44
50
  }
45
51
 
46
- export const OverlayM: Story<Props> = Template.bind({})
47
- OverlayM.args = {
48
- variant: 'Overlay',
49
- size: 'M',
52
+ export const OverlayM: StoryObj<typeof IconButton> = {
53
+ args: {
54
+ variant: 'Overlay',
55
+ size: 'M',
56
+ },
50
57
  }
@@ -1,7 +1,8 @@
1
1
  import { forwardRef } from 'react'
2
- import styled from 'styled-components'
2
+ import styled, { css } from 'styled-components'
3
3
  import Clickable, { ClickableElement, ClickableProps } from '../Clickable'
4
4
  import type { KnownIconType } from '@charcoal-ui/icons'
5
+ import { focusVisibleFocusRingCss } from '@charcoal-ui/styled'
5
6
 
6
7
  type Variant = 'Default' | 'Overlay'
7
8
  type Size = 'XS' | 'S' | 'M'
@@ -10,18 +11,31 @@ interface StyledProps {
10
11
  readonly variant?: Variant
11
12
  readonly size?: Size
12
13
  readonly icon: keyof KnownIconType
14
+ readonly isActive?: boolean
13
15
  }
14
16
 
15
17
  export type IconButtonProps = StyledProps & ClickableProps
16
18
 
17
19
  const IconButton = forwardRef<ClickableElement, IconButtonProps>(
18
20
  function IconButtonInner(
19
- { variant = 'Default', size = 'M', icon, ...rest }: IconButtonProps,
21
+ {
22
+ variant = 'Default',
23
+ size = 'M',
24
+ icon,
25
+ isActive = false,
26
+ ...rest
27
+ }: IconButtonProps,
20
28
  ref
21
29
  ) {
22
30
  validateIconSize(size, icon)
23
31
  return (
24
- <StyledIconButton {...rest} ref={ref} $size={size} $variant={variant}>
32
+ <StyledIconButton
33
+ {...rest}
34
+ ref={ref}
35
+ $size={size}
36
+ $variant={variant}
37
+ $isActive={isActive}
38
+ >
25
39
  <pixiv-icon name={icon} />
26
40
  </StyledIconButton>
27
41
  )
@@ -33,7 +47,7 @@ export default IconButton
33
47
  type StyledIconButtonProps = Required<{
34
48
  [key in keyof Pick<
35
49
  StyledProps,
36
- 'size' | 'variant'
50
+ 'size' | 'variant' | 'isActive'
37
51
  > as `$${key}`]: StyledProps[key]
38
52
  }>
39
53
 
@@ -55,22 +69,20 @@ const StyledIconButton = styled(Clickable).attrs<
55
69
 
56
70
  &:not(:disabled):not([aria-disabled]),
57
71
  &[aria-disabled='false'] {
58
- &:hover {
59
- background-color: var(
60
- ${({ $background }) => `--charcoal-${$background}-hover`}
61
- );
62
- }
63
- &:active {
64
- background-color: var(
65
- ${({ $background }) => `--charcoal-${$background}-press`}
66
- );
67
- }
68
- &:focus,
69
- &:active,
70
- &:focus-visible {
71
- outline: none;
72
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
73
- }
72
+ ${({ $isActive, $background }) =>
73
+ $isActive
74
+ ? css`
75
+ background-color: var(--charcoal-${$background}-press);
76
+ `
77
+ : css`
78
+ &:hover {
79
+ background-color: var(--charcoal-${$background}-hover);
80
+ }
81
+ &:active {
82
+ background-color: var(--charcoal-${$background}-press);
83
+ }
84
+ `}
85
+ ${focusVisibleFocusRingCss}
74
86
  }
75
87
 
76
88
  &:disabled,
@@ -0,0 +1,12 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+ import { LoadingSpinnerIcon } from '.'
3
+
4
+ export default {
5
+ title: 'LoadingSpinnerIcon',
6
+ component: LoadingSpinnerIcon,
7
+ args: {
8
+ once: false,
9
+ },
10
+ } as Meta<typeof LoadingSpinnerIcon>
11
+
12
+ export const Icon: StoryObj<typeof LoadingSpinnerIcon> = {}
@@ -0,0 +1,28 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Storybook Tests LoadingSpinnerIcon Icon 1`] = `
4
+ .c0 {
5
+ width: 1em;
6
+ height: 1em;
7
+ border-radius: 1em;
8
+ background-color: currentColor;
9
+ -webkit-animation: cNZOgq 1s both ease-out;
10
+ animation: cNZOgq 1s both ease-out;
11
+ -webkit-animation-iteration-count: infinite;
12
+ animation-iteration-count: infinite;
13
+ }
14
+
15
+ .c0[data-reset-animation] {
16
+ -webkit-animation: none;
17
+ animation: none;
18
+ }
19
+
20
+ <div
21
+ data-dark={false}
22
+ >
23
+ <div
24
+ className="c0"
25
+ role="presentation"
26
+ />
27
+ </div>
28
+ `;
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Storyshots LoadingSpinner Basic 1`] = `
3
+ exports[`Storybook Tests LoadingSpinner Default 1`] = `
4
4
  .c0 {
5
5
  box-sizing: content-box;
6
6
  margin: auto;
@@ -45,37 +45,3 @@ exports[`Storyshots LoadingSpinner Basic 1`] = `
45
45
  </div>
46
46
  </div>
47
47
  `;
48
-
49
- exports[`Storyshots LoadingSpinner Icon 1`] = `
50
- .c0 {
51
- width: 1em;
52
- height: 1em;
53
- border-radius: 1em;
54
- background-color: currentColor;
55
- -webkit-animation: cNZOgq 1s both ease-out;
56
- animation: cNZOgq 1s both ease-out;
57
- -webkit-animation-iteration-count: infinite;
58
- animation-iteration-count: infinite;
59
- }
60
-
61
- .c0[data-reset-animation] {
62
- -webkit-animation: none;
63
- animation: none;
64
- }
65
-
66
- <div
67
- data-dark={false}
68
- >
69
- <div
70
- css="
71
- font-size: 12px;
72
- color: #B1CC29;
73
- "
74
- >
75
- <div
76
- className="c0"
77
- role="presentation"
78
- />
79
- </div>
80
- </div>
81
- `;
@@ -1,58 +1,15 @@
1
- import {
2
- boolean,
3
- button,
4
- number,
5
- text,
6
- withKnobs,
7
- } from '@storybook/addon-knobs'
8
- import { useRef } from 'react'
9
- import LoadingSpinner, {
10
- LoadingSpinnerIcon,
11
- LoadingSpinnerIconHandler,
12
- } from '.'
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+ import LoadingSpinner from '.'
13
3
 
14
4
  export default {
15
5
  title: 'LoadingSpinner',
16
6
  component: LoadingSpinner,
17
- decorators: [withKnobs],
18
- }
19
-
20
- export function Basic() {
21
- const size = number('size', 48)
22
- const padding = number('padding', 16)
23
- const transparent = boolean('transparent', false)
24
- const className = text('className', 'basic')
25
-
26
- return (
27
- <LoadingSpinner
28
- size={size}
29
- padding={padding}
30
- transparent={transparent}
31
- className={className}
32
- />
33
- )
34
- }
35
-
36
- export function Icon() {
37
- return <IconComponent />
38
- }
39
-
40
- function IconComponent() {
41
- const size = number('size', 12)
42
- const color = text('color', '#B1CC29')
43
- const once = boolean('once', false)
44
- button('restart', () => ref.current?.restart())
45
-
46
- const ref = useRef<LoadingSpinnerIconHandler>(null)
47
-
48
- return (
49
- <div
50
- css={`
51
- font-size: ${size}px;
52
- color: ${color};
53
- `}
54
- >
55
- <LoadingSpinnerIcon once={once} ref={ref} />
56
- </div>
57
- )
58
- }
7
+ args: {
8
+ size: 48,
9
+ padding: 16,
10
+ transparent: false,
11
+ className: 'basic',
12
+ },
13
+ } as Meta<typeof LoadingSpinner>
14
+
15
+ export const Default: StoryObj<typeof LoadingSpinner> = {}
@@ -72,7 +72,7 @@ const Icon = styled.div.attrs({ role: 'presentation' })<{ once: boolean }>`
72
72
  }
73
73
  `
74
74
 
75
- interface Props {
75
+ type Props = {
76
76
  once?: boolean
77
77
  }
78
78