@charcoal-ui/react 3.12.0 → 3.13.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/README.md +1 -1
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/core/SSRProvider.d.ts +3 -1
- package/dist/core/SSRProvider.d.ts.map +1 -1
- package/dist/index.cjs.js +113 -104
- 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 +13 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +8 -8
- package/src/components/Button/__snapshots__/index.story.storyshot +9 -9
- package/src/components/Button/index.story.tsx +1 -1
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +6 -6
- package/src/components/Checkbox/index.story.tsx +1 -1
- package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
- package/src/components/Clickable/index.story.tsx +1 -1
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +1 -1
- package/src/components/DropdownSelector/ListItem/index.story.tsx +1 -1
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +3 -3
- package/src/components/DropdownSelector/MenuList/index.story.tsx +1 -1
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +1 -1
- package/src/components/DropdownSelector/Popover/index.story.tsx +1 -1
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +14 -936
- package/src/components/DropdownSelector/index.story.tsx +2 -2
- package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
- package/src/components/Icon/index.story.tsx +1 -1
- package/src/components/IconButton/__snapshots__/index.story.storyshot +6 -3
- package/src/components/IconButton/index.story.tsx +1 -1
- package/src/components/IconButton/index.tsx +1 -1
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +4 -4
- package/src/components/LoadingSpinner/index.story.tsx +1 -1
- package/src/components/Modal/__snapshots__/index.story.storyshot +24 -12
- package/src/components/Modal/index.story.tsx +2 -2
- package/src/components/Modal/index.tsx +6 -2
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +4 -4
- package/src/components/MultiSelect/index.story.tsx +1 -1
- package/src/components/Radio/__snapshots__/index.story.storyshot +5 -5
- package/src/components/Radio/index.story.tsx +1 -1
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
- package/src/components/SegmentedControl/index.story.tsx +1 -1
- package/src/components/Switch/__snapshots__/index.story.storyshot +4 -4
- package/src/components/Switch/index.story.tsx +1 -1
- package/src/components/TagItem/__snapshots__/index.story.storyshot +9 -9
- package/src/components/TagItem/index.story.tsx +2 -2
- package/src/components/TextArea/TextArea.story.tsx +1 -1
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +11 -11
- package/src/components/TextField/TextField.story.tsx +1 -1
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +13 -13
- package/src/core/SSRProvider.tsx +12 -1
- package/src/index.ts +5 -1
package/dist/index.cjs.js
CHANGED
|
@@ -42,13 +42,14 @@ __export(src_exports, {
|
|
|
42
42
|
ModalAlign: () => ModalAlign,
|
|
43
43
|
ModalBody: () => ModalBody,
|
|
44
44
|
ModalButtons: () => ModalButtons,
|
|
45
|
+
ModalCloseButton: () => ModalCloseButton,
|
|
45
46
|
ModalHeader: () => ModalHeader,
|
|
46
47
|
MultiSelect: () => MultiSelect_default,
|
|
47
48
|
MultiSelectGroup: () => MultiSelectGroup,
|
|
48
49
|
OverlayProvider: () => import_overlays.OverlayProvider,
|
|
49
50
|
Radio: () => Radio_default,
|
|
50
51
|
RadioGroup: () => RadioGroup,
|
|
51
|
-
SSRProvider: () =>
|
|
52
|
+
SSRProvider: () => SSRProvider,
|
|
52
53
|
SegmentedControl: () => SegmentedControl_default,
|
|
53
54
|
Switch: () => Switch_default,
|
|
54
55
|
TagItem: () => TagItem_default,
|
|
@@ -88,6 +89,12 @@ function useComponentAbstraction() {
|
|
|
88
89
|
|
|
89
90
|
// src/core/SSRProvider.tsx
|
|
90
91
|
var import_ssr = require("@react-aria/ssr");
|
|
92
|
+
var import_react2 = require("react");
|
|
93
|
+
function isReactVersionOver(minVersion) {
|
|
94
|
+
const reactMajorVersion = parseInt(import_react2.version.split(".")[0], 10);
|
|
95
|
+
return Number.isFinite(reactMajorVersion) ? reactMajorVersion >= minVersion : false;
|
|
96
|
+
}
|
|
97
|
+
var SSRProvider = isReactVersionOver(18) ? import_react2.Fragment : import_ssr.SSRProvider;
|
|
91
98
|
|
|
92
99
|
// src/core/OverlayProvider.tsx
|
|
93
100
|
var import_overlays = require("@react-aria/overlays");
|
|
@@ -104,14 +111,14 @@ function CharcoalProvider({
|
|
|
104
111
|
children,
|
|
105
112
|
background
|
|
106
113
|
}) {
|
|
107
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SSRProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_styled_components.ThemeProvider, { theme: defaultTheme, children: [
|
|
108
115
|
injectTokens && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_styled.TokenInjector, { theme: themeMap, background }),
|
|
109
116
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ComponentAbstraction, { components, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_overlays.OverlayProvider, { children }) })
|
|
110
117
|
] }) });
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
// src/components/Button/index.tsx
|
|
114
|
-
var
|
|
121
|
+
var import_react3 = require("react");
|
|
115
122
|
|
|
116
123
|
// src/_lib/index.ts
|
|
117
124
|
function unreachable(value) {
|
|
@@ -213,7 +220,7 @@ var StyledButton = (0, import_styled_components3.default)(Clickable_default).wit
|
|
|
213
220
|
|
|
214
221
|
// src/components/Button/index.tsx
|
|
215
222
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
216
|
-
var Button = (0,
|
|
223
|
+
var Button = (0, import_react3.forwardRef)(function Button2({
|
|
217
224
|
children,
|
|
218
225
|
variant = "Default",
|
|
219
226
|
size = "M",
|
|
@@ -227,11 +234,11 @@ var Button = (0, import_react2.forwardRef)(function Button2({
|
|
|
227
234
|
var Button_default = Button;
|
|
228
235
|
|
|
229
236
|
// src/components/IconButton/index.tsx
|
|
230
|
-
var
|
|
237
|
+
var import_react4 = require("react");
|
|
231
238
|
var import_styled_components4 = __toESM(require("styled-components"));
|
|
232
239
|
var import_styled3 = require("@charcoal-ui/styled");
|
|
233
240
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
234
|
-
var IconButton = (0,
|
|
241
|
+
var IconButton = (0, import_react4.forwardRef)(function IconButtonInner({
|
|
235
242
|
variant = "Default",
|
|
236
243
|
size = "M",
|
|
237
244
|
icon,
|
|
@@ -239,7 +246,7 @@ var IconButton = (0, import_react3.forwardRef)(function IconButtonInner({
|
|
|
239
246
|
...rest
|
|
240
247
|
}, ref) {
|
|
241
248
|
validateIconSize(size, icon);
|
|
242
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledIconButton, { ...rest, ref, $size: size, $variant: variant, $isActive: isActive, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pixiv-icon", { name: icon }) });
|
|
249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledIconButton, { ...rest, ref, $size: size, $variant: variant, $isActive: isActive, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pixiv-icon", { "aria-hidden": "true", name: icon }) });
|
|
243
250
|
});
|
|
244
251
|
var IconButton_default = IconButton;
|
|
245
252
|
var StyledIconButton = (0, import_styled_components4.default)(Clickable_default).attrs(styledProps).withConfig({
|
|
@@ -317,13 +324,13 @@ function validateIconSize(size, icon) {
|
|
|
317
324
|
}
|
|
318
325
|
|
|
319
326
|
// src/components/Radio/index.tsx
|
|
320
|
-
var
|
|
327
|
+
var import_react5 = require("react");
|
|
321
328
|
var React3 = __toESM(require("react"));
|
|
322
329
|
var import_styled_components5 = __toESM(require("styled-components"));
|
|
323
330
|
var import_warning = __toESM(require("warning"));
|
|
324
331
|
var import_styled4 = require("@charcoal-ui/styled");
|
|
325
332
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
326
|
-
var Radio = (0,
|
|
333
|
+
var Radio = (0, import_react5.forwardRef)(function RadioInner({
|
|
327
334
|
value,
|
|
328
335
|
disabled = false,
|
|
329
336
|
children,
|
|
@@ -336,7 +343,7 @@ var Radio = (0, import_react4.forwardRef)(function RadioInner({
|
|
|
336
343
|
readonly,
|
|
337
344
|
invalid,
|
|
338
345
|
onChange
|
|
339
|
-
} = (0,
|
|
346
|
+
} = (0, import_react5.useContext)(RadioGroupContext);
|
|
340
347
|
(0, import_warning.default)(
|
|
341
348
|
name !== void 0,
|
|
342
349
|
`"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`
|
|
@@ -344,7 +351,7 @@ var Radio = (0, import_react4.forwardRef)(function RadioInner({
|
|
|
344
351
|
const isSelected = value === selected;
|
|
345
352
|
const isDisabled = disabled || isParentDisabled;
|
|
346
353
|
const isReadonly = readonly && !isSelected;
|
|
347
|
-
const handleChange = (0,
|
|
354
|
+
const handleChange = (0, import_react5.useCallback)((e) => {
|
|
348
355
|
onChange(e.currentTarget.value);
|
|
349
356
|
}, [onChange]);
|
|
350
357
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(RadioRoot, { "aria-disabled": isDisabled || isReadonly, className, children: [
|
|
@@ -352,7 +359,7 @@ var Radio = (0, import_react4.forwardRef)(function RadioInner({
|
|
|
352
359
|
children != null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RadioLabel, { children })
|
|
353
360
|
] });
|
|
354
361
|
});
|
|
355
|
-
var Radio_default = (0,
|
|
362
|
+
var Radio_default = (0, import_react5.memo)(Radio);
|
|
356
363
|
var RadioRoot = import_styled_components5.default.label.withConfig({
|
|
357
364
|
componentId: "ccl__sc-1hitkzn-0"
|
|
358
365
|
})(["display:grid;grid-template-columns:auto 1fr;grid-gap:4px;align-items:center;cursor:pointer;&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"]);
|
|
@@ -388,7 +395,7 @@ function RadioGroup({
|
|
|
388
395
|
invalid,
|
|
389
396
|
children
|
|
390
397
|
}) {
|
|
391
|
-
const handleChange = (0,
|
|
398
|
+
const handleChange = (0, import_react5.useCallback)((next) => {
|
|
392
399
|
onChange(next);
|
|
393
400
|
}, [onChange]);
|
|
394
401
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RadioGroupContext.Provider, { value: {
|
|
@@ -402,14 +409,14 @@ function RadioGroup({
|
|
|
402
409
|
}
|
|
403
410
|
|
|
404
411
|
// src/components/MultiSelect/index.tsx
|
|
405
|
-
var
|
|
412
|
+
var import_react7 = require("react");
|
|
406
413
|
var import_styled_components6 = __toESM(require("styled-components"));
|
|
407
414
|
var import_warning2 = __toESM(require("warning"));
|
|
408
415
|
var import_utils2 = require("@charcoal-ui/utils");
|
|
409
416
|
|
|
410
417
|
// src/components/MultiSelect/context.ts
|
|
411
|
-
var
|
|
412
|
-
var MultiSelectGroupContext = (0,
|
|
418
|
+
var import_react6 = require("react");
|
|
419
|
+
var MultiSelectGroupContext = (0, import_react6.createContext)({
|
|
413
420
|
name: void 0,
|
|
414
421
|
selected: [],
|
|
415
422
|
disabled: false,
|
|
@@ -440,7 +447,7 @@ var Icon_default = Icon;
|
|
|
440
447
|
|
|
441
448
|
// src/components/MultiSelect/index.tsx
|
|
442
449
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
443
|
-
var MultiSelect = (0,
|
|
450
|
+
var MultiSelect = (0, import_react7.forwardRef)(function MultiSelectInner({
|
|
444
451
|
value,
|
|
445
452
|
disabled = false,
|
|
446
453
|
onChange,
|
|
@@ -455,14 +462,14 @@ var MultiSelect = (0, import_react6.forwardRef)(function MultiSelectInner({
|
|
|
455
462
|
readonly,
|
|
456
463
|
invalid,
|
|
457
464
|
onChange: parentOnChange
|
|
458
|
-
} = (0,
|
|
465
|
+
} = (0, import_react7.useContext)(MultiSelectGroupContext);
|
|
459
466
|
(0, import_warning2.default)(
|
|
460
467
|
name !== void 0,
|
|
461
468
|
`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
|
|
462
469
|
);
|
|
463
470
|
const isSelected = selected.includes(value);
|
|
464
471
|
const isDisabled = disabled || parentDisabled || readonly;
|
|
465
|
-
const handleChange = (0,
|
|
472
|
+
const handleChange = (0, import_react7.useCallback)((event) => {
|
|
466
473
|
if (!(event.currentTarget instanceof HTMLInputElement)) {
|
|
467
474
|
return;
|
|
468
475
|
}
|
|
@@ -486,7 +493,7 @@ var MultiSelect = (0, import_react6.forwardRef)(function MultiSelectInner({
|
|
|
486
493
|
Boolean(children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectLabel, { children })
|
|
487
494
|
] });
|
|
488
495
|
});
|
|
489
|
-
var MultiSelect_default = (0,
|
|
496
|
+
var MultiSelect_default = (0, import_react7.memo)(MultiSelect);
|
|
490
497
|
var MultiSelectRoot = import_styled_components6.default.label.withConfig({
|
|
491
498
|
componentId: "ccl__sc-wpr5y9-0"
|
|
492
499
|
})(["display:grid;grid-template-columns:auto 1fr;align-items:center;position:relative;cursor:pointer;gap:", ";&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"], ({
|
|
@@ -524,7 +531,7 @@ function MultiSelectGroup({
|
|
|
524
531
|
invalid = false,
|
|
525
532
|
children
|
|
526
533
|
}) {
|
|
527
|
-
const handleChange = (0,
|
|
534
|
+
const handleChange = (0, import_react7.useCallback)((payload) => {
|
|
528
535
|
const index = selected.indexOf(payload.value);
|
|
529
536
|
if (payload.selected) {
|
|
530
537
|
if (index < 0) {
|
|
@@ -548,18 +555,18 @@ function MultiSelectGroup({
|
|
|
548
555
|
|
|
549
556
|
// src/components/Switch/index.tsx
|
|
550
557
|
var import_switch = require("@react-aria/switch");
|
|
551
|
-
var
|
|
558
|
+
var import_react8 = require("react");
|
|
552
559
|
var import_react_stately = require("react-stately");
|
|
553
560
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
554
561
|
var import_utils3 = require("@react-aria/utils");
|
|
555
562
|
var import_styled6 = require("@charcoal-ui/styled");
|
|
556
563
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
557
|
-
var SwitchCheckbox = (0,
|
|
564
|
+
var SwitchCheckbox = (0, import_react8.forwardRef)(function SwitchCheckboxInner(props, external) {
|
|
558
565
|
const {
|
|
559
566
|
disabled,
|
|
560
567
|
className
|
|
561
568
|
} = props;
|
|
562
|
-
const ariaSwitchProps = (0,
|
|
569
|
+
const ariaSwitchProps = (0, import_react8.useMemo)(() => ({
|
|
563
570
|
...props,
|
|
564
571
|
"aria-label": "children" in props ? void 0 : props.label,
|
|
565
572
|
isDisabled: props.disabled,
|
|
@@ -579,7 +586,7 @@ var SwitchCheckbox = (0, import_react7.forwardRef)(function SwitchCheckboxInner(
|
|
|
579
586
|
"children" in props ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LabelInner, { children: props.children }) : void 0
|
|
580
587
|
] });
|
|
581
588
|
});
|
|
582
|
-
var Switch_default = (0,
|
|
589
|
+
var Switch_default = (0, import_react8.memo)(SwitchCheckbox);
|
|
583
590
|
var Label = import_styled_components7.default.label.withConfig({
|
|
584
591
|
componentId: "ccl__sc-1wy6z5h-0"
|
|
585
592
|
})(["display:inline-grid;grid-template-columns:auto 1fr;align-items:center;cursor:pointer;outline:0;&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"]);
|
|
@@ -595,7 +602,7 @@ var SwitchInput = import_styled_components7.default.input.attrs({
|
|
|
595
602
|
// src/components/TextField/index.tsx
|
|
596
603
|
var import_textfield = require("@react-aria/textfield");
|
|
597
604
|
var import_visually_hidden = require("@react-aria/visually-hidden");
|
|
598
|
-
var
|
|
605
|
+
var import_react10 = require("react");
|
|
599
606
|
var React6 = __toESM(require("react"));
|
|
600
607
|
var import_styled_components9 = __toESM(require("styled-components"));
|
|
601
608
|
|
|
@@ -633,9 +640,9 @@ var FieldLabelWrapper = import_styled_components8.default.div.withConfig({
|
|
|
633
640
|
})(["display:inline-flex;align-items:center;> ", "{margin-left:4px;}> ", "{margin-left:auto;}"], RequiredText, SubLabelClickable);
|
|
634
641
|
|
|
635
642
|
// src/components/TextField/useFocusWithClick.tsx
|
|
636
|
-
var
|
|
643
|
+
var import_react9 = require("react");
|
|
637
644
|
function useFocusWithClick(containerRef, inputRef) {
|
|
638
|
-
(0,
|
|
645
|
+
(0, import_react9.useEffect)(() => {
|
|
639
646
|
const el = containerRef.current;
|
|
640
647
|
if (el) {
|
|
641
648
|
const handleDown = (e) => {
|
|
@@ -678,10 +685,10 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
|
678
685
|
const {
|
|
679
686
|
visuallyHiddenProps
|
|
680
687
|
} = (0, import_visually_hidden.useVisuallyHidden)();
|
|
681
|
-
const ariaRef = (0,
|
|
682
|
-
const [count, setCount] = (0,
|
|
688
|
+
const ariaRef = (0, import_react10.useRef)(null);
|
|
689
|
+
const [count, setCount] = (0, import_react10.useState)(countCodePointsInString(props.value ?? ""));
|
|
683
690
|
const nonControlled = props.value === void 0;
|
|
684
|
-
const handleChange = (0,
|
|
691
|
+
const handleChange = (0, import_react10.useCallback)((value) => {
|
|
685
692
|
const count2 = countCodePointsInString(value);
|
|
686
693
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
687
694
|
return;
|
|
@@ -691,7 +698,7 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
|
691
698
|
}
|
|
692
699
|
onChange?.(value);
|
|
693
700
|
}, [maxLength, nonControlled, onChange]);
|
|
694
|
-
(0,
|
|
701
|
+
(0, import_react10.useEffect)(() => {
|
|
695
702
|
setCount(countCodePointsInString(props.value ?? ""));
|
|
696
703
|
}, [props.value]);
|
|
697
704
|
const {
|
|
@@ -710,7 +717,7 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
|
710
717
|
onChange: handleChange,
|
|
711
718
|
...props
|
|
712
719
|
}, ariaRef);
|
|
713
|
-
const containerRef = (0,
|
|
720
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
714
721
|
useFocusWithClick(containerRef, ariaRef);
|
|
715
722
|
const inputProps = (0, import_utils4.mergeProps)(restProps, ariaInputProps);
|
|
716
723
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(TextFieldRoot, { className, isDisabled: disabled, children: [
|
|
@@ -757,11 +764,11 @@ var AssistiveText = import_styled_components9.default.p.withConfig({
|
|
|
757
764
|
// src/components/TextArea/index.tsx
|
|
758
765
|
var import_textfield2 = require("@react-aria/textfield");
|
|
759
766
|
var import_visually_hidden2 = require("@react-aria/visually-hidden");
|
|
760
|
-
var
|
|
767
|
+
var import_react11 = require("react");
|
|
761
768
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
762
769
|
var import_utils5 = require("@react-aria/utils");
|
|
763
770
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
764
|
-
var TextArea = (0,
|
|
771
|
+
var TextArea = (0, import_react11.forwardRef)(function TextAreaInner({
|
|
765
772
|
onChange,
|
|
766
773
|
...props
|
|
767
774
|
}, forwardRef18) {
|
|
@@ -785,17 +792,17 @@ var TextArea = (0, import_react10.forwardRef)(function TextAreaInner({
|
|
|
785
792
|
const {
|
|
786
793
|
visuallyHiddenProps
|
|
787
794
|
} = (0, import_visually_hidden2.useVisuallyHidden)();
|
|
788
|
-
const textareaRef = (0,
|
|
789
|
-
const ariaRef = (0,
|
|
790
|
-
const [count, setCount] = (0,
|
|
791
|
-
const [rows, setRows] = (0,
|
|
792
|
-
const syncHeight = (0,
|
|
795
|
+
const textareaRef = (0, import_react11.useRef)(null);
|
|
796
|
+
const ariaRef = (0, import_react11.useRef)(null);
|
|
797
|
+
const [count, setCount] = (0, import_react11.useState)(countCodePointsInString(props.value ?? ""));
|
|
798
|
+
const [rows, setRows] = (0, import_react11.useState)(initialRows);
|
|
799
|
+
const syncHeight = (0, import_react11.useCallback)((textarea) => {
|
|
793
800
|
const rows2 = (`${textarea.value}
|
|
794
801
|
`.match(/\n/gu)?.length ?? 0) || 1;
|
|
795
802
|
setRows(initialRows <= rows2 ? rows2 : initialRows);
|
|
796
803
|
}, [initialRows]);
|
|
797
804
|
const nonControlled = props.value === void 0;
|
|
798
|
-
const handleChange = (0,
|
|
805
|
+
const handleChange = (0, import_react11.useCallback)((value) => {
|
|
799
806
|
const count2 = countCodePointsInString(value);
|
|
800
807
|
if (maxLength !== void 0 && count2 > maxLength) {
|
|
801
808
|
return;
|
|
@@ -808,7 +815,7 @@ var TextArea = (0, import_react10.forwardRef)(function TextAreaInner({
|
|
|
808
815
|
}
|
|
809
816
|
onChange?.(value);
|
|
810
817
|
}, [autoHeight, maxLength, nonControlled, onChange, syncHeight]);
|
|
811
|
-
(0,
|
|
818
|
+
(0, import_react11.useEffect)(() => {
|
|
812
819
|
setCount(countCodePointsInString(props.value ?? ""));
|
|
813
820
|
}, [props.value]);
|
|
814
821
|
const {
|
|
@@ -827,12 +834,12 @@ var TextArea = (0, import_react10.forwardRef)(function TextAreaInner({
|
|
|
827
834
|
onChange: handleChange,
|
|
828
835
|
...props
|
|
829
836
|
}, ariaRef);
|
|
830
|
-
(0,
|
|
837
|
+
(0, import_react11.useEffect)(() => {
|
|
831
838
|
if (autoHeight && textareaRef.current !== null) {
|
|
832
839
|
syncHeight(textareaRef.current);
|
|
833
840
|
}
|
|
834
841
|
}, [autoHeight, syncHeight]);
|
|
835
|
-
const containerRef = (0,
|
|
842
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
836
843
|
useFocusWithClick(containerRef, ariaRef);
|
|
837
844
|
const inputProps = (0, import_utils5.mergeProps)(restProps, ariaInputProps);
|
|
838
845
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(TextFieldRoot2, { className, isDisabled: disabled, children: [
|
|
@@ -866,7 +873,7 @@ var MultiLineCounter = import_styled_components10.default.span.withConfig({
|
|
|
866
873
|
})(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
867
874
|
|
|
868
875
|
// src/components/Modal/index.tsx
|
|
869
|
-
var
|
|
876
|
+
var import_react14 = require("react");
|
|
870
877
|
var React10 = __toESM(require("react"));
|
|
871
878
|
var import_overlays3 = require("@react-aria/overlays");
|
|
872
879
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
@@ -876,7 +883,7 @@ var import_react_spring2 = require("react-spring");
|
|
|
876
883
|
var import_utils8 = require("@react-aria/utils");
|
|
877
884
|
|
|
878
885
|
// src/components/Modal/Dialog/index.tsx
|
|
879
|
-
var
|
|
886
|
+
var import_react12 = require("react");
|
|
880
887
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
881
888
|
var import_dialog = require("@react-aria/dialog");
|
|
882
889
|
var import_foundation = require("@charcoal-ui/foundation");
|
|
@@ -901,7 +908,7 @@ function useForwardedRef(ref) {
|
|
|
901
908
|
|
|
902
909
|
// src/components/Modal/Dialog/index.tsx
|
|
903
910
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
904
|
-
var Dialog = (0,
|
|
911
|
+
var Dialog = (0, import_react12.forwardRef)(function Dialog2(props, forwardRef18) {
|
|
905
912
|
const ref = useForwardedRef(forwardRef18);
|
|
906
913
|
const {
|
|
907
914
|
dialogProps
|
|
@@ -940,9 +947,9 @@ var React9 = __toESM(require("react"));
|
|
|
940
947
|
var import_overlays2 = require("@react-aria/overlays");
|
|
941
948
|
|
|
942
949
|
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
943
|
-
var
|
|
950
|
+
var import_react13 = require("react");
|
|
944
951
|
function usePreventScroll(element, isOpen) {
|
|
945
|
-
(0,
|
|
952
|
+
(0, import_react13.useEffect)(() => {
|
|
946
953
|
if (isOpen && element) {
|
|
947
954
|
const defaultPaddingRight = element.style.paddingRight;
|
|
948
955
|
const defaultOverflow = element.style.overflow;
|
|
@@ -983,7 +990,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
983
990
|
// src/components/Modal/index.tsx
|
|
984
991
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
985
992
|
var DEFAULT_Z_INDEX = 10;
|
|
986
|
-
var Modal = (0,
|
|
993
|
+
var Modal = (0, import_react14.forwardRef)(function ModalInner({
|
|
987
994
|
children,
|
|
988
995
|
zIndex = DEFAULT_Z_INDEX,
|
|
989
996
|
portalContainer,
|
|
@@ -996,7 +1003,8 @@ var Modal = (0, import_react13.forwardRef)(function ModalInner({
|
|
|
996
1003
|
isDismissable,
|
|
997
1004
|
onClose,
|
|
998
1005
|
className,
|
|
999
|
-
isOpen = false
|
|
1006
|
+
isOpen = false,
|
|
1007
|
+
closeButtonAriaLabel = "Close"
|
|
1000
1008
|
} = props;
|
|
1001
1009
|
const ref = (0, import_utils8.useObjectRef)(external);
|
|
1002
1010
|
const {
|
|
@@ -1061,10 +1069,10 @@ var Modal = (0, import_react13.forwardRef)(function ModalInner({
|
|
|
1061
1069
|
bottomSheet
|
|
1062
1070
|
}, children: [
|
|
1063
1071
|
children,
|
|
1064
|
-
isDismissable === true && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1072
|
+
isDismissable === true && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalCloseButton, { size: "S", icon: "24/Close", type: "button", "aria-label": closeButtonAriaLabel, onClick: onClose })
|
|
1065
1073
|
] }) }) }) }) }));
|
|
1066
1074
|
});
|
|
1067
|
-
var Modal_default = (0,
|
|
1075
|
+
var Modal_default = (0, import_react14.memo)(Modal);
|
|
1068
1076
|
var ModalContext = React10.createContext({
|
|
1069
1077
|
titleProps: {},
|
|
1070
1078
|
title: "",
|
|
@@ -1079,14 +1087,14 @@ var ModalBackground = (0, import_react_spring2.animated)(import_styled_component
|
|
|
1079
1087
|
}) => zIndex, ({
|
|
1080
1088
|
theme
|
|
1081
1089
|
}) => (0, import_utils7.maxWidth)(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false && (0, import_styled_components12.css)(["padding:0;"])));
|
|
1082
|
-
var
|
|
1090
|
+
var ModalCloseButton = (0, import_styled_components12.default)(IconButton_default).withConfig({
|
|
1083
1091
|
componentId: "ccl__sc-h2bc55-1"
|
|
1084
1092
|
})(["position:absolute;top:8px;right:8px;color:var(--charcoal-text3);transition:0.2s color;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{color:var(--charcoal-text3-hover);}&:active{color:var(--charcoal-text3-press);}}"]);
|
|
1085
1093
|
function ModalTitle(props) {
|
|
1086
1094
|
const {
|
|
1087
1095
|
titleProps,
|
|
1088
1096
|
title
|
|
1089
|
-
} = (0,
|
|
1097
|
+
} = (0, import_react14.useContext)(ModalContext);
|
|
1090
1098
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalHeading, { ...titleProps, ...props, children: title });
|
|
1091
1099
|
}
|
|
1092
1100
|
var ModalHeading = import_styled_components12.default.h3.withConfig({
|
|
@@ -1095,11 +1103,11 @@ var ModalHeading = import_styled_components12.default.h3.withConfig({
|
|
|
1095
1103
|
|
|
1096
1104
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1097
1105
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
1098
|
-
var
|
|
1106
|
+
var import_react15 = require("react");
|
|
1099
1107
|
var import_utils9 = require("@charcoal-ui/utils");
|
|
1100
1108
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1101
1109
|
function ModalHeader() {
|
|
1102
|
-
const modalCtx = (0,
|
|
1110
|
+
const modalCtx = (0, import_react15.useContext)(ModalContext);
|
|
1103
1111
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModalHeaderRoot, { $bottomSheet: modalCtx.bottomSheet, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyledModalTitle, {}) });
|
|
1104
1112
|
}
|
|
1105
1113
|
var ModalHeaderRoot = import_styled_components13.default.div.withConfig({
|
|
@@ -1121,10 +1129,10 @@ var ModalButtons = import_styled_components13.default.div.withConfig({
|
|
|
1121
1129
|
})(["display:grid;grid-auto-flow:row;grid-row-gap:8px;padding-top:16px;padding-left:16px;padding-right:16px;"]);
|
|
1122
1130
|
|
|
1123
1131
|
// src/components/LoadingSpinner/index.tsx
|
|
1124
|
-
var
|
|
1132
|
+
var import_react16 = require("react");
|
|
1125
1133
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
1126
1134
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1127
|
-
var LoadingSpinner = (0,
|
|
1135
|
+
var LoadingSpinner = (0, import_react16.forwardRef)(function LoadingSpinnerInner({
|
|
1128
1136
|
size = 48,
|
|
1129
1137
|
padding = 16,
|
|
1130
1138
|
transparent = false,
|
|
@@ -1132,7 +1140,7 @@ var LoadingSpinner = (0, import_react15.forwardRef)(function LoadingSpinnerInner
|
|
|
1132
1140
|
}, ref) {
|
|
1133
1141
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingSpinnerRoot, { size, padding, transparent, className, ref, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingSpinnerIcon, {}) });
|
|
1134
1142
|
});
|
|
1135
|
-
var LoadingSpinner_default = (0,
|
|
1143
|
+
var LoadingSpinner_default = (0, import_react16.memo)(LoadingSpinner);
|
|
1136
1144
|
var LoadingSpinnerRoot = import_styled_components14.default.div.attrs({
|
|
1137
1145
|
role: "progressbar"
|
|
1138
1146
|
}).withConfig({
|
|
@@ -1146,11 +1154,11 @@ var Icon2 = import_styled_components14.default.div.attrs({
|
|
|
1146
1154
|
}).withConfig({
|
|
1147
1155
|
componentId: "ccl__sc-1id6yz4-1"
|
|
1148
1156
|
})(["width:1em;height:1em;border-radius:1em;background-color:currentColor;animation:", " 1s both ease-out;animation-iteration-count:", ";&[data-reset-animation]{animation:none;}"], scaleOut, (p) => p.once ? 1 : "infinite");
|
|
1149
|
-
var LoadingSpinnerIcon = (0,
|
|
1157
|
+
var LoadingSpinnerIcon = (0, import_react16.forwardRef)(function LoadingSpinnerIcon2({
|
|
1150
1158
|
once = false
|
|
1151
1159
|
}, ref) {
|
|
1152
|
-
const iconRef = (0,
|
|
1153
|
-
(0,
|
|
1160
|
+
const iconRef = (0, import_react16.useRef)(null);
|
|
1161
|
+
(0, import_react16.useImperativeHandle)(ref, () => ({
|
|
1154
1162
|
restart: () => {
|
|
1155
1163
|
if (!iconRef.current) {
|
|
1156
1164
|
return;
|
|
@@ -1164,21 +1172,21 @@ var LoadingSpinnerIcon = (0, import_react15.forwardRef)(function LoadingSpinnerI
|
|
|
1164
1172
|
});
|
|
1165
1173
|
|
|
1166
1174
|
// src/components/DropdownSelector/index.tsx
|
|
1167
|
-
var
|
|
1175
|
+
var import_react21 = require("react");
|
|
1168
1176
|
var import_styled_components17 = __toESM(require("styled-components"));
|
|
1169
1177
|
var import_utils10 = require("@charcoal-ui/utils");
|
|
1170
1178
|
|
|
1171
1179
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1172
|
-
var
|
|
1180
|
+
var import_react18 = require("react");
|
|
1173
1181
|
|
|
1174
1182
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
1175
|
-
var
|
|
1183
|
+
var import_react17 = require("react");
|
|
1176
1184
|
var import_overlays4 = require("@react-aria/overlays");
|
|
1177
1185
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
1178
1186
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1179
1187
|
var _empty = () => null;
|
|
1180
1188
|
function Popover(props) {
|
|
1181
|
-
const defaultPopoverRef = (0,
|
|
1189
|
+
const defaultPopoverRef = (0, import_react17.useRef)(null);
|
|
1182
1190
|
const finalPopoverRef = props.popoverRef === void 0 ? defaultPopoverRef : props.popoverRef;
|
|
1183
1191
|
const {
|
|
1184
1192
|
popoverProps,
|
|
@@ -1194,7 +1202,7 @@ function Popover(props) {
|
|
|
1194
1202
|
setOpen: _empty,
|
|
1195
1203
|
toggle: _empty
|
|
1196
1204
|
});
|
|
1197
|
-
const modalBackground = (0,
|
|
1205
|
+
const modalBackground = (0, import_react17.useContext)(ModalBackgroundContext);
|
|
1198
1206
|
usePreventScroll(modalBackground, props.isOpen);
|
|
1199
1207
|
if (!props.isOpen)
|
|
1200
1208
|
return null;
|
|
@@ -1221,13 +1229,13 @@ function DropdownPopover({
|
|
|
1221
1229
|
children,
|
|
1222
1230
|
...props
|
|
1223
1231
|
}) {
|
|
1224
|
-
const ref = (0,
|
|
1225
|
-
(0,
|
|
1232
|
+
const ref = (0, import_react18.useRef)(null);
|
|
1233
|
+
(0, import_react18.useEffect)(() => {
|
|
1226
1234
|
if (props.isOpen && ref.current && props.triggerRef.current) {
|
|
1227
1235
|
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
1228
1236
|
}
|
|
1229
1237
|
}, [props.triggerRef, props.isOpen]);
|
|
1230
|
-
(0,
|
|
1238
|
+
(0, import_react18.useEffect)(() => {
|
|
1231
1239
|
if (props.isOpen && props.value !== void 0) {
|
|
1232
1240
|
const windowScrollY = window.scrollY;
|
|
1233
1241
|
const windowScrollX = window.scrollX;
|
|
@@ -1264,12 +1272,12 @@ function findPreviewRecursive(children, value) {
|
|
|
1264
1272
|
}
|
|
1265
1273
|
|
|
1266
1274
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1267
|
-
var
|
|
1275
|
+
var import_react20 = require("react");
|
|
1268
1276
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
1269
1277
|
|
|
1270
1278
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
1271
|
-
var
|
|
1272
|
-
var MenuListContext = (0,
|
|
1279
|
+
var import_react19 = require("react");
|
|
1280
|
+
var MenuListContext = (0, import_react19.createContext)({
|
|
1273
1281
|
root: void 0,
|
|
1274
1282
|
value: "",
|
|
1275
1283
|
propsArray: [],
|
|
@@ -1303,8 +1311,8 @@ function getValuesRecursive(children) {
|
|
|
1303
1311
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1304
1312
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1305
1313
|
function MenuList(props) {
|
|
1306
|
-
const root = (0,
|
|
1307
|
-
const propsArray = (0,
|
|
1314
|
+
const root = (0, import_react20.useRef)(null);
|
|
1315
|
+
const propsArray = (0, import_react20.useMemo)(() => getValuesRecursive(props.children), [props.children]);
|
|
1308
1316
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyledUl, { ref: root, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MenuListContext.Provider, { value: {
|
|
1309
1317
|
value: props.value ?? "",
|
|
1310
1318
|
root,
|
|
@@ -1327,15 +1335,15 @@ function DropdownSelector({
|
|
|
1327
1335
|
onChange,
|
|
1328
1336
|
...props
|
|
1329
1337
|
}) {
|
|
1330
|
-
const triggerRef = (0,
|
|
1331
|
-
const [isOpen, setIsOpen] = (0,
|
|
1338
|
+
const triggerRef = (0, import_react21.useRef)(null);
|
|
1339
|
+
const [isOpen, setIsOpen] = (0, import_react21.useState)(false);
|
|
1332
1340
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
1333
|
-
const isPlaceholder = (0,
|
|
1341
|
+
const isPlaceholder = (0, import_react21.useMemo)(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
|
|
1334
1342
|
const propsArray = getValuesRecursive(props.children);
|
|
1335
1343
|
const {
|
|
1336
1344
|
visuallyHiddenProps
|
|
1337
1345
|
} = (0, import_visually_hidden3.useVisuallyHidden)();
|
|
1338
|
-
const handleChange = (0,
|
|
1346
|
+
const handleChange = (0, import_react21.useCallback)((e) => {
|
|
1339
1347
|
onChange(e.target.value);
|
|
1340
1348
|
}, [onChange]);
|
|
1341
1349
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
|
|
@@ -1404,7 +1412,7 @@ var ItemDiv = import_styled_components18.default.div.withConfig({
|
|
|
1404
1412
|
})(["display:flex;align-items:center;min-height:40px;cursor:pointer;outline:none;padding-right:16px;padding-left:16px;transition:background-color 0.2s;&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}:hover,:focus,:focus-within{&:not(disabled):not([aria-disabled='true']){background-color:var(--charcoal-surface3);}}"]);
|
|
1405
1413
|
|
|
1406
1414
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
1407
|
-
var
|
|
1415
|
+
var import_react22 = require("react");
|
|
1408
1416
|
|
|
1409
1417
|
// src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
|
|
1410
1418
|
function handleFocusByKeyBoard(element, parent) {
|
|
@@ -1441,12 +1449,12 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
1441
1449
|
setValue,
|
|
1442
1450
|
root,
|
|
1443
1451
|
propsArray
|
|
1444
|
-
} = (0,
|
|
1445
|
-
const setContextValue = (0,
|
|
1452
|
+
} = (0, import_react22.useContext)(MenuListContext);
|
|
1453
|
+
const setContextValue = (0, import_react22.useCallback)(() => {
|
|
1446
1454
|
if (value !== void 0)
|
|
1447
1455
|
setValue(value);
|
|
1448
1456
|
}, [value, setValue]);
|
|
1449
|
-
const handleKeyDown = (0,
|
|
1457
|
+
const handleKeyDown = (0, import_react22.useCallback)((e) => {
|
|
1450
1458
|
if (e.key === "Enter") {
|
|
1451
1459
|
setContextValue();
|
|
1452
1460
|
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
@@ -1493,12 +1501,12 @@ function MenuItem(props) {
|
|
|
1493
1501
|
}
|
|
1494
1502
|
|
|
1495
1503
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
1496
|
-
var
|
|
1504
|
+
var import_react23 = require("react");
|
|
1497
1505
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1498
1506
|
function DropdownMenuItem(props) {
|
|
1499
1507
|
const {
|
|
1500
1508
|
value: ctxValue
|
|
1501
|
-
} = (0,
|
|
1509
|
+
} = (0, import_react23.useContext)(MenuListContext);
|
|
1502
1510
|
const isSelected = props.value === ctxValue;
|
|
1503
1511
|
const {
|
|
1504
1512
|
children,
|
|
@@ -1538,15 +1546,15 @@ var StyledLi2 = import_styled_components20.default.li.withConfig({
|
|
|
1538
1546
|
})(["display:block;"]);
|
|
1539
1547
|
|
|
1540
1548
|
// src/components/SegmentedControl/index.tsx
|
|
1541
|
-
var
|
|
1549
|
+
var import_react25 = require("react");
|
|
1542
1550
|
var import_radio = require("@react-stately/radio");
|
|
1543
1551
|
var import_radio2 = require("@react-aria/radio");
|
|
1544
1552
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
1545
1553
|
|
|
1546
1554
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
1547
|
-
var
|
|
1555
|
+
var import_react24 = require("react");
|
|
1548
1556
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1549
|
-
var RadioContext = (0,
|
|
1557
|
+
var RadioContext = (0, import_react24.createContext)(null);
|
|
1550
1558
|
var RadioProvider = ({
|
|
1551
1559
|
value,
|
|
1552
1560
|
children
|
|
@@ -1554,7 +1562,7 @@ var RadioProvider = ({
|
|
|
1554
1562
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RadioContext.Provider, { value, children });
|
|
1555
1563
|
};
|
|
1556
1564
|
var useRadioContext = () => {
|
|
1557
|
-
const state = (0,
|
|
1565
|
+
const state = (0, import_react24.useContext)(RadioContext);
|
|
1558
1566
|
if (state === null)
|
|
1559
1567
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
1560
1568
|
return state;
|
|
@@ -1562,8 +1570,8 @@ var useRadioContext = () => {
|
|
|
1562
1570
|
|
|
1563
1571
|
// src/components/SegmentedControl/index.tsx
|
|
1564
1572
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1565
|
-
var SegmentedControl = (0,
|
|
1566
|
-
const ariaRadioGroupProps = (0,
|
|
1573
|
+
var SegmentedControl = (0, import_react25.forwardRef)(function SegmentedControlInner(props, ref) {
|
|
1574
|
+
const ariaRadioGroupProps = (0, import_react25.useMemo)(() => ({
|
|
1567
1575
|
...props,
|
|
1568
1576
|
isDisabled: props.disabled,
|
|
1569
1577
|
isReadOnly: props.readonly,
|
|
@@ -1574,7 +1582,7 @@ var SegmentedControl = (0, import_react24.forwardRef)(function SegmentedControlI
|
|
|
1574
1582
|
const {
|
|
1575
1583
|
radioGroupProps
|
|
1576
1584
|
} = (0, import_radio2.useRadioGroup)(ariaRadioGroupProps, state);
|
|
1577
|
-
const segmentedControlItems = (0,
|
|
1585
|
+
const segmentedControlItems = (0, import_react25.useMemo)(() => {
|
|
1578
1586
|
return props.data.map((d) => typeof d === "string" ? {
|
|
1579
1587
|
value: d,
|
|
1580
1588
|
label: d
|
|
@@ -1582,11 +1590,11 @@ var SegmentedControl = (0, import_react24.forwardRef)(function SegmentedControlI
|
|
|
1582
1590
|
}, [props.data]);
|
|
1583
1591
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SegmentedControlRoot, { ref, ...radioGroupProps, className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
|
|
1584
1592
|
});
|
|
1585
|
-
var SegmentedControl_default = (0,
|
|
1593
|
+
var SegmentedControl_default = (0, import_react25.memo)(SegmentedControl);
|
|
1586
1594
|
var Segmented = (props) => {
|
|
1587
1595
|
const state = useRadioContext();
|
|
1588
|
-
const ref = (0,
|
|
1589
|
-
const ariaRadioProps = (0,
|
|
1596
|
+
const ref = (0, import_react25.useRef)(null);
|
|
1597
|
+
const ariaRadioProps = (0, import_react25.useMemo)(() => ({
|
|
1590
1598
|
value: props.value,
|
|
1591
1599
|
isDisabled: props.disabled,
|
|
1592
1600
|
children: props.children
|
|
@@ -1620,18 +1628,18 @@ var SegmentedLabelInner = import_styled_components21.default.div.withConfig({
|
|
|
1620
1628
|
})(["font-size:14px;line-height:22px;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
1621
1629
|
|
|
1622
1630
|
// src/components/Checkbox/index.tsx
|
|
1623
|
-
var
|
|
1631
|
+
var import_react26 = require("react");
|
|
1624
1632
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
1625
1633
|
var import_checkbox = require("@react-aria/checkbox");
|
|
1626
1634
|
var import_utils11 = require("@react-aria/utils");
|
|
1627
1635
|
var import_react_stately2 = require("react-stately");
|
|
1628
1636
|
var import_styled9 = require("@charcoal-ui/styled");
|
|
1629
1637
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1630
|
-
var Checkbox = (0,
|
|
1638
|
+
var Checkbox = (0, import_react26.forwardRef)(function CheckboxInner({
|
|
1631
1639
|
invalid = false,
|
|
1632
1640
|
...props
|
|
1633
1641
|
}, ref) {
|
|
1634
|
-
const ariaCheckboxProps = (0,
|
|
1642
|
+
const ariaCheckboxProps = (0, import_react26.useMemo)(() => ({
|
|
1635
1643
|
...props,
|
|
1636
1644
|
isInValid: invalid,
|
|
1637
1645
|
isSelected: props.checked,
|
|
@@ -1655,7 +1663,7 @@ var Checkbox = (0, import_react25.forwardRef)(function CheckboxInner({
|
|
|
1655
1663
|
"children" in props && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(InputLabel, { children: props.children })
|
|
1656
1664
|
] });
|
|
1657
1665
|
});
|
|
1658
|
-
var Checkbox_default = (0,
|
|
1666
|
+
var Checkbox_default = (0, import_react26.memo)(Checkbox);
|
|
1659
1667
|
var hiddenCss = (0, import_styled_components22.css)(["visibility:hidden;"]);
|
|
1660
1668
|
var InputRoot = import_styled_components22.default.label.withConfig({
|
|
1661
1669
|
componentId: "ccl__sc-wrdmwj-0"
|
|
@@ -1676,7 +1684,7 @@ var InputLabel = import_styled_components22.default.div.withConfig({
|
|
|
1676
1684
|
})(["color:var(--charcoal-text2);font-size:14px;line-height:20px;"]);
|
|
1677
1685
|
|
|
1678
1686
|
// src/components/TagItem/index.tsx
|
|
1679
|
-
var
|
|
1687
|
+
var import_react27 = require("react");
|
|
1680
1688
|
var import_utils12 = require("@react-aria/utils");
|
|
1681
1689
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
1682
1690
|
var import_utils13 = require("@charcoal-ui/utils");
|
|
@@ -1687,7 +1695,7 @@ var sizeMap = {
|
|
|
1687
1695
|
S: 32,
|
|
1688
1696
|
M: 40
|
|
1689
1697
|
};
|
|
1690
|
-
var TagItem = (0,
|
|
1698
|
+
var TagItem = (0, import_react27.forwardRef)(function TagItemInner({
|
|
1691
1699
|
label,
|
|
1692
1700
|
translatedLabel,
|
|
1693
1701
|
bgColor = "#7ACCB1",
|
|
@@ -1699,7 +1707,7 @@ var TagItem = (0, import_react26.forwardRef)(function TagItemInner({
|
|
|
1699
1707
|
...props
|
|
1700
1708
|
}, _ref) {
|
|
1701
1709
|
const ref = (0, import_utils12.useObjectRef)(_ref);
|
|
1702
|
-
const ariaButtonProps = (0,
|
|
1710
|
+
const ariaButtonProps = (0, import_react27.useMemo)(() => ({
|
|
1703
1711
|
elementType: "a",
|
|
1704
1712
|
isDisabled: disabled,
|
|
1705
1713
|
...props
|
|
@@ -1719,7 +1727,7 @@ var TagItem = (0, import_react26.forwardRef)(function TagItemInner({
|
|
|
1719
1727
|
] })
|
|
1720
1728
|
] });
|
|
1721
1729
|
});
|
|
1722
|
-
var TagItem_default = (0,
|
|
1730
|
+
var TagItem_default = (0, import_react27.memo)(TagItem);
|
|
1723
1731
|
var horizontalPadding = ({
|
|
1724
1732
|
left,
|
|
1725
1733
|
right
|
|
@@ -1797,6 +1805,7 @@ var TranslatedLabel = import_styled_components23.default.div.withConfig({
|
|
|
1797
1805
|
ModalAlign,
|
|
1798
1806
|
ModalBody,
|
|
1799
1807
|
ModalButtons,
|
|
1808
|
+
ModalCloseButton,
|
|
1800
1809
|
ModalHeader,
|
|
1801
1810
|
MultiSelect,
|
|
1802
1811
|
MultiSelectGroup,
|