@charcoal-ui/react 3.3.0-beta.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_lib/useForwardedRef.d.ts +3 -0
- package/dist/_lib/useForwardedRef.d.ts.map +1 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts +1 -0
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/Clickable/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/usePreventScroll.d.ts +2 -0
- package/dist/components/DropdownSelector/Popover/usePreventScroll.d.ts.map +1 -0
- package/dist/components/DropdownSelector/index.story.d.ts +1 -0
- package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
- package/dist/components/Icon/index.story.d.ts +1 -1
- package/dist/components/Modal/Dialog/index.d.ts +26 -0
- package/dist/components/Modal/Dialog/index.d.ts.map +1 -0
- package/dist/components/Modal/ModalBackgroundContext.d.ts +6 -0
- package/dist/components/Modal/ModalBackgroundContext.d.ts.map +1 -0
- package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
- package/dist/components/Modal/__stories__/InternalScrollStory.d.ts +4 -0
- package/dist/components/Modal/__stories__/InternalScrollStory.d.ts.map +1 -0
- package/dist/components/Modal/index.d.ts +12 -2
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.story.d.ts +3 -2
- package/dist/components/Modal/index.story.d.ts.map +1 -1
- package/dist/index.cjs.js +392 -301
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +354 -264
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/_lib/useForwardedRef.tsx +16 -0
- package/src/components/Button/__snapshots__/index.story.storyshot +1971 -0
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +390 -0
- package/src/components/Checkbox/index.story.tsx +3 -0
- package/src/components/Checkbox/index.tsx +7 -4
- package/src/components/Clickable/__snapshots__/index.story.storyshot +100 -0
- package/src/components/Clickable/index.tsx +17 -35
- package/src/components/DropdownSelector/DropdownPopover.tsx +0 -1
- package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +245 -0
- package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +555 -0
- package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +174 -0
- package/src/components/DropdownSelector/Popover/index.tsx +17 -2
- package/src/components/DropdownSelector/Popover/usePreventScroll.tsx +18 -0
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +1241 -0
- package/src/components/DropdownSelector/index.story.tsx +69 -13
- package/src/components/Icon/__snapshots__/index.story.storyshot +12 -0
- package/src/components/{Button/__snapshots__/index.test.tsx.snap → IconButton/__snapshots__/index.story.storyshot} +94 -91
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +81 -0
- package/src/components/Modal/Dialog/index.tsx +82 -0
- package/src/components/Modal/ModalBackgroundContext.tsx +8 -0
- package/src/components/Modal/ModalPlumbing.tsx +16 -4
- package/src/components/Modal/__snapshots__/index.story.storyshot +533 -0
- package/src/components/Modal/__stories__/InternalScrollStory.tsx +75 -0
- package/src/components/Modal/index.story.tsx +57 -38
- package/src/components/Modal/index.tsx +63 -94
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +511 -0
- package/src/components/Radio/__snapshots__/index.story.storyshot +319 -0
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +483 -0
- package/src/components/Switch/__snapshots__/index.story.storyshot +454 -0
- package/src/components/TagItem/__snapshots__/index.story.storyshot +1181 -0
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1271 -0
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +1800 -0
- package/dist/components/Button/index.test.d.ts +0 -4
- package/dist/components/Button/index.test.d.ts.map +0 -1
- package/src/components/Button/index.test.tsx +0 -24
package/dist/index.cjs.js
CHANGED
|
@@ -147,33 +147,33 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
|
147
147
|
var Clickable = React2.forwardRef(
|
|
148
148
|
function Clickable2(props, ref) {
|
|
149
149
|
const { Link } = useComponentAbstraction();
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
onClick: disabled ? void 0 : onClick,
|
|
158
|
-
"aria-disabled": disabled,
|
|
159
|
-
ref
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
} else {
|
|
163
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { ...props, ref });
|
|
150
|
+
const isLink = "to" in props;
|
|
151
|
+
const as = isLink ? Link : "button";
|
|
152
|
+
const ariaDisabled = isLink && props.disabled === true ? true : void 0;
|
|
153
|
+
let rest = props;
|
|
154
|
+
if (isLink) {
|
|
155
|
+
const { disabled, ..._rest } = props;
|
|
156
|
+
rest = _rest;
|
|
164
157
|
}
|
|
158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
159
|
+
StyledClickableDiv,
|
|
160
|
+
{
|
|
161
|
+
...rest,
|
|
162
|
+
ref,
|
|
163
|
+
as,
|
|
164
|
+
"aria-disabled": ariaDisabled
|
|
165
|
+
}
|
|
166
|
+
);
|
|
165
167
|
}
|
|
166
168
|
);
|
|
167
169
|
var Clickable_default = Clickable;
|
|
168
|
-
var
|
|
169
|
-
/* Clickable style */
|
|
170
|
+
var StyledClickableDiv = import_styled_components3.default.div`
|
|
170
171
|
cursor: pointer;
|
|
171
172
|
|
|
172
173
|
${import_utils.disabledSelector} {
|
|
173
174
|
cursor: default;
|
|
174
175
|
}
|
|
175
|
-
|
|
176
|
-
var Button = import_styled_components3.default.button`
|
|
176
|
+
|
|
177
177
|
/* Reset button appearance */
|
|
178
178
|
appearance: none;
|
|
179
179
|
background: transparent;
|
|
@@ -206,27 +206,11 @@ var Button = import_styled_components3.default.button`
|
|
|
206
206
|
border-style: none;
|
|
207
207
|
padding: 0;
|
|
208
208
|
}
|
|
209
|
-
|
|
210
|
-
${clickableCss}
|
|
211
|
-
`;
|
|
212
|
-
var A = import_styled_components3.default.span`
|
|
213
|
-
/* Reset a-tag appearance */
|
|
214
|
-
color: inherit;
|
|
215
|
-
|
|
216
|
-
&:focus {
|
|
217
|
-
outline: none;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.text {
|
|
221
|
-
top: calc(1em + 2em);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
${clickableCss}
|
|
225
209
|
`;
|
|
226
210
|
|
|
227
211
|
// src/components/Button/index.tsx
|
|
228
212
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
229
|
-
var
|
|
213
|
+
var Button = (0, import_react2.forwardRef)(function Button2({
|
|
230
214
|
children,
|
|
231
215
|
variant = "Default",
|
|
232
216
|
size = "M",
|
|
@@ -247,7 +231,7 @@ var Button2 = (0, import_react2.forwardRef)(function Button3({
|
|
|
247
231
|
}
|
|
248
232
|
);
|
|
249
233
|
});
|
|
250
|
-
var Button_default =
|
|
234
|
+
var Button_default = Button;
|
|
251
235
|
var StyledButton = (0, import_styled_components4.default)(Clickable_default)`
|
|
252
236
|
width: ${(p) => p.$fullWidth ? "stretch" : "min-content"};
|
|
253
237
|
display: inline-grid;
|
|
@@ -922,7 +906,7 @@ var FieldLabelWrapper = import_styled_components9.default.div`
|
|
|
922
906
|
// src/components/TextField/index.tsx
|
|
923
907
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
924
908
|
var TextField = React5.forwardRef(
|
|
925
|
-
function SingleLineTextFieldInner({ onChange, ...props },
|
|
909
|
+
function SingleLineTextFieldInner({ onChange, ...props }, forwardRef18) {
|
|
926
910
|
const {
|
|
927
911
|
className,
|
|
928
912
|
showLabel = false,
|
|
@@ -1012,7 +996,7 @@ var TextField = React5.forwardRef(
|
|
|
1012
996
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1013
997
|
StyledInput,
|
|
1014
998
|
{
|
|
1015
|
-
ref: mergeRefs(
|
|
999
|
+
ref: mergeRefs(forwardRef18, ariaRef),
|
|
1016
1000
|
invalid,
|
|
1017
1001
|
extraLeftPadding: prefixWidth,
|
|
1018
1002
|
extraRightPadding: suffixWidth,
|
|
@@ -1121,7 +1105,7 @@ var import_react9 = require("react");
|
|
|
1121
1105
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
1122
1106
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1123
1107
|
var TextArea = (0, import_react9.forwardRef)(
|
|
1124
|
-
function TextAreaInner({ onChange, ...props },
|
|
1108
|
+
function TextAreaInner({ onChange, ...props }, forwardRef18) {
|
|
1125
1109
|
const {
|
|
1126
1110
|
className,
|
|
1127
1111
|
showCount = false,
|
|
@@ -1211,7 +1195,7 @@ var TextArea = (0, import_react9.forwardRef)(
|
|
|
1211
1195
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1212
1196
|
StyledTextarea,
|
|
1213
1197
|
{
|
|
1214
|
-
ref: mergeRefs(textareaRef,
|
|
1198
|
+
ref: mergeRefs(textareaRef, forwardRef18, ariaRef),
|
|
1215
1199
|
rows,
|
|
1216
1200
|
noBottomPadding: showCount,
|
|
1217
1201
|
...inputProps
|
|
@@ -1335,11 +1319,18 @@ var Icon = React6.forwardRef(function IconInner({ name, scale, unsafeNonGuidelin
|
|
|
1335
1319
|
var Icon_default = Icon;
|
|
1336
1320
|
|
|
1337
1321
|
// src/components/Modal/index.tsx
|
|
1338
|
-
var
|
|
1339
|
-
var
|
|
1322
|
+
var import_react11 = require("react");
|
|
1323
|
+
var React9 = __toESM(require("react"));
|
|
1340
1324
|
var import_overlays2 = require("@react-aria/overlays");
|
|
1325
|
+
var import_styled_components13 = __toESM(require("styled-components"));
|
|
1326
|
+
var import_utils7 = require("@charcoal-ui/utils");
|
|
1327
|
+
var import_styled12 = require("@charcoal-ui/styled");
|
|
1328
|
+
var import_react_spring2 = require("react-spring");
|
|
1329
|
+
var import_utils8 = require("@react-aria/utils");
|
|
1330
|
+
|
|
1331
|
+
// src/components/Modal/Dialog/index.tsx
|
|
1332
|
+
var import_react10 = require("react");
|
|
1341
1333
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
1342
|
-
var import_focus = require("@react-aria/focus");
|
|
1343
1334
|
var import_dialog = require("@react-aria/dialog");
|
|
1344
1335
|
|
|
1345
1336
|
// ../foundation/src/grid.ts
|
|
@@ -1349,14 +1340,100 @@ function columnSystem(span, column, gutter) {
|
|
|
1349
1340
|
return span * column + (span - 1) * gutter;
|
|
1350
1341
|
}
|
|
1351
1342
|
|
|
1352
|
-
// src/components/Modal/index.tsx
|
|
1343
|
+
// src/components/Modal/Dialog/index.tsx
|
|
1353
1344
|
var import_utils6 = require("@charcoal-ui/utils");
|
|
1354
|
-
var import_styled12 = require("@charcoal-ui/styled");
|
|
1355
1345
|
var import_react_spring = require("react-spring");
|
|
1356
|
-
|
|
1346
|
+
|
|
1347
|
+
// src/_lib/useForwardedRef.tsx
|
|
1348
|
+
var React7 = __toESM(require("react"));
|
|
1349
|
+
function useForwardedRef(ref) {
|
|
1350
|
+
const innerRef = React7.useRef(null);
|
|
1351
|
+
React7.useEffect(() => {
|
|
1352
|
+
if (!ref)
|
|
1353
|
+
return;
|
|
1354
|
+
if (typeof ref === "function") {
|
|
1355
|
+
ref(innerRef.current);
|
|
1356
|
+
} else {
|
|
1357
|
+
ref.current = innerRef.current;
|
|
1358
|
+
}
|
|
1359
|
+
});
|
|
1360
|
+
return innerRef;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
// src/components/Modal/Dialog/index.tsx
|
|
1357
1364
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1365
|
+
var Dialog = (0, import_react10.forwardRef)(function Dialog2(props, forwardRef18) {
|
|
1366
|
+
const ref = useForwardedRef(forwardRef18);
|
|
1367
|
+
const { dialogProps } = (0, import_dialog.useDialog)(
|
|
1368
|
+
{
|
|
1369
|
+
role: "dialog"
|
|
1370
|
+
},
|
|
1371
|
+
ref
|
|
1372
|
+
);
|
|
1373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1374
|
+
AnimatedStyledDialogDiv,
|
|
1375
|
+
{
|
|
1376
|
+
...props,
|
|
1377
|
+
role: dialogProps.role,
|
|
1378
|
+
tabIndex: dialogProps.tabIndex,
|
|
1379
|
+
"aria-labelledby": dialogProps["aria-labelledby"],
|
|
1380
|
+
onBlur: dialogProps.onBlur,
|
|
1381
|
+
ref
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
});
|
|
1385
|
+
var AnimatedStyledDialogDiv = (0, import_react_spring.animated)(import_styled_components12.default.div`
|
|
1386
|
+
margin: auto;
|
|
1387
|
+
position: relative;
|
|
1388
|
+
height: fit-content;
|
|
1389
|
+
width: ${(p) => {
|
|
1390
|
+
switch (p.size) {
|
|
1391
|
+
case "S": {
|
|
1392
|
+
return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
1393
|
+
}
|
|
1394
|
+
case "M": {
|
|
1395
|
+
return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
1396
|
+
}
|
|
1397
|
+
case "L": {
|
|
1398
|
+
return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
1399
|
+
}
|
|
1400
|
+
default: {
|
|
1401
|
+
return unreachable(p.size);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}}px;
|
|
1405
|
+
|
|
1406
|
+
background-color: ${({ theme: theme3 }) => theme3.color.background1};
|
|
1407
|
+
border-radius: 24px;
|
|
1408
|
+
|
|
1409
|
+
@media ${({ theme: theme3 }) => (0, import_utils6.maxWidth)(theme3.breakpoint.screen1)} {
|
|
1410
|
+
max-width: 440px;
|
|
1411
|
+
width: calc(100% - 48px);
|
|
1412
|
+
${(p) => p.bottomSheet !== false && import_styled_components12.css`
|
|
1413
|
+
max-width: unset;
|
|
1414
|
+
width: 100%;
|
|
1415
|
+
border-radius: 0;
|
|
1416
|
+
margin: auto 0 0 0;
|
|
1417
|
+
${p.bottomSheet === "full" && import_styled_components12.css`
|
|
1418
|
+
min-height: 100%;
|
|
1419
|
+
`}
|
|
1420
|
+
`}
|
|
1421
|
+
}
|
|
1422
|
+
:focus {
|
|
1423
|
+
outline: none;
|
|
1424
|
+
}
|
|
1425
|
+
`);
|
|
1426
|
+
|
|
1427
|
+
// src/components/Modal/ModalBackgroundContext.tsx
|
|
1428
|
+
var React8 = __toESM(require("react"));
|
|
1429
|
+
var ModalBackgroundContext = React8.createContext(
|
|
1430
|
+
null
|
|
1431
|
+
);
|
|
1432
|
+
|
|
1433
|
+
// src/components/Modal/index.tsx
|
|
1434
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1358
1435
|
var DEFAULT_Z_INDEX = 10;
|
|
1359
|
-
var Modal = (0,
|
|
1436
|
+
var Modal = (0, import_react11.forwardRef)(function ModalInner({ children, zIndex = DEFAULT_Z_INDEX, portalContainer, ...props }, external) {
|
|
1360
1437
|
const {
|
|
1361
1438
|
title,
|
|
1362
1439
|
size = "M",
|
|
@@ -1366,9 +1443,8 @@ var Modal = (0, import_react10.forwardRef)(function ModalInner({ children, zInde
|
|
|
1366
1443
|
className,
|
|
1367
1444
|
isOpen = false
|
|
1368
1445
|
} = props;
|
|
1369
|
-
const ref = (0,
|
|
1370
|
-
const {
|
|
1371
|
-
const { modalProps } = (0, import_overlays2.useModalOverlay)(
|
|
1446
|
+
const ref = (0, import_utils8.useObjectRef)(external);
|
|
1447
|
+
const { modalProps, underlayProps } = (0, import_overlays2.useModalOverlay)(
|
|
1372
1448
|
props,
|
|
1373
1449
|
{
|
|
1374
1450
|
close: onClose,
|
|
@@ -1382,51 +1458,62 @@ var Modal = (0, import_react10.forwardRef)(function ModalInner({ children, zInde
|
|
|
1382
1458
|
},
|
|
1383
1459
|
ref
|
|
1384
1460
|
);
|
|
1385
|
-
const
|
|
1386
|
-
const
|
|
1387
|
-
const isMobile = (0, import_styled12.useMedia)((0, import_utils6.maxWidth)(theme3.breakpoint.screen1)) ?? false;
|
|
1461
|
+
const theme3 = (0, import_styled_components13.useTheme)();
|
|
1462
|
+
const isMobile = (0, import_styled12.useMedia)((0, import_utils7.maxWidth)(theme3.breakpoint.screen1)) ?? false;
|
|
1388
1463
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
1389
|
-
const
|
|
1464
|
+
const showDismiss = !isMobile || bottomSheet !== true;
|
|
1465
|
+
const transition = (0, import_react_spring2.useTransition)(isOpen, {
|
|
1390
1466
|
from: {
|
|
1391
1467
|
transform: "translateY(100%)",
|
|
1392
|
-
backgroundColor: "rgba(0, 0, 0, 0)"
|
|
1468
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1469
|
+
overflow: "hidden"
|
|
1393
1470
|
},
|
|
1394
1471
|
enter: {
|
|
1395
1472
|
transform: "translateY(0%)",
|
|
1396
1473
|
backgroundColor: "rgba(0, 0, 0, 0.4)"
|
|
1397
1474
|
},
|
|
1475
|
+
update: {
|
|
1476
|
+
overflow: "auto"
|
|
1477
|
+
},
|
|
1398
1478
|
leave: {
|
|
1399
1479
|
transform: "translateY(100%)",
|
|
1400
|
-
backgroundColor: "rgba(0, 0, 0, 0)"
|
|
1480
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1481
|
+
overflow: "hidden"
|
|
1401
1482
|
},
|
|
1402
|
-
config: transitionEnabled ? { duration: 400, easing:
|
|
1483
|
+
config: transitionEnabled ? { duration: 400, easing: import_react_spring2.easings.easeOutQuart } : { duration: 0 }
|
|
1403
1484
|
});
|
|
1404
|
-
const
|
|
1485
|
+
const bgRef = React9.useRef(null);
|
|
1405
1486
|
return transition(
|
|
1406
|
-
({ backgroundColor, transform }, item) => item && /* @__PURE__ */ (0,
|
|
1487
|
+
({ backgroundColor, overflow, transform }, item) => item && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_overlays2.Overlay, { portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1407
1488
|
ModalBackground,
|
|
1408
1489
|
{
|
|
1490
|
+
ref: bgRef,
|
|
1409
1491
|
zIndex,
|
|
1410
1492
|
...underlayProps,
|
|
1411
|
-
style: transitionEnabled ? { backgroundColor } : {},
|
|
1412
|
-
|
|
1413
|
-
|
|
1493
|
+
style: transitionEnabled ? { backgroundColor, overflow } : {},
|
|
1494
|
+
$bottomSheet: bottomSheet,
|
|
1495
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1496
|
+
Dialog,
|
|
1414
1497
|
{
|
|
1415
1498
|
ref,
|
|
1416
|
-
...overlayProps,
|
|
1417
1499
|
...modalProps,
|
|
1418
|
-
...dialogProps,
|
|
1419
1500
|
style: transitionEnabled ? { transform } : {},
|
|
1420
1501
|
size,
|
|
1421
1502
|
bottomSheet,
|
|
1422
1503
|
className,
|
|
1423
|
-
children: /* @__PURE__ */ (0,
|
|
1504
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1424
1505
|
ModalContext.Provider,
|
|
1425
1506
|
{
|
|
1426
|
-
value: {
|
|
1507
|
+
value: {
|
|
1508
|
+
titleProps: {},
|
|
1509
|
+
title,
|
|
1510
|
+
close: onClose,
|
|
1511
|
+
showDismiss,
|
|
1512
|
+
bottomSheet
|
|
1513
|
+
},
|
|
1427
1514
|
children: [
|
|
1428
1515
|
children,
|
|
1429
|
-
isDismissable === true && /* @__PURE__ */ (0,
|
|
1516
|
+
isDismissable === true && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1430
1517
|
ModalCrossButton,
|
|
1431
1518
|
{
|
|
1432
1519
|
size: "S",
|
|
@@ -1438,78 +1525,42 @@ var Modal = (0, import_react10.forwardRef)(function ModalInner({ children, zInde
|
|
|
1438
1525
|
}
|
|
1439
1526
|
)
|
|
1440
1527
|
}
|
|
1441
|
-
) })
|
|
1528
|
+
) })
|
|
1442
1529
|
}
|
|
1443
1530
|
) })
|
|
1444
1531
|
);
|
|
1445
1532
|
});
|
|
1446
|
-
var Modal_default = (0,
|
|
1447
|
-
var ModalContext =
|
|
1533
|
+
var Modal_default = (0, import_react11.memo)(Modal);
|
|
1534
|
+
var ModalContext = React9.createContext({
|
|
1448
1535
|
titleProps: {},
|
|
1449
1536
|
title: "",
|
|
1450
1537
|
close: void 0,
|
|
1451
|
-
showDismiss: true
|
|
1538
|
+
showDismiss: true,
|
|
1539
|
+
bottomSheet: false
|
|
1452
1540
|
});
|
|
1453
|
-
var ModalBackground = (0,
|
|
1541
|
+
var ModalBackground = (0, import_react_spring2.animated)(import_styled_components13.default.div`
|
|
1454
1542
|
z-index: ${({ zIndex }) => zIndex};
|
|
1455
1543
|
overflow: auto;
|
|
1456
1544
|
display: flex;
|
|
1457
1545
|
position: fixed;
|
|
1458
1546
|
top: 0;
|
|
1459
1547
|
left: 0;
|
|
1460
|
-
width:
|
|
1548
|
+
width: -webkit-fill-available;
|
|
1549
|
+
width: -moz-available;
|
|
1461
1550
|
height: 100%;
|
|
1551
|
+
justify-content: center;
|
|
1552
|
+
padding: 40px 0;
|
|
1553
|
+
box-sizing: border-box;
|
|
1462
1554
|
|
|
1463
|
-
${theme
|
|
1464
|
-
`);
|
|
1465
|
-
var DialogContainer = import_styled_components12.default.div`
|
|
1466
|
-
position: relative;
|
|
1467
|
-
margin: auto;
|
|
1468
|
-
padding: 24px 0;
|
|
1469
|
-
width: ${(p) => {
|
|
1470
|
-
switch (p.size) {
|
|
1471
|
-
case "S": {
|
|
1472
|
-
return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
1473
|
-
}
|
|
1474
|
-
case "M": {
|
|
1475
|
-
return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
1476
|
-
}
|
|
1477
|
-
case "L": {
|
|
1478
|
-
return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
1479
|
-
}
|
|
1480
|
-
default: {
|
|
1481
|
-
return unreachable(p.size);
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
}}px;
|
|
1555
|
+
background-color: ${({ theme: theme3 }) => theme3.color.surface4};
|
|
1485
1556
|
|
|
1486
|
-
@media ${({ theme: theme3 }) => (0,
|
|
1487
|
-
|
|
1488
|
-
${(p) => p.bottomSheet !== false && import_styled_components12.css`
|
|
1489
|
-
margin: 0;
|
|
1557
|
+
@media ${({ theme: theme3 }) => (0, import_utils7.maxWidth)(theme3.breakpoint.screen1)} {
|
|
1558
|
+
${(p) => p.$bottomSheet !== false && import_styled_components13.css`
|
|
1490
1559
|
padding: 0;
|
|
1491
|
-
bottom: 0;
|
|
1492
|
-
position: absolute;
|
|
1493
|
-
width: 100%;
|
|
1494
|
-
${p.bottomSheet === "full" ? "height: 100%" : ""};
|
|
1495
|
-
`}
|
|
1496
|
-
}
|
|
1497
|
-
`;
|
|
1498
|
-
var ModalDialog = (0, import_react_spring.animated)(import_styled_components12.default.div`
|
|
1499
|
-
position: relative;
|
|
1500
|
-
margin: auto;
|
|
1501
|
-
|
|
1502
|
-
${theme((o) => [o.bg.background1, o.borderRadius(24)])}
|
|
1503
|
-
@media ${({ theme: theme3 }) => (0, import_utils6.maxWidth)(theme3.breakpoint.screen1)} {
|
|
1504
|
-
${(p) => p.bottomSheet !== false && import_styled_components12.css`
|
|
1505
|
-
border-radius: 0;
|
|
1506
|
-
${p.bottomSheet === "full" && import_styled_components12.css`
|
|
1507
|
-
height: 100%;
|
|
1508
|
-
`}
|
|
1509
1560
|
`}
|
|
1510
1561
|
}
|
|
1511
1562
|
`);
|
|
1512
|
-
var ModalCrossButton = (0,
|
|
1563
|
+
var ModalCrossButton = (0, import_styled_components13.default)(IconButton_default)`
|
|
1513
1564
|
position: absolute;
|
|
1514
1565
|
top: 8px;
|
|
1515
1566
|
right: 8px;
|
|
@@ -1517,37 +1568,45 @@ var ModalCrossButton = (0, import_styled_components12.default)(IconButton_defaul
|
|
|
1517
1568
|
${theme((o) => [o.font.text3.hover.press])}
|
|
1518
1569
|
`;
|
|
1519
1570
|
function ModalTitle(props) {
|
|
1520
|
-
const { titleProps, title } = (0,
|
|
1521
|
-
return /* @__PURE__ */ (0,
|
|
1571
|
+
const { titleProps, title } = (0, import_react11.useContext)(ModalContext);
|
|
1572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalHeading, { ...titleProps, ...props, children: title });
|
|
1522
1573
|
}
|
|
1523
|
-
var ModalHeading =
|
|
1574
|
+
var ModalHeading = import_styled_components13.default.h3`
|
|
1524
1575
|
margin: 0;
|
|
1525
1576
|
font-weight: inherit;
|
|
1526
1577
|
font-size: inherit;
|
|
1527
1578
|
`;
|
|
1528
1579
|
|
|
1529
1580
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1530
|
-
var
|
|
1531
|
-
var
|
|
1581
|
+
var import_styled_components14 = __toESM(require("styled-components"));
|
|
1582
|
+
var import_react12 = require("react");
|
|
1583
|
+
var import_utils9 = require("@charcoal-ui/utils");
|
|
1584
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1532
1585
|
function ModalHeader() {
|
|
1533
|
-
|
|
1586
|
+
const modalCtx = (0, import_react12.useContext)(ModalContext);
|
|
1587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModalHeaderRoot, { $bottomSheet: modalCtx.bottomSheet, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyledModalTitle, {}) });
|
|
1534
1588
|
}
|
|
1535
|
-
var ModalHeaderRoot =
|
|
1589
|
+
var ModalHeaderRoot = import_styled_components14.default.div`
|
|
1536
1590
|
height: 64px;
|
|
1537
1591
|
display: grid;
|
|
1538
1592
|
align-content: center;
|
|
1539
1593
|
justify-content: center;
|
|
1594
|
+
@media ${({ theme: theme3 }) => (0, import_utils9.maxWidth)(theme3.breakpoint.screen1)} {
|
|
1595
|
+
${(p) => p.$bottomSheet !== false && import_styled_components14.css`
|
|
1596
|
+
height: 48px;
|
|
1597
|
+
`}
|
|
1598
|
+
}
|
|
1540
1599
|
`;
|
|
1541
|
-
var StyledModalTitle = (0,
|
|
1600
|
+
var StyledModalTitle = (0, import_styled_components14.default)(ModalTitle)`
|
|
1542
1601
|
${theme((o) => [o.font.text1, o.typography(16).bold])}
|
|
1543
1602
|
`;
|
|
1544
|
-
var ModalAlign =
|
|
1603
|
+
var ModalAlign = import_styled_components14.default.div`
|
|
1545
1604
|
${theme((o) => [o.padding.horizontal(16)])}
|
|
1546
1605
|
`;
|
|
1547
|
-
var ModalBody =
|
|
1606
|
+
var ModalBody = import_styled_components14.default.div`
|
|
1548
1607
|
${theme((o) => [o.padding.bottom(40)])}
|
|
1549
1608
|
`;
|
|
1550
|
-
var ModalButtons =
|
|
1609
|
+
var ModalButtons = import_styled_components14.default.div`
|
|
1551
1610
|
display: grid;
|
|
1552
1611
|
grid-auto-flow: row;
|
|
1553
1612
|
grid-row-gap: 8px;
|
|
@@ -1556,12 +1615,12 @@ var ModalButtons = import_styled_components13.default.div`
|
|
|
1556
1615
|
`;
|
|
1557
1616
|
|
|
1558
1617
|
// src/components/LoadingSpinner/index.tsx
|
|
1559
|
-
var
|
|
1560
|
-
var
|
|
1561
|
-
var
|
|
1562
|
-
var LoadingSpinner = (0,
|
|
1618
|
+
var import_react13 = require("react");
|
|
1619
|
+
var import_styled_components15 = __toESM(require("styled-components"));
|
|
1620
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1621
|
+
var LoadingSpinner = (0, import_react13.forwardRef)(
|
|
1563
1622
|
function LoadingSpinnerInner({ size = 48, padding = 16, transparent = false, className }, ref) {
|
|
1564
|
-
return /* @__PURE__ */ (0,
|
|
1623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1565
1624
|
LoadingSpinnerRoot,
|
|
1566
1625
|
{
|
|
1567
1626
|
size,
|
|
@@ -1569,13 +1628,13 @@ var LoadingSpinner = (0, import_react11.forwardRef)(
|
|
|
1569
1628
|
transparent,
|
|
1570
1629
|
className,
|
|
1571
1630
|
ref,
|
|
1572
|
-
children: /* @__PURE__ */ (0,
|
|
1631
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingSpinnerIcon, {})
|
|
1573
1632
|
}
|
|
1574
1633
|
);
|
|
1575
1634
|
}
|
|
1576
1635
|
);
|
|
1577
|
-
var LoadingSpinner_default = (0,
|
|
1578
|
-
var LoadingSpinnerRoot =
|
|
1636
|
+
var LoadingSpinner_default = (0, import_react13.memo)(LoadingSpinner);
|
|
1637
|
+
var LoadingSpinnerRoot = import_styled_components15.default.div.attrs({ role: "progressbar" })`
|
|
1579
1638
|
box-sizing: content-box;
|
|
1580
1639
|
margin: auto;
|
|
1581
1640
|
padding: ${(props) => props.padding}px;
|
|
@@ -1589,7 +1648,7 @@ var LoadingSpinnerRoot = import_styled_components14.default.div.attrs({ role: "p
|
|
|
1589
1648
|
transparent ? o.bg.transparent : o.bg.background1
|
|
1590
1649
|
])}
|
|
1591
1650
|
`;
|
|
1592
|
-
var scaleOut =
|
|
1651
|
+
var scaleOut = import_styled_components15.keyframes`
|
|
1593
1652
|
from {
|
|
1594
1653
|
transform: scale(0);
|
|
1595
1654
|
opacity: 1;
|
|
@@ -1600,7 +1659,7 @@ var scaleOut = import_styled_components14.keyframes`
|
|
|
1600
1659
|
opacity: 0;
|
|
1601
1660
|
}
|
|
1602
1661
|
`;
|
|
1603
|
-
var Icon2 =
|
|
1662
|
+
var Icon2 = import_styled_components15.default.div.attrs({ role: "presentation" })`
|
|
1604
1663
|
width: 1em;
|
|
1605
1664
|
height: 1em;
|
|
1606
1665
|
border-radius: 1em;
|
|
@@ -1612,10 +1671,10 @@ var Icon2 = import_styled_components14.default.div.attrs({ role: "presentation"
|
|
|
1612
1671
|
animation: none;
|
|
1613
1672
|
}
|
|
1614
1673
|
`;
|
|
1615
|
-
var LoadingSpinnerIcon = (0,
|
|
1674
|
+
var LoadingSpinnerIcon = (0, import_react13.forwardRef)(
|
|
1616
1675
|
function LoadingSpinnerIcon2({ once = false }, ref) {
|
|
1617
|
-
const iconRef = (0,
|
|
1618
|
-
(0,
|
|
1676
|
+
const iconRef = (0, import_react13.useRef)(null);
|
|
1677
|
+
(0, import_react13.useImperativeHandle)(ref, () => ({
|
|
1619
1678
|
restart: () => {
|
|
1620
1679
|
if (!iconRef.current) {
|
|
1621
1680
|
return;
|
|
@@ -1625,26 +1684,45 @@ var LoadingSpinnerIcon = (0, import_react11.forwardRef)(
|
|
|
1625
1684
|
delete iconRef.current.dataset.resetAnimation;
|
|
1626
1685
|
}
|
|
1627
1686
|
}));
|
|
1628
|
-
return /* @__PURE__ */ (0,
|
|
1687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon2, { ref: iconRef, once });
|
|
1629
1688
|
}
|
|
1630
1689
|
);
|
|
1631
1690
|
|
|
1632
1691
|
// src/components/DropdownSelector/index.tsx
|
|
1633
|
-
var
|
|
1634
|
-
var
|
|
1635
|
-
var
|
|
1692
|
+
var import_react19 = require("react");
|
|
1693
|
+
var import_styled_components18 = __toESM(require("styled-components"));
|
|
1694
|
+
var import_utils10 = require("@charcoal-ui/utils");
|
|
1636
1695
|
|
|
1637
1696
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1638
|
-
var
|
|
1697
|
+
var import_react16 = require("react");
|
|
1639
1698
|
|
|
1640
1699
|
// src/components/DropdownSelector/Popover/index.tsx
|
|
1641
|
-
var
|
|
1700
|
+
var import_react15 = require("react");
|
|
1642
1701
|
var import_overlays3 = require("@react-aria/overlays");
|
|
1643
|
-
var
|
|
1644
|
-
|
|
1702
|
+
var import_styled_components16 = __toESM(require("styled-components"));
|
|
1703
|
+
|
|
1704
|
+
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
1705
|
+
var import_react14 = require("react");
|
|
1706
|
+
function usePreventScroll(element, isOpen) {
|
|
1707
|
+
(0, import_react14.useEffect)(() => {
|
|
1708
|
+
if (isOpen && element) {
|
|
1709
|
+
const defaultPaddingRight = element.style.paddingRight;
|
|
1710
|
+
const defaultOverflow = element.style.overflow;
|
|
1711
|
+
element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
|
|
1712
|
+
element.style.overflow = "hidden";
|
|
1713
|
+
return () => {
|
|
1714
|
+
element.style.paddingRight = defaultPaddingRight;
|
|
1715
|
+
element.style.overflow = defaultOverflow;
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
}, [element, isOpen]);
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
// src/components/DropdownSelector/Popover/index.tsx
|
|
1722
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1645
1723
|
var _empty = () => null;
|
|
1646
1724
|
function Popover(props) {
|
|
1647
|
-
const defaultPopoverRef = (0,
|
|
1725
|
+
const defaultPopoverRef = (0, import_react15.useRef)(null);
|
|
1648
1726
|
const finalPopoverRef = props.popoverRef === void 0 ? defaultPopoverRef : props.popoverRef;
|
|
1649
1727
|
const { popoverProps, underlayProps } = (0, import_overlays3.usePopover)(
|
|
1650
1728
|
{
|
|
@@ -1660,18 +1738,30 @@ function Popover(props) {
|
|
|
1660
1738
|
toggle: _empty
|
|
1661
1739
|
}
|
|
1662
1740
|
);
|
|
1741
|
+
const modalBackground = (0, import_react15.useContext)(ModalBackgroundContext);
|
|
1742
|
+
usePreventScroll(modalBackground, props.isOpen);
|
|
1663
1743
|
if (!props.isOpen)
|
|
1664
1744
|
return null;
|
|
1665
|
-
return /* @__PURE__ */ (0,
|
|
1666
|
-
/* @__PURE__ */ (0,
|
|
1667
|
-
|
|
1668
|
-
|
|
1745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_overlays3.Overlay, { portalContainer: document.body, children: [
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1747
|
+
"div",
|
|
1748
|
+
{
|
|
1749
|
+
...underlayProps,
|
|
1750
|
+
style: {
|
|
1751
|
+
position: "fixed",
|
|
1752
|
+
zIndex: typeof popoverProps.style?.zIndex === "number" ? popoverProps.style.zIndex - 1 : 99999,
|
|
1753
|
+
inset: 0
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
),
|
|
1757
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownPopoverDiv, { ...popoverProps, ref: finalPopoverRef, children: [
|
|
1758
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_overlays3.DismissButton, { onDismiss: () => props.onClose() }),
|
|
1669
1759
|
props.children,
|
|
1670
|
-
/* @__PURE__ */ (0,
|
|
1760
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_overlays3.DismissButton, { onDismiss: () => props.onClose() })
|
|
1671
1761
|
] })
|
|
1672
1762
|
] });
|
|
1673
1763
|
}
|
|
1674
|
-
var DropdownPopoverDiv =
|
|
1764
|
+
var DropdownPopoverDiv = import_styled_components16.default.div`
|
|
1675
1765
|
margin: 4px 0;
|
|
1676
1766
|
list-style: none;
|
|
1677
1767
|
overflow: auto;
|
|
@@ -1686,27 +1776,26 @@ var DropdownPopoverDiv = import_styled_components15.default.div`
|
|
|
1686
1776
|
`;
|
|
1687
1777
|
|
|
1688
1778
|
// src/components/DropdownSelector/DropdownPopover.tsx
|
|
1689
|
-
var
|
|
1779
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1690
1780
|
function DropdownPopover({ children, ...props }) {
|
|
1691
|
-
const ref = (0,
|
|
1692
|
-
(0,
|
|
1781
|
+
const ref = (0, import_react16.useRef)(null);
|
|
1782
|
+
(0, import_react16.useEffect)(() => {
|
|
1693
1783
|
if (props.isOpen && ref.current && props.triggerRef.current) {
|
|
1694
1784
|
ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
|
|
1695
1785
|
}
|
|
1696
1786
|
}, [props.triggerRef, props.isOpen]);
|
|
1697
|
-
(0,
|
|
1787
|
+
(0, import_react16.useEffect)(() => {
|
|
1698
1788
|
if (props.isOpen && props.value !== void 0) {
|
|
1699
1789
|
const windowScrollY = window.scrollY;
|
|
1700
1790
|
const windowScrollX = window.scrollX;
|
|
1701
1791
|
const selectedElement = document.querySelector(
|
|
1702
1792
|
`[data-key="${props.value.toString()}"]`
|
|
1703
1793
|
);
|
|
1704
|
-
selectedElement?.scrollIntoView({ block: "center" });
|
|
1705
1794
|
selectedElement?.focus();
|
|
1706
1795
|
window.scrollTo(windowScrollX, windowScrollY);
|
|
1707
1796
|
}
|
|
1708
1797
|
}, [props.value, props.isOpen]);
|
|
1709
|
-
return /* @__PURE__ */ (0,
|
|
1798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1710
1799
|
Popover,
|
|
1711
1800
|
{
|
|
1712
1801
|
isOpen: props.isOpen,
|
|
@@ -1719,12 +1808,12 @@ function DropdownPopover({ children, ...props }) {
|
|
|
1719
1808
|
}
|
|
1720
1809
|
|
|
1721
1810
|
// src/components/DropdownSelector/utils/findPreviewRecursive.tsx
|
|
1722
|
-
var
|
|
1811
|
+
var React10 = __toESM(require("react"));
|
|
1723
1812
|
function findPreviewRecursive(children, value) {
|
|
1724
|
-
const childArray =
|
|
1813
|
+
const childArray = React10.Children.toArray(children);
|
|
1725
1814
|
for (let i = 0; i < childArray.length; i++) {
|
|
1726
1815
|
const child = childArray[i];
|
|
1727
|
-
if (
|
|
1816
|
+
if (React10.isValidElement(child)) {
|
|
1728
1817
|
if ("value" in child.props) {
|
|
1729
1818
|
const childValue = child.props.value;
|
|
1730
1819
|
if (childValue === value && "children" in child.props) {
|
|
@@ -1746,12 +1835,12 @@ function findPreviewRecursive(children, value) {
|
|
|
1746
1835
|
}
|
|
1747
1836
|
|
|
1748
1837
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1749
|
-
var
|
|
1750
|
-
var
|
|
1838
|
+
var import_react18 = require("react");
|
|
1839
|
+
var import_styled_components17 = __toESM(require("styled-components"));
|
|
1751
1840
|
|
|
1752
1841
|
// src/components/DropdownSelector/MenuList/MenuListContext.ts
|
|
1753
|
-
var
|
|
1754
|
-
var MenuListContext = (0,
|
|
1842
|
+
var import_react17 = require("react");
|
|
1843
|
+
var MenuListContext = (0, import_react17.createContext)({
|
|
1755
1844
|
root: void 0,
|
|
1756
1845
|
value: "",
|
|
1757
1846
|
values: [],
|
|
@@ -1760,12 +1849,12 @@ var MenuListContext = (0, import_react14.createContext)({
|
|
|
1760
1849
|
});
|
|
1761
1850
|
|
|
1762
1851
|
// src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx
|
|
1763
|
-
var
|
|
1852
|
+
var React11 = __toESM(require("react"));
|
|
1764
1853
|
function getValuesRecursive(children, values = []) {
|
|
1765
|
-
const childArray =
|
|
1854
|
+
const childArray = React11.Children.toArray(children);
|
|
1766
1855
|
for (let i = 0; i < childArray.length; i++) {
|
|
1767
1856
|
const child = childArray[i];
|
|
1768
|
-
if (
|
|
1857
|
+
if (React11.isValidElement(child)) {
|
|
1769
1858
|
const props = child.props;
|
|
1770
1859
|
if ("value" in props && typeof props.value === "string") {
|
|
1771
1860
|
const childValue = props.value;
|
|
@@ -1779,12 +1868,12 @@ function getValuesRecursive(children, values = []) {
|
|
|
1779
1868
|
}
|
|
1780
1869
|
|
|
1781
1870
|
// src/components/DropdownSelector/MenuList/index.tsx
|
|
1782
|
-
var
|
|
1871
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1783
1872
|
function MenuList(props) {
|
|
1784
|
-
const root = (0,
|
|
1873
|
+
const root = (0, import_react18.useRef)(null);
|
|
1785
1874
|
const values = [];
|
|
1786
1875
|
getValuesRecursive(props.children, values);
|
|
1787
|
-
return /* @__PURE__ */ (0,
|
|
1876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StyledUl, { ref: root, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1788
1877
|
MenuListContext.Provider,
|
|
1789
1878
|
{
|
|
1790
1879
|
value: {
|
|
@@ -1799,20 +1888,20 @@ function MenuList(props) {
|
|
|
1799
1888
|
}
|
|
1800
1889
|
) });
|
|
1801
1890
|
}
|
|
1802
|
-
var StyledUl =
|
|
1891
|
+
var StyledUl = import_styled_components17.default.ul`
|
|
1803
1892
|
padding: 0;
|
|
1804
1893
|
margin: 0;
|
|
1805
1894
|
`;
|
|
1806
1895
|
|
|
1807
1896
|
// src/components/DropdownSelector/index.tsx
|
|
1808
|
-
var
|
|
1897
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1809
1898
|
var defaultRequiredText = "*\u5FC5\u9808";
|
|
1810
1899
|
function DropdownSelector(props) {
|
|
1811
|
-
const triggerRef = (0,
|
|
1812
|
-
const [isOpen, setIsOpen] = (0,
|
|
1900
|
+
const triggerRef = (0, import_react19.useRef)(null);
|
|
1901
|
+
const [isOpen, setIsOpen] = (0, import_react19.useState)(false);
|
|
1813
1902
|
const preview = findPreviewRecursive(props.children, props.value);
|
|
1814
|
-
return /* @__PURE__ */ (0,
|
|
1815
|
-
props.showLabel === true && /* @__PURE__ */ (0,
|
|
1903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
|
|
1904
|
+
props.showLabel === true && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1816
1905
|
DropdownFieldLabel,
|
|
1817
1906
|
{
|
|
1818
1907
|
label: props.label,
|
|
@@ -1821,7 +1910,7 @@ function DropdownSelector(props) {
|
|
|
1821
1910
|
subLabel: props.subLabel
|
|
1822
1911
|
}
|
|
1823
1912
|
),
|
|
1824
|
-
/* @__PURE__ */ (0,
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1825
1914
|
DropdownButton,
|
|
1826
1915
|
{
|
|
1827
1916
|
invalid: props.invalid,
|
|
@@ -1834,19 +1923,19 @@ function DropdownSelector(props) {
|
|
|
1834
1923
|
ref: triggerRef,
|
|
1835
1924
|
type: "button",
|
|
1836
1925
|
children: [
|
|
1837
|
-
/* @__PURE__ */ (0,
|
|
1838
|
-
/* @__PURE__ */ (0,
|
|
1926
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownButtonText, { children: props.placeholder !== void 0 && preview === void 0 ? props.placeholder : preview }),
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownButtonIcon, { name: "16/Menu" })
|
|
1839
1928
|
]
|
|
1840
1929
|
}
|
|
1841
1930
|
),
|
|
1842
|
-
isOpen && /* @__PURE__ */ (0,
|
|
1931
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1843
1932
|
DropdownPopover,
|
|
1844
1933
|
{
|
|
1845
1934
|
isOpen,
|
|
1846
1935
|
onClose: () => setIsOpen(false),
|
|
1847
1936
|
triggerRef,
|
|
1848
1937
|
value: props.value,
|
|
1849
|
-
children: /* @__PURE__ */ (0,
|
|
1938
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1850
1939
|
MenuList,
|
|
1851
1940
|
{
|
|
1852
1941
|
value: props.value,
|
|
@@ -1859,24 +1948,24 @@ function DropdownSelector(props) {
|
|
|
1859
1948
|
)
|
|
1860
1949
|
}
|
|
1861
1950
|
),
|
|
1862
|
-
props.assistiveText !== void 0 && /* @__PURE__ */ (0,
|
|
1951
|
+
props.assistiveText !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
|
|
1863
1952
|
] });
|
|
1864
1953
|
}
|
|
1865
|
-
var DropdownSelectorRoot =
|
|
1954
|
+
var DropdownSelectorRoot = import_styled_components18.default.div`
|
|
1866
1955
|
display: inline-block;
|
|
1867
1956
|
width: 100%;
|
|
1868
1957
|
|
|
1869
|
-
${
|
|
1958
|
+
${import_utils10.disabledSelector} {
|
|
1870
1959
|
cursor: default;
|
|
1871
1960
|
${theme((o) => o.disabled)}
|
|
1872
1961
|
}
|
|
1873
1962
|
`;
|
|
1874
|
-
var DropdownFieldLabel = (0,
|
|
1963
|
+
var DropdownFieldLabel = (0, import_styled_components18.default)(FieldLabel_default)`
|
|
1875
1964
|
width: 100%;
|
|
1876
1965
|
|
|
1877
1966
|
${theme((o) => o.margin.bottom(8))}
|
|
1878
1967
|
`;
|
|
1879
|
-
var DropdownButton =
|
|
1968
|
+
var DropdownButton = import_styled_components18.default.button`
|
|
1880
1969
|
display: flex;
|
|
1881
1970
|
justify-content: space-between;
|
|
1882
1971
|
align-items: center;
|
|
@@ -1887,7 +1976,7 @@ var DropdownButton = import_styled_components17.default.button`
|
|
|
1887
1976
|
border: none;
|
|
1888
1977
|
cursor: pointer;
|
|
1889
1978
|
|
|
1890
|
-
${
|
|
1979
|
+
${import_utils10.disabledSelector} {
|
|
1891
1980
|
cursor: default;
|
|
1892
1981
|
}
|
|
1893
1982
|
|
|
@@ -1899,15 +1988,15 @@ var DropdownButton = import_styled_components17.default.button`
|
|
|
1899
1988
|
invalid === true && o.outline.assertive
|
|
1900
1989
|
])}
|
|
1901
1990
|
`;
|
|
1902
|
-
var DropdownButtonText =
|
|
1991
|
+
var DropdownButtonText = import_styled_components18.default.span`
|
|
1903
1992
|
text-align: left;
|
|
1904
1993
|
|
|
1905
1994
|
${theme((o) => [o.typography(14), o.font.text2])}
|
|
1906
1995
|
`;
|
|
1907
|
-
var DropdownButtonIcon = (0,
|
|
1996
|
+
var DropdownButtonIcon = (0, import_styled_components18.default)(Icon_default)`
|
|
1908
1997
|
${theme((o) => [o.font.text2])}
|
|
1909
1998
|
`;
|
|
1910
|
-
var AssertiveText =
|
|
1999
|
+
var AssertiveText = import_styled_components18.default.div`
|
|
1911
2000
|
${({ invalid }) => theme((o) => [
|
|
1912
2001
|
o.typography(14),
|
|
1913
2002
|
o.margin.top(8),
|
|
@@ -1916,19 +2005,19 @@ var AssertiveText = import_styled_components17.default.div`
|
|
|
1916
2005
|
`;
|
|
1917
2006
|
|
|
1918
2007
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
1919
|
-
var
|
|
2008
|
+
var import_styled_components20 = __toESM(require("styled-components"));
|
|
1920
2009
|
|
|
1921
2010
|
// src/components/DropdownSelector/ListItem/index.tsx
|
|
1922
|
-
var
|
|
1923
|
-
var
|
|
2011
|
+
var import_styled_components19 = __toESM(require("styled-components"));
|
|
2012
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1924
2013
|
function ListItem(props) {
|
|
1925
2014
|
const { children, ...rest } = props;
|
|
1926
|
-
return /* @__PURE__ */ (0,
|
|
2015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyledLi, { role: "option", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemDiv, { ...rest, children: props.children }) });
|
|
1927
2016
|
}
|
|
1928
|
-
var StyledLi =
|
|
2017
|
+
var StyledLi = import_styled_components19.default.li`
|
|
1929
2018
|
list-style: none;
|
|
1930
2019
|
`;
|
|
1931
|
-
var ItemDiv =
|
|
2020
|
+
var ItemDiv = import_styled_components19.default.div`
|
|
1932
2021
|
display: flex;
|
|
1933
2022
|
align-items: center;
|
|
1934
2023
|
min-height: 40px;
|
|
@@ -1949,7 +2038,7 @@ var ItemDiv = import_styled_components18.default.div`
|
|
|
1949
2038
|
`;
|
|
1950
2039
|
|
|
1951
2040
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
1952
|
-
var
|
|
2041
|
+
var import_react20 = require("react");
|
|
1953
2042
|
|
|
1954
2043
|
// src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
|
|
1955
2044
|
function handleFocusByKeyBoard(element, parent) {
|
|
@@ -1982,12 +2071,12 @@ function scrollIfNeeded(element) {
|
|
|
1982
2071
|
|
|
1983
2072
|
// src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
|
|
1984
2073
|
function useMenuItemHandleKeyDown(value) {
|
|
1985
|
-
const { setValue, root, values } = (0,
|
|
1986
|
-
const setContextValue = (0,
|
|
2074
|
+
const { setValue, root, values } = (0, import_react20.useContext)(MenuListContext);
|
|
2075
|
+
const setContextValue = (0, import_react20.useCallback)(() => {
|
|
1987
2076
|
if (value !== void 0)
|
|
1988
2077
|
setValue(value);
|
|
1989
2078
|
}, [value, setValue]);
|
|
1990
|
-
const handleKeyDown = (0,
|
|
2079
|
+
const handleKeyDown = (0, import_react20.useCallback)(
|
|
1991
2080
|
(e) => {
|
|
1992
2081
|
if (e.key === "Enter") {
|
|
1993
2082
|
setContextValue();
|
|
@@ -2014,11 +2103,11 @@ function useMenuItemHandleKeyDown(value) {
|
|
|
2014
2103
|
}
|
|
2015
2104
|
|
|
2016
2105
|
// src/components/DropdownSelector/MenuItem/index.tsx
|
|
2017
|
-
var
|
|
2106
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2018
2107
|
function MenuItem(props) {
|
|
2019
2108
|
const { children, as, ...rest } = props;
|
|
2020
2109
|
const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(props.value);
|
|
2021
|
-
return /* @__PURE__ */ (0,
|
|
2110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2022
2111
|
ListItem,
|
|
2023
2112
|
{
|
|
2024
2113
|
...rest,
|
|
@@ -2034,85 +2123,85 @@ function MenuItem(props) {
|
|
|
2034
2123
|
}
|
|
2035
2124
|
|
|
2036
2125
|
// src/components/DropdownSelector/DropdownMenuItem.tsx
|
|
2037
|
-
var
|
|
2038
|
-
var
|
|
2126
|
+
var import_react21 = require("react");
|
|
2127
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2039
2128
|
function DropdownMenuItem(props) {
|
|
2040
|
-
const { value: ctxValue } = (0,
|
|
2129
|
+
const { value: ctxValue } = (0, import_react21.useContext)(MenuListContext);
|
|
2041
2130
|
const isSelected = props.value === ctxValue;
|
|
2042
2131
|
const { children, ...rest } = props;
|
|
2043
|
-
return /* @__PURE__ */ (0,
|
|
2044
|
-
isSelected && /* @__PURE__ */ (0,
|
|
2045
|
-
/* @__PURE__ */ (0,
|
|
2132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(MenuItem, { ...rest, children: [
|
|
2133
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text2ColorIcon, { name: "16/Check" }),
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StyledSpan, { isSelected, children: props.children })
|
|
2046
2135
|
] });
|
|
2047
2136
|
}
|
|
2048
|
-
var StyledSpan =
|
|
2137
|
+
var StyledSpan = import_styled_components20.default.span`
|
|
2049
2138
|
${theme((o) => [o.typography(14), o.font.text2])};
|
|
2050
2139
|
display: flex;
|
|
2051
2140
|
align-items: center;
|
|
2052
2141
|
width: 100%;
|
|
2053
2142
|
margin-left: ${({ isSelected }) => isSelected === true ? 0 : 20}px;
|
|
2054
2143
|
`;
|
|
2055
|
-
var Text2ColorIcon = (0,
|
|
2144
|
+
var Text2ColorIcon = (0, import_styled_components20.default)(Icon_default)`
|
|
2056
2145
|
${theme((o) => [o.font.text2])}
|
|
2057
2146
|
padding-right: 4px;
|
|
2058
2147
|
`;
|
|
2059
2148
|
|
|
2060
2149
|
// src/components/DropdownSelector/MenuItemGroup/index.tsx
|
|
2061
|
-
var
|
|
2062
|
-
var
|
|
2150
|
+
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2151
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2063
2152
|
function MenuItemGroup(props) {
|
|
2064
|
-
return /* @__PURE__ */ (0,
|
|
2065
|
-
/* @__PURE__ */ (0,
|
|
2066
|
-
/* @__PURE__ */ (0,
|
|
2153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(StyledLi2, { role: "presentation", children: [
|
|
2154
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextSpan, { children: props.text }),
|
|
2155
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledUl2, { role: "group", children: props.children })
|
|
2067
2156
|
] });
|
|
2068
2157
|
}
|
|
2069
|
-
var TextSpan =
|
|
2158
|
+
var TextSpan = import_styled_components21.default.span`
|
|
2070
2159
|
display: block;
|
|
2071
2160
|
color: ${({ theme: theme3 }) => theme3.color.text3};
|
|
2072
2161
|
font-size: 12px;
|
|
2073
2162
|
font-weight: bold;
|
|
2074
2163
|
padding: 12px 0 8px 16px;
|
|
2075
2164
|
`;
|
|
2076
|
-
var StyledUl2 =
|
|
2165
|
+
var StyledUl2 = import_styled_components21.default.ul`
|
|
2077
2166
|
padding-left: 0;
|
|
2078
2167
|
margin: 0;
|
|
2079
2168
|
box-sizing: border-box;
|
|
2080
2169
|
list-style: none;
|
|
2081
2170
|
overflow: hidden;
|
|
2082
2171
|
`;
|
|
2083
|
-
var StyledLi2 =
|
|
2172
|
+
var StyledLi2 = import_styled_components21.default.li`
|
|
2084
2173
|
display: block;
|
|
2085
2174
|
`;
|
|
2086
2175
|
|
|
2087
2176
|
// src/components/SegmentedControl/index.tsx
|
|
2088
|
-
var
|
|
2177
|
+
var import_react23 = require("react");
|
|
2089
2178
|
var import_react_stately2 = require("react-stately");
|
|
2090
2179
|
var import_radio = require("@react-aria/radio");
|
|
2091
|
-
var
|
|
2092
|
-
var
|
|
2180
|
+
var import_styled_components22 = __toESM(require("styled-components"));
|
|
2181
|
+
var import_utils11 = require("@charcoal-ui/utils");
|
|
2093
2182
|
|
|
2094
2183
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
2095
|
-
var
|
|
2096
|
-
var
|
|
2097
|
-
var RadioContext = (0,
|
|
2184
|
+
var import_react22 = require("react");
|
|
2185
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2186
|
+
var RadioContext = (0, import_react22.createContext)(null);
|
|
2098
2187
|
var RadioProvider = ({
|
|
2099
2188
|
value,
|
|
2100
2189
|
children
|
|
2101
2190
|
}) => {
|
|
2102
|
-
return /* @__PURE__ */ (0,
|
|
2191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RadioContext.Provider, { value, children });
|
|
2103
2192
|
};
|
|
2104
2193
|
var useRadioContext = () => {
|
|
2105
|
-
const state = (0,
|
|
2194
|
+
const state = (0, import_react22.useContext)(RadioContext);
|
|
2106
2195
|
if (state === null)
|
|
2107
2196
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
2108
2197
|
return state;
|
|
2109
2198
|
};
|
|
2110
2199
|
|
|
2111
2200
|
// src/components/SegmentedControl/index.tsx
|
|
2112
|
-
var
|
|
2113
|
-
var SegmentedControl = (0,
|
|
2201
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2202
|
+
var SegmentedControl = (0, import_react23.forwardRef)(
|
|
2114
2203
|
function SegmentedControlInner(props, ref) {
|
|
2115
|
-
const ariaRadioGroupProps = (0,
|
|
2204
|
+
const ariaRadioGroupProps = (0, import_react23.useMemo)(
|
|
2116
2205
|
() => ({
|
|
2117
2206
|
...props,
|
|
2118
2207
|
isDisabled: props.disabled,
|
|
@@ -2124,18 +2213,18 @@ var SegmentedControl = (0, import_react20.forwardRef)(
|
|
|
2124
2213
|
);
|
|
2125
2214
|
const state = (0, import_react_stately2.useRadioGroupState)(ariaRadioGroupProps);
|
|
2126
2215
|
const { radioGroupProps } = (0, import_radio.useRadioGroup)(ariaRadioGroupProps, state);
|
|
2127
|
-
const segmentedControlItems = (0,
|
|
2216
|
+
const segmentedControlItems = (0, import_react23.useMemo)(() => {
|
|
2128
2217
|
return props.data.map(
|
|
2129
2218
|
(d) => typeof d === "string" ? { value: d, label: d } : d
|
|
2130
2219
|
);
|
|
2131
2220
|
}, [props.data]);
|
|
2132
|
-
return /* @__PURE__ */ (0,
|
|
2221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2133
2222
|
SegmentedControlRoot,
|
|
2134
2223
|
{
|
|
2135
2224
|
ref,
|
|
2136
2225
|
...radioGroupProps,
|
|
2137
2226
|
className: props.className,
|
|
2138
|
-
children: /* @__PURE__ */ (0,
|
|
2227
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2139
2228
|
Segmented,
|
|
2140
2229
|
{
|
|
2141
2230
|
value: item.value,
|
|
@@ -2148,11 +2237,11 @@ var SegmentedControl = (0, import_react20.forwardRef)(
|
|
|
2148
2237
|
);
|
|
2149
2238
|
}
|
|
2150
2239
|
);
|
|
2151
|
-
var SegmentedControl_default = (0,
|
|
2240
|
+
var SegmentedControl_default = (0, import_react23.memo)(SegmentedControl);
|
|
2152
2241
|
var Segmented = (props) => {
|
|
2153
2242
|
const state = useRadioContext();
|
|
2154
|
-
const ref = (0,
|
|
2155
|
-
const ariaRadioProps = (0,
|
|
2243
|
+
const ref = (0, import_react23.useRef)(null);
|
|
2244
|
+
const ariaRadioProps = (0, import_react23.useMemo)(
|
|
2156
2245
|
() => ({
|
|
2157
2246
|
value: props.value,
|
|
2158
2247
|
isDisabled: props.disabled,
|
|
@@ -2165,32 +2254,32 @@ var Segmented = (props) => {
|
|
|
2165
2254
|
state,
|
|
2166
2255
|
ref
|
|
2167
2256
|
);
|
|
2168
|
-
return /* @__PURE__ */ (0,
|
|
2257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2169
2258
|
SegmentedRoot,
|
|
2170
2259
|
{
|
|
2171
2260
|
"aria-disabled": isDisabled || state.isReadOnly,
|
|
2172
2261
|
checked: isSelected,
|
|
2173
2262
|
children: [
|
|
2174
|
-
/* @__PURE__ */ (0,
|
|
2175
|
-
/* @__PURE__ */ (0,
|
|
2263
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SegmentedInput, { ...inputProps, ref }),
|
|
2264
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RadioLabel2, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SegmentedLabelInner, { children: props.children }) })
|
|
2176
2265
|
]
|
|
2177
2266
|
}
|
|
2178
2267
|
);
|
|
2179
2268
|
};
|
|
2180
|
-
var SegmentedControlRoot =
|
|
2269
|
+
var SegmentedControlRoot = import_styled_components22.default.div`
|
|
2181
2270
|
display: inline-flex;
|
|
2182
2271
|
align-items: center;
|
|
2183
2272
|
|
|
2184
2273
|
${theme((o) => [o.bg.surface3, o.borderRadius(16)])}
|
|
2185
2274
|
`;
|
|
2186
|
-
var SegmentedRoot =
|
|
2275
|
+
var SegmentedRoot = import_styled_components22.default.label`
|
|
2187
2276
|
position: relative;
|
|
2188
2277
|
display: flex;
|
|
2189
2278
|
align-items: center;
|
|
2190
2279
|
cursor: pointer;
|
|
2191
2280
|
height: 32px;
|
|
2192
2281
|
|
|
2193
|
-
${
|
|
2282
|
+
${import_utils11.disabledSelector} {
|
|
2194
2283
|
cursor: default;
|
|
2195
2284
|
}
|
|
2196
2285
|
|
|
@@ -2202,7 +2291,7 @@ var SegmentedRoot = import_styled_components21.default.label`
|
|
|
2202
2291
|
checked === true ? o.font.text5 : o.font.text2
|
|
2203
2292
|
])}
|
|
2204
2293
|
`;
|
|
2205
|
-
var SegmentedInput =
|
|
2294
|
+
var SegmentedInput = import_styled_components22.default.input`
|
|
2206
2295
|
position: absolute;
|
|
2207
2296
|
|
|
2208
2297
|
height: 0px;
|
|
@@ -2216,69 +2305,70 @@ var SegmentedInput = import_styled_components21.default.input`
|
|
|
2216
2305
|
white-space: nowrap;
|
|
2217
2306
|
opacity: 0;
|
|
2218
2307
|
`;
|
|
2219
|
-
var RadioLabel2 =
|
|
2308
|
+
var RadioLabel2 = import_styled_components22.default.div`
|
|
2220
2309
|
background: transparent;
|
|
2221
2310
|
display: flex;
|
|
2222
2311
|
align-items: center;
|
|
2223
2312
|
height: 22px;
|
|
2224
2313
|
`;
|
|
2225
|
-
var SegmentedLabelInner =
|
|
2314
|
+
var SegmentedLabelInner = import_styled_components22.default.div`
|
|
2226
2315
|
${theme((o) => [o.typography(14)])}
|
|
2227
2316
|
`;
|
|
2228
2317
|
|
|
2229
2318
|
// src/components/Checkbox/index.tsx
|
|
2230
|
-
var
|
|
2231
|
-
var
|
|
2319
|
+
var import_react24 = require("react");
|
|
2320
|
+
var import_styled_components23 = __toESM(require("styled-components"));
|
|
2232
2321
|
var import_checkbox = require("@react-aria/checkbox");
|
|
2233
|
-
var
|
|
2322
|
+
var import_utils12 = require("@react-aria/utils");
|
|
2234
2323
|
var import_react_stately3 = require("react-stately");
|
|
2235
|
-
var
|
|
2236
|
-
var
|
|
2237
|
-
var Checkbox = (0,
|
|
2238
|
-
function CheckboxInner(props, ref) {
|
|
2239
|
-
const ariaCheckboxProps = (0,
|
|
2324
|
+
var import_utils13 = require("@charcoal-ui/utils");
|
|
2325
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2326
|
+
var Checkbox = (0, import_react24.forwardRef)(
|
|
2327
|
+
function CheckboxInner({ invalid = false, ...props }, ref) {
|
|
2328
|
+
const ariaCheckboxProps = (0, import_react24.useMemo)(
|
|
2240
2329
|
() => ({
|
|
2241
2330
|
...props,
|
|
2242
2331
|
isSelected: props.checked,
|
|
2243
2332
|
defaultSelected: props.defaultChecked,
|
|
2333
|
+
validationState: invalid ? "invalid" : "valid",
|
|
2244
2334
|
"aria-label": "children" in props ? void 0 : props.label,
|
|
2245
2335
|
isDisabled: props.disabled
|
|
2246
2336
|
}),
|
|
2247
|
-
[props]
|
|
2337
|
+
[invalid, props]
|
|
2248
2338
|
);
|
|
2249
2339
|
const state = (0, import_react_stately3.useToggleState)(ariaCheckboxProps);
|
|
2250
|
-
const objectRef = (0,
|
|
2340
|
+
const objectRef = (0, import_utils12.useObjectRef)(ref);
|
|
2251
2341
|
const { inputProps } = (0, import_checkbox.useCheckbox)(ariaCheckboxProps, state, objectRef);
|
|
2252
2342
|
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
2253
|
-
return /* @__PURE__ */ (0,
|
|
2254
|
-
/* @__PURE__ */ (0,
|
|
2255
|
-
/* @__PURE__ */ (0,
|
|
2256
|
-
/* @__PURE__ */ (0,
|
|
2343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
|
|
2344
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CheckboxRoot, { children: [
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxInput, { type: "checkbox", ...inputProps, invalid }),
|
|
2346
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
|
|
2257
2347
|
] }),
|
|
2258
|
-
"children" in props && /* @__PURE__ */ (0,
|
|
2348
|
+
"children" in props && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(InputLabel, { children: props.children })
|
|
2259
2349
|
] });
|
|
2260
2350
|
}
|
|
2261
2351
|
);
|
|
2262
|
-
var Checkbox_default = (0,
|
|
2263
|
-
var hiddenCss =
|
|
2352
|
+
var Checkbox_default = (0, import_react24.memo)(Checkbox);
|
|
2353
|
+
var hiddenCss = import_styled_components23.css`
|
|
2264
2354
|
visibility: hidden;
|
|
2265
2355
|
`;
|
|
2266
|
-
var InputRoot =
|
|
2356
|
+
var InputRoot = import_styled_components23.default.label`
|
|
2267
2357
|
position: relative;
|
|
2268
2358
|
display: flex;
|
|
2269
2359
|
|
|
2270
2360
|
cursor: pointer;
|
|
2271
|
-
${
|
|
2361
|
+
${import_utils13.disabledSelector} {
|
|
2272
2362
|
cursor: default;
|
|
2273
2363
|
}
|
|
2274
2364
|
|
|
2275
|
-
gap: ${({ theme: theme3 }) => (0,
|
|
2365
|
+
gap: ${({ theme: theme3 }) => (0, import_utils13.px)(theme3.spacing[4])};
|
|
2276
2366
|
${theme((o) => [o.disabled])}
|
|
2277
2367
|
`;
|
|
2278
|
-
var CheckboxRoot =
|
|
2368
|
+
var CheckboxRoot = import_styled_components23.default.div`
|
|
2279
2369
|
position: relative;
|
|
2280
2370
|
`;
|
|
2281
|
-
var CheckboxInput =
|
|
2371
|
+
var CheckboxInput = import_styled_components23.default.input`
|
|
2282
2372
|
&[type='checkbox'] {
|
|
2283
2373
|
appearance: none;
|
|
2284
2374
|
display: block;
|
|
@@ -2296,12 +2386,13 @@ var CheckboxInput = import_styled_components22.default.input`
|
|
|
2296
2386
|
border-color: ${({ theme: theme3 }) => theme3.color.text4};
|
|
2297
2387
|
}
|
|
2298
2388
|
${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
|
|
2389
|
+
${(p) => p.invalid && theme((o) => [o.outline.assertive])}
|
|
2299
2390
|
|
|
2300
2391
|
/* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
|
|
2301
2392
|
transition: all 0.2s !important;
|
|
2302
2393
|
}
|
|
2303
2394
|
`;
|
|
2304
|
-
var CheckboxInputOverlay =
|
|
2395
|
+
var CheckboxInputOverlay = import_styled_components23.default.div`
|
|
2305
2396
|
position: absolute;
|
|
2306
2397
|
top: -2px;
|
|
2307
2398
|
left: -2px;
|
|
@@ -2314,7 +2405,7 @@ var CheckboxInputOverlay = import_styled_components22.default.div`
|
|
|
2314
2405
|
|
|
2315
2406
|
${({ checked }) => checked !== true && hiddenCss};
|
|
2316
2407
|
`;
|
|
2317
|
-
var InputLabel =
|
|
2408
|
+
var InputLabel = import_styled_components23.default.div`
|
|
2318
2409
|
${theme((o) => [o.font.text2])}
|
|
2319
2410
|
|
|
2320
2411
|
font-size: 14px;
|
|
@@ -2323,17 +2414,17 @@ var InputLabel = import_styled_components22.default.div`
|
|
|
2323
2414
|
`;
|
|
2324
2415
|
|
|
2325
2416
|
// src/components/TagItem/index.tsx
|
|
2326
|
-
var
|
|
2327
|
-
var
|
|
2328
|
-
var
|
|
2329
|
-
var
|
|
2417
|
+
var import_react25 = require("react");
|
|
2418
|
+
var import_utils14 = require("@react-aria/utils");
|
|
2419
|
+
var import_styled_components24 = __toESM(require("styled-components"));
|
|
2420
|
+
var import_utils15 = require("@charcoal-ui/utils");
|
|
2330
2421
|
var import_button = require("@react-aria/button");
|
|
2331
|
-
var
|
|
2422
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2332
2423
|
var sizeMap = {
|
|
2333
2424
|
S: 32,
|
|
2334
2425
|
M: 40
|
|
2335
2426
|
};
|
|
2336
|
-
var TagItem = (0,
|
|
2427
|
+
var TagItem = (0, import_react25.forwardRef)(
|
|
2337
2428
|
function TagItemInner({
|
|
2338
2429
|
label,
|
|
2339
2430
|
translatedLabel,
|
|
@@ -2345,8 +2436,8 @@ var TagItem = (0, import_react22.forwardRef)(
|
|
|
2345
2436
|
className,
|
|
2346
2437
|
...props
|
|
2347
2438
|
}, _ref) {
|
|
2348
|
-
const ref = (0,
|
|
2349
|
-
const ariaButtonProps = (0,
|
|
2439
|
+
const ref = (0, import_utils14.useObjectRef)(_ref);
|
|
2440
|
+
const ariaButtonProps = (0, import_react25.useMemo)(
|
|
2350
2441
|
() => ({
|
|
2351
2442
|
elementType: "a",
|
|
2352
2443
|
isDisabled: disabled,
|
|
@@ -2356,7 +2447,7 @@ var TagItem = (0, import_react22.forwardRef)(
|
|
|
2356
2447
|
);
|
|
2357
2448
|
const { buttonProps } = (0, import_button.useButton)(ariaButtonProps, ref);
|
|
2358
2449
|
const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
|
|
2359
|
-
return /* @__PURE__ */ (0,
|
|
2450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2360
2451
|
TagItemRoot,
|
|
2361
2452
|
{
|
|
2362
2453
|
ref,
|
|
@@ -2365,21 +2456,21 @@ var TagItem = (0, import_react22.forwardRef)(
|
|
|
2365
2456
|
...buttonProps,
|
|
2366
2457
|
className,
|
|
2367
2458
|
children: [
|
|
2368
|
-
/* @__PURE__ */ (0,
|
|
2369
|
-
/* @__PURE__ */ (0,
|
|
2370
|
-
/* @__PURE__ */ (0,
|
|
2371
|
-
hasTranslatedLabel && /* @__PURE__ */ (0,
|
|
2372
|
-
/* @__PURE__ */ (0,
|
|
2459
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Background, { bgColor, bgImage, status }),
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Inner, { children: [
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(LabelWrapper, { isTranslate: hasTranslatedLabel, children: [
|
|
2462
|
+
hasTranslatedLabel && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TranslatedLabel, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Label3, { children: translatedLabel }) }),
|
|
2463
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Label3, { children: label })
|
|
2373
2464
|
] }),
|
|
2374
|
-
status === "active" && /* @__PURE__ */ (0,
|
|
2465
|
+
status === "active" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: "16/Remove" })
|
|
2375
2466
|
] })
|
|
2376
2467
|
]
|
|
2377
2468
|
}
|
|
2378
2469
|
);
|
|
2379
2470
|
}
|
|
2380
2471
|
);
|
|
2381
|
-
var TagItem_default = (0,
|
|
2382
|
-
var TagItemRoot =
|
|
2472
|
+
var TagItem_default = (0, import_react25.memo)(TagItem);
|
|
2473
|
+
var TagItemRoot = import_styled_components24.default.a`
|
|
2383
2474
|
isolation: isolate;
|
|
2384
2475
|
position: relative;
|
|
2385
2476
|
height: ${({ size }) => sizeMap[size]}px;
|
|
@@ -2399,12 +2490,12 @@ var TagItemRoot = import_styled_components23.default.a`
|
|
|
2399
2490
|
...status === "active" ? [o.padding.left(16), o.padding.right(8)] : []
|
|
2400
2491
|
])}
|
|
2401
2492
|
|
|
2402
|
-
${
|
|
2493
|
+
${import_utils15.disabledSelector} {
|
|
2403
2494
|
${theme((o) => [o.disabled])}
|
|
2404
2495
|
cursor: default;
|
|
2405
2496
|
}
|
|
2406
2497
|
`;
|
|
2407
|
-
var Background =
|
|
2498
|
+
var Background = import_styled_components24.default.div`
|
|
2408
2499
|
position: absolute;
|
|
2409
2500
|
z-index: 1;
|
|
2410
2501
|
top: 0;
|
|
@@ -2415,7 +2506,7 @@ var Background = import_styled_components23.default.div`
|
|
|
2415
2506
|
background-color: ${({ bgColor }) => bgColor};
|
|
2416
2507
|
${({ status }) => status === "inactive" && theme((o) => o.bg.surface3)}
|
|
2417
2508
|
|
|
2418
|
-
${({ bgImage }) => bgImage !== void 0 &&
|
|
2509
|
+
${({ bgImage }) => bgImage !== void 0 && import_styled_components24.css`
|
|
2419
2510
|
${theme((o) => [o.bg.surface4])}
|
|
2420
2511
|
&::before {
|
|
2421
2512
|
content: '';
|
|
@@ -2431,25 +2522,25 @@ var Background = import_styled_components23.default.div`
|
|
|
2431
2522
|
}
|
|
2432
2523
|
`}
|
|
2433
2524
|
`;
|
|
2434
|
-
var Inner =
|
|
2525
|
+
var Inner = import_styled_components24.default.div`
|
|
2435
2526
|
display: inline-flex;
|
|
2436
|
-
gap: ${({ theme: theme3 }) => (0,
|
|
2527
|
+
gap: ${({ theme: theme3 }) => (0, import_utils15.px)(theme3.spacing[8])};
|
|
2437
2528
|
align-items: center;
|
|
2438
2529
|
z-index: 2;
|
|
2439
2530
|
`;
|
|
2440
|
-
var labelCSS =
|
|
2531
|
+
var labelCSS = import_styled_components24.css`
|
|
2441
2532
|
${theme((o) => [o.typography(14).bold])}
|
|
2442
2533
|
`;
|
|
2443
|
-
var translateLabelCSS =
|
|
2534
|
+
var translateLabelCSS = import_styled_components24.css`
|
|
2444
2535
|
display: flex;
|
|
2445
2536
|
align-items: center;
|
|
2446
2537
|
flex-direction: column;
|
|
2447
2538
|
font-size: 10px;
|
|
2448
2539
|
`;
|
|
2449
|
-
var LabelWrapper =
|
|
2540
|
+
var LabelWrapper = import_styled_components24.default.div`
|
|
2450
2541
|
${({ isTranslate }) => isTranslate ?? false ? translateLabelCSS : labelCSS}
|
|
2451
2542
|
`;
|
|
2452
|
-
var Label3 =
|
|
2543
|
+
var Label3 = import_styled_components24.default.span`
|
|
2453
2544
|
max-width: 152px;
|
|
2454
2545
|
overflow: hidden;
|
|
2455
2546
|
text-overflow: ellipsis;
|
|
@@ -2458,7 +2549,7 @@ var Label3 = import_styled_components23.default.span`
|
|
|
2458
2549
|
color: inherit;
|
|
2459
2550
|
line-height: inherit;
|
|
2460
2551
|
`;
|
|
2461
|
-
var TranslatedLabel =
|
|
2552
|
+
var TranslatedLabel = import_styled_components24.default.div`
|
|
2462
2553
|
${theme((o) => [o.typography(12).bold])}
|
|
2463
2554
|
`;
|
|
2464
2555
|
// Annotate the CommonJS export names for ESM import in node:
|