@orianatech/pire 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data/DataTable.d.cts +8 -2
- package/dist/components/data/DataTable.d.ts +8 -2
- package/dist/components/data/DataTable.d.ts.map +1 -1
- package/dist/components/data/Timeline.d.cts +1 -1
- package/dist/components/data/Timeline.d.ts +1 -1
- package/dist/components/data/Timeline.d.ts.map +1 -1
- package/dist/components/feedback/Toast.d.ts.map +1 -1
- package/dist/components/forms/ComboBox.d.ts.map +1 -1
- package/dist/components/forms/FileUpload.d.cts +7 -1
- package/dist/components/forms/FileUpload.d.ts +7 -1
- package/dist/components/forms/FileUpload.d.ts.map +1 -1
- package/dist/components/forms/MultiComboBox.d.ts.map +1 -1
- package/dist/components/forms/TextArea.d.cts +1 -3
- package/dist/components/forms/TextArea.d.ts +1 -3
- package/dist/components/forms/TextArea.d.ts.map +1 -1
- package/dist/components/navigation/Pagination.d.ts.map +1 -1
- package/dist/components/navigation/ShellBar.d.cts +2 -5
- package/dist/components/navigation/ShellBar.d.ts +2 -5
- package/dist/components/navigation/ShellBar.d.ts.map +1 -1
- package/dist/components/navigation/Tabs.d.ts.map +1 -1
- package/dist/components/patterns/AppLauncher.d.ts.map +1 -1
- package/dist/components/patterns/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/patterns/FileDropZone.d.ts.map +1 -1
- package/dist/components/patterns/ValueHelpDialog.d.ts.map +1 -1
- package/dist/components/utils/useLoadMoreOnScroll.d.cts +11 -0
- package/dist/components/utils/useLoadMoreOnScroll.d.ts +12 -0
- package/dist/components/utils/useLoadMoreOnScroll.d.ts.map +1 -0
- package/dist/components.css +6 -2
- package/dist/i18n/messages.d.cts +18 -0
- package/dist/i18n/messages.d.ts +18 -0
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/index.cjs +696 -525
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +615 -444
- package/dist/index.js.map +1 -1
- package/dist/tokens/colors.css +1 -0
- package/dist/tokens/themes.css +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -52,18 +52,18 @@ __export(src_exports, {
|
|
|
52
52
|
DialogBody: () => DialogBody,
|
|
53
53
|
DialogDescription: () => DialogDescription,
|
|
54
54
|
DialogTitle: () => DialogTitle,
|
|
55
|
-
DialogTrigger: () =>
|
|
55
|
+
DialogTrigger: () => import_react_aria_components45.DialogTrigger,
|
|
56
56
|
DonutChart: () => DonutChart,
|
|
57
57
|
EmptyState: () => EmptyState,
|
|
58
58
|
FieldHelp: () => FieldHelp,
|
|
59
59
|
FileDropZone: () => FileDropZone,
|
|
60
60
|
FileUpload: () => FileUpload,
|
|
61
61
|
FilterBar: () => FilterBar,
|
|
62
|
-
Focusable: () =>
|
|
62
|
+
Focusable: () => import_react_aria_components46.Focusable,
|
|
63
63
|
FooterBar: () => FooterBar,
|
|
64
64
|
FormField: () => FormField,
|
|
65
65
|
Heading: () => Heading,
|
|
66
|
-
I18nProvider: () =>
|
|
66
|
+
I18nProvider: () => import_react_aria_components45.I18nProvider,
|
|
67
67
|
ICON_NAMES: () => ICON_NAMES,
|
|
68
68
|
Icon: () => Icon,
|
|
69
69
|
IconButton: () => IconButton,
|
|
@@ -78,7 +78,7 @@ __export(src_exports, {
|
|
|
78
78
|
MenuItem: () => MenuItem,
|
|
79
79
|
MenuSection: () => MenuSection,
|
|
80
80
|
MenuSeparator: () => MenuSeparator,
|
|
81
|
-
MenuTrigger: () =>
|
|
81
|
+
MenuTrigger: () => import_react_aria_components45.MenuTrigger,
|
|
82
82
|
MultiComboBox: () => MultiComboBox,
|
|
83
83
|
NumPad: () => NumPad,
|
|
84
84
|
NumberField: () => NumberField,
|
|
@@ -87,14 +87,14 @@ __export(src_exports, {
|
|
|
87
87
|
PageHeader: () => PageHeader,
|
|
88
88
|
Pagination: () => Pagination,
|
|
89
89
|
PireIntlProvider: () => PireIntlProvider,
|
|
90
|
-
Popover: () =>
|
|
90
|
+
Popover: () => import_react_aria_components45.Popover,
|
|
91
91
|
ProgressBar: () => ProgressBar,
|
|
92
92
|
QuantityStepper: () => QuantityStepper,
|
|
93
93
|
Radio: () => Radio,
|
|
94
94
|
RadioGroup: () => RadioGroup,
|
|
95
95
|
RecordCard: () => RecordCard,
|
|
96
96
|
Ribbon: () => Ribbon,
|
|
97
|
-
RouterProvider: () =>
|
|
97
|
+
RouterProvider: () => import_react_aria_components45.RouterProvider,
|
|
98
98
|
SectionHeader: () => SectionHeader,
|
|
99
99
|
SegmentedControl: () => SegmentedControl,
|
|
100
100
|
Select: () => Select,
|
|
@@ -108,7 +108,7 @@ __export(src_exports, {
|
|
|
108
108
|
SkeletonTableRow: () => SkeletonTableRow,
|
|
109
109
|
SplitPane: () => SplitPane,
|
|
110
110
|
Strong: () => Strong,
|
|
111
|
-
SubmenuTrigger: () =>
|
|
111
|
+
SubmenuTrigger: () => import_react_aria_components45.SubmenuTrigger,
|
|
112
112
|
Switch: () => Switch,
|
|
113
113
|
Tabs: () => Tabs,
|
|
114
114
|
Tag: () => Tag,
|
|
@@ -572,6 +572,7 @@ var enMessages = {
|
|
|
572
572
|
paginationPrevious: "Previous page",
|
|
573
573
|
paginationNext: "Next page",
|
|
574
574
|
paginationRowsPerPage: "Rows per page",
|
|
575
|
+
paginationPageSize: "{count} rows",
|
|
575
576
|
sideNavLabel: "Main navigation",
|
|
576
577
|
shellRailLabel: "Applications",
|
|
577
578
|
appLauncherLabel: "All applications",
|
|
@@ -587,6 +588,8 @@ var enMessages = {
|
|
|
587
588
|
fileUploadUploading: "Uploading",
|
|
588
589
|
fileDropZonePrompt: "Drag files here, or choose them",
|
|
589
590
|
shellBarUserMenu: "Account menu for {user}",
|
|
591
|
+
shellBarMenu: "Open navigation",
|
|
592
|
+
shellBarSearch: "Search",
|
|
590
593
|
commandPaletteLabel: "Command palette",
|
|
591
594
|
commandPaletteSearchLabel: "Search commands and records",
|
|
592
595
|
commandPalettePlaceholder: "Search for a screen, an action or a record\u2026",
|
|
@@ -607,6 +610,9 @@ var enMessages = {
|
|
|
607
610
|
quantityStepperIncrease: "Increase quantity",
|
|
608
611
|
quantityStepperDecrease: "Decrease quantity",
|
|
609
612
|
confirmDialogFactsLabel: "Summary",
|
|
613
|
+
confirmDialogConfirm: "Confirm",
|
|
614
|
+
confirmDialogCancel: "Cancel",
|
|
615
|
+
confirmDialogBusy: "Working\u2026",
|
|
610
616
|
valueHelpSelectAllCount: "Select all ({count})",
|
|
611
617
|
valueHelpClearSelection: "Clear selection",
|
|
612
618
|
valueHelpSelectedCount: "Selected: {count}",
|
|
@@ -625,7 +631,10 @@ var enMessages = {
|
|
|
625
631
|
selectionBarNounOther: "records",
|
|
626
632
|
selectionBarClear: "Clear selection",
|
|
627
633
|
breadcrumbMore: "Show the full path",
|
|
628
|
-
breadcrumbLabel: "Breadcrumb"
|
|
634
|
+
breadcrumbLabel: "Breadcrumb",
|
|
635
|
+
tabsLabel: "Views",
|
|
636
|
+
multiComboBoxAdded: "{label} added. {count} selected.",
|
|
637
|
+
multiComboBoxRemoved: "{label} removed. {count} selected."
|
|
629
638
|
};
|
|
630
639
|
var esMessages = {
|
|
631
640
|
filterBarLabel: "Filtros",
|
|
@@ -670,6 +679,7 @@ var esMessages = {
|
|
|
670
679
|
paginationPrevious: "P\xE1gina anterior",
|
|
671
680
|
paginationNext: "P\xE1gina siguiente",
|
|
672
681
|
paginationRowsPerPage: "Filas por p\xE1gina",
|
|
682
|
+
paginationPageSize: "{count} filas",
|
|
673
683
|
sideNavLabel: "Navegaci\xF3n principal",
|
|
674
684
|
shellRailLabel: "Aplicaciones",
|
|
675
685
|
appLauncherLabel: "Todas las aplicaciones",
|
|
@@ -685,6 +695,8 @@ var esMessages = {
|
|
|
685
695
|
fileUploadUploading: "Subiendo",
|
|
686
696
|
fileDropZonePrompt: "Arrastr\xE1 archivos ac\xE1, o elegilos",
|
|
687
697
|
shellBarUserMenu: "Men\xFA de cuenta de {user}",
|
|
698
|
+
shellBarMenu: "Abrir navegaci\xF3n",
|
|
699
|
+
shellBarSearch: "Buscar",
|
|
688
700
|
commandPaletteLabel: "Paleta de comandos",
|
|
689
701
|
commandPaletteSearchLabel: "Buscar comandos y registros",
|
|
690
702
|
commandPalettePlaceholder: "Busc\xE1 una pantalla, una acci\xF3n o un registro\u2026",
|
|
@@ -705,6 +717,9 @@ var esMessages = {
|
|
|
705
717
|
quantityStepperIncrease: "Aumentar cantidad",
|
|
706
718
|
quantityStepperDecrease: "Disminuir cantidad",
|
|
707
719
|
confirmDialogFactsLabel: "Resumen",
|
|
720
|
+
confirmDialogConfirm: "Confirmar",
|
|
721
|
+
confirmDialogCancel: "Cancelar",
|
|
722
|
+
confirmDialogBusy: "Procesando\u2026",
|
|
708
723
|
valueHelpSelectAllCount: "Seleccionar todo ({count})",
|
|
709
724
|
valueHelpClearSelection: "Limpiar selecci\xF3n",
|
|
710
725
|
valueHelpSelectedCount: "Seleccionadas: {count}",
|
|
@@ -723,7 +738,10 @@ var esMessages = {
|
|
|
723
738
|
selectionBarNounOther: "registros",
|
|
724
739
|
selectionBarClear: "Quitar selecci\xF3n",
|
|
725
740
|
breadcrumbMore: "Mostrar la ruta completa",
|
|
726
|
-
breadcrumbLabel: "Ruta de navegaci\xF3n"
|
|
741
|
+
breadcrumbLabel: "Ruta de navegaci\xF3n",
|
|
742
|
+
tabsLabel: "Vistas",
|
|
743
|
+
multiComboBoxAdded: "Se agreg\xF3 {label}. Seleccionados: {count}.",
|
|
744
|
+
multiComboBoxRemoved: "Se quit\xF3 {label}. Seleccionados: {count}."
|
|
727
745
|
};
|
|
728
746
|
|
|
729
747
|
// src/i18n/PireIntlProvider.tsx
|
|
@@ -1388,8 +1406,7 @@ function TextArea({
|
|
|
1388
1406
|
const chrome = el.offsetHeight - el.clientHeight;
|
|
1389
1407
|
el.style.height = "auto";
|
|
1390
1408
|
const wanted = maxRows ? Math.min(el.scrollHeight, Math.ceil(lineHeight * maxRows)) : el.scrollHeight;
|
|
1391
|
-
|
|
1392
|
-
if (el.style.height !== next) el.style.height = next;
|
|
1409
|
+
el.style.height = `${wanted + chrome}px`;
|
|
1393
1410
|
}, [autoGrow, maxRows]);
|
|
1394
1411
|
useIsomorphicLayoutEffect(() => {
|
|
1395
1412
|
if (!autoGrow) {
|
|
@@ -1423,7 +1440,7 @@ function TextArea({
|
|
|
1423
1440
|
{
|
|
1424
1441
|
ref,
|
|
1425
1442
|
rows,
|
|
1426
|
-
onInput: autoGrow ? grow : void 0,
|
|
1443
|
+
onInput: autoGrow && rest.value === void 0 ? grow : void 0,
|
|
1427
1444
|
className: cx("pire-input", "pire-textarea"),
|
|
1428
1445
|
"data-auto-grow": autoGrow ? "true" : void 0
|
|
1429
1446
|
}
|
|
@@ -1649,8 +1666,28 @@ function ChoiceCardGroup({
|
|
|
1649
1666
|
}
|
|
1650
1667
|
|
|
1651
1668
|
// src/components/forms/ComboBox.tsx
|
|
1652
|
-
var
|
|
1669
|
+
var React14 = __toESM(require("react"), 1);
|
|
1653
1670
|
var import_react_aria_components19 = require("react-aria-components");
|
|
1671
|
+
|
|
1672
|
+
// src/components/utils/useLoadMoreOnScroll.ts
|
|
1673
|
+
var React13 = __toESM(require("react"), 1);
|
|
1674
|
+
var THRESHOLD = 64;
|
|
1675
|
+
function useLoadMoreOnScroll(onLoadMore, isLoading) {
|
|
1676
|
+
const requestedAt = React13.useRef(null);
|
|
1677
|
+
React13.useEffect(() => {
|
|
1678
|
+
if (!isLoading) requestedAt.current = null;
|
|
1679
|
+
}, [isLoading]);
|
|
1680
|
+
if (!onLoadMore) return void 0;
|
|
1681
|
+
return (event) => {
|
|
1682
|
+
const el = event.currentTarget;
|
|
1683
|
+
if (isLoading || el.scrollHeight - el.scrollTop - el.clientHeight >= THRESHOLD) return;
|
|
1684
|
+
if (requestedAt.current === el.scrollHeight) return;
|
|
1685
|
+
requestedAt.current = el.scrollHeight;
|
|
1686
|
+
onLoadMore();
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
// src/components/forms/ComboBox.tsx
|
|
1654
1691
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1655
1692
|
var norm2 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1656
1693
|
function ComboBox({
|
|
@@ -1680,10 +1717,10 @@ function ComboBox({
|
|
|
1680
1717
|
const msg = usePireMessages();
|
|
1681
1718
|
const items = options.map(norm2);
|
|
1682
1719
|
const isSelectionControlled = value !== void 0;
|
|
1683
|
-
const [ownSelection, setOwnSelection] =
|
|
1720
|
+
const [ownSelection, setOwnSelection] = React14.useState(defaultValue ?? null);
|
|
1684
1721
|
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1685
1722
|
const currentSelection = isSelectionControlled ? value : ownSelection;
|
|
1686
|
-
const [typedText, setTypedText] =
|
|
1723
|
+
const [typedText, setTypedText] = React14.useState("");
|
|
1687
1724
|
const currentText = inputValue !== void 0 ? inputValue : typedText;
|
|
1688
1725
|
const handleInputChange = isClearable ? (text) => {
|
|
1689
1726
|
setTypedText(text);
|
|
@@ -1697,6 +1734,7 @@ function ComboBox({
|
|
|
1697
1734
|
onInputChange?.("");
|
|
1698
1735
|
};
|
|
1699
1736
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1737
|
+
const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
|
|
1700
1738
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1701
1739
|
warnHelpWithoutLabel("ComboBox", label, help);
|
|
1702
1740
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
@@ -1762,10 +1800,7 @@ function ComboBox({
|
|
|
1762
1800
|
import_react_aria_components19.ListBox,
|
|
1763
1801
|
{
|
|
1764
1802
|
className: "pire-listbox",
|
|
1765
|
-
onScroll:
|
|
1766
|
-
const el = e.currentTarget;
|
|
1767
|
-
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
|
|
1768
|
-
} : void 0,
|
|
1803
|
+
onScroll: onListScroll,
|
|
1769
1804
|
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
|
|
1770
1805
|
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1771
1806
|
import_react_aria_components19.ListBoxItem,
|
|
@@ -1788,7 +1823,7 @@ function ComboBox({
|
|
|
1788
1823
|
}
|
|
1789
1824
|
|
|
1790
1825
|
// src/components/forms/MultiComboBox.tsx
|
|
1791
|
-
var
|
|
1826
|
+
var React15 = __toESM(require("react"), 1);
|
|
1792
1827
|
var import_react_aria_components20 = require("react-aria-components");
|
|
1793
1828
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1794
1829
|
var norm3 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
@@ -1815,22 +1850,24 @@ function MultiComboBox({
|
|
|
1815
1850
|
...rest
|
|
1816
1851
|
}) {
|
|
1817
1852
|
const msg = usePireMessages();
|
|
1818
|
-
const items =
|
|
1853
|
+
const items = React15.useMemo(() => options.map(norm3), [options]);
|
|
1819
1854
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1855
|
+
const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
|
|
1820
1856
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1821
|
-
const [uncontrolled, setUncontrolled] =
|
|
1822
|
-
const [announcement, setAnnouncement] =
|
|
1823
|
-
const inputRef =
|
|
1857
|
+
const [uncontrolled, setUncontrolled] = React15.useState(defaultValue ?? []);
|
|
1858
|
+
const [announcement, setAnnouncement] = React15.useState("");
|
|
1859
|
+
const inputRef = React15.useRef(null);
|
|
1824
1860
|
const raw = value ?? uncontrolled;
|
|
1825
1861
|
const contentKey = raw.join("\0");
|
|
1826
|
-
const values =
|
|
1862
|
+
const values = React15.useMemo(() => raw, [contentKey]);
|
|
1827
1863
|
const labelOf = (v) => items.find((o) => o.value === v)?.label ?? v;
|
|
1828
1864
|
const isEditable = !rest.isDisabled && !rest.isReadOnly;
|
|
1829
1865
|
const commit = (next) => {
|
|
1830
1866
|
const added = next.find((v) => !values.includes(v));
|
|
1831
1867
|
const removed = values.find((v) => !next.includes(v));
|
|
1832
|
-
|
|
1833
|
-
|
|
1868
|
+
const announce = (template, value2) => setAnnouncement(template.replace("{label}", labelOf(value2)).replace("{count}", String(next.length)));
|
|
1869
|
+
if (added) announce(msg.multiComboBoxAdded, added);
|
|
1870
|
+
else if (removed) announce(msg.multiComboBoxRemoved, removed);
|
|
1834
1871
|
if (value === void 0) setUncontrolled(next);
|
|
1835
1872
|
onChange?.(next);
|
|
1836
1873
|
};
|
|
@@ -1922,10 +1959,7 @@ function MultiComboBox({
|
|
|
1922
1959
|
import_react_aria_components20.ListBox,
|
|
1923
1960
|
{
|
|
1924
1961
|
className: "pire-listbox",
|
|
1925
|
-
onScroll:
|
|
1926
|
-
const el = e.currentTarget;
|
|
1927
|
-
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
|
|
1928
|
-
} : void 0,
|
|
1962
|
+
onScroll: onListScroll,
|
|
1929
1963
|
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
|
|
1930
1964
|
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1931
1965
|
import_react_aria_components20.ListBoxItem,
|
|
@@ -1948,7 +1982,7 @@ function MultiComboBox({
|
|
|
1948
1982
|
}
|
|
1949
1983
|
|
|
1950
1984
|
// src/components/forms/NumberField.tsx
|
|
1951
|
-
var
|
|
1985
|
+
var React16 = __toESM(require("react"), 1);
|
|
1952
1986
|
var import_react_aria_components21 = require("react-aria-components");
|
|
1953
1987
|
|
|
1954
1988
|
// src/components/utils/decimalSeparator.ts
|
|
@@ -1988,7 +2022,7 @@ function toAriaNumber(value) {
|
|
|
1988
2022
|
return typeof value === "number" ? value : Number(value);
|
|
1989
2023
|
}
|
|
1990
2024
|
function ClearButton({ label, onClear }) {
|
|
1991
|
-
const state =
|
|
2025
|
+
const state = React16.useContext(import_react_aria_components21.NumberFieldStateContext);
|
|
1992
2026
|
if (!state?.inputValue) {
|
|
1993
2027
|
return null;
|
|
1994
2028
|
}
|
|
@@ -2031,7 +2065,7 @@ function NumberField({
|
|
|
2031
2065
|
const { locale } = (0, import_react_aria_components21.useLocale)();
|
|
2032
2066
|
const empty = emptyValue === void 0 ? NaN : emptyValue;
|
|
2033
2067
|
const isControlled = value !== void 0;
|
|
2034
|
-
const [ownValue, setOwnValue] =
|
|
2068
|
+
const [ownValue, setOwnValue] = React16.useState(() => toAriaNumber(defaultValue) ?? NaN);
|
|
2035
2069
|
const takesOverValue = Boolean(isClearable) && !isControlled;
|
|
2036
2070
|
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : { value: toAriaNumber(value), defaultValue: toAriaNumber(defaultValue) };
|
|
2037
2071
|
const handleChange = (next) => {
|
|
@@ -2179,7 +2213,7 @@ function QuantityStepper({ size = "md", ...rest }) {
|
|
|
2179
2213
|
}
|
|
2180
2214
|
|
|
2181
2215
|
// src/components/forms/DatePicker.tsx
|
|
2182
|
-
var
|
|
2216
|
+
var React17 = __toESM(require("react"), 1);
|
|
2183
2217
|
var import_react_aria_components22 = require("react-aria-components");
|
|
2184
2218
|
|
|
2185
2219
|
// src/components/forms/dateValues.ts
|
|
@@ -2212,7 +2246,7 @@ function coerceBound(value) {
|
|
|
2212
2246
|
// src/components/forms/DatePicker.tsx
|
|
2213
2247
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2214
2248
|
function ClearButton2({ label }) {
|
|
2215
|
-
const state =
|
|
2249
|
+
const state = React17.useContext(import_react_aria_components22.DatePickerStateContext);
|
|
2216
2250
|
if (!state?.value) {
|
|
2217
2251
|
return null;
|
|
2218
2252
|
}
|
|
@@ -2329,7 +2363,7 @@ function DatePicker({
|
|
|
2329
2363
|
}
|
|
2330
2364
|
|
|
2331
2365
|
// src/components/forms/DateRangePicker.tsx
|
|
2332
|
-
var
|
|
2366
|
+
var React18 = __toESM(require("react"), 1);
|
|
2333
2367
|
var import_react_aria_components23 = require("react-aria-components");
|
|
2334
2368
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2335
2369
|
function coerceRange(range) {
|
|
@@ -2352,7 +2386,7 @@ function rangeLengthInDays(range) {
|
|
|
2352
2386
|
return end.toDate("UTC").getTime() / 864e5 - start.toDate("UTC").getTime() / 864e5 + 1;
|
|
2353
2387
|
}
|
|
2354
2388
|
function ClearButton3({ label }) {
|
|
2355
|
-
const state =
|
|
2389
|
+
const state = React18.useContext(import_react_aria_components23.DateRangePickerStateContext);
|
|
2356
2390
|
if (!state?.value?.start && !state?.value?.end) {
|
|
2357
2391
|
return null;
|
|
2358
2392
|
}
|
|
@@ -2504,13 +2538,14 @@ function DateRangePicker({
|
|
|
2504
2538
|
}
|
|
2505
2539
|
|
|
2506
2540
|
// src/components/forms/ValueHelpField.tsx
|
|
2507
|
-
var
|
|
2541
|
+
var React22 = __toESM(require("react"), 1);
|
|
2508
2542
|
|
|
2509
2543
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
2510
|
-
var
|
|
2544
|
+
var React21 = __toESM(require("react"), 1);
|
|
2545
|
+
var import_react_aria_components26 = require("react-aria-components");
|
|
2511
2546
|
|
|
2512
2547
|
// src/components/feedback/Dialog.tsx
|
|
2513
|
-
var
|
|
2548
|
+
var React19 = __toESM(require("react"), 1);
|
|
2514
2549
|
var import_react_aria_components24 = require("react-aria-components");
|
|
2515
2550
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2516
2551
|
function DialogTitle({ children, className }) {
|
|
@@ -2544,8 +2579,8 @@ function Dialog({
|
|
|
2544
2579
|
onClose?.();
|
|
2545
2580
|
onOpenChange?.(false);
|
|
2546
2581
|
};
|
|
2547
|
-
const parts =
|
|
2548
|
-
const slotOf = (type) => parts.find((node) =>
|
|
2582
|
+
const parts = React19.Children.toArray(children);
|
|
2583
|
+
const slotOf = (type) => parts.find((node) => React19.isValidElement(node) && node.type === type);
|
|
2549
2584
|
const titleSlot = slotOf(DialogTitle);
|
|
2550
2585
|
const descriptionSlot = slotOf(DialogDescription);
|
|
2551
2586
|
const bodySlot = slotOf(DialogBody);
|
|
@@ -2581,7 +2616,7 @@ function Dialog({
|
|
|
2581
2616
|
}
|
|
2582
2617
|
|
|
2583
2618
|
// src/components/data/DataTable.tsx
|
|
2584
|
-
var
|
|
2619
|
+
var React20 = __toESM(require("react"), 1);
|
|
2585
2620
|
var import_react_aria_components25 = require("react-aria-components");
|
|
2586
2621
|
|
|
2587
2622
|
// src/components/feedback/Skeleton.tsx
|
|
@@ -2661,11 +2696,11 @@ function EditCell({
|
|
|
2661
2696
|
onCommit,
|
|
2662
2697
|
onCancel
|
|
2663
2698
|
}) {
|
|
2664
|
-
const state =
|
|
2699
|
+
const state = React20.useContext(import_react_aria_components25.TableStateContext);
|
|
2665
2700
|
const setNavDisabled = state?.setKeyboardNavigationDisabled;
|
|
2666
|
-
const ref =
|
|
2667
|
-
const focusedWithin =
|
|
2668
|
-
|
|
2701
|
+
const ref = React20.useRef(null);
|
|
2702
|
+
const focusedWithin = React20.useRef(false);
|
|
2703
|
+
React20.useLayoutEffect(() => {
|
|
2669
2704
|
if (!isFirst) return;
|
|
2670
2705
|
const row = ref.current?.closest('[role="row"]');
|
|
2671
2706
|
void focusToken;
|
|
@@ -2677,7 +2712,7 @@ function EditCell({
|
|
|
2677
2712
|
}
|
|
2678
2713
|
}
|
|
2679
2714
|
}, [isFirst, focusToken]);
|
|
2680
|
-
|
|
2715
|
+
React20.useLayoutEffect(() => {
|
|
2681
2716
|
if (!isFirst) return;
|
|
2682
2717
|
const row = ref.current?.closest('[role="row"]');
|
|
2683
2718
|
return () => {
|
|
@@ -2687,7 +2722,7 @@ function EditCell({
|
|
|
2687
2722
|
});
|
|
2688
2723
|
};
|
|
2689
2724
|
}, [isFirst]);
|
|
2690
|
-
|
|
2725
|
+
React20.useEffect(
|
|
2691
2726
|
() => () => {
|
|
2692
2727
|
if (focusedWithin.current) setNavDisabled?.(false);
|
|
2693
2728
|
},
|
|
@@ -2729,6 +2764,31 @@ function EditCell({
|
|
|
2729
2764
|
}
|
|
2730
2765
|
);
|
|
2731
2766
|
}
|
|
2767
|
+
var LiveEditContext = React20.createContext(null);
|
|
2768
|
+
function LiveEditField({ columnKey, row }) {
|
|
2769
|
+
const live = React20.useContext(LiveEditContext);
|
|
2770
|
+
const column = live?.columns.find((c) => c.key === columnKey);
|
|
2771
|
+
const target = row ?? live?.pendingRow;
|
|
2772
|
+
return target && column?.renderEdit ? column.renderEdit(target) : null;
|
|
2773
|
+
}
|
|
2774
|
+
function useTableElement(deps, columnFunctions, isEditing, build) {
|
|
2775
|
+
const cache = React20.useRef(null);
|
|
2776
|
+
const churn = React20.useRef(0);
|
|
2777
|
+
const prev = cache.current;
|
|
2778
|
+
if (prev && sameValues(prev.deps, deps) && sameValues(prev.columnFunctions, columnFunctions)) {
|
|
2779
|
+
churn.current = 0;
|
|
2780
|
+
return prev.element;
|
|
2781
|
+
}
|
|
2782
|
+
if (IS_DEV3 && isEditing && prev && sameValues(prev.deps, deps) && ++churn.current === 3) {
|
|
2783
|
+
warnOnce3(
|
|
2784
|
+
"columns-churn",
|
|
2785
|
+
"DataTable columns get new render/tone functions on every render, so each keystroke in an editing row re-renders the whole table. Define the columns outside the component or memoize them; see the `columns` prop."
|
|
2786
|
+
);
|
|
2787
|
+
}
|
|
2788
|
+
cache.current = { deps, columnFunctions, element: build() };
|
|
2789
|
+
return cache.current.element;
|
|
2790
|
+
}
|
|
2791
|
+
var sameValues = (a, b) => a.length === b.length && a.every((v, i) => Object.is(v, b[i]));
|
|
2732
2792
|
function DataTable({
|
|
2733
2793
|
columns,
|
|
2734
2794
|
rows,
|
|
@@ -2758,11 +2818,13 @@ function DataTable({
|
|
|
2758
2818
|
...rest
|
|
2759
2819
|
}) {
|
|
2760
2820
|
const msg = usePireMessages();
|
|
2761
|
-
const [pendingFocus, setPendingFocus] =
|
|
2821
|
+
const [pendingFocus, setPendingFocus] = React20.useState(0);
|
|
2822
|
+
const latest = React20.useRef({ onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow });
|
|
2823
|
+
latest.current = { onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow };
|
|
2762
2824
|
const isEditing = (row) => editingRowId != null && String(row.id) === String(editingRowId);
|
|
2763
2825
|
const selectionMode = selectable === true || selectable === "multiple" ? "multiple" : selectable === "single" ? "single" : "none";
|
|
2764
2826
|
const hasCheckboxColumn = selectionMode === "multiple";
|
|
2765
|
-
const pinnedGeometry =
|
|
2827
|
+
const pinnedGeometry = React20.useMemo(() => {
|
|
2766
2828
|
const geometry = /* @__PURE__ */ new Map();
|
|
2767
2829
|
let x = hasCheckboxColumn ? CHECKBOX_W : 0;
|
|
2768
2830
|
let broke = null;
|
|
@@ -2801,12 +2863,12 @@ function DataTable({
|
|
|
2801
2863
|
const keys = selection !== "all" && selection.has(PENDING_KEY) ? new Set([...selection].filter((key) => key !== PENDING_KEY)) : selection;
|
|
2802
2864
|
if (keys === "all") {
|
|
2803
2865
|
const inCollection = new Set(rows.map((r) => r.id));
|
|
2804
|
-
return onSelectionChange?.([
|
|
2866
|
+
return latest.current.onSelectionChange?.([
|
|
2805
2867
|
...rows.map((r) => r.id),
|
|
2806
2868
|
...(selected ?? []).filter((id) => !inCollection.has(id))
|
|
2807
2869
|
]);
|
|
2808
2870
|
}
|
|
2809
|
-
onSelectionChange?.([...keys]);
|
|
2871
|
+
latest.current.onSelectionChange?.([...keys]);
|
|
2810
2872
|
};
|
|
2811
2873
|
const skeletonRows = loadingRowCount ?? (rows.length || 5);
|
|
2812
2874
|
const skeletonColumns = [
|
|
@@ -2830,6 +2892,223 @@ function DataTable({
|
|
|
2830
2892
|
style: { left: box.left, width: box.width, minWidth: box.width, maxWidth: box.width }
|
|
2831
2893
|
};
|
|
2832
2894
|
};
|
|
2895
|
+
const renderRecord = (row, editing) => {
|
|
2896
|
+
const rowIsDisabled = presentation.get(row.id)?.isDisabled;
|
|
2897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2898
|
+
import_react_aria_components25.Row,
|
|
2899
|
+
{
|
|
2900
|
+
id: row.id,
|
|
2901
|
+
className: cx("pire-tr", presentation.get(row.id)?.className),
|
|
2902
|
+
"data-pressable": onRowAction && !rowIsDisabled && !editing ? "true" : void 0,
|
|
2903
|
+
"data-editing": editing ? "true" : void 0,
|
|
2904
|
+
children: [
|
|
2905
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-td", ...pinProps(null), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
|
|
2906
|
+
columns.map((c) => {
|
|
2907
|
+
const pin = pinProps(c.key);
|
|
2908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2909
|
+
import_react_aria_components25.Cell,
|
|
2910
|
+
{
|
|
2911
|
+
className: "pire-td",
|
|
2912
|
+
"data-numeric": c.numeric ? "true" : void 0,
|
|
2913
|
+
"data-tone": c.tone?.(row) ?? void 0,
|
|
2914
|
+
...pin,
|
|
2915
|
+
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
2916
|
+
children: editing && c.renderEdit ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2917
|
+
EditCell,
|
|
2918
|
+
{
|
|
2919
|
+
isFirst: c === firstEditable,
|
|
2920
|
+
focusToken: 0,
|
|
2921
|
+
onCommit: () => latest.current.onCommitRow?.(row.id),
|
|
2922
|
+
onCancel: () => latest.current.onCancelRow?.(row.id),
|
|
2923
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LiveEditField, { columnKey: c.key, row })
|
|
2924
|
+
}
|
|
2925
|
+
) : c.render ? c.render(row) : row[c.key]
|
|
2926
|
+
},
|
|
2927
|
+
c.key
|
|
2928
|
+
);
|
|
2929
|
+
})
|
|
2930
|
+
]
|
|
2931
|
+
},
|
|
2932
|
+
row.id
|
|
2933
|
+
);
|
|
2934
|
+
};
|
|
2935
|
+
const renderDetail = (row) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded?.(row) }) }, expandedKey(row.id));
|
|
2936
|
+
const table = useTableElement(
|
|
2937
|
+
[
|
|
2938
|
+
rows,
|
|
2939
|
+
isLoading,
|
|
2940
|
+
loadingRowCount,
|
|
2941
|
+
loadingLabel,
|
|
2942
|
+
emptyLabel,
|
|
2943
|
+
density,
|
|
2944
|
+
stickyHeader,
|
|
2945
|
+
hideSelectAll,
|
|
2946
|
+
selectionMode,
|
|
2947
|
+
rest["aria-label"],
|
|
2948
|
+
selected,
|
|
2949
|
+
sort?.key,
|
|
2950
|
+
sort?.dir,
|
|
2951
|
+
editingRowId,
|
|
2952
|
+
pendingRow != null,
|
|
2953
|
+
pendingFocus,
|
|
2954
|
+
expandedIds,
|
|
2955
|
+
renderExpanded,
|
|
2956
|
+
footer,
|
|
2957
|
+
msg,
|
|
2958
|
+
Boolean(onRowAction),
|
|
2959
|
+
...columns.flatMap((c) => [
|
|
2960
|
+
c.key,
|
|
2961
|
+
c.label,
|
|
2962
|
+
c.align,
|
|
2963
|
+
c.width,
|
|
2964
|
+
c.numeric,
|
|
2965
|
+
c.sortable,
|
|
2966
|
+
c.hideLabel,
|
|
2967
|
+
c.pinned,
|
|
2968
|
+
Boolean(c.renderEdit)
|
|
2969
|
+
]),
|
|
2970
|
+
...rows.flatMap((row) => [presentation.get(row.id)?.className, presentation.get(row.id)?.isDisabled])
|
|
2971
|
+
],
|
|
2972
|
+
columns.flatMap((c) => [c.render, c.tone]),
|
|
2973
|
+
editingRowId != null || pendingRow != null,
|
|
2974
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2975
|
+
import_react_aria_components25.Table,
|
|
2976
|
+
{
|
|
2977
|
+
className: "pire-table",
|
|
2978
|
+
"data-density": density,
|
|
2979
|
+
"data-sticky": String(stickyHeader),
|
|
2980
|
+
"data-pinned": hasPinned ? "true" : void 0,
|
|
2981
|
+
"aria-label": rest["aria-label"],
|
|
2982
|
+
disabledKeys: disabledKeys.length ? new Set(disabledKeys) : void 0,
|
|
2983
|
+
selectionMode,
|
|
2984
|
+
selectedKeys: selected ? new Set(selected) : void 0,
|
|
2985
|
+
onSelectionChange: handleSelection,
|
|
2986
|
+
sortDescriptor,
|
|
2987
|
+
onSortChange: (d) => latest.current.onSortChange?.({
|
|
2988
|
+
key: String(d.column),
|
|
2989
|
+
dir: d.direction === "ascending" ? "asc" : "desc"
|
|
2990
|
+
}),
|
|
2991
|
+
onRowAction: onRowAction ? (key) => {
|
|
2992
|
+
const row = rows.find((r) => String(r.id) === String(key));
|
|
2993
|
+
if (row && !isEditing(row)) latest.current.onRowAction?.(row);
|
|
2994
|
+
} : void 0,
|
|
2995
|
+
children: [
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react_aria_components25.TableHeader, { className: "pire-thead-row", children: [
|
|
2997
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Column, { className: "pire-th", ...pinProps(null), children: hideSelectAll ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-sr-only", children: msg.dataTableSelectionColumn }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectAll }) }) : null,
|
|
2998
|
+
columns.map((c, i) => (
|
|
2999
|
+
// The checkbox column is never the row header — a selection control does not identify
|
|
3000
|
+
// the record — so the first *data* column carries it regardless of whether a checkbox
|
|
3001
|
+
// column precedes it. Conditioning this on `hasCheckboxColumn` left every selectable
|
|
3002
|
+
// table with no row header at all: invisible on first paint, and a hard crash from
|
|
3003
|
+
// React Aria's own "table must have a row header" invariant the moment `rows` changes
|
|
3004
|
+
// under it (search, sort, a paginated load).
|
|
3005
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3006
|
+
import_react_aria_components25.Column,
|
|
3007
|
+
{
|
|
3008
|
+
id: c.key,
|
|
3009
|
+
className: "pire-th",
|
|
3010
|
+
isRowHeader: i === 0,
|
|
3011
|
+
allowsSorting: c.sortable,
|
|
3012
|
+
"data-align": c.numeric || c.align === "right" ? "right" : c.align,
|
|
3013
|
+
"data-allows-sorting": c.sortable ? "true" : void 0,
|
|
3014
|
+
...pinProps(c.key),
|
|
3015
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: c.hideLabel ? "pire-sr-only" : "pire-th-inner", children: [
|
|
3016
|
+
c.label,
|
|
3017
|
+
c.sortable ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3018
|
+
Icon,
|
|
3019
|
+
{
|
|
3020
|
+
size: 12,
|
|
3021
|
+
name: sort?.key === c.key ? sort.dir === "asc" ? "arrow-up" : "arrow-down" : "chevrons-up-down",
|
|
3022
|
+
style: {
|
|
3023
|
+
color: sort?.key === c.key ? "var(--accent-subtle-fg)" : "var(--text-tertiary)"
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
) : null
|
|
3027
|
+
] })
|
|
3028
|
+
},
|
|
3029
|
+
c.key
|
|
3030
|
+
)
|
|
3031
|
+
))
|
|
3032
|
+
] }),
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
3034
|
+
import_react_aria_components25.TableBody,
|
|
3035
|
+
{
|
|
3036
|
+
renderEmptyState: () => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "pire-table-loading", role: "status", "aria-live": "polite", children: [
|
|
3037
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-sr-only", children: loadingLabel ?? msg.dataTableLoading }),
|
|
3038
|
+
Array.from({ length: skeletonRows }, (_, i) => (
|
|
3039
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
|
|
3040
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SkeletonTableRow, { columns: skeletonColumns, density }, i)
|
|
3041
|
+
))
|
|
3042
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "pire-table-empty", children: emptyLabel ?? msg.dataTableEmpty }),
|
|
3043
|
+
children: [
|
|
3044
|
+
pendingRow && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
3045
|
+
import_react_aria_components25.Row,
|
|
3046
|
+
{
|
|
3047
|
+
id: PENDING_KEY,
|
|
3048
|
+
className: "pire-tr",
|
|
3049
|
+
"data-editing": "true",
|
|
3050
|
+
"data-pending": "true",
|
|
3051
|
+
children: [
|
|
3052
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-td", ...pinProps(null) }) : null,
|
|
3053
|
+
columns.map((c) => {
|
|
3054
|
+
const pin = pinProps(c.key);
|
|
3055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3056
|
+
import_react_aria_components25.Cell,
|
|
3057
|
+
{
|
|
3058
|
+
className: "pire-td",
|
|
3059
|
+
"data-numeric": c.numeric ? "true" : void 0,
|
|
3060
|
+
...pin,
|
|
3061
|
+
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
3062
|
+
children: c.renderEdit ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3063
|
+
EditCell,
|
|
3064
|
+
{
|
|
3065
|
+
isFirst: c === firstEditable,
|
|
3066
|
+
focusToken: pendingFocus,
|
|
3067
|
+
onCommit: () => {
|
|
3068
|
+
latest.current.onCommitRow?.(null);
|
|
3069
|
+
setPendingFocus((n) => n + 1);
|
|
3070
|
+
},
|
|
3071
|
+
onCancel: () => latest.current.onCancelRow?.(null),
|
|
3072
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LiveEditField, { columnKey: c.key, row: null })
|
|
3073
|
+
}
|
|
3074
|
+
) : null
|
|
3075
|
+
},
|
|
3076
|
+
c.key
|
|
3077
|
+
);
|
|
3078
|
+
})
|
|
3079
|
+
]
|
|
3080
|
+
},
|
|
3081
|
+
PENDING_KEY
|
|
3082
|
+
) : null,
|
|
3083
|
+
body.flatMap((row) => {
|
|
3084
|
+
const record = renderRecord(row, isEditing(row));
|
|
3085
|
+
if (!renderExpanded || !expanded.has(String(row.id))) return [record];
|
|
3086
|
+
return [record, renderDetail(row)];
|
|
3087
|
+
})
|
|
3088
|
+
]
|
|
3089
|
+
}
|
|
3090
|
+
),
|
|
3091
|
+
footer && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react_aria_components25.Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
|
|
3092
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-tf", ...pinProps(null) }) : null,
|
|
3093
|
+
columns.map((c, i) => {
|
|
3094
|
+
const pin = pinProps(c.key);
|
|
3095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3096
|
+
import_react_aria_components25.Cell,
|
|
3097
|
+
{
|
|
3098
|
+
className: "pire-tf",
|
|
3099
|
+
"data-numeric": c.numeric ? "true" : void 0,
|
|
3100
|
+
...pin,
|
|
3101
|
+
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
3102
|
+
children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
|
|
3103
|
+
},
|
|
3104
|
+
c.key
|
|
3105
|
+
);
|
|
3106
|
+
})
|
|
3107
|
+
] }) }) : null
|
|
3108
|
+
]
|
|
3109
|
+
}
|
|
3110
|
+
)
|
|
3111
|
+
);
|
|
2833
3112
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2834
3113
|
"div",
|
|
2835
3114
|
{
|
|
@@ -2837,181 +3116,7 @@ function DataTable({
|
|
|
2837
3116
|
style,
|
|
2838
3117
|
"data-loading": isLoading ? "true" : void 0,
|
|
2839
3118
|
"aria-busy": isLoading ? "true" : void 0,
|
|
2840
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.
|
|
2841
|
-
import_react_aria_components25.Table,
|
|
2842
|
-
{
|
|
2843
|
-
className: "pire-table",
|
|
2844
|
-
"data-density": density,
|
|
2845
|
-
"data-sticky": String(stickyHeader),
|
|
2846
|
-
"data-pinned": hasPinned ? "true" : void 0,
|
|
2847
|
-
"aria-label": rest["aria-label"],
|
|
2848
|
-
disabledKeys: disabledKeys.length ? new Set(disabledKeys) : void 0,
|
|
2849
|
-
selectionMode,
|
|
2850
|
-
selectedKeys: selected ? new Set(selected) : void 0,
|
|
2851
|
-
onSelectionChange: handleSelection,
|
|
2852
|
-
sortDescriptor,
|
|
2853
|
-
onSortChange: (d) => onSortChange?.({ key: String(d.column), dir: d.direction === "ascending" ? "asc" : "desc" }),
|
|
2854
|
-
onRowAction: onRowAction ? (key) => {
|
|
2855
|
-
const row = rows.find((r) => String(r.id) === String(key));
|
|
2856
|
-
if (row && !isEditing(row)) onRowAction(row);
|
|
2857
|
-
} : void 0,
|
|
2858
|
-
children: [
|
|
2859
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react_aria_components25.TableHeader, { className: "pire-thead-row", children: [
|
|
2860
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Column, { className: "pire-th", ...pinProps(null), children: hideSelectAll ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-sr-only", children: msg.dataTableSelectionColumn }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectAll }) }) : null,
|
|
2861
|
-
columns.map((c, i) => (
|
|
2862
|
-
// The checkbox column is never the row header — a selection control does not identify
|
|
2863
|
-
// the record — so the first *data* column carries it regardless of whether a checkbox
|
|
2864
|
-
// column precedes it. Conditioning this on `hasCheckboxColumn` left every selectable
|
|
2865
|
-
// table with no row header at all: invisible on first paint, and a hard crash from
|
|
2866
|
-
// React Aria's own "table must have a row header" invariant the moment `rows` changes
|
|
2867
|
-
// under it (search, sort, a paginated load).
|
|
2868
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2869
|
-
import_react_aria_components25.Column,
|
|
2870
|
-
{
|
|
2871
|
-
id: c.key,
|
|
2872
|
-
className: "pire-th",
|
|
2873
|
-
isRowHeader: i === 0,
|
|
2874
|
-
allowsSorting: c.sortable,
|
|
2875
|
-
"data-align": c.numeric || c.align === "right" ? "right" : c.align,
|
|
2876
|
-
"data-allows-sorting": c.sortable ? "true" : void 0,
|
|
2877
|
-
...pinProps(c.key),
|
|
2878
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: c.hideLabel ? "pire-sr-only" : "pire-th-inner", children: [
|
|
2879
|
-
c.label,
|
|
2880
|
-
c.sortable ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2881
|
-
Icon,
|
|
2882
|
-
{
|
|
2883
|
-
size: 12,
|
|
2884
|
-
name: sort?.key === c.key ? sort.dir === "asc" ? "arrow-up" : "arrow-down" : "chevrons-up-down",
|
|
2885
|
-
style: {
|
|
2886
|
-
color: sort?.key === c.key ? "var(--accent-subtle-fg)" : "var(--text-tertiary)"
|
|
2887
|
-
}
|
|
2888
|
-
}
|
|
2889
|
-
) : null
|
|
2890
|
-
] })
|
|
2891
|
-
},
|
|
2892
|
-
c.key
|
|
2893
|
-
)
|
|
2894
|
-
))
|
|
2895
|
-
] }),
|
|
2896
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2897
|
-
import_react_aria_components25.TableBody,
|
|
2898
|
-
{
|
|
2899
|
-
renderEmptyState: () => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "pire-table-loading", role: "status", "aria-live": "polite", children: [
|
|
2900
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-sr-only", children: loadingLabel ?? msg.dataTableLoading }),
|
|
2901
|
-
Array.from({ length: skeletonRows }, (_, i) => (
|
|
2902
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
|
|
2903
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SkeletonTableRow, { columns: skeletonColumns, density }, i)
|
|
2904
|
-
))
|
|
2905
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "pire-table-empty", children: emptyLabel ?? msg.dataTableEmpty }),
|
|
2906
|
-
children: [
|
|
2907
|
-
pendingRow && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2908
|
-
import_react_aria_components25.Row,
|
|
2909
|
-
{
|
|
2910
|
-
id: PENDING_KEY,
|
|
2911
|
-
className: "pire-tr",
|
|
2912
|
-
"data-editing": "true",
|
|
2913
|
-
"data-pending": "true",
|
|
2914
|
-
children: [
|
|
2915
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-td", ...pinProps(null) }) : null,
|
|
2916
|
-
columns.map((c) => {
|
|
2917
|
-
const pin = pinProps(c.key);
|
|
2918
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2919
|
-
import_react_aria_components25.Cell,
|
|
2920
|
-
{
|
|
2921
|
-
className: "pire-td",
|
|
2922
|
-
"data-numeric": c.numeric ? "true" : void 0,
|
|
2923
|
-
...pin,
|
|
2924
|
-
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
2925
|
-
children: c.renderEdit ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2926
|
-
EditCell,
|
|
2927
|
-
{
|
|
2928
|
-
isFirst: c === firstEditable,
|
|
2929
|
-
focusToken: pendingFocus,
|
|
2930
|
-
onCommit: () => {
|
|
2931
|
-
onCommitRow?.(null);
|
|
2932
|
-
setPendingFocus((n) => n + 1);
|
|
2933
|
-
},
|
|
2934
|
-
onCancel: () => onCancelRow?.(null),
|
|
2935
|
-
children: c.renderEdit(pendingRow)
|
|
2936
|
-
}
|
|
2937
|
-
) : null
|
|
2938
|
-
},
|
|
2939
|
-
c.key
|
|
2940
|
-
);
|
|
2941
|
-
})
|
|
2942
|
-
]
|
|
2943
|
-
},
|
|
2944
|
-
PENDING_KEY
|
|
2945
|
-
) : null,
|
|
2946
|
-
body.flatMap((row) => {
|
|
2947
|
-
const rowIsDisabled = presentation.get(row.id)?.isDisabled;
|
|
2948
|
-
const editing = isEditing(row);
|
|
2949
|
-
const record = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2950
|
-
import_react_aria_components25.Row,
|
|
2951
|
-
{
|
|
2952
|
-
id: row.id,
|
|
2953
|
-
className: cx("pire-tr", presentation.get(row.id)?.className),
|
|
2954
|
-
"data-pressable": onRowAction && !rowIsDisabled && !editing ? "true" : void 0,
|
|
2955
|
-
"data-editing": editing ? "true" : void 0,
|
|
2956
|
-
children: [
|
|
2957
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-td", ...pinProps(null), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
|
|
2958
|
-
columns.map((c) => {
|
|
2959
|
-
const pin = pinProps(c.key);
|
|
2960
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2961
|
-
import_react_aria_components25.Cell,
|
|
2962
|
-
{
|
|
2963
|
-
className: "pire-td",
|
|
2964
|
-
"data-numeric": c.numeric ? "true" : void 0,
|
|
2965
|
-
"data-tone": c.tone?.(row) ?? void 0,
|
|
2966
|
-
...pin,
|
|
2967
|
-
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
2968
|
-
children: editing && c.renderEdit ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2969
|
-
EditCell,
|
|
2970
|
-
{
|
|
2971
|
-
isFirst: c === firstEditable,
|
|
2972
|
-
focusToken: 0,
|
|
2973
|
-
onCommit: () => onCommitRow?.(row.id),
|
|
2974
|
-
onCancel: () => onCancelRow?.(row.id),
|
|
2975
|
-
children: c.renderEdit(row)
|
|
2976
|
-
}
|
|
2977
|
-
) : c.render ? c.render(row) : row[c.key]
|
|
2978
|
-
},
|
|
2979
|
-
c.key
|
|
2980
|
-
);
|
|
2981
|
-
})
|
|
2982
|
-
]
|
|
2983
|
-
},
|
|
2984
|
-
row.id
|
|
2985
|
-
);
|
|
2986
|
-
if (!renderExpanded || !expanded.has(String(row.id))) return [record];
|
|
2987
|
-
return [
|
|
2988
|
-
record,
|
|
2989
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded(row) }) }, expandedKey(row.id))
|
|
2990
|
-
];
|
|
2991
|
-
})
|
|
2992
|
-
]
|
|
2993
|
-
}
|
|
2994
|
-
),
|
|
2995
|
-
footer && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react_aria_components25.Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
|
|
2996
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-tf", ...pinProps(null) }) : null,
|
|
2997
|
-
columns.map((c, i) => {
|
|
2998
|
-
const pin = pinProps(c.key);
|
|
2999
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3000
|
-
import_react_aria_components25.Cell,
|
|
3001
|
-
{
|
|
3002
|
-
className: "pire-tf",
|
|
3003
|
-
"data-numeric": c.numeric ? "true" : void 0,
|
|
3004
|
-
...pin,
|
|
3005
|
-
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
3006
|
-
children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
|
|
3007
|
-
},
|
|
3008
|
-
c.key
|
|
3009
|
-
);
|
|
3010
|
-
})
|
|
3011
|
-
] }) }) : null
|
|
3012
|
-
]
|
|
3013
|
-
}
|
|
3014
|
-
)
|
|
3119
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LiveEditContext.Provider, { value: { columns, pendingRow }, children: table })
|
|
3015
3120
|
}
|
|
3016
3121
|
);
|
|
3017
3122
|
}
|
|
@@ -3037,17 +3142,20 @@ function ValueHelpDialog({
|
|
|
3037
3142
|
onConfirm
|
|
3038
3143
|
}) {
|
|
3039
3144
|
const msg = usePireMessages();
|
|
3040
|
-
const
|
|
3041
|
-
|
|
3145
|
+
const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
|
|
3146
|
+
const [query, setQuery] = React21.useState("");
|
|
3147
|
+
React21.useEffect(() => {
|
|
3042
3148
|
if (isOpen) setQuery("");
|
|
3043
3149
|
}, [isOpen]);
|
|
3044
3150
|
const isMultiple = selectionMode === "multiple";
|
|
3045
|
-
const
|
|
3151
|
+
const { contains } = (0, import_react_aria_components26.useFilter)({ sensitivity: "base" });
|
|
3152
|
+
const filtered = React21.useMemo(() => {
|
|
3046
3153
|
if (isFilteredExternally) return rows;
|
|
3047
|
-
const q = query.trim()
|
|
3154
|
+
const q = query.trim();
|
|
3048
3155
|
if (!q) return rows;
|
|
3049
|
-
|
|
3050
|
-
|
|
3156
|
+
const searchable = (v) => typeof v === "string" || typeof v === "number";
|
|
3157
|
+
return rows.filter((row) => Object.values(row).some((v) => searchable(v) && contains(String(v), q)));
|
|
3158
|
+
}, [rows, query, isFilteredExternally, contains]);
|
|
3051
3159
|
const handleSearch = (value) => {
|
|
3052
3160
|
setQuery(value);
|
|
3053
3161
|
onSearch?.(value);
|
|
@@ -3092,35 +3200,25 @@ function ValueHelpDialog({
|
|
|
3092
3200
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.([]), children: msg.valueHelpClearSelection }),
|
|
3093
3201
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "pire-valuehelp-count", children: msg.valueHelpSelectedCount.replace("{count}", String(selectedKeys?.length ?? 0)) })
|
|
3094
3202
|
] }) : null,
|
|
3095
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3096
|
-
|
|
3203
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { onScroll: onListScroll, style: { overflow: "auto", maxHeight: "48vh" }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3204
|
+
DataTable,
|
|
3097
3205
|
{
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
selectable: isMultiple ? "multiple" : void 0,
|
|
3113
|
-
hideSelectAll: isMultiple,
|
|
3114
|
-
selected: isMultiple ? selectedKeys : void 0,
|
|
3115
|
-
onSelectionChange: isMultiple ? onSelectionChange : void 0,
|
|
3116
|
-
onRowAction: isMultiple ? void 0 : (row) => {
|
|
3117
|
-
onSelect?.(row);
|
|
3118
|
-
onClose?.();
|
|
3119
|
-
}
|
|
3120
|
-
}
|
|
3121
|
-
)
|
|
3206
|
+
"aria-label": typeof title === "string" ? title : msg.valueHelpDialogTitle,
|
|
3207
|
+
density: "condensed",
|
|
3208
|
+
columns,
|
|
3209
|
+
rows: filtered,
|
|
3210
|
+
isLoading,
|
|
3211
|
+
emptyLabel: emptyLabel ?? msg.valueHelpDialogEmpty,
|
|
3212
|
+
selectable: isMultiple ? "multiple" : void 0,
|
|
3213
|
+
hideSelectAll: isMultiple,
|
|
3214
|
+
selected: isMultiple ? selectedKeys : void 0,
|
|
3215
|
+
onSelectionChange: isMultiple ? onSelectionChange : void 0,
|
|
3216
|
+
onRowAction: isMultiple ? void 0 : (row) => {
|
|
3217
|
+
onSelect?.(row);
|
|
3218
|
+
onClose?.();
|
|
3219
|
+
}
|
|
3122
3220
|
}
|
|
3123
|
-
)
|
|
3221
|
+
) })
|
|
3124
3222
|
] })
|
|
3125
3223
|
}
|
|
3126
3224
|
);
|
|
@@ -3153,7 +3251,7 @@ function ValueHelpField({
|
|
|
3153
3251
|
style
|
|
3154
3252
|
}) {
|
|
3155
3253
|
const msg = usePireMessages();
|
|
3156
|
-
const [open, setOpen] =
|
|
3254
|
+
const [open, setOpen] = React22.useState(false);
|
|
3157
3255
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: cx(className), style, children: [
|
|
3158
3256
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3159
3257
|
Input,
|
|
@@ -3209,11 +3307,11 @@ function ValueHelpField({
|
|
|
3209
3307
|
}
|
|
3210
3308
|
|
|
3211
3309
|
// src/components/forms/FileUpload.tsx
|
|
3212
|
-
var
|
|
3213
|
-
var
|
|
3310
|
+
var React23 = __toESM(require("react"), 1);
|
|
3311
|
+
var import_react_aria_components28 = require("react-aria-components");
|
|
3214
3312
|
|
|
3215
3313
|
// src/components/feedback/ProgressBar.tsx
|
|
3216
|
-
var
|
|
3314
|
+
var import_react_aria_components27 = require("react-aria-components");
|
|
3217
3315
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3218
3316
|
function ProgressBar({
|
|
3219
3317
|
value = 0,
|
|
@@ -3228,7 +3326,7 @@ function ProgressBar({
|
|
|
3228
3326
|
style
|
|
3229
3327
|
}) {
|
|
3230
3328
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3231
|
-
|
|
3329
|
+
import_react_aria_components27.ProgressBar,
|
|
3232
3330
|
{
|
|
3233
3331
|
className: cx("pire-progress", className),
|
|
3234
3332
|
"data-status": status,
|
|
@@ -3240,7 +3338,7 @@ function ProgressBar({
|
|
|
3240
3338
|
style,
|
|
3241
3339
|
children: ({ percentage, valueText }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
3242
3340
|
label || showValue ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "pire-progress-head", children: [
|
|
3243
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3341
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_aria_components27.Label, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", {}),
|
|
3244
3342
|
showValue && !isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "pire-numeric", children: valueText }) : null
|
|
3245
3343
|
] }) : null,
|
|
3246
3344
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "pire-progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "pire-progress-fill", style: { width: `${isIndeterminate ? 40 : percentage}%` } }) })
|
|
@@ -3278,6 +3376,29 @@ function screenFiles(files, { maxSize, acceptedFileTypes }) {
|
|
|
3278
3376
|
}
|
|
3279
3377
|
return { accepted, rejected };
|
|
3280
3378
|
}
|
|
3379
|
+
function usePreviewUrls(files) {
|
|
3380
|
+
const owned = React23.useRef(/* @__PURE__ */ new Set());
|
|
3381
|
+
React23.useEffect(() => {
|
|
3382
|
+
const live = new Set(files.map((f) => f.previewUrl));
|
|
3383
|
+
for (const url of owned.current) {
|
|
3384
|
+
if (live.has(url)) continue;
|
|
3385
|
+
URL.revokeObjectURL(url);
|
|
3386
|
+
owned.current.delete(url);
|
|
3387
|
+
}
|
|
3388
|
+
}, [files]);
|
|
3389
|
+
React23.useEffect(() => {
|
|
3390
|
+
const urls = owned.current;
|
|
3391
|
+
return () => {
|
|
3392
|
+
for (const url of urls) URL.revokeObjectURL(url);
|
|
3393
|
+
urls.clear();
|
|
3394
|
+
};
|
|
3395
|
+
}, []);
|
|
3396
|
+
return (file) => {
|
|
3397
|
+
const url = URL.createObjectURL(file);
|
|
3398
|
+
owned.current.add(url);
|
|
3399
|
+
return url;
|
|
3400
|
+
};
|
|
3401
|
+
}
|
|
3281
3402
|
function FileUpload({
|
|
3282
3403
|
label,
|
|
3283
3404
|
value,
|
|
@@ -3302,15 +3423,14 @@ function FileUpload({
|
|
|
3302
3423
|
...rest
|
|
3303
3424
|
}) {
|
|
3304
3425
|
const msg = usePireMessages();
|
|
3305
|
-
const [uncontrolled, setUncontrolled] =
|
|
3426
|
+
const [uncontrolled, setUncontrolled] = React23.useState(defaultValue ?? []);
|
|
3306
3427
|
const files = value ?? uncontrolled;
|
|
3307
|
-
const
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
);
|
|
3428
|
+
const previewUrlFor = usePreviewUrls(files);
|
|
3429
|
+
const id = React23.useId();
|
|
3430
|
+
const labelId = label ? `${id}-label` : void 0;
|
|
3431
|
+
const hintId = description ? `${id}-hint` : void 0;
|
|
3432
|
+
const errorId = isInvalid && errorMessage ? `${id}-error` : void 0;
|
|
3433
|
+
const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
|
|
3314
3434
|
const commit = (next) => {
|
|
3315
3435
|
if (value === void 0) setUncontrolled(next);
|
|
3316
3436
|
onChange?.(next);
|
|
@@ -3321,8 +3441,7 @@ function FileUpload({
|
|
|
3321
3441
|
if (rejected.length) onError?.(rejected);
|
|
3322
3442
|
if (!accepted.length) return;
|
|
3323
3443
|
const wrapped = accepted.map((file) => {
|
|
3324
|
-
const previewUrl = showPreview && isImage(file) ?
|
|
3325
|
-
if (previewUrl) created.current.push(previewUrl);
|
|
3444
|
+
const previewUrl = showPreview && isImage(file) ? previewUrlFor(file) : void 0;
|
|
3326
3445
|
return { file, previewUrl };
|
|
3327
3446
|
});
|
|
3328
3447
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
@@ -3337,17 +3456,27 @@ function FileUpload({
|
|
|
3337
3456
|
"data-invalid": isInvalid ? "true" : void 0,
|
|
3338
3457
|
...rest,
|
|
3339
3458
|
children: [
|
|
3340
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "pire-field-label", children: [
|
|
3459
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "pire-field-label", id: labelId, children: [
|
|
3341
3460
|
label,
|
|
3342
3461
|
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
3343
3462
|
] }) : null,
|
|
3344
3463
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3345
|
-
|
|
3464
|
+
import_react_aria_components28.FileTrigger,
|
|
3346
3465
|
{
|
|
3347
3466
|
acceptedFileTypes,
|
|
3348
3467
|
allowsMultiple,
|
|
3349
3468
|
onSelect: accept,
|
|
3350
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3469
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3470
|
+
Button,
|
|
3471
|
+
{
|
|
3472
|
+
id: `${id}-button`,
|
|
3473
|
+
icon: "paperclip",
|
|
3474
|
+
isDisabled: isDisabled || isReadOnly,
|
|
3475
|
+
"aria-labelledby": labelId ? `${labelId} ${id}-button` : void 0,
|
|
3476
|
+
"aria-describedby": describedBy,
|
|
3477
|
+
children: chooseLabel ?? msg.fileUploadChoose
|
|
3478
|
+
}
|
|
3479
|
+
)
|
|
3351
3480
|
}
|
|
3352
3481
|
),
|
|
3353
3482
|
files.length ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("li", { className: "pire-fileupload-item", children: [
|
|
@@ -3365,27 +3494,27 @@ function FileUpload({
|
|
|
3365
3494
|
)
|
|
3366
3495
|
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
3367
3496
|
uploadProgress != null ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
3368
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3369
|
-
|
|
3497
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-field-hint", id: hintId, children: description }) : null,
|
|
3498
|
+
errorId ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-field-error", id: errorId, children: errorMessage }) : null
|
|
3370
3499
|
]
|
|
3371
3500
|
}
|
|
3372
3501
|
);
|
|
3373
3502
|
}
|
|
3374
3503
|
|
|
3375
3504
|
// src/components/navigation/ShellBar.tsx
|
|
3376
|
-
var
|
|
3505
|
+
var import_react_aria_components31 = require("react-aria-components");
|
|
3377
3506
|
|
|
3378
3507
|
// src/components/navigation/Breadcrumb.tsx
|
|
3379
|
-
var
|
|
3380
|
-
var
|
|
3508
|
+
var React24 = __toESM(require("react"), 1);
|
|
3509
|
+
var import_react_aria_components30 = require("react-aria-components");
|
|
3381
3510
|
|
|
3382
3511
|
// src/components/navigation/Menu.tsx
|
|
3383
|
-
var
|
|
3512
|
+
var import_react_aria_components29 = require("react-aria-components");
|
|
3384
3513
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3385
3514
|
function Menu({ minWidth, className, style, ...rest }) {
|
|
3386
3515
|
const width = typeof minWidth === "number" ? `${minWidth}px` : minWidth;
|
|
3387
3516
|
const menuStyle = width == null ? style : { ["--pire-menu-min-w"]: width, ...style };
|
|
3388
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_aria_components29.Menu, { className: cx("pire-menu", className), style: menuStyle, ...rest });
|
|
3389
3518
|
}
|
|
3390
3519
|
var shortcutKeys = (shortcut) => {
|
|
3391
3520
|
if (shortcut == null) return [];
|
|
@@ -3403,7 +3532,7 @@ function MenuItem({
|
|
|
3403
3532
|
}) {
|
|
3404
3533
|
const keys = shortcutKeys(shortcut);
|
|
3405
3534
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
3406
|
-
|
|
3535
|
+
import_react_aria_components29.MenuItem,
|
|
3407
3536
|
{
|
|
3408
3537
|
className: cx("pire-menu-item", className),
|
|
3409
3538
|
"data-tone": tone === "danger" ? "danger" : void 0,
|
|
@@ -3427,13 +3556,13 @@ function MenuItem({
|
|
|
3427
3556
|
);
|
|
3428
3557
|
}
|
|
3429
3558
|
function MenuSection({ title, children, className, ...rest }) {
|
|
3430
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
3431
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_aria_components29.MenuSection, { className: cx("pire-menu-section", className), ...rest, children: [
|
|
3560
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_aria_components29.Header, { className: "pire-menu-section-title", children: title }) : null,
|
|
3432
3561
|
children
|
|
3433
3562
|
] });
|
|
3434
3563
|
}
|
|
3435
3564
|
function MenuSeparator({ className }) {
|
|
3436
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_aria_components29.Separator, { className: cx("pire-menu-separator", className) });
|
|
3437
3566
|
}
|
|
3438
3567
|
|
|
3439
3568
|
// src/components/navigation/Breadcrumb.tsx
|
|
@@ -3441,10 +3570,10 @@ var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
|
3441
3570
|
var keyOf = (item) => item.id ?? item.label;
|
|
3442
3571
|
var MIN_CURRENT = 64;
|
|
3443
3572
|
function useFitLevel(enabled) {
|
|
3444
|
-
const boxRef =
|
|
3445
|
-
const measureRef =
|
|
3446
|
-
const [level, setLevel] =
|
|
3447
|
-
|
|
3573
|
+
const boxRef = React24.useRef(null);
|
|
3574
|
+
const measureRef = React24.useRef(null);
|
|
3575
|
+
const [level, setLevel] = React24.useState(0);
|
|
3576
|
+
React24.useLayoutEffect(() => {
|
|
3448
3577
|
const box = boxRef.current;
|
|
3449
3578
|
const measure = measureRef.current;
|
|
3450
3579
|
if (!enabled || !box || !measure) return;
|
|
@@ -3479,7 +3608,7 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3479
3608
|
const crumb = (item) => {
|
|
3480
3609
|
const isLast = item === last;
|
|
3481
3610
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3482
|
-
|
|
3611
|
+
import_react_aria_components30.Breadcrumb,
|
|
3483
3612
|
{
|
|
3484
3613
|
className: "pire-breadcrumb",
|
|
3485
3614
|
id: keyOf(item),
|
|
@@ -3489,8 +3618,8 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3489
3618
|
// A Link even for the current step, because that is what React Aria marks
|
|
3490
3619
|
// `aria-current="page"`. The `title` is what reads the step whole once it truncates.
|
|
3491
3620
|
// A class, not an `a` selector: React Aria renders a Link with no `href` as a <span>.
|
|
3492
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3493
|
-
) : isLast ? item.label : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components30.Link, { className: "pire-breadcrumb-link", href: isLast ? void 0 : item.href, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { title: isLast ? item.label : void 0, children: item.label }) })
|
|
3622
|
+
) : isLast ? item.label : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components30.Link, { href: item.href, children: item.label }),
|
|
3494
3623
|
isLast ? null : separator
|
|
3495
3624
|
]
|
|
3496
3625
|
},
|
|
@@ -3499,7 +3628,7 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3499
3628
|
};
|
|
3500
3629
|
if (!isCollapsible) {
|
|
3501
3630
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3502
|
-
|
|
3631
|
+
import_react_aria_components30.Breadcrumbs,
|
|
3503
3632
|
{
|
|
3504
3633
|
className: cx("pire-breadcrumbs", className),
|
|
3505
3634
|
style,
|
|
@@ -3511,17 +3640,17 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3511
3640
|
}
|
|
3512
3641
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref: boxRef, className: cx("pire-breadcrumbs-fit", className), style, children: [
|
|
3513
3642
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3514
|
-
|
|
3643
|
+
import_react_aria_components30.Breadcrumbs,
|
|
3515
3644
|
{
|
|
3516
3645
|
className: "pire-breadcrumbs",
|
|
3517
3646
|
"data-collapsible": "true",
|
|
3518
3647
|
onAction: (key) => onNavigate?.(String(key)),
|
|
3519
3648
|
children: shown.map(
|
|
3520
|
-
(item, i) => collapse && i === moreAt ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3521
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3522
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3523
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3524
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3649
|
+
(item, i) => collapse && i === moreAt ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(React24.Fragment, { children: [
|
|
3650
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_aria_components30.Breadcrumb, { className: "pire-breadcrumb", id: "__pire_breadcrumb_more__", children: [
|
|
3651
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_aria_components30.MenuTrigger, { children: [
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components30.Button, { className: "pire-breadcrumb-more", "aria-label": msg.breadcrumbMore, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
3653
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components30.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Menu, { onAction: (key) => onNavigate?.(String(key)), children: folded.map((step) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MenuItem, { id: keyOf(step), href: step.href, children: step.label }, keyOf(step))) }) })
|
|
3525
3654
|
] }),
|
|
3526
3655
|
separator
|
|
3527
3656
|
] }),
|
|
@@ -3564,8 +3693,8 @@ function ShellBar({
|
|
|
3564
3693
|
onBreadcrumbNavigate,
|
|
3565
3694
|
onMenu,
|
|
3566
3695
|
onSearch,
|
|
3567
|
-
menuLabel
|
|
3568
|
-
searchLabel
|
|
3696
|
+
menuLabel,
|
|
3697
|
+
searchLabel,
|
|
3569
3698
|
actions,
|
|
3570
3699
|
user,
|
|
3571
3700
|
userMenu,
|
|
@@ -3576,7 +3705,16 @@ function ShellBar({
|
|
|
3576
3705
|
const msg = usePireMessages();
|
|
3577
3706
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("header", { className: cx("pire-shellbar", className), ...rest, children: [
|
|
3578
3707
|
launcher,
|
|
3579
|
-
onMenu ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3708
|
+
onMenu ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3709
|
+
IconButton,
|
|
3710
|
+
{
|
|
3711
|
+
icon: "menu",
|
|
3712
|
+
label: menuLabel ?? msg.shellBarMenu,
|
|
3713
|
+
variant: "inverse",
|
|
3714
|
+
size: "sm",
|
|
3715
|
+
onPress: onMenu
|
|
3716
|
+
}
|
|
3717
|
+
) : null,
|
|
3580
3718
|
monogram ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellbar-mono", "aria-hidden": "true", children: monogram }) : null,
|
|
3581
3719
|
product ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellbar-product", children: product }) : null,
|
|
3582
3720
|
breadcrumb?.length ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("nav", { className: "pire-shellbar-crumbs", "aria-label": msg.breadcrumbLabel, children: [
|
|
@@ -3585,30 +3723,39 @@ function ShellBar({
|
|
|
3585
3723
|
] }) : null,
|
|
3586
3724
|
title ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellbar-title", children: title }) : null,
|
|
3587
3725
|
breadcrumb?.length ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellbar-spacer" }),
|
|
3588
|
-
onSearch ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3726
|
+
onSearch ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3727
|
+
IconButton,
|
|
3728
|
+
{
|
|
3729
|
+
icon: "search",
|
|
3730
|
+
label: searchLabel ?? msg.shellBarSearch,
|
|
3731
|
+
variant: "inverse",
|
|
3732
|
+
size: "sm",
|
|
3733
|
+
onPress: onSearch
|
|
3734
|
+
}
|
|
3735
|
+
) : null,
|
|
3589
3736
|
actions,
|
|
3590
3737
|
user && userMenu ? (
|
|
3591
3738
|
// A real button, not the img-role span: the avatar is where "my profile", "switch company"
|
|
3592
3739
|
// and "sign out" live in any ERP, and a span accepts neither focus nor onPress. Popover is
|
|
3593
3740
|
// rendered here rather than expected from the consumer so the panel keeps shell placement.
|
|
3594
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
3741
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_aria_components31.MenuTrigger, { children: [
|
|
3595
3742
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3596
|
-
|
|
3743
|
+
import_react_aria_components31.Button,
|
|
3597
3744
|
{
|
|
3598
3745
|
className: "pire-avatar pire-avatar-trigger",
|
|
3599
3746
|
"aria-label": (userMenuLabel ?? msg.shellBarUserMenu).replace("{user}", user),
|
|
3600
3747
|
children: initials2(user)
|
|
3601
3748
|
}
|
|
3602
3749
|
),
|
|
3603
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3750
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_aria_components31.Popover, { className: "pire-popover", children: userMenu })
|
|
3604
3751
|
] })
|
|
3605
3752
|
) : user ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-avatar", title: user, "aria-label": user, role: "img", children: initials2(user) }) : null
|
|
3606
3753
|
] });
|
|
3607
3754
|
}
|
|
3608
3755
|
|
|
3609
3756
|
// src/components/navigation/SideNav.tsx
|
|
3610
|
-
var
|
|
3611
|
-
var
|
|
3757
|
+
var React25 = __toESM(require("react"), 1);
|
|
3758
|
+
var import_react_aria_components32 = require("react-aria-components");
|
|
3612
3759
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3613
3760
|
function findActiveParent(groups, value) {
|
|
3614
3761
|
if (value == null) return void 0;
|
|
@@ -3636,10 +3783,10 @@ function SideNav({
|
|
|
3636
3783
|
const msg = usePireMessages();
|
|
3637
3784
|
const activeParent = findActiveParent(groups, value);
|
|
3638
3785
|
const isControlled = expandedIds != null;
|
|
3639
|
-
const [ownExpanded, setOwnExpanded] =
|
|
3786
|
+
const [ownExpanded, setOwnExpanded] = React25.useState(
|
|
3640
3787
|
() => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
|
|
3641
3788
|
);
|
|
3642
|
-
const [lastValue, setLastValue] =
|
|
3789
|
+
const [lastValue, setLastValue] = React25.useState(value);
|
|
3643
3790
|
if (value !== lastValue) {
|
|
3644
3791
|
setLastValue(value);
|
|
3645
3792
|
if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
|
|
@@ -3660,7 +3807,7 @@ function SideNav({
|
|
|
3660
3807
|
const renderRow = (item, onPress, isGroup) => {
|
|
3661
3808
|
const selected = !isGroup && item.id === value;
|
|
3662
3809
|
const button = /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3663
|
-
|
|
3810
|
+
import_react_aria_components32.Button,
|
|
3664
3811
|
{
|
|
3665
3812
|
className: "pire-sidenav-item",
|
|
3666
3813
|
"data-selected": selected ? "true" : void 0,
|
|
@@ -3678,9 +3825,9 @@ function SideNav({
|
|
|
3678
3825
|
);
|
|
3679
3826
|
return collapsed ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Tooltip, { label: item.label, placement: "right", children: button }, item.id) : button;
|
|
3680
3827
|
};
|
|
3681
|
-
const renderRailFlyout = (item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3828
|
+
const renderRailFlyout = (item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_aria_components32.MenuTrigger, { children: [
|
|
3682
3829
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3683
|
-
|
|
3830
|
+
import_react_aria_components32.Button,
|
|
3684
3831
|
{
|
|
3685
3832
|
className: "pire-sidenav-item",
|
|
3686
3833
|
"aria-label": item.label,
|
|
@@ -3688,7 +3835,7 @@ function SideNav({
|
|
|
3688
3835
|
children: item.icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: item.icon, size: 16 }) : null
|
|
3689
3836
|
}
|
|
3690
3837
|
),
|
|
3691
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3838
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_aria_components32.Popover, { className: "pire-popover", placement: "right top", offset: 4, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3692
3839
|
Menu,
|
|
3693
3840
|
{
|
|
3694
3841
|
"aria-label": item.label,
|
|
@@ -3698,9 +3845,9 @@ function SideNav({
|
|
|
3698
3845
|
}
|
|
3699
3846
|
) })
|
|
3700
3847
|
] }, item.id);
|
|
3701
|
-
const renderSection = (item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3848
|
+
const renderSection = (item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_aria_components32.Disclosure, { id: item.id, className: "pire-sidenav-section", children: [
|
|
3702
3849
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3703
|
-
|
|
3850
|
+
import_react_aria_components32.Button,
|
|
3704
3851
|
{
|
|
3705
3852
|
slot: "trigger",
|
|
3706
3853
|
className: "pire-sidenav-item",
|
|
@@ -3714,10 +3861,10 @@ function SideNav({
|
|
|
3714
3861
|
]
|
|
3715
3862
|
}
|
|
3716
3863
|
),
|
|
3717
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3864
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_aria_components32.DisclosurePanel, { className: "pire-sidenav-subnav", children: item.items?.map((child) => {
|
|
3718
3865
|
const selected = child.id === value;
|
|
3719
3866
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3720
|
-
|
|
3867
|
+
import_react_aria_components32.Button,
|
|
3721
3868
|
{
|
|
3722
3869
|
className: "pire-sidenav-item pire-sidenav-subitem",
|
|
3723
3870
|
"data-selected": selected ? "true" : void 0,
|
|
@@ -3752,7 +3899,7 @@ function SideNav({
|
|
|
3752
3899
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "pire-sidenav-group", children: [
|
|
3753
3900
|
group.label && !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "pire-sidenav-label", children: group.label }) : null,
|
|
3754
3901
|
hasSections ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3755
|
-
|
|
3902
|
+
import_react_aria_components32.DisclosureGroup,
|
|
3756
3903
|
{
|
|
3757
3904
|
className: "pire-sidenav-tree",
|
|
3758
3905
|
allowsMultipleExpanded: true,
|
|
@@ -3770,8 +3917,8 @@ function SideNav({
|
|
|
3770
3917
|
}
|
|
3771
3918
|
|
|
3772
3919
|
// src/components/navigation/ShellRail.tsx
|
|
3773
|
-
var
|
|
3774
|
-
var
|
|
3920
|
+
var React26 = __toESM(require("react"), 1);
|
|
3921
|
+
var import_react_aria_components33 = require("react-aria-components");
|
|
3775
3922
|
var import_jsx_runtime45 = (
|
|
3776
3923
|
// The divider is a sibling of the groups rather than a pseudo-element on one, because the
|
|
3777
3924
|
// scrolling zone would carry its own rule out of view on the first wheel event.
|
|
@@ -3779,10 +3926,10 @@ var import_jsx_runtime45 = (
|
|
|
3779
3926
|
);
|
|
3780
3927
|
function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
3781
3928
|
const msg = usePireMessages();
|
|
3782
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
3929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(React26.Fragment, { children: [
|
|
3783
3930
|
gi > 0 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "pire-shellrail-divider" }) : null,
|
|
3784
3931
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "pire-shellrail-group", "data-scroll": group.isScrollable ? "true" : void 0, children: group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Tooltip, { label: item.label, placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3785
|
-
|
|
3932
|
+
import_react_aria_components33.Button,
|
|
3786
3933
|
{
|
|
3787
3934
|
className: "pire-shellrail-item",
|
|
3788
3935
|
"aria-label": item.label,
|
|
@@ -3796,11 +3943,12 @@ function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
|
3796
3943
|
}
|
|
3797
3944
|
|
|
3798
3945
|
// src/components/navigation/Tabs.tsx
|
|
3799
|
-
var
|
|
3946
|
+
var import_react_aria_components34 = require("react-aria-components");
|
|
3800
3947
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3801
3948
|
function Tabs({ items, value, defaultValue, onChange, panels, className, style, ...rest }) {
|
|
3949
|
+
const msg = usePireMessages();
|
|
3802
3950
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3803
|
-
|
|
3951
|
+
import_react_aria_components34.Tabs,
|
|
3804
3952
|
{
|
|
3805
3953
|
className,
|
|
3806
3954
|
style,
|
|
@@ -3808,12 +3956,12 @@ function Tabs({ items, value, defaultValue, onChange, panels, className, style,
|
|
|
3808
3956
|
defaultSelectedKey: defaultValue,
|
|
3809
3957
|
onSelectionChange: (k) => onChange?.(String(k)),
|
|
3810
3958
|
children: [
|
|
3811
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3959
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components34.TabList, { className: "pire-tablist", items, "aria-label": rest["aria-label"] ?? msg.tabsLabel, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_aria_components34.Tab, { className: cx("pire-tab"), id: item.id, isDisabled: item.isDisabled, children: [
|
|
3812
3960
|
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Icon, { name: item.icon, size: 16 }) : null,
|
|
3813
3961
|
item.label,
|
|
3814
3962
|
item.count != null ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "pire-tab-count", children: item.count }) : null
|
|
3815
3963
|
] }) }),
|
|
3816
|
-
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3964
|
+
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components34.TabPanel, { id: item.id, className: panels ? "pire-tabpanel" : void 0, children: panels?.[item.id] }, item.id))
|
|
3817
3965
|
]
|
|
3818
3966
|
}
|
|
3819
3967
|
);
|
|
@@ -3867,7 +4015,10 @@ function Pagination({
|
|
|
3867
4015
|
size: "sm",
|
|
3868
4016
|
fullWidth: false,
|
|
3869
4017
|
value: String(pageSize),
|
|
3870
|
-
options: pageSizes.map((s) => ({
|
|
4018
|
+
options: pageSizes.map((s) => ({
|
|
4019
|
+
value: String(s),
|
|
4020
|
+
label: msg.paginationPageSize.replace("{count}", String(s))
|
|
4021
|
+
})),
|
|
3871
4022
|
onChange: (v) => onPageSizeChange(Number(v)),
|
|
3872
4023
|
style: { width: 120 }
|
|
3873
4024
|
}
|
|
@@ -3876,8 +4027,8 @@ function Pagination({
|
|
|
3876
4027
|
}
|
|
3877
4028
|
|
|
3878
4029
|
// src/components/navigation/Ribbon.tsx
|
|
3879
|
-
var
|
|
3880
|
-
var
|
|
4030
|
+
var React27 = __toESM(require("react"), 1);
|
|
4031
|
+
var import_react_aria_components35 = require("react-aria-components");
|
|
3881
4032
|
var import_jsx_runtime48 = (
|
|
3882
4033
|
// The tile is a column with no room for a third line under a two-line caption, and a mark
|
|
3883
4034
|
// pinned to its corner lands on the icon. Beside the icon is the one place it fits.
|
|
@@ -3896,7 +4047,7 @@ var RibbonGroup = outside("Ribbon.Group", "Ribbon.Tab");
|
|
|
3896
4047
|
var RibbonCommand = outside("Ribbon.Command", "Ribbon.Group");
|
|
3897
4048
|
var CONFIG_ELEMENTS = /* @__PURE__ */ new Set([RibbonTab, RibbonGroup, RibbonCommand]);
|
|
3898
4049
|
function describe(child) {
|
|
3899
|
-
if (!
|
|
4050
|
+
if (!React27.isValidElement(child)) return JSON.stringify(child);
|
|
3900
4051
|
if (typeof child.type === "string") return `<${child.type}>`;
|
|
3901
4052
|
const type = child.type;
|
|
3902
4053
|
return type?.displayName || type?.name || "a component";
|
|
@@ -3904,13 +4055,13 @@ function describe(child) {
|
|
|
3904
4055
|
function childrenOfType(children, type, what, parent) {
|
|
3905
4056
|
const out = [];
|
|
3906
4057
|
const walk = (nodes, path) => {
|
|
3907
|
-
|
|
4058
|
+
React27.Children.forEach(nodes, (child, i) => {
|
|
3908
4059
|
if (child == null || typeof child === "boolean") return;
|
|
3909
|
-
if (
|
|
4060
|
+
if (React27.isValidElement(child) && child.type === React27.Fragment) {
|
|
3910
4061
|
return walk(child.props.children, `${path}${i}.`);
|
|
3911
4062
|
}
|
|
3912
|
-
if (!
|
|
3913
|
-
const isWrapper =
|
|
4063
|
+
if (!React27.isValidElement(child) || child.type !== type) {
|
|
4064
|
+
const isWrapper = React27.isValidElement(child) && typeof child.type !== "string" && !CONFIG_ELEMENTS.has(child.type);
|
|
3914
4065
|
throw new Error(
|
|
3915
4066
|
`[pire] ${parent} accepts only ${what} as children, and got ${describe(child)}.` + (isWrapper ? ` Configuration elements are read, not rendered, so ${parent} cannot see through a wrapper component.` : "")
|
|
3916
4067
|
);
|
|
@@ -3947,7 +4098,7 @@ function Command({
|
|
|
3947
4098
|
const comingSoon = command.isComingSoon === true;
|
|
3948
4099
|
const isDisabled = !comingSoon && (command.isDisabled || command.requiresSelection === true && selectionCount === 0);
|
|
3949
4100
|
const button = /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3950
|
-
|
|
4101
|
+
import_react_aria_components35.Button,
|
|
3951
4102
|
{
|
|
3952
4103
|
className: "pire-ribbon-command",
|
|
3953
4104
|
"data-size": size,
|
|
@@ -3983,9 +4134,9 @@ function Group8({ group, selectionCount }) {
|
|
|
3983
4134
|
] });
|
|
3984
4135
|
}
|
|
3985
4136
|
function useTrailingOverflow() {
|
|
3986
|
-
const ref =
|
|
3987
|
-
const [overflow, setOverflow] =
|
|
3988
|
-
|
|
4137
|
+
const ref = React27.useRef(null);
|
|
4138
|
+
const [overflow, setOverflow] = React27.useState(false);
|
|
4139
|
+
React27.useEffect(() => {
|
|
3989
4140
|
const node = ref.current;
|
|
3990
4141
|
if (!node) return;
|
|
3991
4142
|
const measure = () => setOverflow(node.scrollLeft + node.clientWidth < node.scrollWidth - 1);
|
|
@@ -4010,7 +4161,7 @@ function Surface({
|
|
|
4010
4161
|
}) {
|
|
4011
4162
|
const [scrollRef, overflow] = useTrailingOverflow();
|
|
4012
4163
|
const domId = id ? { id } : {};
|
|
4013
|
-
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
4164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_aria_components35.Toolbar, { ...domId, className, "aria-label": label, children: [
|
|
4014
4165
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-ribbon-scroll", ref: scrollRef, children }),
|
|
4015
4166
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-ribbon-trail", "data-overflow": overflow ? "true" : void 0, children: trailing })
|
|
4016
4167
|
] });
|
|
@@ -4048,18 +4199,18 @@ function Ribbon({
|
|
|
4048
4199
|
const count = selectionCount ?? 0;
|
|
4049
4200
|
const visible = tabs.filter((tab) => !tab.isContextual || count > 0);
|
|
4050
4201
|
const fallback = visible[0]?.id;
|
|
4051
|
-
const [ownTab, setOwnTab] =
|
|
4202
|
+
const [ownTab, setOwnTab] = React27.useState(defaultValue);
|
|
4052
4203
|
const requested = value ?? ownTab;
|
|
4053
4204
|
const selected = visible.some((tab) => tab.id === requested) ? requested : fallback;
|
|
4054
|
-
const select =
|
|
4205
|
+
const select = React27.useCallback(
|
|
4055
4206
|
(id) => {
|
|
4056
4207
|
setOwnTab(id);
|
|
4057
4208
|
onChange?.(id);
|
|
4058
4209
|
},
|
|
4059
4210
|
[onChange]
|
|
4060
4211
|
);
|
|
4061
|
-
const hadSelection =
|
|
4062
|
-
|
|
4212
|
+
const hadSelection = React27.useRef(false);
|
|
4213
|
+
React27.useEffect(() => {
|
|
4063
4214
|
const has = count > 0;
|
|
4064
4215
|
if (has === hadSelection.current) return;
|
|
4065
4216
|
hadSelection.current = has;
|
|
@@ -4068,18 +4219,18 @@ function Ribbon({
|
|
|
4068
4219
|
if (has) select(contextual.id);
|
|
4069
4220
|
else if (requested === contextual.id) select(tabs.find((tab) => !tab.isContextual)?.id ?? "");
|
|
4070
4221
|
}, [count, tabs, requested, select]);
|
|
4071
|
-
const [ownCollapsed, setOwnCollapsed] =
|
|
4222
|
+
const [ownCollapsed, setOwnCollapsed] = React27.useState(false);
|
|
4072
4223
|
const collapsed = isCollapsed ?? ownCollapsed;
|
|
4073
|
-
const toggleRef =
|
|
4074
|
-
const restoreFocus =
|
|
4075
|
-
|
|
4224
|
+
const toggleRef = React27.useRef(null);
|
|
4225
|
+
const restoreFocus = React27.useRef(false);
|
|
4226
|
+
React27.useLayoutEffect(() => {
|
|
4076
4227
|
if (!restoreFocus.current) return;
|
|
4077
4228
|
restoreFocus.current = false;
|
|
4078
4229
|
toggleRef.current?.focus();
|
|
4079
4230
|
});
|
|
4080
|
-
const bandId =
|
|
4231
|
+
const bandId = React27.useId();
|
|
4081
4232
|
const toggle = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4082
|
-
|
|
4233
|
+
import_react_aria_components35.Button,
|
|
4083
4234
|
{
|
|
4084
4235
|
ref: toggleRef,
|
|
4085
4236
|
className: "pire-ribbon-toggle",
|
|
@@ -4109,7 +4260,7 @@ function Ribbon({
|
|
|
4109
4260
|
children: [
|
|
4110
4261
|
primaries.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Command, { command: c, selectionCount: count, inBar: true }, c.key)),
|
|
4111
4262
|
leading ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-ribbon-leading", children: leading }) : null,
|
|
4112
|
-
blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
4263
|
+
blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(React27.Fragment, { children: [
|
|
4113
4264
|
i > 0 || leading || primaries.length ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "pire-ribbon-bar-sep" }) : null,
|
|
4114
4265
|
block.commands.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Command, { command: c, selectionCount: count, inBar: true }, c.key))
|
|
4115
4266
|
] }, block.key))
|
|
@@ -4117,9 +4268,9 @@ function Ribbon({
|
|
|
4117
4268
|
}
|
|
4118
4269
|
) });
|
|
4119
4270
|
}
|
|
4120
|
-
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
4121
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4122
|
-
|
|
4271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_aria_components35.Tabs, { selectedKey: selected, onSelectionChange: (k) => select(String(k)), children: [
|
|
4272
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components35.TabList, { className: "pire-ribbon-tablist", "aria-label": rest["aria-label"], children: visible.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4273
|
+
import_react_aria_components35.Tab,
|
|
4123
4274
|
{
|
|
4124
4275
|
id: tab.id,
|
|
4125
4276
|
className: "pire-ribbon-tab",
|
|
@@ -4128,7 +4279,7 @@ function Ribbon({
|
|
|
4128
4279
|
},
|
|
4129
4280
|
tab.key
|
|
4130
4281
|
)) }),
|
|
4131
|
-
visible.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4282
|
+
visible.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components35.TabPanel, { id: tab.id, className: "pire-ribbon-panel", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4132
4283
|
Surface,
|
|
4133
4284
|
{
|
|
4134
4285
|
id: bandId,
|
|
@@ -4188,7 +4339,7 @@ function InlineMessage({
|
|
|
4188
4339
|
}
|
|
4189
4340
|
|
|
4190
4341
|
// src/components/feedback/Toast.tsx
|
|
4191
|
-
var
|
|
4342
|
+
var React28 = __toESM(require("react"), 1);
|
|
4192
4343
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
4193
4344
|
var KIND_ICON2 = {
|
|
4194
4345
|
info: "info",
|
|
@@ -4221,25 +4372,42 @@ function Toast({
|
|
|
4221
4372
|
}
|
|
4222
4373
|
);
|
|
4223
4374
|
}
|
|
4224
|
-
var ToastContext =
|
|
4375
|
+
var ToastContext = React28.createContext(null);
|
|
4225
4376
|
function ToastProvider({
|
|
4226
4377
|
children,
|
|
4227
4378
|
timeout = 6e3
|
|
4228
4379
|
}) {
|
|
4229
4380
|
const msg = usePireMessages();
|
|
4230
|
-
const [toasts, setToasts] =
|
|
4231
|
-
const
|
|
4232
|
-
const
|
|
4381
|
+
const [toasts, setToasts] = React28.useState([]);
|
|
4382
|
+
const timers = React28.useRef(/* @__PURE__ */ new Map());
|
|
4383
|
+
const nextId = React28.useRef(0);
|
|
4384
|
+
const close = React28.useCallback((id) => {
|
|
4385
|
+
clearTimeout(timers.current.get(id));
|
|
4386
|
+
timers.current.delete(id);
|
|
4387
|
+
setToasts((t) => t.filter((x) => x.id !== id));
|
|
4388
|
+
}, []);
|
|
4389
|
+
const add = React28.useCallback(
|
|
4233
4390
|
(toast) => {
|
|
4234
|
-
const id =
|
|
4391
|
+
const id = String(++nextId.current);
|
|
4235
4392
|
setToasts((t) => [...t, { ...toast, id }]);
|
|
4236
4393
|
const ms = toast.timeout ?? timeout;
|
|
4237
|
-
if (ms > 0)
|
|
4394
|
+
if (ms > 0)
|
|
4395
|
+
timers.current.set(
|
|
4396
|
+
id,
|
|
4397
|
+
setTimeout(() => close(id), ms)
|
|
4398
|
+
);
|
|
4238
4399
|
return id;
|
|
4239
4400
|
},
|
|
4240
4401
|
[close, timeout]
|
|
4241
4402
|
);
|
|
4242
|
-
|
|
4403
|
+
React28.useEffect(() => {
|
|
4404
|
+
const pending = timers.current;
|
|
4405
|
+
return () => {
|
|
4406
|
+
for (const timer of pending.values()) clearTimeout(timer);
|
|
4407
|
+
pending.clear();
|
|
4408
|
+
};
|
|
4409
|
+
}, []);
|
|
4410
|
+
const value = React28.useMemo(() => ({ add, close }), [add, close]);
|
|
4243
4411
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(ToastContext.Provider, { value, children: [
|
|
4244
4412
|
children,
|
|
4245
4413
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
@@ -4255,13 +4423,13 @@ function ToastProvider({
|
|
|
4255
4423
|
] });
|
|
4256
4424
|
}
|
|
4257
4425
|
function useToast() {
|
|
4258
|
-
const ctx =
|
|
4426
|
+
const ctx = React28.useContext(ToastContext);
|
|
4259
4427
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
|
|
4260
4428
|
return ctx;
|
|
4261
4429
|
}
|
|
4262
4430
|
|
|
4263
4431
|
// src/components/data/KpiTile.tsx
|
|
4264
|
-
var
|
|
4432
|
+
var import_react_aria_components36 = require("react-aria-components");
|
|
4265
4433
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4266
4434
|
function KpiTile({
|
|
4267
4435
|
label,
|
|
@@ -4294,7 +4462,7 @@ function KpiTile({
|
|
|
4294
4462
|
footnote ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "pire-kpi-foot", children: footnote }) : null
|
|
4295
4463
|
] });
|
|
4296
4464
|
const props = { className: cx("pire-kpi", className), "data-status": status, style };
|
|
4297
|
-
return onPress ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4465
|
+
return onPress ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_aria_components36.Button, { ...props, "data-pressable": "true", onPress, children: body }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { ...props, children: body });
|
|
4298
4466
|
}
|
|
4299
4467
|
|
|
4300
4468
|
// src/components/data/ObjectHeader.tsx
|
|
@@ -4633,14 +4801,14 @@ function BarChart({
|
|
|
4633
4801
|
}
|
|
4634
4802
|
|
|
4635
4803
|
// src/components/data/LineChart.tsx
|
|
4636
|
-
var
|
|
4804
|
+
var React29 = __toESM(require("react"), 1);
|
|
4637
4805
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4638
4806
|
var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
|
|
4639
4807
|
var MARKER_LIMIT = 20;
|
|
4640
|
-
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ?
|
|
4808
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React29.useEffect : React29.useLayoutEffect;
|
|
4641
4809
|
function useMeasuredWidth() {
|
|
4642
|
-
const ref =
|
|
4643
|
-
const [width, setWidth] =
|
|
4810
|
+
const ref = React29.useRef(null);
|
|
4811
|
+
const [width, setWidth] = React29.useState(0);
|
|
4644
4812
|
useIsomorphicLayoutEffect2(() => {
|
|
4645
4813
|
const element = ref.current;
|
|
4646
4814
|
if (!element) return;
|
|
@@ -4795,7 +4963,7 @@ function LineChart({
|
|
|
4795
4963
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "pire-chart-tip-row", children: [
|
|
4796
4964
|
one.label,
|
|
4797
4965
|
": ",
|
|
4798
|
-
value == null ?
|
|
4966
|
+
value == null ? msg.chartNoValue : formatValue(value)
|
|
4799
4967
|
] }, one.id);
|
|
4800
4968
|
})
|
|
4801
4969
|
] }) }, categoryIndex)
|
|
@@ -4808,7 +4976,7 @@ function LineChart({
|
|
|
4808
4976
|
}
|
|
4809
4977
|
|
|
4810
4978
|
// src/components/data/DonutChart.tsx
|
|
4811
|
-
var
|
|
4979
|
+
var React30 = __toESM(require("react"), 1);
|
|
4812
4980
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4813
4981
|
var SEGMENT_GAP_DEGREES = 1.5;
|
|
4814
4982
|
function DonutChart({
|
|
@@ -4829,7 +4997,7 @@ function DonutChart({
|
|
|
4829
4997
|
}) {
|
|
4830
4998
|
const label = rest["aria-label"];
|
|
4831
4999
|
const msg = usePireMessages();
|
|
4832
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
5000
|
+
const [hoveredIndex, setHoveredIndex] = React30.useState(null);
|
|
4833
5001
|
warnOnDonutShape(series, categories.length, label);
|
|
4834
5002
|
const values = (series[0]?.values ?? []).slice(0, categories.length);
|
|
4835
5003
|
const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
|
|
@@ -4840,7 +5008,7 @@ function DonutChart({
|
|
|
4840
5008
|
const circumference = 2 * Math.PI * radius;
|
|
4841
5009
|
const gapLength = SEGMENT_GAP_DEGREES / 360 * circumference;
|
|
4842
5010
|
const legend = segments.map((segment) => ({
|
|
4843
|
-
key: segment.
|
|
5011
|
+
key: String(segment.index),
|
|
4844
5012
|
label: segment.category,
|
|
4845
5013
|
color: colorForSegment(segment.index)
|
|
4846
5014
|
}));
|
|
@@ -4888,7 +5056,7 @@ function DonutChart({
|
|
|
4888
5056
|
"data-hovered": hoveredIndex === segment.index ? "true" : void 0,
|
|
4889
5057
|
onMouseEnter: () => setHoveredIndex(segment.index)
|
|
4890
5058
|
},
|
|
4891
|
-
segment.
|
|
5059
|
+
segment.index
|
|
4892
5060
|
)
|
|
4893
5061
|
);
|
|
4894
5062
|
}) })
|
|
@@ -4907,14 +5075,14 @@ function colorForSegment(index) {
|
|
|
4907
5075
|
}
|
|
4908
5076
|
|
|
4909
5077
|
// src/components/data/LinkList.tsx
|
|
4910
|
-
var
|
|
5078
|
+
var import_react_aria_components37 = require("react-aria-components");
|
|
4911
5079
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4912
5080
|
function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
|
|
4913
5081
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: cx("pire-linklist", className), role: "list", "data-emphasis": emphasis, ...rest, children: items.map((item) => {
|
|
4914
5082
|
const keySlot = item.key ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "pire-linklist-key", children: item.key }) : null;
|
|
4915
5083
|
const textSlot = item.text ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "pire-linklist-text", children: item.text }) : null;
|
|
4916
5084
|
const [first, second] = emphasis === "text" ? [textSlot, keySlot] : [keySlot, textSlot];
|
|
4917
|
-
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "listitem", className: "pire-linklist-row", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "listitem", className: "pire-linklist-row", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react_aria_components37.Button, { className: "pire-linklist-item", onPress: () => onSelect?.(item.id), children: [
|
|
4918
5086
|
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: item.icon, size: 16, style: { color: "var(--text-secondary)" } }) : null,
|
|
4919
5087
|
first,
|
|
4920
5088
|
second,
|
|
@@ -4953,7 +5121,7 @@ function RecordCard({
|
|
|
4953
5121
|
}
|
|
4954
5122
|
|
|
4955
5123
|
// src/components/data/ViewSwitcher.tsx
|
|
4956
|
-
var
|
|
5124
|
+
var import_react_aria_components38 = require("react-aria-components");
|
|
4957
5125
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4958
5126
|
function ViewSwitcher({
|
|
4959
5127
|
name,
|
|
@@ -4968,7 +5136,7 @@ function ViewSwitcher({
|
|
|
4968
5136
|
const msg = usePireMessages();
|
|
4969
5137
|
const label = ariaLabel ?? (isDirty ? msg.viewSwitcherNameModified.replace("{view}", name) : msg.viewSwitcherName.replace("{view}", name));
|
|
4970
5138
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
4971
|
-
|
|
5139
|
+
import_react_aria_components38.Button,
|
|
4972
5140
|
{
|
|
4973
5141
|
className: cx("pire-viewswitcher", className),
|
|
4974
5142
|
style,
|
|
@@ -5048,8 +5216,8 @@ function SectionHeader({ title, meta, actions, className, ...rest }) {
|
|
|
5048
5216
|
}
|
|
5049
5217
|
|
|
5050
5218
|
// src/components/layout/SelectionBar.tsx
|
|
5051
|
-
var
|
|
5052
|
-
var
|
|
5219
|
+
var React31 = __toESM(require("react"), 1);
|
|
5220
|
+
var import_react_aria_components39 = require("react-aria-components");
|
|
5053
5221
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
5054
5222
|
function SelectionBar({
|
|
5055
5223
|
count,
|
|
@@ -5064,9 +5232,9 @@ function SelectionBar({
|
|
|
5064
5232
|
...rest
|
|
5065
5233
|
}) {
|
|
5066
5234
|
const msg = usePireMessages();
|
|
5067
|
-
const { locale } = (0,
|
|
5068
|
-
const plural =
|
|
5069
|
-
const numbers =
|
|
5235
|
+
const { locale } = (0, import_react_aria_components39.useLocale)();
|
|
5236
|
+
const plural = React31.useMemo(() => new Intl.PluralRules(locale), [locale]);
|
|
5237
|
+
const numbers = React31.useMemo(() => new Intl.NumberFormat(locale), [locale]);
|
|
5070
5238
|
if (!count) return null;
|
|
5071
5239
|
const isOne = plural.select(count) === "one";
|
|
5072
5240
|
let sentence;
|
|
@@ -5140,8 +5308,8 @@ function ConfirmDialog({
|
|
|
5140
5308
|
facts,
|
|
5141
5309
|
consequence,
|
|
5142
5310
|
children,
|
|
5143
|
-
confirmLabel
|
|
5144
|
-
cancelLabel
|
|
5311
|
+
confirmLabel,
|
|
5312
|
+
cancelLabel,
|
|
5145
5313
|
tone = "primary",
|
|
5146
5314
|
isBusy,
|
|
5147
5315
|
onConfirm,
|
|
@@ -5159,8 +5327,8 @@ function ConfirmDialog({
|
|
|
5159
5327
|
isDismissable: !isBusy,
|
|
5160
5328
|
showClose: false,
|
|
5161
5329
|
footer: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
5162
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Button, { variant: "tertiary", isDisabled: isBusy, onPress: onCancel, children: cancelLabel }),
|
|
5163
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Button, { variant: tone === "danger" ? "danger" : "primary", isDisabled: isBusy, onPress: onConfirm, children: isBusy ?
|
|
5330
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Button, { variant: "tertiary", isDisabled: isBusy, onPress: onCancel, children: cancelLabel ?? msg.confirmDialogCancel }),
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Button, { variant: tone === "danger" ? "danger" : "primary", isDisabled: isBusy, onPress: onConfirm, children: isBusy ? msg.confirmDialogBusy : confirmLabel ?? msg.confirmDialogConfirm })
|
|
5164
5332
|
] }),
|
|
5165
5333
|
children: [
|
|
5166
5334
|
facts?.length ? (
|
|
@@ -5185,8 +5353,8 @@ function ConfirmDialog({
|
|
|
5185
5353
|
}
|
|
5186
5354
|
|
|
5187
5355
|
// src/components/patterns/CommandPalette.tsx
|
|
5188
|
-
var
|
|
5189
|
-
var
|
|
5356
|
+
var React32 = __toESM(require("react"), 1);
|
|
5357
|
+
var import_react_aria_components40 = require("react-aria-components");
|
|
5190
5358
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
5191
5359
|
var RESULTS_SECTION_KEY = "__pire_results__";
|
|
5192
5360
|
var searchableText = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
@@ -5208,17 +5376,17 @@ function CommandPalette({
|
|
|
5208
5376
|
style
|
|
5209
5377
|
}) {
|
|
5210
5378
|
const msg = usePireMessages();
|
|
5211
|
-
const [query, setQuery] =
|
|
5212
|
-
const { contains } = (0,
|
|
5213
|
-
|
|
5379
|
+
const [query, setQuery] = React32.useState("");
|
|
5380
|
+
const { contains } = (0, import_react_aria_components40.useFilter)({ sensitivity: "base" });
|
|
5381
|
+
React32.useEffect(() => {
|
|
5214
5382
|
if (isOpen) setQuery("");
|
|
5215
5383
|
}, [isOpen]);
|
|
5216
|
-
const searchableById =
|
|
5384
|
+
const searchableById = React32.useMemo(() => {
|
|
5217
5385
|
const byId = /* @__PURE__ */ new Map();
|
|
5218
5386
|
for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
|
|
5219
5387
|
return byId;
|
|
5220
5388
|
}, [groups]);
|
|
5221
|
-
const filter =
|
|
5389
|
+
const filter = React32.useCallback(
|
|
5222
5390
|
(textValue, inputValue, node) => {
|
|
5223
5391
|
if (node.parentKey === RESULTS_SECTION_KEY) return true;
|
|
5224
5392
|
return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
|
|
@@ -5232,7 +5400,7 @@ function CommandPalette({
|
|
|
5232
5400
|
const sections = [...groups, ...resultsGroup ? [{ ...resultsGroup, id: RESULTS_SECTION_KEY }] : []];
|
|
5233
5401
|
const status = isLoading ? loadingLabel ?? msg.commandPaletteLoading : emptyLabel ?? msg.commandPaletteEmpty;
|
|
5234
5402
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5235
|
-
|
|
5403
|
+
import_react_aria_components40.ModalOverlay,
|
|
5236
5404
|
{
|
|
5237
5405
|
className: "pire-cp-overlay",
|
|
5238
5406
|
isOpen,
|
|
@@ -5240,12 +5408,12 @@ function CommandPalette({
|
|
|
5240
5408
|
onOpenChange: (open) => {
|
|
5241
5409
|
if (!open) onOpenChange?.(false);
|
|
5242
5410
|
},
|
|
5243
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5244
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
5245
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
5411
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react_aria_components40.Modal, { className: cx("pire-cp-modal", className), style, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_aria_components40.Dialog, { className: "pire-cp-dialog", "aria-label": ariaLabel ?? msg.commandPaletteLabel, children: [
|
|
5412
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_aria_components40.Autocomplete, { filter, inputValue: query, onInputChange: handleInputChange, children: [
|
|
5413
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_aria_components40.SearchField, { className: "pire-cp-search", "aria-label": msg.commandPaletteSearchLabel, children: [
|
|
5246
5414
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Icon, { name: "search", size: 18, className: "pire-cp-search-icon" }),
|
|
5247
5415
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5248
|
-
|
|
5416
|
+
import_react_aria_components40.Input,
|
|
5249
5417
|
{
|
|
5250
5418
|
className: "pire-cp-input",
|
|
5251
5419
|
autoFocus: true,
|
|
@@ -5255,13 +5423,13 @@ function CommandPalette({
|
|
|
5255
5423
|
] }),
|
|
5256
5424
|
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "pire-cp-loading", role: "status", "aria-live": "polite", children: loadingLabel ?? msg.commandPaletteLoading }) : null,
|
|
5257
5425
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5258
|
-
|
|
5426
|
+
import_react_aria_components40.Menu,
|
|
5259
5427
|
{
|
|
5260
5428
|
className: "pire-cp-list",
|
|
5261
5429
|
onAction: (key) => onAction?.(String(key)),
|
|
5262
5430
|
renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "pire-cp-status", children: status }),
|
|
5263
|
-
children: sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
5264
|
-
section.label ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5431
|
+
children: sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_aria_components40.MenuSection, { id: section.id, className: "pire-cp-section", children: [
|
|
5432
|
+
section.label ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react_aria_components40.Header, { className: "pire-cp-section-title", children: section.label }) : null,
|
|
5265
5433
|
section.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5266
5434
|
MenuItem,
|
|
5267
5435
|
{
|
|
@@ -5304,9 +5472,9 @@ function CommandPalette({
|
|
|
5304
5472
|
);
|
|
5305
5473
|
}
|
|
5306
5474
|
function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
5307
|
-
const handler =
|
|
5475
|
+
const handler = React32.useRef(onTrigger);
|
|
5308
5476
|
handler.current = onTrigger;
|
|
5309
|
-
|
|
5477
|
+
React32.useEffect(() => {
|
|
5310
5478
|
if (isDisabled) return;
|
|
5311
5479
|
const onKeyDown = (event) => {
|
|
5312
5480
|
if (!(event.metaKey || event.ctrlKey) || event.altKey) return;
|
|
@@ -5320,8 +5488,8 @@ function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
|
5320
5488
|
}
|
|
5321
5489
|
|
|
5322
5490
|
// src/components/patterns/AppLauncher.tsx
|
|
5323
|
-
var
|
|
5324
|
-
var
|
|
5491
|
+
var React33 = __toESM(require("react"), 1);
|
|
5492
|
+
var import_react_aria_components41 = require("react-aria-components");
|
|
5325
5493
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
5326
5494
|
var searchableText2 = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
5327
5495
|
function AppLauncher({
|
|
@@ -5341,13 +5509,13 @@ function AppLauncher({
|
|
|
5341
5509
|
className
|
|
5342
5510
|
}) {
|
|
5343
5511
|
const msg = usePireMessages();
|
|
5344
|
-
const [query, setQuery] =
|
|
5345
|
-
const { contains } = (0,
|
|
5512
|
+
const [query, setQuery] = React33.useState("");
|
|
5513
|
+
const { contains } = (0, import_react_aria_components41.useFilter)({ sensitivity: "base" });
|
|
5346
5514
|
const handleSearch = (next) => {
|
|
5347
5515
|
setQuery(next);
|
|
5348
5516
|
onSearchChange?.(next);
|
|
5349
5517
|
};
|
|
5350
|
-
const visible =
|
|
5518
|
+
const visible = React33.useMemo(() => {
|
|
5351
5519
|
if (isFilteredExternally) return sections;
|
|
5352
5520
|
const q = query.trim();
|
|
5353
5521
|
if (!q) return sections;
|
|
@@ -5358,86 +5526,90 @@ function AppLauncher({
|
|
|
5358
5526
|
}, [sections, query, isFilteredExternally, contains]);
|
|
5359
5527
|
const isEmpty = !isLoading && visible.length === 0;
|
|
5360
5528
|
const label = ariaLabel ?? msg.appLauncherLabel;
|
|
5361
|
-
return
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
{
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5529
|
+
return (
|
|
5530
|
+
// Each opening starts from the full list, as CommandPalette and ValueHelpDialog do. Reset through
|
|
5531
|
+
// `handleSearch` so a consumer filtering on the server clears its query too.
|
|
5532
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_react_aria_components41.DialogTrigger, { onOpenChange: (open) => open && query && handleSearch(""), children: [
|
|
5533
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react_aria_components41.Button, { className: "pire-launcher-trigger", "aria-label": label, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Icon, { name: icon, size: 20 }) }),
|
|
5534
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5535
|
+
import_react_aria_components41.Popover,
|
|
5536
|
+
{
|
|
5537
|
+
className: cx("pire-launcher-popover", className),
|
|
5538
|
+
placement: "bottom start",
|
|
5539
|
+
offset: 0,
|
|
5540
|
+
crossOffset: 0,
|
|
5541
|
+
containerPadding: 0,
|
|
5542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react_aria_components41.Dialog, { className: "pire-launcher", "aria-label": label, children: ({ close }) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
5543
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "pire-launcher-head", children: [
|
|
5544
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-title", children: title ?? msg.appLauncherTitle }),
|
|
5545
|
+
meta ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-meta", children: meta }) : null
|
|
5546
|
+
] }),
|
|
5547
|
+
isSearchable ? (
|
|
5548
|
+
// autoFocus is right here specifically: the panel exists to be searched, and the
|
|
5549
|
+
// user just chose to open it, so taking the caret is what they asked for.
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5551
|
+
Input,
|
|
5552
|
+
{
|
|
5553
|
+
"aria-label": msg.appLauncherSearch,
|
|
5554
|
+
icon: "search",
|
|
5555
|
+
type: "search",
|
|
5556
|
+
autoFocus: true,
|
|
5557
|
+
isClearable: true,
|
|
5558
|
+
value: query,
|
|
5559
|
+
onChange: handleSearch,
|
|
5560
|
+
placeholder: searchPlaceholder ?? msg.appLauncherSearch
|
|
5561
|
+
}
|
|
5562
|
+
)
|
|
5563
|
+
) : null,
|
|
5564
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-launcher-empty", role: "status", "aria-live": "polite", children: msg.appLauncherLoading }) : null,
|
|
5565
|
+
isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-launcher-empty", children: emptyLabel ?? msg.appLauncherEmpty }) : null,
|
|
5566
|
+
visible.map((section, si) => (
|
|
5567
|
+
// Sections are positional zones with no record identity, so the heading is the key
|
|
5568
|
+
// where there is one. Same reasoning as ShellRail's groups.
|
|
5569
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "pire-launcher-section", children: [
|
|
5570
|
+
section.label ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-eyebrow", children: section.label }) : null,
|
|
5571
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-launcher-grid", "data-variant": section.variant ?? "tile", children: section.items.map((item) => {
|
|
5572
|
+
const isCurrent = item.id === value;
|
|
5573
|
+
const showsDescription = (section.variant ?? "tile") === "tile" && Boolean(item.description);
|
|
5574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
5575
|
+
import_react_aria_components41.Button,
|
|
5576
|
+
{
|
|
5577
|
+
className: "pire-launcher-item",
|
|
5578
|
+
"data-selected": isCurrent ? "true" : void 0,
|
|
5579
|
+
"aria-current": isCurrent ? "true" : void 0,
|
|
5580
|
+
onPress: () => {
|
|
5581
|
+
close();
|
|
5582
|
+
onAction?.(item.id);
|
|
5583
|
+
},
|
|
5584
|
+
children: [
|
|
5585
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-item-icon", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5586
|
+
Icon,
|
|
5587
|
+
{
|
|
5588
|
+
name: item.icon,
|
|
5589
|
+
size: (section.variant ?? "tile") === "tile" ? 20 : 16
|
|
5590
|
+
}
|
|
5591
|
+
) }) : null,
|
|
5592
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "pire-launcher-item-text", children: [
|
|
5593
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-item-label", children: item.label }),
|
|
5594
|
+
showsDescription ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-item-desc", children: item.description }) : null
|
|
5595
|
+
] })
|
|
5596
|
+
]
|
|
5412
5597
|
},
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
showsDescription ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-item-desc", children: item.description }) : null
|
|
5424
|
-
] })
|
|
5425
|
-
]
|
|
5426
|
-
},
|
|
5427
|
-
item.id
|
|
5428
|
-
);
|
|
5429
|
-
}) })
|
|
5430
|
-
] }, section.label ?? section.items[0]?.id ?? si)
|
|
5431
|
-
))
|
|
5432
|
-
] }) })
|
|
5433
|
-
}
|
|
5434
|
-
)
|
|
5435
|
-
] });
|
|
5598
|
+
item.id
|
|
5599
|
+
);
|
|
5600
|
+
}) })
|
|
5601
|
+
] }, section.label ?? section.items[0]?.id ?? si)
|
|
5602
|
+
))
|
|
5603
|
+
] }) })
|
|
5604
|
+
}
|
|
5605
|
+
)
|
|
5606
|
+
] })
|
|
5607
|
+
);
|
|
5436
5608
|
}
|
|
5437
5609
|
|
|
5438
5610
|
// src/components/patterns/SidePanel.tsx
|
|
5439
|
-
var
|
|
5440
|
-
var
|
|
5611
|
+
var React34 = __toESM(require("react"), 1);
|
|
5612
|
+
var import_react_aria_components42 = require("react-aria-components");
|
|
5441
5613
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
5442
5614
|
var PHONE_MAX_WIDTH = 600;
|
|
5443
5615
|
var narrowQuery = `(max-width: ${PHONE_MAX_WIDTH}px)`;
|
|
@@ -5461,8 +5633,8 @@ function SidePanel({
|
|
|
5461
5633
|
className
|
|
5462
5634
|
}) {
|
|
5463
5635
|
const msg = usePireMessages();
|
|
5464
|
-
const titleId =
|
|
5465
|
-
const narrow =
|
|
5636
|
+
const titleId = React34.useId();
|
|
5637
|
+
const narrow = React34.useSyncExternalStore(subscribeNarrow, isNarrow, () => false);
|
|
5466
5638
|
const head = (heading) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("header", { className: "pire-dialog-head", children: [
|
|
5467
5639
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5468
5640
|
heading,
|
|
@@ -5500,7 +5672,7 @@ function SidePanel({
|
|
|
5500
5672
|
);
|
|
5501
5673
|
}
|
|
5502
5674
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5503
|
-
|
|
5675
|
+
import_react_aria_components42.ModalOverlay,
|
|
5504
5676
|
{
|
|
5505
5677
|
className: "pire-sidepanel-overlay",
|
|
5506
5678
|
isOpen,
|
|
@@ -5508,9 +5680,9 @@ function SidePanel({
|
|
|
5508
5680
|
onOpenChange: (o) => {
|
|
5509
5681
|
if (!o) onClose?.();
|
|
5510
5682
|
},
|
|
5511
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5683
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react_aria_components42.Modal, { className: cx("pire-sidepanel", className), style: { width }, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_react_aria_components42.Dialog, { className: "pire-dialog", style: { height: "100%" }, children: [
|
|
5512
5684
|
head(
|
|
5513
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5685
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react_aria_components42.Heading, { slot: "title", className: "pire-dialog-title", children: title })
|
|
5514
5686
|
),
|
|
5515
5687
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "pire-dialog-body", style: { flex: 1 }, children }),
|
|
5516
5688
|
footer ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("footer", { className: "pire-dialog-foot", children: footer }) : null
|
|
@@ -5539,8 +5711,8 @@ function EmptyState({
|
|
|
5539
5711
|
}
|
|
5540
5712
|
|
|
5541
5713
|
// src/components/patterns/NumPad.tsx
|
|
5542
|
-
var
|
|
5543
|
-
var
|
|
5714
|
+
var React35 = __toESM(require("react"), 1);
|
|
5715
|
+
var import_react_aria_components43 = require("react-aria-components");
|
|
5544
5716
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
5545
5717
|
var BASE_KEYS = [
|
|
5546
5718
|
{ value: "7" },
|
|
@@ -5564,9 +5736,9 @@ function fittingDigits(digits, buffer, separator, maxFractionDigits) {
|
|
|
5564
5736
|
return room <= 0 ? "" : digits.slice(0, room);
|
|
5565
5737
|
}
|
|
5566
5738
|
function useNumPadKeyboard(onKey, isDisabled, containerRef) {
|
|
5567
|
-
const handler =
|
|
5739
|
+
const handler = React35.useRef(onKey);
|
|
5568
5740
|
handler.current = onKey;
|
|
5569
|
-
|
|
5741
|
+
React35.useEffect(() => {
|
|
5570
5742
|
if (isDisabled) return;
|
|
5571
5743
|
const isEditingElsewhere = () => {
|
|
5572
5744
|
const el = document.activeElement;
|
|
@@ -5613,11 +5785,11 @@ function NumPad({
|
|
|
5613
5785
|
style
|
|
5614
5786
|
}) {
|
|
5615
5787
|
const msg = usePireMessages();
|
|
5616
|
-
const containerRef =
|
|
5617
|
-
const { locale } = (0,
|
|
5788
|
+
const containerRef = React35.useRef(null);
|
|
5789
|
+
const { locale } = (0, import_react_aria_components43.useLocale)();
|
|
5618
5790
|
const separator = decimalSeparatorFor(locale);
|
|
5619
5791
|
const allowsDecimal = maxFractionDigits !== void 0 && maxFractionDigits > 0;
|
|
5620
|
-
const applyKey =
|
|
5792
|
+
const applyKey = React35.useCallback(
|
|
5621
5793
|
(key) => {
|
|
5622
5794
|
if (isDisabled) return;
|
|
5623
5795
|
if (key.value === "backspace") {
|
|
@@ -5684,8 +5856,8 @@ function NumPad({
|
|
|
5684
5856
|
}
|
|
5685
5857
|
|
|
5686
5858
|
// src/components/patterns/FileDropZone.tsx
|
|
5687
|
-
var
|
|
5688
|
-
var
|
|
5859
|
+
var React36 = __toESM(require("react"), 1);
|
|
5860
|
+
var import_react_aria_components44 = require("react-aria-components");
|
|
5689
5861
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
5690
5862
|
var isImage2 = (file) => file.type.startsWith("image/");
|
|
5691
5863
|
function FileDropZone({
|
|
@@ -5714,15 +5886,14 @@ function FileDropZone({
|
|
|
5714
5886
|
...rest
|
|
5715
5887
|
}) {
|
|
5716
5888
|
const msg = usePireMessages();
|
|
5717
|
-
const [uncontrolled, setUncontrolled] =
|
|
5889
|
+
const [uncontrolled, setUncontrolled] = React36.useState(defaultValue ?? []);
|
|
5718
5890
|
const files = value ?? uncontrolled;
|
|
5719
|
-
const
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
);
|
|
5891
|
+
const previewUrlFor = usePreviewUrls(files);
|
|
5892
|
+
const id = React36.useId();
|
|
5893
|
+
const labelId = label ? `${id}-label` : void 0;
|
|
5894
|
+
const hintId = description ? `${id}-hint` : void 0;
|
|
5895
|
+
const errorId = isInvalid && errorMessage ? `${id}-error` : void 0;
|
|
5896
|
+
const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
|
|
5726
5897
|
const commit = (next) => {
|
|
5727
5898
|
if (value === void 0) setUncontrolled(next);
|
|
5728
5899
|
onChange?.(next);
|
|
@@ -5733,39 +5904,39 @@ function FileDropZone({
|
|
|
5733
5904
|
if (rejected.length) onError?.(rejected);
|
|
5734
5905
|
if (!accepted.length) return;
|
|
5735
5906
|
const wrapped = accepted.map((file) => {
|
|
5736
|
-
const previewUrl = showPreview && isImage2(file) ?
|
|
5737
|
-
if (previewUrl) created.current.push(previewUrl);
|
|
5907
|
+
const previewUrl = showPreview && isImage2(file) ? previewUrlFor(file) : void 0;
|
|
5738
5908
|
return { file, previewUrl };
|
|
5739
5909
|
});
|
|
5740
5910
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
5741
5911
|
};
|
|
5742
5912
|
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
5743
5913
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: cx("pire-field", className), style, "data-full-width": String(fullWidth), ...rest, children: [
|
|
5744
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "pire-field-label", children: [
|
|
5914
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "pire-field-label", id: labelId, children: [
|
|
5745
5915
|
label,
|
|
5746
5916
|
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
5747
5917
|
] }) : null,
|
|
5748
5918
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
5749
|
-
|
|
5919
|
+
import_react_aria_components44.DropZone,
|
|
5750
5920
|
{
|
|
5751
5921
|
className: "pire-dropzone",
|
|
5752
5922
|
"aria-label": ariaLabel,
|
|
5923
|
+
"aria-labelledby": ariaLabel ? void 0 : labelId,
|
|
5753
5924
|
"data-height": height,
|
|
5754
5925
|
isDisabled: isDisabled || isReadOnly,
|
|
5755
5926
|
onDrop: async (e) => {
|
|
5756
|
-
const dropped = await Promise.all(e.items.filter(
|
|
5927
|
+
const dropped = await Promise.all(e.items.filter(import_react_aria_components44.isFileDropItem).map((item) => item.getFile()));
|
|
5757
5928
|
accept(dropped);
|
|
5758
5929
|
},
|
|
5759
5930
|
children: [
|
|
5760
5931
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Icon, { name: "download", size: 24, className: "pire-dropzone-icon" }),
|
|
5761
5932
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-dropzone-prompt", children: promptLabel ?? msg.fileDropZonePrompt }),
|
|
5762
5933
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
5763
|
-
|
|
5934
|
+
import_react_aria_components44.FileTrigger,
|
|
5764
5935
|
{
|
|
5765
5936
|
acceptedFileTypes,
|
|
5766
5937
|
allowsMultiple,
|
|
5767
5938
|
onSelect: (list) => accept(list ? [...list] : []),
|
|
5768
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Button, { variant: "secondary", isDisabled: isDisabled || isReadOnly, children: msg.fileUploadChoose })
|
|
5939
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Button, { variant: "secondary", isDisabled: isDisabled || isReadOnly, "aria-describedby": describedBy, children: msg.fileUploadChoose })
|
|
5769
5940
|
}
|
|
5770
5941
|
)
|
|
5771
5942
|
]
|
|
@@ -5786,14 +5957,14 @@ function FileDropZone({
|
|
|
5786
5957
|
)
|
|
5787
5958
|
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
5788
5959
|
uploadProgress != null ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
5789
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-field-hint", children: description }) : null,
|
|
5790
|
-
|
|
5960
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-field-hint", id: hintId, children: description }) : null,
|
|
5961
|
+
errorId ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-field-error", id: errorId, children: errorMessage }) : null
|
|
5791
5962
|
] });
|
|
5792
5963
|
}
|
|
5793
5964
|
|
|
5794
5965
|
// src/index.ts
|
|
5795
|
-
var import_react_aria_components44 = require("react-aria-components");
|
|
5796
5966
|
var import_react_aria_components45 = require("react-aria-components");
|
|
5967
|
+
var import_react_aria_components46 = require("react-aria-components");
|
|
5797
5968
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5798
5969
|
0 && (module.exports = {
|
|
5799
5970
|
AppLauncher,
|