@charcoal-ui/react 3.7.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.
- package/dist/components/Button/StyledButton.d.ts +1 -0
- package/dist/components/Button/StyledButton.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.story.d.ts +16 -32
- package/dist/components/Button/index.story.d.ts.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts +7 -7
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts +6 -9
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/index.story.d.ts +3 -7
- package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.story.d.ts +9 -12
- package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
- package/dist/components/Icon/index.story.d.ts +4 -26
- package/dist/components/Icon/index.story.d.ts.map +1 -1
- package/dist/components/IconButton/index.d.ts +1 -0
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.story.d.ts +6 -25
- package/dist/components/IconButton/index.story.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +8 -0
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +1 -0
- package/dist/components/LoadingSpinner/index.d.ts +2 -2
- package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/index.story.d.ts +4 -7
- package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
- package/dist/components/Modal/index.story.d.ts +16 -41
- package/dist/components/Modal/index.story.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts +0 -2
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/Radio/index.story.d.ts +12 -23
- package/dist/components/Radio/index.story.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.story.d.ts +5 -8
- package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.story.d.ts +7 -12
- package/dist/components/Switch/index.story.d.ts.map +1 -1
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/components/TagItem/index.story.d.ts +14 -24
- package/dist/components/TagItem/index.story.d.ts.map +1 -1
- package/dist/components/TextArea/TextArea.story.d.ts +7 -25
- package/dist/components/TextArea/TextArea.story.d.ts.map +1 -1
- package/dist/components/TextField/TextField.story.d.ts +13 -20
- package/dist/components/TextField/TextField.story.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/index.cjs.js +80 -86
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +80 -86
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +6 -6
- package/src/components/Button/StyledButton.tsx +19 -14
- package/src/components/Button/__snapshots__/index.story.storyshot +314 -118
- package/src/components/Button/index.story.tsx +141 -138
- package/src/components/Button/index.tsx +3 -0
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +12 -27
- package/src/components/Checkbox/index.tsx +2 -12
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +42 -37
- package/src/components/DropdownSelector/ListItem/index.story.tsx +8 -4
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +38 -38
- package/src/components/DropdownSelector/MenuList/index.story.tsx +33 -27
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +11 -5
- package/src/components/DropdownSelector/Popover/index.story.tsx +6 -6
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +145 -47
- package/src/components/DropdownSelector/index.story.tsx +207 -204
- package/src/components/DropdownSelector/index.tsx +17 -10
- package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
- package/src/components/Icon/index.story.tsx +8 -12
- package/src/components/IconButton/__snapshots__/index.story.storyshot +130 -13
- package/src/components/IconButton/index.story.tsx +30 -23
- package/src/components/IconButton/index.tsx +32 -20
- package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +12 -0
- package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +28 -0
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +1 -35
- package/src/components/LoadingSpinner/index.story.tsx +11 -54
- package/src/components/LoadingSpinner/index.tsx +1 -1
- package/src/components/Modal/__snapshots__/index.story.storyshot +212 -171
- package/src/components/Modal/index.story.tsx +139 -133
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +56 -4
- package/src/components/MultiSelect/index.tsx +3 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +981 -121
- package/src/components/Radio/index.story.tsx +128 -63
- package/src/components/Radio/index.tsx +10 -16
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
- package/src/components/SegmentedControl/index.story.tsx +24 -29
- package/src/components/Switch/__snapshots__/index.story.storyshot +184 -26
- package/src/components/Switch/index.story.tsx +72 -48
- package/src/components/Switch/index.tsx +2 -7
- package/src/components/TagItem/__snapshots__/index.story.storyshot +72 -33
- package/src/components/TagItem/index.story.tsx +154 -159
- package/src/components/TagItem/index.tsx +2 -6
- package/src/components/TextArea/TextArea.story.tsx +29 -32
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +127 -73
- package/src/components/TextField/TextField.story.tsx +67 -66
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +182 -147
- package/src/components/TextField/index.tsx +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
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(
|
|
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(
|
|
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
|
-
|
|
81
|
-
|
|
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[`
|
|
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(
|
|
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(
|
|
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
|
-
|
|
185
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
export const IsActive: StoryObj<typeof IconButton> = {
|
|
47
|
+
args: {
|
|
48
|
+
isActive: true,
|
|
49
|
+
},
|
|
44
50
|
}
|
|
45
51
|
|
|
46
|
-
export const OverlayM:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
{
|
|
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
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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[`
|
|
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
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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> = {}
|