@nubitio/ui 0.5.29 → 0.5.30

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/index.cjs CHANGED
@@ -541,7 +541,7 @@ function FileDropzone({ accept, value = null, image = false, disabled = false, r
541
541
  function cx$2(...values) {
542
542
  return values.filter(Boolean).join(" ");
543
543
  }
544
- function normalizeIcon(icon) {
544
+ function normalizeIcon$2(icon) {
545
545
  if (!icon) return void 0;
546
546
  if (icon.startsWith("ph ")) return icon;
547
547
  if (icon.startsWith("ph-")) return `ph ${icon}`;
@@ -579,7 +579,7 @@ function getMenuStyle(containerRef, menuMinWidth = 72) {
579
579
  visibility: "visible"
580
580
  };
581
581
  }
582
- function AppDropdown({ id: idProp, label, icon, value, options, onChange, disabled = false, placeholder = "Seleccionar…", variant = "form", className, showFieldLabel = variant === "form", menuMinWidth, error, helpText }) {
582
+ function AppDropdown({ id: idProp, label, icon, value, options, onChange, disabled = false, placeholder = "Seleccionar…", variant = "form", className, showFieldLabel = variant === "form", menuMinWidth, error, helpText, menuHeader, menuFooter, onOpenChange }) {
583
583
  const generatedId = (0, react.useId)();
584
584
  const id = idProp ?? generatedId;
585
585
  const [open, setOpen] = (0, react.useState)(false);
@@ -592,22 +592,26 @@ function AppDropdown({ id: idProp, label, icon, value, options, onChange, disabl
592
592
  });
593
593
  const selected = options.find((option) => option.value === value);
594
594
  const computeMenuStyle = (0, react.useCallback)(() => getMenuStyle(containerRef, menuMinWidth), [menuMinWidth]);
595
+ const setMenuOpen = (0, react.useCallback)((next) => {
596
+ setOpen(next);
597
+ onOpenChange?.(next);
598
+ }, [onOpenChange]);
595
599
  (0, react.useEffect)(() => {
596
600
  if (!open) return;
597
601
  const handler = (e) => {
598
602
  const target = e.target;
599
- if (!containerRef.current?.contains(target) && !menuRef.current?.contains(target)) setOpen(false);
603
+ if (!containerRef.current?.contains(target) && !menuRef.current?.contains(target)) setMenuOpen(false);
600
604
  };
601
605
  document.addEventListener("mousedown", handler);
602
606
  return () => document.removeEventListener("mousedown", handler);
603
- }, [open]);
607
+ }, [open, setMenuOpen]);
604
608
  (0, react.useLayoutEffect)(() => {
605
609
  if (!open) return;
606
610
  const update = () => {
607
611
  if (!containerRef.current) return;
608
612
  const rect = containerRef.current.getBoundingClientRect();
609
613
  if (rect.top >= window.innerHeight || rect.bottom <= 0) {
610
- setOpen(false);
614
+ setMenuOpen(false);
611
615
  return;
612
616
  }
613
617
  setMenuStyle(computeMenuStyle());
@@ -622,11 +626,15 @@ function AppDropdown({ id: idProp, label, icon, value, options, onChange, disabl
622
626
  window.removeEventListener("resize", update);
623
627
  window.removeEventListener("scroll", update, { capture: true });
624
628
  };
625
- }, [open, computeMenuStyle]);
629
+ }, [
630
+ open,
631
+ computeMenuStyle,
632
+ setMenuOpen
633
+ ]);
626
634
  const openMenu = (0, react.useCallback)(() => {
627
635
  setMenuStyle(computeMenuStyle());
628
- setOpen(true);
629
- }, [computeMenuStyle]);
636
+ setMenuOpen(true);
637
+ }, [computeMenuStyle, setMenuOpen]);
630
638
  const control = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
631
639
  ref: containerRef,
632
640
  className: cx$2("nb-dropdown", `nb-dropdown--${variant}`, open && "nb-dropdown--open", disabled && "nb-dropdown--disabled", className),
@@ -637,7 +645,7 @@ function AppDropdown({ id: idProp, label, icon, value, options, onChange, disabl
637
645
  className: "nb-dropdown__toolbar-label",
638
646
  id: `${id}-label`,
639
647
  children: [icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {
640
- className: normalizeIcon(icon),
648
+ className: normalizeIcon$2(icon),
641
649
  "aria-hidden": "true"
642
650
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label })]
643
651
  }),
