@charcoal-ui/react 3.0.0-beta.1 → 3.0.0-beta.2
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/LoadingSpinner/index.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +5 -2
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
- package/dist/index.cjs.js +52 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +52 -27
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/components/LoadingSpinner/index.tsx +1 -0
- package/src/components/Modal/index.tsx +79 -61
- package/src/components/Radio/index.tsx +2 -0
- package/src/components/SegmentedControl/index.story.tsx +2 -0
- package/src/components/SegmentedControl/index.tsx +1 -0
- package/src/components/TextField/index.tsx +1 -0
- package/src/index.ts +1 -1
- package/dist/components/DropdownSelector/OptionLi.d.ts +0 -11
- package/dist/components/DropdownSelector/OptionLi.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charcoal-ui/react",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"typescript": "^4.9.5"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@charcoal-ui/icons": "^3.0.0-beta.
|
|
53
|
-
"@charcoal-ui/styled": "^3.0.0-beta.
|
|
54
|
-
"@charcoal-ui/theme": "^3.0.0-beta.
|
|
55
|
-
"@charcoal-ui/utils": "^3.0.0-beta.
|
|
52
|
+
"@charcoal-ui/icons": "^3.0.0-beta.2",
|
|
53
|
+
"@charcoal-ui/styled": "^3.0.0-beta.2",
|
|
54
|
+
"@charcoal-ui/theme": "^3.0.0-beta.2",
|
|
55
|
+
"@charcoal-ui/utils": "^3.0.0-beta.2",
|
|
56
56
|
"@react-aria/button": "^3.7.0",
|
|
57
57
|
"@react-aria/checkbox": "^3.8.0",
|
|
58
58
|
"@react-aria/dialog": "^3.5.0",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"url": "https://github.com/pixiv/charcoal.git",
|
|
89
89
|
"directory": "packages/react"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "dbf33f97e67fc6eabc4283fa38ac9af0b89292f4"
|
|
92
92
|
}
|
|
@@ -18,13 +18,16 @@ import { animated, useTransition, easings } from 'react-spring'
|
|
|
18
18
|
import Button, { ButtonProps } from '../Button'
|
|
19
19
|
import IconButton from '../IconButton'
|
|
20
20
|
|
|
21
|
+
type BottomSheet = boolean | 'full'
|
|
22
|
+
type Size = 'S' | 'M' | 'L'
|
|
23
|
+
|
|
21
24
|
export type ModalProps = AriaModalOverlayProps &
|
|
22
25
|
AriaDialogProps & {
|
|
23
26
|
children: React.ReactNode
|
|
24
27
|
zIndex?: number
|
|
25
28
|
title: string
|
|
26
|
-
size?:
|
|
27
|
-
bottomSheet?:
|
|
29
|
+
size?: Size
|
|
30
|
+
bottomSheet?: BottomSheet
|
|
28
31
|
isOpen: boolean
|
|
29
32
|
onClose: () => void
|
|
30
33
|
|
|
@@ -133,28 +136,30 @@ export default function Modal({
|
|
|
133
136
|
style={transitionEnabled ? { backgroundColor } : {}}
|
|
134
137
|
>
|
|
135
138
|
<FocusScope contain restoreFocus autoFocus>
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<ModalContext.Provider
|
|
146
|
-
value={{ titleProps, title, close: onClose, showDismiss }}
|
|
139
|
+
<DialogContainer bottomSheet={bottomSheet} size={size}>
|
|
140
|
+
<ModalDialog
|
|
141
|
+
ref={ref}
|
|
142
|
+
{...overlayProps}
|
|
143
|
+
{...modalProps}
|
|
144
|
+
{...dialogProps}
|
|
145
|
+
style={transitionEnabled ? { transform } : {}}
|
|
146
|
+
size={size}
|
|
147
|
+
bottomSheet={bottomSheet}
|
|
147
148
|
>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
<ModalContext.Provider
|
|
150
|
+
value={{ titleProps, title, close: onClose, showDismiss }}
|
|
151
|
+
>
|
|
152
|
+
{children}
|
|
153
|
+
{isDismissable === true && (
|
|
154
|
+
<ModalCrossButton
|
|
155
|
+
size="S"
|
|
156
|
+
icon="24/Close"
|
|
157
|
+
onClick={onClose}
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
160
|
+
</ModalContext.Provider>
|
|
161
|
+
</ModalDialog>
|
|
162
|
+
</DialogContainer>
|
|
158
163
|
</FocusScope>
|
|
159
164
|
</ModalBackground>
|
|
160
165
|
</Overlay>
|
|
@@ -176,6 +181,8 @@ const ModalContext = React.createContext<{
|
|
|
176
181
|
|
|
177
182
|
const ModalBackground = animated(styled.div<{ zIndex: number }>`
|
|
178
183
|
z-index: ${({ zIndex }) => zIndex};
|
|
184
|
+
overflow: scroll;
|
|
185
|
+
display: flex;
|
|
179
186
|
position: fixed;
|
|
180
187
|
top: 0;
|
|
181
188
|
left: 0;
|
|
@@ -185,50 +192,61 @@ const ModalBackground = animated(styled.div<{ zIndex: number }>`
|
|
|
185
192
|
${theme((o) => [o.bg.surface4])}
|
|
186
193
|
`)
|
|
187
194
|
|
|
195
|
+
const DialogContainer = styled.div<{ bottomSheet: BottomSheet; size: Size }>`
|
|
196
|
+
position: relative;
|
|
197
|
+
margin: auto;
|
|
198
|
+
padding: 24px 0;
|
|
199
|
+
width: ${(p) => {
|
|
200
|
+
switch (p.size) {
|
|
201
|
+
case 'S': {
|
|
202
|
+
return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
|
|
203
|
+
}
|
|
204
|
+
case 'M': {
|
|
205
|
+
return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
|
|
206
|
+
}
|
|
207
|
+
case 'L': {
|
|
208
|
+
return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
|
|
209
|
+
}
|
|
210
|
+
default: {
|
|
211
|
+
return unreachable(p.size)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}}px;
|
|
215
|
+
|
|
216
|
+
@media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
|
|
217
|
+
width: calc(100% - 48px);
|
|
218
|
+
${(p) =>
|
|
219
|
+
p.bottomSheet !== false &&
|
|
220
|
+
css`
|
|
221
|
+
margin: 0;
|
|
222
|
+
padding: 0;
|
|
223
|
+
bottom: 0;
|
|
224
|
+
position: absolute;
|
|
225
|
+
width: 100%;
|
|
226
|
+
${p.bottomSheet === 'full' ? 'height: 100%' : ''};
|
|
227
|
+
`}
|
|
228
|
+
}
|
|
229
|
+
`
|
|
230
|
+
|
|
188
231
|
const ModalDialog = animated(styled.div<{
|
|
189
|
-
size:
|
|
190
|
-
bottomSheet:
|
|
232
|
+
size: Size
|
|
233
|
+
bottomSheet: BottomSheet
|
|
191
234
|
}>`
|
|
192
|
-
position:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
transform: translate(-50%, -50%);
|
|
196
|
-
width: ${(p) =>
|
|
197
|
-
p.size === 'S'
|
|
198
|
-
? columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
|
|
199
|
-
: p.size === 'M'
|
|
200
|
-
? columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
|
|
201
|
-
: // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
202
|
-
p.size === 'L'
|
|
203
|
-
? columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2
|
|
204
|
-
: unreachable(p.size)}px;
|
|
235
|
+
position: relative;
|
|
236
|
+
margin: auto;
|
|
237
|
+
padding: 24px 0;
|
|
205
238
|
|
|
206
239
|
${theme((o) => [o.bg.background1, o.borderRadius(24)])}
|
|
207
|
-
|
|
208
240
|
@media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
|
|
209
241
|
${(p) =>
|
|
210
|
-
p.bottomSheet
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
height: 100%;
|
|
219
|
-
`
|
|
220
|
-
: p.bottomSheet
|
|
221
|
-
? css`
|
|
222
|
-
top: auto;
|
|
223
|
-
bottom: 0;
|
|
224
|
-
left: 0;
|
|
225
|
-
transform: none;
|
|
226
|
-
border-radius: 0;
|
|
227
|
-
width: 100%;
|
|
228
|
-
`
|
|
229
|
-
: css`
|
|
230
|
-
width: calc(100% - 48px);
|
|
231
|
-
`}
|
|
242
|
+
p.bottomSheet !== false &&
|
|
243
|
+
css`
|
|
244
|
+
border-radius: 0;
|
|
245
|
+
${p.bottomSheet === 'full' &&
|
|
246
|
+
css`
|
|
247
|
+
height: 100%;
|
|
248
|
+
`}
|
|
249
|
+
`}
|
|
232
250
|
}
|
|
233
251
|
`)
|
|
234
252
|
|
|
@@ -13,6 +13,7 @@ export const StringSegments: Story<SegmentedControlProps> = (props) => {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
StringSegments.args = {
|
|
16
|
+
name: 'test',
|
|
16
17
|
data: ['option1', 'option2', 'option3'],
|
|
17
18
|
disabled: false,
|
|
18
19
|
readonly: false,
|
|
@@ -24,6 +25,7 @@ export const ObjectSegments: Story<SegmentedControlProps> = (props) => {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
ObjectSegments.args = {
|
|
28
|
+
name: 'test',
|
|
27
29
|
data: [
|
|
28
30
|
{ label: '選択肢1', value: 'option1' },
|
|
29
31
|
{ label: '選択肢2', value: 'option2' },
|
package/src/index.ts
CHANGED
|
@@ -63,5 +63,5 @@ export {
|
|
|
63
63
|
default as SegmentedControl,
|
|
64
64
|
type SegmentedControlProps,
|
|
65
65
|
} from './components/SegmentedControl'
|
|
66
|
-
export { default as Checkbox } from './components/Checkbox'
|
|
66
|
+
export { default as Checkbox, type CheckboxProps } from './components/Checkbox'
|
|
67
67
|
export { default as TagItem, type TagItemProps } from './components/TagItem'
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { DropdownSelectorOption } from '.';
|
|
3
|
-
type OptionProps = {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
isSelected: boolean;
|
|
6
|
-
value: DropdownSelectorOption;
|
|
7
|
-
onSelect: () => void;
|
|
8
|
-
};
|
|
9
|
-
export declare function OptionLi(props: OptionProps): JSX.Element;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=OptionLi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionLi.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownSelector/OptionLi.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,GAAG,CAAA;AAG1C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,SAAS,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,sBAAsB,CAAA;IAC7B,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,WAAW,eAsC1C"}
|