@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.
Files changed (38) hide show
  1. package/dist/components/data/DataTable.d.cts +8 -2
  2. package/dist/components/data/DataTable.d.ts +8 -2
  3. package/dist/components/data/DataTable.d.ts.map +1 -1
  4. package/dist/components/data/Timeline.d.cts +1 -1
  5. package/dist/components/data/Timeline.d.ts +1 -1
  6. package/dist/components/data/Timeline.d.ts.map +1 -1
  7. package/dist/components/feedback/Toast.d.ts.map +1 -1
  8. package/dist/components/forms/ComboBox.d.ts.map +1 -1
  9. package/dist/components/forms/FileUpload.d.cts +7 -1
  10. package/dist/components/forms/FileUpload.d.ts +7 -1
  11. package/dist/components/forms/FileUpload.d.ts.map +1 -1
  12. package/dist/components/forms/MultiComboBox.d.ts.map +1 -1
  13. package/dist/components/forms/TextArea.d.cts +1 -3
  14. package/dist/components/forms/TextArea.d.ts +1 -3
  15. package/dist/components/forms/TextArea.d.ts.map +1 -1
  16. package/dist/components/navigation/Pagination.d.ts.map +1 -1
  17. package/dist/components/navigation/ShellBar.d.cts +2 -5
  18. package/dist/components/navigation/ShellBar.d.ts +2 -5
  19. package/dist/components/navigation/ShellBar.d.ts.map +1 -1
  20. package/dist/components/navigation/Tabs.d.ts.map +1 -1
  21. package/dist/components/patterns/AppLauncher.d.ts.map +1 -1
  22. package/dist/components/patterns/ConfirmDialog.d.ts.map +1 -1
  23. package/dist/components/patterns/FileDropZone.d.ts.map +1 -1
  24. package/dist/components/patterns/ValueHelpDialog.d.ts.map +1 -1
  25. package/dist/components/utils/useLoadMoreOnScroll.d.cts +11 -0
  26. package/dist/components/utils/useLoadMoreOnScroll.d.ts +12 -0
  27. package/dist/components/utils/useLoadMoreOnScroll.d.ts.map +1 -0
  28. package/dist/components.css +6 -2
  29. package/dist/i18n/messages.d.cts +18 -0
  30. package/dist/i18n/messages.d.ts +18 -0
  31. package/dist/i18n/messages.d.ts.map +1 -1
  32. package/dist/index.cjs +696 -525
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.js +615 -444
  35. package/dist/index.js.map +1 -1
  36. package/dist/tokens/colors.css +1 -0
  37. package/dist/tokens/themes.css +1 -0
  38. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -437,6 +437,7 @@ var enMessages = {
437
437
  paginationPrevious: "Previous page",
438
438
  paginationNext: "Next page",
439
439
  paginationRowsPerPage: "Rows per page",
440
+ paginationPageSize: "{count} rows",
440
441
  sideNavLabel: "Main navigation",
441
442
  shellRailLabel: "Applications",
442
443
  appLauncherLabel: "All applications",
@@ -452,6 +453,8 @@ var enMessages = {
452
453
  fileUploadUploading: "Uploading",
453
454
  fileDropZonePrompt: "Drag files here, or choose them",
454
455
  shellBarUserMenu: "Account menu for {user}",
456
+ shellBarMenu: "Open navigation",
457
+ shellBarSearch: "Search",
455
458
  commandPaletteLabel: "Command palette",
456
459
  commandPaletteSearchLabel: "Search commands and records",
457
460
  commandPalettePlaceholder: "Search for a screen, an action or a record\u2026",
@@ -472,6 +475,9 @@ var enMessages = {
472
475
  quantityStepperIncrease: "Increase quantity",
473
476
  quantityStepperDecrease: "Decrease quantity",
474
477
  confirmDialogFactsLabel: "Summary",
478
+ confirmDialogConfirm: "Confirm",
479
+ confirmDialogCancel: "Cancel",
480
+ confirmDialogBusy: "Working\u2026",
475
481
  valueHelpSelectAllCount: "Select all ({count})",
476
482
  valueHelpClearSelection: "Clear selection",
477
483
  valueHelpSelectedCount: "Selected: {count}",
@@ -490,7 +496,10 @@ var enMessages = {
490
496
  selectionBarNounOther: "records",
491
497
  selectionBarClear: "Clear selection",
492
498
  breadcrumbMore: "Show the full path",
493
- breadcrumbLabel: "Breadcrumb"
499
+ breadcrumbLabel: "Breadcrumb",
500
+ tabsLabel: "Views",
501
+ multiComboBoxAdded: "{label} added. {count} selected.",
502
+ multiComboBoxRemoved: "{label} removed. {count} selected."
494
503
  };
495
504
  var esMessages = {
496
505
  filterBarLabel: "Filtros",
@@ -535,6 +544,7 @@ var esMessages = {
535
544
  paginationPrevious: "P\xE1gina anterior",
536
545
  paginationNext: "P\xE1gina siguiente",
537
546
  paginationRowsPerPage: "Filas por p\xE1gina",
547
+ paginationPageSize: "{count} filas",
538
548
  sideNavLabel: "Navegaci\xF3n principal",
539
549
  shellRailLabel: "Aplicaciones",
540
550
  appLauncherLabel: "Todas las aplicaciones",
@@ -550,6 +560,8 @@ var esMessages = {
550
560
  fileUploadUploading: "Subiendo",
551
561
  fileDropZonePrompt: "Arrastr\xE1 archivos ac\xE1, o elegilos",
552
562
  shellBarUserMenu: "Men\xFA de cuenta de {user}",
563
+ shellBarMenu: "Abrir navegaci\xF3n",
564
+ shellBarSearch: "Buscar",
553
565
  commandPaletteLabel: "Paleta de comandos",
554
566
  commandPaletteSearchLabel: "Buscar comandos y registros",
555
567
  commandPalettePlaceholder: "Busc\xE1 una pantalla, una acci\xF3n o un registro\u2026",
@@ -570,6 +582,9 @@ var esMessages = {
570
582
  quantityStepperIncrease: "Aumentar cantidad",
571
583
  quantityStepperDecrease: "Disminuir cantidad",
572
584
  confirmDialogFactsLabel: "Resumen",
585
+ confirmDialogConfirm: "Confirmar",
586
+ confirmDialogCancel: "Cancelar",
587
+ confirmDialogBusy: "Procesando\u2026",
573
588
  valueHelpSelectAllCount: "Seleccionar todo ({count})",
574
589
  valueHelpClearSelection: "Limpiar selecci\xF3n",
575
590
  valueHelpSelectedCount: "Seleccionadas: {count}",
@@ -588,7 +603,10 @@ var esMessages = {
588
603
  selectionBarNounOther: "registros",
589
604
  selectionBarClear: "Quitar selecci\xF3n",
590
605
  breadcrumbMore: "Mostrar la ruta completa",
591
- breadcrumbLabel: "Ruta de navegaci\xF3n"
606
+ breadcrumbLabel: "Ruta de navegaci\xF3n",
607
+ tabsLabel: "Vistas",
608
+ multiComboBoxAdded: "Se agreg\xF3 {label}. Seleccionados: {count}.",
609
+ multiComboBoxRemoved: "Se quit\xF3 {label}. Seleccionados: {count}."
592
610
  };
593
611
 
594
612
  // src/i18n/PireIntlProvider.tsx
@@ -1259,8 +1277,7 @@ function TextArea({
1259
1277
  const chrome = el.offsetHeight - el.clientHeight;
1260
1278
  el.style.height = "auto";
1261
1279
  const wanted = maxRows ? Math.min(el.scrollHeight, Math.ceil(lineHeight * maxRows)) : el.scrollHeight;
1262
- const next = `${wanted + chrome}px`;
1263
- if (el.style.height !== next) el.style.height = next;
1280
+ el.style.height = `${wanted + chrome}px`;
1264
1281
  }, [autoGrow, maxRows]);
1265
1282
  useIsomorphicLayoutEffect(() => {
1266
1283
  if (!autoGrow) {
@@ -1294,7 +1311,7 @@ function TextArea({
1294
1311
  {
1295
1312
  ref,
1296
1313
  rows,
1297
- onInput: autoGrow ? grow : void 0,
1314
+ onInput: autoGrow && rest.value === void 0 ? grow : void 0,
1298
1315
  className: cx("pire-input", "pire-textarea"),
1299
1316
  "data-auto-grow": autoGrow ? "true" : void 0
1300
1317
  }
@@ -1534,7 +1551,7 @@ function ChoiceCardGroup({
1534
1551
  }
1535
1552
 
1536
1553
  // src/components/forms/ComboBox.tsx
1537
- import * as React13 from "react";
1554
+ import * as React14 from "react";
1538
1555
  import {
1539
1556
  ComboBox as AriaComboBox,
1540
1557
  Input as AriaInput2,
@@ -1545,6 +1562,26 @@ import {
1545
1562
  ListBoxItem as ListBoxItem2,
1546
1563
  FieldError as FieldError6
1547
1564
  } from "react-aria-components";
1565
+
1566
+ // src/components/utils/useLoadMoreOnScroll.ts
1567
+ import * as React13 from "react";
1568
+ var THRESHOLD = 64;
1569
+ function useLoadMoreOnScroll(onLoadMore, isLoading) {
1570
+ const requestedAt = React13.useRef(null);
1571
+ React13.useEffect(() => {
1572
+ if (!isLoading) requestedAt.current = null;
1573
+ }, [isLoading]);
1574
+ if (!onLoadMore) return void 0;
1575
+ return (event) => {
1576
+ const el = event.currentTarget;
1577
+ if (isLoading || el.scrollHeight - el.scrollTop - el.clientHeight >= THRESHOLD) return;
1578
+ if (requestedAt.current === el.scrollHeight) return;
1579
+ requestedAt.current = el.scrollHeight;
1580
+ onLoadMore();
1581
+ };
1582
+ }
1583
+
1584
+ // src/components/forms/ComboBox.tsx
1548
1585
  import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
1549
1586
  var norm2 = (o) => typeof o === "string" ? { value: o, label: o } : o;
1550
1587
  function ComboBox({
@@ -1574,10 +1611,10 @@ function ComboBox({
1574
1611
  const msg = usePireMessages();
1575
1612
  const items = options.map(norm2);
1576
1613
  const isSelectionControlled = value !== void 0;
1577
- const [ownSelection, setOwnSelection] = React13.useState(defaultValue ?? null);
1614
+ const [ownSelection, setOwnSelection] = React14.useState(defaultValue ?? null);
1578
1615
  const takesOverSelection = isClearable === true && !isSelectionControlled;
1579
1616
  const currentSelection = isSelectionControlled ? value : ownSelection;
1580
- const [typedText, setTypedText] = React13.useState("");
1617
+ const [typedText, setTypedText] = React14.useState("");
1581
1618
  const currentText = inputValue !== void 0 ? inputValue : typedText;
1582
1619
  const handleInputChange = isClearable ? (text) => {
1583
1620
  setTypedText(text);
@@ -1591,6 +1628,7 @@ function ComboBox({
1591
1628
  onInputChange?.("");
1592
1629
  };
1593
1630
  const collection = isFilteredExternally ? { items } : { defaultItems: items };
1631
+ const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
1594
1632
  const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
1595
1633
  warnHelpWithoutLabel("ComboBox", label, help);
1596
1634
  return /* @__PURE__ */ jsxs20(
@@ -1656,10 +1694,7 @@ function ComboBox({
1656
1694
  ListBox2,
1657
1695
  {
1658
1696
  className: "pire-listbox",
1659
- onScroll: onLoadMore ? (e) => {
1660
- const el = e.currentTarget;
1661
- if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
1662
- } : void 0,
1697
+ onScroll: onListScroll,
1663
1698
  renderEmptyState: showsStatus ? () => /* @__PURE__ */ jsx28("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
1664
1699
  children: (item) => /* @__PURE__ */ jsxs20(
1665
1700
  ListBoxItem2,
@@ -1682,7 +1717,7 @@ function ComboBox({
1682
1717
  }
1683
1718
 
1684
1719
  // src/components/forms/MultiComboBox.tsx
1685
- import * as React14 from "react";
1720
+ import * as React15 from "react";
1686
1721
  import {
1687
1722
  ComboBox as AriaComboBox2,
1688
1723
  Input as AriaInput3,
@@ -1720,22 +1755,24 @@ function MultiComboBox({
1720
1755
  ...rest
1721
1756
  }) {
1722
1757
  const msg = usePireMessages();
1723
- const items = React14.useMemo(() => options.map(norm3), [options]);
1758
+ const items = React15.useMemo(() => options.map(norm3), [options]);
1724
1759
  const collection = isFilteredExternally ? { items } : { defaultItems: items };
1760
+ const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
1725
1761
  const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
1726
- const [uncontrolled, setUncontrolled] = React14.useState(defaultValue ?? []);
1727
- const [announcement, setAnnouncement] = React14.useState("");
1728
- const inputRef = React14.useRef(null);
1762
+ const [uncontrolled, setUncontrolled] = React15.useState(defaultValue ?? []);
1763
+ const [announcement, setAnnouncement] = React15.useState("");
1764
+ const inputRef = React15.useRef(null);
1729
1765
  const raw = value ?? uncontrolled;
1730
1766
  const contentKey = raw.join("\0");
1731
- const values = React14.useMemo(() => raw, [contentKey]);
1767
+ const values = React15.useMemo(() => raw, [contentKey]);
1732
1768
  const labelOf = (v) => items.find((o) => o.value === v)?.label ?? v;
1733
1769
  const isEditable = !rest.isDisabled && !rest.isReadOnly;
1734
1770
  const commit = (next) => {
1735
1771
  const added = next.find((v) => !values.includes(v));
1736
1772
  const removed = values.find((v) => !next.includes(v));
1737
- if (added) setAnnouncement(`${labelOf(added)} added. ${next.length} selected.`);
1738
- else if (removed) setAnnouncement(`${labelOf(removed)} removed. ${next.length} selected.`);
1773
+ const announce = (template, value2) => setAnnouncement(template.replace("{label}", labelOf(value2)).replace("{count}", String(next.length)));
1774
+ if (added) announce(msg.multiComboBoxAdded, added);
1775
+ else if (removed) announce(msg.multiComboBoxRemoved, removed);
1739
1776
  if (value === void 0) setUncontrolled(next);
1740
1777
  onChange?.(next);
1741
1778
  };
@@ -1827,10 +1864,7 @@ function MultiComboBox({
1827
1864
  ListBox3,
1828
1865
  {
1829
1866
  className: "pire-listbox",
1830
- onScroll: onLoadMore ? (e) => {
1831
- const el = e.currentTarget;
1832
- if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
1833
- } : void 0,
1867
+ onScroll: onListScroll,
1834
1868
  renderEmptyState: showsStatus ? () => /* @__PURE__ */ jsx29("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
1835
1869
  children: (item) => /* @__PURE__ */ jsxs21(
1836
1870
  ListBoxItem3,
@@ -1853,7 +1887,7 @@ function MultiComboBox({
1853
1887
  }
1854
1888
 
1855
1889
  // src/components/forms/NumberField.tsx
1856
- import * as React15 from "react";
1890
+ import * as React16 from "react";
1857
1891
  import {
1858
1892
  NumberField as AriaNumberField,
1859
1893
  Input as AriaInput4,
@@ -1901,7 +1935,7 @@ function toAriaNumber(value) {
1901
1935
  return typeof value === "number" ? value : Number(value);
1902
1936
  }
1903
1937
  function ClearButton({ label, onClear }) {
1904
- const state = React15.useContext(NumberFieldStateContext);
1938
+ const state = React16.useContext(NumberFieldStateContext);
1905
1939
  if (!state?.inputValue) {
1906
1940
  return null;
1907
1941
  }
@@ -1944,7 +1978,7 @@ function NumberField({
1944
1978
  const { locale } = useLocale();
1945
1979
  const empty = emptyValue === void 0 ? NaN : emptyValue;
1946
1980
  const isControlled = value !== void 0;
1947
- const [ownValue, setOwnValue] = React15.useState(() => toAriaNumber(defaultValue) ?? NaN);
1981
+ const [ownValue, setOwnValue] = React16.useState(() => toAriaNumber(defaultValue) ?? NaN);
1948
1982
  const takesOverValue = Boolean(isClearable) && !isControlled;
1949
1983
  const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : { value: toAriaNumber(value), defaultValue: toAriaNumber(defaultValue) };
1950
1984
  const handleChange = (next) => {
@@ -2092,7 +2126,7 @@ function QuantityStepper({ size = "md", ...rest }) {
2092
2126
  }
2093
2127
 
2094
2128
  // src/components/forms/DatePicker.tsx
2095
- import * as React16 from "react";
2129
+ import * as React17 from "react";
2096
2130
  import {
2097
2131
  DatePicker as AriaDatePicker,
2098
2132
  Group as Group6,
@@ -2142,7 +2176,7 @@ function coerceBound(value) {
2142
2176
  // src/components/forms/DatePicker.tsx
2143
2177
  import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
2144
2178
  function ClearButton2({ label }) {
2145
- const state = React16.useContext(DatePickerStateContext);
2179
+ const state = React17.useContext(DatePickerStateContext);
2146
2180
  if (!state?.value) {
2147
2181
  return null;
2148
2182
  }
@@ -2259,7 +2293,7 @@ function DatePicker({
2259
2293
  }
2260
2294
 
2261
2295
  // src/components/forms/DateRangePicker.tsx
2262
- import * as React17 from "react";
2296
+ import * as React18 from "react";
2263
2297
  import {
2264
2298
  DateRangePicker as AriaDateRangePicker,
2265
2299
  Group as Group7,
@@ -2299,7 +2333,7 @@ function rangeLengthInDays(range) {
2299
2333
  return end.toDate("UTC").getTime() / 864e5 - start.toDate("UTC").getTime() / 864e5 + 1;
2300
2334
  }
2301
2335
  function ClearButton3({ label }) {
2302
- const state = React17.useContext(DateRangePickerStateContext);
2336
+ const state = React18.useContext(DateRangePickerStateContext);
2303
2337
  if (!state?.value?.start && !state?.value?.end) {
2304
2338
  return null;
2305
2339
  }
@@ -2451,13 +2485,14 @@ function DateRangePicker({
2451
2485
  }
2452
2486
 
2453
2487
  // src/components/forms/ValueHelpField.tsx
2454
- import * as React21 from "react";
2488
+ import * as React22 from "react";
2455
2489
 
2456
2490
  // src/components/patterns/ValueHelpDialog.tsx
2457
- import * as React20 from "react";
2491
+ import * as React21 from "react";
2492
+ import { useFilter } from "react-aria-components";
2458
2493
 
2459
2494
  // src/components/feedback/Dialog.tsx
2460
- import * as React18 from "react";
2495
+ import * as React19 from "react";
2461
2496
  import { ModalOverlay, Modal, Dialog as AriaDialog3, Heading as Heading4 } from "react-aria-components";
2462
2497
  import { jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
2463
2498
  function DialogTitle({ children, className }) {
@@ -2491,8 +2526,8 @@ function Dialog({
2491
2526
  onClose?.();
2492
2527
  onOpenChange?.(false);
2493
2528
  };
2494
- const parts = React18.Children.toArray(children);
2495
- const slotOf = (type) => parts.find((node) => React18.isValidElement(node) && node.type === type);
2529
+ const parts = React19.Children.toArray(children);
2530
+ const slotOf = (type) => parts.find((node) => React19.isValidElement(node) && node.type === type);
2496
2531
  const titleSlot = slotOf(DialogTitle);
2497
2532
  const descriptionSlot = slotOf(DialogDescription);
2498
2533
  const bodySlot = slotOf(DialogBody);
@@ -2528,7 +2563,7 @@ function Dialog({
2528
2563
  }
2529
2564
 
2530
2565
  // src/components/data/DataTable.tsx
2531
- import * as React19 from "react";
2566
+ import * as React20 from "react";
2532
2567
  import {
2533
2568
  Table,
2534
2569
  TableHeader,
@@ -2614,11 +2649,11 @@ function EditCell({
2614
2649
  onCommit,
2615
2650
  onCancel
2616
2651
  }) {
2617
- const state = React19.useContext(TableStateContext);
2652
+ const state = React20.useContext(TableStateContext);
2618
2653
  const setNavDisabled = state?.setKeyboardNavigationDisabled;
2619
- const ref = React19.useRef(null);
2620
- const focusedWithin = React19.useRef(false);
2621
- React19.useLayoutEffect(() => {
2654
+ const ref = React20.useRef(null);
2655
+ const focusedWithin = React20.useRef(false);
2656
+ React20.useLayoutEffect(() => {
2622
2657
  if (!isFirst) return;
2623
2658
  const row = ref.current?.closest('[role="row"]');
2624
2659
  void focusToken;
@@ -2630,7 +2665,7 @@ function EditCell({
2630
2665
  }
2631
2666
  }
2632
2667
  }, [isFirst, focusToken]);
2633
- React19.useLayoutEffect(() => {
2668
+ React20.useLayoutEffect(() => {
2634
2669
  if (!isFirst) return;
2635
2670
  const row = ref.current?.closest('[role="row"]');
2636
2671
  return () => {
@@ -2640,7 +2675,7 @@ function EditCell({
2640
2675
  });
2641
2676
  };
2642
2677
  }, [isFirst]);
2643
- React19.useEffect(
2678
+ React20.useEffect(
2644
2679
  () => () => {
2645
2680
  if (focusedWithin.current) setNavDisabled?.(false);
2646
2681
  },
@@ -2685,6 +2720,31 @@ function EditCell({
2685
2720
  )
2686
2721
  );
2687
2722
  }
2723
+ var LiveEditContext = React20.createContext(null);
2724
+ function LiveEditField({ columnKey, row }) {
2725
+ const live = React20.useContext(LiveEditContext);
2726
+ const column = live?.columns.find((c) => c.key === columnKey);
2727
+ const target = row ?? live?.pendingRow;
2728
+ return target && column?.renderEdit ? column.renderEdit(target) : null;
2729
+ }
2730
+ function useTableElement(deps, columnFunctions, isEditing, build) {
2731
+ const cache = React20.useRef(null);
2732
+ const churn = React20.useRef(0);
2733
+ const prev = cache.current;
2734
+ if (prev && sameValues(prev.deps, deps) && sameValues(prev.columnFunctions, columnFunctions)) {
2735
+ churn.current = 0;
2736
+ return prev.element;
2737
+ }
2738
+ if (IS_DEV3 && isEditing && prev && sameValues(prev.deps, deps) && ++churn.current === 3) {
2739
+ warnOnce3(
2740
+ "columns-churn",
2741
+ "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."
2742
+ );
2743
+ }
2744
+ cache.current = { deps, columnFunctions, element: build() };
2745
+ return cache.current.element;
2746
+ }
2747
+ var sameValues = (a, b) => a.length === b.length && a.every((v, i) => Object.is(v, b[i]));
2688
2748
  function DataTable({
2689
2749
  columns,
2690
2750
  rows,
@@ -2714,11 +2774,13 @@ function DataTable({
2714
2774
  ...rest
2715
2775
  }) {
2716
2776
  const msg = usePireMessages();
2717
- const [pendingFocus, setPendingFocus] = React19.useState(0);
2777
+ const [pendingFocus, setPendingFocus] = React20.useState(0);
2778
+ const latest = React20.useRef({ onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow });
2779
+ latest.current = { onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow };
2718
2780
  const isEditing = (row) => editingRowId != null && String(row.id) === String(editingRowId);
2719
2781
  const selectionMode = selectable === true || selectable === "multiple" ? "multiple" : selectable === "single" ? "single" : "none";
2720
2782
  const hasCheckboxColumn = selectionMode === "multiple";
2721
- const pinnedGeometry = React19.useMemo(() => {
2783
+ const pinnedGeometry = React20.useMemo(() => {
2722
2784
  const geometry = /* @__PURE__ */ new Map();
2723
2785
  let x = hasCheckboxColumn ? CHECKBOX_W : 0;
2724
2786
  let broke = null;
@@ -2757,12 +2819,12 @@ function DataTable({
2757
2819
  const keys = selection !== "all" && selection.has(PENDING_KEY) ? new Set([...selection].filter((key) => key !== PENDING_KEY)) : selection;
2758
2820
  if (keys === "all") {
2759
2821
  const inCollection = new Set(rows.map((r) => r.id));
2760
- return onSelectionChange?.([
2822
+ return latest.current.onSelectionChange?.([
2761
2823
  ...rows.map((r) => r.id),
2762
2824
  ...(selected ?? []).filter((id) => !inCollection.has(id))
2763
2825
  ]);
2764
2826
  }
2765
- onSelectionChange?.([...keys]);
2827
+ latest.current.onSelectionChange?.([...keys]);
2766
2828
  };
2767
2829
  const skeletonRows = loadingRowCount ?? (rows.length || 5);
2768
2830
  const skeletonColumns = [
@@ -2786,6 +2848,223 @@ function DataTable({
2786
2848
  style: { left: box.left, width: box.width, minWidth: box.width, maxWidth: box.width }
2787
2849
  };
2788
2850
  };
2851
+ const renderRecord = (row, editing) => {
2852
+ const rowIsDisabled = presentation.get(row.id)?.isDisabled;
2853
+ return /* @__PURE__ */ jsxs26(
2854
+ Row,
2855
+ {
2856
+ id: row.id,
2857
+ className: cx("pire-tr", presentation.get(row.id)?.className),
2858
+ "data-pressable": onRowAction && !rowIsDisabled && !editing ? "true" : void 0,
2859
+ "data-editing": editing ? "true" : void 0,
2860
+ children: [
2861
+ hasCheckboxColumn ? /* @__PURE__ */ jsx36(Cell, { className: "pire-td", ...pinProps(null), children: /* @__PURE__ */ jsx36(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
2862
+ columns.map((c) => {
2863
+ const pin = pinProps(c.key);
2864
+ return /* @__PURE__ */ jsx36(
2865
+ Cell,
2866
+ {
2867
+ className: "pire-td",
2868
+ "data-numeric": c.numeric ? "true" : void 0,
2869
+ "data-tone": c.tone?.(row) ?? void 0,
2870
+ ...pin,
2871
+ style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
2872
+ children: editing && c.renderEdit ? /* @__PURE__ */ jsx36(
2873
+ EditCell,
2874
+ {
2875
+ isFirst: c === firstEditable,
2876
+ focusToken: 0,
2877
+ onCommit: () => latest.current.onCommitRow?.(row.id),
2878
+ onCancel: () => latest.current.onCancelRow?.(row.id),
2879
+ children: /* @__PURE__ */ jsx36(LiveEditField, { columnKey: c.key, row })
2880
+ }
2881
+ ) : c.render ? c.render(row) : row[c.key]
2882
+ },
2883
+ c.key
2884
+ );
2885
+ })
2886
+ ]
2887
+ },
2888
+ row.id
2889
+ );
2890
+ };
2891
+ const renderDetail = (row) => /* @__PURE__ */ jsx36(Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ jsx36(Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded?.(row) }) }, expandedKey(row.id));
2892
+ const table = useTableElement(
2893
+ [
2894
+ rows,
2895
+ isLoading,
2896
+ loadingRowCount,
2897
+ loadingLabel,
2898
+ emptyLabel,
2899
+ density,
2900
+ stickyHeader,
2901
+ hideSelectAll,
2902
+ selectionMode,
2903
+ rest["aria-label"],
2904
+ selected,
2905
+ sort?.key,
2906
+ sort?.dir,
2907
+ editingRowId,
2908
+ pendingRow != null,
2909
+ pendingFocus,
2910
+ expandedIds,
2911
+ renderExpanded,
2912
+ footer,
2913
+ msg,
2914
+ Boolean(onRowAction),
2915
+ ...columns.flatMap((c) => [
2916
+ c.key,
2917
+ c.label,
2918
+ c.align,
2919
+ c.width,
2920
+ c.numeric,
2921
+ c.sortable,
2922
+ c.hideLabel,
2923
+ c.pinned,
2924
+ Boolean(c.renderEdit)
2925
+ ]),
2926
+ ...rows.flatMap((row) => [presentation.get(row.id)?.className, presentation.get(row.id)?.isDisabled])
2927
+ ],
2928
+ columns.flatMap((c) => [c.render, c.tone]),
2929
+ editingRowId != null || pendingRow != null,
2930
+ () => /* @__PURE__ */ jsxs26(
2931
+ Table,
2932
+ {
2933
+ className: "pire-table",
2934
+ "data-density": density,
2935
+ "data-sticky": String(stickyHeader),
2936
+ "data-pinned": hasPinned ? "true" : void 0,
2937
+ "aria-label": rest["aria-label"],
2938
+ disabledKeys: disabledKeys.length ? new Set(disabledKeys) : void 0,
2939
+ selectionMode,
2940
+ selectedKeys: selected ? new Set(selected) : void 0,
2941
+ onSelectionChange: handleSelection,
2942
+ sortDescriptor,
2943
+ onSortChange: (d) => latest.current.onSortChange?.({
2944
+ key: String(d.column),
2945
+ dir: d.direction === "ascending" ? "asc" : "desc"
2946
+ }),
2947
+ onRowAction: onRowAction ? (key) => {
2948
+ const row = rows.find((r) => String(r.id) === String(key));
2949
+ if (row && !isEditing(row)) latest.current.onRowAction?.(row);
2950
+ } : void 0,
2951
+ children: [
2952
+ /* @__PURE__ */ jsxs26(TableHeader, { className: "pire-thead-row", children: [
2953
+ hasCheckboxColumn ? /* @__PURE__ */ jsx36(Column, { className: "pire-th", ...pinProps(null), children: hideSelectAll ? /* @__PURE__ */ jsx36("span", { className: "pire-sr-only", children: msg.dataTableSelectionColumn }) : /* @__PURE__ */ jsx36(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectAll }) }) : null,
2954
+ columns.map((c, i) => (
2955
+ // The checkbox column is never the row header — a selection control does not identify
2956
+ // the record — so the first *data* column carries it regardless of whether a checkbox
2957
+ // column precedes it. Conditioning this on `hasCheckboxColumn` left every selectable
2958
+ // table with no row header at all: invisible on first paint, and a hard crash from
2959
+ // React Aria's own "table must have a row header" invariant the moment `rows` changes
2960
+ // under it (search, sort, a paginated load).
2961
+ /* @__PURE__ */ jsx36(
2962
+ Column,
2963
+ {
2964
+ id: c.key,
2965
+ className: "pire-th",
2966
+ isRowHeader: i === 0,
2967
+ allowsSorting: c.sortable,
2968
+ "data-align": c.numeric || c.align === "right" ? "right" : c.align,
2969
+ "data-allows-sorting": c.sortable ? "true" : void 0,
2970
+ ...pinProps(c.key),
2971
+ children: /* @__PURE__ */ jsxs26("span", { className: c.hideLabel ? "pire-sr-only" : "pire-th-inner", children: [
2972
+ c.label,
2973
+ c.sortable ? /* @__PURE__ */ jsx36(
2974
+ Icon,
2975
+ {
2976
+ size: 12,
2977
+ name: sort?.key === c.key ? sort.dir === "asc" ? "arrow-up" : "arrow-down" : "chevrons-up-down",
2978
+ style: {
2979
+ color: sort?.key === c.key ? "var(--accent-subtle-fg)" : "var(--text-tertiary)"
2980
+ }
2981
+ }
2982
+ ) : null
2983
+ ] })
2984
+ },
2985
+ c.key
2986
+ )
2987
+ ))
2988
+ ] }),
2989
+ /* @__PURE__ */ jsxs26(
2990
+ TableBody,
2991
+ {
2992
+ renderEmptyState: () => isLoading ? /* @__PURE__ */ jsxs26("div", { className: "pire-table-loading", role: "status", "aria-live": "polite", children: [
2993
+ /* @__PURE__ */ jsx36("span", { className: "pire-sr-only", children: loadingLabel ?? msg.dataTableLoading }),
2994
+ Array.from({ length: skeletonRows }, (_, i) => (
2995
+ // biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
2996
+ /* @__PURE__ */ jsx36(SkeletonTableRow, { columns: skeletonColumns, density }, i)
2997
+ ))
2998
+ ] }) : /* @__PURE__ */ jsx36("div", { className: "pire-table-empty", children: emptyLabel ?? msg.dataTableEmpty }),
2999
+ children: [
3000
+ pendingRow && !isLoading ? /* @__PURE__ */ jsxs26(
3001
+ Row,
3002
+ {
3003
+ id: PENDING_KEY,
3004
+ className: "pire-tr",
3005
+ "data-editing": "true",
3006
+ "data-pending": "true",
3007
+ children: [
3008
+ hasCheckboxColumn ? /* @__PURE__ */ jsx36(Cell, { className: "pire-td", ...pinProps(null) }) : null,
3009
+ columns.map((c) => {
3010
+ const pin = pinProps(c.key);
3011
+ return /* @__PURE__ */ jsx36(
3012
+ Cell,
3013
+ {
3014
+ className: "pire-td",
3015
+ "data-numeric": c.numeric ? "true" : void 0,
3016
+ ...pin,
3017
+ style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
3018
+ children: c.renderEdit ? /* @__PURE__ */ jsx36(
3019
+ EditCell,
3020
+ {
3021
+ isFirst: c === firstEditable,
3022
+ focusToken: pendingFocus,
3023
+ onCommit: () => {
3024
+ latest.current.onCommitRow?.(null);
3025
+ setPendingFocus((n) => n + 1);
3026
+ },
3027
+ onCancel: () => latest.current.onCancelRow?.(null),
3028
+ children: /* @__PURE__ */ jsx36(LiveEditField, { columnKey: c.key, row: null })
3029
+ }
3030
+ ) : null
3031
+ },
3032
+ c.key
3033
+ );
3034
+ })
3035
+ ]
3036
+ },
3037
+ PENDING_KEY
3038
+ ) : null,
3039
+ body.flatMap((row) => {
3040
+ const record = renderRecord(row, isEditing(row));
3041
+ if (!renderExpanded || !expanded.has(String(row.id))) return [record];
3042
+ return [record, renderDetail(row)];
3043
+ })
3044
+ ]
3045
+ }
3046
+ ),
3047
+ footer && !isLoading ? /* @__PURE__ */ jsx36(TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ jsxs26(Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
3048
+ hasCheckboxColumn ? /* @__PURE__ */ jsx36(Cell, { className: "pire-tf", ...pinProps(null) }) : null,
3049
+ columns.map((c, i) => {
3050
+ const pin = pinProps(c.key);
3051
+ return /* @__PURE__ */ jsx36(
3052
+ Cell,
3053
+ {
3054
+ className: "pire-tf",
3055
+ "data-numeric": c.numeric ? "true" : void 0,
3056
+ ...pin,
3057
+ style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
3058
+ children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ jsx36("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
3059
+ },
3060
+ c.key
3061
+ );
3062
+ })
3063
+ ] }) }) : null
3064
+ ]
3065
+ }
3066
+ )
3067
+ );
2789
3068
  return /* @__PURE__ */ jsx36(
2790
3069
  "div",
2791
3070
  {
@@ -2793,181 +3072,7 @@ function DataTable({
2793
3072
  style,
2794
3073
  "data-loading": isLoading ? "true" : void 0,
2795
3074
  "aria-busy": isLoading ? "true" : void 0,
2796
- children: /* @__PURE__ */ jsxs26(
2797
- Table,
2798
- {
2799
- className: "pire-table",
2800
- "data-density": density,
2801
- "data-sticky": String(stickyHeader),
2802
- "data-pinned": hasPinned ? "true" : void 0,
2803
- "aria-label": rest["aria-label"],
2804
- disabledKeys: disabledKeys.length ? new Set(disabledKeys) : void 0,
2805
- selectionMode,
2806
- selectedKeys: selected ? new Set(selected) : void 0,
2807
- onSelectionChange: handleSelection,
2808
- sortDescriptor,
2809
- onSortChange: (d) => onSortChange?.({ key: String(d.column), dir: d.direction === "ascending" ? "asc" : "desc" }),
2810
- onRowAction: onRowAction ? (key) => {
2811
- const row = rows.find((r) => String(r.id) === String(key));
2812
- if (row && !isEditing(row)) onRowAction(row);
2813
- } : void 0,
2814
- children: [
2815
- /* @__PURE__ */ jsxs26(TableHeader, { className: "pire-thead-row", children: [
2816
- hasCheckboxColumn ? /* @__PURE__ */ jsx36(Column, { className: "pire-th", ...pinProps(null), children: hideSelectAll ? /* @__PURE__ */ jsx36("span", { className: "pire-sr-only", children: msg.dataTableSelectionColumn }) : /* @__PURE__ */ jsx36(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectAll }) }) : null,
2817
- columns.map((c, i) => (
2818
- // The checkbox column is never the row header — a selection control does not identify
2819
- // the record — so the first *data* column carries it regardless of whether a checkbox
2820
- // column precedes it. Conditioning this on `hasCheckboxColumn` left every selectable
2821
- // table with no row header at all: invisible on first paint, and a hard crash from
2822
- // React Aria's own "table must have a row header" invariant the moment `rows` changes
2823
- // under it (search, sort, a paginated load).
2824
- /* @__PURE__ */ jsx36(
2825
- Column,
2826
- {
2827
- id: c.key,
2828
- className: "pire-th",
2829
- isRowHeader: i === 0,
2830
- allowsSorting: c.sortable,
2831
- "data-align": c.numeric || c.align === "right" ? "right" : c.align,
2832
- "data-allows-sorting": c.sortable ? "true" : void 0,
2833
- ...pinProps(c.key),
2834
- children: /* @__PURE__ */ jsxs26("span", { className: c.hideLabel ? "pire-sr-only" : "pire-th-inner", children: [
2835
- c.label,
2836
- c.sortable ? /* @__PURE__ */ jsx36(
2837
- Icon,
2838
- {
2839
- size: 12,
2840
- name: sort?.key === c.key ? sort.dir === "asc" ? "arrow-up" : "arrow-down" : "chevrons-up-down",
2841
- style: {
2842
- color: sort?.key === c.key ? "var(--accent-subtle-fg)" : "var(--text-tertiary)"
2843
- }
2844
- }
2845
- ) : null
2846
- ] })
2847
- },
2848
- c.key
2849
- )
2850
- ))
2851
- ] }),
2852
- /* @__PURE__ */ jsxs26(
2853
- TableBody,
2854
- {
2855
- renderEmptyState: () => isLoading ? /* @__PURE__ */ jsxs26("div", { className: "pire-table-loading", role: "status", "aria-live": "polite", children: [
2856
- /* @__PURE__ */ jsx36("span", { className: "pire-sr-only", children: loadingLabel ?? msg.dataTableLoading }),
2857
- Array.from({ length: skeletonRows }, (_, i) => (
2858
- // biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
2859
- /* @__PURE__ */ jsx36(SkeletonTableRow, { columns: skeletonColumns, density }, i)
2860
- ))
2861
- ] }) : /* @__PURE__ */ jsx36("div", { className: "pire-table-empty", children: emptyLabel ?? msg.dataTableEmpty }),
2862
- children: [
2863
- pendingRow && !isLoading ? /* @__PURE__ */ jsxs26(
2864
- Row,
2865
- {
2866
- id: PENDING_KEY,
2867
- className: "pire-tr",
2868
- "data-editing": "true",
2869
- "data-pending": "true",
2870
- children: [
2871
- hasCheckboxColumn ? /* @__PURE__ */ jsx36(Cell, { className: "pire-td", ...pinProps(null) }) : null,
2872
- columns.map((c) => {
2873
- const pin = pinProps(c.key);
2874
- return /* @__PURE__ */ jsx36(
2875
- Cell,
2876
- {
2877
- className: "pire-td",
2878
- "data-numeric": c.numeric ? "true" : void 0,
2879
- ...pin,
2880
- style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
2881
- children: c.renderEdit ? /* @__PURE__ */ jsx36(
2882
- EditCell,
2883
- {
2884
- isFirst: c === firstEditable,
2885
- focusToken: pendingFocus,
2886
- onCommit: () => {
2887
- onCommitRow?.(null);
2888
- setPendingFocus((n) => n + 1);
2889
- },
2890
- onCancel: () => onCancelRow?.(null),
2891
- children: c.renderEdit(pendingRow)
2892
- }
2893
- ) : null
2894
- },
2895
- c.key
2896
- );
2897
- })
2898
- ]
2899
- },
2900
- PENDING_KEY
2901
- ) : null,
2902
- body.flatMap((row) => {
2903
- const rowIsDisabled = presentation.get(row.id)?.isDisabled;
2904
- const editing = isEditing(row);
2905
- const record = /* @__PURE__ */ jsxs26(
2906
- Row,
2907
- {
2908
- id: row.id,
2909
- className: cx("pire-tr", presentation.get(row.id)?.className),
2910
- "data-pressable": onRowAction && !rowIsDisabled && !editing ? "true" : void 0,
2911
- "data-editing": editing ? "true" : void 0,
2912
- children: [
2913
- hasCheckboxColumn ? /* @__PURE__ */ jsx36(Cell, { className: "pire-td", ...pinProps(null), children: /* @__PURE__ */ jsx36(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
2914
- columns.map((c) => {
2915
- const pin = pinProps(c.key);
2916
- return /* @__PURE__ */ jsx36(
2917
- Cell,
2918
- {
2919
- className: "pire-td",
2920
- "data-numeric": c.numeric ? "true" : void 0,
2921
- "data-tone": c.tone?.(row) ?? void 0,
2922
- ...pin,
2923
- style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
2924
- children: editing && c.renderEdit ? /* @__PURE__ */ jsx36(
2925
- EditCell,
2926
- {
2927
- isFirst: c === firstEditable,
2928
- focusToken: 0,
2929
- onCommit: () => onCommitRow?.(row.id),
2930
- onCancel: () => onCancelRow?.(row.id),
2931
- children: c.renderEdit(row)
2932
- }
2933
- ) : c.render ? c.render(row) : row[c.key]
2934
- },
2935
- c.key
2936
- );
2937
- })
2938
- ]
2939
- },
2940
- row.id
2941
- );
2942
- if (!renderExpanded || !expanded.has(String(row.id))) return [record];
2943
- return [
2944
- record,
2945
- /* @__PURE__ */ jsx36(Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ jsx36(Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded(row) }) }, expandedKey(row.id))
2946
- ];
2947
- })
2948
- ]
2949
- }
2950
- ),
2951
- footer && !isLoading ? /* @__PURE__ */ jsx36(TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ jsxs26(Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
2952
- hasCheckboxColumn ? /* @__PURE__ */ jsx36(Cell, { className: "pire-tf", ...pinProps(null) }) : null,
2953
- columns.map((c, i) => {
2954
- const pin = pinProps(c.key);
2955
- return /* @__PURE__ */ jsx36(
2956
- Cell,
2957
- {
2958
- className: "pire-tf",
2959
- "data-numeric": c.numeric ? "true" : void 0,
2960
- ...pin,
2961
- style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
2962
- children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ jsx36("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
2963
- },
2964
- c.key
2965
- );
2966
- })
2967
- ] }) }) : null
2968
- ]
2969
- }
2970
- )
3075
+ children: /* @__PURE__ */ jsx36(LiveEditContext.Provider, { value: { columns, pendingRow }, children: table })
2971
3076
  }
2972
3077
  );
2973
3078
  }
@@ -2993,17 +3098,20 @@ function ValueHelpDialog({
2993
3098
  onConfirm
2994
3099
  }) {
2995
3100
  const msg = usePireMessages();
2996
- const [query, setQuery] = React20.useState("");
2997
- React20.useEffect(() => {
3101
+ const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
3102
+ const [query, setQuery] = React21.useState("");
3103
+ React21.useEffect(() => {
2998
3104
  if (isOpen) setQuery("");
2999
3105
  }, [isOpen]);
3000
3106
  const isMultiple = selectionMode === "multiple";
3001
- const filtered = React20.useMemo(() => {
3107
+ const { contains } = useFilter({ sensitivity: "base" });
3108
+ const filtered = React21.useMemo(() => {
3002
3109
  if (isFilteredExternally) return rows;
3003
- const q = query.trim().toLowerCase();
3110
+ const q = query.trim();
3004
3111
  if (!q) return rows;
3005
- return rows.filter((row) => Object.values(row).some((v) => String(v).toLowerCase().includes(q)));
3006
- }, [rows, query, isFilteredExternally]);
3112
+ const searchable = (v) => typeof v === "string" || typeof v === "number";
3113
+ return rows.filter((row) => Object.values(row).some((v) => searchable(v) && contains(String(v), q)));
3114
+ }, [rows, query, isFilteredExternally, contains]);
3007
3115
  const handleSearch = (value) => {
3008
3116
  setQuery(value);
3009
3117
  onSearch?.(value);
@@ -3048,35 +3156,25 @@ function ValueHelpDialog({
3048
3156
  /* @__PURE__ */ jsx37(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.([]), children: msg.valueHelpClearSelection }),
3049
3157
  /* @__PURE__ */ jsx37("span", { className: "pire-valuehelp-count", children: msg.valueHelpSelectedCount.replace("{count}", String(selectedKeys?.length ?? 0)) })
3050
3158
  ] }) : null,
3051
- /* @__PURE__ */ jsx37(
3052
- "div",
3159
+ /* @__PURE__ */ jsx37("div", { onScroll: onListScroll, style: { overflow: "auto", maxHeight: "48vh" }, children: /* @__PURE__ */ jsx37(
3160
+ DataTable,
3053
3161
  {
3054
- onScroll: onLoadMore ? (event) => {
3055
- const el = event.currentTarget;
3056
- if (el.scrollHeight - el.scrollTop - el.clientHeight < 64) onLoadMore();
3057
- } : void 0,
3058
- style: { overflow: "auto", maxHeight: "48vh" },
3059
- children: /* @__PURE__ */ jsx37(
3060
- DataTable,
3061
- {
3062
- "aria-label": typeof title === "string" ? title : msg.valueHelpDialogTitle,
3063
- density: "condensed",
3064
- columns,
3065
- rows: filtered,
3066
- isLoading,
3067
- emptyLabel: emptyLabel ?? msg.valueHelpDialogEmpty,
3068
- selectable: isMultiple ? "multiple" : void 0,
3069
- hideSelectAll: isMultiple,
3070
- selected: isMultiple ? selectedKeys : void 0,
3071
- onSelectionChange: isMultiple ? onSelectionChange : void 0,
3072
- onRowAction: isMultiple ? void 0 : (row) => {
3073
- onSelect?.(row);
3074
- onClose?.();
3075
- }
3076
- }
3077
- )
3162
+ "aria-label": typeof title === "string" ? title : msg.valueHelpDialogTitle,
3163
+ density: "condensed",
3164
+ columns,
3165
+ rows: filtered,
3166
+ isLoading,
3167
+ emptyLabel: emptyLabel ?? msg.valueHelpDialogEmpty,
3168
+ selectable: isMultiple ? "multiple" : void 0,
3169
+ hideSelectAll: isMultiple,
3170
+ selected: isMultiple ? selectedKeys : void 0,
3171
+ onSelectionChange: isMultiple ? onSelectionChange : void 0,
3172
+ onRowAction: isMultiple ? void 0 : (row) => {
3173
+ onSelect?.(row);
3174
+ onClose?.();
3175
+ }
3078
3176
  }
3079
- )
3177
+ ) })
3080
3178
  ] })
3081
3179
  }
3082
3180
  );
@@ -3109,7 +3207,7 @@ function ValueHelpField({
3109
3207
  style
3110
3208
  }) {
3111
3209
  const msg = usePireMessages();
3112
- const [open, setOpen] = React21.useState(false);
3210
+ const [open, setOpen] = React22.useState(false);
3113
3211
  return /* @__PURE__ */ jsxs28("div", { className: cx(className), style, children: [
3114
3212
  /* @__PURE__ */ jsx38(
3115
3213
  Input,
@@ -3165,8 +3263,8 @@ function ValueHelpField({
3165
3263
  }
3166
3264
 
3167
3265
  // src/components/forms/FileUpload.tsx
3168
- import * as React22 from "react";
3169
- import { FileTrigger, Text as Text5 } from "react-aria-components";
3266
+ import * as React23 from "react";
3267
+ import { FileTrigger } from "react-aria-components";
3170
3268
 
3171
3269
  // src/components/feedback/ProgressBar.tsx
3172
3270
  import { ProgressBar as AriaProgressBar, Label as Label3 } from "react-aria-components";
@@ -3234,6 +3332,29 @@ function screenFiles(files, { maxSize, acceptedFileTypes }) {
3234
3332
  }
3235
3333
  return { accepted, rejected };
3236
3334
  }
3335
+ function usePreviewUrls(files) {
3336
+ const owned = React23.useRef(/* @__PURE__ */ new Set());
3337
+ React23.useEffect(() => {
3338
+ const live = new Set(files.map((f) => f.previewUrl));
3339
+ for (const url of owned.current) {
3340
+ if (live.has(url)) continue;
3341
+ URL.revokeObjectURL(url);
3342
+ owned.current.delete(url);
3343
+ }
3344
+ }, [files]);
3345
+ React23.useEffect(() => {
3346
+ const urls = owned.current;
3347
+ return () => {
3348
+ for (const url of urls) URL.revokeObjectURL(url);
3349
+ urls.clear();
3350
+ };
3351
+ }, []);
3352
+ return (file) => {
3353
+ const url = URL.createObjectURL(file);
3354
+ owned.current.add(url);
3355
+ return url;
3356
+ };
3357
+ }
3237
3358
  function FileUpload({
3238
3359
  label,
3239
3360
  value,
@@ -3258,15 +3379,14 @@ function FileUpload({
3258
3379
  ...rest
3259
3380
  }) {
3260
3381
  const msg = usePireMessages();
3261
- const [uncontrolled, setUncontrolled] = React22.useState(defaultValue ?? []);
3382
+ const [uncontrolled, setUncontrolled] = React23.useState(defaultValue ?? []);
3262
3383
  const files = value ?? uncontrolled;
3263
- const created = React22.useRef([]);
3264
- React22.useEffect(
3265
- () => () => {
3266
- for (const url of created.current) URL.revokeObjectURL(url);
3267
- },
3268
- []
3269
- );
3384
+ const previewUrlFor = usePreviewUrls(files);
3385
+ const id = React23.useId();
3386
+ const labelId = label ? `${id}-label` : void 0;
3387
+ const hintId = description ? `${id}-hint` : void 0;
3388
+ const errorId = isInvalid && errorMessage ? `${id}-error` : void 0;
3389
+ const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
3270
3390
  const commit = (next) => {
3271
3391
  if (value === void 0) setUncontrolled(next);
3272
3392
  onChange?.(next);
@@ -3277,8 +3397,7 @@ function FileUpload({
3277
3397
  if (rejected.length) onError?.(rejected);
3278
3398
  if (!accepted.length) return;
3279
3399
  const wrapped = accepted.map((file) => {
3280
- const previewUrl = showPreview && isImage(file) ? URL.createObjectURL(file) : void 0;
3281
- if (previewUrl) created.current.push(previewUrl);
3400
+ const previewUrl = showPreview && isImage(file) ? previewUrlFor(file) : void 0;
3282
3401
  return { file, previewUrl };
3283
3402
  });
3284
3403
  commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
@@ -3293,7 +3412,7 @@ function FileUpload({
3293
3412
  "data-invalid": isInvalid ? "true" : void 0,
3294
3413
  ...rest,
3295
3414
  children: [
3296
- label ? /* @__PURE__ */ jsxs30("span", { className: "pire-field-label", children: [
3415
+ label ? /* @__PURE__ */ jsxs30("span", { className: "pire-field-label", id: labelId, children: [
3297
3416
  label,
3298
3417
  isRequired ? /* @__PURE__ */ jsx40("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
3299
3418
  ] }) : null,
@@ -3303,7 +3422,17 @@ function FileUpload({
3303
3422
  acceptedFileTypes,
3304
3423
  allowsMultiple,
3305
3424
  onSelect: accept,
3306
- children: /* @__PURE__ */ jsx40(Button, { icon: "paperclip", isDisabled: isDisabled || isReadOnly, children: chooseLabel ?? msg.fileUploadChoose })
3425
+ children: /* @__PURE__ */ jsx40(
3426
+ Button,
3427
+ {
3428
+ id: `${id}-button`,
3429
+ icon: "paperclip",
3430
+ isDisabled: isDisabled || isReadOnly,
3431
+ "aria-labelledby": labelId ? `${labelId} ${id}-button` : void 0,
3432
+ "aria-describedby": describedBy,
3433
+ children: chooseLabel ?? msg.fileUploadChoose
3434
+ }
3435
+ )
3307
3436
  }
3308
3437
  ),
3309
3438
  files.length ? /* @__PURE__ */ jsx40("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ jsxs30("li", { className: "pire-fileupload-item", children: [
@@ -3321,8 +3450,8 @@ function FileUpload({
3321
3450
  )
3322
3451
  ] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
3323
3452
  uploadProgress != null ? /* @__PURE__ */ jsx40(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
3324
- description ? /* @__PURE__ */ jsx40(Text5, { slot: "description", className: "pire-field-hint", children: description }) : null,
3325
- isInvalid && errorMessage ? /* @__PURE__ */ jsx40("span", { className: "pire-field-error", children: errorMessage }) : null
3453
+ description ? /* @__PURE__ */ jsx40("span", { className: "pire-field-hint", id: hintId, children: description }) : null,
3454
+ errorId ? /* @__PURE__ */ jsx40("span", { className: "pire-field-error", id: errorId, children: errorMessage }) : null
3326
3455
  ]
3327
3456
  }
3328
3457
  );
@@ -3332,7 +3461,7 @@ function FileUpload({
3332
3461
  import { MenuTrigger as MenuTrigger2, Button as AriaButton12, Popover as Popover7 } from "react-aria-components";
3333
3462
 
3334
3463
  // src/components/navigation/Breadcrumb.tsx
3335
- import * as React23 from "react";
3464
+ import * as React24 from "react";
3336
3465
  import {
3337
3466
  Breadcrumbs as AriaBreadcrumbs,
3338
3467
  Breadcrumb as AriaBreadcrumb,
@@ -3410,10 +3539,10 @@ import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
3410
3539
  var keyOf = (item) => item.id ?? item.label;
3411
3540
  var MIN_CURRENT = 64;
3412
3541
  function useFitLevel(enabled) {
3413
- const boxRef = React23.useRef(null);
3414
- const measureRef = React23.useRef(null);
3415
- const [level, setLevel] = React23.useState(0);
3416
- React23.useLayoutEffect(() => {
3542
+ const boxRef = React24.useRef(null);
3543
+ const measureRef = React24.useRef(null);
3544
+ const [level, setLevel] = React24.useState(0);
3545
+ React24.useLayoutEffect(() => {
3417
3546
  const box = boxRef.current;
3418
3547
  const measure = measureRef.current;
3419
3548
  if (!enabled || !box || !measure) return;
@@ -3486,7 +3615,7 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
3486
3615
  "data-collapsible": "true",
3487
3616
  onAction: (key) => onNavigate?.(String(key)),
3488
3617
  children: shown.map(
3489
- (item, i) => collapse && i === moreAt ? /* @__PURE__ */ jsxs32(React23.Fragment, { children: [
3618
+ (item, i) => collapse && i === moreAt ? /* @__PURE__ */ jsxs32(React24.Fragment, { children: [
3490
3619
  /* @__PURE__ */ jsxs32(AriaBreadcrumb, { className: "pire-breadcrumb", id: "__pire_breadcrumb_more__", children: [
3491
3620
  /* @__PURE__ */ jsxs32(MenuTrigger, { children: [
3492
3621
  /* @__PURE__ */ jsx42(AriaButton11, { className: "pire-breadcrumb-more", "aria-label": msg.breadcrumbMore, children: /* @__PURE__ */ jsx42(Icon, { name: "more-horizontal", size: 16 }) }),
@@ -3533,8 +3662,8 @@ function ShellBar({
3533
3662
  onBreadcrumbNavigate,
3534
3663
  onMenu,
3535
3664
  onSearch,
3536
- menuLabel = "Open navigation",
3537
- searchLabel = "Search",
3665
+ menuLabel,
3666
+ searchLabel,
3538
3667
  actions,
3539
3668
  user,
3540
3669
  userMenu,
@@ -3545,7 +3674,16 @@ function ShellBar({
3545
3674
  const msg = usePireMessages();
3546
3675
  return /* @__PURE__ */ jsxs33("header", { className: cx("pire-shellbar", className), ...rest, children: [
3547
3676
  launcher,
3548
- onMenu ? /* @__PURE__ */ jsx43(IconButton, { icon: "menu", label: menuLabel, variant: "inverse", size: "sm", onPress: onMenu }) : null,
3677
+ onMenu ? /* @__PURE__ */ jsx43(
3678
+ IconButton,
3679
+ {
3680
+ icon: "menu",
3681
+ label: menuLabel ?? msg.shellBarMenu,
3682
+ variant: "inverse",
3683
+ size: "sm",
3684
+ onPress: onMenu
3685
+ }
3686
+ ) : null,
3549
3687
  monogram ? /* @__PURE__ */ jsx43("span", { className: "pire-shellbar-mono", "aria-hidden": "true", children: monogram }) : null,
3550
3688
  product ? /* @__PURE__ */ jsx43("span", { className: "pire-shellbar-product", children: product }) : null,
3551
3689
  breadcrumb?.length ? /* @__PURE__ */ jsxs33("nav", { className: "pire-shellbar-crumbs", "aria-label": msg.breadcrumbLabel, children: [
@@ -3554,7 +3692,16 @@ function ShellBar({
3554
3692
  ] }) : null,
3555
3693
  title ? /* @__PURE__ */ jsx43("span", { className: "pire-shellbar-title", children: title }) : null,
3556
3694
  breadcrumb?.length ? null : /* @__PURE__ */ jsx43("span", { className: "pire-shellbar-spacer" }),
3557
- onSearch ? /* @__PURE__ */ jsx43(IconButton, { icon: "search", label: searchLabel, variant: "inverse", size: "sm", onPress: onSearch }) : null,
3695
+ onSearch ? /* @__PURE__ */ jsx43(
3696
+ IconButton,
3697
+ {
3698
+ icon: "search",
3699
+ label: searchLabel ?? msg.shellBarSearch,
3700
+ variant: "inverse",
3701
+ size: "sm",
3702
+ onPress: onSearch
3703
+ }
3704
+ ) : null,
3558
3705
  actions,
3559
3706
  user && userMenu ? (
3560
3707
  // A real button, not the img-role span: the avatar is where "my profile", "switch company"
@@ -3576,7 +3723,7 @@ function ShellBar({
3576
3723
  }
3577
3724
 
3578
3725
  // src/components/navigation/SideNav.tsx
3579
- import * as React24 from "react";
3726
+ import * as React25 from "react";
3580
3727
  import {
3581
3728
  Button as AriaButton13,
3582
3729
  Disclosure,
@@ -3612,10 +3759,10 @@ function SideNav({
3612
3759
  const msg = usePireMessages();
3613
3760
  const activeParent = findActiveParent(groups, value);
3614
3761
  const isControlled = expandedIds != null;
3615
- const [ownExpanded, setOwnExpanded] = React24.useState(
3762
+ const [ownExpanded, setOwnExpanded] = React25.useState(
3616
3763
  () => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
3617
3764
  );
3618
- const [lastValue, setLastValue] = React24.useState(value);
3765
+ const [lastValue, setLastValue] = React25.useState(value);
3619
3766
  if (value !== lastValue) {
3620
3767
  setLastValue(value);
3621
3768
  if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
@@ -3746,7 +3893,7 @@ function SideNav({
3746
3893
  }
3747
3894
 
3748
3895
  // src/components/navigation/ShellRail.tsx
3749
- import * as React25 from "react";
3896
+ import * as React26 from "react";
3750
3897
  import { Button as AriaButton14 } from "react-aria-components";
3751
3898
  import { jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
3752
3899
  function ShellRail({ groups, value, onChange, className, ...rest }) {
@@ -3754,7 +3901,7 @@ function ShellRail({ groups, value, onChange, className, ...rest }) {
3754
3901
  return /* @__PURE__ */ jsx45("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => (
3755
3902
  // The divider is a sibling of the groups rather than a pseudo-element on one, because the
3756
3903
  // scrolling zone would carry its own rule out of view on the first wheel event.
3757
- /* @__PURE__ */ jsxs35(React25.Fragment, { children: [
3904
+ /* @__PURE__ */ jsxs35(React26.Fragment, { children: [
3758
3905
  gi > 0 ? /* @__PURE__ */ jsx45("div", { className: "pire-shellrail-divider" }) : null,
3759
3906
  /* @__PURE__ */ jsx45("div", { className: "pire-shellrail-group", "data-scroll": group.isScrollable ? "true" : void 0, children: group.items.map((item) => /* @__PURE__ */ jsx45(Tooltip, { label: item.label, placement: "right", children: /* @__PURE__ */ jsx45(
3760
3907
  AriaButton14,
@@ -3775,6 +3922,7 @@ function ShellRail({ groups, value, onChange, className, ...rest }) {
3775
3922
  import { Tabs as AriaTabs, TabList, Tab as AriaTab, TabPanel } from "react-aria-components";
3776
3923
  import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
3777
3924
  function Tabs({ items, value, defaultValue, onChange, panels, className, style, ...rest }) {
3925
+ const msg = usePireMessages();
3778
3926
  return /* @__PURE__ */ jsxs36(
3779
3927
  AriaTabs,
3780
3928
  {
@@ -3784,7 +3932,7 @@ function Tabs({ items, value, defaultValue, onChange, panels, className, style,
3784
3932
  defaultSelectedKey: defaultValue,
3785
3933
  onSelectionChange: (k) => onChange?.(String(k)),
3786
3934
  children: [
3787
- /* @__PURE__ */ jsx46(TabList, { className: "pire-tablist", items, "aria-label": rest["aria-label"] ?? "Views", children: (item) => /* @__PURE__ */ jsxs36(AriaTab, { className: cx("pire-tab"), id: item.id, isDisabled: item.isDisabled, children: [
3935
+ /* @__PURE__ */ jsx46(TabList, { className: "pire-tablist", items, "aria-label": rest["aria-label"] ?? msg.tabsLabel, children: (item) => /* @__PURE__ */ jsxs36(AriaTab, { className: cx("pire-tab"), id: item.id, isDisabled: item.isDisabled, children: [
3788
3936
  item.icon ? /* @__PURE__ */ jsx46(Icon, { name: item.icon, size: 16 }) : null,
3789
3937
  item.label,
3790
3938
  item.count != null ? /* @__PURE__ */ jsx46("span", { className: "pire-tab-count", children: item.count }) : null
@@ -3843,7 +3991,10 @@ function Pagination({
3843
3991
  size: "sm",
3844
3992
  fullWidth: false,
3845
3993
  value: String(pageSize),
3846
- options: pageSizes.map((s) => ({ value: String(s), label: `${s} rows` })),
3994
+ options: pageSizes.map((s) => ({
3995
+ value: String(s),
3996
+ label: msg.paginationPageSize.replace("{count}", String(s))
3997
+ })),
3847
3998
  onChange: (v) => onPageSizeChange(Number(v)),
3848
3999
  style: { width: 120 }
3849
4000
  }
@@ -3852,7 +4003,7 @@ function Pagination({
3852
4003
  }
3853
4004
 
3854
4005
  // src/components/navigation/Ribbon.tsx
3855
- import * as React26 from "react";
4006
+ import * as React27 from "react";
3856
4007
  import { Tabs as AriaTabs2, TabList as TabList2, Tab as AriaTab2, TabPanel as TabPanel2, Toolbar, Button as Button3 } from "react-aria-components";
3857
4008
  import { Fragment as Fragment8, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
3858
4009
  var outside = (what, parent) => {
@@ -3868,7 +4019,7 @@ var RibbonGroup = outside("Ribbon.Group", "Ribbon.Tab");
3868
4019
  var RibbonCommand = outside("Ribbon.Command", "Ribbon.Group");
3869
4020
  var CONFIG_ELEMENTS = /* @__PURE__ */ new Set([RibbonTab, RibbonGroup, RibbonCommand]);
3870
4021
  function describe(child) {
3871
- if (!React26.isValidElement(child)) return JSON.stringify(child);
4022
+ if (!React27.isValidElement(child)) return JSON.stringify(child);
3872
4023
  if (typeof child.type === "string") return `<${child.type}>`;
3873
4024
  const type = child.type;
3874
4025
  return type?.displayName || type?.name || "a component";
@@ -3876,13 +4027,13 @@ function describe(child) {
3876
4027
  function childrenOfType(children, type, what, parent) {
3877
4028
  const out = [];
3878
4029
  const walk = (nodes, path) => {
3879
- React26.Children.forEach(nodes, (child, i) => {
4030
+ React27.Children.forEach(nodes, (child, i) => {
3880
4031
  if (child == null || typeof child === "boolean") return;
3881
- if (React26.isValidElement(child) && child.type === React26.Fragment) {
4032
+ if (React27.isValidElement(child) && child.type === React27.Fragment) {
3882
4033
  return walk(child.props.children, `${path}${i}.`);
3883
4034
  }
3884
- if (!React26.isValidElement(child) || child.type !== type) {
3885
- const isWrapper = React26.isValidElement(child) && typeof child.type !== "string" && !CONFIG_ELEMENTS.has(child.type);
4035
+ if (!React27.isValidElement(child) || child.type !== type) {
4036
+ const isWrapper = React27.isValidElement(child) && typeof child.type !== "string" && !CONFIG_ELEMENTS.has(child.type);
3886
4037
  throw new Error(
3887
4038
  `[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.` : "")
3888
4039
  );
@@ -3959,9 +4110,9 @@ function Group8({ group, selectionCount }) {
3959
4110
  ] });
3960
4111
  }
3961
4112
  function useTrailingOverflow() {
3962
- const ref = React26.useRef(null);
3963
- const [overflow, setOverflow] = React26.useState(false);
3964
- React26.useEffect(() => {
4113
+ const ref = React27.useRef(null);
4114
+ const [overflow, setOverflow] = React27.useState(false);
4115
+ React27.useEffect(() => {
3965
4116
  const node = ref.current;
3966
4117
  if (!node) return;
3967
4118
  const measure = () => setOverflow(node.scrollLeft + node.clientWidth < node.scrollWidth - 1);
@@ -4024,18 +4175,18 @@ function Ribbon({
4024
4175
  const count = selectionCount ?? 0;
4025
4176
  const visible = tabs.filter((tab) => !tab.isContextual || count > 0);
4026
4177
  const fallback = visible[0]?.id;
4027
- const [ownTab, setOwnTab] = React26.useState(defaultValue);
4178
+ const [ownTab, setOwnTab] = React27.useState(defaultValue);
4028
4179
  const requested = value ?? ownTab;
4029
4180
  const selected = visible.some((tab) => tab.id === requested) ? requested : fallback;
4030
- const select = React26.useCallback(
4181
+ const select = React27.useCallback(
4031
4182
  (id) => {
4032
4183
  setOwnTab(id);
4033
4184
  onChange?.(id);
4034
4185
  },
4035
4186
  [onChange]
4036
4187
  );
4037
- const hadSelection = React26.useRef(false);
4038
- React26.useEffect(() => {
4188
+ const hadSelection = React27.useRef(false);
4189
+ React27.useEffect(() => {
4039
4190
  const has = count > 0;
4040
4191
  if (has === hadSelection.current) return;
4041
4192
  hadSelection.current = has;
@@ -4044,16 +4195,16 @@ function Ribbon({
4044
4195
  if (has) select(contextual.id);
4045
4196
  else if (requested === contextual.id) select(tabs.find((tab) => !tab.isContextual)?.id ?? "");
4046
4197
  }, [count, tabs, requested, select]);
4047
- const [ownCollapsed, setOwnCollapsed] = React26.useState(false);
4198
+ const [ownCollapsed, setOwnCollapsed] = React27.useState(false);
4048
4199
  const collapsed = isCollapsed ?? ownCollapsed;
4049
- const toggleRef = React26.useRef(null);
4050
- const restoreFocus = React26.useRef(false);
4051
- React26.useLayoutEffect(() => {
4200
+ const toggleRef = React27.useRef(null);
4201
+ const restoreFocus = React27.useRef(false);
4202
+ React27.useLayoutEffect(() => {
4052
4203
  if (!restoreFocus.current) return;
4053
4204
  restoreFocus.current = false;
4054
4205
  toggleRef.current?.focus();
4055
4206
  });
4056
- const bandId = React26.useId();
4207
+ const bandId = React27.useId();
4057
4208
  const toggle = /* @__PURE__ */ jsx48(
4058
4209
  Button3,
4059
4210
  {
@@ -4085,7 +4236,7 @@ function Ribbon({
4085
4236
  children: [
4086
4237
  primaries.map((c) => /* @__PURE__ */ jsx48(Command, { command: c, selectionCount: count, inBar: true }, c.key)),
4087
4238
  leading ? /* @__PURE__ */ jsx48("div", { className: "pire-ribbon-leading", children: leading }) : null,
4088
- blocks.map((block, i) => /* @__PURE__ */ jsxs38(React26.Fragment, { children: [
4239
+ blocks.map((block, i) => /* @__PURE__ */ jsxs38(React27.Fragment, { children: [
4089
4240
  i > 0 || leading || primaries.length ? /* @__PURE__ */ jsx48("span", { className: "pire-ribbon-bar-sep" }) : null,
4090
4241
  block.commands.map((c) => /* @__PURE__ */ jsx48(Command, { command: c, selectionCount: count, inBar: true }, c.key))
4091
4242
  ] }, block.key))
@@ -4164,7 +4315,7 @@ function InlineMessage({
4164
4315
  }
4165
4316
 
4166
4317
  // src/components/feedback/Toast.tsx
4167
- import * as React27 from "react";
4318
+ import * as React28 from "react";
4168
4319
  import { jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
4169
4320
  var KIND_ICON2 = {
4170
4321
  info: "info",
@@ -4197,25 +4348,42 @@ function Toast({
4197
4348
  }
4198
4349
  );
4199
4350
  }
4200
- var ToastContext = React27.createContext(null);
4351
+ var ToastContext = React28.createContext(null);
4201
4352
  function ToastProvider({
4202
4353
  children,
4203
4354
  timeout = 6e3
4204
4355
  }) {
4205
4356
  const msg = usePireMessages();
4206
- const [toasts, setToasts] = React27.useState([]);
4207
- const close = React27.useCallback((id) => setToasts((t) => t.filter((x) => x.id !== id)), []);
4208
- const add = React27.useCallback(
4357
+ const [toasts, setToasts] = React28.useState([]);
4358
+ const timers = React28.useRef(/* @__PURE__ */ new Map());
4359
+ const nextId = React28.useRef(0);
4360
+ const close = React28.useCallback((id) => {
4361
+ clearTimeout(timers.current.get(id));
4362
+ timers.current.delete(id);
4363
+ setToasts((t) => t.filter((x) => x.id !== id));
4364
+ }, []);
4365
+ const add = React28.useCallback(
4209
4366
  (toast) => {
4210
- const id = Math.random().toString(36).slice(2);
4367
+ const id = String(++nextId.current);
4211
4368
  setToasts((t) => [...t, { ...toast, id }]);
4212
4369
  const ms = toast.timeout ?? timeout;
4213
- if (ms > 0) setTimeout(() => close(id), ms);
4370
+ if (ms > 0)
4371
+ timers.current.set(
4372
+ id,
4373
+ setTimeout(() => close(id), ms)
4374
+ );
4214
4375
  return id;
4215
4376
  },
4216
4377
  [close, timeout]
4217
4378
  );
4218
- const value = React27.useMemo(() => ({ add, close }), [add, close]);
4379
+ React28.useEffect(() => {
4380
+ const pending = timers.current;
4381
+ return () => {
4382
+ for (const timer of pending.values()) clearTimeout(timer);
4383
+ pending.clear();
4384
+ };
4385
+ }, []);
4386
+ const value = React28.useMemo(() => ({ add, close }), [add, close]);
4219
4387
  return /* @__PURE__ */ jsxs40(ToastContext.Provider, { value, children: [
4220
4388
  children,
4221
4389
  /* @__PURE__ */ jsx50("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ jsx50(
@@ -4231,7 +4399,7 @@ function ToastProvider({
4231
4399
  ] });
4232
4400
  }
4233
4401
  function useToast() {
4234
- const ctx = React27.useContext(ToastContext);
4402
+ const ctx = React28.useContext(ToastContext);
4235
4403
  if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
4236
4404
  return ctx;
4237
4405
  }
@@ -4609,14 +4777,14 @@ function BarChart({
4609
4777
  }
4610
4778
 
4611
4779
  // src/components/data/LineChart.tsx
4612
- import * as React28 from "react";
4780
+ import * as React29 from "react";
4613
4781
  import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
4614
4782
  var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
4615
4783
  var MARKER_LIMIT = 20;
4616
- var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React28.useEffect : React28.useLayoutEffect;
4784
+ var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React29.useEffect : React29.useLayoutEffect;
4617
4785
  function useMeasuredWidth() {
4618
- const ref = React28.useRef(null);
4619
- const [width, setWidth] = React28.useState(0);
4786
+ const ref = React29.useRef(null);
4787
+ const [width, setWidth] = React29.useState(0);
4620
4788
  useIsomorphicLayoutEffect2(() => {
4621
4789
  const element = ref.current;
4622
4790
  if (!element) return;
@@ -4771,7 +4939,7 @@ function LineChart({
4771
4939
  return /* @__PURE__ */ jsxs48("span", { className: "pire-chart-tip-row", children: [
4772
4940
  one.label,
4773
4941
  ": ",
4774
- value == null ? "No data" : formatValue(value)
4942
+ value == null ? msg.chartNoValue : formatValue(value)
4775
4943
  ] }, one.id);
4776
4944
  })
4777
4945
  ] }) }, categoryIndex)
@@ -4784,7 +4952,7 @@ function LineChart({
4784
4952
  }
4785
4953
 
4786
4954
  // src/components/data/DonutChart.tsx
4787
- import * as React29 from "react";
4955
+ import * as React30 from "react";
4788
4956
  import { jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
4789
4957
  var SEGMENT_GAP_DEGREES = 1.5;
4790
4958
  function DonutChart({
@@ -4805,7 +4973,7 @@ function DonutChart({
4805
4973
  }) {
4806
4974
  const label = rest["aria-label"];
4807
4975
  const msg = usePireMessages();
4808
- const [hoveredIndex, setHoveredIndex] = React29.useState(null);
4976
+ const [hoveredIndex, setHoveredIndex] = React30.useState(null);
4809
4977
  warnOnDonutShape(series, categories.length, label);
4810
4978
  const values = (series[0]?.values ?? []).slice(0, categories.length);
4811
4979
  const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
@@ -4816,7 +4984,7 @@ function DonutChart({
4816
4984
  const circumference = 2 * Math.PI * radius;
4817
4985
  const gapLength = SEGMENT_GAP_DEGREES / 360 * circumference;
4818
4986
  const legend = segments.map((segment) => ({
4819
- key: segment.category,
4987
+ key: String(segment.index),
4820
4988
  label: segment.category,
4821
4989
  color: colorForSegment(segment.index)
4822
4990
  }));
@@ -4864,7 +5032,7 @@ function DonutChart({
4864
5032
  "data-hovered": hoveredIndex === segment.index ? "true" : void 0,
4865
5033
  onMouseEnter: () => setHoveredIndex(segment.index)
4866
5034
  },
4867
- segment.category
5035
+ segment.index
4868
5036
  )
4869
5037
  );
4870
5038
  }) })
@@ -5024,7 +5192,7 @@ function SectionHeader({ title, meta, actions, className, ...rest }) {
5024
5192
  }
5025
5193
 
5026
5194
  // src/components/layout/SelectionBar.tsx
5027
- import * as React30 from "react";
5195
+ import * as React31 from "react";
5028
5196
  import { useLocale as useLocale2 } from "react-aria-components";
5029
5197
  import { jsx as jsx67, jsxs as jsxs56 } from "react/jsx-runtime";
5030
5198
  function SelectionBar({
@@ -5041,8 +5209,8 @@ function SelectionBar({
5041
5209
  }) {
5042
5210
  const msg = usePireMessages();
5043
5211
  const { locale } = useLocale2();
5044
- const plural = React30.useMemo(() => new Intl.PluralRules(locale), [locale]);
5045
- const numbers = React30.useMemo(() => new Intl.NumberFormat(locale), [locale]);
5212
+ const plural = React31.useMemo(() => new Intl.PluralRules(locale), [locale]);
5213
+ const numbers = React31.useMemo(() => new Intl.NumberFormat(locale), [locale]);
5046
5214
  if (!count) return null;
5047
5215
  const isOne = plural.select(count) === "one";
5048
5216
  let sentence;
@@ -5116,8 +5284,8 @@ function ConfirmDialog({
5116
5284
  facts,
5117
5285
  consequence,
5118
5286
  children,
5119
- confirmLabel = "Confirm",
5120
- cancelLabel = "Cancel",
5287
+ confirmLabel,
5288
+ cancelLabel,
5121
5289
  tone = "primary",
5122
5290
  isBusy,
5123
5291
  onConfirm,
@@ -5135,8 +5303,8 @@ function ConfirmDialog({
5135
5303
  isDismissable: !isBusy,
5136
5304
  showClose: false,
5137
5305
  footer: /* @__PURE__ */ jsxs59(Fragment10, { children: [
5138
- /* @__PURE__ */ jsx70(Button, { variant: "tertiary", isDisabled: isBusy, onPress: onCancel, children: cancelLabel }),
5139
- /* @__PURE__ */ jsx70(Button, { variant: tone === "danger" ? "danger" : "primary", isDisabled: isBusy, onPress: onConfirm, children: isBusy ? "Working\u2026" : confirmLabel })
5306
+ /* @__PURE__ */ jsx70(Button, { variant: "tertiary", isDisabled: isBusy, onPress: onCancel, children: cancelLabel ?? msg.confirmDialogCancel }),
5307
+ /* @__PURE__ */ jsx70(Button, { variant: tone === "danger" ? "danger" : "primary", isDisabled: isBusy, onPress: onConfirm, children: isBusy ? msg.confirmDialogBusy : confirmLabel ?? msg.confirmDialogConfirm })
5140
5308
  ] }),
5141
5309
  children: [
5142
5310
  facts?.length ? (
@@ -5161,7 +5329,7 @@ function ConfirmDialog({
5161
5329
  }
5162
5330
 
5163
5331
  // src/components/patterns/CommandPalette.tsx
5164
- import * as React31 from "react";
5332
+ import * as React32 from "react";
5165
5333
  import {
5166
5334
  Autocomplete,
5167
5335
  ModalOverlay as ModalOverlay2,
@@ -5172,7 +5340,7 @@ import {
5172
5340
  Menu as AriaMenu2,
5173
5341
  MenuSection as AriaMenuSection2,
5174
5342
  Header as Header2,
5175
- useFilter
5343
+ useFilter as useFilter2
5176
5344
  } from "react-aria-components";
5177
5345
  import { Fragment as Fragment11, jsx as jsx71, jsxs as jsxs60 } from "react/jsx-runtime";
5178
5346
  var RESULTS_SECTION_KEY = "__pire_results__";
@@ -5195,17 +5363,17 @@ function CommandPalette({
5195
5363
  style
5196
5364
  }) {
5197
5365
  const msg = usePireMessages();
5198
- const [query, setQuery] = React31.useState("");
5199
- const { contains } = useFilter({ sensitivity: "base" });
5200
- React31.useEffect(() => {
5366
+ const [query, setQuery] = React32.useState("");
5367
+ const { contains } = useFilter2({ sensitivity: "base" });
5368
+ React32.useEffect(() => {
5201
5369
  if (isOpen) setQuery("");
5202
5370
  }, [isOpen]);
5203
- const searchableById = React31.useMemo(() => {
5371
+ const searchableById = React32.useMemo(() => {
5204
5372
  const byId = /* @__PURE__ */ new Map();
5205
5373
  for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
5206
5374
  return byId;
5207
5375
  }, [groups]);
5208
- const filter = React31.useCallback(
5376
+ const filter = React32.useCallback(
5209
5377
  (textValue, inputValue, node) => {
5210
5378
  if (node.parentKey === RESULTS_SECTION_KEY) return true;
5211
5379
  return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
@@ -5291,9 +5459,9 @@ function CommandPalette({
5291
5459
  );
5292
5460
  }
5293
5461
  function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
5294
- const handler = React31.useRef(onTrigger);
5462
+ const handler = React32.useRef(onTrigger);
5295
5463
  handler.current = onTrigger;
5296
- React31.useEffect(() => {
5464
+ React32.useEffect(() => {
5297
5465
  if (isDisabled) return;
5298
5466
  const onKeyDown = (event) => {
5299
5467
  if (!(event.metaKey || event.ctrlKey) || event.altKey) return;
@@ -5307,13 +5475,13 @@ function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
5307
5475
  }
5308
5476
 
5309
5477
  // src/components/patterns/AppLauncher.tsx
5310
- import * as React32 from "react";
5478
+ import * as React33 from "react";
5311
5479
  import {
5312
5480
  DialogTrigger,
5313
5481
  Button as AriaButton18,
5314
5482
  Popover as Popover9,
5315
5483
  Dialog as AriaDialog5,
5316
- useFilter as useFilter2
5484
+ useFilter as useFilter3
5317
5485
  } from "react-aria-components";
5318
5486
  import { Fragment as Fragment12, jsx as jsx72, jsxs as jsxs61 } from "react/jsx-runtime";
5319
5487
  var searchableText2 = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
@@ -5334,13 +5502,13 @@ function AppLauncher({
5334
5502
  className
5335
5503
  }) {
5336
5504
  const msg = usePireMessages();
5337
- const [query, setQuery] = React32.useState("");
5338
- const { contains } = useFilter2({ sensitivity: "base" });
5505
+ const [query, setQuery] = React33.useState("");
5506
+ const { contains } = useFilter3({ sensitivity: "base" });
5339
5507
  const handleSearch = (next) => {
5340
5508
  setQuery(next);
5341
5509
  onSearchChange?.(next);
5342
5510
  };
5343
- const visible = React32.useMemo(() => {
5511
+ const visible = React33.useMemo(() => {
5344
5512
  if (isFilteredExternally) return sections;
5345
5513
  const q = query.trim();
5346
5514
  if (!q) return sections;
@@ -5351,85 +5519,89 @@ function AppLauncher({
5351
5519
  }, [sections, query, isFilteredExternally, contains]);
5352
5520
  const isEmpty = !isLoading && visible.length === 0;
5353
5521
  const label = ariaLabel ?? msg.appLauncherLabel;
5354
- return /* @__PURE__ */ jsxs61(DialogTrigger, { children: [
5355
- /* @__PURE__ */ jsx72(AriaButton18, { className: "pire-launcher-trigger", "aria-label": label, children: /* @__PURE__ */ jsx72(Icon, { name: icon, size: 20 }) }),
5356
- /* @__PURE__ */ jsx72(
5357
- Popover9,
5358
- {
5359
- className: cx("pire-launcher-popover", className),
5360
- placement: "bottom start",
5361
- offset: 0,
5362
- crossOffset: 0,
5363
- containerPadding: 0,
5364
- children: /* @__PURE__ */ jsx72(AriaDialog5, { className: "pire-launcher", "aria-label": label, children: ({ close }) => /* @__PURE__ */ jsxs61(Fragment12, { children: [
5365
- /* @__PURE__ */ jsxs61("div", { className: "pire-launcher-head", children: [
5366
- /* @__PURE__ */ jsx72("span", { className: "pire-launcher-title", children: title ?? msg.appLauncherTitle }),
5367
- meta ? /* @__PURE__ */ jsx72("span", { className: "pire-launcher-meta", children: meta }) : null
5368
- ] }),
5369
- isSearchable ? (
5370
- // autoFocus is right here specifically: the panel exists to be searched, and the
5371
- // user just chose to open it, so taking the caret is what they asked for.
5372
- /* @__PURE__ */ jsx72(
5373
- Input,
5374
- {
5375
- "aria-label": msg.appLauncherSearch,
5376
- icon: "search",
5377
- type: "search",
5378
- autoFocus: true,
5379
- isClearable: true,
5380
- value: query,
5381
- onChange: handleSearch,
5382
- placeholder: searchPlaceholder ?? msg.appLauncherSearch
5383
- }
5384
- )
5385
- ) : null,
5386
- isLoading ? /* @__PURE__ */ jsx72("div", { className: "pire-launcher-empty", role: "status", "aria-live": "polite", children: msg.appLauncherLoading }) : null,
5387
- isEmpty ? /* @__PURE__ */ jsx72("div", { className: "pire-launcher-empty", children: emptyLabel ?? msg.appLauncherEmpty }) : null,
5388
- visible.map((section, si) => (
5389
- // Sections are positional zones with no record identity, so the heading is the key
5390
- // where there is one. Same reasoning as ShellRail's groups.
5391
- /* @__PURE__ */ jsxs61("div", { className: "pire-launcher-section", children: [
5392
- section.label ? /* @__PURE__ */ jsx72("div", { className: "pire-eyebrow", children: section.label }) : null,
5393
- /* @__PURE__ */ jsx72("div", { className: "pire-launcher-grid", "data-variant": section.variant ?? "tile", children: section.items.map((item) => {
5394
- const isCurrent = item.id === value;
5395
- const showsDescription = (section.variant ?? "tile") === "tile" && Boolean(item.description);
5396
- return /* @__PURE__ */ jsxs61(
5397
- AriaButton18,
5398
- {
5399
- className: "pire-launcher-item",
5400
- "data-selected": isCurrent ? "true" : void 0,
5401
- "aria-current": isCurrent ? "true" : void 0,
5402
- onPress: () => {
5403
- close();
5404
- onAction?.(item.id);
5522
+ return (
5523
+ // Each opening starts from the full list, as CommandPalette and ValueHelpDialog do. Reset through
5524
+ // `handleSearch` so a consumer filtering on the server clears its query too.
5525
+ /* @__PURE__ */ jsxs61(DialogTrigger, { onOpenChange: (open) => open && query && handleSearch(""), children: [
5526
+ /* @__PURE__ */ jsx72(AriaButton18, { className: "pire-launcher-trigger", "aria-label": label, children: /* @__PURE__ */ jsx72(Icon, { name: icon, size: 20 }) }),
5527
+ /* @__PURE__ */ jsx72(
5528
+ Popover9,
5529
+ {
5530
+ className: cx("pire-launcher-popover", className),
5531
+ placement: "bottom start",
5532
+ offset: 0,
5533
+ crossOffset: 0,
5534
+ containerPadding: 0,
5535
+ children: /* @__PURE__ */ jsx72(AriaDialog5, { className: "pire-launcher", "aria-label": label, children: ({ close }) => /* @__PURE__ */ jsxs61(Fragment12, { children: [
5536
+ /* @__PURE__ */ jsxs61("div", { className: "pire-launcher-head", children: [
5537
+ /* @__PURE__ */ jsx72("span", { className: "pire-launcher-title", children: title ?? msg.appLauncherTitle }),
5538
+ meta ? /* @__PURE__ */ jsx72("span", { className: "pire-launcher-meta", children: meta }) : null
5539
+ ] }),
5540
+ isSearchable ? (
5541
+ // autoFocus is right here specifically: the panel exists to be searched, and the
5542
+ // user just chose to open it, so taking the caret is what they asked for.
5543
+ /* @__PURE__ */ jsx72(
5544
+ Input,
5545
+ {
5546
+ "aria-label": msg.appLauncherSearch,
5547
+ icon: "search",
5548
+ type: "search",
5549
+ autoFocus: true,
5550
+ isClearable: true,
5551
+ value: query,
5552
+ onChange: handleSearch,
5553
+ placeholder: searchPlaceholder ?? msg.appLauncherSearch
5554
+ }
5555
+ )
5556
+ ) : null,
5557
+ isLoading ? /* @__PURE__ */ jsx72("div", { className: "pire-launcher-empty", role: "status", "aria-live": "polite", children: msg.appLauncherLoading }) : null,
5558
+ isEmpty ? /* @__PURE__ */ jsx72("div", { className: "pire-launcher-empty", children: emptyLabel ?? msg.appLauncherEmpty }) : null,
5559
+ visible.map((section, si) => (
5560
+ // Sections are positional zones with no record identity, so the heading is the key
5561
+ // where there is one. Same reasoning as ShellRail's groups.
5562
+ /* @__PURE__ */ jsxs61("div", { className: "pire-launcher-section", children: [
5563
+ section.label ? /* @__PURE__ */ jsx72("div", { className: "pire-eyebrow", children: section.label }) : null,
5564
+ /* @__PURE__ */ jsx72("div", { className: "pire-launcher-grid", "data-variant": section.variant ?? "tile", children: section.items.map((item) => {
5565
+ const isCurrent = item.id === value;
5566
+ const showsDescription = (section.variant ?? "tile") === "tile" && Boolean(item.description);
5567
+ return /* @__PURE__ */ jsxs61(
5568
+ AriaButton18,
5569
+ {
5570
+ className: "pire-launcher-item",
5571
+ "data-selected": isCurrent ? "true" : void 0,
5572
+ "aria-current": isCurrent ? "true" : void 0,
5573
+ onPress: () => {
5574
+ close();
5575
+ onAction?.(item.id);
5576
+ },
5577
+ children: [
5578
+ item.icon ? /* @__PURE__ */ jsx72("span", { className: "pire-launcher-item-icon", children: /* @__PURE__ */ jsx72(
5579
+ Icon,
5580
+ {
5581
+ name: item.icon,
5582
+ size: (section.variant ?? "tile") === "tile" ? 20 : 16
5583
+ }
5584
+ ) }) : null,
5585
+ /* @__PURE__ */ jsxs61("span", { className: "pire-launcher-item-text", children: [
5586
+ /* @__PURE__ */ jsx72("span", { className: "pire-launcher-item-label", children: item.label }),
5587
+ showsDescription ? /* @__PURE__ */ jsx72("span", { className: "pire-launcher-item-desc", children: item.description }) : null
5588
+ ] })
5589
+ ]
5405
5590
  },
5406
- children: [
5407
- item.icon ? /* @__PURE__ */ jsx72("span", { className: "pire-launcher-item-icon", children: /* @__PURE__ */ jsx72(
5408
- Icon,
5409
- {
5410
- name: item.icon,
5411
- size: (section.variant ?? "tile") === "tile" ? 20 : 16
5412
- }
5413
- ) }) : null,
5414
- /* @__PURE__ */ jsxs61("span", { className: "pire-launcher-item-text", children: [
5415
- /* @__PURE__ */ jsx72("span", { className: "pire-launcher-item-label", children: item.label }),
5416
- showsDescription ? /* @__PURE__ */ jsx72("span", { className: "pire-launcher-item-desc", children: item.description }) : null
5417
- ] })
5418
- ]
5419
- },
5420
- item.id
5421
- );
5422
- }) })
5423
- ] }, section.label ?? section.items[0]?.id ?? si)
5424
- ))
5425
- ] }) })
5426
- }
5427
- )
5428
- ] });
5591
+ item.id
5592
+ );
5593
+ }) })
5594
+ ] }, section.label ?? section.items[0]?.id ?? si)
5595
+ ))
5596
+ ] }) })
5597
+ }
5598
+ )
5599
+ ] })
5600
+ );
5429
5601
  }
5430
5602
 
5431
5603
  // src/components/patterns/SidePanel.tsx
5432
- import * as React33 from "react";
5604
+ import * as React34 from "react";
5433
5605
  import { ModalOverlay as ModalOverlay3, Modal as Modal3, Dialog as AriaDialog6, Heading as Heading5 } from "react-aria-components";
5434
5606
  import { jsx as jsx73, jsxs as jsxs62 } from "react/jsx-runtime";
5435
5607
  var PHONE_MAX_WIDTH = 600;
@@ -5454,8 +5626,8 @@ function SidePanel({
5454
5626
  className
5455
5627
  }) {
5456
5628
  const msg = usePireMessages();
5457
- const titleId = React33.useId();
5458
- const narrow = React33.useSyncExternalStore(subscribeNarrow, isNarrow, () => false);
5629
+ const titleId = React34.useId();
5630
+ const narrow = React34.useSyncExternalStore(subscribeNarrow, isNarrow, () => false);
5459
5631
  const head = (heading) => /* @__PURE__ */ jsxs62("header", { className: "pire-dialog-head", children: [
5460
5632
  /* @__PURE__ */ jsxs62("div", { style: { flex: 1, minWidth: 0 }, children: [
5461
5633
  heading,
@@ -5532,7 +5704,7 @@ function EmptyState({
5532
5704
  }
5533
5705
 
5534
5706
  // src/components/patterns/NumPad.tsx
5535
- import * as React34 from "react";
5707
+ import * as React35 from "react";
5536
5708
  import { useLocale as useLocale3 } from "react-aria-components";
5537
5709
  import { jsx as jsx75, jsxs as jsxs64 } from "react/jsx-runtime";
5538
5710
  var BASE_KEYS = [
@@ -5557,9 +5729,9 @@ function fittingDigits(digits, buffer, separator, maxFractionDigits) {
5557
5729
  return room <= 0 ? "" : digits.slice(0, room);
5558
5730
  }
5559
5731
  function useNumPadKeyboard(onKey, isDisabled, containerRef) {
5560
- const handler = React34.useRef(onKey);
5732
+ const handler = React35.useRef(onKey);
5561
5733
  handler.current = onKey;
5562
- React34.useEffect(() => {
5734
+ React35.useEffect(() => {
5563
5735
  if (isDisabled) return;
5564
5736
  const isEditingElsewhere = () => {
5565
5737
  const el = document.activeElement;
@@ -5606,11 +5778,11 @@ function NumPad({
5606
5778
  style
5607
5779
  }) {
5608
5780
  const msg = usePireMessages();
5609
- const containerRef = React34.useRef(null);
5781
+ const containerRef = React35.useRef(null);
5610
5782
  const { locale } = useLocale3();
5611
5783
  const separator = decimalSeparatorFor(locale);
5612
5784
  const allowsDecimal = maxFractionDigits !== void 0 && maxFractionDigits > 0;
5613
- const applyKey = React34.useCallback(
5785
+ const applyKey = React35.useCallback(
5614
5786
  (key) => {
5615
5787
  if (isDisabled) return;
5616
5788
  if (key.value === "backspace") {
@@ -5677,7 +5849,7 @@ function NumPad({
5677
5849
  }
5678
5850
 
5679
5851
  // src/components/patterns/FileDropZone.tsx
5680
- import * as React35 from "react";
5852
+ import * as React36 from "react";
5681
5853
  import { DropZone, FileTrigger as FileTrigger2, isFileDropItem } from "react-aria-components";
5682
5854
  import { jsx as jsx76, jsxs as jsxs65 } from "react/jsx-runtime";
5683
5855
  var isImage2 = (file) => file.type.startsWith("image/");
@@ -5707,15 +5879,14 @@ function FileDropZone({
5707
5879
  ...rest
5708
5880
  }) {
5709
5881
  const msg = usePireMessages();
5710
- const [uncontrolled, setUncontrolled] = React35.useState(defaultValue ?? []);
5882
+ const [uncontrolled, setUncontrolled] = React36.useState(defaultValue ?? []);
5711
5883
  const files = value ?? uncontrolled;
5712
- const created = React35.useRef([]);
5713
- React35.useEffect(
5714
- () => () => {
5715
- for (const url of created.current) URL.revokeObjectURL(url);
5716
- },
5717
- []
5718
- );
5884
+ const previewUrlFor = usePreviewUrls(files);
5885
+ const id = React36.useId();
5886
+ const labelId = label ? `${id}-label` : void 0;
5887
+ const hintId = description ? `${id}-hint` : void 0;
5888
+ const errorId = isInvalid && errorMessage ? `${id}-error` : void 0;
5889
+ const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
5719
5890
  const commit = (next) => {
5720
5891
  if (value === void 0) setUncontrolled(next);
5721
5892
  onChange?.(next);
@@ -5726,15 +5897,14 @@ function FileDropZone({
5726
5897
  if (rejected.length) onError?.(rejected);
5727
5898
  if (!accepted.length) return;
5728
5899
  const wrapped = accepted.map((file) => {
5729
- const previewUrl = showPreview && isImage2(file) ? URL.createObjectURL(file) : void 0;
5730
- if (previewUrl) created.current.push(previewUrl);
5900
+ const previewUrl = showPreview && isImage2(file) ? previewUrlFor(file) : void 0;
5731
5901
  return { file, previewUrl };
5732
5902
  });
5733
5903
  commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
5734
5904
  };
5735
5905
  const remove = (target) => commit(files.filter((f) => f.file !== target));
5736
5906
  return /* @__PURE__ */ jsxs65("div", { className: cx("pire-field", className), style, "data-full-width": String(fullWidth), ...rest, children: [
5737
- label ? /* @__PURE__ */ jsxs65("span", { className: "pire-field-label", children: [
5907
+ label ? /* @__PURE__ */ jsxs65("span", { className: "pire-field-label", id: labelId, children: [
5738
5908
  label,
5739
5909
  isRequired ? /* @__PURE__ */ jsx76("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
5740
5910
  ] }) : null,
@@ -5743,6 +5913,7 @@ function FileDropZone({
5743
5913
  {
5744
5914
  className: "pire-dropzone",
5745
5915
  "aria-label": ariaLabel,
5916
+ "aria-labelledby": ariaLabel ? void 0 : labelId,
5746
5917
  "data-height": height,
5747
5918
  isDisabled: isDisabled || isReadOnly,
5748
5919
  onDrop: async (e) => {
@@ -5758,7 +5929,7 @@ function FileDropZone({
5758
5929
  acceptedFileTypes,
5759
5930
  allowsMultiple,
5760
5931
  onSelect: (list) => accept(list ? [...list] : []),
5761
- children: /* @__PURE__ */ jsx76(Button, { variant: "secondary", isDisabled: isDisabled || isReadOnly, children: msg.fileUploadChoose })
5932
+ children: /* @__PURE__ */ jsx76(Button, { variant: "secondary", isDisabled: isDisabled || isReadOnly, "aria-describedby": describedBy, children: msg.fileUploadChoose })
5762
5933
  }
5763
5934
  )
5764
5935
  ]
@@ -5779,8 +5950,8 @@ function FileDropZone({
5779
5950
  )
5780
5951
  ] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
5781
5952
  uploadProgress != null ? /* @__PURE__ */ jsx76(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
5782
- description ? /* @__PURE__ */ jsx76("span", { className: "pire-field-hint", children: description }) : null,
5783
- isInvalid && errorMessage ? /* @__PURE__ */ jsx76("span", { className: "pire-field-error", children: errorMessage }) : null
5953
+ description ? /* @__PURE__ */ jsx76("span", { className: "pire-field-hint", id: hintId, children: description }) : null,
5954
+ errorId ? /* @__PURE__ */ jsx76("span", { className: "pire-field-error", id: errorId, children: errorMessage }) : null
5784
5955
  ] });
5785
5956
  }
5786
5957