@@ -648,7 +656,7 @@ function AppDropdown({ id: idProp, label, icon, value, options, onChange, disabl
648
656
  "aria-expanded": open,
649
657
  "aria-labelledby": label ? `${id}-label ${id}-value` : `${id}-value`,
650
658
  disabled,
651
- onClick: () => open ? setOpen(false) : openMenu(),
659
+ onClick: () => open ? setMenuOpen(false) : openMenu(),
652
660
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
653
661
  className: "nb-dropdown__value",
654
662
  id: `${id}-value`,
@@ -658,38 +666,45 @@ function AppDropdown({ id: idProp, label, icon, value, options, onChange, disabl
658
666
  "aria-hidden": "true"
659
667
  })]
660
668
  }),
661
- open && !disabled && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
669
+ open && !disabled && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
662
670
  ref: menuRef,
663
671
  className: cx$2("nb-dropdown__menu", `nb-dropdown__menu--${variant}`),
664
- role: "listbox",
665
- "aria-labelledby": label ? `${id}-label` : void 0,
666
672
  style: menuStyle,
667
- children: options.map((option) => {
668
- const isActive = option.value === value;
669
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
670
- role: "presentation",
671
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
672
- type: "button",
673
- role: "option",
674
- "aria-selected": isActive,
675
- disabled: option.disabled,
676
- className: cx$2("nb-dropdown__option", isActive && "nb-dropdown__option--active"),
677
- onClick: () => {
678
- if (option.disabled) return;
679
- onChange(option.value);
680
- setOpen(false);
681
- },
682
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
683
- className: "nb-dropdown__option-content",
684
- children: [option.iconText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
685
- className: "nb-dropdown__option-icon",
686
- "aria-hidden": "true",
687
- children: option.iconText
688
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: option.label })]
689
- })
673
+ children: [
674
+ menuHeader,
675
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
676
+ role: "listbox",
677
+ "aria-labelledby": label ? `${id}-label` : void 0,
678
+ className: "nb-dropdown__menu-list",
679
+ children: options.map((option) => {
680
+ const isActive = option.value === value;
681
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
682
+ role: "presentation",
683
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
684
+ type: "button",
685
+ role: "option",
686
+ "aria-selected": isActive,
687
+ disabled: option.disabled,
688
+ className: cx$2("nb-dropdown__option", isActive && "nb-dropdown__option--active"),
689
+ onClick: () => {
690
+ if (option.disabled) return;
691
+ onChange(option.value);
692
+ setMenuOpen(false);
693
+ },
694
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
695
+ className: "nb-dropdown__option-content",
696
+ children: [option.iconText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
697
+ className: "nb-dropdown__option-icon",
698
+ "aria-hidden": "true",
699
+ children: option.iconText
700
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: option.label })]
701
+ })
702
+ })
703
+ }, option.value);
690
704
  })
691
- }, option.value);
692
- })
705
+ }),
706
+ menuFooter
707
+ ]
693
708
  }), document.body)
694
709
  ]
695
710
  });
@@ -716,6 +731,139 @@ function AppDropdown({ id: idProp, label, icon, value, options, onChange, disabl
716
731
  });
717
732
  }
718
733
  //#endregion
