@charcoal-ui/react 2.8.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/index.test.d.ts +4 -0
- package/dist/components/Button/index.test.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts +1 -0
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/index.d.ts +8 -6
- package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
- package/dist/components/LoadingSpinner/index.story.d.ts +2 -2
- package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +17 -26
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.story.d.ts +13 -2
- package/dist/components/Modal/index.story.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +15 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.story.d.ts +15 -2
- package/dist/components/MultiSelect/index.story.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts +10 -1
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/Radio/index.story.d.ts +9 -2
- package/dist/components/Radio/index.story.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts +1 -0
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/Switch/index.d.ts +2 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.story.d.ts +2 -2
- package/dist/components/Switch/index.story.d.ts.map +1 -1
- package/dist/index.cjs.js +170 -141
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +188 -154
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/components/Button/__snapshots__/index.test.tsx.snap +385 -0
- package/src/components/Button/index.test.tsx +25 -0
- package/src/components/Checkbox/index.story.tsx +1 -0
- package/src/components/Checkbox/index.tsx +2 -1
- package/src/components/LoadingSpinner/index.story.tsx +7 -1
- package/src/components/LoadingSpinner/index.tsx +27 -11
- package/src/components/Modal/index.tsx +18 -12
- package/src/components/MultiSelect/index.story.tsx +11 -3
- package/src/components/MultiSelect/index.tsx +77 -61
- package/src/components/Radio/index.story.tsx +3 -0
- package/src/components/Radio/index.tsx +13 -9
- package/src/components/SegmentedControl/index.tsx +15 -5
- package/src/components/Switch/index.tsx +37 -32
- package/src/components/TextField/index.story.tsx +1 -1
- package/src/components/TextField/index.tsx +1 -0
package/dist/index.esm.js
CHANGED
|
@@ -314,16 +314,11 @@ function validateIconSize(size, icon) {
|
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
// src/components/Radio/index.tsx
|
|
317
|
-
import React6, { useCallback, useContext as useContext2 } from "react";
|
|
317
|
+
import React6, { forwardRef, memo, useCallback, useContext as useContext2 } from "react";
|
|
318
318
|
import styled5 from "styled-components";
|
|
319
319
|
import warning from "warning";
|
|
320
320
|
import { px } from "@charcoal-ui/utils";
|
|
321
|
-
|
|
322
|
-
value,
|
|
323
|
-
forceChecked = false,
|
|
324
|
-
disabled = false,
|
|
325
|
-
children
|
|
326
|
-
}) {
|
|
321
|
+
var Radio = forwardRef(function RadioInner({ value, forceChecked = false, disabled = false, children, className }, ref) {
|
|
327
322
|
const {
|
|
328
323
|
name,
|
|
329
324
|
selected,
|
|
@@ -345,7 +340,7 @@ function Radio({
|
|
|
345
340
|
},
|
|
346
341
|
[onChange]
|
|
347
342
|
);
|
|
348
|
-
return /* @__PURE__ */ React6.createElement(RadioRoot, { "aria-disabled": isDisabled || isReadonly }, /* @__PURE__ */ React6.createElement(
|
|
343
|
+
return /* @__PURE__ */ React6.createElement(RadioRoot, { "aria-disabled": isDisabled || isReadonly, className }, /* @__PURE__ */ React6.createElement(
|
|
349
344
|
RadioInput,
|
|
350
345
|
{
|
|
351
346
|
name,
|
|
@@ -353,10 +348,12 @@ function Radio({
|
|
|
353
348
|
checked: forceChecked || isSelected,
|
|
354
349
|
hasError,
|
|
355
350
|
onChange: handleChange,
|
|
356
|
-
disabled: isDisabled || isReadonly
|
|
351
|
+
disabled: isDisabled || isReadonly,
|
|
352
|
+
ref
|
|
357
353
|
}
|
|
358
354
|
), children != null && /* @__PURE__ */ React6.createElement(RadioLabel, null, children));
|
|
359
|
-
}
|
|
355
|
+
});
|
|
356
|
+
var Radio_default = memo(Radio);
|
|
360
357
|
var RadioRoot = styled5.label`
|
|
361
358
|
display: grid;
|
|
362
359
|
grid-template-columns: auto 1fr;
|
|
@@ -379,6 +376,8 @@ var RadioInput = styled5.input.attrs({ type: "radio" })`
|
|
|
379
376
|
width: 20px;
|
|
380
377
|
height: 20px;
|
|
381
378
|
|
|
379
|
+
cursor: pointer;
|
|
380
|
+
|
|
382
381
|
${({ hasError = false }) => theme((o) => [
|
|
383
382
|
o.borderRadius("oval"),
|
|
384
383
|
o.bg.surface1.hover.press,
|
|
@@ -475,7 +474,12 @@ function RadioGroup({
|
|
|
475
474
|
}
|
|
476
475
|
|
|
477
476
|
// src/components/MultiSelect/index.tsx
|
|
478
|
-
import React7, {
|
|
477
|
+
import React7, {
|
|
478
|
+
forwardRef as forwardRef2,
|
|
479
|
+
memo as memo2,
|
|
480
|
+
useCallback as useCallback2,
|
|
481
|
+
useContext as useContext3
|
|
482
|
+
} from "react";
|
|
479
483
|
import styled6, { css as css2 } from "styled-components";
|
|
480
484
|
import warning2 from "warning";
|
|
481
485
|
import { disabledSelector as disabledSelector2, px as px2 } from "@charcoal-ui/utils";
|
|
@@ -496,63 +500,68 @@ var MultiSelectGroupContext = createContext({
|
|
|
496
500
|
});
|
|
497
501
|
|
|
498
502
|
// src/components/MultiSelect/index.tsx
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
503
|
+
var MultiSelect = forwardRef2(
|
|
504
|
+
function MultiSelectInner({
|
|
505
|
+
value,
|
|
506
|
+
forceChecked = false,
|
|
507
|
+
disabled = false,
|
|
508
|
+
onChange,
|
|
509
|
+
variant = "default",
|
|
510
|
+
className,
|
|
511
|
+
children
|
|
512
|
+
}, ref) {
|
|
513
|
+
const {
|
|
514
|
+
name,
|
|
515
|
+
selected,
|
|
516
|
+
disabled: parentDisabled,
|
|
517
|
+
readonly,
|
|
518
|
+
hasError,
|
|
519
|
+
onChange: parentOnChange
|
|
520
|
+
} = useContext3(MultiSelectGroupContext);
|
|
521
|
+
warning2(
|
|
522
|
+
name !== void 0,
|
|
523
|
+
`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
|
|
524
|
+
);
|
|
525
|
+
const isSelected = selected.includes(value) || forceChecked;
|
|
526
|
+
const isDisabled = disabled || parentDisabled || readonly;
|
|
527
|
+
const handleChange = useCallback2(
|
|
528
|
+
(event) => {
|
|
529
|
+
if (!(event.currentTarget instanceof HTMLInputElement)) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (onChange)
|
|
533
|
+
onChange({ value, selected: event.currentTarget.checked });
|
|
534
|
+
parentOnChange({ value, selected: event.currentTarget.checked });
|
|
535
|
+
},
|
|
536
|
+
[onChange, parentOnChange, value]
|
|
537
|
+
);
|
|
538
|
+
return /* @__PURE__ */ React7.createElement(MultiSelectRoot, { "aria-disabled": isDisabled, className }, /* @__PURE__ */ React7.createElement(
|
|
539
|
+
MultiSelectInput,
|
|
540
|
+
{
|
|
541
|
+
...{
|
|
542
|
+
name,
|
|
543
|
+
value,
|
|
544
|
+
hasError
|
|
545
|
+
},
|
|
546
|
+
checked: isSelected,
|
|
547
|
+
disabled: isDisabled,
|
|
548
|
+
onChange: handleChange,
|
|
549
|
+
overlay: variant === "overlay",
|
|
550
|
+
"aria-invalid": hasError,
|
|
551
|
+
ref
|
|
525
552
|
}
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
return /* @__PURE__ */ React7.createElement(MultiSelectRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React7.createElement(
|
|
533
|
-
MultiSelectInput,
|
|
534
|
-
{
|
|
535
|
-
...{
|
|
536
|
-
name,
|
|
537
|
-
value,
|
|
538
|
-
hasError
|
|
553
|
+
), /* @__PURE__ */ React7.createElement(
|
|
554
|
+
MultiSelectInputOverlay,
|
|
555
|
+
{
|
|
556
|
+
overlay: variant === "overlay",
|
|
557
|
+
hasError,
|
|
558
|
+
"aria-hidden": true
|
|
539
559
|
},
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}
|
|
546
|
-
), /* @__PURE__ */ React7.createElement(
|
|
547
|
-
MultiSelectInputOverlay,
|
|
548
|
-
{
|
|
549
|
-
overlay: variant === "overlay",
|
|
550
|
-
hasError,
|
|
551
|
-
"aria-hidden": true
|
|
552
|
-
},
|
|
553
|
-
/* @__PURE__ */ React7.createElement("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 })
|
|
554
|
-
), Boolean(children) && /* @__PURE__ */ React7.createElement(MultiSelectLabel, null, children));
|
|
555
|
-
}
|
|
560
|
+
/* @__PURE__ */ React7.createElement("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 })
|
|
561
|
+
), Boolean(children) && /* @__PURE__ */ React7.createElement(MultiSelectLabel, null, children));
|
|
562
|
+
}
|
|
563
|
+
);
|
|
564
|
+
var MultiSelect_default = memo2(MultiSelect);
|
|
556
565
|
var MultiSelectRoot = styled6.label`
|
|
557
566
|
display: grid;
|
|
558
567
|
grid-template-columns: auto 1fr;
|
|
@@ -665,28 +674,32 @@ function MultiSelectGroup({
|
|
|
665
674
|
|
|
666
675
|
// src/components/Switch/index.tsx
|
|
667
676
|
import { useSwitch } from "@react-aria/switch";
|
|
668
|
-
import React8, {
|
|
677
|
+
import React8, { useMemo, memo as memo3, forwardRef as forwardRef3 } from "react";
|
|
669
678
|
import { useToggleState } from "react-stately";
|
|
670
679
|
import styled7 from "styled-components";
|
|
671
680
|
import { disabledSelector as disabledSelector3 } from "@charcoal-ui/utils";
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
681
|
+
import { useObjectRef } from "@react-aria/utils";
|
|
682
|
+
var SwitchCheckbox = forwardRef3(
|
|
683
|
+
function SwitchCheckboxInner(props, external) {
|
|
684
|
+
const { disabled, className } = props;
|
|
685
|
+
const ariaSwitchProps = useMemo(
|
|
686
|
+
() => ({
|
|
687
|
+
...props,
|
|
688
|
+
"aria-label": "children" in props ? void 0 : props.label,
|
|
689
|
+
isDisabled: props.disabled,
|
|
690
|
+
isSelected: props.checked
|
|
691
|
+
}),
|
|
692
|
+
[props]
|
|
693
|
+
);
|
|
694
|
+
const state = useToggleState(ariaSwitchProps);
|
|
695
|
+
const ref = useObjectRef(external);
|
|
696
|
+
const {
|
|
697
|
+
inputProps: { className: _className, type: _type, ...rest }
|
|
698
|
+
} = useSwitch(ariaSwitchProps, state, ref);
|
|
699
|
+
return /* @__PURE__ */ React8.createElement(Label, { className, "aria-disabled": disabled }, /* @__PURE__ */ React8.createElement(SwitchInput, { ...rest, ref }), "children" in props ? /* @__PURE__ */ React8.createElement(LabelInner, null, props.children) : void 0);
|
|
700
|
+
}
|
|
701
|
+
);
|
|
702
|
+
var Switch_default = memo3(SwitchCheckbox);
|
|
690
703
|
var Label = styled7.label`
|
|
691
704
|
display: inline-grid;
|
|
692
705
|
grid-template-columns: auto 1fr;
|
|
@@ -781,7 +794,7 @@ import { useVisuallyHidden } from "@react-aria/visually-hidden";
|
|
|
781
794
|
import React10, {
|
|
782
795
|
useCallback as useCallback3,
|
|
783
796
|
useEffect,
|
|
784
|
-
useRef
|
|
797
|
+
useRef,
|
|
785
798
|
useState
|
|
786
799
|
} from "react";
|
|
787
800
|
import styled9, { css as css3 } from "styled-components";
|
|
@@ -855,7 +868,7 @@ var TextField = React10.forwardRef(
|
|
|
855
868
|
}
|
|
856
869
|
);
|
|
857
870
|
var TextField_default = TextField;
|
|
858
|
-
var SingleLineTextField = React10.forwardRef(function SingleLineTextFieldInner({ onChange, ...props },
|
|
871
|
+
var SingleLineTextField = React10.forwardRef(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef9) {
|
|
859
872
|
const {
|
|
860
873
|
className,
|
|
861
874
|
showLabel = false,
|
|
@@ -872,9 +885,9 @@ var SingleLineTextField = React10.forwardRef(function SingleLineTextFieldInner({
|
|
|
872
885
|
suffix = null
|
|
873
886
|
} = props;
|
|
874
887
|
const { visuallyHiddenProps } = useVisuallyHidden();
|
|
875
|
-
const ariaRef =
|
|
876
|
-
const prefixRef =
|
|
877
|
-
const suffixRef =
|
|
888
|
+
const ariaRef = useRef(null);
|
|
889
|
+
const prefixRef = useRef(null);
|
|
890
|
+
const suffixRef = useRef(null);
|
|
878
891
|
const [count, setCount] = useState(countCodePointsInString(props.value ?? ""));
|
|
879
892
|
const [prefixWidth, setPrefixWidth] = useState(0);
|
|
880
893
|
const [suffixWidth, setSuffixWidth] = useState(0);
|
|
@@ -939,7 +952,7 @@ var SingleLineTextField = React10.forwardRef(function SingleLineTextFieldInner({
|
|
|
939
952
|
), /* @__PURE__ */ React10.createElement(StyledInputContainer, null, /* @__PURE__ */ React10.createElement(PrefixContainer, { ref: prefixRef }, /* @__PURE__ */ React10.createElement(Affix, null, prefix)), /* @__PURE__ */ React10.createElement(
|
|
940
953
|
StyledInput,
|
|
941
954
|
{
|
|
942
|
-
ref: mergeRefs(
|
|
955
|
+
ref: mergeRefs(forwardRef9, ariaRef),
|
|
943
956
|
invalid,
|
|
944
957
|
extraLeftPadding: prefixWidth,
|
|
945
958
|
extraRightPadding: suffixWidth,
|
|
@@ -954,7 +967,7 @@ var SingleLineTextField = React10.forwardRef(function SingleLineTextFieldInner({
|
|
|
954
967
|
assistiveText
|
|
955
968
|
));
|
|
956
969
|
});
|
|
957
|
-
var MultiLineTextField = React10.forwardRef(function MultiLineTextFieldInner({ onChange, ...props },
|
|
970
|
+
var MultiLineTextField = React10.forwardRef(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef9) {
|
|
958
971
|
const {
|
|
959
972
|
className,
|
|
960
973
|
showCount = false,
|
|
@@ -971,8 +984,8 @@ var MultiLineTextField = React10.forwardRef(function MultiLineTextFieldInner({ o
|
|
|
971
984
|
rows: initialRows = 4
|
|
972
985
|
} = props;
|
|
973
986
|
const { visuallyHiddenProps } = useVisuallyHidden();
|
|
974
|
-
const textareaRef =
|
|
975
|
-
const ariaRef =
|
|
987
|
+
const textareaRef = useRef(null);
|
|
988
|
+
const ariaRef = useRef(null);
|
|
976
989
|
const [count, setCount] = useState(countCodePointsInString(props.value ?? ""));
|
|
977
990
|
const [rows, setRows] = useState(initialRows);
|
|
978
991
|
const syncHeight = useCallback3(
|
|
@@ -1040,7 +1053,7 @@ var MultiLineTextField = React10.forwardRef(function MultiLineTextFieldInner({ o
|
|
|
1040
1053
|
/* @__PURE__ */ React10.createElement(
|
|
1041
1054
|
StyledTextarea,
|
|
1042
1055
|
{
|
|
1043
|
-
ref: mergeRefs(textareaRef,
|
|
1056
|
+
ref: mergeRefs(textareaRef, forwardRef9, ariaRef),
|
|
1044
1057
|
rows,
|
|
1045
1058
|
noBottomPadding: showCount,
|
|
1046
1059
|
...inputProps
|
|
@@ -1075,6 +1088,7 @@ var PrefixContainer = styled9.span`
|
|
|
1075
1088
|
top: 50%;
|
|
1076
1089
|
left: 8px;
|
|
1077
1090
|
transform: translateY(-50%);
|
|
1091
|
+
z-index: 1;
|
|
1078
1092
|
`;
|
|
1079
1093
|
var SuffixContainer = styled9.span`
|
|
1080
1094
|
position: absolute;
|
|
@@ -1222,7 +1236,7 @@ var Icon = React11.forwardRef(function IconInner({ name, scale, unsafeNonGuideli
|
|
|
1222
1236
|
var Icon_default = Icon;
|
|
1223
1237
|
|
|
1224
1238
|
// src/components/Modal/index.tsx
|
|
1225
|
-
import React12, {
|
|
1239
|
+
import React12, { forwardRef as forwardRef4, memo as memo4, useContext as useContext4 } from "react";
|
|
1226
1240
|
import {
|
|
1227
1241
|
Overlay,
|
|
1228
1242
|
useModalOverlay,
|
|
@@ -1243,22 +1257,19 @@ function columnSystem(span, column, gutter) {
|
|
|
1243
1257
|
import { maxWidth } from "@charcoal-ui/utils";
|
|
1244
1258
|
import { useMedia } from "@charcoal-ui/styled";
|
|
1245
1259
|
import { animated, useTransition, easings } from "react-spring";
|
|
1260
|
+
import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
1246
1261
|
var DEFAULT_Z_INDEX = 10;
|
|
1247
|
-
|
|
1248
|
-
children,
|
|
1249
|
-
zIndex = DEFAULT_Z_INDEX,
|
|
1250
|
-
portalContainer,
|
|
1251
|
-
...props
|
|
1252
|
-
}) {
|
|
1262
|
+
var Modal = forwardRef4(function ModalInner({ children, zIndex = DEFAULT_Z_INDEX, portalContainer, ...props }, external) {
|
|
1253
1263
|
const {
|
|
1254
1264
|
title,
|
|
1255
1265
|
size = "M",
|
|
1256
1266
|
bottomSheet = false,
|
|
1257
1267
|
isDismissable,
|
|
1258
1268
|
onClose,
|
|
1269
|
+
className,
|
|
1259
1270
|
isOpen = false
|
|
1260
1271
|
} = props;
|
|
1261
|
-
const ref =
|
|
1272
|
+
const ref = useObjectRef2(external);
|
|
1262
1273
|
const { overlayProps, underlayProps } = useOverlay(props, ref);
|
|
1263
1274
|
const { modalProps } = useModalOverlay(
|
|
1264
1275
|
props,
|
|
@@ -1311,7 +1322,8 @@ function Modal({
|
|
|
1311
1322
|
...dialogProps,
|
|
1312
1323
|
style: transitionEnabled ? { transform } : {},
|
|
1313
1324
|
size,
|
|
1314
|
-
bottomSheet
|
|
1325
|
+
bottomSheet,
|
|
1326
|
+
className
|
|
1315
1327
|
},
|
|
1316
1328
|
/* @__PURE__ */ React12.createElement(
|
|
1317
1329
|
ModalContext.Provider,
|
|
@@ -1331,7 +1343,8 @@ function Modal({
|
|
|
1331
1343
|
)))
|
|
1332
1344
|
))
|
|
1333
1345
|
);
|
|
1334
|
-
}
|
|
1346
|
+
});
|
|
1347
|
+
var Modal_default = memo4(Modal);
|
|
1335
1348
|
var ModalContext = React12.createContext({
|
|
1336
1349
|
titleProps: {},
|
|
1337
1350
|
title: "",
|
|
@@ -1445,15 +1458,24 @@ var ModalButtons = styled11.div`
|
|
|
1445
1458
|
`;
|
|
1446
1459
|
|
|
1447
1460
|
// src/components/LoadingSpinner/index.tsx
|
|
1448
|
-
import React14, { useImperativeHandle, useRef as
|
|
1461
|
+
import React14, { forwardRef as forwardRef5, memo as memo5, useImperativeHandle, useRef as useRef2 } from "react";
|
|
1449
1462
|
import styled12, { keyframes } from "styled-components";
|
|
1450
|
-
|
|
1451
|
-
size = 48,
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1463
|
+
var LoadingSpinner = forwardRef5(
|
|
1464
|
+
function LoadingSpinnerInner({ size = 48, padding = 16, transparent = false, className }, ref) {
|
|
1465
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1466
|
+
LoadingSpinnerRoot,
|
|
1467
|
+
{
|
|
1468
|
+
size,
|
|
1469
|
+
padding,
|
|
1470
|
+
transparent,
|
|
1471
|
+
className,
|
|
1472
|
+
ref
|
|
1473
|
+
},
|
|
1474
|
+
/* @__PURE__ */ React14.createElement(LoadingSpinnerIcon, null)
|
|
1475
|
+
);
|
|
1476
|
+
}
|
|
1477
|
+
);
|
|
1478
|
+
var LoadingSpinner_default = memo5(LoadingSpinner);
|
|
1457
1479
|
var LoadingSpinnerRoot = styled12.div.attrs({ role: "progressbar" })`
|
|
1458
1480
|
box-sizing: content-box;
|
|
1459
1481
|
margin: auto;
|
|
@@ -1492,7 +1514,7 @@ var Icon2 = styled12.div.attrs({ role: "presentation" })`
|
|
|
1492
1514
|
}
|
|
1493
1515
|
`;
|
|
1494
1516
|
var LoadingSpinnerIcon = React14.forwardRef(function LoadingSpinnerIcon2({ once = false }, ref) {
|
|
1495
|
-
const iconRef =
|
|
1517
|
+
const iconRef = useRef2(null);
|
|
1496
1518
|
useImperativeHandle(ref, () => ({
|
|
1497
1519
|
restart: () => {
|
|
1498
1520
|
if (!iconRef.current) {
|
|
@@ -1507,7 +1529,7 @@ var LoadingSpinnerIcon = React14.forwardRef(function LoadingSpinnerIcon2({ once
|
|
|
1507
1529
|
});
|
|
1508
1530
|
|
|
1509
1531
|
// src/components/DropdownSelector/index.tsx
|
|
1510
|
-
import React19, { useMemo as useMemo3, useRef as
|
|
1532
|
+
import React19, { useMemo as useMemo3, useRef as useRef6 } from "react";
|
|
1511
1533
|
import styled18 from "styled-components";
|
|
1512
1534
|
import { Item, useSelectState } from "react-stately";
|
|
1513
1535
|
import { disabledSelector as disabledSelector4 } from "@charcoal-ui/utils";
|
|
@@ -1516,7 +1538,7 @@ import { useSelect, HiddenSelect } from "@react-aria/select";
|
|
|
1516
1538
|
import { useButton } from "@react-aria/button";
|
|
1517
1539
|
|
|
1518
1540
|
// src/components/DropdownSelector/Listbox.tsx
|
|
1519
|
-
import React17, { memo, useRef as
|
|
1541
|
+
import React17, { memo as memo6, useRef as useRef4, Fragment, useMemo as useMemo2 } from "react";
|
|
1520
1542
|
import styled16 from "styled-components";
|
|
1521
1543
|
import { useListBox } from "@react-aria/listbox";
|
|
1522
1544
|
|
|
@@ -1527,14 +1549,14 @@ import React16 from "react";
|
|
|
1527
1549
|
import styled15 from "styled-components";
|
|
1528
1550
|
|
|
1529
1551
|
// src/components/DropdownSelector/Option.tsx
|
|
1530
|
-
import React15, { useRef as
|
|
1552
|
+
import React15, { useRef as useRef3 } from "react";
|
|
1531
1553
|
import styled13, { css as css5 } from "styled-components";
|
|
1532
1554
|
import { useOption } from "@react-aria/listbox";
|
|
1533
1555
|
import { mergeProps } from "@react-aria/utils";
|
|
1534
1556
|
import { useFocusRing } from "@react-aria/focus";
|
|
1535
1557
|
import { px as px3 } from "@charcoal-ui/utils";
|
|
1536
1558
|
function Option({ item, state, mode }) {
|
|
1537
|
-
const ref =
|
|
1559
|
+
const ref = useRef3(null);
|
|
1538
1560
|
const { optionProps, isSelected } = useOption(item, state, ref);
|
|
1539
1561
|
const { focusProps } = useFocusRing();
|
|
1540
1562
|
return /* @__PURE__ */ React15.createElement(OptionRoot, { ...mergeProps(optionProps, focusProps), ref, mode }, /* @__PURE__ */ React15.createElement(OptionCheckIcon, { name: "16/Check", isSelected }), /* @__PURE__ */ React15.createElement(OptionText, null, item.rendered));
|
|
@@ -1617,7 +1639,7 @@ var Listbox = ({
|
|
|
1617
1639
|
mode = "default",
|
|
1618
1640
|
...props
|
|
1619
1641
|
}) => {
|
|
1620
|
-
const ref =
|
|
1642
|
+
const ref = useRef4(null);
|
|
1621
1643
|
const { listBoxProps } = useListBox(props, state, ref);
|
|
1622
1644
|
const collection = useMemo2(
|
|
1623
1645
|
() => [...state.collection].map((node, index, self) => ({
|
|
@@ -1629,7 +1651,7 @@ var Listbox = ({
|
|
|
1629
1651
|
);
|
|
1630
1652
|
return /* @__PURE__ */ React17.createElement(ListboxRoot, { ref, ...listBoxProps }, collection.map(({ node, last }) => /* @__PURE__ */ React17.createElement(Fragment, { key: node.key }, node.type === "section" ? /* @__PURE__ */ React17.createElement(ListBoxSection, { section: node, state }) : /* @__PURE__ */ React17.createElement(Option, { item: node, state, mode }), !last && mode === "separator" && /* @__PURE__ */ React17.createElement(Divider, null))));
|
|
1631
1653
|
};
|
|
1632
|
-
var Listbox_default =
|
|
1654
|
+
var Listbox_default = memo6(Listbox);
|
|
1633
1655
|
var ListboxRoot = styled16.ul`
|
|
1634
1656
|
padding-left: 0;
|
|
1635
1657
|
margin: 0;
|
|
@@ -1648,7 +1670,7 @@ var ListboxRoot = styled16.ul`
|
|
|
1648
1670
|
`;
|
|
1649
1671
|
|
|
1650
1672
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1651
|
-
import React18, { useEffect as useEffect2, useRef as
|
|
1673
|
+
import React18, { useEffect as useEffect2, useRef as useRef5 } from "react";
|
|
1652
1674
|
import {
|
|
1653
1675
|
DismissButton,
|
|
1654
1676
|
Overlay as Overlay2,
|
|
@@ -1660,7 +1682,7 @@ var DropdownPopoverDiv = styled17.div`
|
|
|
1660
1682
|
${theme((o) => o.margin.top(4).bottom(4))}
|
|
1661
1683
|
`;
|
|
1662
1684
|
function DropdownPopover({ children, state, ...props }) {
|
|
1663
|
-
const ref =
|
|
1685
|
+
const ref = useRef5(null);
|
|
1664
1686
|
const { popoverProps, underlayProps } = usePopover(
|
|
1665
1687
|
{
|
|
1666
1688
|
...props,
|
|
@@ -1709,7 +1731,7 @@ var DropdownSelector = ({
|
|
|
1709
1731
|
...props
|
|
1710
1732
|
}) => {
|
|
1711
1733
|
const { visuallyHiddenProps } = useVisuallyHidden2();
|
|
1712
|
-
const triggerRef =
|
|
1734
|
+
const triggerRef = useRef6(null);
|
|
1713
1735
|
const selectProps = useMemo3(
|
|
1714
1736
|
() => ({
|
|
1715
1737
|
...props,
|
|
@@ -1833,7 +1855,7 @@ var AssertiveText = styled18.div`
|
|
|
1833
1855
|
`;
|
|
1834
1856
|
|
|
1835
1857
|
// src/components/SegmentedControl/index.tsx
|
|
1836
|
-
import React21, { forwardRef, memo as
|
|
1858
|
+
import React21, { forwardRef as forwardRef6, memo as memo7, useMemo as useMemo4, useRef as useRef7 } from "react";
|
|
1837
1859
|
import { useRadioGroupState } from "react-stately";
|
|
1838
1860
|
import {
|
|
1839
1861
|
useRadio,
|
|
@@ -1859,7 +1881,7 @@ var useRadioContext = () => {
|
|
|
1859
1881
|
};
|
|
1860
1882
|
|
|
1861
1883
|
// src/components/SegmentedControl/index.tsx
|
|
1862
|
-
var SegmentedControl =
|
|
1884
|
+
var SegmentedControl = forwardRef6(
|
|
1863
1885
|
function SegmentedControlInner(props, ref) {
|
|
1864
1886
|
const ariaRadioGroupProps = useMemo4(
|
|
1865
1887
|
() => ({
|
|
@@ -1878,23 +1900,35 @@ var SegmentedControl = forwardRef(
|
|
|
1878
1900
|
(d) => typeof d === "string" ? { value: d, label: d } : d
|
|
1879
1901
|
);
|
|
1880
1902
|
}, [props.data]);
|
|
1881
|
-
return /* @__PURE__ */ React21.createElement(
|
|
1882
|
-
|
|
1903
|
+
return /* @__PURE__ */ React21.createElement(
|
|
1904
|
+
SegmentedControlRoot,
|
|
1883
1905
|
{
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1906
|
+
ref,
|
|
1907
|
+
...radioGroupProps,
|
|
1908
|
+
className: props.className
|
|
1887
1909
|
},
|
|
1888
|
-
item.
|
|
1889
|
-
|
|
1910
|
+
/* @__PURE__ */ React21.createElement(RadioProvider, { value: state }, segmentedControlItems.map((item) => /* @__PURE__ */ React21.createElement(
|
|
1911
|
+
Segmented,
|
|
1912
|
+
{
|
|
1913
|
+
key: item.value,
|
|
1914
|
+
value: item.value,
|
|
1915
|
+
disabled: item.disabled
|
|
1916
|
+
},
|
|
1917
|
+
item.label
|
|
1918
|
+
)))
|
|
1919
|
+
);
|
|
1890
1920
|
}
|
|
1891
1921
|
);
|
|
1892
|
-
var SegmentedControl_default =
|
|
1893
|
-
var Segmented = (
|
|
1922
|
+
var SegmentedControl_default = memo7(SegmentedControl);
|
|
1923
|
+
var Segmented = (props) => {
|
|
1894
1924
|
const state = useRadioContext();
|
|
1895
|
-
const ref =
|
|
1925
|
+
const ref = useRef7(null);
|
|
1896
1926
|
const ariaRadioProps = useMemo4(
|
|
1897
|
-
() => ({
|
|
1927
|
+
() => ({
|
|
1928
|
+
value: props.value,
|
|
1929
|
+
isDisabled: props.disabled,
|
|
1930
|
+
children: props.children
|
|
1931
|
+
}),
|
|
1898
1932
|
[props]
|
|
1899
1933
|
);
|
|
1900
1934
|
const { inputProps, isDisabled, isSelected } = useRadio(
|
|
@@ -1909,7 +1943,7 @@ var Segmented = ({ children, ...props }) => {
|
|
|
1909
1943
|
checked: isSelected
|
|
1910
1944
|
},
|
|
1911
1945
|
/* @__PURE__ */ React21.createElement(SegmentedInput, { ...inputProps, ref }),
|
|
1912
|
-
/* @__PURE__ */ React21.createElement(RadioLabel2, null, /* @__PURE__ */ React21.createElement(SegmentedLabelInner, null, children))
|
|
1946
|
+
/* @__PURE__ */ React21.createElement(RadioLabel2, null, /* @__PURE__ */ React21.createElement(SegmentedLabelInner, null, props.children))
|
|
1913
1947
|
);
|
|
1914
1948
|
};
|
|
1915
1949
|
var SegmentedControlRoot = styled19.div`
|
|
@@ -1962,13 +1996,13 @@ var SegmentedLabelInner = styled19.div`
|
|
|
1962
1996
|
`;
|
|
1963
1997
|
|
|
1964
1998
|
// src/components/Checkbox/index.tsx
|
|
1965
|
-
import React22, { forwardRef as
|
|
1999
|
+
import React22, { forwardRef as forwardRef7, memo as memo8, useMemo as useMemo5 } from "react";
|
|
1966
2000
|
import styled20, { css as css6 } from "styled-components";
|
|
1967
2001
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
1968
|
-
import { useObjectRef } from "@react-aria/utils";
|
|
2002
|
+
import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
|
|
1969
2003
|
import { useToggleState as useToggleState2 } from "react-stately";
|
|
1970
2004
|
import { disabledSelector as disabledSelector6, px as px4 } from "@charcoal-ui/utils";
|
|
1971
|
-
var Checkbox =
|
|
2005
|
+
var Checkbox = forwardRef7(
|
|
1972
2006
|
function CheckboxInner(props, ref) {
|
|
1973
2007
|
const ariaCheckboxProps = useMemo5(
|
|
1974
2008
|
() => ({
|
|
@@ -1981,13 +2015,13 @@ var Checkbox = forwardRef2(
|
|
|
1981
2015
|
[props]
|
|
1982
2016
|
);
|
|
1983
2017
|
const state = useToggleState2(ariaCheckboxProps);
|
|
1984
|
-
const objectRef =
|
|
2018
|
+
const objectRef = useObjectRef3(ref);
|
|
1985
2019
|
const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef);
|
|
1986
2020
|
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
1987
|
-
return /* @__PURE__ */ React22.createElement(InputRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React22.createElement(CheckboxRoot, null, /* @__PURE__ */ React22.createElement(CheckboxInput, { type: "checkbox", ...inputProps }), /* @__PURE__ */ React22.createElement(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked }, /* @__PURE__ */ React22.createElement(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }))), "children" in props && /* @__PURE__ */ React22.createElement(InputLabel, null, props.children));
|
|
2021
|
+
return /* @__PURE__ */ React22.createElement(InputRoot, { "aria-disabled": isDisabled, className: props.className }, /* @__PURE__ */ React22.createElement(CheckboxRoot, null, /* @__PURE__ */ React22.createElement(CheckboxInput, { type: "checkbox", ...inputProps }), /* @__PURE__ */ React22.createElement(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked }, /* @__PURE__ */ React22.createElement(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }))), "children" in props && /* @__PURE__ */ React22.createElement(InputLabel, null, props.children));
|
|
1988
2022
|
}
|
|
1989
2023
|
);
|
|
1990
|
-
var Checkbox_default =
|
|
2024
|
+
var Checkbox_default = memo8(Checkbox);
|
|
1991
2025
|
var hiddenCss = css6`
|
|
1992
2026
|
visibility: hidden;
|
|
1993
2027
|
`;
|
|
@@ -2052,11 +2086,11 @@ var InputLabel = styled20.div`
|
|
|
2052
2086
|
|
|
2053
2087
|
// src/components/TagItem/index.tsx
|
|
2054
2088
|
import React23, {
|
|
2055
|
-
forwardRef as
|
|
2056
|
-
memo as
|
|
2089
|
+
forwardRef as forwardRef8,
|
|
2090
|
+
memo as memo9,
|
|
2057
2091
|
useMemo as useMemo6
|
|
2058
2092
|
} from "react";
|
|
2059
|
-
import { useObjectRef as
|
|
2093
|
+
import { useObjectRef as useObjectRef4 } from "@react-aria/utils";
|
|
2060
2094
|
import styled21, { css as css7 } from "styled-components";
|
|
2061
2095
|
import { disabledSelector as disabledSelector7, px as px5 } from "@charcoal-ui/utils";
|
|
2062
2096
|
import { useButton as useButton2 } from "@react-aria/button";
|
|
@@ -2064,7 +2098,7 @@ var sizeMap = {
|
|
|
2064
2098
|
S: 32,
|
|
2065
2099
|
M: 40
|
|
2066
2100
|
};
|
|
2067
|
-
var TagItem =
|
|
2101
|
+
var TagItem = forwardRef8(
|
|
2068
2102
|
function TagItemInner({
|
|
2069
2103
|
label,
|
|
2070
2104
|
translatedLabel,
|
|
@@ -2076,7 +2110,7 @@ var TagItem = forwardRef3(
|
|
|
2076
2110
|
className,
|
|
2077
2111
|
...props
|
|
2078
2112
|
}, _ref) {
|
|
2079
|
-
const ref =
|
|
2113
|
+
const ref = useObjectRef4(_ref);
|
|
2080
2114
|
const ariaButtonProps = useMemo6(
|
|
2081
2115
|
() => ({
|
|
2082
2116
|
elementType: "a",
|
|
@@ -2101,7 +2135,7 @@ var TagItem = forwardRef3(
|
|
|
2101
2135
|
);
|
|
2102
2136
|
}
|
|
2103
2137
|
);
|
|
2104
|
-
var TagItem_default =
|
|
2138
|
+
var TagItem_default = memo9(TagItem);
|
|
2105
2139
|
var TagItemRoot = styled21.a`
|
|
2106
2140
|
isolation: isolate;
|
|
2107
2141
|
position: relative;
|
|
@@ -2194,21 +2228,21 @@ export {
|
|
|
2194
2228
|
DropdownSelectorItem,
|
|
2195
2229
|
Icon_default as Icon,
|
|
2196
2230
|
IconButton_default as IconButton,
|
|
2197
|
-
LoadingSpinner,
|
|
2231
|
+
LoadingSpinner_default as LoadingSpinner,
|
|
2198
2232
|
LoadingSpinnerIcon,
|
|
2199
|
-
Modal,
|
|
2233
|
+
Modal_default as Modal,
|
|
2200
2234
|
ModalAlign,
|
|
2201
2235
|
ModalBody,
|
|
2202
2236
|
ModalButtons,
|
|
2203
2237
|
ModalHeader,
|
|
2204
|
-
MultiSelect,
|
|
2238
|
+
MultiSelect_default as MultiSelect,
|
|
2205
2239
|
MultiSelectGroup,
|
|
2206
2240
|
OverlayProvider,
|
|
2207
|
-
Radio,
|
|
2241
|
+
Radio_default as Radio,
|
|
2208
2242
|
RadioGroup,
|
|
2209
2243
|
SSRProvider,
|
|
2210
2244
|
SegmentedControl_default as SegmentedControl,
|
|
2211
|
-
|
|
2245
|
+
Switch_default as Switch,
|
|
2212
2246
|
TagItem_default as TagItem,
|
|
2213
2247
|
TextField_default as TextField,
|
|
2214
2248
|
useComponentAbstraction
|