@dragunio/fe-libs 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -3
- package/dist/{chunk-3TCR34LS.mjs → chunk-NDMLXSI5.mjs} +13 -0
- package/dist/icons.d.mts +2 -1
- package/dist/icons.d.ts +2 -1
- package/dist/icons.js +14 -0
- package/dist/icons.mjs +3 -1
- package/dist/index.d.mts +98 -5
- package/dist/index.d.ts +98 -5
- package/dist/index.js +410 -99
- package/dist/index.mjs +414 -103
- package/dist/styles.css +238 -30
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,7 +21,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Button: () => Button,
|
|
24
|
+
Checkbox: () => Checkbox,
|
|
24
25
|
ChevronDownIcon: () => ChevronDownIcon,
|
|
26
|
+
ChevronUpIcon: () => ChevronUpIcon,
|
|
25
27
|
Chip: () => Chip,
|
|
26
28
|
CloseIcon: () => CloseIcon,
|
|
27
29
|
CurrencyInput: () => CurrencyInput,
|
|
@@ -35,6 +37,8 @@ __export(index_exports, {
|
|
|
35
37
|
Pagination: () => Pagination,
|
|
36
38
|
PlusIcon: () => PlusIcon,
|
|
37
39
|
ProgressBar: () => ProgressBar,
|
|
40
|
+
RadioButton: () => RadioButton,
|
|
41
|
+
RadioGroup: () => RadioGroup,
|
|
38
42
|
SearchIcon: () => SearchIcon,
|
|
39
43
|
Selection: () => Selection,
|
|
40
44
|
Skeleton: () => Skeleton,
|
|
@@ -263,6 +267,18 @@ function ChevronDownIcon(props) {
|
|
|
263
267
|
}
|
|
264
268
|
) });
|
|
265
269
|
}
|
|
270
|
+
function ChevronUpIcon(props) {
|
|
271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { ...iconProps4(props), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
272
|
+
"path",
|
|
273
|
+
{
|
|
274
|
+
d: "m6 15 6-6 6 6",
|
|
275
|
+
stroke: "currentColor",
|
|
276
|
+
strokeWidth: "2",
|
|
277
|
+
strokeLinecap: "round",
|
|
278
|
+
strokeLinejoin: "round"
|
|
279
|
+
}
|
|
280
|
+
) });
|
|
281
|
+
}
|
|
266
282
|
function CloseIcon(props) {
|
|
267
283
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { ...iconProps4(props), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
268
284
|
"path",
|
|
@@ -533,16 +549,35 @@ function TableCaption(props) {
|
|
|
533
549
|
// packages/toggle/src/index.tsx
|
|
534
550
|
var import_react4 = require("react");
|
|
535
551
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
536
|
-
var Toggle = (0, import_react4.forwardRef)(function Toggle2({
|
|
537
|
-
|
|
552
|
+
var Toggle = (0, import_react4.forwardRef)(function Toggle2({
|
|
553
|
+
color = "#16a34a",
|
|
554
|
+
label,
|
|
555
|
+
labelPosition = "right",
|
|
556
|
+
className,
|
|
557
|
+
style,
|
|
558
|
+
id,
|
|
559
|
+
...props
|
|
560
|
+
}, ref) {
|
|
561
|
+
const classes = ["fe-toggle", `fe-toggle--label-${labelPosition}`, className].filter(Boolean).join(" ");
|
|
538
562
|
const toggleStyle = {
|
|
539
563
|
"--fe-toggle-color": color,
|
|
540
564
|
...style
|
|
541
565
|
};
|
|
542
566
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: classes, style: toggleStyle, children: [
|
|
543
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("
|
|
567
|
+
label && labelPosition === "top" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "fe-toggle__label", children: label }),
|
|
568
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
569
|
+
"input",
|
|
570
|
+
{
|
|
571
|
+
ref,
|
|
572
|
+
id,
|
|
573
|
+
className: "fe-toggle__input",
|
|
574
|
+
type: "checkbox",
|
|
575
|
+
role: "switch",
|
|
576
|
+
...props
|
|
577
|
+
}
|
|
578
|
+
),
|
|
544
579
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "fe-toggle__control", "aria-hidden": "true" }),
|
|
545
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "fe-toggle__label", children: label })
|
|
580
|
+
label && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "fe-toggle__label", children: label })
|
|
546
581
|
] });
|
|
547
582
|
});
|
|
548
583
|
Toggle.displayName = "Toggle";
|
|
@@ -808,6 +843,7 @@ var TextArea = (0, import_react8.forwardRef)(
|
|
|
808
843
|
helperText,
|
|
809
844
|
error,
|
|
810
845
|
errorMessage,
|
|
846
|
+
autosize = false,
|
|
811
847
|
clearable = false,
|
|
812
848
|
onClear,
|
|
813
849
|
clearLabel = "Clear text area",
|
|
@@ -828,6 +864,7 @@ var TextArea = (0, import_react8.forwardRef)(
|
|
|
828
864
|
const messageId2 = generatedId + "-message";
|
|
829
865
|
const controlled = value !== void 0;
|
|
830
866
|
const [internalValue, setInternalValue] = (0, import_react8.useState)(defaultValue);
|
|
867
|
+
const textareaRef = (0, import_react8.useRef)(null);
|
|
831
868
|
const currentValue = controlled ? value : internalValue;
|
|
832
869
|
const fieldError = getFieldError(error, errorMessage);
|
|
833
870
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
@@ -841,6 +878,16 @@ var TextArea = (0, import_react8.forwardRef)(
|
|
|
841
878
|
ariaLabelledBy,
|
|
842
879
|
label ? labelId : void 0
|
|
843
880
|
);
|
|
881
|
+
const resizeToContent = (textarea) => {
|
|
882
|
+
textarea.style.height = "auto";
|
|
883
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
884
|
+
};
|
|
885
|
+
(0, import_react8.useImperativeHandle)(ref, () => textareaRef.current, []);
|
|
886
|
+
(0, import_react8.useLayoutEffect)(() => {
|
|
887
|
+
if (autosize && textareaRef.current) {
|
|
888
|
+
resizeToContent(textareaRef.current);
|
|
889
|
+
}
|
|
890
|
+
}, [autosize, currentValue]);
|
|
844
891
|
const clear = () => {
|
|
845
892
|
if (!controlled) setInternalValue("");
|
|
846
893
|
onValueChange?.("");
|
|
@@ -852,6 +899,7 @@ var TextArea = (0, import_react8.forwardRef)(
|
|
|
852
899
|
className: [
|
|
853
900
|
"fe-text-area",
|
|
854
901
|
hasError && "fe-text-area--error",
|
|
902
|
+
autosize && "fe-text-area--autosize",
|
|
855
903
|
className
|
|
856
904
|
].filter(Boolean).join(" "),
|
|
857
905
|
children: [
|
|
@@ -869,7 +917,7 @@ var TextArea = (0, import_react8.forwardRef)(
|
|
|
869
917
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
870
918
|
"textarea",
|
|
871
919
|
{
|
|
872
|
-
ref,
|
|
920
|
+
ref: textareaRef,
|
|
873
921
|
id: inputId,
|
|
874
922
|
value: currentValue,
|
|
875
923
|
placeholder,
|
|
@@ -882,6 +930,7 @@ var TextArea = (0, import_react8.forwardRef)(
|
|
|
882
930
|
"aria-describedby": describedBy,
|
|
883
931
|
onChange: (event) => {
|
|
884
932
|
if (!controlled) setInternalValue(event.target.value);
|
|
933
|
+
if (autosize) resizeToContent(event.currentTarget);
|
|
885
934
|
onValueChange?.(event.target.value);
|
|
886
935
|
onChange?.(event);
|
|
887
936
|
},
|
|
@@ -1267,6 +1316,11 @@ function escapeRegExp(value) {
|
|
|
1267
1316
|
function groupInteger(value, separator) {
|
|
1268
1317
|
return value.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
1269
1318
|
}
|
|
1319
|
+
function roundToDecimals(value, decimals) {
|
|
1320
|
+
const precision = Math.min(Math.max(0, decimals), 15);
|
|
1321
|
+
const multiplier = 10 ** precision;
|
|
1322
|
+
return Math.round((value + Number.EPSILON) * multiplier) / multiplier;
|
|
1323
|
+
}
|
|
1270
1324
|
function normalizeNumberInput(raw, options) {
|
|
1271
1325
|
const { allowDecimal, decimalSeparator, thousandSeparator, min, max } = options;
|
|
1272
1326
|
const decimals = Math.max(0, options.decimals);
|
|
@@ -1329,10 +1383,20 @@ var NumberInput = (0, import_react10.forwardRef)(
|
|
|
1329
1383
|
placeholder,
|
|
1330
1384
|
required,
|
|
1331
1385
|
endAdornment,
|
|
1386
|
+
prefix,
|
|
1387
|
+
suffix,
|
|
1388
|
+
Prefix,
|
|
1389
|
+
Suffix,
|
|
1390
|
+
step = 1,
|
|
1391
|
+
showStepper = true,
|
|
1392
|
+
incrementLabel = "Increase value",
|
|
1393
|
+
decrementLabel = "Decrease value",
|
|
1332
1394
|
"aria-describedby": ariaDescribedBy,
|
|
1333
1395
|
"aria-labelledby": ariaLabelledBy,
|
|
1396
|
+
onKeyDown,
|
|
1334
1397
|
...props
|
|
1335
1398
|
}, ref) {
|
|
1399
|
+
const inputRef = (0, import_react10.useRef)(null);
|
|
1336
1400
|
const generatedId = (0, import_react10.useId)();
|
|
1337
1401
|
const messageId2 = generatedId + "-message";
|
|
1338
1402
|
const isControlled = value !== void 0;
|
|
@@ -1360,6 +1424,8 @@ var NumberInput = (0, import_react10.forwardRef)(
|
|
|
1360
1424
|
ariaLabelledBy,
|
|
1361
1425
|
label ? labelId : void 0
|
|
1362
1426
|
);
|
|
1427
|
+
const resolvedPrefix = prefix ?? Prefix;
|
|
1428
|
+
const resolvedSuffix = suffix ?? Suffix;
|
|
1363
1429
|
(0, import_react10.useEffect)(() => {
|
|
1364
1430
|
if (!focused)
|
|
1365
1431
|
setText(
|
|
@@ -1384,8 +1450,38 @@ var NumberInput = (0, import_react10.forwardRef)(
|
|
|
1384
1450
|
if (!isControlled) setInternalValue(next.value);
|
|
1385
1451
|
onValueChange?.(next.value);
|
|
1386
1452
|
};
|
|
1453
|
+
const setValue = (nextValue) => {
|
|
1454
|
+
const clamped = Math.min(
|
|
1455
|
+
max ?? Number.POSITIVE_INFINITY,
|
|
1456
|
+
Math.max(min ?? Number.NEGATIVE_INFINITY, nextValue)
|
|
1457
|
+
);
|
|
1458
|
+
const normalized = roundToDecimals(
|
|
1459
|
+
clamped,
|
|
1460
|
+
allowDecimal ? decimals : 0
|
|
1461
|
+
);
|
|
1462
|
+
setText(
|
|
1463
|
+
formatNumber(
|
|
1464
|
+
normalized,
|
|
1465
|
+
decimals,
|
|
1466
|
+
thousandSeparator,
|
|
1467
|
+
decimalSeparator
|
|
1468
|
+
)
|
|
1469
|
+
);
|
|
1470
|
+
if (!isControlled) setInternalValue(normalized);
|
|
1471
|
+
onValueChange?.(normalized);
|
|
1472
|
+
};
|
|
1473
|
+
const adjustValue = (direction) => {
|
|
1474
|
+
if (props.disabled || props.readOnly || !Number.isFinite(step) || step <= 0)
|
|
1475
|
+
return;
|
|
1476
|
+
const baseValue = actualValue ?? min ?? 0;
|
|
1477
|
+
setValue(baseValue + direction * step);
|
|
1478
|
+
inputRef.current?.focus();
|
|
1479
|
+
};
|
|
1480
|
+
const stepIsUsable = Number.isFinite(step) && step > 0;
|
|
1481
|
+
const disableIncrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || max !== void 0 && actualValue !== null && actualValue >= max;
|
|
1482
|
+
const disableDecrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || min !== void 0 && actualValue !== null && actualValue <= min;
|
|
1387
1483
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1388
|
-
"
|
|
1484
|
+
"div",
|
|
1389
1485
|
{
|
|
1390
1486
|
className: [
|
|
1391
1487
|
"fe-number-input",
|
|
@@ -1404,35 +1500,86 @@ var NumberInput = (0, import_react10.forwardRef)(
|
|
|
1404
1500
|
}
|
|
1405
1501
|
),
|
|
1406
1502
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "fe-number-input__control", children: [
|
|
1407
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1503
|
+
resolvedPrefix && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fe-number-input__prefix", children: resolvedPrefix }),
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "fe-number-input__input-wrap", children: [
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1506
|
+
"input",
|
|
1507
|
+
{
|
|
1508
|
+
ref: (node) => {
|
|
1509
|
+
inputRef.current = node;
|
|
1510
|
+
if (typeof ref === "function") ref(node);
|
|
1511
|
+
else if (ref) ref.current = node;
|
|
1512
|
+
},
|
|
1513
|
+
inputMode: allowDecimal ? "decimal" : "numeric",
|
|
1514
|
+
value: text,
|
|
1515
|
+
placeholder,
|
|
1516
|
+
required: isRequired || required,
|
|
1517
|
+
onFocus: (event) => {
|
|
1518
|
+
setFocused(true);
|
|
1519
|
+
onFocus?.(event);
|
|
1520
|
+
},
|
|
1521
|
+
onChange: (event) => updateValue(event.target.value),
|
|
1522
|
+
onBlur: (event) => {
|
|
1523
|
+
setFocused(false);
|
|
1524
|
+
onBlur?.(event);
|
|
1525
|
+
},
|
|
1526
|
+
onKeyDown: (event) => {
|
|
1527
|
+
onKeyDown?.(event);
|
|
1528
|
+
if (event.defaultPrevented) return;
|
|
1529
|
+
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
|
1530
|
+
event.preventDefault();
|
|
1531
|
+
adjustValue(event.key === "ArrowUp" ? 1 : -1);
|
|
1532
|
+
}
|
|
1533
|
+
},
|
|
1534
|
+
...props,
|
|
1535
|
+
"aria-invalid": hasError || void 0,
|
|
1536
|
+
"aria-required": isRequired || void 0,
|
|
1537
|
+
"aria-labelledby": labelledBy,
|
|
1538
|
+
"aria-describedby": describedBy
|
|
1539
|
+
}
|
|
1540
|
+
),
|
|
1541
|
+
isRequired && placeholder && !text && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1542
|
+
"span",
|
|
1543
|
+
{
|
|
1544
|
+
className: "fe-number-input__placeholder",
|
|
1545
|
+
"aria-hidden": "true",
|
|
1546
|
+
children: [
|
|
1547
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: placeholder }),
|
|
1548
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fe-field__required", children: "*" })
|
|
1549
|
+
]
|
|
1550
|
+
}
|
|
1551
|
+
)
|
|
1434
1552
|
] }),
|
|
1435
|
-
|
|
1553
|
+
resolvedSuffix && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fe-number-input__suffix", children: resolvedSuffix }),
|
|
1554
|
+
endAdornment,
|
|
1555
|
+
showStepper && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "fe-number-input__stepper", children: [
|
|
1556
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1557
|
+
Button,
|
|
1558
|
+
{
|
|
1559
|
+
hierarchy: "tertiary-gray",
|
|
1560
|
+
size: "24",
|
|
1561
|
+
iconOnly: true,
|
|
1562
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronUpIcon, { size: 12 }),
|
|
1563
|
+
"aria-label": incrementLabel,
|
|
1564
|
+
disabled: disableIncrement,
|
|
1565
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1566
|
+
onClick: () => adjustValue(1)
|
|
1567
|
+
}
|
|
1568
|
+
),
|
|
1569
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1570
|
+
Button,
|
|
1571
|
+
{
|
|
1572
|
+
hierarchy: "tertiary-gray",
|
|
1573
|
+
size: "24",
|
|
1574
|
+
iconOnly: true,
|
|
1575
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDownIcon, { size: 12 }),
|
|
1576
|
+
"aria-label": decrementLabel,
|
|
1577
|
+
disabled: disableDecrement,
|
|
1578
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1579
|
+
onClick: () => adjustValue(-1)
|
|
1580
|
+
}
|
|
1581
|
+
)
|
|
1582
|
+
] })
|
|
1436
1583
|
] }),
|
|
1437
1584
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1438
1585
|
FieldMessage,
|
|
@@ -1785,30 +1932,190 @@ function DateTimePicker(props) {
|
|
|
1785
1932
|
);
|
|
1786
1933
|
}
|
|
1787
1934
|
|
|
1788
|
-
// packages/
|
|
1935
|
+
// packages/form-controls/src/controls/Checkbox/checkbox.tsx
|
|
1789
1936
|
var import_react13 = require("react");
|
|
1790
1937
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1938
|
+
var Checkbox = (0, import_react13.forwardRef)(
|
|
1939
|
+
function Checkbox2({
|
|
1940
|
+
label,
|
|
1941
|
+
labelPosition = "right",
|
|
1942
|
+
className,
|
|
1943
|
+
style,
|
|
1944
|
+
id,
|
|
1945
|
+
disabled,
|
|
1946
|
+
...props
|
|
1947
|
+
}, ref) {
|
|
1948
|
+
const classes = [
|
|
1949
|
+
"fe-checkbox",
|
|
1950
|
+
`fe-checkbox--label-${labelPosition}`,
|
|
1951
|
+
disabled && "fe-checkbox--disabled",
|
|
1952
|
+
className
|
|
1953
|
+
].filter(Boolean).join(" ");
|
|
1954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: classes, style, children: [
|
|
1955
|
+
label && labelPosition === "top" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fe-checkbox__label", children: label }),
|
|
1956
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "fe-checkbox__content", children: [
|
|
1957
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1958
|
+
"input",
|
|
1959
|
+
{
|
|
1960
|
+
ref,
|
|
1961
|
+
id,
|
|
1962
|
+
className: "fe-checkbox__input",
|
|
1963
|
+
type: "checkbox",
|
|
1964
|
+
disabled,
|
|
1965
|
+
...props
|
|
1966
|
+
}
|
|
1967
|
+
),
|
|
1968
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fe-checkbox__control", "aria-hidden": "true" }),
|
|
1969
|
+
label && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fe-checkbox__label", children: label })
|
|
1970
|
+
] })
|
|
1971
|
+
] });
|
|
1972
|
+
}
|
|
1973
|
+
);
|
|
1974
|
+
Checkbox.displayName = "Checkbox";
|
|
1975
|
+
|
|
1976
|
+
// packages/form-controls/src/controls/RadioButton/radio-button.tsx
|
|
1977
|
+
var import_react14 = require("react");
|
|
1978
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1979
|
+
var RadioButton = (0, import_react14.forwardRef)(
|
|
1980
|
+
function RadioButton2({
|
|
1981
|
+
label,
|
|
1982
|
+
labelPosition = "right",
|
|
1983
|
+
className,
|
|
1984
|
+
style,
|
|
1985
|
+
id,
|
|
1986
|
+
disabled,
|
|
1987
|
+
...props
|
|
1988
|
+
}, ref) {
|
|
1989
|
+
const classes = [
|
|
1990
|
+
"fe-radio-button",
|
|
1991
|
+
`fe-radio-button--label-${labelPosition}`,
|
|
1992
|
+
disabled && "fe-radio-button--disabled",
|
|
1993
|
+
className
|
|
1994
|
+
].filter(Boolean).join(" ");
|
|
1995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: classes, style, children: [
|
|
1996
|
+
label && labelPosition === "top" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fe-radio-button__label", children: label }),
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "fe-radio-button__content", children: [
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1999
|
+
"input",
|
|
2000
|
+
{
|
|
2001
|
+
ref,
|
|
2002
|
+
id,
|
|
2003
|
+
className: "fe-radio-button__input",
|
|
2004
|
+
type: "radio",
|
|
2005
|
+
disabled,
|
|
2006
|
+
...props
|
|
2007
|
+
}
|
|
2008
|
+
),
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fe-radio-button__control", "aria-hidden": "true" }),
|
|
2010
|
+
label && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fe-radio-button__label", children: label })
|
|
2011
|
+
] })
|
|
2012
|
+
] });
|
|
2013
|
+
}
|
|
2014
|
+
);
|
|
2015
|
+
RadioButton.displayName = "RadioButton";
|
|
2016
|
+
|
|
2017
|
+
// packages/form-controls/src/controls/RadioGroup/radio-group.tsx
|
|
2018
|
+
var import_react15 = require("react");
|
|
2019
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2020
|
+
var RadioGroup = (0, import_react15.forwardRef)(
|
|
2021
|
+
function RadioGroup2({
|
|
2022
|
+
label,
|
|
2023
|
+
labelPosition = "top",
|
|
2024
|
+
options,
|
|
2025
|
+
name,
|
|
2026
|
+
value,
|
|
2027
|
+
defaultValue,
|
|
2028
|
+
onChange,
|
|
2029
|
+
disabled = false,
|
|
2030
|
+
direction = "vertical",
|
|
2031
|
+
isRequired = false,
|
|
2032
|
+
className,
|
|
2033
|
+
id,
|
|
2034
|
+
"aria-label": ariaLabel,
|
|
2035
|
+
"aria-labelledby": ariaLabelledBy,
|
|
2036
|
+
...props
|
|
2037
|
+
}, ref) {
|
|
2038
|
+
const generatedId = (0, import_react15.useId)();
|
|
2039
|
+
const groupName = name ?? `fe-radio-group-${generatedId}`;
|
|
2040
|
+
const labelId = `${id ?? generatedId}-label`;
|
|
2041
|
+
const isControlled = value !== void 0;
|
|
2042
|
+
const classes = [
|
|
2043
|
+
"fe-radio-group",
|
|
2044
|
+
`fe-radio-group--label-${labelPosition}`,
|
|
2045
|
+
`fe-radio-group--${direction}`,
|
|
2046
|
+
disabled && "fe-radio-group--disabled",
|
|
2047
|
+
className
|
|
2048
|
+
].filter(Boolean).join(" ");
|
|
2049
|
+
const handleChange = (option, event) => {
|
|
2050
|
+
if (event.target.checked) onChange?.(option.value, option, event);
|
|
2051
|
+
};
|
|
2052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { ref, className: classes, ...props, children: [
|
|
2053
|
+
label && labelPosition === "top" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { id: labelId, className: "fe-radio-group__label", children: [
|
|
2054
|
+
label,
|
|
2055
|
+
isRequired && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
2056
|
+
] }),
|
|
2057
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2058
|
+
"div",
|
|
2059
|
+
{
|
|
2060
|
+
id,
|
|
2061
|
+
className: "fe-radio-group__options",
|
|
2062
|
+
role: "radiogroup",
|
|
2063
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
2064
|
+
"aria-labelledby": label ? labelId : ariaLabelledBy,
|
|
2065
|
+
"aria-required": isRequired || void 0,
|
|
2066
|
+
children: options.map((option) => {
|
|
2067
|
+
const optionDisabled = disabled || option.disabled;
|
|
2068
|
+
const optionValue = String(option.value);
|
|
2069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2070
|
+
RadioButton,
|
|
2071
|
+
{
|
|
2072
|
+
name: groupName,
|
|
2073
|
+
value: optionValue,
|
|
2074
|
+
label: option.label,
|
|
2075
|
+
disabled: optionDisabled,
|
|
2076
|
+
required: isRequired,
|
|
2077
|
+
checked: isControlled ? option.value === value : void 0,
|
|
2078
|
+
defaultChecked: !isControlled ? option.value === defaultValue : void 0,
|
|
2079
|
+
onChange: (event) => handleChange(option, event)
|
|
2080
|
+
},
|
|
2081
|
+
optionValue
|
|
2082
|
+
);
|
|
2083
|
+
})
|
|
2084
|
+
}
|
|
2085
|
+
),
|
|
2086
|
+
label && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { id: labelId, className: "fe-radio-group__label", children: [
|
|
2087
|
+
label,
|
|
2088
|
+
isRequired && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
2089
|
+
] })
|
|
2090
|
+
] });
|
|
2091
|
+
}
|
|
2092
|
+
);
|
|
2093
|
+
RadioGroup.displayName = "RadioGroup";
|
|
2094
|
+
|
|
2095
|
+
// packages/expandable-section/src/index.tsx
|
|
2096
|
+
var import_react16 = require("react");
|
|
2097
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1791
2098
|
function ExpandableSection({ title, children, expanded, defaultExpanded = false, onExpandedChange, disabled, className, ...props }) {
|
|
1792
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
2099
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react16.useState)(defaultExpanded);
|
|
1793
2100
|
const isExpanded = expanded ?? internalExpanded;
|
|
1794
|
-
const id = (0,
|
|
2101
|
+
const id = (0, import_react16.useId)();
|
|
1795
2102
|
const toggle = () => {
|
|
1796
2103
|
if (disabled) return;
|
|
1797
2104
|
const next = !isExpanded;
|
|
1798
2105
|
if (expanded === void 0) setInternalExpanded(next);
|
|
1799
2106
|
onExpandedChange?.(next);
|
|
1800
2107
|
};
|
|
1801
|
-
return /* @__PURE__ */ (0,
|
|
1802
|
-
/* @__PURE__ */ (0,
|
|
1803
|
-
/* @__PURE__ */ (0,
|
|
1804
|
-
/* @__PURE__ */ (0,
|
|
2108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: ["fe-expandable-section", isExpanded && "fe-expandable-section--expanded", disabled && "fe-expandable-section--disabled", className].filter(Boolean).join(" "), ...props, children: [
|
|
2109
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("button", { className: "fe-expandable-section__trigger", type: "button", "aria-expanded": isExpanded, "aria-controls": id, disabled, onClick: toggle, children: [
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: title }),
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fe-expandable-section__chevron", "aria-hidden": "true" })
|
|
1805
2112
|
] }),
|
|
1806
|
-
/* @__PURE__ */ (0,
|
|
2113
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { id, className: "fe-expandable-section__content", "aria-hidden": !isExpanded, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "fe-expandable-section__content-inner", children }) })
|
|
1807
2114
|
] });
|
|
1808
2115
|
}
|
|
1809
2116
|
|
|
1810
2117
|
// packages/loading/src/index.tsx
|
|
1811
|
-
var
|
|
2118
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1812
2119
|
var sizes = {
|
|
1813
2120
|
small: "16px",
|
|
1814
2121
|
medium: "24px",
|
|
@@ -1821,15 +2128,15 @@ function Loading({ size = "medium", color = "#2878f0", label, className, style,
|
|
|
1821
2128
|
"--fe-loading-color": color,
|
|
1822
2129
|
...style
|
|
1823
2130
|
};
|
|
1824
|
-
return /* @__PURE__ */ (0,
|
|
1825
|
-
/* @__PURE__ */ (0,
|
|
1826
|
-
label && /* @__PURE__ */ (0,
|
|
1827
|
-
!label && /* @__PURE__ */ (0,
|
|
2131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: ["fe-loading", className].filter(Boolean).join(" "), style: loadingStyle, role: "status", ...props, children: [
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fe-loading__spinner", "aria-hidden": "true" }),
|
|
2133
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fe-loading__label", children: label }),
|
|
2134
|
+
!label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fe-loading__sr-only", children: "Loading" })
|
|
1828
2135
|
] });
|
|
1829
2136
|
}
|
|
1830
2137
|
|
|
1831
2138
|
// packages/skeleton/src/index.tsx
|
|
1832
|
-
var
|
|
2139
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1833
2140
|
var pixels = (value) => typeof value === "number" ? `${value}px` : value;
|
|
1834
2141
|
function SkeletonBase({ variant = "box", shape, width, height, count = 1, animated = true, className, style, ...props }) {
|
|
1835
2142
|
const resolvedVariant = shape ?? variant;
|
|
@@ -1840,7 +2147,7 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
1840
2147
|
"--fe-skeleton-height": resolvedHeight,
|
|
1841
2148
|
...style
|
|
1842
2149
|
};
|
|
1843
|
-
return /* @__PURE__ */ (0,
|
|
2150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: Array.from({ length: Math.max(1, count) }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1844
2151
|
"div",
|
|
1845
2152
|
{
|
|
1846
2153
|
className: ["fe-skeleton", `fe-skeleton--${resolvedVariant}`, animated && "fe-skeleton--animated", className].filter(Boolean).join(" "),
|
|
@@ -1852,16 +2159,16 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
1852
2159
|
)) });
|
|
1853
2160
|
}
|
|
1854
2161
|
function SkeletonCircle({ size = 40, ...props }) {
|
|
1855
|
-
return /* @__PURE__ */ (0,
|
|
2162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SkeletonBase, { variant: "circle", width: size, height: size, ...props });
|
|
1856
2163
|
}
|
|
1857
2164
|
function SkeletonSquare({ size = 80, ...props }) {
|
|
1858
|
-
return /* @__PURE__ */ (0,
|
|
2165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SkeletonBase, { variant: "box", width: size, height: size, ...props });
|
|
1859
2166
|
}
|
|
1860
2167
|
function SkeletonBox({ width = "100%", height = 80, ...props }) {
|
|
1861
|
-
return /* @__PURE__ */ (0,
|
|
2168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SkeletonBase, { variant: "box", width, height, ...props });
|
|
1862
2169
|
}
|
|
1863
2170
|
function SkeletonLine({ width = "100%", height = 12, ...props }) {
|
|
1864
|
-
return /* @__PURE__ */ (0,
|
|
2171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SkeletonBase, { variant: "line", width, height, ...props });
|
|
1865
2172
|
}
|
|
1866
2173
|
var Skeleton = Object.assign(SkeletonBase, {
|
|
1867
2174
|
Circle: SkeletonCircle,
|
|
@@ -1871,9 +2178,9 @@ var Skeleton = Object.assign(SkeletonBase, {
|
|
|
1871
2178
|
});
|
|
1872
2179
|
|
|
1873
2180
|
// packages/modal/src/index.tsx
|
|
1874
|
-
var
|
|
2181
|
+
var import_react17 = require("react");
|
|
1875
2182
|
var import_react_dom3 = require("react-dom");
|
|
1876
|
-
var
|
|
2183
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1877
2184
|
function Modal({
|
|
1878
2185
|
open,
|
|
1879
2186
|
onClose,
|
|
@@ -1889,9 +2196,9 @@ function Modal({
|
|
|
1889
2196
|
className,
|
|
1890
2197
|
...props
|
|
1891
2198
|
}) {
|
|
1892
|
-
const titleId = (0,
|
|
1893
|
-
const panelRef = (0,
|
|
1894
|
-
(0,
|
|
2199
|
+
const titleId = (0, import_react17.useId)();
|
|
2200
|
+
const panelRef = (0, import_react17.useRef)(null);
|
|
2201
|
+
(0, import_react17.useEffect)(() => {
|
|
1895
2202
|
if (!open) return;
|
|
1896
2203
|
const onKeyDown = (event) => {
|
|
1897
2204
|
if (event.key === "Escape") onClose();
|
|
@@ -1903,9 +2210,9 @@ function Modal({
|
|
|
1903
2210
|
if (!open || typeof document === "undefined") return null;
|
|
1904
2211
|
const hasFooter = footer || actions.length > 0;
|
|
1905
2212
|
return (0, import_react_dom3.createPortal)(
|
|
1906
|
-
/* @__PURE__ */ (0,
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fe-modal-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
1907
2214
|
if (event.target === event.currentTarget && closeOnBackdropClick) onClose();
|
|
1908
|
-
}, children: /* @__PURE__ */ (0,
|
|
2215
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1909
2216
|
"div",
|
|
1910
2217
|
{
|
|
1911
2218
|
ref: panelRef,
|
|
@@ -1917,17 +2224,17 @@ function Modal({
|
|
|
1917
2224
|
tabIndex: -1,
|
|
1918
2225
|
...props,
|
|
1919
2226
|
children: [
|
|
1920
|
-
(title || description || closeButton) && /* @__PURE__ */ (0,
|
|
1921
|
-
/* @__PURE__ */ (0,
|
|
1922
|
-
title && /* @__PURE__ */ (0,
|
|
1923
|
-
description && /* @__PURE__ */ (0,
|
|
2227
|
+
(title || description || closeButton) && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("header", { className: "fe-modal__header", children: [
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fe-modal__heading", children: [
|
|
2229
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { id: titleId, children: title }),
|
|
2230
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: description })
|
|
1924
2231
|
] }),
|
|
1925
|
-
closeButton && /* @__PURE__ */ (0,
|
|
2232
|
+
closeButton && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { hierarchy: "tertiary-gray", size: "32", iconOnly: true, icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CloseIcon, {}), "aria-label": closeLabel, onClick: onClose })
|
|
1926
2233
|
] }),
|
|
1927
|
-
/* @__PURE__ */ (0,
|
|
1928
|
-
hasFooter && /* @__PURE__ */ (0,
|
|
1929
|
-
footer && /* @__PURE__ */ (0,
|
|
1930
|
-
actions.length > 0 && /* @__PURE__ */ (0,
|
|
2234
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fe-modal__body", children }),
|
|
2235
|
+
hasFooter && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("footer", { className: "fe-modal__footer", children: [
|
|
2236
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fe-modal__footer-content", children: footer }),
|
|
2237
|
+
actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fe-modal__actions", children: actions.map(({ label, ...action }, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { ...action, children: label }, index)) })
|
|
1931
2238
|
] })
|
|
1932
2239
|
]
|
|
1933
2240
|
}
|
|
@@ -1937,7 +2244,7 @@ function Modal({
|
|
|
1937
2244
|
}
|
|
1938
2245
|
|
|
1939
2246
|
// packages/progress/src/index.tsx
|
|
1940
|
-
var
|
|
2247
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1941
2248
|
function ProgressBar({ value, max = 100, label, showValue = true, size = "medium", color = "#2878f0", className, style, "aria-label": ariaLabel, ...props }) {
|
|
1942
2249
|
const indeterminate = value === null || value === void 0;
|
|
1943
2250
|
const percentage = indeterminate ? 0 : Math.min(100, Math.max(0, Number(value) / Math.max(1, max) * 100));
|
|
@@ -1947,17 +2254,17 @@ function ProgressBar({ value, max = 100, label, showValue = true, size = "medium
|
|
|
1947
2254
|
...style
|
|
1948
2255
|
};
|
|
1949
2256
|
const visibleValue = `${Math.round(percentage)}%`;
|
|
1950
|
-
return /* @__PURE__ */ (0,
|
|
1951
|
-
(label || !indeterminate && showValue) && /* @__PURE__ */ (0,
|
|
1952
|
-
label && /* @__PURE__ */ (0,
|
|
1953
|
-
!indeterminate && showValue && /* @__PURE__ */ (0,
|
|
2257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ["fe-progress", `fe-progress--${size}`, indeterminate && "fe-progress--indeterminate", className].filter(Boolean).join(" "), style: progressStyle, ...props, children: [
|
|
2258
|
+
(label || !indeterminate && showValue) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fe-progress__meta", children: [
|
|
2259
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fe-progress__label", children: label }),
|
|
2260
|
+
!indeterminate && showValue && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("output", { className: "fe-progress__value", children: visibleValue })
|
|
1954
2261
|
] }),
|
|
1955
|
-
/* @__PURE__ */ (0,
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "fe-progress__track", role: "progressbar", "aria-label": ariaLabel ?? (typeof label === "string" ? label : "Progress"), "aria-valuemin": indeterminate ? void 0 : 0, "aria-valuemax": indeterminate ? void 0 : max, "aria-valuenow": indeterminate ? void 0 : Number(value), "aria-valuetext": indeterminate ? "Loading" : visibleValue, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "fe-progress__indicator" }) })
|
|
1956
2263
|
] });
|
|
1957
2264
|
}
|
|
1958
2265
|
|
|
1959
2266
|
// packages/chip/src/index.tsx
|
|
1960
|
-
var
|
|
2267
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1961
2268
|
var statuses = ["default", "info", "success", "warning", "error", "neutral", "pending", "processing"];
|
|
1962
2269
|
function Chip({ children, status = "default", color, variant = "subtle", dot = false, onRemove, removeLabel = "Remove", className, style, ...props }) {
|
|
1963
2270
|
const usesCustomColor = Boolean(color);
|
|
@@ -1966,16 +2273,16 @@ function Chip({ children, status = "default", color, variant = "subtle", dot = f
|
|
|
1966
2273
|
...style
|
|
1967
2274
|
};
|
|
1968
2275
|
const resolvedStatus = statuses.includes(status) ? status : "default";
|
|
1969
|
-
return /* @__PURE__ */ (0,
|
|
1970
|
-
dot && /* @__PURE__ */ (0,
|
|
1971
|
-
/* @__PURE__ */ (0,
|
|
1972
|
-
onRemove && /* @__PURE__ */ (0,
|
|
2276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: ["fe-chip", `fe-chip--${variant}`, `fe-chip--${usesCustomColor ? "custom" : resolvedStatus}`, className].filter(Boolean).join(" "), style: chipStyle, ...props, children: [
|
|
2277
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "fe-chip__dot", "aria-hidden": "true" }),
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "fe-chip__content", children }),
|
|
2279
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CloseIcon, { size: 14 }), "aria-label": removeLabel, onClick: onRemove, className: "fe-chip__remove" })
|
|
1973
2280
|
] });
|
|
1974
2281
|
}
|
|
1975
2282
|
|
|
1976
2283
|
// packages/message/src/index.tsx
|
|
1977
|
-
var
|
|
1978
|
-
var
|
|
2284
|
+
var import_react18 = require("react");
|
|
2285
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1979
2286
|
var messageId = 0;
|
|
1980
2287
|
var entries = [];
|
|
1981
2288
|
var listeners = /* @__PURE__ */ new Set();
|
|
@@ -2008,22 +2315,22 @@ var message = {
|
|
|
2008
2315
|
};
|
|
2009
2316
|
var icons = { success: "\u2713", info: "i", warning: "!", error: "\xD7" };
|
|
2010
2317
|
function Message({ maxCount = 4, closeLabel = "Close notification", className, ...props }) {
|
|
2011
|
-
const [visibleEntries, setVisibleEntries] = (0,
|
|
2012
|
-
(0,
|
|
2318
|
+
const [visibleEntries, setVisibleEntries] = (0, import_react18.useState)(entries);
|
|
2319
|
+
(0, import_react18.useEffect)(() => {
|
|
2013
2320
|
const listener = (nextEntries) => setVisibleEntries(nextEntries);
|
|
2014
2321
|
listeners.add(listener);
|
|
2015
2322
|
return () => {
|
|
2016
2323
|
listeners.delete(listener);
|
|
2017
2324
|
};
|
|
2018
2325
|
}, []);
|
|
2019
|
-
return /* @__PURE__ */ (0,
|
|
2020
|
-
/* @__PURE__ */ (0,
|
|
2021
|
-
/* @__PURE__ */ (0,
|
|
2022
|
-
entry.title && /* @__PURE__ */ (0,
|
|
2023
|
-
/* @__PURE__ */ (0,
|
|
2326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: ["fe-message-viewport", className].filter(Boolean).join(" "), "aria-live": "polite", ...props, children: visibleEntries.slice(-Math.max(1, maxCount)).map((entry) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `fe-message fe-message--${entry.severity ?? "info"}`, role: entry.severity === "error" ? "alert" : "status", children: [
|
|
2327
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "fe-message__icon", "aria-hidden": "true", children: icons[entry.severity ?? "info"] }),
|
|
2328
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fe-message__body", children: [
|
|
2329
|
+
entry.title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("strong", { className: "fe-message__title", children: entry.title }),
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "fe-message__content", children: entry.content })
|
|
2024
2331
|
] }),
|
|
2025
|
-
entry.action && /* @__PURE__ */ (0,
|
|
2026
|
-
/* @__PURE__ */ (0,
|
|
2332
|
+
entry.action && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "fe-message__action", children: entry.action }),
|
|
2333
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { className: "fe-message__close", hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: "\xD7", "aria-label": closeLabel, onClick: () => dismiss(entry.id) })
|
|
2027
2334
|
] }, entry.id)) });
|
|
2028
2335
|
}
|
|
2029
2336
|
((Message2) => {
|
|
@@ -2037,8 +2344,8 @@ function Message({ maxCount = 4, closeLabel = "Close notification", className, .
|
|
|
2037
2344
|
})(Message || (Message = {}));
|
|
2038
2345
|
|
|
2039
2346
|
// packages/snackbar/src/index.tsx
|
|
2040
|
-
var
|
|
2041
|
-
var
|
|
2347
|
+
var import_react19 = require("react");
|
|
2348
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2042
2349
|
function Snackbar({
|
|
2043
2350
|
open,
|
|
2044
2351
|
message: message2,
|
|
@@ -2052,12 +2359,12 @@ function Snackbar({
|
|
|
2052
2359
|
}) {
|
|
2053
2360
|
const vertical = anchorOrigin.vertical ?? "bottom";
|
|
2054
2361
|
const horizontal = anchorOrigin.horizontal ?? "center";
|
|
2055
|
-
(0,
|
|
2362
|
+
(0, import_react19.useEffect)(() => {
|
|
2056
2363
|
if (!open || autoHideDuration === null) return void 0;
|
|
2057
2364
|
const timer = window.setTimeout(() => onClose?.("timeout"), autoHideDuration);
|
|
2058
2365
|
return () => window.clearTimeout(timer);
|
|
2059
2366
|
}, [open, autoHideDuration, onClose]);
|
|
2060
|
-
(0,
|
|
2367
|
+
(0, import_react19.useEffect)(() => {
|
|
2061
2368
|
if (!open) return void 0;
|
|
2062
2369
|
const onKeyDown = (event) => {
|
|
2063
2370
|
if (event.key === "Escape") onClose?.("escapeKeyDown");
|
|
@@ -2066,16 +2373,18 @@ function Snackbar({
|
|
|
2066
2373
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
2067
2374
|
}, [open, onClose]);
|
|
2068
2375
|
if (!open) return null;
|
|
2069
|
-
return /* @__PURE__ */ (0,
|
|
2070
|
-
/* @__PURE__ */ (0,
|
|
2071
|
-
action && /* @__PURE__ */ (0,
|
|
2072
|
-
onClose && /* @__PURE__ */ (0,
|
|
2376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: ["fe-snackbar", `fe-snackbar--${vertical}`, `fe-snackbar--${horizontal}`, className].filter(Boolean).join(" "), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "fe-snackbar__content", role: "status", "aria-live": "polite", children: [
|
|
2377
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fe-snackbar__message", children: message2 }),
|
|
2378
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fe-snackbar__action", children: action }),
|
|
2379
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { className: "fe-snackbar__close", hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: "\xD7", "aria-label": closeLabel, onClick: () => onClose("closeButton") })
|
|
2073
2380
|
] }) });
|
|
2074
2381
|
}
|
|
2075
2382
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2076
2383
|
0 && (module.exports = {
|
|
2077
2384
|
Button,
|
|
2385
|
+
Checkbox,
|
|
2078
2386
|
ChevronDownIcon,
|
|
2387
|
+
ChevronUpIcon,
|
|
2079
2388
|
Chip,
|
|
2080
2389
|
CloseIcon,
|
|
2081
2390
|
CurrencyInput,
|
|
@@ -2089,6 +2398,8 @@ function Snackbar({
|
|
|
2089
2398
|
Pagination,
|
|
2090
2399
|
PlusIcon,
|
|
2091
2400
|
ProgressBar,
|
|
2401
|
+
RadioButton,
|
|
2402
|
+
RadioGroup,
|
|
2092
2403
|
SearchIcon,
|
|
2093
2404
|
Selection,
|
|
2094
2405
|
Skeleton,
|