734
+ //#region packages/ui/SearchableAppDropdown.tsx
735
+ function normalizeSearch(value) {
736
+ return value.trim().toLowerCase();
737
+ }
738
+ function filterOptions(options, query) {
739
+ const needle = normalizeSearch(query);
740
+ if (!needle) return options;
741
+ return options.filter((option) => {
742
+ return [
743
+ option.label,
744
+ option.selectedLabel,
745
+ option.value
746
+ ].filter(Boolean).join(" ").toLowerCase().includes(needle);
747
+ });
748
+ }
749
+ function SearchableAppDropdown({ options = [], searchable = true, searchPlaceholder = "Buscar…", onSearch, minSearchLength = 2, emptySearchLabel = "Sin resultados", loadingLabel = "Buscando…", selectedOption = null, value, onChange, placeholder, disabled, ...rest }) {
750
+ const searchInputId = (0, react.useId)();
751
+ const [open, setOpen] = (0, react.useState)(false);
752
+ const [searchQuery, setSearchQuery] = (0, react.useState)("");
753
+ const [remoteOptions, setRemoteOptions] = (0, react.useState)([]);
754
+ const [loading, setLoading] = (0, react.useState)(false);
755
+ const requestIdRef = (0, react.useRef)(0);
756
+ const staticSelected = (0, react.useMemo)(() => options.find((option) => option.value === value) ?? selectedOption ?? null, [
757
+ options,
758
+ selectedOption,
759
+ value
760
+ ]);
761
+ const resolvedOptions = (0, react.useMemo)(() => {
762
+ const merged = /* @__PURE__ */ new Map();
763
+ for (const option of [...options, ...remoteOptions]) if (option.value) merged.set(option.value, option);
764
+ if (staticSelected?.value) merged.set(staticSelected.value, staticSelected);
765
+ const base = Array.from(merged.values()).filter((option) => option.value !== "");
766
+ if (!searchable) return base;
767
+ if (onSearch) return base;
768
+ return filterOptions(base, searchQuery);
769
+ }, [
770
+ onSearch,
771
+ options,
772
+ remoteOptions,
773
+ searchable,
774
+ searchQuery,
775
+ staticSelected
776
+ ]);
777
+ const runSearch = (0, react.useCallback)(async (query) => {
778
+ if (!onSearch) return;
779
+ const trimmed = query.trim();
780
+ if (trimmed.length < minSearchLength) {
781
+ setRemoteOptions([]);
782
+ setLoading(false);
783
+ return;
784
+ }
785
+ const requestId = ++requestIdRef.current;
786
+ setLoading(true);
787
+ try {
788
+ const results = await onSearch(trimmed);
789
+ if (requestId !== requestIdRef.current) return;
790
+ setRemoteOptions(results.filter((option) => option.value !== ""));
791
+ } catch {
792
+ if (requestId !== requestIdRef.current) return;
793
+ setRemoteOptions([]);
794
+ } finally {
795
+ if (requestId === requestIdRef.current) setLoading(false);
796
+ }
797
+ }, [minSearchLength, onSearch]);
798
+ (0, react.useEffect)(() => {
799
+ if (!open || !onSearch) return;
800
+ const timer = window.setTimeout(() => {
801
+ runSearch(searchQuery);
802
+ }, 250);
803
+ return () => window.clearTimeout(timer);
804
+ }, [
805
+ open,
806
+ onSearch,
807
+ runSearch,
808
+ searchQuery
809
+ ]);
810
+ (0, react.useEffect)(() => {
811
+ if (open) return;
812
+ setSearchQuery("");
813
+ setRemoteOptions([]);
814
+ setLoading(false);
815
+ }, [open]);
816
+ const menuHeader = searchable ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
817
+ className: "nb-searchable-dropdown__search",
818
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {
819
+ className: "ph ph-magnifying-glass",
820
+ "aria-hidden": "true"
821
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
822
+ id: searchInputId,
823
+ type: "search",
824
+ value: searchQuery,
825
+ onChange: (event) => setSearchQuery(event.target.value),
826
+ placeholder: searchPlaceholder,
827
+ autoComplete: "off",
828
+ onKeyDown: (event) => event.stopPropagation()
829
+ })]
830
+ }) : null;
831
+ const menuFooter = (() => {
832
+ if (!searchable || !onSearch) return null;
833
+ if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
834
+ className: "nb-searchable-dropdown__status",
835
+ children: loadingLabel
836
+ });
837
+ if (searchQuery.trim().length < minSearchLength) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
838
+ className: "nb-searchable-dropdown__status",
839
+ children: [
840
+ "Escribe al menos ",
841
+ minSearchLength,
842
+ " caracteres"
843
+ ]
844
+ });
845
+ if (resolvedOptions.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
846
+ className: "nb-searchable-dropdown__status",
847
+ children: emptySearchLabel
848
+ });
849
+ return null;
850
+ })();
851
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppDropdown, {
852
+ ...rest,
853
+ value,
854
+ onChange,
855
+ placeholder,
856
+ disabled,
857
+ options: [{
858
+ value: "",
859
+ label: placeholder ?? "Seleccionar…"
860
+ }, ...resolvedOptions],
861
+ menuHeader,
862
+ menuFooter,
863
+ onOpenChange: setOpen
864
+ });
865
+ }
866
+ //#endregion
719
867
  //#region packages/ui/theme/ThemeProvider.tsx
720
868
  const ThemeContext = react.default.createContext(null);
