@dragunio/fe-libs 0.1.7 → 0.1.8
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 +29 -0
- package/dist/{chunk-GT4546FD.mjs → chunk-HM3V3DVO.mjs} +4 -4
- package/dist/icons.js +4 -4
- package/dist/icons.mjs +1 -1
- package/dist/index.d.mts +67 -4
- package/dist/index.d.ts +67 -4
- package/dist/index.js +568 -345
- package/dist/index.mjs +575 -346
- package/dist/styles.css +156 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59,6 +59,7 @@ __export(index_exports, {
|
|
|
59
59
|
TableHead: () => TableHead,
|
|
60
60
|
TableHeader: () => TableHeader,
|
|
61
61
|
TableRow: () => TableRow,
|
|
62
|
+
Tabs: () => Tabs,
|
|
62
63
|
TextArea: () => TextArea,
|
|
63
64
|
TextInput: () => TextInput,
|
|
64
65
|
Toggle: () => Toggle,
|
|
@@ -209,16 +210,16 @@ var iconProps2 = ({ size, ...props }) => ({
|
|
|
209
210
|
...props
|
|
210
211
|
});
|
|
211
212
|
var chevron_right = (props) => {
|
|
212
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...iconProps2(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", {
|
|
213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...iconProps2(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.39898 5.39898C8.73093 5.06704 9.26912 5.06704 9.60107 5.39898L15.6011 11.399C15.933 11.7309 15.933 12.2691 15.6011 12.6011L9.60107 18.6011C9.26912 18.933 8.73093 18.933 8.39898 18.6011C8.06704 18.2691 8.06704 17.7309 8.39898 17.399L13.7979 12L8.39898 6.60107C8.06704 6.26912 8.06704 5.73093 8.39898 5.39898Z", fill: props.fill }) });
|
|
213
214
|
};
|
|
214
215
|
var chevron_up = (props) => {
|
|
215
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...iconProps2(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", {
|
|
216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...iconProps2(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.399 8.39898C11.7309 8.06704 12.2691 8.06704 12.6011 8.39898L18.6011 14.399C18.933 14.7309 18.933 15.2691 18.6011 15.6011C18.2691 15.933 17.7309 15.933 17.399 15.6011L12 10.2021L6.60107 15.6011C6.26912 15.933 5.73093 15.933 5.39898 15.6011C5.06704 15.2691 5.06704 14.7309 5.39898 14.399L11.399 8.39898Z", fill: "#101828" }) });
|
|
216
217
|
};
|
|
217
218
|
var chevron_left = (props) => {
|
|
218
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...iconProps2(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", {
|
|
219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...iconProps2(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.6011 5.39898C15.933 5.73093 15.933 6.26912 15.6011 6.60107L10.2021 12L15.6011 17.399C15.933 17.7309 15.933 18.2691 15.6011 18.6011C15.2691 18.933 14.7309 18.933 14.399 18.6011L8.39898 12.6011C8.06704 12.2691 8.06704 11.7309 8.39898 11.399L14.399 5.39898C14.7309 5.06704 15.2691 5.06704 15.6011 5.39898Z", fill: "#101828" }) });
|
|
219
220
|
};
|
|
220
221
|
var chevron_down = (props) => {
|
|
221
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...iconProps2(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", {
|
|
222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...iconProps2(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.39898 8.39898C5.73093 8.06704 6.26912 8.06704 6.60107 8.39898L12 13.7979L17.399 8.39898C17.7309 8.06704 18.2691 8.06704 18.6011 8.39898C18.933 8.73093 18.933 9.26912 18.6011 9.60107L12.6011 15.6011C12.2691 15.933 11.7309 15.933 11.399 15.6011L5.39898 9.60107C5.06704 9.26912 5.06704 8.73093 5.39898 8.39898Z", fill: "#101828" }) });
|
|
222
223
|
};
|
|
223
224
|
|
|
224
225
|
// packages/icons/src/svgItems/security.tsx
|
|
@@ -342,9 +343,23 @@ function ButtonBar({
|
|
|
342
343
|
const rootRef = (0, import_react2.useRef)(null);
|
|
343
344
|
const moreMenuId = (0, import_react2.useId)();
|
|
344
345
|
const visibleCount = Math.max(0, Math.floor(maxVisible));
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
const actionCount = actions.filter(
|
|
347
|
+
(item) => item !== "|"
|
|
348
|
+
).length;
|
|
349
|
+
const hasOverflow = actionCount > visibleCount;
|
|
350
|
+
let visibleActionEndIndex = actions.length;
|
|
351
|
+
if (hasOverflow) {
|
|
352
|
+
visibleActionEndIndex = 0;
|
|
353
|
+
let renderedActionCount = 0;
|
|
354
|
+
while (visibleActionEndIndex < actions.length && renderedActionCount < visibleCount) {
|
|
355
|
+
if (actions[visibleActionEndIndex] !== "|") renderedActionCount += 1;
|
|
356
|
+
visibleActionEndIndex += 1;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const visibleActions = actions.slice(0, visibleActionEndIndex).filter((item) => item !== "|");
|
|
360
|
+
const overflowItems = actions.slice(visibleActionEndIndex).filter(
|
|
361
|
+
(item, index, items) => item !== "|" || items.slice(0, index).some((candidate) => candidate !== "|") && items.slice(index + 1).some((candidate) => candidate !== "|") && items[index - 1] !== "|"
|
|
362
|
+
);
|
|
348
363
|
const {
|
|
349
364
|
onClick: onMoreClick,
|
|
350
365
|
disabled: moreDisabled,
|
|
@@ -368,18 +383,20 @@ function ButtonBar({
|
|
|
368
383
|
document.removeEventListener("keydown", onKeyDown);
|
|
369
384
|
};
|
|
370
385
|
}, [isMoreOpen]);
|
|
371
|
-
const renderAction = (action,
|
|
372
|
-
const { id, onClick, disabled, ...buttonProps } = action;
|
|
386
|
+
const renderAction = (action, isOverflowAction = false) => {
|
|
387
|
+
const { id, className: className2, onClick, disabled, prefix, ...buttonProps } = action;
|
|
373
388
|
return /* @__PURE__ */ (0, import_react3.createElement)(
|
|
374
389
|
Button,
|
|
375
390
|
{
|
|
376
391
|
...buttonProps,
|
|
392
|
+
className: [className2, isOverflowAction && "fe-button-bar__menu-action"].filter(Boolean).join(" ") || void 0,
|
|
377
393
|
disabled,
|
|
378
394
|
key: id,
|
|
379
395
|
onClick: (event) => {
|
|
380
396
|
onClick?.(event);
|
|
381
|
-
if (
|
|
382
|
-
}
|
|
397
|
+
if (isOverflowAction && !disabled) setIsMoreOpen(false);
|
|
398
|
+
},
|
|
399
|
+
prefix: isOverflowAction ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "fe-button-bar__menu-icon", children: prefix }) : prefix
|
|
383
400
|
}
|
|
384
401
|
);
|
|
385
402
|
};
|
|
@@ -417,7 +434,17 @@ function ButtonBar({
|
|
|
417
434
|
className: "fe-button-bar__menu",
|
|
418
435
|
id: moreMenuId,
|
|
419
436
|
role: "group",
|
|
420
|
-
children:
|
|
437
|
+
children: overflowItems.map(
|
|
438
|
+
(item, index) => item === "|" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
"aria-orientation": "horizontal",
|
|
442
|
+
className: "fe-button-bar__menu-divider",
|
|
443
|
+
role: "separator"
|
|
444
|
+
},
|
|
445
|
+
`divider-${index}`
|
|
446
|
+
) : renderAction(item, true)
|
|
447
|
+
)
|
|
421
448
|
}
|
|
422
449
|
)
|
|
423
450
|
] })
|
|
@@ -426,12 +453,207 @@ function ButtonBar({
|
|
|
426
453
|
);
|
|
427
454
|
}
|
|
428
455
|
|
|
456
|
+
// packages/tabs/src/index.tsx
|
|
457
|
+
var import_react4 = require("react");
|
|
458
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
459
|
+
var hasPanel = (item) => Object.prototype.hasOwnProperty.call(item, "content");
|
|
460
|
+
function findSelectableTab(items, value) {
|
|
461
|
+
return items.find((item) => item.id === value && !item.disabled) ?? items.find((item) => !item.disabled);
|
|
462
|
+
}
|
|
463
|
+
function scrollBehavior() {
|
|
464
|
+
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
|
|
465
|
+
}
|
|
466
|
+
var Tabs = (0, import_react4.forwardRef)(function Tabs2({
|
|
467
|
+
items,
|
|
468
|
+
value,
|
|
469
|
+
defaultValue,
|
|
470
|
+
onChange,
|
|
471
|
+
variant = "tab",
|
|
472
|
+
scrollButtons = "auto",
|
|
473
|
+
previousScrollLabel = "Scroll tabs backward",
|
|
474
|
+
nextScrollLabel = "Scroll tabs forward",
|
|
475
|
+
className,
|
|
476
|
+
"aria-label": ariaLabel = "Tabs",
|
|
477
|
+
"aria-labelledby": ariaLabelledBy,
|
|
478
|
+
...props
|
|
479
|
+
}, ref) {
|
|
480
|
+
const generatedId = (0, import_react4.useId)();
|
|
481
|
+
const listRef = (0, import_react4.useRef)(null);
|
|
482
|
+
const tabRefs = (0, import_react4.useRef)(/* @__PURE__ */ new Map());
|
|
483
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react4.useState)(
|
|
484
|
+
() => findSelectableTab(items, defaultValue)?.id
|
|
485
|
+
);
|
|
486
|
+
const [scrollState, setScrollState] = (0, import_react4.useState)({
|
|
487
|
+
hasOverflow: false,
|
|
488
|
+
canScrollBackward: false,
|
|
489
|
+
canScrollForward: false
|
|
490
|
+
});
|
|
491
|
+
const activeTab = findSelectableTab(items, value ?? uncontrolledValue);
|
|
492
|
+
const activeIndex = activeTab ? items.findIndex((item) => item.id === activeTab.id) : -1;
|
|
493
|
+
(0, import_react4.useEffect)(() => {
|
|
494
|
+
if (value === void 0 && activeTab?.id !== uncontrolledValue) {
|
|
495
|
+
setUncontrolledValue(activeTab?.id);
|
|
496
|
+
}
|
|
497
|
+
}, [activeTab?.id, uncontrolledValue, value]);
|
|
498
|
+
const updateScrollState = (0, import_react4.useCallback)(() => {
|
|
499
|
+
const list = listRef.current;
|
|
500
|
+
if (!list) return;
|
|
501
|
+
const maxScroll = Math.max(0, list.scrollWidth - list.clientWidth);
|
|
502
|
+
setScrollState({
|
|
503
|
+
hasOverflow: maxScroll > 1,
|
|
504
|
+
canScrollBackward: list.scrollLeft > 1,
|
|
505
|
+
canScrollForward: list.scrollLeft < maxScroll - 1
|
|
506
|
+
});
|
|
507
|
+
}, []);
|
|
508
|
+
(0, import_react4.useEffect)(() => {
|
|
509
|
+
const list = listRef.current;
|
|
510
|
+
if (!list) return;
|
|
511
|
+
updateScrollState();
|
|
512
|
+
list.addEventListener("scroll", updateScrollState, { passive: true });
|
|
513
|
+
const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(updateScrollState);
|
|
514
|
+
observer?.observe(list);
|
|
515
|
+
window.addEventListener("resize", updateScrollState);
|
|
516
|
+
return () => {
|
|
517
|
+
list.removeEventListener("scroll", updateScrollState);
|
|
518
|
+
observer?.disconnect();
|
|
519
|
+
window.removeEventListener("resize", updateScrollState);
|
|
520
|
+
};
|
|
521
|
+
}, [items, updateScrollState]);
|
|
522
|
+
(0, import_react4.useEffect)(() => {
|
|
523
|
+
const tab = activeTab ? tabRefs.current.get(activeTab.id) : void 0;
|
|
524
|
+
tab?.scrollIntoView?.({
|
|
525
|
+
behavior: scrollBehavior(),
|
|
526
|
+
block: "nearest",
|
|
527
|
+
inline: "nearest"
|
|
528
|
+
});
|
|
529
|
+
}, [activeTab?.id]);
|
|
530
|
+
const selectTab = (item, event) => {
|
|
531
|
+
if (item.disabled || item.id === activeTab?.id) return;
|
|
532
|
+
if (value === void 0) setUncontrolledValue(item.id);
|
|
533
|
+
onChange?.(item.id, item, event);
|
|
534
|
+
};
|
|
535
|
+
const selectFromKeyboard = (item, event) => {
|
|
536
|
+
const enabledItems = items.filter((candidate) => !candidate.disabled);
|
|
537
|
+
const currentIndex = enabledItems.findIndex(
|
|
538
|
+
(candidate) => candidate.id === item.id
|
|
539
|
+
);
|
|
540
|
+
if (currentIndex === -1) return;
|
|
541
|
+
let nextIndex;
|
|
542
|
+
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
543
|
+
nextIndex = (currentIndex + 1) % enabledItems.length;
|
|
544
|
+
} else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
545
|
+
nextIndex = (currentIndex - 1 + enabledItems.length) % enabledItems.length;
|
|
546
|
+
} else if (event.key === "Home") {
|
|
547
|
+
nextIndex = 0;
|
|
548
|
+
} else if (event.key === "End") {
|
|
549
|
+
nextIndex = enabledItems.length - 1;
|
|
550
|
+
}
|
|
551
|
+
if (nextIndex === void 0) return;
|
|
552
|
+
event.preventDefault();
|
|
553
|
+
const nextItem = enabledItems[nextIndex];
|
|
554
|
+
if (!nextItem) return;
|
|
555
|
+
tabRefs.current.get(nextItem.id)?.focus();
|
|
556
|
+
selectTab(nextItem, event);
|
|
557
|
+
};
|
|
558
|
+
const scrollTabs = (direction) => {
|
|
559
|
+
const list = listRef.current;
|
|
560
|
+
if (!list) return;
|
|
561
|
+
list.scrollBy({
|
|
562
|
+
left: direction * Math.max(160, Math.round(list.clientWidth * 0.75)),
|
|
563
|
+
behavior: scrollBehavior()
|
|
564
|
+
});
|
|
565
|
+
};
|
|
566
|
+
const showScrollButtons = scrollButtons === "always" || scrollButtons === "auto" && scrollState.hasOverflow;
|
|
567
|
+
const classes = ["fe-tabs", `fe-tabs--${variant}`, className].filter(Boolean).join(" ");
|
|
568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ...props, className: classes, ref, children: [
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "fe-tabs__navigation", children: [
|
|
570
|
+
showScrollButtons && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
571
|
+
Button,
|
|
572
|
+
{
|
|
573
|
+
"aria-label": previousScrollLabel,
|
|
574
|
+
className: "fe-tabs__scroll-button",
|
|
575
|
+
disabled: !scrollState.canScrollBackward,
|
|
576
|
+
hierarchy: "tertiary-gray",
|
|
577
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(chevron_left, { size: 18 }),
|
|
578
|
+
iconOnly: true,
|
|
579
|
+
onClick: () => scrollTabs(-1),
|
|
580
|
+
size: "32"
|
|
581
|
+
}
|
|
582
|
+
),
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "fe-tabs__scroller", ref: listRef, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
584
|
+
"div",
|
|
585
|
+
{
|
|
586
|
+
"aria-label": ariaLabelledBy ? void 0 : ariaLabel,
|
|
587
|
+
"aria-labelledby": ariaLabelledBy,
|
|
588
|
+
"aria-orientation": "horizontal",
|
|
589
|
+
className: "fe-tabs__list",
|
|
590
|
+
role: "tablist",
|
|
591
|
+
children: items.map((item, index) => {
|
|
592
|
+
const selected = item.id === activeTab?.id;
|
|
593
|
+
const panelId = `${generatedId}-panel-${index}`;
|
|
594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
595
|
+
"button",
|
|
596
|
+
{
|
|
597
|
+
"aria-controls": hasPanel(item) ? panelId : void 0,
|
|
598
|
+
"aria-selected": selected,
|
|
599
|
+
className: "fe-tabs__tab",
|
|
600
|
+
disabled: item.disabled,
|
|
601
|
+
id: `${generatedId}-tab-${index}`,
|
|
602
|
+
onClick: (event) => selectTab(item, event),
|
|
603
|
+
onKeyDown: (event) => selectFromKeyboard(item, event),
|
|
604
|
+
ref: (node) => {
|
|
605
|
+
if (node) tabRefs.current.set(item.id, node);
|
|
606
|
+
else tabRefs.current.delete(item.id);
|
|
607
|
+
},
|
|
608
|
+
role: "tab",
|
|
609
|
+
tabIndex: selected ? 0 : -1,
|
|
610
|
+
type: "button",
|
|
611
|
+
children: item.label
|
|
612
|
+
},
|
|
613
|
+
item.id
|
|
614
|
+
);
|
|
615
|
+
})
|
|
616
|
+
}
|
|
617
|
+
) }),
|
|
618
|
+
showScrollButtons && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
619
|
+
Button,
|
|
620
|
+
{
|
|
621
|
+
"aria-label": nextScrollLabel,
|
|
622
|
+
className: "fe-tabs__scroll-button",
|
|
623
|
+
disabled: !scrollState.canScrollForward,
|
|
624
|
+
hierarchy: "tertiary-gray",
|
|
625
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(chevron_right, { size: 18 }),
|
|
626
|
+
iconOnly: true,
|
|
627
|
+
onClick: () => scrollTabs(1),
|
|
628
|
+
size: "32"
|
|
629
|
+
}
|
|
630
|
+
)
|
|
631
|
+
] }),
|
|
632
|
+
items.map(
|
|
633
|
+
(item, index) => hasPanel(item) ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
634
|
+
"div",
|
|
635
|
+
{
|
|
636
|
+
"aria-labelledby": `${generatedId}-tab-${index}`,
|
|
637
|
+
className: "fe-tabs__panel",
|
|
638
|
+
hidden: item.id !== activeTab?.id,
|
|
639
|
+
id: `${generatedId}-panel-${index}`,
|
|
640
|
+
role: "tabpanel",
|
|
641
|
+
tabIndex: 0,
|
|
642
|
+
children: item.content
|
|
643
|
+
},
|
|
644
|
+
item.id
|
|
645
|
+
) : null
|
|
646
|
+
)
|
|
647
|
+
] });
|
|
648
|
+
});
|
|
649
|
+
Tabs.displayName = "Tabs";
|
|
650
|
+
|
|
429
651
|
// packages/table/src/index.tsx
|
|
430
|
-
var
|
|
652
|
+
var import_react6 = require("react");
|
|
431
653
|
|
|
432
654
|
// packages/pagination/src/index.tsx
|
|
433
|
-
var
|
|
434
|
-
var
|
|
655
|
+
var import_react5 = require("react");
|
|
656
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
435
657
|
var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
436
658
|
var range = (start, end) => Array.from({ length: Math.max(0, end - start + 1) }, (_, index) => start + index);
|
|
437
659
|
function getItems(totalPages, page, siblingCount, boundaryCount) {
|
|
@@ -463,9 +685,9 @@ function Pagination({
|
|
|
463
685
|
...props
|
|
464
686
|
}) {
|
|
465
687
|
const safeTotalPages = Math.max(1, Math.floor(totalPages));
|
|
466
|
-
const [uncontrolledPage, setUncontrolledPage] = (0,
|
|
688
|
+
const [uncontrolledPage, setUncontrolledPage] = (0, import_react5.useState)(() => clamp(defaultPage, 1, safeTotalPages));
|
|
467
689
|
const currentPage = clamp(page ?? uncontrolledPage, 1, safeTotalPages);
|
|
468
|
-
const items = (0,
|
|
690
|
+
const items = (0, import_react5.useMemo)(
|
|
469
691
|
() => getItems(safeTotalPages, currentPage, Math.max(0, siblingCount), Math.max(0, boundaryCount)),
|
|
470
692
|
[safeTotalPages, currentPage, siblingCount, boundaryCount]
|
|
471
693
|
);
|
|
@@ -474,9 +696,9 @@ function Pagination({
|
|
|
474
696
|
if (page === void 0) setUncontrolledPage(resolvedPage);
|
|
475
697
|
if (resolvedPage !== currentPage) onPageChange?.(resolvedPage);
|
|
476
698
|
};
|
|
477
|
-
return /* @__PURE__ */ (0,
|
|
478
|
-
/* @__PURE__ */ (0,
|
|
479
|
-
items.map((item, index) => item === "start-ellipsis" || item === "end-ellipsis" ? /* @__PURE__ */ (0,
|
|
699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("nav", { className: ["fe-pagination", className].filter(Boolean).join(" "), "aria-label": "Pagination", ...props, children: [
|
|
700
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { className: "fe-pagination__button fe-pagination__button--control", hierarchy: "secondary-gray", size: "40", iconOnly: true, icon: "\u2039", "aria-label": previousLabel, disabled: disabled || currentPage === 1, onClick: () => selectPage(currentPage - 1) }),
|
|
701
|
+
items.map((item, index) => item === "start-ellipsis" || item === "end-ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "fe-pagination__ellipsis", "aria-hidden": "true", children: "\u2026" }, `${item}-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
480
702
|
Button,
|
|
481
703
|
{
|
|
482
704
|
className: "fe-pagination__button",
|
|
@@ -490,13 +712,13 @@ function Pagination({
|
|
|
490
712
|
},
|
|
491
713
|
item
|
|
492
714
|
)),
|
|
493
|
-
/* @__PURE__ */ (0,
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { className: "fe-pagination__button fe-pagination__button--control", hierarchy: "secondary-gray", size: "40", iconOnly: true, icon: "\u203A", "aria-label": nextLabel, disabled: disabled || currentPage === safeTotalPages, onClick: () => selectPage(currentPage + 1) })
|
|
494
716
|
] });
|
|
495
717
|
}
|
|
496
718
|
|
|
497
719
|
// packages/table/src/index.tsx
|
|
498
|
-
var
|
|
499
|
-
var TableContext = (0,
|
|
720
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
721
|
+
var TableContext = (0, import_react6.createContext)({ striped: false });
|
|
500
722
|
var MIN_COLUMN_WIDTH = 96;
|
|
501
723
|
var MAX_COLUMN_WIDTH = 1200;
|
|
502
724
|
function getColumnCount(headers, data) {
|
|
@@ -505,7 +727,7 @@ function getColumnCount(headers, data) {
|
|
|
505
727
|
function getText(value) {
|
|
506
728
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
507
729
|
if (Array.isArray(value)) return value.map(getText).join("");
|
|
508
|
-
if ((0,
|
|
730
|
+
if ((0, import_react6.isValidElement)(value)) return getText(value.props.children);
|
|
509
731
|
return "";
|
|
510
732
|
}
|
|
511
733
|
function autoColumnSize(columnIndex, headers, data) {
|
|
@@ -541,37 +763,37 @@ function DataTable({
|
|
|
541
763
|
}) {
|
|
542
764
|
const columnCount = getColumnCount(headers, data);
|
|
543
765
|
const safeMinWidth = Math.max(1, minColumnWidth);
|
|
544
|
-
const generatedSizes = (0,
|
|
766
|
+
const generatedSizes = (0, import_react6.useMemo)(
|
|
545
767
|
() => getInitialColumnSizes(headers, data, defaultColumnSizes, safeMinWidth),
|
|
546
768
|
[headers, data, defaultColumnSizes, safeMinWidth]
|
|
547
769
|
);
|
|
548
|
-
const [uncontrolledSizes, setUncontrolledSizes] = (0,
|
|
770
|
+
const [uncontrolledSizes, setUncontrolledSizes] = (0, import_react6.useState)(generatedSizes);
|
|
549
771
|
const shouldPaginate = pagination ?? pageSize !== void 0;
|
|
550
772
|
const safePageSize = Math.max(1, Math.floor(pageSize ?? 10));
|
|
551
773
|
const totalPages = Math.max(1, Math.ceil(data.length / safePageSize));
|
|
552
|
-
const [uncontrolledPage, setUncontrolledPage] = (0,
|
|
774
|
+
const [uncontrolledPage, setUncontrolledPage] = (0, import_react6.useState)(() => Math.min(Math.max(1, defaultPage), totalPages));
|
|
553
775
|
const currentPage = Math.min(Math.max(1, page ?? uncontrolledPage), totalPages);
|
|
554
776
|
const pagedData = shouldPaginate ? data.slice((currentPage - 1) * safePageSize, currentPage * safePageSize) : data;
|
|
555
|
-
const resizeState = (0,
|
|
556
|
-
const [isResizing, setIsResizing] = (0,
|
|
777
|
+
const resizeState = (0, import_react6.useRef)();
|
|
778
|
+
const [isResizing, setIsResizing] = (0, import_react6.useState)(false);
|
|
557
779
|
const sizes2 = columnSizes ? getInitialColumnSizes(headers, data, columnSizes, safeMinWidth).map((size) => Math.max(safeMinWidth, size)) : uncontrolledSizes.map((size) => Math.max(safeMinWidth, size));
|
|
558
|
-
(0,
|
|
780
|
+
(0, import_react6.useEffect)(() => {
|
|
559
781
|
if (columnSizes) return;
|
|
560
782
|
setUncontrolledSizes((currentSizes) => {
|
|
561
783
|
const nextSizes = generatedSizes.map((generatedSize, index) => currentSizes[index] ?? generatedSize);
|
|
562
784
|
return sameSizes(currentSizes, nextSizes) ? currentSizes : nextSizes;
|
|
563
785
|
});
|
|
564
786
|
}, [columnSizes, generatedSizes]);
|
|
565
|
-
(0,
|
|
787
|
+
(0, import_react6.useEffect)(() => {
|
|
566
788
|
if (page === void 0 && uncontrolledPage > totalPages) setUncontrolledPage(totalPages);
|
|
567
789
|
}, [page, totalPages, uncontrolledPage]);
|
|
568
|
-
const updateColumnSize = (0,
|
|
790
|
+
const updateColumnSize = (0, import_react6.useCallback)((columnIndex, nextSize) => {
|
|
569
791
|
const clampedSize = Math.min(MAX_COLUMN_WIDTH, Math.max(safeMinWidth, Math.round(nextSize)));
|
|
570
792
|
const nextSizes = sizes2.map((size, index) => index === columnIndex ? clampedSize : size);
|
|
571
793
|
if (!columnSizes) setUncontrolledSizes(nextSizes);
|
|
572
794
|
onColumnResize?.(nextSizes, columnIndex);
|
|
573
795
|
}, [columnSizes, onColumnResize, safeMinWidth, sizes2]);
|
|
574
|
-
(0,
|
|
796
|
+
(0, import_react6.useEffect)(() => {
|
|
575
797
|
const onPointerMove = (event) => {
|
|
576
798
|
const activeResize = resizeState.current;
|
|
577
799
|
if (!activeResize) return;
|
|
@@ -595,14 +817,14 @@ function DataTable({
|
|
|
595
817
|
if (nextPage !== currentPage) onPageChange?.(nextPage);
|
|
596
818
|
};
|
|
597
819
|
const resolvedPaginationPosition = paginationPosition === "middle-bottom" ? "bottom-center" : paginationPosition;
|
|
598
|
-
const paginationControl = shouldPaginate && totalPages > 1 ? /* @__PURE__ */ (0,
|
|
599
|
-
return /* @__PURE__ */ (0,
|
|
820
|
+
const paginationControl = shouldPaginate && totalPages > 1 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `fe-table__pagination fe-table__pagination--${resolvedPaginationPosition}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pagination, { page: currentPage, totalPages, onPageChange: changePage }) }) : null;
|
|
821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fe-table", "data-resizing": isResizing || void 0, children: [
|
|
600
822
|
resolvedPaginationPosition === "top-right" && paginationControl,
|
|
601
|
-
/* @__PURE__ */ (0,
|
|
602
|
-
/* @__PURE__ */ (0,
|
|
603
|
-
/* @__PURE__ */ (0,
|
|
604
|
-
/* @__PURE__ */ (0,
|
|
605
|
-
/* @__PURE__ */ (0,
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("table", { className: ["fe-table__table", className].filter(Boolean).join(" "), "data-fe-table": true, "data-striped": striped || void 0, ...props, children: [
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("colgroup", { children: sizes2.map((size, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("col", { style: { width: `${size}px` } }, index)) }),
|
|
825
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("tr", { children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("th", { scope: "col", children: [
|
|
826
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "fe-table__header-content", children: headers[columnIndex] ?? `Column ${columnIndex + 1}` }),
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
606
828
|
"span",
|
|
607
829
|
{
|
|
608
830
|
className: "fe-table__resize-handle",
|
|
@@ -626,7 +848,7 @@ function DataTable({
|
|
|
626
848
|
}
|
|
627
849
|
)
|
|
628
850
|
] }, columnIndex)) }) }),
|
|
629
|
-
/* @__PURE__ */ (0,
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("tbody", { children: pagedData.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("tr", { children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("td", { children: row[columnIndex] }, columnIndex)) }, shouldPaginate ? (currentPage - 1) * safePageSize + rowIndex : rowIndex)) })
|
|
630
852
|
] }),
|
|
631
853
|
resolvedPaginationPosition !== "top-right" && paginationControl
|
|
632
854
|
] });
|
|
@@ -644,33 +866,33 @@ function Table({
|
|
|
644
866
|
paginationPosition,
|
|
645
867
|
...props
|
|
646
868
|
}) {
|
|
647
|
-
if (headers || data) return /* @__PURE__ */ (0,
|
|
648
|
-
return /* @__PURE__ */ (0,
|
|
869
|
+
if (headers || data) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DataTable, { headers: headers ?? [], data: data ?? [], striped: striped ?? true, pagination, pageSize, page, defaultPage, onPageChange, paginationPosition, ...props });
|
|
870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TableContext.Provider, { value: { striped: striped ?? false }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("table", { "data-fe-table": true, "data-striped": striped || void 0, ...props, children }) });
|
|
649
871
|
}
|
|
650
872
|
function TableHead(props) {
|
|
651
|
-
return /* @__PURE__ */ (0,
|
|
873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("thead", { ...props });
|
|
652
874
|
}
|
|
653
875
|
function TableBody(props) {
|
|
654
|
-
return /* @__PURE__ */ (0,
|
|
876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("tbody", { ...props });
|
|
655
877
|
}
|
|
656
878
|
function TableRow({ children, ...props }) {
|
|
657
|
-
const { striped } = (0,
|
|
658
|
-
return /* @__PURE__ */ (0,
|
|
879
|
+
const { striped } = (0, import_react6.useContext)(TableContext);
|
|
880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("tr", { "data-striped": striped || void 0, ...props, children });
|
|
659
881
|
}
|
|
660
882
|
function TableCell({ children, ...props }) {
|
|
661
|
-
return /* @__PURE__ */ (0,
|
|
883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("td", { ...props, children });
|
|
662
884
|
}
|
|
663
885
|
function TableHeader({ children, ...props }) {
|
|
664
|
-
return /* @__PURE__ */ (0,
|
|
886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("th", { scope: "col", ...props, children });
|
|
665
887
|
}
|
|
666
888
|
function TableCaption(props) {
|
|
667
|
-
return /* @__PURE__ */ (0,
|
|
889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("caption", { ...props });
|
|
668
890
|
}
|
|
669
891
|
|
|
670
892
|
// packages/toggle/src/index.tsx
|
|
671
|
-
var
|
|
672
|
-
var
|
|
673
|
-
var Toggle = (0,
|
|
893
|
+
var import_react7 = require("react");
|
|
894
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
895
|
+
var Toggle = (0, import_react7.forwardRef)(function Toggle2({
|
|
674
896
|
color = "#16a34a",
|
|
675
897
|
label,
|
|
676
898
|
labelPosition = "right",
|
|
@@ -684,9 +906,9 @@ var Toggle = (0, import_react6.forwardRef)(function Toggle2({
|
|
|
684
906
|
"--fe-toggle-color": color,
|
|
685
907
|
...style
|
|
686
908
|
};
|
|
687
|
-
return /* @__PURE__ */ (0,
|
|
688
|
-
label && labelPosition === "top" && /* @__PURE__ */ (0,
|
|
689
|
-
/* @__PURE__ */ (0,
|
|
909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: classes, style: toggleStyle, children: [
|
|
910
|
+
label && labelPosition === "top" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "fe-toggle__label", children: label }),
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
690
912
|
"input",
|
|
691
913
|
{
|
|
692
914
|
ref,
|
|
@@ -697,18 +919,18 @@ var Toggle = (0, import_react6.forwardRef)(function Toggle2({
|
|
|
697
919
|
...props
|
|
698
920
|
}
|
|
699
921
|
),
|
|
700
|
-
/* @__PURE__ */ (0,
|
|
701
|
-
label && labelPosition === "right" && /* @__PURE__ */ (0,
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "fe-toggle__control", "aria-hidden": "true" }),
|
|
923
|
+
label && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "fe-toggle__label", children: label })
|
|
702
924
|
] });
|
|
703
925
|
});
|
|
704
926
|
Toggle.displayName = "Toggle";
|
|
705
927
|
|
|
706
928
|
// packages/drawer/src/index.tsx
|
|
707
|
-
var
|
|
929
|
+
var import_react8 = require("react");
|
|
708
930
|
var import_react_dom = require("react-dom");
|
|
709
|
-
var
|
|
931
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
710
932
|
function Drawer({ open, onClose, title, footer, side = "right", width = 400, fullScreen = false, children, closeOnBackdropClick = true, className, style, ...props }) {
|
|
711
|
-
(0,
|
|
933
|
+
(0, import_react8.useEffect)(() => {
|
|
712
934
|
if (!open) return;
|
|
713
935
|
const onKeyDown = (event) => {
|
|
714
936
|
if (event.key === "Escape") onClose();
|
|
@@ -718,28 +940,28 @@ function Drawer({ open, onClose, title, footer, side = "right", width = 400, ful
|
|
|
718
940
|
}, [onClose, open]);
|
|
719
941
|
if (!open || typeof document === "undefined") return null;
|
|
720
942
|
const panelStyle = !fullScreen && (side === "left" || side === "right") ? { ...style, width: typeof width === "number" ? `${width}px` : width } : style;
|
|
721
|
-
return (0, import_react_dom.createPortal)(/* @__PURE__ */ (0,
|
|
943
|
+
return (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "fe-drawer-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
722
944
|
if (event.target === event.currentTarget && closeOnBackdropClick) onClose();
|
|
723
|
-
}, children: /* @__PURE__ */ (0,
|
|
724
|
-
/* @__PURE__ */ (0,
|
|
725
|
-
title && /* @__PURE__ */ (0,
|
|
726
|
-
/* @__PURE__ */ (0,
|
|
945
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("aside", { className: ["fe-drawer", `fe-drawer--${side}`, fullScreen && "fe-drawer--full-screen", className].filter(Boolean).join(" "), style: panelStyle, role: "dialog", "aria-modal": "true", "aria-label": typeof title === "string" ? title : "Drawer", ...props, children: [
|
|
946
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("header", { className: "fe-drawer__header", children: [
|
|
947
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h2", { children: title }),
|
|
948
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "aria-label": "Close drawer", onClick: onClose, children: "\xD7" })
|
|
727
949
|
] }),
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
729
|
-
footer && /* @__PURE__ */ (0,
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "fe-drawer__body", children }),
|
|
951
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("footer", { className: "fe-drawer__footer", children: footer })
|
|
730
952
|
] }) }), document.body);
|
|
731
953
|
}
|
|
732
954
|
|
|
733
955
|
// packages/form-controls/src/controls/TextInput/text-input.tsx
|
|
734
|
-
var
|
|
956
|
+
var import_react10 = require("react");
|
|
735
957
|
|
|
736
958
|
// packages/tooltip/src/index.tsx
|
|
737
|
-
var
|
|
738
|
-
var
|
|
959
|
+
var import_react9 = require("react");
|
|
960
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
739
961
|
function Tooltip({ content, children, placement = "top", disabled, className, ...props }) {
|
|
740
|
-
const [visible, setVisible] = (0,
|
|
741
|
-
const id = (0,
|
|
742
|
-
const trigger = (0,
|
|
962
|
+
const [visible, setVisible] = (0, import_react9.useState)(false);
|
|
963
|
+
const id = (0, import_react9.useId)();
|
|
964
|
+
const trigger = (0, import_react9.cloneElement)(children, { "aria-describedby": visible ? id : void 0, onMouseEnter: (event) => {
|
|
743
965
|
children.props.onMouseEnter?.(event);
|
|
744
966
|
setVisible(true);
|
|
745
967
|
}, onMouseLeave: (event) => {
|
|
@@ -752,14 +974,14 @@ function Tooltip({ content, children, placement = "top", disabled, className, ..
|
|
|
752
974
|
children.props.onBlur?.(event);
|
|
753
975
|
setVisible(false);
|
|
754
976
|
} });
|
|
755
|
-
return /* @__PURE__ */ (0,
|
|
977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: ["fe-tooltip", `fe-tooltip--${placement}`, className].filter(Boolean).join(" "), ...props, children: [
|
|
756
978
|
trigger,
|
|
757
|
-
visible && !disabled && /* @__PURE__ */ (0,
|
|
979
|
+
visible && !disabled && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { id, role: "tooltip", className: "fe-tooltip__content", children: content })
|
|
758
980
|
] });
|
|
759
981
|
}
|
|
760
982
|
|
|
761
983
|
// packages/form-controls/src/controls/Field/field.tsx
|
|
762
|
-
var
|
|
984
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
763
985
|
function getFieldError(error, errorMessage) {
|
|
764
986
|
if (errorMessage !== void 0 && errorMessage !== null) return errorMessage;
|
|
765
987
|
if (typeof error !== "boolean") return error;
|
|
@@ -776,10 +998,10 @@ function FieldLabel({
|
|
|
776
998
|
isRequired = false
|
|
777
999
|
}) {
|
|
778
1000
|
if (!label) return null;
|
|
779
|
-
return /* @__PURE__ */ (0,
|
|
780
|
-
/* @__PURE__ */ (0,
|
|
781
|
-
isRequired && /* @__PURE__ */ (0,
|
|
782
|
-
description && descriptionDisplay === "tooltip" && /* @__PURE__ */ (0,
|
|
1001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "fe-field__label", children: [
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { id, children: label }),
|
|
1003
|
+
isRequired && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" }),
|
|
1004
|
+
description && descriptionDisplay === "tooltip" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { content: description, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
783
1005
|
"span",
|
|
784
1006
|
{
|
|
785
1007
|
className: "fe-field__info",
|
|
@@ -798,7 +1020,7 @@ function FieldMessage({
|
|
|
798
1020
|
descriptionDisplay
|
|
799
1021
|
}) {
|
|
800
1022
|
if (error !== void 0 && error !== false && error !== null)
|
|
801
|
-
return /* @__PURE__ */ (0,
|
|
1023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
802
1024
|
"span",
|
|
803
1025
|
{
|
|
804
1026
|
id,
|
|
@@ -808,13 +1030,13 @@ function FieldMessage({
|
|
|
808
1030
|
}
|
|
809
1031
|
);
|
|
810
1032
|
if (description && descriptionDisplay === "inline")
|
|
811
|
-
return /* @__PURE__ */ (0,
|
|
1033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { id, className: "fe-field__message", children: description });
|
|
812
1034
|
return null;
|
|
813
1035
|
}
|
|
814
1036
|
|
|
815
1037
|
// packages/form-controls/src/controls/TextInput/text-input.tsx
|
|
816
|
-
var
|
|
817
|
-
var TextInput = (0,
|
|
1038
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1039
|
+
var TextInput = (0, import_react10.forwardRef)(
|
|
818
1040
|
function TextInput2({
|
|
819
1041
|
value,
|
|
820
1042
|
defaultValue = "",
|
|
@@ -844,12 +1066,12 @@ var TextInput = (0, import_react9.forwardRef)(
|
|
|
844
1066
|
"aria-labelledby": ariaLabelledBy,
|
|
845
1067
|
...props
|
|
846
1068
|
}, ref) {
|
|
847
|
-
const generatedId = (0,
|
|
1069
|
+
const generatedId = (0, import_react10.useId)();
|
|
848
1070
|
const inputId = id ?? generatedId + "-input";
|
|
849
1071
|
const labelId = generatedId + "-label";
|
|
850
1072
|
const messageId2 = generatedId + "-message";
|
|
851
1073
|
const controlled = value !== void 0;
|
|
852
|
-
const [internalValue, setInternalValue] = (0,
|
|
1074
|
+
const [internalValue, setInternalValue] = (0, import_react10.useState)(defaultValue);
|
|
853
1075
|
const currentValue = controlled ? value : internalValue;
|
|
854
1076
|
const fieldError = getFieldError(error, errorMessage);
|
|
855
1077
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
@@ -870,7 +1092,7 @@ var TextInput = (0, import_react9.forwardRef)(
|
|
|
870
1092
|
onValueChange?.("");
|
|
871
1093
|
onClear?.();
|
|
872
1094
|
};
|
|
873
|
-
return /* @__PURE__ */ (0,
|
|
1095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
874
1096
|
"div",
|
|
875
1097
|
{
|
|
876
1098
|
className: [
|
|
@@ -879,7 +1101,7 @@ var TextInput = (0, import_react9.forwardRef)(
|
|
|
879
1101
|
className
|
|
880
1102
|
].filter(Boolean).join(" "),
|
|
881
1103
|
children: [
|
|
882
|
-
/* @__PURE__ */ (0,
|
|
1104
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
883
1105
|
FieldLabel,
|
|
884
1106
|
{
|
|
885
1107
|
id: labelId,
|
|
@@ -889,10 +1111,10 @@ var TextInput = (0, import_react9.forwardRef)(
|
|
|
889
1111
|
isRequired
|
|
890
1112
|
}
|
|
891
1113
|
),
|
|
892
|
-
/* @__PURE__ */ (0,
|
|
893
|
-
resolvedPrefix && /* @__PURE__ */ (0,
|
|
894
|
-
/* @__PURE__ */ (0,
|
|
895
|
-
/* @__PURE__ */ (0,
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "fe-text-input__control", children: [
|
|
1115
|
+
resolvedPrefix && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fe-text-input__prefix", children: resolvedPrefix }),
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "fe-text-input__input-wrap", children: [
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
896
1118
|
"input",
|
|
897
1119
|
{
|
|
898
1120
|
ref,
|
|
@@ -914,26 +1136,26 @@ var TextInput = (0, import_react9.forwardRef)(
|
|
|
914
1136
|
...props
|
|
915
1137
|
}
|
|
916
1138
|
),
|
|
917
|
-
isRequired && placeholder && !currentValue && /* @__PURE__ */ (0,
|
|
918
|
-
/* @__PURE__ */ (0,
|
|
919
|
-
/* @__PURE__ */ (0,
|
|
1139
|
+
isRequired && placeholder && !currentValue && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "fe-text-input__placeholder", "aria-hidden": "true", children: [
|
|
1140
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: placeholder }),
|
|
1141
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fe-field__required", children: "*" })
|
|
920
1142
|
] })
|
|
921
1143
|
] }),
|
|
922
|
-
resolvedSuffix && /* @__PURE__ */ (0,
|
|
923
|
-
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ (0,
|
|
1144
|
+
resolvedSuffix && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fe-text-input__suffix", children: resolvedSuffix }),
|
|
1145
|
+
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
924
1146
|
Button,
|
|
925
1147
|
{
|
|
926
1148
|
hierarchy: "tertiary-gray",
|
|
927
1149
|
size: "24",
|
|
928
1150
|
iconOnly: true,
|
|
929
|
-
icon: /* @__PURE__ */ (0,
|
|
1151
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseIcon, { size: 14 }),
|
|
930
1152
|
"aria-label": clearLabel,
|
|
931
1153
|
onClick: clear,
|
|
932
1154
|
className: "fe-text-input__clear"
|
|
933
1155
|
}
|
|
934
1156
|
)
|
|
935
1157
|
] }),
|
|
936
|
-
/* @__PURE__ */ (0,
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
937
1159
|
FieldMessage,
|
|
938
1160
|
{
|
|
939
1161
|
id: messageId2,
|
|
@@ -950,9 +1172,9 @@ var TextInput = (0, import_react9.forwardRef)(
|
|
|
950
1172
|
TextInput.displayName = "TextInput";
|
|
951
1173
|
|
|
952
1174
|
// packages/form-controls/src/controls/TextArea/text-area.tsx
|
|
953
|
-
var
|
|
954
|
-
var
|
|
955
|
-
var TextArea = (0,
|
|
1175
|
+
var import_react11 = require("react");
|
|
1176
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1177
|
+
var TextArea = (0, import_react11.forwardRef)(
|
|
956
1178
|
function TextArea2({
|
|
957
1179
|
value,
|
|
958
1180
|
defaultValue = "",
|
|
@@ -979,13 +1201,13 @@ var TextArea = (0, import_react10.forwardRef)(
|
|
|
979
1201
|
"aria-labelledby": ariaLabelledBy,
|
|
980
1202
|
...props
|
|
981
1203
|
}, ref) {
|
|
982
|
-
const generatedId = (0,
|
|
1204
|
+
const generatedId = (0, import_react11.useId)();
|
|
983
1205
|
const inputId = id ?? generatedId + "-input";
|
|
984
1206
|
const labelId = generatedId + "-label";
|
|
985
1207
|
const messageId2 = generatedId + "-message";
|
|
986
1208
|
const controlled = value !== void 0;
|
|
987
|
-
const [internalValue, setInternalValue] = (0,
|
|
988
|
-
const textareaRef = (0,
|
|
1209
|
+
const [internalValue, setInternalValue] = (0, import_react11.useState)(defaultValue);
|
|
1210
|
+
const textareaRef = (0, import_react11.useRef)(null);
|
|
989
1211
|
const currentValue = controlled ? value : internalValue;
|
|
990
1212
|
const fieldError = getFieldError(error, errorMessage);
|
|
991
1213
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
@@ -1003,8 +1225,8 @@ var TextArea = (0, import_react10.forwardRef)(
|
|
|
1003
1225
|
textarea.style.height = "auto";
|
|
1004
1226
|
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
1005
1227
|
};
|
|
1006
|
-
(0,
|
|
1007
|
-
(0,
|
|
1228
|
+
(0, import_react11.useImperativeHandle)(ref, () => textareaRef.current, []);
|
|
1229
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
1008
1230
|
if (autosize && textareaRef.current) {
|
|
1009
1231
|
resizeToContent(textareaRef.current);
|
|
1010
1232
|
}
|
|
@@ -1014,7 +1236,7 @@ var TextArea = (0, import_react10.forwardRef)(
|
|
|
1014
1236
|
onValueChange?.("");
|
|
1015
1237
|
onClear?.();
|
|
1016
1238
|
};
|
|
1017
|
-
return /* @__PURE__ */ (0,
|
|
1239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1018
1240
|
"div",
|
|
1019
1241
|
{
|
|
1020
1242
|
className: [
|
|
@@ -1024,7 +1246,7 @@ var TextArea = (0, import_react10.forwardRef)(
|
|
|
1024
1246
|
className
|
|
1025
1247
|
].filter(Boolean).join(" "),
|
|
1026
1248
|
children: [
|
|
1027
|
-
/* @__PURE__ */ (0,
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1028
1250
|
FieldLabel,
|
|
1029
1251
|
{
|
|
1030
1252
|
id: labelId,
|
|
@@ -1034,8 +1256,8 @@ var TextArea = (0, import_react10.forwardRef)(
|
|
|
1034
1256
|
isRequired
|
|
1035
1257
|
}
|
|
1036
1258
|
),
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1259
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "fe-text-area__control", children: [
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1039
1261
|
"textarea",
|
|
1040
1262
|
{
|
|
1041
1263
|
ref: textareaRef,
|
|
@@ -1058,24 +1280,24 @@ var TextArea = (0, import_react10.forwardRef)(
|
|
|
1058
1280
|
...props
|
|
1059
1281
|
}
|
|
1060
1282
|
),
|
|
1061
|
-
isRequired && placeholder && !currentValue && /* @__PURE__ */ (0,
|
|
1062
|
-
/* @__PURE__ */ (0,
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1283
|
+
isRequired && placeholder && !currentValue && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "fe-text-area__placeholder", "aria-hidden": "true", children: [
|
|
1284
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: placeholder }),
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fe-field__required", children: "*" })
|
|
1064
1286
|
] }),
|
|
1065
|
-
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ (0,
|
|
1287
|
+
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1066
1288
|
Button,
|
|
1067
1289
|
{
|
|
1068
1290
|
hierarchy: "tertiary-gray",
|
|
1069
1291
|
size: "24",
|
|
1070
1292
|
iconOnly: true,
|
|
1071
|
-
icon: /* @__PURE__ */ (0,
|
|
1293
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CloseIcon, { size: 14 }),
|
|
1072
1294
|
"aria-label": clearLabel,
|
|
1073
1295
|
onClick: clear,
|
|
1074
1296
|
className: "fe-text-area__clear"
|
|
1075
1297
|
}
|
|
1076
1298
|
)
|
|
1077
1299
|
] }),
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1079
1301
|
FieldMessage,
|
|
1080
1302
|
{
|
|
1081
1303
|
id: messageId2,
|
|
@@ -1092,10 +1314,10 @@ var TextArea = (0, import_react10.forwardRef)(
|
|
|
1092
1314
|
TextArea.displayName = "TextArea";
|
|
1093
1315
|
|
|
1094
1316
|
// packages/form-controls/src/controls/Selection/selection.tsx
|
|
1095
|
-
var
|
|
1317
|
+
var import_react12 = require("react");
|
|
1096
1318
|
var import_react_dom2 = require("react-dom");
|
|
1097
|
-
var
|
|
1098
|
-
var Selection = (0,
|
|
1319
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1320
|
+
var Selection = (0, import_react12.forwardRef)(
|
|
1099
1321
|
function Selection2({
|
|
1100
1322
|
className,
|
|
1101
1323
|
label,
|
|
@@ -1124,7 +1346,7 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1124
1346
|
"aria-labelledby": ariaLabelledBy,
|
|
1125
1347
|
...props
|
|
1126
1348
|
}, ref) {
|
|
1127
|
-
const generatedId = (0,
|
|
1349
|
+
const generatedId = (0, import_react12.useId)();
|
|
1128
1350
|
const triggerId = id ?? generatedId + "-trigger";
|
|
1129
1351
|
const listboxId = triggerId + "-listbox";
|
|
1130
1352
|
const labelId = generatedId + "-label";
|
|
@@ -1142,7 +1364,7 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1142
1364
|
label ? labelId : void 0
|
|
1143
1365
|
);
|
|
1144
1366
|
const isControlled = value !== void 0;
|
|
1145
|
-
const [internalValue, setInternalValue] = (0,
|
|
1367
|
+
const [internalValue, setInternalValue] = (0, import_react12.useState)(
|
|
1146
1368
|
defaultValue ?? (multiple ? [] : "")
|
|
1147
1369
|
);
|
|
1148
1370
|
const selectedValue = isControlled ? value : internalValue;
|
|
@@ -1150,13 +1372,13 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1150
1372
|
const selectedOptions = options.filter(
|
|
1151
1373
|
(option) => selectedValues.some((item) => String(item) === String(option.value))
|
|
1152
1374
|
);
|
|
1153
|
-
const [open, setOpen] = (0,
|
|
1154
|
-
const [query, setQuery] = (0,
|
|
1155
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
1156
|
-
const rootRef = (0,
|
|
1157
|
-
const menuRef = (0,
|
|
1158
|
-
const [menuPosition, setMenuPosition] = (0,
|
|
1159
|
-
(0,
|
|
1375
|
+
const [open, setOpen] = (0, import_react12.useState)(false);
|
|
1376
|
+
const [query, setQuery] = (0, import_react12.useState)("");
|
|
1377
|
+
const [activeIndex, setActiveIndex] = (0, import_react12.useState)(0);
|
|
1378
|
+
const rootRef = (0, import_react12.useRef)(null);
|
|
1379
|
+
const menuRef = (0, import_react12.useRef)(null);
|
|
1380
|
+
const [menuPosition, setMenuPosition] = (0, import_react12.useState)(null);
|
|
1381
|
+
(0, import_react12.useEffect)(() => {
|
|
1160
1382
|
const close = (event) => {
|
|
1161
1383
|
const target = event.target;
|
|
1162
1384
|
if (!rootRef.current?.contains(target) && !menuRef.current?.contains(target))
|
|
@@ -1165,7 +1387,7 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1165
1387
|
document.addEventListener("mousedown", close);
|
|
1166
1388
|
return () => document.removeEventListener("mousedown", close);
|
|
1167
1389
|
}, []);
|
|
1168
|
-
(0,
|
|
1390
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
1169
1391
|
if (!open) return;
|
|
1170
1392
|
const updateMenuPosition = () => {
|
|
1171
1393
|
const rect = rootRef.current?.getBoundingClientRect();
|
|
@@ -1242,7 +1464,7 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1242
1464
|
}
|
|
1243
1465
|
if (event.key === "Escape") setOpen(false);
|
|
1244
1466
|
};
|
|
1245
|
-
return /* @__PURE__ */ (0,
|
|
1467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1246
1468
|
"div",
|
|
1247
1469
|
{
|
|
1248
1470
|
ref,
|
|
@@ -1257,7 +1479,7 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1257
1479
|
].filter(Boolean).join(" "),
|
|
1258
1480
|
...props,
|
|
1259
1481
|
children: [
|
|
1260
|
-
/* @__PURE__ */ (0,
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1261
1483
|
FieldLabel,
|
|
1262
1484
|
{
|
|
1263
1485
|
id: labelId,
|
|
@@ -1267,8 +1489,8 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1267
1489
|
isRequired
|
|
1268
1490
|
}
|
|
1269
1491
|
),
|
|
1270
|
-
/* @__PURE__ */ (0,
|
|
1271
|
-
name && selectedValues.map((item) => /* @__PURE__ */ (0,
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: rootRef, className: "fe-selection__control", children: [
|
|
1493
|
+
name && selectedValues.map((item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1272
1494
|
"input",
|
|
1273
1495
|
{
|
|
1274
1496
|
type: "hidden",
|
|
@@ -1277,7 +1499,7 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1277
1499
|
},
|
|
1278
1500
|
String(item)
|
|
1279
1501
|
)),
|
|
1280
|
-
/* @__PURE__ */ (0,
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1281
1503
|
"button",
|
|
1282
1504
|
{
|
|
1283
1505
|
id: triggerId,
|
|
@@ -1295,7 +1517,7 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1295
1517
|
onClick: () => setOpen((current) => !current),
|
|
1296
1518
|
onKeyDown: onTriggerKeyDown,
|
|
1297
1519
|
children: [
|
|
1298
|
-
/* @__PURE__ */ (0,
|
|
1520
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1299
1521
|
"span",
|
|
1300
1522
|
{
|
|
1301
1523
|
className: [
|
|
@@ -1303,30 +1525,30 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1303
1525
|
!selectedOptions.length && "is-placeholder",
|
|
1304
1526
|
tag && selectedOptions.length > 1 && "is-tags"
|
|
1305
1527
|
].filter(Boolean).join(" "),
|
|
1306
|
-
children: displayLabel ? tag && multiple ? selectedOptions.map((option) => /* @__PURE__ */ (0,
|
|
1528
|
+
children: displayLabel ? tag && multiple ? selectedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1307
1529
|
"span",
|
|
1308
1530
|
{
|
|
1309
1531
|
className: "fe-selection__tag",
|
|
1310
1532
|
children: [
|
|
1311
1533
|
option.label,
|
|
1312
|
-
/* @__PURE__ */ (0,
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "aria-hidden": "true", children: "\xD7" })
|
|
1313
1535
|
]
|
|
1314
1536
|
},
|
|
1315
1537
|
String(option.value)
|
|
1316
|
-
)) : displayLabel.map((item, index) => /* @__PURE__ */ (0,
|
|
1538
|
+
)) : displayLabel.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
|
|
1317
1539
|
item,
|
|
1318
1540
|
index < displayLabel.length - 1 ? ", " : ""
|
|
1319
|
-
] }, index)) : /* @__PURE__ */ (0,
|
|
1320
|
-
/* @__PURE__ */ (0,
|
|
1321
|
-
isRequired && /* @__PURE__ */ (0,
|
|
1541
|
+
] }, index)) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: placeholder }),
|
|
1543
|
+
isRequired && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" })
|
|
1322
1544
|
] })
|
|
1323
1545
|
}
|
|
1324
1546
|
),
|
|
1325
|
-
/* @__PURE__ */ (0,
|
|
1547
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fe-selection__actions", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fe-selection__chevron", "aria-hidden": "true" }) })
|
|
1326
1548
|
]
|
|
1327
1549
|
}
|
|
1328
1550
|
),
|
|
1329
|
-
clearable && selectedOptions.length > 0 && !disabled && /* @__PURE__ */ (0,
|
|
1551
|
+
clearable && selectedOptions.length > 0 && !disabled && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1330
1552
|
"button",
|
|
1331
1553
|
{
|
|
1332
1554
|
type: "button",
|
|
@@ -1336,7 +1558,7 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1336
1558
|
}
|
|
1337
1559
|
),
|
|
1338
1560
|
open && menuPosition && (0, import_react_dom2.createPortal)(
|
|
1339
|
-
/* @__PURE__ */ (0,
|
|
1561
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1340
1562
|
"div",
|
|
1341
1563
|
{
|
|
1342
1564
|
ref: menuRef,
|
|
@@ -1351,9 +1573,9 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1351
1573
|
role: "listbox",
|
|
1352
1574
|
"aria-multiselectable": multiple || void 0,
|
|
1353
1575
|
children: [
|
|
1354
|
-
searchable && /* @__PURE__ */ (0,
|
|
1355
|
-
/* @__PURE__ */ (0,
|
|
1356
|
-
/* @__PURE__ */ (0,
|
|
1576
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "fe-selection__search", children: [
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "aria-hidden": "true", children: "\u2315" }),
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1357
1579
|
"input",
|
|
1358
1580
|
{
|
|
1359
1581
|
autoFocus: true,
|
|
@@ -1367,11 +1589,11 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1367
1589
|
}
|
|
1368
1590
|
)
|
|
1369
1591
|
] }),
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1592
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "fe-selection__options", children: filteredOptions.length ? filteredOptions.map((option, index) => {
|
|
1371
1593
|
const isSelected = selectedValues.some(
|
|
1372
1594
|
(item) => String(item) === String(option.value)
|
|
1373
1595
|
);
|
|
1374
|
-
return /* @__PURE__ */ (0,
|
|
1596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1375
1597
|
"button",
|
|
1376
1598
|
{
|
|
1377
1599
|
type: "button",
|
|
@@ -1385,8 +1607,8 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1385
1607
|
onMouseMove: () => setActiveIndex(index),
|
|
1386
1608
|
onClick: () => choose(option),
|
|
1387
1609
|
children: [
|
|
1388
|
-
/* @__PURE__ */ (0,
|
|
1389
|
-
isSelected && /* @__PURE__ */ (0,
|
|
1610
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: option.label }),
|
|
1611
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1390
1612
|
"span",
|
|
1391
1613
|
{
|
|
1392
1614
|
className: "fe-selection__check",
|
|
@@ -1398,14 +1620,14 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1398
1620
|
},
|
|
1399
1621
|
String(option.value)
|
|
1400
1622
|
);
|
|
1401
|
-
}) : /* @__PURE__ */ (0,
|
|
1623
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "fe-selection__empty", children: "No matching options" }) })
|
|
1402
1624
|
]
|
|
1403
1625
|
}
|
|
1404
1626
|
),
|
|
1405
1627
|
document.body
|
|
1406
1628
|
)
|
|
1407
1629
|
] }),
|
|
1408
|
-
/* @__PURE__ */ (0,
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1409
1631
|
FieldMessage,
|
|
1410
1632
|
{
|
|
1411
1633
|
id: messageId2,
|
|
@@ -1422,8 +1644,8 @@ var Selection = (0, import_react11.forwardRef)(
|
|
|
1422
1644
|
Selection.displayName = "Selection";
|
|
1423
1645
|
|
|
1424
1646
|
// packages/form-controls/src/controls/NumberInput/number-input.tsx
|
|
1425
|
-
var
|
|
1426
|
-
var
|
|
1647
|
+
var import_react13 = require("react");
|
|
1648
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1427
1649
|
function formatNumber(value, decimals = 2, thousandSeparator = ",", decimalSeparator = ".") {
|
|
1428
1650
|
return new Intl.NumberFormat("en-US", {
|
|
1429
1651
|
minimumFractionDigits: 0,
|
|
@@ -1480,7 +1702,7 @@ function normalizeNumberInput(raw, options) {
|
|
|
1480
1702
|
value
|
|
1481
1703
|
};
|
|
1482
1704
|
}
|
|
1483
|
-
var NumberInput = (0,
|
|
1705
|
+
var NumberInput = (0, import_react13.forwardRef)(
|
|
1484
1706
|
function NumberInput2({
|
|
1485
1707
|
value,
|
|
1486
1708
|
defaultValue = null,
|
|
@@ -1517,14 +1739,14 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1517
1739
|
onKeyDown,
|
|
1518
1740
|
...props
|
|
1519
1741
|
}, ref) {
|
|
1520
|
-
const inputRef = (0,
|
|
1521
|
-
const generatedId = (0,
|
|
1742
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
1743
|
+
const generatedId = (0, import_react13.useId)();
|
|
1522
1744
|
const messageId2 = generatedId + "-message";
|
|
1523
1745
|
const isControlled = value !== void 0;
|
|
1524
|
-
const [internalValue, setInternalValue] = (0,
|
|
1525
|
-
const [focused, setFocused] = (0,
|
|
1746
|
+
const [internalValue, setInternalValue] = (0, import_react13.useState)(defaultValue);
|
|
1747
|
+
const [focused, setFocused] = (0, import_react13.useState)(false);
|
|
1526
1748
|
const actualValue = isControlled ? value ?? null : internalValue;
|
|
1527
|
-
const [text, setText] = (0,
|
|
1749
|
+
const [text, setText] = (0, import_react13.useState)(
|
|
1528
1750
|
actualValue === null ? "" : formatNumber(
|
|
1529
1751
|
actualValue,
|
|
1530
1752
|
decimals,
|
|
@@ -1547,7 +1769,7 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1547
1769
|
);
|
|
1548
1770
|
const resolvedPrefix = prefix ?? Prefix;
|
|
1549
1771
|
const resolvedSuffix = suffix ?? Suffix;
|
|
1550
|
-
(0,
|
|
1772
|
+
(0, import_react13.useEffect)(() => {
|
|
1551
1773
|
if (!focused)
|
|
1552
1774
|
setText(
|
|
1553
1775
|
actualValue === null ? "" : formatNumber(
|
|
@@ -1601,7 +1823,7 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1601
1823
|
const stepIsUsable = Number.isFinite(step) && step > 0;
|
|
1602
1824
|
const disableIncrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || max !== void 0 && actualValue !== null && actualValue >= max;
|
|
1603
1825
|
const disableDecrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || min !== void 0 && actualValue !== null && actualValue <= min;
|
|
1604
|
-
return /* @__PURE__ */ (0,
|
|
1826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1605
1827
|
"div",
|
|
1606
1828
|
{
|
|
1607
1829
|
className: [
|
|
@@ -1610,7 +1832,7 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1610
1832
|
className
|
|
1611
1833
|
].filter(Boolean).join(" "),
|
|
1612
1834
|
children: [
|
|
1613
|
-
/* @__PURE__ */ (0,
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1614
1836
|
FieldLabel,
|
|
1615
1837
|
{
|
|
1616
1838
|
id: labelId,
|
|
@@ -1620,10 +1842,10 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1620
1842
|
isRequired
|
|
1621
1843
|
}
|
|
1622
1844
|
),
|
|
1623
|
-
/* @__PURE__ */ (0,
|
|
1624
|
-
resolvedPrefix && /* @__PURE__ */ (0,
|
|
1625
|
-
/* @__PURE__ */ (0,
|
|
1626
|
-
/* @__PURE__ */ (0,
|
|
1845
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "fe-number-input__control", children: [
|
|
1846
|
+
resolvedPrefix && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "fe-number-input__prefix", children: resolvedPrefix }),
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "fe-number-input__input-wrap", children: [
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1627
1849
|
"input",
|
|
1628
1850
|
{
|
|
1629
1851
|
ref: (node) => {
|
|
@@ -1659,41 +1881,41 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1659
1881
|
"aria-describedby": describedBy
|
|
1660
1882
|
}
|
|
1661
1883
|
),
|
|
1662
|
-
isRequired && placeholder && !text && /* @__PURE__ */ (0,
|
|
1884
|
+
isRequired && placeholder && !text && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1663
1885
|
"span",
|
|
1664
1886
|
{
|
|
1665
1887
|
className: "fe-number-input__placeholder",
|
|
1666
1888
|
"aria-hidden": "true",
|
|
1667
1889
|
children: [
|
|
1668
|
-
/* @__PURE__ */ (0,
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
1890
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: placeholder }),
|
|
1891
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "fe-field__required", children: "*" })
|
|
1670
1892
|
]
|
|
1671
1893
|
}
|
|
1672
1894
|
)
|
|
1673
1895
|
] }),
|
|
1674
|
-
resolvedSuffix && /* @__PURE__ */ (0,
|
|
1896
|
+
resolvedSuffix && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "fe-number-input__suffix", children: resolvedSuffix }),
|
|
1675
1897
|
endAdornment,
|
|
1676
|
-
showStepper && /* @__PURE__ */ (0,
|
|
1677
|
-
/* @__PURE__ */ (0,
|
|
1898
|
+
showStepper && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "fe-number-input__stepper", children: [
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1678
1900
|
Button,
|
|
1679
1901
|
{
|
|
1680
1902
|
hierarchy: "tertiary-gray",
|
|
1681
1903
|
size: "24",
|
|
1682
1904
|
iconOnly: true,
|
|
1683
|
-
icon: /* @__PURE__ */ (0,
|
|
1905
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronUpIcon, { size: 12 }),
|
|
1684
1906
|
"aria-label": incrementLabel,
|
|
1685
1907
|
disabled: disableIncrement,
|
|
1686
1908
|
onMouseDown: (event) => event.preventDefault(),
|
|
1687
1909
|
onClick: () => adjustValue(1)
|
|
1688
1910
|
}
|
|
1689
1911
|
),
|
|
1690
|
-
/* @__PURE__ */ (0,
|
|
1912
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1691
1913
|
Button,
|
|
1692
1914
|
{
|
|
1693
1915
|
hierarchy: "tertiary-gray",
|
|
1694
1916
|
size: "24",
|
|
1695
1917
|
iconOnly: true,
|
|
1696
|
-
icon: /* @__PURE__ */ (0,
|
|
1918
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDownIcon, { size: 12 }),
|
|
1697
1919
|
"aria-label": decrementLabel,
|
|
1698
1920
|
disabled: disableDecrement,
|
|
1699
1921
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -1702,7 +1924,7 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1702
1924
|
)
|
|
1703
1925
|
] })
|
|
1704
1926
|
] }),
|
|
1705
|
-
/* @__PURE__ */ (0,
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1706
1928
|
FieldMessage,
|
|
1707
1929
|
{
|
|
1708
1930
|
id: messageId2,
|
|
@@ -1719,8 +1941,8 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1719
1941
|
NumberInput.displayName = "NumberInput";
|
|
1720
1942
|
|
|
1721
1943
|
// packages/form-controls/src/controls/CurrencyInput/currency-input.tsx
|
|
1722
|
-
var
|
|
1723
|
-
var
|
|
1944
|
+
var import_react14 = require("react");
|
|
1945
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1724
1946
|
function CurrencyInput({
|
|
1725
1947
|
suffix = "VND",
|
|
1726
1948
|
currencies,
|
|
@@ -1731,13 +1953,13 @@ function CurrencyInput({
|
|
|
1731
1953
|
disabled,
|
|
1732
1954
|
...props
|
|
1733
1955
|
}) {
|
|
1734
|
-
const [internalCurrency, setInternalCurrency] = (0,
|
|
1956
|
+
const [internalCurrency, setInternalCurrency] = (0, import_react14.useState)(
|
|
1735
1957
|
defaultCurrency ?? currencies?.[0]?.code ?? ""
|
|
1736
1958
|
);
|
|
1737
1959
|
const selectedCurrency = currency ?? internalCurrency;
|
|
1738
1960
|
const current = currencies?.find((item) => item.code === selectedCurrency);
|
|
1739
1961
|
const currencySuffix = current?.suffix ?? current?.code ?? suffix;
|
|
1740
|
-
const endAdornment = currencies?.length ? /* @__PURE__ */ (0,
|
|
1962
|
+
const endAdornment = currencies?.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1741
1963
|
Selection,
|
|
1742
1964
|
{
|
|
1743
1965
|
className: "fe-currency-input__currency",
|
|
@@ -1756,8 +1978,8 @@ function CurrencyInput({
|
|
|
1756
1978
|
onCurrencyChange?.(next);
|
|
1757
1979
|
}
|
|
1758
1980
|
}
|
|
1759
|
-
) : /* @__PURE__ */ (0,
|
|
1760
|
-
return /* @__PURE__ */ (0,
|
|
1981
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fe-currency-input__suffix", children: currencySuffix });
|
|
1982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1761
1983
|
NumberInput,
|
|
1762
1984
|
{
|
|
1763
1985
|
...props,
|
|
@@ -1769,8 +1991,8 @@ function CurrencyInput({
|
|
|
1769
1991
|
}
|
|
1770
1992
|
|
|
1771
1993
|
// packages/form-controls/src/controls/DateTimePicker/date-time-picker.tsx
|
|
1772
|
-
var
|
|
1773
|
-
var
|
|
1994
|
+
var import_react15 = require("react");
|
|
1995
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1774
1996
|
var pad = (value) => String(value).padStart(2, "0");
|
|
1775
1997
|
function formatDate(date, format) {
|
|
1776
1998
|
return format.replace(/yyyy/g, String(date.getFullYear())).replace(/MM/g, pad(date.getMonth() + 1)).replace(/dd/g, pad(date.getDate())).replace(/HH/g, pad(date.getHours())).replace(/mm/g, pad(date.getMinutes()));
|
|
@@ -1806,7 +2028,7 @@ function DateTimePicker(props) {
|
|
|
1806
2028
|
"aria-describedby": ariaDescribedBy,
|
|
1807
2029
|
"aria-labelledby": ariaLabelledBy
|
|
1808
2030
|
} = props;
|
|
1809
|
-
const generatedId = (0,
|
|
2031
|
+
const generatedId = (0, import_react15.useId)();
|
|
1810
2032
|
const triggerId = id ?? generatedId + "-trigger";
|
|
1811
2033
|
const labelId = generatedId + "-label";
|
|
1812
2034
|
const messageId2 = generatedId + "-message";
|
|
@@ -1824,28 +2046,28 @@ function DateTimePicker(props) {
|
|
|
1824
2046
|
);
|
|
1825
2047
|
const isRange = mode === "range";
|
|
1826
2048
|
const controlled = props.value !== void 0;
|
|
1827
|
-
const [singleInternal, setSingleInternal] = (0,
|
|
2049
|
+
const [singleInternal, setSingleInternal] = (0, import_react15.useState)(
|
|
1828
2050
|
(!isRange ? props.defaultValue : null) ?? null
|
|
1829
2051
|
);
|
|
1830
|
-
const [rangeInternal, setRangeInternal] = (0,
|
|
2052
|
+
const [rangeInternal, setRangeInternal] = (0, import_react15.useState)(
|
|
1831
2053
|
(isRange ? props.defaultValue : void 0) ?? [null, null]
|
|
1832
2054
|
);
|
|
1833
2055
|
const singleValue = !isRange ? props.value ?? singleInternal : null;
|
|
1834
2056
|
const rangeValue = isRange ? props.value ?? rangeInternal : [null, null];
|
|
1835
|
-
const [open, setOpen] = (0,
|
|
1836
|
-
const [month, setMonth] = (0,
|
|
2057
|
+
const [open, setOpen] = (0, import_react15.useState)(false);
|
|
2058
|
+
const [month, setMonth] = (0, import_react15.useState)(
|
|
1837
2059
|
() => new Date((isRange ? rangeValue[0] : singleValue) ?? /* @__PURE__ */ new Date())
|
|
1838
2060
|
);
|
|
1839
|
-
const [editingEnd, setEditingEnd] = (0,
|
|
1840
|
-
const rootRef = (0,
|
|
1841
|
-
(0,
|
|
2061
|
+
const [editingEnd, setEditingEnd] = (0, import_react15.useState)(false);
|
|
2062
|
+
const rootRef = (0, import_react15.useRef)(null);
|
|
2063
|
+
(0, import_react15.useEffect)(() => {
|
|
1842
2064
|
const onPointerDown = (event) => {
|
|
1843
2065
|
if (!rootRef.current?.contains(event.target)) setOpen(false);
|
|
1844
2066
|
};
|
|
1845
2067
|
document.addEventListener("mousedown", onPointerDown);
|
|
1846
2068
|
return () => document.removeEventListener("mousedown", onPointerDown);
|
|
1847
2069
|
}, []);
|
|
1848
|
-
(0,
|
|
2070
|
+
(0, import_react15.useEffect)(() => {
|
|
1849
2071
|
if (disabled) setOpen(false);
|
|
1850
2072
|
}, [disabled]);
|
|
1851
2073
|
const setSingle = (next) => {
|
|
@@ -1901,7 +2123,7 @@ function DateTimePicker(props) {
|
|
|
1901
2123
|
setRange(editingEnd ? [rangeValue[0], next] : [next, rangeValue[1]]);
|
|
1902
2124
|
else setSingle(next);
|
|
1903
2125
|
};
|
|
1904
|
-
return /* @__PURE__ */ (0,
|
|
2126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1905
2127
|
"div",
|
|
1906
2128
|
{
|
|
1907
2129
|
ref: rootRef,
|
|
@@ -1911,7 +2133,7 @@ function DateTimePicker(props) {
|
|
|
1911
2133
|
className
|
|
1912
2134
|
].filter(Boolean).join(" "),
|
|
1913
2135
|
children: [
|
|
1914
|
-
/* @__PURE__ */ (0,
|
|
2136
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1915
2137
|
FieldLabel,
|
|
1916
2138
|
{
|
|
1917
2139
|
id: labelId,
|
|
@@ -1921,7 +2143,7 @@ function DateTimePicker(props) {
|
|
|
1921
2143
|
isRequired
|
|
1922
2144
|
}
|
|
1923
2145
|
),
|
|
1924
|
-
/* @__PURE__ */ (0,
|
|
2146
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1925
2147
|
"button",
|
|
1926
2148
|
{
|
|
1927
2149
|
id: triggerId,
|
|
@@ -1935,29 +2157,29 @@ function DateTimePicker(props) {
|
|
|
1935
2157
|
"aria-expanded": open,
|
|
1936
2158
|
onClick: () => setOpen((current) => !current),
|
|
1937
2159
|
children: [
|
|
1938
|
-
/* @__PURE__ */ (0,
|
|
1939
|
-
/* @__PURE__ */ (0,
|
|
2160
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { "aria-hidden": "true", children: "\u25F7" }),
|
|
2161
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1940
2162
|
"span",
|
|
1941
2163
|
{
|
|
1942
2164
|
className: !shownValue && placeholder ? "fe-datetime-picker__value is-placeholder" : "fe-datetime-picker__value",
|
|
1943
2165
|
children: [
|
|
1944
2166
|
shownValue || placeholder || (isRange ? "Select date range" : "Select date and time"),
|
|
1945
|
-
isRequired && placeholder && !shownValue && /* @__PURE__ */ (0,
|
|
2167
|
+
isRequired && placeholder && !shownValue && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" })
|
|
1946
2168
|
]
|
|
1947
2169
|
}
|
|
1948
2170
|
)
|
|
1949
2171
|
]
|
|
1950
2172
|
}
|
|
1951
2173
|
),
|
|
1952
|
-
open && /* @__PURE__ */ (0,
|
|
2174
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1953
2175
|
"div",
|
|
1954
2176
|
{
|
|
1955
2177
|
className: "fe-datetime-picker__popper",
|
|
1956
2178
|
role: "dialog",
|
|
1957
2179
|
"aria-label": "Date and time picker",
|
|
1958
2180
|
children: [
|
|
1959
|
-
/* @__PURE__ */ (0,
|
|
1960
|
-
/* @__PURE__ */ (0,
|
|
2181
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "fe-datetime-picker__month", children: [
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1961
2183
|
"button",
|
|
1962
2184
|
{
|
|
1963
2185
|
type: "button",
|
|
@@ -1968,11 +2190,11 @@ function DateTimePicker(props) {
|
|
|
1968
2190
|
children: "\u2039"
|
|
1969
2191
|
}
|
|
1970
2192
|
),
|
|
1971
|
-
/* @__PURE__ */ (0,
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { children: month.toLocaleDateString(locale, {
|
|
1972
2194
|
month: "long",
|
|
1973
2195
|
year: "numeric"
|
|
1974
2196
|
}) }),
|
|
1975
|
-
/* @__PURE__ */ (0,
|
|
2197
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1976
2198
|
"button",
|
|
1977
2199
|
{
|
|
1978
2200
|
type: "button",
|
|
@@ -1984,12 +2206,12 @@ function DateTimePicker(props) {
|
|
|
1984
2206
|
}
|
|
1985
2207
|
)
|
|
1986
2208
|
] }),
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
1988
|
-
/* @__PURE__ */ (0,
|
|
2209
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "fe-datetime-picker__weekdays", children: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((day) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: day }, day)) }),
|
|
2210
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "fe-datetime-picker__days", children: days.map((day) => {
|
|
1989
2211
|
const inMonth = day.getMonth() === month.getMonth();
|
|
1990
2212
|
const selected = isRange ? sameDay(day, rangeValue[0]) || sameDay(day, rangeValue[1]) : sameDay(day, singleValue);
|
|
1991
2213
|
const inRange = isRange && rangeValue[0] && rangeValue[1] && day > startOfDay(rangeValue[0]) && day < startOfDay(rangeValue[1]);
|
|
1992
|
-
return /* @__PURE__ */ (0,
|
|
2214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1993
2215
|
"button",
|
|
1994
2216
|
{
|
|
1995
2217
|
type: "button",
|
|
@@ -2004,8 +2226,8 @@ function DateTimePicker(props) {
|
|
|
2004
2226
|
day.toISOString()
|
|
2005
2227
|
);
|
|
2006
2228
|
}) }),
|
|
2007
|
-
isRange && /* @__PURE__ */ (0,
|
|
2008
|
-
/* @__PURE__ */ (0,
|
|
2229
|
+
isRange && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "fe-datetime-picker__range-tabs", children: [
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2009
2231
|
"button",
|
|
2010
2232
|
{
|
|
2011
2233
|
type: "button",
|
|
@@ -2014,7 +2236,7 @@ function DateTimePicker(props) {
|
|
|
2014
2236
|
children: "Start"
|
|
2015
2237
|
}
|
|
2016
2238
|
),
|
|
2017
|
-
/* @__PURE__ */ (0,
|
|
2239
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2018
2240
|
"button",
|
|
2019
2241
|
{
|
|
2020
2242
|
type: "button",
|
|
@@ -2024,9 +2246,9 @@ function DateTimePicker(props) {
|
|
|
2024
2246
|
}
|
|
2025
2247
|
)
|
|
2026
2248
|
] }),
|
|
2027
|
-
/* @__PURE__ */ (0,
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "fe-datetime-picker__time", children: [
|
|
2028
2250
|
"Time",
|
|
2029
|
-
/* @__PURE__ */ (0,
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2030
2252
|
"input",
|
|
2031
2253
|
{
|
|
2032
2254
|
type: "time",
|
|
@@ -2039,7 +2261,7 @@ function DateTimePicker(props) {
|
|
|
2039
2261
|
]
|
|
2040
2262
|
}
|
|
2041
2263
|
),
|
|
2042
|
-
/* @__PURE__ */ (0,
|
|
2264
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2043
2265
|
FieldMessage,
|
|
2044
2266
|
{
|
|
2045
2267
|
id: messageId2,
|
|
@@ -2054,9 +2276,9 @@ function DateTimePicker(props) {
|
|
|
2054
2276
|
}
|
|
2055
2277
|
|
|
2056
2278
|
// packages/form-controls/src/controls/Checkbox/checkbox.tsx
|
|
2057
|
-
var
|
|
2058
|
-
var
|
|
2059
|
-
var Checkbox = (0,
|
|
2279
|
+
var import_react16 = require("react");
|
|
2280
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2281
|
+
var Checkbox = (0, import_react16.forwardRef)(
|
|
2060
2282
|
function Checkbox2({
|
|
2061
2283
|
label,
|
|
2062
2284
|
labelPosition = "right",
|
|
@@ -2072,10 +2294,10 @@ var Checkbox = (0, import_react15.forwardRef)(
|
|
|
2072
2294
|
disabled && "fe-checkbox--disabled",
|
|
2073
2295
|
className
|
|
2074
2296
|
].filter(Boolean).join(" ");
|
|
2075
|
-
return /* @__PURE__ */ (0,
|
|
2076
|
-
label && labelPosition === "top" && /* @__PURE__ */ (0,
|
|
2077
|
-
/* @__PURE__ */ (0,
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: classes, style, children: [
|
|
2298
|
+
label && labelPosition === "top" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fe-checkbox__label", children: label }),
|
|
2299
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "fe-checkbox__content", children: [
|
|
2300
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2079
2301
|
"input",
|
|
2080
2302
|
{
|
|
2081
2303
|
ref,
|
|
@@ -2086,8 +2308,8 @@ var Checkbox = (0, import_react15.forwardRef)(
|
|
|
2086
2308
|
...props
|
|
2087
2309
|
}
|
|
2088
2310
|
),
|
|
2089
|
-
/* @__PURE__ */ (0,
|
|
2090
|
-
label && labelPosition === "right" && /* @__PURE__ */ (0,
|
|
2311
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fe-checkbox__control", "aria-hidden": "true" }),
|
|
2312
|
+
label && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "fe-checkbox__label", children: label })
|
|
2091
2313
|
] })
|
|
2092
2314
|
] });
|
|
2093
2315
|
}
|
|
@@ -2095,9 +2317,9 @@ var Checkbox = (0, import_react15.forwardRef)(
|
|
|
2095
2317
|
Checkbox.displayName = "Checkbox";
|
|
2096
2318
|
|
|
2097
2319
|
// packages/form-controls/src/controls/RadioButton/radio-button.tsx
|
|
2098
|
-
var
|
|
2099
|
-
var
|
|
2100
|
-
var RadioButton = (0,
|
|
2320
|
+
var import_react17 = require("react");
|
|
2321
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2322
|
+
var RadioButton = (0, import_react17.forwardRef)(
|
|
2101
2323
|
function RadioButton2({
|
|
2102
2324
|
label,
|
|
2103
2325
|
labelPosition = "right",
|
|
@@ -2113,10 +2335,10 @@ var RadioButton = (0, import_react16.forwardRef)(
|
|
|
2113
2335
|
disabled && "fe-radio-button--disabled",
|
|
2114
2336
|
className
|
|
2115
2337
|
].filter(Boolean).join(" ");
|
|
2116
|
-
return /* @__PURE__ */ (0,
|
|
2117
|
-
label && labelPosition === "top" && /* @__PURE__ */ (0,
|
|
2118
|
-
/* @__PURE__ */ (0,
|
|
2119
|
-
/* @__PURE__ */ (0,
|
|
2338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: classes, style, children: [
|
|
2339
|
+
label && labelPosition === "top" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fe-radio-button__label", children: label }),
|
|
2340
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "fe-radio-button__content", children: [
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2120
2342
|
"input",
|
|
2121
2343
|
{
|
|
2122
2344
|
ref,
|
|
@@ -2127,8 +2349,8 @@ var RadioButton = (0, import_react16.forwardRef)(
|
|
|
2127
2349
|
...props
|
|
2128
2350
|
}
|
|
2129
2351
|
),
|
|
2130
|
-
/* @__PURE__ */ (0,
|
|
2131
|
-
label && labelPosition === "right" && /* @__PURE__ */ (0,
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fe-radio-button__control", "aria-hidden": "true" }),
|
|
2353
|
+
label && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fe-radio-button__label", children: label })
|
|
2132
2354
|
] })
|
|
2133
2355
|
] });
|
|
2134
2356
|
}
|
|
@@ -2136,9 +2358,9 @@ var RadioButton = (0, import_react16.forwardRef)(
|
|
|
2136
2358
|
RadioButton.displayName = "RadioButton";
|
|
2137
2359
|
|
|
2138
2360
|
// packages/form-controls/src/controls/RadioGroup/radio-group.tsx
|
|
2139
|
-
var
|
|
2140
|
-
var
|
|
2141
|
-
var RadioGroup = (0,
|
|
2361
|
+
var import_react18 = require("react");
|
|
2362
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2363
|
+
var RadioGroup = (0, import_react18.forwardRef)(
|
|
2142
2364
|
function RadioGroup2({
|
|
2143
2365
|
label,
|
|
2144
2366
|
labelPosition = "top",
|
|
@@ -2156,7 +2378,7 @@ var RadioGroup = (0, import_react17.forwardRef)(
|
|
|
2156
2378
|
"aria-labelledby": ariaLabelledBy,
|
|
2157
2379
|
...props
|
|
2158
2380
|
}, ref) {
|
|
2159
|
-
const generatedId = (0,
|
|
2381
|
+
const generatedId = (0, import_react18.useId)();
|
|
2160
2382
|
const groupName = name ?? `fe-radio-group-${generatedId}`;
|
|
2161
2383
|
const labelId = `${id ?? generatedId}-label`;
|
|
2162
2384
|
const isControlled = value !== void 0;
|
|
@@ -2170,12 +2392,12 @@ var RadioGroup = (0, import_react17.forwardRef)(
|
|
|
2170
2392
|
const handleChange = (option, event) => {
|
|
2171
2393
|
if (event.target.checked) onChange?.(option.value, option, event);
|
|
2172
2394
|
};
|
|
2173
|
-
return /* @__PURE__ */ (0,
|
|
2174
|
-
label && labelPosition === "top" && /* @__PURE__ */ (0,
|
|
2395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { ref, className: classes, ...props, children: [
|
|
2396
|
+
label && labelPosition === "top" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { id: labelId, className: "fe-radio-group__label", children: [
|
|
2175
2397
|
label,
|
|
2176
|
-
isRequired && /* @__PURE__ */ (0,
|
|
2398
|
+
isRequired && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
2177
2399
|
] }),
|
|
2178
|
-
/* @__PURE__ */ (0,
|
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2179
2401
|
"div",
|
|
2180
2402
|
{
|
|
2181
2403
|
id,
|
|
@@ -2187,7 +2409,7 @@ var RadioGroup = (0, import_react17.forwardRef)(
|
|
|
2187
2409
|
children: options.map((option) => {
|
|
2188
2410
|
const optionDisabled = disabled || option.disabled;
|
|
2189
2411
|
const optionValue = String(option.value);
|
|
2190
|
-
return /* @__PURE__ */ (0,
|
|
2412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2191
2413
|
RadioButton,
|
|
2192
2414
|
{
|
|
2193
2415
|
name: groupName,
|
|
@@ -2204,9 +2426,9 @@ var RadioGroup = (0, import_react17.forwardRef)(
|
|
|
2204
2426
|
})
|
|
2205
2427
|
}
|
|
2206
2428
|
),
|
|
2207
|
-
label && labelPosition === "right" && /* @__PURE__ */ (0,
|
|
2429
|
+
label && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { id: labelId, className: "fe-radio-group__label", children: [
|
|
2208
2430
|
label,
|
|
2209
|
-
isRequired && /* @__PURE__ */ (0,
|
|
2431
|
+
isRequired && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
2210
2432
|
] })
|
|
2211
2433
|
] });
|
|
2212
2434
|
}
|
|
@@ -2214,29 +2436,29 @@ var RadioGroup = (0, import_react17.forwardRef)(
|
|
|
2214
2436
|
RadioGroup.displayName = "RadioGroup";
|
|
2215
2437
|
|
|
2216
2438
|
// packages/expandable-section/src/index.tsx
|
|
2217
|
-
var
|
|
2218
|
-
var
|
|
2439
|
+
var import_react19 = require("react");
|
|
2440
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2219
2441
|
function ExpandableSection({ title, children, expanded, defaultExpanded = false, onExpandedChange, disabled, className, ...props }) {
|
|
2220
|
-
const [internalExpanded, setInternalExpanded] = (0,
|
|
2442
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react19.useState)(defaultExpanded);
|
|
2221
2443
|
const isExpanded = expanded ?? internalExpanded;
|
|
2222
|
-
const id = (0,
|
|
2444
|
+
const id = (0, import_react19.useId)();
|
|
2223
2445
|
const toggle = () => {
|
|
2224
2446
|
if (disabled) return;
|
|
2225
2447
|
const next = !isExpanded;
|
|
2226
2448
|
if (expanded === void 0) setInternalExpanded(next);
|
|
2227
2449
|
onExpandedChange?.(next);
|
|
2228
2450
|
};
|
|
2229
|
-
return /* @__PURE__ */ (0,
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2231
|
-
/* @__PURE__ */ (0,
|
|
2232
|
-
/* @__PURE__ */ (0,
|
|
2451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: ["fe-expandable-section", isExpanded && "fe-expandable-section--expanded", disabled && "fe-expandable-section--disabled", className].filter(Boolean).join(" "), ...props, children: [
|
|
2452
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("button", { className: "fe-expandable-section__trigger", type: "button", "aria-expanded": isExpanded, "aria-controls": id, disabled, onClick: toggle, children: [
|
|
2453
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: title }),
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "fe-expandable-section__chevron", "aria-hidden": "true" })
|
|
2233
2455
|
] }),
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2456
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { id, className: "fe-expandable-section__content", "aria-hidden": !isExpanded, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "fe-expandable-section__content-inner", children }) })
|
|
2235
2457
|
] });
|
|
2236
2458
|
}
|
|
2237
2459
|
|
|
2238
2460
|
// packages/loading/src/index.tsx
|
|
2239
|
-
var
|
|
2461
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2240
2462
|
var sizes = {
|
|
2241
2463
|
small: "16px",
|
|
2242
2464
|
medium: "24px",
|
|
@@ -2249,15 +2471,15 @@ function Loading({ size = "medium", color = "#2878f0", label, className, style,
|
|
|
2249
2471
|
"--fe-loading-color": color,
|
|
2250
2472
|
...style
|
|
2251
2473
|
};
|
|
2252
|
-
return /* @__PURE__ */ (0,
|
|
2253
|
-
/* @__PURE__ */ (0,
|
|
2254
|
-
label && /* @__PURE__ */ (0,
|
|
2255
|
-
!label && /* @__PURE__ */ (0,
|
|
2474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: ["fe-loading", className].filter(Boolean).join(" "), style: loadingStyle, role: "status", ...props, children: [
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fe-loading__spinner", "aria-hidden": "true" }),
|
|
2476
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fe-loading__label", children: label }),
|
|
2477
|
+
!label && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fe-loading__sr-only", children: "Loading" })
|
|
2256
2478
|
] });
|
|
2257
2479
|
}
|
|
2258
2480
|
|
|
2259
2481
|
// packages/skeleton/src/index.tsx
|
|
2260
|
-
var
|
|
2482
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2261
2483
|
var pixels = (value) => typeof value === "number" ? `${value}px` : value;
|
|
2262
2484
|
function SkeletonBase({ variant = "box", shape, width, height, count = 1, animated = true, className, style, ...props }) {
|
|
2263
2485
|
const resolvedVariant = shape ?? variant;
|
|
@@ -2268,7 +2490,7 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
2268
2490
|
"--fe-skeleton-height": resolvedHeight,
|
|
2269
2491
|
...style
|
|
2270
2492
|
};
|
|
2271
|
-
return /* @__PURE__ */ (0,
|
|
2493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: Array.from({ length: Math.max(1, count) }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2272
2494
|
"div",
|
|
2273
2495
|
{
|
|
2274
2496
|
className: ["fe-skeleton", `fe-skeleton--${resolvedVariant}`, animated && "fe-skeleton--animated", className].filter(Boolean).join(" "),
|
|
@@ -2280,16 +2502,16 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
2280
2502
|
)) });
|
|
2281
2503
|
}
|
|
2282
2504
|
function SkeletonCircle({ size = 40, ...props }) {
|
|
2283
|
-
return /* @__PURE__ */ (0,
|
|
2505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SkeletonBase, { variant: "circle", width: size, height: size, ...props });
|
|
2284
2506
|
}
|
|
2285
2507
|
function SkeletonSquare({ size = 80, ...props }) {
|
|
2286
|
-
return /* @__PURE__ */ (0,
|
|
2508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SkeletonBase, { variant: "box", width: size, height: size, ...props });
|
|
2287
2509
|
}
|
|
2288
2510
|
function SkeletonBox({ width = "100%", height = 80, ...props }) {
|
|
2289
|
-
return /* @__PURE__ */ (0,
|
|
2511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SkeletonBase, { variant: "box", width, height, ...props });
|
|
2290
2512
|
}
|
|
2291
2513
|
function SkeletonLine({ width = "100%", height = 12, ...props }) {
|
|
2292
|
-
return /* @__PURE__ */ (0,
|
|
2514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SkeletonBase, { variant: "line", width, height, ...props });
|
|
2293
2515
|
}
|
|
2294
2516
|
var Skeleton = Object.assign(SkeletonBase, {
|
|
2295
2517
|
Circle: SkeletonCircle,
|
|
@@ -2299,9 +2521,9 @@ var Skeleton = Object.assign(SkeletonBase, {
|
|
|
2299
2521
|
});
|
|
2300
2522
|
|
|
2301
2523
|
// packages/modal/src/index.tsx
|
|
2302
|
-
var
|
|
2524
|
+
var import_react20 = require("react");
|
|
2303
2525
|
var import_react_dom3 = require("react-dom");
|
|
2304
|
-
var
|
|
2526
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2305
2527
|
function Modal({
|
|
2306
2528
|
open,
|
|
2307
2529
|
onClose,
|
|
@@ -2317,9 +2539,9 @@ function Modal({
|
|
|
2317
2539
|
className,
|
|
2318
2540
|
...props
|
|
2319
2541
|
}) {
|
|
2320
|
-
const titleId = (0,
|
|
2321
|
-
const panelRef = (0,
|
|
2322
|
-
(0,
|
|
2542
|
+
const titleId = (0, import_react20.useId)();
|
|
2543
|
+
const panelRef = (0, import_react20.useRef)(null);
|
|
2544
|
+
(0, import_react20.useEffect)(() => {
|
|
2323
2545
|
if (!open) return;
|
|
2324
2546
|
const onKeyDown = (event) => {
|
|
2325
2547
|
if (event.key === "Escape") onClose();
|
|
@@ -2331,9 +2553,9 @@ function Modal({
|
|
|
2331
2553
|
if (!open || typeof document === "undefined") return null;
|
|
2332
2554
|
const hasFooter = footer || actions.length > 0;
|
|
2333
2555
|
return (0, import_react_dom3.createPortal)(
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "fe-modal-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
2335
2557
|
if (event.target === event.currentTarget && closeOnBackdropClick) onClose();
|
|
2336
|
-
}, children: /* @__PURE__ */ (0,
|
|
2558
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2337
2559
|
"div",
|
|
2338
2560
|
{
|
|
2339
2561
|
ref: panelRef,
|
|
@@ -2345,17 +2567,17 @@ function Modal({
|
|
|
2345
2567
|
tabIndex: -1,
|
|
2346
2568
|
...props,
|
|
2347
2569
|
children: [
|
|
2348
|
-
(title || description || closeButton) && /* @__PURE__ */ (0,
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2350
|
-
title && /* @__PURE__ */ (0,
|
|
2351
|
-
description && /* @__PURE__ */ (0,
|
|
2570
|
+
(title || description || closeButton) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("header", { className: "fe-modal__header", children: [
|
|
2571
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "fe-modal__heading", children: [
|
|
2572
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { id: titleId, children: title }),
|
|
2573
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { children: description })
|
|
2352
2574
|
] }),
|
|
2353
|
-
closeButton && /* @__PURE__ */ (0,
|
|
2575
|
+
closeButton && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { hierarchy: "tertiary-gray", size: "32", iconOnly: true, icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CloseIcon, {}), "aria-label": closeLabel, onClick: onClose })
|
|
2354
2576
|
] }),
|
|
2355
|
-
/* @__PURE__ */ (0,
|
|
2356
|
-
hasFooter && /* @__PURE__ */ (0,
|
|
2357
|
-
footer && /* @__PURE__ */ (0,
|
|
2358
|
-
actions.length > 0 && /* @__PURE__ */ (0,
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "fe-modal__body", children }),
|
|
2578
|
+
hasFooter && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("footer", { className: "fe-modal__footer", children: [
|
|
2579
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "fe-modal__footer-content", children: footer }),
|
|
2580
|
+
actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "fe-modal__actions", children: actions.map(({ label, ...action }, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { ...action, children: label }, index)) })
|
|
2359
2581
|
] })
|
|
2360
2582
|
]
|
|
2361
2583
|
}
|
|
@@ -2365,7 +2587,7 @@ function Modal({
|
|
|
2365
2587
|
}
|
|
2366
2588
|
|
|
2367
2589
|
// packages/progress/src/index.tsx
|
|
2368
|
-
var
|
|
2590
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2369
2591
|
function ProgressBar({ value, max = 100, label, showValue = true, size = "medium", color = "#2878f0", className, style, "aria-label": ariaLabel, ...props }) {
|
|
2370
2592
|
const indeterminate = value === null || value === void 0;
|
|
2371
2593
|
const percentage = indeterminate ? 0 : Math.min(100, Math.max(0, Number(value) / Math.max(1, max) * 100));
|
|
@@ -2375,17 +2597,17 @@ function ProgressBar({ value, max = 100, label, showValue = true, size = "medium
|
|
|
2375
2597
|
...style
|
|
2376
2598
|
};
|
|
2377
2599
|
const visibleValue = `${Math.round(percentage)}%`;
|
|
2378
|
-
return /* @__PURE__ */ (0,
|
|
2379
|
-
(label || !indeterminate && showValue) && /* @__PURE__ */ (0,
|
|
2380
|
-
label && /* @__PURE__ */ (0,
|
|
2381
|
-
!indeterminate && showValue && /* @__PURE__ */ (0,
|
|
2600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: ["fe-progress", `fe-progress--${size}`, indeterminate && "fe-progress--indeterminate", className].filter(Boolean).join(" "), style: progressStyle, ...props, children: [
|
|
2601
|
+
(label || !indeterminate && showValue) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fe-progress__meta", children: [
|
|
2602
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "fe-progress__label", children: label }),
|
|
2603
|
+
!indeterminate && showValue && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("output", { className: "fe-progress__value", children: visibleValue })
|
|
2382
2604
|
] }),
|
|
2383
|
-
/* @__PURE__ */ (0,
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)("span", { className: "fe-progress__indicator" }) })
|
|
2384
2606
|
] });
|
|
2385
2607
|
}
|
|
2386
2608
|
|
|
2387
2609
|
// packages/chip/src/index.tsx
|
|
2388
|
-
var
|
|
2610
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2389
2611
|
var statuses = ["default", "info", "success", "warning", "error", "neutral", "pending", "processing"];
|
|
2390
2612
|
function Chip({ children, status = "default", color, variant = "subtle", dot = false, onRemove, removeLabel = "Remove", className, style, ...props }) {
|
|
2391
2613
|
const usesCustomColor = Boolean(color);
|
|
@@ -2394,16 +2616,16 @@ function Chip({ children, status = "default", color, variant = "subtle", dot = f
|
|
|
2394
2616
|
...style
|
|
2395
2617
|
};
|
|
2396
2618
|
const resolvedStatus = statuses.includes(status) ? status : "default";
|
|
2397
|
-
return /* @__PURE__ */ (0,
|
|
2398
|
-
dot && /* @__PURE__ */ (0,
|
|
2399
|
-
/* @__PURE__ */ (0,
|
|
2400
|
-
onRemove && /* @__PURE__ */ (0,
|
|
2619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: ["fe-chip", `fe-chip--${variant}`, `fe-chip--${usesCustomColor ? "custom" : resolvedStatus}`, className].filter(Boolean).join(" "), style: chipStyle, ...props, children: [
|
|
2620
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fe-chip__dot", "aria-hidden": "true" }),
|
|
2621
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "fe-chip__content", children }),
|
|
2622
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CloseIcon, { size: 14 }), "aria-label": removeLabel, onClick: onRemove, className: "fe-chip__remove" })
|
|
2401
2623
|
] });
|
|
2402
2624
|
}
|
|
2403
2625
|
|
|
2404
2626
|
// packages/message/src/index.tsx
|
|
2405
|
-
var
|
|
2406
|
-
var
|
|
2627
|
+
var import_react21 = require("react");
|
|
2628
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2407
2629
|
var messageId = 0;
|
|
2408
2630
|
var entries = [];
|
|
2409
2631
|
var listeners = /* @__PURE__ */ new Set();
|
|
@@ -2436,22 +2658,22 @@ var message = {
|
|
|
2436
2658
|
};
|
|
2437
2659
|
var icons = { success: "\u2713", info: "i", warning: "!", error: "\xD7" };
|
|
2438
2660
|
function Message({ maxCount = 4, closeLabel = "Close notification", className, ...props }) {
|
|
2439
|
-
const [visibleEntries, setVisibleEntries] = (0,
|
|
2440
|
-
(0,
|
|
2661
|
+
const [visibleEntries, setVisibleEntries] = (0, import_react21.useState)(entries);
|
|
2662
|
+
(0, import_react21.useEffect)(() => {
|
|
2441
2663
|
const listener = (nextEntries) => setVisibleEntries(nextEntries);
|
|
2442
2664
|
listeners.add(listener);
|
|
2443
2665
|
return () => {
|
|
2444
2666
|
listeners.delete(listener);
|
|
2445
2667
|
};
|
|
2446
2668
|
}, []);
|
|
2447
|
-
return /* @__PURE__ */ (0,
|
|
2448
|
-
/* @__PURE__ */ (0,
|
|
2449
|
-
/* @__PURE__ */ (0,
|
|
2450
|
-
entry.title && /* @__PURE__ */ (0,
|
|
2451
|
-
/* @__PURE__ */ (0,
|
|
2669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.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_runtime29.jsxs)("div", { className: `fe-message fe-message--${entry.severity ?? "info"}`, role: entry.severity === "error" ? "alert" : "status", children: [
|
|
2670
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "fe-message__icon", "aria-hidden": "true", children: icons[entry.severity ?? "info"] }),
|
|
2671
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "fe-message__body", children: [
|
|
2672
|
+
entry.title && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("strong", { className: "fe-message__title", children: entry.title }),
|
|
2673
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "fe-message__content", children: entry.content })
|
|
2452
2674
|
] }),
|
|
2453
|
-
entry.action && /* @__PURE__ */ (0,
|
|
2454
|
-
/* @__PURE__ */ (0,
|
|
2675
|
+
entry.action && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "fe-message__action", children: entry.action }),
|
|
2676
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { className: "fe-message__close", hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: "\xD7", "aria-label": closeLabel, onClick: () => dismiss(entry.id) })
|
|
2455
2677
|
] }, entry.id)) });
|
|
2456
2678
|
}
|
|
2457
2679
|
((Message2) => {
|
|
@@ -2465,8 +2687,8 @@ function Message({ maxCount = 4, closeLabel = "Close notification", className, .
|
|
|
2465
2687
|
})(Message || (Message = {}));
|
|
2466
2688
|
|
|
2467
2689
|
// packages/snackbar/src/index.tsx
|
|
2468
|
-
var
|
|
2469
|
-
var
|
|
2690
|
+
var import_react22 = require("react");
|
|
2691
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2470
2692
|
function Snackbar({
|
|
2471
2693
|
open,
|
|
2472
2694
|
message: message2,
|
|
@@ -2480,12 +2702,12 @@ function Snackbar({
|
|
|
2480
2702
|
}) {
|
|
2481
2703
|
const vertical = anchorOrigin.vertical ?? "bottom";
|
|
2482
2704
|
const horizontal = anchorOrigin.horizontal ?? "center";
|
|
2483
|
-
(0,
|
|
2705
|
+
(0, import_react22.useEffect)(() => {
|
|
2484
2706
|
if (!open || autoHideDuration === null) return void 0;
|
|
2485
2707
|
const timer = window.setTimeout(() => onClose?.("timeout"), autoHideDuration);
|
|
2486
2708
|
return () => window.clearTimeout(timer);
|
|
2487
2709
|
}, [open, autoHideDuration, onClose]);
|
|
2488
|
-
(0,
|
|
2710
|
+
(0, import_react22.useEffect)(() => {
|
|
2489
2711
|
if (!open) return void 0;
|
|
2490
2712
|
const onKeyDown = (event) => {
|
|
2491
2713
|
if (event.key === "Escape") onClose?.("escapeKeyDown");
|
|
@@ -2494,16 +2716,16 @@ function Snackbar({
|
|
|
2494
2716
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
2495
2717
|
}, [open, onClose]);
|
|
2496
2718
|
if (!open) return null;
|
|
2497
|
-
return /* @__PURE__ */ (0,
|
|
2498
|
-
/* @__PURE__ */ (0,
|
|
2499
|
-
action && /* @__PURE__ */ (0,
|
|
2500
|
-
onClose && /* @__PURE__ */ (0,
|
|
2719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: ["fe-snackbar", `fe-snackbar--${vertical}`, `fe-snackbar--${horizontal}`, className].filter(Boolean).join(" "), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "fe-snackbar__content", role: "status", "aria-live": "polite", children: [
|
|
2720
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fe-snackbar__message", children: message2 }),
|
|
2721
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fe-snackbar__action", children: action }),
|
|
2722
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { className: "fe-snackbar__close", hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: "\xD7", "aria-label": closeLabel, onClick: () => onClose("closeButton") })
|
|
2501
2723
|
] }) });
|
|
2502
2724
|
}
|
|
2503
2725
|
|
|
2504
2726
|
// packages/avatar/src/index.tsx
|
|
2505
|
-
var
|
|
2506
|
-
var
|
|
2727
|
+
var import_react23 = require("react");
|
|
2728
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2507
2729
|
var FALLBACK_AVATARS = [
|
|
2508
2730
|
{
|
|
2509
2731
|
background: "#E0E7FF",
|
|
@@ -2836,7 +3058,7 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2836
3058
|
shirt,
|
|
2837
3059
|
skin
|
|
2838
3060
|
} = avatar;
|
|
2839
|
-
return /* @__PURE__ */ (0,
|
|
3061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2840
3062
|
"svg",
|
|
2841
3063
|
{
|
|
2842
3064
|
className: "fe-avatar__fallback-icon",
|
|
@@ -2844,15 +3066,15 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2844
3066
|
focusable: "false",
|
|
2845
3067
|
"aria-hidden": "true",
|
|
2846
3068
|
children: [
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
3069
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("rect", { width: "24", height: "24", fill: background }),
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2849
3071
|
"path",
|
|
2850
3072
|
{
|
|
2851
3073
|
d: "M3 24c.52-3.79 3.58-6.25 9-6.25S20.48 20.21 21 24",
|
|
2852
3074
|
fill: shirt
|
|
2853
3075
|
}
|
|
2854
3076
|
),
|
|
2855
|
-
/* @__PURE__ */ (0,
|
|
3077
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2856
3078
|
"path",
|
|
2857
3079
|
{
|
|
2858
3080
|
d: "M8.1 17.65h7.8l1.05 2.05H7.05l1.05-2.05Z",
|
|
@@ -2860,38 +3082,38 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2860
3082
|
opacity: ".72"
|
|
2861
3083
|
}
|
|
2862
3084
|
),
|
|
2863
|
-
/* @__PURE__ */ (0,
|
|
2864
|
-
hairStyle === 0 && /* @__PURE__ */ (0,
|
|
3085
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("circle", { cx: "12", cy: "10.25", r: "5.25", fill: skin }),
|
|
3086
|
+
hairStyle === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2865
3087
|
"path",
|
|
2866
3088
|
{
|
|
2867
3089
|
d: "M6.75 10.25C6.75 6.34 9.02 4 12.15 4c3.22 0 5.1 2.33 5.1 5.54-1.6-1.41-3.46-2.1-5.59-2.1-1.63 0-3.27.56-4.91 1.68Z",
|
|
2868
3090
|
fill: hair
|
|
2869
3091
|
}
|
|
2870
3092
|
),
|
|
2871
|
-
hairStyle === 1 && /* @__PURE__ */ (0,
|
|
3093
|
+
hairStyle === 1 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2872
3094
|
"path",
|
|
2873
3095
|
{
|
|
2874
3096
|
d: "M6.6 10.1c.16-3.93 2.57-6.2 5.62-6.2 3.57 0 5.3 2.75 5.08 6.32-1.42-1.23-2.91-1.82-4.48-1.82-2.4 0-3.9.65-6.22 1.7Z",
|
|
2875
3097
|
fill: hair
|
|
2876
3098
|
}
|
|
2877
3099
|
),
|
|
2878
|
-
hairStyle === 2 && /* @__PURE__ */ (0,
|
|
3100
|
+
hairStyle === 2 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2879
3101
|
"path",
|
|
2880
3102
|
{
|
|
2881
3103
|
d: "M6.8 10.55C6.8 6.28 9.43 4 12.2 4c3.46 0 5.13 2.83 4.93 6.38-1.38-1.58-3.03-2.38-4.92-2.38-1.81 0-3.61.85-5.41 2.55Z",
|
|
2882
3104
|
fill: hair
|
|
2883
3105
|
}
|
|
2884
3106
|
),
|
|
2885
|
-
hairStyle === 3 && /* @__PURE__ */ (0,
|
|
3107
|
+
hairStyle === 3 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2886
3108
|
"path",
|
|
2887
3109
|
{
|
|
2888
3110
|
d: "M6.66 10.1C6.94 6.12 9.18 4 12.1 4c3.77 0 5.2 2.95 5.18 6.21-1.5-1.07-3.1-1.6-4.8-1.6-2.18 0-3.98.5-5.82 1.49Z",
|
|
2889
3111
|
fill: hair
|
|
2890
3112
|
}
|
|
2891
3113
|
),
|
|
2892
|
-
/* @__PURE__ */ (0,
|
|
2893
|
-
/* @__PURE__ */ (0,
|
|
2894
|
-
expression === 0 && /* @__PURE__ */ (0,
|
|
3114
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("circle", { cx: "10.05", cy: "10.65", r: ".48", fill: "#3B2924" }),
|
|
3115
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("circle", { cx: "13.95", cy: "10.65", r: ".48", fill: "#3B2924" }),
|
|
3116
|
+
expression === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2895
3117
|
"path",
|
|
2896
3118
|
{
|
|
2897
3119
|
d: "M10.25 13.2c1.08.66 2.42.66 3.5 0",
|
|
@@ -2901,7 +3123,7 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2901
3123
|
strokeLinecap: "round"
|
|
2902
3124
|
}
|
|
2903
3125
|
),
|
|
2904
|
-
expression === 1 && /* @__PURE__ */ (0,
|
|
3126
|
+
expression === 1 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2905
3127
|
"path",
|
|
2906
3128
|
{
|
|
2907
3129
|
d: "M10.5 13.2h3",
|
|
@@ -2911,7 +3133,7 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2911
3133
|
strokeLinecap: "round"
|
|
2912
3134
|
}
|
|
2913
3135
|
),
|
|
2914
|
-
expression === 2 && /* @__PURE__ */ (0,
|
|
3136
|
+
expression === 2 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2915
3137
|
"path",
|
|
2916
3138
|
{
|
|
2917
3139
|
d: "M10.6 13.38c.84-.44 1.96-.44 2.8 0",
|
|
@@ -2921,11 +3143,11 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2921
3143
|
strokeLinecap: "round"
|
|
2922
3144
|
}
|
|
2923
3145
|
),
|
|
2924
|
-
expression === 3 && /* @__PURE__ */ (0,
|
|
2925
|
-
glasses && /* @__PURE__ */ (0,
|
|
2926
|
-
/* @__PURE__ */ (0,
|
|
2927
|
-
/* @__PURE__ */ (0,
|
|
2928
|
-
/* @__PURE__ */ (0,
|
|
3146
|
+
expression === 3 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("circle", { cx: "12", cy: "13.2", r: ".82", fill: "#B95A5A" }),
|
|
3147
|
+
glasses && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("g", { fill: "none", stroke: "#3C4355", strokeWidth: ".65", children: [
|
|
3148
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("circle", { cx: "10", cy: "10.55", r: "1.45" }),
|
|
3149
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("circle", { cx: "14", cy: "10.55", r: "1.45" }),
|
|
3150
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { d: "M11.45 10.55h1.1M8.55 10.55H7.5m9 0h-1.05" })
|
|
2929
3151
|
] })
|
|
2930
3152
|
]
|
|
2931
3153
|
}
|
|
@@ -2944,10 +3166,10 @@ function Avatar({
|
|
|
2944
3166
|
"aria-label": ariaLabel,
|
|
2945
3167
|
...props
|
|
2946
3168
|
}) {
|
|
2947
|
-
const [generatedFallbackIndex] = (0,
|
|
3169
|
+
const [generatedFallbackIndex] = (0, import_react23.useState)(
|
|
2948
3170
|
() => Math.floor(Math.random() * FALLBACK_AVATARS.length)
|
|
2949
3171
|
);
|
|
2950
|
-
const [failedImageSrc, setFailedImageSrc] = (0,
|
|
3172
|
+
const [failedImageSrc, setFailedImageSrc] = (0, import_react23.useState)();
|
|
2951
3173
|
const imageSrc = src?.trim();
|
|
2952
3174
|
const trimmedContent = content?.trim() ?? "";
|
|
2953
3175
|
const showImage = Boolean(imageSrc && failedImageSrc !== imageSrc);
|
|
@@ -2959,7 +3181,7 @@ function Avatar({
|
|
|
2959
3181
|
...style
|
|
2960
3182
|
};
|
|
2961
3183
|
const fallbackLabel = (alt ?? trimmedContent) || "Avatar";
|
|
2962
|
-
return /* @__PURE__ */ (0,
|
|
3184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2963
3185
|
"span",
|
|
2964
3186
|
{
|
|
2965
3187
|
className: ["fe-avatar", `fe-avatar--${shape}`, className].filter(Boolean).join(" "),
|
|
@@ -2968,7 +3190,7 @@ function Avatar({
|
|
|
2968
3190
|
"aria-label": showImage ? ariaLabel : ariaLabel ?? fallbackLabel,
|
|
2969
3191
|
...props,
|
|
2970
3192
|
children: [
|
|
2971
|
-
showImage && /* @__PURE__ */ (0,
|
|
3193
|
+
showImage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2972
3194
|
"img",
|
|
2973
3195
|
{
|
|
2974
3196
|
className: "fe-avatar__image",
|
|
@@ -2977,8 +3199,8 @@ function Avatar({
|
|
|
2977
3199
|
onError: () => setFailedImageSrc(imageSrc)
|
|
2978
3200
|
}
|
|
2979
3201
|
),
|
|
2980
|
-
!showImage && initials && /* @__PURE__ */ (0,
|
|
2981
|
-
!showImage && !initials && /* @__PURE__ */ (0,
|
|
3202
|
+
!showImage && initials && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "fe-avatar__initials", "aria-hidden": "true", children: initials }),
|
|
3203
|
+
!showImage && !initials && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AvatarFallbackIcon, { avatar: selectedFallback })
|
|
2982
3204
|
]
|
|
2983
3205
|
}
|
|
2984
3206
|
);
|
|
@@ -2991,7 +3213,7 @@ function AvatarGroup({
|
|
|
2991
3213
|
role,
|
|
2992
3214
|
...props
|
|
2993
3215
|
}) {
|
|
2994
|
-
const avatars =
|
|
3216
|
+
const avatars = import_react23.Children.toArray(children).filter(import_react23.isValidElement);
|
|
2995
3217
|
const hasMaxCount = typeof maxCount === "number" && Number.isFinite(maxCount) && maxCount > 0;
|
|
2996
3218
|
const itemLimit = hasMaxCount ? Math.floor(maxCount) : avatars.length;
|
|
2997
3219
|
const hasOverflow = avatars.length > itemLimit;
|
|
@@ -3004,7 +3226,7 @@ function AvatarGroup({
|
|
|
3004
3226
|
"--fe-avatar-font-size": resolveFontSize(firstAvatarSize)
|
|
3005
3227
|
};
|
|
3006
3228
|
const singleContent = avatars.length === 1 ? avatars[0]?.props.content?.trim() ?? "" : "";
|
|
3007
|
-
return /* @__PURE__ */ (0,
|
|
3229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3008
3230
|
"div",
|
|
3009
3231
|
{
|
|
3010
3232
|
className: ["fe-avatar-group", className].filter(Boolean).join(" "),
|
|
@@ -3012,8 +3234,8 @@ function AvatarGroup({
|
|
|
3012
3234
|
role: role ?? "group",
|
|
3013
3235
|
...props,
|
|
3014
3236
|
children: [
|
|
3015
|
-
/* @__PURE__ */ (0,
|
|
3016
|
-
visibleAvatars.map((avatar, index) => /* @__PURE__ */ (0,
|
|
3237
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "fe-avatar-group__items", children: [
|
|
3238
|
+
visibleAvatars.map((avatar, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3017
3239
|
"span",
|
|
3018
3240
|
{
|
|
3019
3241
|
className: "fe-avatar-group__item",
|
|
@@ -3022,7 +3244,7 @@ function AvatarGroup({
|
|
|
3022
3244
|
},
|
|
3023
3245
|
avatar.key ?? index
|
|
3024
3246
|
)),
|
|
3025
|
-
hasOverflow && /* @__PURE__ */ (0,
|
|
3247
|
+
hasOverflow && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3026
3248
|
"span",
|
|
3027
3249
|
{
|
|
3028
3250
|
className: "fe-avatar-group__more",
|
|
@@ -3036,7 +3258,7 @@ function AvatarGroup({
|
|
|
3036
3258
|
}
|
|
3037
3259
|
)
|
|
3038
3260
|
] }),
|
|
3039
|
-
singleContent && /* @__PURE__ */ (0,
|
|
3261
|
+
singleContent && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "fe-avatar-group__content", children: singleContent })
|
|
3040
3262
|
]
|
|
3041
3263
|
}
|
|
3042
3264
|
);
|
|
@@ -3082,6 +3304,7 @@ function AvatarGroup({
|
|
|
3082
3304
|
TableHead,
|
|
3083
3305
|
TableHeader,
|
|
3084
3306
|
TableRow,
|
|
3307
|
+
Tabs,
|
|
3085
3308
|
TextArea,
|
|
3086
3309
|
TextInput,
|
|
3087
3310
|
Toggle,
|