@charcoal-ui/react 3.3.0-beta.0 → 3.4.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/_lib/useForwardedRef.d.ts +3 -0
- package/dist/_lib/useForwardedRef.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts +1 -0
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/Clickable/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/usePreventScroll.d.ts +2 -0
- package/dist/components/DropdownSelector/Popover/usePreventScroll.d.ts.map +1 -0
- package/dist/components/DropdownSelector/index.story.d.ts +1 -0
- package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
- package/dist/components/Icon/index.story.d.ts +1 -1
- package/dist/components/Modal/Dialog/index.d.ts +26 -0
- package/dist/components/Modal/Dialog/index.d.ts.map +1 -0
- package/dist/components/Modal/ModalBackgroundContext.d.ts +6 -0
- package/dist/components/Modal/ModalBackgroundContext.d.ts.map +1 -0
- package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
- package/dist/components/Modal/__stories__/InternalScrollStory.d.ts +4 -0
- package/dist/components/Modal/__stories__/InternalScrollStory.d.ts.map +1 -0
- package/dist/components/Modal/index.d.ts +12 -2
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.story.d.ts +3 -2
- package/dist/components/Modal/index.story.d.ts.map +1 -1
- package/dist/index.cjs.js +392 -301
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +354 -264
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/_lib/useForwardedRef.tsx +16 -0
- package/src/components/Button/__snapshots__/index.story.storyshot +1971 -0
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +390 -0
- package/src/components/Checkbox/index.story.tsx +3 -0
- package/src/components/Checkbox/index.tsx +7 -4
- package/src/components/Clickable/__snapshots__/index.story.storyshot +100 -0
- package/src/components/Clickable/index.tsx +17 -35
- package/src/components/DropdownSelector/DropdownPopover.tsx +0 -1
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +245 -0
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +555 -0
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +174 -0
- package/src/components/DropdownSelector/Popover/index.tsx +17 -2
- package/src/components/DropdownSelector/Popover/usePreventScroll.tsx +18 -0
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +1241 -0
- package/src/components/DropdownSelector/index.story.tsx +69 -13
- package/src/components/Icon/__snapshots__/index.story.storyshot +12 -0
- package/src/components/{Button/__snapshots__/index.test.tsx.snap → IconButton/__snapshots__/index.story.storyshot} +94 -91
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +81 -0
- package/src/components/Modal/Dialog/index.tsx +82 -0
- package/src/components/Modal/ModalBackgroundContext.tsx +8 -0
- package/src/components/Modal/ModalPlumbing.tsx +16 -4
- package/src/components/Modal/__snapshots__/index.story.storyshot +533 -0
- package/src/components/Modal/__stories__/InternalScrollStory.tsx +75 -0
- package/src/components/Modal/index.story.tsx +57 -38
- package/src/components/Modal/index.tsx +63 -94
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +511 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +319 -0
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +483 -0
- package/src/components/Switch/__snapshots__/index.story.storyshot +454 -0
- package/src/components/TagItem/__snapshots__/index.story.storyshot +1181 -0
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1271 -0
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +1800 -0
- package/dist/components/Button/index.test.d.ts +0 -4
- package/dist/components/Button/index.test.d.ts.map +0 -1
- package/src/components/Button/index.test.tsx +0 -24
|
@@ -4,6 +4,10 @@ import { Story } from '../../_lib/compat'
|
|
|
4
4
|
import { Divider } from './Divider'
|
|
5
5
|
import MenuItemGroup from './MenuItemGroup'
|
|
6
6
|
import DropdownMenuItem from './DropdownMenuItem'
|
|
7
|
+
import Modal from '../Modal'
|
|
8
|
+
import { ModalBody, ModalHeader } from '../Modal/ModalPlumbing'
|
|
9
|
+
import styled from 'styled-components'
|
|
10
|
+
import Button from '../Button'
|
|
7
11
|
|
|
8
12
|
export default {
|
|
9
13
|
title: 'DropdownSelector',
|
|
@@ -26,6 +30,7 @@ export const Playground: Story<DropdownSelectorProps> = (
|
|
|
26
30
|
const [selected, setSelected] = useState('50')
|
|
27
31
|
return (
|
|
28
32
|
<div style={{ width: 288 }}>
|
|
33
|
+
<Button></Button>
|
|
29
34
|
<DropdownSelector
|
|
30
35
|
{...props}
|
|
31
36
|
onChange={(value) => {
|
|
@@ -51,27 +56,78 @@ Playground.args = { ...baseProps }
|
|
|
51
56
|
export const Basic: Story<DropdownSelectorProps> = (
|
|
52
57
|
props: DropdownSelectorProps
|
|
53
58
|
) => {
|
|
54
|
-
const [selected, setSelected] = useState('')
|
|
55
59
|
return (
|
|
56
60
|
<div style={{ width: 288 }}>
|
|
57
|
-
<
|
|
58
|
-
{...props}
|
|
59
|
-
onChange={(value) => {
|
|
60
|
-
setSelected(value)
|
|
61
|
-
}}
|
|
62
|
-
value={selected}
|
|
63
|
-
label="label"
|
|
64
|
-
>
|
|
65
|
-
<DropdownMenuItem value={'10'}>Apple</DropdownMenuItem>
|
|
66
|
-
<DropdownMenuItem value={'20'}>Banana</DropdownMenuItem>
|
|
67
|
-
<DropdownMenuItem value={'30'}>Orange</DropdownMenuItem>
|
|
68
|
-
</DropdownSelector>
|
|
61
|
+
<PlaygroundDropdownSelector {...props} />
|
|
69
62
|
</div>
|
|
70
63
|
)
|
|
71
64
|
}
|
|
72
65
|
|
|
73
66
|
Basic.args = { ...baseProps }
|
|
74
67
|
|
|
68
|
+
function PlaygroundDropdownSelector(props: Partial<DropdownSelectorProps>) {
|
|
69
|
+
const [selected, setSelected] = useState('10')
|
|
70
|
+
return (
|
|
71
|
+
<DropdownSelector
|
|
72
|
+
{...props}
|
|
73
|
+
onChange={(value) => {
|
|
74
|
+
setSelected(value)
|
|
75
|
+
}}
|
|
76
|
+
value={selected}
|
|
77
|
+
label="label"
|
|
78
|
+
>
|
|
79
|
+
<DropdownMenuItem value={'10'}>Apple</DropdownMenuItem>
|
|
80
|
+
<DropdownMenuItem value={'20'}>Banana</DropdownMenuItem>
|
|
81
|
+
<DropdownMenuItem value={'30'}>Orange</DropdownMenuItem>
|
|
82
|
+
</DropdownSelector>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const DummyBox = styled.div`
|
|
87
|
+
border: solid 1px ${({ theme }) => theme.border.default.color};
|
|
88
|
+
display: flex;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
align-items: center;
|
|
91
|
+
height: 256px;
|
|
92
|
+
`
|
|
93
|
+
|
|
94
|
+
export const InModal: Story<DropdownSelectorProps> = () => {
|
|
95
|
+
const [open, setOpen] = useState(true)
|
|
96
|
+
return (
|
|
97
|
+
<div
|
|
98
|
+
style={{
|
|
99
|
+
height: '10px',
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
<button onClick={() => setOpen(true)}>open</button>
|
|
103
|
+
<Modal
|
|
104
|
+
bottomSheet="full"
|
|
105
|
+
title="modal"
|
|
106
|
+
isOpen={open}
|
|
107
|
+
isDismissable
|
|
108
|
+
onClose={() => {
|
|
109
|
+
setOpen(false)
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
<ModalHeader />
|
|
113
|
+
<ModalBody>
|
|
114
|
+
<div
|
|
115
|
+
style={{
|
|
116
|
+
padding: '16px',
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
<DummyBox>256px</DummyBox>
|
|
120
|
+
<PlaygroundDropdownSelector />
|
|
121
|
+
<DummyBox>256px</DummyBox>
|
|
122
|
+
<PlaygroundDropdownSelector />
|
|
123
|
+
<DummyBox>256px</DummyBox>
|
|
124
|
+
</div>
|
|
125
|
+
</ModalBody>
|
|
126
|
+
</Modal>
|
|
127
|
+
</div>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
75
131
|
export const InFormTag: Story<DropdownSelectorProps> = (
|
|
76
132
|
props: DropdownSelectorProps
|
|
77
133
|
) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Storyshots IconButton Default M 1`] = `
|
|
4
4
|
.c0 {
|
|
5
|
+
cursor: pointer;
|
|
5
6
|
-webkit-appearance: none;
|
|
6
7
|
-moz-appearance: none;
|
|
7
8
|
appearance: none;
|
|
@@ -20,7 +21,11 @@ exports[`Basic <Button>Hello</Button> 1`] = `
|
|
|
20
21
|
margin: 0;
|
|
21
22
|
overflow: visible;
|
|
22
23
|
text-transform: none;
|
|
23
|
-
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.c0:disabled,
|
|
27
|
+
.c0[aria-disabled]:not([aria-disabled=false]) {
|
|
28
|
+
cursor: default;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
.c0:focus {
|
|
@@ -32,16 +37,17 @@ exports[`Basic <Button>Hello</Button> 1`] = `
|
|
|
32
37
|
padding: 0;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
|
-
.c0:disabled,
|
|
36
|
-
.c0[aria-disabled]:not([aria-disabled=false]) {
|
|
37
|
-
cursor: default;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
40
|
.c1 {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
-webkit-user-select: none;
|
|
42
|
+
-moz-user-select: none;
|
|
43
|
+
-ms-user-select: none;
|
|
44
|
+
user-select: none;
|
|
45
|
+
width: 40px;
|
|
46
|
+
height: 40px;
|
|
47
|
+
display: -webkit-box;
|
|
48
|
+
display: -webkit-flex;
|
|
49
|
+
display: -ms-flexbox;
|
|
50
|
+
display: flex;
|
|
45
51
|
-webkit-align-items: center;
|
|
46
52
|
-webkit-box-align: center;
|
|
47
53
|
-ms-flex-align: center;
|
|
@@ -50,43 +56,21 @@ exports[`Basic <Button>Hello</Button> 1`] = `
|
|
|
50
56
|
-webkit-justify-content: center;
|
|
51
57
|
-ms-flex-pack: center;
|
|
52
58
|
justify-content: center;
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-moz-user-select: none;
|
|
56
|
-
-ms-user-select: none;
|
|
57
|
-
user-select: none;
|
|
58
|
-
white-space: nowrap;
|
|
59
|
-
color: var(--charcoal-text2);
|
|
60
|
-
background-color: var(--charcoal-surface3);
|
|
61
|
-
font-size: 14px;
|
|
62
|
-
line-height: 22px;
|
|
63
|
-
font-weight: bold;
|
|
64
|
-
padding-right: 24px;
|
|
65
|
-
padding-left: 24px;
|
|
59
|
+
color: var(--charcoal-text3);
|
|
60
|
+
background-color: var(--charcoal-transparent);
|
|
66
61
|
border-radius: 999999px;
|
|
67
|
-
-webkit-transition: 0.2s
|
|
68
|
-
transition: 0.2s
|
|
69
|
-
height: 40px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.c1:hover:not(:disabled):not([aria-disabled]),
|
|
73
|
-
.c1:hover[aria-disabled=false] {
|
|
74
|
-
color: var(--charcoal-text2-hover);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.c1:active:not(:disabled):not([aria-disabled]),
|
|
78
|
-
.c1:active[aria-disabled=false] {
|
|
79
|
-
color: var(--charcoal-text2-press);
|
|
62
|
+
-webkit-transition: 0.2s background-color,0.2s box-shadow;
|
|
63
|
+
transition: 0.2s background-color,0.2s box-shadow;
|
|
80
64
|
}
|
|
81
65
|
|
|
82
66
|
.c1:hover:not(:disabled):not([aria-disabled]),
|
|
83
67
|
.c1:hover[aria-disabled=false] {
|
|
84
|
-
background-color: var(--charcoal-
|
|
68
|
+
background-color: var(--charcoal-transparent-hover);
|
|
85
69
|
}
|
|
86
70
|
|
|
87
71
|
.c1:active:not(:disabled):not([aria-disabled]),
|
|
88
72
|
.c1:active[aria-disabled=false] {
|
|
89
|
-
background-color: var(--charcoal-
|
|
73
|
+
background-color: var(--charcoal-transparent-press);
|
|
90
74
|
}
|
|
91
75
|
|
|
92
76
|
.c1:disabled,
|
|
@@ -115,26 +99,44 @@ exports[`Basic <Button>Hello</Button> 1`] = `
|
|
|
115
99
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
116
100
|
}
|
|
117
101
|
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
disabled={false}
|
|
102
|
+
<div
|
|
103
|
+
data-dark={false}
|
|
121
104
|
>
|
|
122
|
-
|
|
123
|
-
|
|
105
|
+
<button
|
|
106
|
+
className="c0 c1"
|
|
107
|
+
height={40}
|
|
108
|
+
size="M"
|
|
109
|
+
title="close"
|
|
110
|
+
width={40}
|
|
111
|
+
>
|
|
112
|
+
<pixiv-icon
|
|
113
|
+
name="24/Close"
|
|
114
|
+
/>
|
|
115
|
+
</button>
|
|
116
|
+
</div>
|
|
124
117
|
`;
|
|
125
118
|
|
|
126
|
-
exports[`
|
|
119
|
+
exports[`Storyshots IconButton Overlay M 1`] = `
|
|
127
120
|
.c0 {
|
|
128
|
-
color: inherit;
|
|
129
121
|
cursor: pointer;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
122
|
+
-webkit-appearance: none;
|
|
123
|
+
-moz-appearance: none;
|
|
124
|
+
appearance: none;
|
|
125
|
+
background: transparent;
|
|
126
|
+
padding: 0;
|
|
127
|
+
border-style: none;
|
|
133
128
|
outline: none;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
color: inherit;
|
|
130
|
+
text-rendering: inherit;
|
|
131
|
+
-webkit-letter-spacing: inherit;
|
|
132
|
+
-moz-letter-spacing: inherit;
|
|
133
|
+
-ms-letter-spacing: inherit;
|
|
134
|
+
letter-spacing: inherit;
|
|
135
|
+
word-spacing: inherit;
|
|
136
|
+
font: inherit;
|
|
137
|
+
margin: 0;
|
|
138
|
+
overflow: visible;
|
|
139
|
+
text-transform: none;
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
.c0:disabled,
|
|
@@ -142,11 +144,26 @@ exports[`Link <Button to="#">Hello</Button> 1`] = `
|
|
|
142
144
|
cursor: default;
|
|
143
145
|
}
|
|
144
146
|
|
|
147
|
+
.c0:focus {
|
|
148
|
+
outline: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.c0::-moz-focus-inner {
|
|
152
|
+
border-style: none;
|
|
153
|
+
padding: 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
145
156
|
.c1 {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
157
|
+
-webkit-user-select: none;
|
|
158
|
+
-moz-user-select: none;
|
|
159
|
+
-ms-user-select: none;
|
|
160
|
+
user-select: none;
|
|
161
|
+
width: 40px;
|
|
162
|
+
height: 40px;
|
|
163
|
+
display: -webkit-box;
|
|
164
|
+
display: -webkit-flex;
|
|
165
|
+
display: -ms-flexbox;
|
|
166
|
+
display: flex;
|
|
150
167
|
-webkit-align-items: center;
|
|
151
168
|
-webkit-box-align: center;
|
|
152
169
|
-ms-flex-align: center;
|
|
@@ -155,43 +172,21 @@ exports[`Link <Button to="#">Hello</Button> 1`] = `
|
|
|
155
172
|
-webkit-justify-content: center;
|
|
156
173
|
-ms-flex-pack: center;
|
|
157
174
|
justify-content: center;
|
|
158
|
-
|
|
159
|
-
-
|
|
160
|
-
-moz-user-select: none;
|
|
161
|
-
-ms-user-select: none;
|
|
162
|
-
user-select: none;
|
|
163
|
-
white-space: nowrap;
|
|
164
|
-
color: var(--charcoal-text2);
|
|
165
|
-
background-color: var(--charcoal-surface3);
|
|
166
|
-
font-size: 14px;
|
|
167
|
-
line-height: 22px;
|
|
168
|
-
font-weight: bold;
|
|
169
|
-
padding-right: 24px;
|
|
170
|
-
padding-left: 24px;
|
|
175
|
+
color: var(--charcoal-text5);
|
|
176
|
+
background-color: var(--charcoal-surface4);
|
|
171
177
|
border-radius: 999999px;
|
|
172
|
-
-webkit-transition: 0.2s
|
|
173
|
-
transition: 0.2s
|
|
174
|
-
height: 40px;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.c1:hover:not(:disabled):not([aria-disabled]),
|
|
178
|
-
.c1:hover[aria-disabled=false] {
|
|
179
|
-
color: var(--charcoal-text2-hover);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.c1:active:not(:disabled):not([aria-disabled]),
|
|
183
|
-
.c1:active[aria-disabled=false] {
|
|
184
|
-
color: var(--charcoal-text2-press);
|
|
178
|
+
-webkit-transition: 0.2s background-color,0.2s box-shadow;
|
|
179
|
+
transition: 0.2s background-color,0.2s box-shadow;
|
|
185
180
|
}
|
|
186
181
|
|
|
187
182
|
.c1:hover:not(:disabled):not([aria-disabled]),
|
|
188
183
|
.c1:hover[aria-disabled=false] {
|
|
189
|
-
background-color: var(--charcoal-
|
|
184
|
+
background-color: var(--charcoal-surface4-hover);
|
|
190
185
|
}
|
|
191
186
|
|
|
192
187
|
.c1:active:not(:disabled):not([aria-disabled]),
|
|
193
188
|
.c1:active[aria-disabled=false] {
|
|
194
|
-
background-color: var(--charcoal-
|
|
189
|
+
background-color: var(--charcoal-surface4-press);
|
|
195
190
|
}
|
|
196
191
|
|
|
197
192
|
.c1:disabled,
|
|
@@ -220,11 +215,19 @@ exports[`Link <Button to="#">Hello</Button> 1`] = `
|
|
|
220
215
|
box-shadow: 0 0 0 4px rgba(0,150,250,0.32);
|
|
221
216
|
}
|
|
222
217
|
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
className="c0 c1"
|
|
226
|
-
href="#"
|
|
218
|
+
<div
|
|
219
|
+
data-dark={false}
|
|
227
220
|
>
|
|
228
|
-
|
|
229
|
-
|
|
221
|
+
<button
|
|
222
|
+
className="c0 c1"
|
|
223
|
+
height={40}
|
|
224
|
+
size="M"
|
|
225
|
+
title="close"
|
|
226
|
+
width={40}
|
|
227
|
+
>
|
|
228
|
+
<pixiv-icon
|
|
229
|
+
name="24/Close"
|
|
230
|
+
/>
|
|
231
|
+
</button>
|
|
232
|
+
</div>
|
|
230
233
|
`;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Storyshots LoadingSpinner Basic 1`] = `
|
|
4
|
+
.c0 {
|
|
5
|
+
box-sizing: content-box;
|
|
6
|
+
margin: auto;
|
|
7
|
+
padding: 16px;
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
font-size: 48px;
|
|
10
|
+
width: 48px;
|
|
11
|
+
height: 48px;
|
|
12
|
+
opacity: 0.84;
|
|
13
|
+
color: var(--charcoal-text4);
|
|
14
|
+
background-color: var(--charcoal-background1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.c1 {
|
|
18
|
+
width: 1em;
|
|
19
|
+
height: 1em;
|
|
20
|
+
border-radius: 1em;
|
|
21
|
+
background-color: currentColor;
|
|
22
|
+
-webkit-animation: cNZOgq 1s both ease-out;
|
|
23
|
+
animation: cNZOgq 1s both ease-out;
|
|
24
|
+
-webkit-animation-iteration-count: infinite;
|
|
25
|
+
animation-iteration-count: infinite;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.c1[data-reset-animation] {
|
|
29
|
+
-webkit-animation: none;
|
|
30
|
+
animation: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
data-dark={false}
|
|
35
|
+
>
|
|
36
|
+
<div
|
|
37
|
+
className="c0 basic"
|
|
38
|
+
role="progressbar"
|
|
39
|
+
size={48}
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
className="c1"
|
|
43
|
+
role="presentation"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
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
|
+
`;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { forwardRef } from 'react'
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import styled, { css } from 'styled-components'
|
|
4
|
+
import { useDialog } from '@react-aria/dialog'
|
|
5
|
+
import { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from '@charcoal-ui/foundation'
|
|
6
|
+
import { unreachable } from '../../../_lib'
|
|
7
|
+
import { maxWidth } from '@charcoal-ui/utils'
|
|
8
|
+
import { animated } from 'react-spring'
|
|
9
|
+
import { useForwardedRef } from '../../../_lib/useForwardedRef'
|
|
10
|
+
import { Size, BottomSheet } from '..'
|
|
11
|
+
|
|
12
|
+
export const Dialog = forwardRef<
|
|
13
|
+
HTMLDivElement,
|
|
14
|
+
React.ComponentProps<typeof AnimatedStyledDialogDiv>
|
|
15
|
+
>(function Dialog(props, forwardRef) {
|
|
16
|
+
const ref = useForwardedRef(forwardRef)
|
|
17
|
+
const { dialogProps } = useDialog(
|
|
18
|
+
{
|
|
19
|
+
role: 'dialog',
|
|
20
|
+
},
|
|
21
|
+
ref
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<AnimatedStyledDialogDiv
|
|
26
|
+
{...props}
|
|
27
|
+
role={dialogProps.role}
|
|
28
|
+
tabIndex={dialogProps.tabIndex}
|
|
29
|
+
aria-labelledby={dialogProps['aria-labelledby']}
|
|
30
|
+
onBlur={dialogProps.onBlur}
|
|
31
|
+
ref={ref}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const AnimatedStyledDialogDiv = animated(styled.div<{
|
|
37
|
+
size: Size
|
|
38
|
+
bottomSheet: BottomSheet
|
|
39
|
+
}>`
|
|
40
|
+
margin: auto;
|
|
41
|
+
position: relative;
|
|
42
|
+
height: fit-content;
|
|
43
|
+
width: ${(p) => {
|
|
44
|
+
switch (p.size) {
|
|
45
|
+
case 'S': {
|
|
46
|
+
return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
|
|
47
|
+
}
|
|
48
|
+
case 'M': {
|
|
49
|
+
return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
|
|
50
|
+
}
|
|
51
|
+
case 'L': {
|
|
52
|
+
return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
|
|
53
|
+
}
|
|
54
|
+
default: {
|
|
55
|
+
return unreachable(p.size)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}}px;
|
|
59
|
+
|
|
60
|
+
background-color: ${({ theme }) => theme.color.background1};
|
|
61
|
+
border-radius: 24px;
|
|
62
|
+
|
|
63
|
+
@media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
|
|
64
|
+
max-width: 440px;
|
|
65
|
+
width: calc(100% - 48px);
|
|
66
|
+
${(p) =>
|
|
67
|
+
p.bottomSheet !== false &&
|
|
68
|
+
css`
|
|
69
|
+
max-width: unset;
|
|
70
|
+
width: 100%;
|
|
71
|
+
border-radius: 0;
|
|
72
|
+
margin: auto 0 0 0;
|
|
73
|
+
${p.bottomSheet === 'full' &&
|
|
74
|
+
css`
|
|
75
|
+
min-height: 100%;
|
|
76
|
+
`}
|
|
77
|
+
`}
|
|
78
|
+
}
|
|
79
|
+
:focus {
|
|
80
|
+
outline: none;
|
|
81
|
+
}
|
|
82
|
+
`)
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
import { ModalTitle } from '.'
|
|
2
|
-
import styled from 'styled-components'
|
|
1
|
+
import { BottomSheet, ModalContext, ModalTitle } from '.'
|
|
2
|
+
import styled, { css } from 'styled-components'
|
|
3
3
|
import { theme } from '../../styled'
|
|
4
|
+
import { useContext } from 'react'
|
|
5
|
+
import { maxWidth } from '@charcoal-ui/utils'
|
|
4
6
|
|
|
5
7
|
export function ModalHeader() {
|
|
8
|
+
const modalCtx = useContext(ModalContext)
|
|
6
9
|
return (
|
|
7
|
-
<ModalHeaderRoot>
|
|
10
|
+
<ModalHeaderRoot $bottomSheet={modalCtx.bottomSheet}>
|
|
8
11
|
<StyledModalTitle />
|
|
9
12
|
</ModalHeaderRoot>
|
|
10
13
|
)
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
const ModalHeaderRoot = styled.div
|
|
16
|
+
const ModalHeaderRoot = styled.div<{
|
|
17
|
+
$bottomSheet: BottomSheet
|
|
18
|
+
}>`
|
|
14
19
|
height: 64px;
|
|
15
20
|
display: grid;
|
|
16
21
|
align-content: center;
|
|
17
22
|
justify-content: center;
|
|
23
|
+
@media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
|
|
24
|
+
${(p) =>
|
|
25
|
+
p.$bottomSheet !== false &&
|
|
26
|
+
css`
|
|
27
|
+
height: 48px;
|
|
28
|
+
`}
|
|
29
|
+
}
|
|
18
30
|
`
|
|
19
31
|
|
|
20
32
|
const StyledModalTitle = styled(ModalTitle)`
|