721
869
  function useTheme() {
@@ -1322,21 +1470,275 @@ const StatCard = ({ title, headerExtra, menuVisible = true, menuItems = [{ label
1322
1470
  });
1323
1471
  //#endregion
1324
1472
  //#region packages/ui/KpiMetricRow.tsx
1325
- function KpiMetricRow({ items, className = "" }) {
1473
+ function normalizeIcon$1(icon) {
1474
+ if (!icon) return void 0;
1475
+ if (icon.startsWith("ph ")) return icon;
1476
+ if (icon.startsWith("ph-")) return `ph ${icon}`;
1477
+ return `ph ph-${icon}`;
1478
+ }
1479
+ function KpiMetricRow({ items, className = "", layout = "cards", density = "default", testId, loading = false }) {
1326
1480
  if (items.length === 0) return null;
1327
1481
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1328
- className: `nb-kpi-metric-row${className ? ` ${className}` : ""}`,
1482
+ className: `nb-kpi-metric-row${layout === "strip" ? " nb-kpi-metric-row--strip" : ""}${density === "compact" ? " nb-kpi-metric-row--compact" : ""}${className ? ` ${className}` : ""}`,
1483
+ "data-testid": testId,
1484
+ role: "group",
1485
+ "aria-busy": loading,
1486
+ children: items.map((item) => {
1487
+ const iconClass = normalizeIcon$1(item.icon);
1488
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1489
+ className: `nb-kpi-metric-card nb-kpi-metric-card--${item.tone ?? "default"}`,
1490
+ children: [layout === "strip" && iconClass && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1491
+ className: "nb-kpi-metric-card__icon",
1492
+ "aria-hidden": "true",
1493
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", { className: iconClass })
1494
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1495
+ className: "nb-kpi-metric-card__body",
1496
+ children: [
1497
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1498
+ className: "nb-kpi-metric-card__label",
1499
+ children: item.label
1500
+ }),
1501
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1502
+ className: "nb-kpi-metric-card__value",
1503
+ children: item.value
1504
+ }),
1505
+ item.hint && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1506
+ className: "nb-kpi-metric-card__hint",
1507
+ children: item.hint
1508
+ })
1509
+ ]
1510
+ })]
1511
+ }, item.label);
1512
+ })
1513
+ });
1514
+ }
1515
+ //#endregion
1516
+ //#region packages/ui/SegmentedControl.tsx
1517
+ function SegmentedControl({ options, value, onChange, ariaLabel, className = "", size = "md" }) {
1518
+ if (options.length === 0) return null;
1519
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1520
+ className: `nb-segmented-control${size === "sm" ? " nb-segmented-control--sm" : ""}${className ? ` ${className}` : ""}`,
1521
+ role: "group",
1522
+ "aria-label": ariaLabel,
1523
+ children: options.map((option) => {
1524
+ const active = option.value === value;
1525
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1526
+ type: "button",
1527
+ className: `nb-segmented-control__btn${active ? " nb-segmented-control__btn--active" : ""}`,
1528
+ "aria-pressed": active,
1529
+ disabled: option.disabled,
1530
+ onClick: () => onChange(option.value),
1531
+ children: option.label
1532
+ }, option.value);
1533
+ })
1534
+ });
1535
+ }
1536
+ //#endregion
1537
+ //#region packages/ui/FilterPanel.tsx
1538
+ function FilterPanel({ category, status, layout = "stacked", density = "default", className = "", testId }) {
1539
+ const [search, setSearch] = (0, react.useState)("");
1540
+ const threshold = category.searchThreshold ?? 10;
1541
+ const showSearch = category.options.length > threshold;
1542
+ const filteredOptions = (0, react.useMemo)(() => {
1543
+ const query = search.trim().toLowerCase();
1544
+ if (!query) return category.options;
1545
+ return category.options.filter((option) => String(option.label).toLowerCase().includes(query));
1546
+ }, [category.options, search]);
1547
+ const layoutClass = layout === "toolbar" ? " nb-filter-panel--toolbar" : "";
1548
+ const densityClass = density === "compact" ? " nb-filter-panel--compact" : "";
1549
+ const categoryChips = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1550
+ className: "nb-filter-panel__chips",
1329
1551
  role: "group",
1330
- children: items.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1331
- className: `nb-kpi-metric-card nb-kpi-metric-card--${item.tone ?? "default"}`,
1552
+ "aria-label": category.ariaLabel,
1553
+ children: [
1554
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
1555
+ label: category.allLabel ?? "Todas",
1556
+ active: category.selectedKey === null,
1557
+ size: "sm",
1558
+ onClick: () => category.onSelect(null)
1559
+ }),
1560
+ filteredOptions.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
1561
+ label: option.label,
1562
+ active: category.selectedKey === option.key,
1563
+ size: "sm",
1564
+ onClick: () => category.onSelect(option.key)
1565
+ }, option.key)),
1566
+ showSearch && filteredOptions.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1567
+ className: "nb-filter-panel__empty",
1568
+ children: category.emptyMessage ?? "Sin coincidencias"
1569
+ })
1570
+ ]
1571
+ });
1572
+ if (layout === "toolbar") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1573
+ className: `nb-filter-panel${layoutClass}${densityClass}${className ? ` ${className}` : ""}`,
1574
+ "data-testid": testId,
1575
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1576
+ className: "nb-filter-panel__toolbar",
1577
+ children: [
1578
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1579
+ className: "nb-filter-panel__title",
1580
+ children: category.title
1581
+ }),
1582
+ showSearch && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1583
+ className: "nb-filter-panel__search",
1584
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
1585
+ value: search,
1586
+ onChange: (event) => setSearch(event.target.value),
1587
+ placeholder: category.searchPlaceholder ?? "Buscar…",
1588
+ "aria-label": category.searchPlaceholder ?? "Buscar"
1589
+ })
1590
+ }),
1591
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1592
+ className: "nb-filter-panel__scroll nb-filter-panel__scroll--grow",
1593
+ children: categoryChips
1594
+ }),
1595
+ status && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1596
+ className: "nb-filter-panel__title nb-filter-panel__title--status",
1597
+ children: status.title
1598
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentedControl, {
1599
+ options: status.options,
1600
+ value: status.value,
1601
+ onChange: status.onChange,
1602
+ ariaLabel: status.ariaLabel,
1603
+ size: "sm"
1604
+ })] })
1605
+ ]
1606
+ })
1607
+ });
1608
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1609
+ className: `nb-filter-panel${layoutClass}${densityClass}${className ? ` ${className}` : ""}`,
1610
+ "data-testid": testId,
1611
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1612
+ className: "nb-filter-panel__section",
1613
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1614
+ className: "nb-filter-panel__head",
1615
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1616
+ className: "nb-filter-panel__title",
1617
+ children: category.title
1618
+ }), showSearch && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1619
+ className: "nb-filter-panel__search",
1620
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
1621
+ value: search,
1622
+ onChange: (event) => setSearch(event.target.value),
1623
+ placeholder: category.searchPlaceholder ?? "Buscar…",
1624
+ "aria-label": category.searchPlaceholder ?? "Buscar"
1625
+ })
1626
+ })]
1627
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1628
+ className: "nb-filter-panel__scroll",
1629
+ children: categoryChips
1630
+ })]
1631
+ }), status && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1632
+ className: "nb-filter-panel__section nb-filter-panel__section--status",
1332
1633
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1333
- className: "nb-kpi-metric-card__label",
1334
- children: item.label
1335
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1336
- className: "nb-kpi-metric-card__value",
1337
- children: item.value
1634
+ className: "nb-filter-panel__title",
1635
+ children: status.title
1636
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentedControl, {
1637
+ options: status.options,
1638
+ value: status.value,
1639
+ onChange: status.onChange,
1640
+ ariaLabel: status.ariaLabel,
1641
+ size: "sm"
1642
+ })]
1643
+ })]
1644
+ });
1645
+ }
1646
+ //#endregion
1647
+ //#region packages/ui/ScopeTabs.tsx
1648
+ /**
1649
+ * Pill tabs for scoping a list view (warehouse, branch, period, etc.).
1650
+ * Hides itself when there is at most one scope option.
1651
+ */
1652
+ function ScopeTabs({ options, selectedKey, onChange, allLabel = "Todos", ariaLabel, density = "default", className = "", testId }) {
1653
+ if (options.length <= 1) return null;
1654
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1655
+ className: `nb-scope-tabs${density === "compact" ? " nb-scope-tabs--compact" : ""}${className ? ` ${className}` : ""}`,
1656
+ "data-testid": testId,
1657
+ role: "tablist",
1658
+ "aria-label": ariaLabel,
1659
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1660
+ type: "button",
1661
+ role: "tab",
1662
+ "aria-selected": selectedKey === null,
1663
+ className: `nb-scope-tabs__tab${selectedKey === null ? " nb-scope-tabs__tab--active" : ""}`,
1664
+ onClick: () => onChange(null),
1665
+ children: allLabel
1666
+ }), options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1667
+ type: "button",
1668
+ role: "tab",
1669
+ "aria-selected": selectedKey === option.key,
1670
+ className: `nb-scope-tabs__tab${selectedKey === option.key ? " nb-scope-tabs__tab--active" : ""}`,
1671
+ onClick: () => onChange(option.key),
1672
+ children: option.label
1673
+ }, option.key))]
1674
+ });
1675
+ }
1676
+ //#endregion
1677
+ //#region packages/ui/OperationCardGrid.tsx
1678
+ function normalizeIcon(icon) {
1679
+ if (icon.startsWith("ph ")) return icon;
1680
+ if (icon.startsWith("ph-")) return `ph ${icon}`;
1681
+ return `ph ph-${icon}`;
1682
+ }
1683
+ function OperationCardGrid({ title, description, operations, className = "", testId }) {
1684
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1685
+ className: `nb-operation-grid${className ? ` ${className}` : ""}`,
1686
+ "data-testid": testId,
1687
+ children: [(title || description) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
1688
+ className: "nb-operation-grid__header",
1689
+ children: [title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
1690
+ className: "nb-operation-grid__title",
1691
+ children: title
1692
+ }), description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1693
+ className: "nb-operation-grid__intro",
1694
+ children: description
1338
1695
  })]
