@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.
- package/dist/_lib/compat.d.ts +1 -0
- package/dist/_lib/compat.d.ts.map +1 -1
- package/dist/components/Button/StyledButton.d.ts +13 -0
- package/dist/components/Button/StyledButton.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -2
- 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/Button/lib/variantToBackground.d.ts +3 -0
- package/dist/components/Button/lib/variantToBackground.d.ts.map +1 -0
- package/dist/components/Button/lib/variantToFont.d.ts +3 -0
- package/dist/components/Button/lib/variantToFont.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts +6 -16
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/Clickable/index.story.d.ts +4 -6
- package/dist/components/Clickable/index.story.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 -11
- 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/RadioGroupContext.d.ts +1 -1
- package/dist/components/SegmentedControl/RadioGroupContext.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 +418 -206
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +387 -175
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +4 -4
- package/package.json +17 -20
- package/src/_lib/compat.ts +8 -0
- package/src/components/Button/StyledButton.tsx +71 -0
- 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 +15 -104
- package/src/components/Button/lib/variantToBackground.tsx +19 -0
- package/src/components/Button/lib/variantToFont.tsx +19 -0
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +12 -27
- package/src/components/Checkbox/index.story.tsx +82 -88
- package/src/components/Checkbox/index.tsx +2 -12
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Clickable/index.story.tsx +12 -9
- package/src/components/DropdownSelector/DropdownMenuItem.tsx +1 -14
- 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 +313 -151
- package/src/components/DropdownSelector/index.story.tsx +207 -171
- package/src/components/DropdownSelector/index.tsx +22 -22
- 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 +231 -194
- 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/RadioGroupContext.tsx +1 -1
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +11 -11
- package/src/components/SegmentedControl/index.story.tsx +24 -29
- package/src/components/SegmentedControl/index.tsx +1 -1
- 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 +139 -83
- package/src/components/TextField/TextField.story.tsx +67 -66
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +198 -162
- package/src/components/TextField/index.tsx +0 -7
- package/dist/components/Checkbox/performance.test.d.ts +0 -4
- package/dist/components/Checkbox/performance.test.d.ts.map +0 -1
- package/dist/components/Checkbox/snapshot.test.d.ts +0 -2
- package/dist/components/Checkbox/snapshot.test.d.ts.map +0 -1
- package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +0 -1093
- package/src/components/Checkbox/performance.test.tsx +0 -30
- package/src/components/Checkbox/snapshot.test.tsx +0 -66
package/dist/index.cjs.js
CHANGED
|
@@ -110,7 +110,6 @@ function CharcoalProvider({
|
|
|
110
110
|
|
|
111
111
|
// src/components/Button/index.tsx
|
|
112
112
|
var import_react2 = require("react");
|
|
113
|
-
var import_styled_components3 = __toESM(require("styled-components"));
|
|
114
113
|
|
|
115
114
|
// src/_lib/index.ts
|
|
116
115
|
function unreachable(value) {
|
|
@@ -134,6 +133,45 @@ function countCodePointsInString(string) {
|
|
|
134
133
|
return Array.from(string).length;
|
|
135
134
|
}
|
|
136
135
|
|
|
136
|
+
// src/components/Button/lib/variantToFont.tsx
|
|
137
|
+
function variantToFont(variant) {
|
|
138
|
+
switch (variant) {
|
|
139
|
+
case "Overlay":
|
|
140
|
+
return "text5";
|
|
141
|
+
case "Default":
|
|
142
|
+
return "text2";
|
|
143
|
+
case "Primary":
|
|
144
|
+
return "text5";
|
|
145
|
+
case "Navigation":
|
|
146
|
+
return "text5";
|
|
147
|
+
case "Danger":
|
|
148
|
+
return "text5";
|
|
149
|
+
default:
|
|
150
|
+
return unreachable(variant);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/components/Button/lib/variantToBackground.tsx
|
|
155
|
+
function variantToBackground(variant) {
|
|
156
|
+
switch (variant) {
|
|
157
|
+
case "Overlay":
|
|
158
|
+
return "surface4";
|
|
159
|
+
case "Default":
|
|
160
|
+
return "surface3";
|
|
161
|
+
case "Primary":
|
|
162
|
+
return "brand";
|
|
163
|
+
case "Navigation":
|
|
164
|
+
return "surface6";
|
|
165
|
+
case "Danger":
|
|
166
|
+
return "assertive";
|
|
167
|
+
default:
|
|
168
|
+
return unreachable(variant);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// src/components/Button/StyledButton.tsx
|
|
173
|
+
var import_styled_components3 = __toESM(require("styled-components"));
|
|
174
|
+
|
|
137
175
|
// src/components/Clickable/index.tsx
|
|
138
176
|
var React2 = __toESM(require("react"));
|
|
139
177
|
var import_styled_components2 = __toESM(require("styled-components"));
|
|
@@ -204,31 +242,8 @@ var StyledClickableDiv = import_styled_components2.default.div`
|
|
|
204
242
|
}
|
|
205
243
|
`;
|
|
206
244
|
|
|
207
|
-
// src/components/Button/
|
|
208
|
-
var
|
|
209
|
-
var Button = (0, import_react2.forwardRef)(function Button2({
|
|
210
|
-
children,
|
|
211
|
-
variant = "Default",
|
|
212
|
-
size = "M",
|
|
213
|
-
fullWidth: fixed = false,
|
|
214
|
-
disabled = false,
|
|
215
|
-
...rest
|
|
216
|
-
}, ref) {
|
|
217
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
218
|
-
StyledButton,
|
|
219
|
-
{
|
|
220
|
-
...rest,
|
|
221
|
-
disabled,
|
|
222
|
-
$background: variantToBackground(variant),
|
|
223
|
-
$color: variantToFont(variant),
|
|
224
|
-
$size: size,
|
|
225
|
-
$fullWidth: fixed,
|
|
226
|
-
ref,
|
|
227
|
-
children
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
});
|
|
231
|
-
var Button_default = Button;
|
|
245
|
+
// src/components/Button/StyledButton.tsx
|
|
246
|
+
var import_styled2 = require("@charcoal-ui/styled");
|
|
232
247
|
var horizontalPaddingSmall = import_styled_components3.css`
|
|
233
248
|
padding-right: 16px;
|
|
234
249
|
padding-left: 16px;
|
|
@@ -251,79 +266,89 @@ var StyledButton = (0, import_styled_components3.default)(Clickable_default)`
|
|
|
251
266
|
font-weight: bold;
|
|
252
267
|
|
|
253
268
|
${(p) => p.$size === "M" ? horizontalPaddingMedium : horizontalPaddingSmall}
|
|
254
|
-
|
|
255
269
|
color: var(--charcoal-${(p) => p.$color});
|
|
256
270
|
background-color: var(--charcoal-${(p) => p.$background});
|
|
257
271
|
transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;
|
|
258
272
|
|
|
259
273
|
&:not(:disabled):not([aria-disabled]),
|
|
260
274
|
&[aria-disabled='false'] {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
275
|
+
${import_styled2.focusVisibleFocusRingCss}
|
|
276
|
+
|
|
277
|
+
${({ $isActive: $active, $color, $background }) => $active ? import_styled_components3.css`
|
|
278
|
+
color: var(--charcoal-${$color}-press);
|
|
279
|
+
background-color: var(--charcoal-${$background}-press);
|
|
280
|
+
` : import_styled_components3.css`
|
|
281
|
+
&:hover {
|
|
282
|
+
color: var(--charcoal-${$color}-hover);
|
|
283
|
+
background-color: var(--charcoal-${$background}-hover);
|
|
284
|
+
}
|
|
285
|
+
&:active {
|
|
286
|
+
color: var(--charcoal-${$color}-press);
|
|
287
|
+
background-color: var(--charcoal-${$background}-press);
|
|
288
|
+
}
|
|
289
|
+
`}
|
|
276
290
|
}
|
|
277
291
|
|
|
278
292
|
&:disabled,
|
|
279
293
|
&[aria-disabled]:not([aria-disabled='false']) {
|
|
280
294
|
opacity: 0.32;
|
|
281
295
|
}
|
|
282
|
-
|
|
283
|
-
/* よく考えたらheight=32って定義が存在しないな... */
|
|
284
296
|
height: ${(p) => p.$size === "M" ? 40 : 32}px;
|
|
285
297
|
`;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
default:
|
|
315
|
-
return unreachable(variant);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
298
|
+
|
|
299
|
+
// src/components/Button/index.tsx
|
|
300
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
301
|
+
var Button = (0, import_react2.forwardRef)(function Button2({
|
|
302
|
+
children,
|
|
303
|
+
variant = "Default",
|
|
304
|
+
size = "M",
|
|
305
|
+
fullWidth: fixed = false,
|
|
306
|
+
disabled = false,
|
|
307
|
+
isActive = false,
|
|
308
|
+
...rest
|
|
309
|
+
}, ref) {
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
311
|
+
StyledButton,
|
|
312
|
+
{
|
|
313
|
+
...rest,
|
|
314
|
+
disabled,
|
|
315
|
+
$background: variantToBackground(variant),
|
|
316
|
+
$color: variantToFont(variant),
|
|
317
|
+
$size: size,
|
|
318
|
+
$fullWidth: fixed,
|
|
319
|
+
$isActive: isActive,
|
|
320
|
+
ref,
|
|
321
|
+
children
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
});
|
|
325
|
+
var Button_default = Button;
|
|
318
326
|
|
|
319
327
|
// src/components/IconButton/index.tsx
|
|
320
328
|
var import_react3 = require("react");
|
|
321
329
|
var import_styled_components4 = __toESM(require("styled-components"));
|
|
330
|
+
var import_styled3 = require("@charcoal-ui/styled");
|
|
322
331
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
323
332
|
var IconButton = (0, import_react3.forwardRef)(
|
|
324
|
-
function IconButtonInner({
|
|
333
|
+
function IconButtonInner({
|
|
334
|
+
variant = "Default",
|
|
335
|
+
size = "M",
|
|
336
|
+
icon,
|
|
337
|
+
isActive = false,
|
|
338
|
+
...rest
|
|
339
|
+
}, ref) {
|
|
325
340
|
validateIconSize(size, icon);
|
|
326
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
342
|
+
StyledIconButton,
|
|
343
|
+
{
|
|
344
|
+
...rest,
|
|
345
|
+
ref,
|
|
346
|
+
$size: size,
|
|
347
|
+
$variant: variant,
|
|
348
|
+
$isActive: isActive,
|
|
349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pixiv-icon", { name: icon })
|
|
350
|
+
}
|
|
351
|
+
);
|
|
327
352
|
}
|
|
328
353
|
);
|
|
329
354
|
var IconButton_default = IconButton;
|
|
@@ -342,22 +367,17 @@ var StyledIconButton = (0, import_styled_components4.default)(Clickable_default)
|
|
|
342
367
|
|
|
343
368
|
&:not(:disabled):not([aria-disabled]),
|
|
344
369
|
&[aria-disabled='false'] {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
&:active,
|
|
357
|
-
&:focus-visible {
|
|
358
|
-
outline: none;
|
|
359
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
360
|
-
}
|
|
370
|
+
${({ $isActive, $background }) => $isActive ? import_styled_components4.css`
|
|
371
|
+
background-color: var(--charcoal-${$background}-press);
|
|
372
|
+
` : import_styled_components4.css`
|
|
373
|
+
&:hover {
|
|
374
|
+
background-color: var(--charcoal-${$background}-hover);
|
|
375
|
+
}
|
|
376
|
+
&:active {
|
|
377
|
+
background-color: var(--charcoal-${$background}-press);
|
|
378
|
+
}
|
|
379
|
+
`}
|
|
380
|
+
${import_styled3.focusVisibleFocusRingCss}
|
|
361
381
|
}
|
|
362
382
|
|
|
363
383
|
&:disabled,
|
|
@@ -426,6 +446,7 @@ var import_react4 = require("react");
|
|
|
426
446
|
var React3 = __toESM(require("react"));
|
|
427
447
|
var import_styled_components5 = __toESM(require("styled-components"));
|
|
428
448
|
var import_warning = __toESM(require("warning"));
|
|
449
|
+
var import_styled4 = require("@charcoal-ui/styled");
|
|
429
450
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
430
451
|
var Radio = (0, import_react4.forwardRef)(function RadioInner({ value, disabled = false, children, className }, ref) {
|
|
431
452
|
const {
|
|
@@ -456,7 +477,7 @@ var Radio = (0, import_react4.forwardRef)(function RadioInner({ value, disabled
|
|
|
456
477
|
name,
|
|
457
478
|
value,
|
|
458
479
|
checked: isSelected,
|
|
459
|
-
invalid,
|
|
480
|
+
"aria-invalid": invalid,
|
|
460
481
|
onChange: handleChange,
|
|
461
482
|
disabled: isDisabled || isReadonly,
|
|
462
483
|
ref
|
|
@@ -497,21 +518,18 @@ var RadioInput = import_styled_components5.default.input.attrs({ type: "radio" }
|
|
|
497
518
|
|
|
498
519
|
&:not(:disabled):not([aria-disabled]),
|
|
499
520
|
&[aria-disabled='false'] {
|
|
500
|
-
${({ invalid = false }) => invalid && import_styled_components5.css`
|
|
501
|
-
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
502
|
-
`}
|
|
503
|
-
|
|
504
521
|
&:hover {
|
|
505
522
|
background-color: var(--charcoal-surface1-hover);
|
|
506
523
|
}
|
|
507
524
|
&:active {
|
|
508
525
|
background-color: var(--charcoal-surface1-press);
|
|
509
526
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
527
|
+
${import_styled4.focusVisibleFocusRingCss}
|
|
528
|
+
&[aria-invalid='true'] {
|
|
529
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
530
|
+
&:focus {
|
|
531
|
+
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
532
|
+
}
|
|
515
533
|
}
|
|
516
534
|
}
|
|
517
535
|
|
|
@@ -655,6 +673,7 @@ var MultiSelectGroupContext = (0, import_react5.createContext)({
|
|
|
655
673
|
});
|
|
656
674
|
|
|
657
675
|
// src/components/MultiSelect/index.tsx
|
|
676
|
+
var import_styled5 = require("@charcoal-ui/styled");
|
|
658
677
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
659
678
|
var MultiSelect = (0, import_react6.forwardRef)(
|
|
660
679
|
function MultiSelectInner({
|
|
@@ -799,6 +818,8 @@ var MultiSelectInput = import_styled_components6.default.input.attrs({ type: "ch
|
|
|
799
818
|
}
|
|
800
819
|
}
|
|
801
820
|
|
|
821
|
+
${import_styled5.focusVisibleFocusRingCss}
|
|
822
|
+
|
|
802
823
|
${({ invalid, overlay }) => invalid && !overlay && import_styled_components6.css`
|
|
803
824
|
&:not(:disabled):not([aria-disabled]),
|
|
804
825
|
&[aria-disabled='false'] {
|
|
@@ -884,6 +905,7 @@ var import_react7 = require("react");
|
|
|
884
905
|
var import_react_stately = require("react-stately");
|
|
885
906
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
886
907
|
var import_utils3 = require("@react-aria/utils");
|
|
908
|
+
var import_styled6 = require("@charcoal-ui/styled");
|
|
887
909
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
888
910
|
var SwitchCheckbox = (0, import_react7.forwardRef)(
|
|
889
911
|
function SwitchCheckboxInner(props, external) {
|
|
@@ -921,10 +943,6 @@ var Label = import_styled_components7.default.label`
|
|
|
921
943
|
opacity: 0.32;
|
|
922
944
|
cursor: default;
|
|
923
945
|
}
|
|
924
|
-
|
|
925
|
-
:active > input {
|
|
926
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
927
|
-
}
|
|
928
946
|
`;
|
|
929
947
|
var LabelInner = import_styled_components7.default.div`
|
|
930
948
|
font-size: 14px;
|
|
@@ -955,9 +973,7 @@ var SwitchInput = import_styled_components7.default.input.attrs({ type: "checkbo
|
|
|
955
973
|
:active {
|
|
956
974
|
background-color: var(--charcoal-text4-press);
|
|
957
975
|
}
|
|
958
|
-
|
|
959
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
960
|
-
}
|
|
976
|
+
${import_styled6.focusVisibleFocusRingCss}
|
|
961
977
|
|
|
962
978
|
&::after {
|
|
963
979
|
content: '';
|
|
@@ -1268,13 +1284,6 @@ var StyledInputContainer = import_styled_components9.default.div`
|
|
|
1268
1284
|
background-color: var(--charcoal-surface3-hover);
|
|
1269
1285
|
}
|
|
1270
1286
|
|
|
1271
|
-
:not(:disabled):not([aria-disabled]):active,
|
|
1272
|
-
[aria-disabled='false']:active {
|
|
1273
|
-
outline: none;
|
|
1274
|
-
box-shadow: 0 0 0 4px
|
|
1275
|
-
${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
1287
|
:focus-within {
|
|
1279
1288
|
outline: none;
|
|
1280
1289
|
box-shadow: 0 0 0 4px
|
|
@@ -1554,7 +1563,7 @@ var React9 = __toESM(require("react"));
|
|
|
1554
1563
|
var import_overlays2 = require("@react-aria/overlays");
|
|
1555
1564
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
1556
1565
|
var import_utils5 = require("@charcoal-ui/utils");
|
|
1557
|
-
var
|
|
1566
|
+
var import_styled7 = require("@charcoal-ui/styled");
|
|
1558
1567
|
var import_react_spring2 = require("react-spring");
|
|
1559
1568
|
var import_utils6 = require("@react-aria/utils");
|
|
1560
1569
|
|
|
@@ -1692,7 +1701,7 @@ var Modal = (0, import_react12.forwardRef)(function ModalInner({ children, zInde
|
|
|
1692
1701
|
ref
|
|
1693
1702
|
);
|
|
1694
1703
|
const theme = (0, import_styled_components12.useTheme)();
|
|
1695
|
-
const isMobile = (0,
|
|
1704
|
+
const isMobile = (0, import_styled7.useMedia)((0, import_utils5.maxWidth)(theme.breakpoint.screen1)) ?? false;
|
|
1696
1705
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
1697
1706
|
const showDismiss = !isMobile || bottomSheet !== true;
|
|
1698
1707
|
const transition = (0, import_react_spring2.useTransition)(isOpen, {
|
|
@@ -2156,6 +2165,7 @@ var StyledUl = import_styled_components16.default.ul`
|
|
|
2156
2165
|
`;
|
|
2157
2166
|
|
|
2158
2167
|
// src/components/DropdownSelector/index.tsx
|
|
2168
|
+
var import_styled8 = require("@charcoal-ui/styled");
|
|
2159
2169
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2160
2170
|
var defaultRequiredText = "*\u5FC5\u9808";
|
|
2161
2171
|
function DropdownSelector(props) {
|
|
@@ -2184,6 +2194,7 @@ function DropdownSelector(props) {
|
|
|
2184
2194
|
},
|
|
2185
2195
|
ref: triggerRef,
|
|
2186
2196
|
type: "button",
|
|
2197
|
+
$active: isOpen,
|
|
2187
2198
|
children: [
|
|
2188
2199
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownButtonText, { children: props.placeholder !== void 0 && preview === void 0 ? props.placeholder : preview }),
|
|
2189
2200
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownButtonIcon, { name: "16/Menu" })
|
|
@@ -2236,6 +2247,7 @@ var DropdownButton = import_styled_components17.default.button`
|
|
|
2236
2247
|
box-sizing: border-box;
|
|
2237
2248
|
border: none;
|
|
2238
2249
|
cursor: pointer;
|
|
2250
|
+
gap: 4px;
|
|
2239
2251
|
|
|
2240
2252
|
${import_utils8.disabledSelector} {
|
|
2241
2253
|
cursor: default;
|
|
@@ -2246,16 +2258,21 @@ var DropdownButton = import_styled_components17.default.button`
|
|
|
2246
2258
|
background-color: var(--charcoal-surface3);
|
|
2247
2259
|
border-radius: 4px;
|
|
2248
2260
|
|
|
2249
|
-
transition: 0.2s box-shadow;
|
|
2261
|
+
transition: 0.2s box-shadow, 0.2s background-color;
|
|
2250
2262
|
|
|
2251
2263
|
&:not(:disabled):not([aria-disabled]),
|
|
2252
2264
|
&[aria-disabled='false'] {
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2265
|
+
${import_styled8.focusVisibleFocusRingCss}
|
|
2266
|
+
${({ $active }) => $active === true ? import_styled_components17.css`
|
|
2267
|
+
background-color: var(--charcoal-surface3-press);
|
|
2268
|
+
` : import_styled_components17.css`
|
|
2269
|
+
&:hover {
|
|
2270
|
+
background-color: var(--charcoal-surface3-hover);
|
|
2271
|
+
}
|
|
2272
|
+
&:active {
|
|
2273
|
+
background-color: var(--charcoal-surface3-press);
|
|
2274
|
+
}
|
|
2275
|
+
`}
|
|
2259
2276
|
}
|
|
2260
2277
|
|
|
2261
2278
|
${({ invalid }) => invalid === true && import_styled_components17.css`
|
|
@@ -2271,20 +2288,9 @@ var DropdownButtonText = import_styled_components17.default.span`
|
|
|
2271
2288
|
line-height: 22px;
|
|
2272
2289
|
display: flow-root;
|
|
2273
2290
|
color: var(--charcoal-text2);
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
height: 0;
|
|
2278
|
-
content: '';
|
|
2279
|
-
margin-top: -4px;
|
|
2280
|
-
}
|
|
2281
|
-
&::after {
|
|
2282
|
-
display: block;
|
|
2283
|
-
width: 0;
|
|
2284
|
-
height: 0;
|
|
2285
|
-
content: '';
|
|
2286
|
-
margin-bottom: -4px;
|
|
2287
|
-
}
|
|
2291
|
+
overflow: hidden;
|
|
2292
|
+
text-overflow: ellipsis;
|
|
2293
|
+
white-space: nowrap;
|
|
2288
2294
|
`;
|
|
2289
2295
|
var DropdownButtonIcon = (0, import_styled_components17.default)(Icon_default)`
|
|
2290
2296
|
color: var(--charcoal-text2);
|
|
@@ -2452,20 +2458,7 @@ var StyledSpan = import_styled_components19.default.span`
|
|
|
2452
2458
|
font-size: 14px;
|
|
2453
2459
|
line-height: 22px;
|
|
2454
2460
|
color: var(--charcoal-text2);
|
|
2455
|
-
|
|
2456
|
-
display: block;
|
|
2457
|
-
width: 0;
|
|
2458
|
-
height: 0;
|
|
2459
|
-
content: '';
|
|
2460
|
-
margin-top: -4px;
|
|
2461
|
-
}
|
|
2462
|
-
&::after {
|
|
2463
|
-
display: block;
|
|
2464
|
-
width: 0;
|
|
2465
|
-
height: 0;
|
|
2466
|
-
content: '';
|
|
2467
|
-
margin-bottom: -4px;
|
|
2468
|
-
}
|
|
2461
|
+
padding: 9px 0;
|
|
2469
2462
|
|
|
2470
2463
|
display: flex;
|
|
2471
2464
|
align-items: center;
|
|
@@ -2505,15 +2498,248 @@ var StyledLi2 = import_styled_components20.default.li`
|
|
|
2505
2498
|
`;
|
|
2506
2499
|
|
|
2507
2500
|
// src/components/SegmentedControl/index.tsx
|
|
2501
|
+
var import_react27 = require("react");
|
|
2502
|
+
|
|
2503
|
+
// ../../node_modules/@react-stately/form/dist/import.mjs
|
|
2504
|
+
var import_react23 = require("react");
|
|
2505
|
+
var $e5be200c675c3b3a$export$aca958c65c314e6c = {
|
|
2506
|
+
badInput: false,
|
|
2507
|
+
customError: false,
|
|
2508
|
+
patternMismatch: false,
|
|
2509
|
+
rangeOverflow: false,
|
|
2510
|
+
rangeUnderflow: false,
|
|
2511
|
+
stepMismatch: false,
|
|
2512
|
+
tooLong: false,
|
|
2513
|
+
tooShort: false,
|
|
2514
|
+
typeMismatch: false,
|
|
2515
|
+
valueMissing: false,
|
|
2516
|
+
valid: true
|
|
2517
|
+
};
|
|
2518
|
+
var $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
|
|
2519
|
+
...$e5be200c675c3b3a$export$aca958c65c314e6c,
|
|
2520
|
+
customError: true,
|
|
2521
|
+
valid: false
|
|
2522
|
+
};
|
|
2523
|
+
var $e5be200c675c3b3a$export$dad6ae84456c676a = {
|
|
2524
|
+
isInvalid: false,
|
|
2525
|
+
validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
|
|
2526
|
+
validationErrors: []
|
|
2527
|
+
};
|
|
2528
|
+
var $e5be200c675c3b3a$export$571b5131b7e65c11 = (0, import_react23.createContext)({});
|
|
2529
|
+
var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
|
|
2530
|
+
function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
|
|
2531
|
+
if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
|
|
2532
|
+
let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
|
|
2533
|
+
return {
|
|
2534
|
+
realtimeValidation,
|
|
2535
|
+
displayValidation,
|
|
2536
|
+
updateValidation,
|
|
2537
|
+
resetValidation,
|
|
2538
|
+
commitValidation
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
|
|
2542
|
+
}
|
|
2543
|
+
function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
2544
|
+
let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
|
|
2545
|
+
if (validationState)
|
|
2546
|
+
isInvalid || (isInvalid = validationState === "invalid");
|
|
2547
|
+
let controlledError = isInvalid ? {
|
|
2548
|
+
isInvalid: true,
|
|
2549
|
+
validationErrors: [],
|
|
2550
|
+
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
2551
|
+
} : null;
|
|
2552
|
+
let clientError = (0, import_react23.useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [
|
|
2553
|
+
validate,
|
|
2554
|
+
value
|
|
2555
|
+
]);
|
|
2556
|
+
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
|
|
2557
|
+
builtinValidation = null;
|
|
2558
|
+
let serverErrors = (0, import_react23.useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
|
|
2559
|
+
let serverErrorMessages = (0, import_react23.useMemo)(() => {
|
|
2560
|
+
if (name)
|
|
2561
|
+
return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
|
|
2562
|
+
return [];
|
|
2563
|
+
}, [
|
|
2564
|
+
serverErrors,
|
|
2565
|
+
name
|
|
2566
|
+
]);
|
|
2567
|
+
let [lastServerErrors, setLastServerErrors] = (0, import_react23.useState)(serverErrors);
|
|
2568
|
+
let [isServerErrorCleared, setServerErrorCleared] = (0, import_react23.useState)(false);
|
|
2569
|
+
if (serverErrors !== lastServerErrors) {
|
|
2570
|
+
setLastServerErrors(serverErrors);
|
|
2571
|
+
setServerErrorCleared(false);
|
|
2572
|
+
}
|
|
2573
|
+
let serverError = (0, import_react23.useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
|
|
2574
|
+
isServerErrorCleared,
|
|
2575
|
+
serverErrorMessages
|
|
2576
|
+
]);
|
|
2577
|
+
let nextValidation = (0, import_react23.useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
2578
|
+
let [currentValidity, setCurrentValidity] = (0, import_react23.useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
2579
|
+
let lastError = (0, import_react23.useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
2580
|
+
let commitValidation = () => {
|
|
2581
|
+
if (!commitQueued)
|
|
2582
|
+
return;
|
|
2583
|
+
setCommitQueued(false);
|
|
2584
|
+
let error = clientError || builtinValidation || nextValidation.current;
|
|
2585
|
+
if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
|
|
2586
|
+
lastError.current = error;
|
|
2587
|
+
setCurrentValidity(error);
|
|
2588
|
+
}
|
|
2589
|
+
};
|
|
2590
|
+
let [commitQueued, setCommitQueued] = (0, import_react23.useState)(false);
|
|
2591
|
+
(0, import_react23.useEffect)(commitValidation);
|
|
2592
|
+
let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
|
|
2593
|
+
let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
|
|
2594
|
+
return {
|
|
2595
|
+
realtimeValidation,
|
|
2596
|
+
displayValidation,
|
|
2597
|
+
updateValidation(value2) {
|
|
2598
|
+
if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2))
|
|
2599
|
+
setCurrentValidity(value2);
|
|
2600
|
+
else
|
|
2601
|
+
nextValidation.current = value2;
|
|
2602
|
+
},
|
|
2603
|
+
resetValidation() {
|
|
2604
|
+
let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
|
|
2605
|
+
if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
|
|
2606
|
+
lastError.current = error;
|
|
2607
|
+
setCurrentValidity(error);
|
|
2608
|
+
}
|
|
2609
|
+
if (validationBehavior === "native")
|
|
2610
|
+
setCommitQueued(false);
|
|
2611
|
+
setServerErrorCleared(true);
|
|
2612
|
+
},
|
|
2613
|
+
commitValidation() {
|
|
2614
|
+
if (validationBehavior === "native")
|
|
2615
|
+
setCommitQueued(true);
|
|
2616
|
+
setServerErrorCleared(true);
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2619
|
+
}
|
|
2620
|
+
function $e5be200c675c3b3a$var$asArray(v) {
|
|
2621
|
+
if (!v)
|
|
2622
|
+
return [];
|
|
2623
|
+
return Array.isArray(v) ? v : [
|
|
2624
|
+
v
|
|
2625
|
+
];
|
|
2626
|
+
}
|
|
2627
|
+
function $e5be200c675c3b3a$var$runValidate(validate, value) {
|
|
2628
|
+
if (typeof validate === "function") {
|
|
2629
|
+
let e = validate(value);
|
|
2630
|
+
if (e && typeof e !== "boolean")
|
|
2631
|
+
return $e5be200c675c3b3a$var$asArray(e);
|
|
2632
|
+
}
|
|
2633
|
+
return [];
|
|
2634
|
+
}
|
|
2635
|
+
function $e5be200c675c3b3a$var$getValidationResult(errors) {
|
|
2636
|
+
return errors.length ? {
|
|
2637
|
+
isInvalid: true,
|
|
2638
|
+
validationErrors: errors,
|
|
2639
|
+
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
2640
|
+
} : null;
|
|
2641
|
+
}
|
|
2642
|
+
function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
|
|
2643
|
+
if (a === b)
|
|
2644
|
+
return true;
|
|
2645
|
+
return a && b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
// ../../node_modules/@react-stately/utils/dist/import.mjs
|
|
2508
2649
|
var import_react24 = require("react");
|
|
2509
|
-
|
|
2510
|
-
|
|
2650
|
+
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
|
2651
|
+
let [stateValue, setStateValue] = (0, import_react24.useState)(value || defaultValue);
|
|
2652
|
+
let isControlledRef = (0, import_react24.useRef)(value !== void 0);
|
|
2653
|
+
let isControlled = value !== void 0;
|
|
2654
|
+
(0, import_react24.useEffect)(() => {
|
|
2655
|
+
let wasControlled = isControlledRef.current;
|
|
2656
|
+
if (wasControlled !== isControlled)
|
|
2657
|
+
console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
|
|
2658
|
+
isControlledRef.current = isControlled;
|
|
2659
|
+
}, [
|
|
2660
|
+
isControlled
|
|
2661
|
+
]);
|
|
2662
|
+
let currentValue = isControlled ? value : stateValue;
|
|
2663
|
+
let setValue = (0, import_react24.useCallback)((value2, ...args) => {
|
|
2664
|
+
let onChangeCaller = (value3, ...onChangeArgs) => {
|
|
2665
|
+
if (onChange) {
|
|
2666
|
+
if (!Object.is(currentValue, value3))
|
|
2667
|
+
onChange(value3, ...onChangeArgs);
|
|
2668
|
+
}
|
|
2669
|
+
if (!isControlled)
|
|
2670
|
+
currentValue = value3;
|
|
2671
|
+
};
|
|
2672
|
+
if (typeof value2 === "function") {
|
|
2673
|
+
console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
|
|
2674
|
+
let updateFunction = (oldValue, ...functionArgs) => {
|
|
2675
|
+
let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
|
|
2676
|
+
onChangeCaller(interceptedValue, ...args);
|
|
2677
|
+
if (!isControlled)
|
|
2678
|
+
return interceptedValue;
|
|
2679
|
+
return oldValue;
|
|
2680
|
+
};
|
|
2681
|
+
setStateValue(updateFunction);
|
|
2682
|
+
} else {
|
|
2683
|
+
if (!isControlled)
|
|
2684
|
+
setStateValue(value2);
|
|
2685
|
+
onChangeCaller(value2, ...args);
|
|
2686
|
+
}
|
|
2687
|
+
}, [
|
|
2688
|
+
isControlled,
|
|
2689
|
+
currentValue,
|
|
2690
|
+
onChange
|
|
2691
|
+
]);
|
|
2692
|
+
return [
|
|
2693
|
+
currentValue,
|
|
2694
|
+
setValue
|
|
2695
|
+
];
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
// ../../node_modules/@react-stately/radio/dist/import.mjs
|
|
2699
|
+
var import_react25 = require("react");
|
|
2700
|
+
var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
|
|
2701
|
+
var $a54cdc5c1942b639$var$i = 0;
|
|
2702
|
+
function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
|
|
2703
|
+
let name = (0, import_react25.useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [
|
|
2704
|
+
props.name
|
|
2705
|
+
]);
|
|
2706
|
+
var _props_defaultValue;
|
|
2707
|
+
let [selectedValue, setSelected] = (0, $458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
|
|
2708
|
+
let [lastFocusedValue, setLastFocusedValue] = (0, import_react25.useState)(null);
|
|
2709
|
+
let validation = (0, $e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
|
|
2710
|
+
...props,
|
|
2711
|
+
value: selectedValue
|
|
2712
|
+
});
|
|
2713
|
+
let setSelectedValue = (value) => {
|
|
2714
|
+
if (!props.isReadOnly && !props.isDisabled) {
|
|
2715
|
+
setSelected(value);
|
|
2716
|
+
validation.commitValidation();
|
|
2717
|
+
}
|
|
2718
|
+
};
|
|
2719
|
+
let isInvalid = validation.displayValidation.isInvalid;
|
|
2720
|
+
return {
|
|
2721
|
+
...validation,
|
|
2722
|
+
name,
|
|
2723
|
+
selectedValue,
|
|
2724
|
+
setSelectedValue,
|
|
2725
|
+
lastFocusedValue,
|
|
2726
|
+
setLastFocusedValue,
|
|
2727
|
+
isDisabled: props.isDisabled || false,
|
|
2728
|
+
isReadOnly: props.isReadOnly || false,
|
|
2729
|
+
isRequired: props.isRequired || false,
|
|
2730
|
+
validationState: props.validationState || (isInvalid ? "invalid" : null),
|
|
2731
|
+
isInvalid
|
|
2732
|
+
};
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
// src/components/SegmentedControl/index.tsx
|
|
2736
|
+
var import_radio2 = require("@react-aria/radio");
|
|
2511
2737
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2512
2738
|
|
|
2513
2739
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
2514
|
-
var
|
|
2740
|
+
var import_react26 = require("react");
|
|
2515
2741
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2516
|
-
var RadioContext = (0,
|
|
2742
|
+
var RadioContext = (0, import_react26.createContext)(null);
|
|
2517
2743
|
var RadioProvider = ({
|
|
2518
2744
|
value,
|
|
2519
2745
|
children
|
|
@@ -2521,7 +2747,7 @@ var RadioProvider = ({
|
|
|
2521
2747
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RadioContext.Provider, { value, children });
|
|
2522
2748
|
};
|
|
2523
2749
|
var useRadioContext = () => {
|
|
2524
|
-
const state = (0,
|
|
2750
|
+
const state = (0, import_react26.useContext)(RadioContext);
|
|
2525
2751
|
if (state === null)
|
|
2526
2752
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
2527
2753
|
return state;
|
|
@@ -2529,9 +2755,9 @@ var useRadioContext = () => {
|
|
|
2529
2755
|
|
|
2530
2756
|
// src/components/SegmentedControl/index.tsx
|
|
2531
2757
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2532
|
-
var SegmentedControl = (0,
|
|
2758
|
+
var SegmentedControl = (0, import_react27.forwardRef)(
|
|
2533
2759
|
function SegmentedControlInner(props, ref) {
|
|
2534
|
-
const ariaRadioGroupProps = (0,
|
|
2760
|
+
const ariaRadioGroupProps = (0, import_react27.useMemo)(
|
|
2535
2761
|
() => ({
|
|
2536
2762
|
...props,
|
|
2537
2763
|
isDisabled: props.disabled,
|
|
@@ -2541,9 +2767,9 @@ var SegmentedControl = (0, import_react24.forwardRef)(
|
|
|
2541
2767
|
}),
|
|
2542
2768
|
[props]
|
|
2543
2769
|
);
|
|
2544
|
-
const state = (
|
|
2545
|
-
const { radioGroupProps } = (0,
|
|
2546
|
-
const segmentedControlItems = (0,
|
|
2770
|
+
const state = $a54cdc5c1942b639$export$bca9d026f8e704eb(ariaRadioGroupProps);
|
|
2771
|
+
const { radioGroupProps } = (0, import_radio2.useRadioGroup)(ariaRadioGroupProps, state);
|
|
2772
|
+
const segmentedControlItems = (0, import_react27.useMemo)(() => {
|
|
2547
2773
|
return props.data.map(
|
|
2548
2774
|
(d) => typeof d === "string" ? { value: d, label: d } : d
|
|
2549
2775
|
);
|
|
@@ -2567,11 +2793,11 @@ var SegmentedControl = (0, import_react24.forwardRef)(
|
|
|
2567
2793
|
);
|
|
2568
2794
|
}
|
|
2569
2795
|
);
|
|
2570
|
-
var SegmentedControl_default = (0,
|
|
2796
|
+
var SegmentedControl_default = (0, import_react27.memo)(SegmentedControl);
|
|
2571
2797
|
var Segmented = (props) => {
|
|
2572
2798
|
const state = useRadioContext();
|
|
2573
|
-
const ref = (0,
|
|
2574
|
-
const ariaRadioProps = (0,
|
|
2799
|
+
const ref = (0, import_react27.useRef)(null);
|
|
2800
|
+
const ariaRadioProps = (0, import_react27.useMemo)(
|
|
2575
2801
|
() => ({
|
|
2576
2802
|
value: props.value,
|
|
2577
2803
|
isDisabled: props.disabled,
|
|
@@ -2579,7 +2805,7 @@ var Segmented = (props) => {
|
|
|
2579
2805
|
}),
|
|
2580
2806
|
[props]
|
|
2581
2807
|
);
|
|
2582
|
-
const { inputProps, isDisabled, isSelected } = (0,
|
|
2808
|
+
const { inputProps, isDisabled, isSelected } = (0, import_radio2.useRadio)(
|
|
2583
2809
|
ariaRadioProps,
|
|
2584
2810
|
state,
|
|
2585
2811
|
ref
|
|
@@ -2667,16 +2893,17 @@ var SegmentedLabelInner = import_styled_components21.default.div`
|
|
|
2667
2893
|
`;
|
|
2668
2894
|
|
|
2669
2895
|
// src/components/Checkbox/index.tsx
|
|
2670
|
-
var
|
|
2896
|
+
var import_react28 = require("react");
|
|
2671
2897
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
2672
2898
|
var import_checkbox = require("@react-aria/checkbox");
|
|
2673
|
-
var
|
|
2674
|
-
var
|
|
2675
|
-
var
|
|
2899
|
+
var import_utils10 = require("@react-aria/utils");
|
|
2900
|
+
var import_react_stately2 = require("react-stately");
|
|
2901
|
+
var import_utils11 = require("@charcoal-ui/utils");
|
|
2902
|
+
var import_styled9 = require("@charcoal-ui/styled");
|
|
2676
2903
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2677
|
-
var Checkbox = (0,
|
|
2904
|
+
var Checkbox = (0, import_react28.forwardRef)(
|
|
2678
2905
|
function CheckboxInner({ invalid = false, ...props }, ref) {
|
|
2679
|
-
const ariaCheckboxProps = (0,
|
|
2906
|
+
const ariaCheckboxProps = (0, import_react28.useMemo)(
|
|
2680
2907
|
() => ({
|
|
2681
2908
|
...props,
|
|
2682
2909
|
isInValid: invalid,
|
|
@@ -2688,8 +2915,8 @@ var Checkbox = (0, import_react25.forwardRef)(
|
|
|
2688
2915
|
}),
|
|
2689
2916
|
[invalid, props]
|
|
2690
2917
|
);
|
|
2691
|
-
const state = (0,
|
|
2692
|
-
const objectRef = (0,
|
|
2918
|
+
const state = (0, import_react_stately2.useToggleState)(ariaCheckboxProps);
|
|
2919
|
+
const objectRef = (0, import_utils10.useObjectRef)(ref);
|
|
2693
2920
|
const { inputProps } = (0, import_checkbox.useCheckbox)(ariaCheckboxProps, state, objectRef);
|
|
2694
2921
|
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
2695
2922
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
|
|
@@ -2701,7 +2928,7 @@ var Checkbox = (0, import_react25.forwardRef)(
|
|
|
2701
2928
|
] });
|
|
2702
2929
|
}
|
|
2703
2930
|
);
|
|
2704
|
-
var Checkbox_default = (0,
|
|
2931
|
+
var Checkbox_default = (0, import_react28.memo)(Checkbox);
|
|
2705
2932
|
var hiddenCss = import_styled_components22.css`
|
|
2706
2933
|
visibility: hidden;
|
|
2707
2934
|
`;
|
|
@@ -2710,7 +2937,7 @@ var InputRoot = import_styled_components22.default.label`
|
|
|
2710
2937
|
display: flex;
|
|
2711
2938
|
|
|
2712
2939
|
cursor: pointer;
|
|
2713
|
-
${
|
|
2940
|
+
${import_utils11.disabledSelector} {
|
|
2714
2941
|
cursor: default;
|
|
2715
2942
|
}
|
|
2716
2943
|
|
|
@@ -2750,18 +2977,7 @@ var CheckboxInput = import_styled_components22.default.input`
|
|
|
2750
2977
|
|
|
2751
2978
|
&:not(:disabled):not([aria-disabled]),
|
|
2752
2979
|
&[aria-disabled='false'] {
|
|
2753
|
-
|
|
2754
|
-
&:active {
|
|
2755
|
-
outline: none;
|
|
2756
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
2757
|
-
&:not(:focus-visible) {
|
|
2758
|
-
outline: none;
|
|
2759
|
-
}
|
|
2760
|
-
}
|
|
2761
|
-
&:focus-visible {
|
|
2762
|
-
outline: none;
|
|
2763
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
2764
|
-
}
|
|
2980
|
+
${import_styled9.focusVisibleFocusRingCss}
|
|
2765
2981
|
&[aria-invalid='true'] {
|
|
2766
2982
|
box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
|
|
2767
2983
|
}
|
|
@@ -2796,17 +3012,18 @@ var InputLabel = import_styled_components22.default.div`
|
|
|
2796
3012
|
`;
|
|
2797
3013
|
|
|
2798
3014
|
// src/components/TagItem/index.tsx
|
|
2799
|
-
var
|
|
2800
|
-
var
|
|
3015
|
+
var import_react29 = require("react");
|
|
3016
|
+
var import_utils12 = require("@react-aria/utils");
|
|
2801
3017
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
2802
|
-
var
|
|
3018
|
+
var import_utils13 = require("@charcoal-ui/utils");
|
|
2803
3019
|
var import_button = require("@react-aria/button");
|
|
3020
|
+
var import_styled10 = require("@charcoal-ui/styled");
|
|
2804
3021
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2805
3022
|
var sizeMap = {
|
|
2806
3023
|
S: 32,
|
|
2807
3024
|
M: 40
|
|
2808
3025
|
};
|
|
2809
|
-
var TagItem = (0,
|
|
3026
|
+
var TagItem = (0, import_react29.forwardRef)(
|
|
2810
3027
|
function TagItemInner({
|
|
2811
3028
|
label,
|
|
2812
3029
|
translatedLabel,
|
|
@@ -2818,8 +3035,8 @@ var TagItem = (0, import_react26.forwardRef)(
|
|
|
2818
3035
|
className,
|
|
2819
3036
|
...props
|
|
2820
3037
|
}, _ref) {
|
|
2821
|
-
const ref = (0,
|
|
2822
|
-
const ariaButtonProps = (0,
|
|
3038
|
+
const ref = (0, import_utils12.useObjectRef)(_ref);
|
|
3039
|
+
const ariaButtonProps = (0, import_react29.useMemo)(
|
|
2823
3040
|
() => ({
|
|
2824
3041
|
elementType: "a",
|
|
2825
3042
|
isDisabled: disabled,
|
|
@@ -2851,10 +3068,10 @@ var TagItem = (0, import_react26.forwardRef)(
|
|
|
2851
3068
|
);
|
|
2852
3069
|
}
|
|
2853
3070
|
);
|
|
2854
|
-
var TagItem_default = (0,
|
|
3071
|
+
var TagItem_default = (0, import_react29.memo)(TagItem);
|
|
2855
3072
|
var horizontalPadding = ({ left, right }) => import_styled_components23.css`
|
|
2856
|
-
padding-right: ${(0,
|
|
2857
|
-
padding-left: ${(0,
|
|
3073
|
+
padding-right: ${(0, import_utils13.px)(right)};
|
|
3074
|
+
padding-left: ${(0, import_utils13.px)(left)};
|
|
2858
3075
|
`;
|
|
2859
3076
|
var tagItemRootSize = (size) => {
|
|
2860
3077
|
switch (size) {
|
|
@@ -2884,12 +3101,7 @@ var TagItemRoot = import_styled_components23.default.a`
|
|
|
2884
3101
|
|
|
2885
3102
|
&:not(:disabled):not([aria-disabled]),
|
|
2886
3103
|
&[aria-disabled='false'] {
|
|
2887
|
-
|
|
2888
|
-
&:active,
|
|
2889
|
-
&:focus-visible {
|
|
2890
|
-
outline: none;
|
|
2891
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
2892
|
-
}
|
|
3104
|
+
${import_styled10.focusVisibleFocusRingCss}
|
|
2893
3105
|
}
|
|
2894
3106
|
|
|
2895
3107
|
&:disabled,
|