1339
- }, item.label))
1696
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1697
+ className: "nb-operation-grid__cards",
1698
+ children: operations.map((operation) => {
1699
+ const accent = operation.accent ?? "default";
1700
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1701
+ type: "button",
1702
+ className: `nb-operation-card nb-operation-card--${accent}`,
1703
+ "data-testid": operation.testId,
1704
+ onClick: operation.onClick,
1705
+ children: [
1706
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1707
+ className: `nb-operation-card__icon nb-operation-card__icon--${accent}`,
1708
+ "aria-hidden": "true",
1709
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", { className: normalizeIcon(operation.icon) })
1710
+ }),
1711
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1712
+ className: "nb-operation-card__body",
1713
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1714
+ className: "nb-operation-card__title",
1715
+ children: operation.title
1716
+ }), operation.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1717
+ className: "nb-operation-card__desc",
1718
+ children: operation.description
1719
+ })]
1720
+ }),
1721
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1722
+ className: "nb-operation-card__arrow",
1723
+ "aria-hidden": "true",
1724
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", { className: "ph ph-caret-right" })
1725
+ })
1726
+ ]
1727
+ }, operation.key);
1728
+ })
1729
+ })]
1730
+ });
1731
+ }
1732
+ //#endregion
1733
+ //#region packages/ui/HubPanel.tsx
1734
+ /**
1735
+ * Card shell for feature-hub chrome above a CRUD grid (KPIs, scope tabs, filters).
1736
+ */
1737
+ function HubPanel({ children, variant = "card", className = "", testId }) {
1738
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1739
+ className: `nb-hub-panel${variant === "flush" ? " nb-hub-panel--flush" : ""}${className ? ` ${className}` : ""}`,
1740
+ "data-testid": testId,
1741
+ children
1340
1742
  });
1341
1743
  }
1342
1744
  //#endregion
@@ -2710,10 +3112,16 @@ exports.ES_UI_STRINGS = ES_UI_STRINGS;
2710
3112
  exports.EmptyState = EmptyState;
2711
3113
  exports.FeatureGate = FeatureGate;
2712
3114
  exports.FileDropzone = FileDropzone;
3115
+ exports.FilterPanel = FilterPanel;
2713
3116
  exports.FormField = FormField;
3117
+ exports.HubPanel = HubPanel;
2714
3118
  exports.IconButton = IconButton;
2715
3119
  exports.KpiMetricRow = KpiMetricRow;
3120
+ exports.OperationCardGrid = OperationCardGrid;
2716
3121
  exports.Popover = Popover;
3122
+ exports.ScopeTabs = ScopeTabs;
3123
+ exports.SearchableAppDropdown = SearchableAppDropdown;
3124
+ exports.SegmentedControl = SegmentedControl;
2717
3125
  exports.SelectField = SelectField;
2718
3126
  exports.SettingsPanel = SettingsPanel;
2719
3127
  exports.Skeleton = Skeleton;