@pitchfork-ui/react 0.7.0 → 0.9.0

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 (117) hide show
  1. package/LICENSE +21 -0
  2. package/dist/a11y/index.js +1 -0
  3. package/dist/components/Accordion/Accordion2.js +1 -0
  4. package/dist/components/Alert/Alert2.js +1 -0
  5. package/dist/components/Avatar/Avatar2.js +1 -0
  6. package/dist/components/AvatarGroup/AvatarGroup.css +26 -0
  7. package/dist/components/AvatarGroup/AvatarGroup2.js +38 -0
  8. package/dist/components/Badge/Badge2.js +1 -0
  9. package/dist/components/BadgeGroup/BadgeGroup2.js +1 -0
  10. package/dist/components/Breadcrumbs/Breadcrumbs2.js +1 -0
  11. package/dist/components/Button/Button2.js +1 -0
  12. package/dist/components/ButtonGroup/ButtonGroup2.js +1 -0
  13. package/dist/components/Calendar/Calendar.css +0 -1
  14. package/dist/components/Calendar/Calendar2.js +1 -0
  15. package/dist/components/Card/Card2.js +1 -0
  16. package/dist/components/Carousel/Carousel2.js +1 -0
  17. package/dist/components/Checkbox/Checkbox2.js +1 -0
  18. package/dist/components/CodeSnippet/CodeSnippet2.js +1 -0
  19. package/dist/components/Combobox/Combobox.css +155 -0
  20. package/dist/components/Combobox/Combobox2.js +192 -0
  21. package/dist/components/CommandPalette/CommandPalette.css +225 -0
  22. package/dist/components/CommandPalette/CommandPalette2.js +196 -0
  23. package/dist/components/ContentDivider/ContentDivider2.js +1 -0
  24. package/dist/components/CreditCard/CreditCard2.js +1 -0
  25. package/dist/components/DatePicker/DatePicker2.js +1 -0
  26. package/dist/components/DateRangePicker/DateRangePicker.css +258 -0
  27. package/dist/components/DateRangePicker/DateRangePicker2.js +379 -0
  28. package/dist/components/Dropdown/Dropdown2.js +1 -0
  29. package/dist/components/EmptyState/EmptyState2.js +1 -0
  30. package/dist/components/FileUploader/FileUploader2.js +1 -0
  31. package/dist/components/GaugeChart/GaugeChart2.js +1 -0
  32. package/dist/components/HeaderNavigation/HeaderNavigation2.js +1 -0
  33. package/dist/components/Heatmap/Heatmap2.js +1 -0
  34. package/dist/components/Icon/Icon2.js +44 -0
  35. package/dist/components/InlineCTA/InlineCTA2.js +1 -0
  36. package/dist/components/Input/Input2.js +1 -0
  37. package/dist/components/Kbd/Kbd.css +25 -0
  38. package/dist/components/Kbd/Kbd2.js +18 -0
  39. package/dist/components/LineBarCharts/LineBarChart2.js +1 -0
  40. package/dist/components/LoadingIndicators/LoadingIndicators2.js +1 -0
  41. package/dist/components/Metrics/Metrics2.js +1 -0
  42. package/dist/components/Modal/Modal.css +6 -3
  43. package/dist/components/Modal/Modal2.js +1 -0
  44. package/dist/components/MultiSelect/MultiSelect2.js +1 -0
  45. package/dist/components/Notification/Notification2.js +1 -0
  46. package/dist/components/NumberInput/NumberInput.css +98 -0
  47. package/dist/components/NumberInput/NumberInput2.js +166 -0
  48. package/dist/components/PageHeader/PageHeader2.js +1 -0
  49. package/dist/components/Pagination/Pagination2.js +1 -0
  50. package/dist/components/PieChart/PieChart2.js +1 -0
  51. package/dist/components/Popover/Popover.css +46 -0
  52. package/dist/components/Popover/Popover2.js +77 -0
  53. package/dist/components/ProgressIndicators/ProgressIndicators2.js +1 -0
  54. package/dist/components/ProgressSteps/ProgressSteps2.js +1 -0
  55. package/dist/components/RadarChart/RadarChart2.js +1 -0
  56. package/dist/components/RadioButton/RadioButton2.js +1 -0
  57. package/dist/components/RadioGroup/RadioGroup2.js +1 -0
  58. package/dist/components/Rating/Rating2.js +1 -0
  59. package/dist/components/RichTextEditor/RichTextEditor2.js +1 -0
  60. package/dist/components/SectionFooter/SectionFooter2.js +1 -0
  61. package/dist/components/SectionHeader/SectionHeader2.js +1 -0
  62. package/dist/components/Select/Select2.js +1 -0
  63. package/dist/components/SidebarNavigation/SidebarNavigation2.js +1 -0
  64. package/dist/components/SlideoutMenu/SlideoutMenu2.js +1 -0
  65. package/dist/components/Slider/Slider2.js +1 -0
  66. package/dist/components/Sparkline/Sparkline2.js +1 -0
  67. package/dist/components/Switch/Switch2.js +1 -0
  68. package/dist/components/Table/Table2.js +1 -0
  69. package/dist/components/Tabs/Tabs2.js +1 -0
  70. package/dist/components/Tag/Tag2.js +1 -0
  71. package/dist/components/Textarea/Textarea2.js +1 -0
  72. package/dist/components/Toast/Toast.js +130 -0
  73. package/dist/components/Tooltip/Tooltip2.js +1 -0
  74. package/dist/components/TreeView/TreeView2.js +1 -0
  75. package/dist/components/UtilityButton/UtilityButton2.js +1 -0
  76. package/dist/components/VideoPlayer/VideoPlayer2.js +1 -0
  77. package/dist/hooks/useAnchoredPosition.js +1 -0
  78. package/dist/hooks/useComposedRefs.js +1 -0
  79. package/dist/hooks/useControllableState.js +1 -0
  80. package/dist/hooks/useDisclosure.js +1 -0
  81. package/dist/hooks/useExitAnimation.js +1 -0
  82. package/dist/hooks/useFocusTrap.js +1 -0
  83. package/dist/hooks/useListNavigation.js +1 -0
  84. package/dist/hooks/useOutsideInteraction.js +1 -0
  85. package/dist/hooks/usePresence.js +1 -0
  86. package/dist/index.cjs +1191 -24
  87. package/dist/index.js +10 -1
  88. package/dist/src/components/AvatarGroup/AvatarGroup.d.ts +14 -0
  89. package/dist/src/components/AvatarGroup/AvatarGroup.test.d.ts +1 -0
  90. package/dist/src/components/AvatarGroup/index.d.ts +1 -0
  91. package/dist/src/components/Combobox/Combobox.d.ts +20 -0
  92. package/dist/src/components/Combobox/Combobox.test.d.ts +1 -0
  93. package/dist/src/components/Combobox/index.d.ts +1 -0
  94. package/dist/src/components/CommandPalette/CommandPalette.d.ts +18 -0
  95. package/dist/src/components/CommandPalette/CommandPalette.test.d.ts +1 -0
  96. package/dist/src/components/CommandPalette/index.d.ts +1 -0
  97. package/dist/src/components/DateRangePicker/DateRangePicker.d.ts +21 -0
  98. package/dist/src/components/DateRangePicker/DateRangePicker.test.d.ts +1 -0
  99. package/dist/src/components/DateRangePicker/index.d.ts +1 -0
  100. package/dist/src/components/Kbd/Kbd.d.ts +9 -0
  101. package/dist/src/components/Kbd/Kbd.test.d.ts +1 -0
  102. package/dist/src/components/Kbd/index.d.ts +1 -0
  103. package/dist/src/components/NumberInput/NumberInput.d.ts +19 -0
  104. package/dist/src/components/NumberInput/NumberInput.test.d.ts +1 -0
  105. package/dist/src/components/NumberInput/index.d.ts +1 -0
  106. package/dist/src/components/Popover/Popover.d.ts +21 -0
  107. package/dist/src/components/Popover/Popover.test.d.ts +1 -0
  108. package/dist/src/components/Popover/index.d.ts +1 -0
  109. package/dist/src/components/Toast/Toast.d.ts +35 -0
  110. package/dist/src/components/Toast/Toast.test.d.ts +1 -0
  111. package/dist/src/components/Toast/index.d.ts +1 -0
  112. package/dist/src/index.d.ts +8 -0
  113. package/dist/styles/theme.css +68 -0
  114. package/dist/styles.css +983 -80
  115. package/dist/utils/FieldWrapper.js +1 -0
  116. package/dist/utils/cx.js +1 -0
  117. package/package.json +29 -3
package/dist/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
3
  require('./styles.css');//#region \0rolldown/runtime.js
3
4
  var __create = Object.create;
@@ -434,6 +435,49 @@ var customIcons = {
434
435
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 12v6" }),
435
436
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m15 15-3-3-3 3" })
436
437
  ]
438
+ }),
439
+ plus: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
440
+ width: "1em",
441
+ height: "1em",
442
+ viewBox: "0 0 24 24",
443
+ fill: "none",
444
+ stroke: "currentColor",
445
+ strokeWidth: "2.5",
446
+ strokeLinecap: "round",
447
+ strokeLinejoin: "round",
448
+ focusable: "false",
449
+ "aria-hidden": "true",
450
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 5v14" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 12h14" })]
451
+ }),
452
+ "magnifying-glass": /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
453
+ width: "1em",
454
+ height: "1em",
455
+ viewBox: "0 0 24 24",
456
+ fill: "none",
457
+ stroke: "currentColor",
458
+ strokeWidth: "2",
459
+ strokeLinecap: "round",
460
+ strokeLinejoin: "round",
461
+ focusable: "false",
462
+ "aria-hidden": "true",
463
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
464
+ cx: "11",
465
+ cy: "11",
466
+ r: "8"
467
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m21 21-4.35-4.35" })]
468
+ }),
469
+ minus: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
470
+ width: "1em",
471
+ height: "1em",
472
+ viewBox: "0 0 24 24",
473
+ fill: "none",
474
+ stroke: "currentColor",
475
+ strokeWidth: "2.5",
476
+ strokeLinecap: "round",
477
+ strokeLinejoin: "round",
478
+ focusable: "false",
479
+ "aria-hidden": "true",
480
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 12h14" })
437
481
  })
438
482
  };
439
483
  var regularIcons = {
@@ -676,6 +720,37 @@ var Avatar = (0, react.forwardRef)(({ src, alt, name, size = "md", status, class
676
720
  });
677
721
  Avatar.displayName = "Avatar";
678
722
  //#endregion
723
+ //#region src/components/AvatarGroup/AvatarGroup.tsx
724
+ var AvatarGroup = (0, react.forwardRef)(function AvatarGroup({ className, avatars, max = 5, size = "md", total, label, ...props }, ref) {
725
+ const shown = avatars.slice(0, Math.max(0, max));
726
+ const overflow = (total ?? avatars.length) - shown.length;
727
+ const count = total ?? avatars.length;
728
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
729
+ ref,
730
+ className: cx("pf-avatar-group", `pf-avatar-group--${size}`, className),
731
+ role: "group",
732
+ "aria-label": label ?? `${count} ${count === 1 ? "person" : "people"}`,
733
+ ...props,
734
+ children: [shown.map((avatar, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Avatar, {
735
+ size,
736
+ className: "pf-avatar-group__item",
737
+ style: { zIndex: shown.length - index },
738
+ ...avatar
739
+ }, index)), overflow > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
740
+ className: cx("pf-avatar", `pf-avatar--${size}`, "pf-avatar-group__item", "pf-avatar-group__overflow"),
741
+ role: "img",
742
+ "aria-label": `${overflow} more`,
743
+ style: { zIndex: 0 },
744
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
745
+ className: "pf-avatar__fallback",
746
+ "aria-hidden": true,
747
+ children: ["+", overflow]
748
+ })
749
+ }) : null]
750
+ });
751
+ });
752
+ AvatarGroup.displayName = "AvatarGroup";
753
+ //#endregion
679
754
  //#region src/components/Button/Button.tsx
680
755
  var Spinner = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
681
756
  className: "pf-button__spinner",
@@ -709,6 +784,190 @@ var Button = (0, react.forwardRef)(({ className, variant = "primary", size = "md
709
784
  });
710
785
  Button.displayName = "Button";
711
786
  //#endregion
787
+ //#region src/components/CommandPalette/CommandPalette.tsx
788
+ function CommandPalette({ open, onOpenChange, items, placeholder = "Search commands…", emptyMessage = "No results found." }) {
789
+ const inputId = (0, react.useId)();
790
+ const listId = (0, react.useId)();
791
+ const [query, setQuery] = (0, react.useState)("");
792
+ const dialogRef = (0, react.useRef)(null);
793
+ const inputRef = (0, react.useRef)(null);
794
+ const { isMounted, isExiting } = usePresence(open, 180);
795
+ (0, react.useEffect)(() => {
796
+ if (!open) return;
797
+ const frame = requestAnimationFrame(() => {
798
+ setQuery("");
799
+ inputRef.current?.focus();
800
+ });
801
+ return () => cancelAnimationFrame(frame);
802
+ }, [open]);
803
+ (0, react.useEffect)(() => {
804
+ if (!isMounted || typeof document === "undefined") return;
805
+ const prev = document.body.style.overflow;
806
+ document.body.style.overflow = "hidden";
807
+ return () => {
808
+ document.body.style.overflow = prev;
809
+ };
810
+ }, [isMounted]);
811
+ useFocusTrap({
812
+ containerRef: dialogRef,
813
+ enabled: open,
814
+ onEscape: () => onOpenChange(false)
815
+ });
816
+ const filtered = (0, react.useMemo)(() => {
817
+ const q = query.trim().toLowerCase();
818
+ if (!q) return items;
819
+ return items.filter((item) => item.label.toLowerCase().includes(q) || item.description?.toLowerCase().includes(q) || item.group?.toLowerCase().includes(q));
820
+ }, [items, query]);
821
+ const { activeIndex, move, setActiveIndex } = useListNavigation({
822
+ items: filtered,
823
+ isDisabled: (item) => !!item.disabled
824
+ });
825
+ (0, react.useEffect)(() => {
826
+ setActiveIndex(0);
827
+ }, [query, setActiveIndex]);
828
+ const selectActive = () => {
829
+ const item = filtered[activeIndex];
830
+ if (item && !item.disabled) {
831
+ item.onSelect();
832
+ onOpenChange(false);
833
+ }
834
+ };
835
+ const onKeyDown = (e) => {
836
+ if (e.key === Keys.ArrowDown) {
837
+ e.preventDefault();
838
+ move("next");
839
+ } else if (e.key === Keys.ArrowUp) {
840
+ e.preventDefault();
841
+ move("previous");
842
+ } else if (e.key === Keys.Home) {
843
+ e.preventDefault();
844
+ move("first");
845
+ } else if (e.key === Keys.End) {
846
+ e.preventDefault();
847
+ move("last");
848
+ } else if (e.key === Keys.Enter) {
849
+ e.preventDefault();
850
+ selectActive();
851
+ }
852
+ };
853
+ const groupedItems = (0, react.useMemo)(() => {
854
+ const groups = [];
855
+ const seen = /* @__PURE__ */ new Map();
856
+ filtered.forEach((item, index) => {
857
+ const g = item.group;
858
+ if (!seen.has(g)) {
859
+ seen.set(g, groups.length);
860
+ groups.push({
861
+ group: g,
862
+ items: []
863
+ });
864
+ }
865
+ groups[seen.get(g)].items.push({
866
+ item,
867
+ index
868
+ });
869
+ });
870
+ return groups;
871
+ }, [filtered]);
872
+ const activeOptionId = filtered[activeIndex] ? `${listId}-option-${activeIndex}` : void 0;
873
+ if (!isMounted || typeof document === "undefined") return null;
874
+ return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
875
+ className: cx("pf-command__backdrop", isExiting && "pf-command__backdrop--exiting"),
876
+ onClick: () => onOpenChange(false),
877
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
878
+ ref: dialogRef,
879
+ className: cx("pf-command", isExiting && "pf-command--exiting"),
880
+ role: "dialog",
881
+ "aria-modal": "true",
882
+ "aria-label": "Command palette",
883
+ tabIndex: -1,
884
+ onClick: (e) => e.stopPropagation(),
885
+ onKeyDown,
886
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
887
+ className: "pf-command__search",
888
+ children: [
889
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
890
+ name: "magnifying-glass",
891
+ "aria-hidden": true,
892
+ className: "pf-command__search-icon"
893
+ }),
894
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
895
+ ref: inputRef,
896
+ id: inputId,
897
+ type: "text",
898
+ className: "pf-command__input",
899
+ value: query,
900
+ placeholder,
901
+ autoComplete: "off",
902
+ spellCheck: false,
903
+ role: "combobox",
904
+ "aria-autocomplete": "list",
905
+ "aria-expanded": true,
906
+ "aria-controls": listId,
907
+ "aria-activedescendant": activeOptionId,
908
+ onChange: (e) => setQuery(e.target.value)
909
+ }),
910
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("kbd", {
911
+ className: "pf-command__esc-hint",
912
+ "aria-hidden": true,
913
+ children: "esc"
914
+ })
915
+ ]
916
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
917
+ id: listId,
918
+ role: "listbox",
919
+ "aria-label": "Commands",
920
+ className: "pf-command__list",
921
+ children: filtered.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
922
+ className: "pf-command__empty",
923
+ role: "presentation",
924
+ children: emptyMessage
925
+ }) : groupedItems.map(({ group, items: groupItems }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
926
+ role: "presentation",
927
+ children: [group ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
928
+ className: "pf-command__group-label",
929
+ role: "presentation",
930
+ children: group
931
+ }) : null, groupItems.map(({ item, index }) => {
932
+ const isActive = index === activeIndex;
933
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
934
+ id: `${listId}-option-${index}`,
935
+ role: "option",
936
+ "aria-selected": isActive,
937
+ "aria-disabled": item.disabled ? true : void 0,
938
+ className: cx("pf-command__item", isActive && "pf-command__item--active", item.disabled && "pf-command__item--disabled"),
939
+ onMouseEnter: () => {
940
+ if (!item.disabled) setActiveIndex(index);
941
+ },
942
+ onMouseDown: (e) => e.preventDefault(),
943
+ onClick: () => {
944
+ if (!item.disabled) {
945
+ item.onSelect();
946
+ onOpenChange(false);
947
+ }
948
+ },
949
+ children: [item.icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
950
+ className: "pf-command__item-icon",
951
+ "aria-hidden": true,
952
+ children: item.icon
953
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
954
+ className: "pf-command__item-content",
955
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
956
+ className: "pf-command__item-label",
957
+ children: item.label
958
+ }), item.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
959
+ className: "pf-command__item-description",
960
+ children: item.description
961
+ }) : null]
962
+ })]
963
+ }, item.id);
964
+ })]
965
+ }, group ?? "__ungrouped"))
966
+ })]
967
+ })
968
+ }), document.body);
969
+ }
970
+ //#endregion
712
971
  //#region src/components/BadgeGroup/BadgeGroup.tsx
713
972
  var BadgeGroup = (0, react.forwardRef)(({ label, message, color = "gray", appearance = "pill", badgePosition = "leading", className, ...props }, ref) => {
714
973
  const badge = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -1145,7 +1404,7 @@ var Dropdown = (0, react.forwardRef)(({ label = "Actions", items, align = "start
1145
1404
  Dropdown.displayName = "Dropdown";
1146
1405
  //#endregion
1147
1406
  //#region src/components/Calendar/Calendar.tsx
1148
- var WEEKDAY_LABELS = [
1407
+ var WEEKDAY_LABELS$1 = [
1149
1408
  "Su",
1150
1409
  "Mo",
1151
1410
  "Tu",
@@ -1161,22 +1420,22 @@ var MONTH_OPTIONS = Array.from({ length: 12 }, (_, month) => {
1161
1420
  label: new Intl.DateTimeFormat("en-US", { month: "long" }).format(date)
1162
1421
  };
1163
1422
  });
1164
- var toMidday$1 = (date) => {
1423
+ var toMidday$2 = (date) => {
1165
1424
  const next = new Date(date);
1166
1425
  next.setHours(12, 0, 0, 0);
1167
1426
  return next;
1168
1427
  };
1169
- var isSameDay = (a, b) => {
1428
+ var isSameDay$1 = (a, b) => {
1170
1429
  return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
1171
1430
  };
1172
- var startOfMonth = (date) => {
1431
+ var startOfMonth$1 = (date) => {
1173
1432
  return new Date(date.getFullYear(), date.getMonth(), 1, 12);
1174
1433
  };
1175
- var addMonths = (date, amount) => {
1434
+ var addMonths$1 = (date, amount) => {
1176
1435
  return new Date(date.getFullYear(), date.getMonth() + amount, 1, 12);
1177
1436
  };
1178
1437
  var buildCalendarDays = (monthDate) => {
1179
- const monthStart = startOfMonth(monthDate);
1438
+ const monthStart = startOfMonth$1(monthDate);
1180
1439
  const firstWeekday = monthStart.getDay();
1181
1440
  const gridStart = new Date(monthStart.getFullYear(), monthStart.getMonth(), monthStart.getDate() - firstWeekday, 12);
1182
1441
  return Array.from({ length: 42 }, (_, index) => {
@@ -1198,7 +1457,7 @@ var Calendar = (0, react.forwardRef)(function Calendar({ className, value, defau
1198
1457
  errorId
1199
1458
  ].filter(Boolean).join(" ") || void 0;
1200
1459
  const isControlled = value !== void 0;
1201
- const [internalValue, setInternalValue] = (0, react.useState)(defaultValue ? toMidday$1(defaultValue) : autoSelectToday ? toMidday$1(/* @__PURE__ */ new Date()) : void 0);
1460
+ const [internalValue, setInternalValue] = (0, react.useState)(defaultValue ? toMidday$2(defaultValue) : autoSelectToday ? toMidday$2(/* @__PURE__ */ new Date()) : void 0);
1202
1461
  const selectedDate = isControlled ? value : internalValue;
1203
1462
  const yearRange = (0, react.useMemo)(() => {
1204
1463
  const fallbackStart = (/* @__PURE__ */ new Date()).getFullYear() - 50;
@@ -1217,11 +1476,11 @@ var Calendar = (0, react.forwardRef)(function Calendar({ className, value, defau
1217
1476
  return date;
1218
1477
  };
1219
1478
  const [displayMonth, setDisplayMonth] = (0, react.useState)(() => {
1220
- return clampToYearRange(startOfMonth(selectedDate ?? /* @__PURE__ */ new Date()));
1479
+ return clampToYearRange(startOfMonth$1(selectedDate ?? /* @__PURE__ */ new Date()));
1221
1480
  });
1222
1481
  (0, react.useEffect)(() => {
1223
1482
  if (!selectedDate) return;
1224
- setDisplayMonth(clampToYearRange(startOfMonth(selectedDate)));
1483
+ setDisplayMonth(clampToYearRange(startOfMonth$1(selectedDate)));
1225
1484
  }, [
1226
1485
  selectedDate,
1227
1486
  yearRange.end,
@@ -1242,12 +1501,12 @@ var Calendar = (0, react.forwardRef)(function Calendar({ className, value, defau
1242
1501
  const dayItems = (0, react.useMemo)(() => {
1243
1502
  return buildCalendarDays(displayMonth);
1244
1503
  }, [displayMonth]);
1245
- const today = (0, react.useMemo)(() => toMidday$1(/* @__PURE__ */ new Date()), []);
1504
+ const today = (0, react.useMemo)(() => toMidday$2(/* @__PURE__ */ new Date()), []);
1246
1505
  const selectDate = (nextDate) => {
1247
1506
  if (disabledDates?.(nextDate)) return;
1248
1507
  if (!isControlled) setInternalValue(nextDate);
1249
1508
  onValueChange?.(nextDate);
1250
- setDisplayMonth(clampToYearRange(startOfMonth(nextDate)));
1509
+ setDisplayMonth(clampToYearRange(startOfMonth$1(nextDate)));
1251
1510
  };
1252
1511
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1253
1512
  className: "pf-field",
@@ -1273,7 +1532,7 @@ var Calendar = (0, react.forwardRef)(function Calendar({ className, value, defau
1273
1532
  "aria-label": "Previous month",
1274
1533
  disabled: isPrevMonthDisabled,
1275
1534
  onClick: () => {
1276
- setDisplayMonth((current) => clampToYearRange(addMonths(current, -1)));
1535
+ setDisplayMonth((current) => clampToYearRange(addMonths$1(current, -1)));
1277
1536
  },
1278
1537
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
1279
1538
  name: "square-caret-left",
@@ -1324,7 +1583,7 @@ var Calendar = (0, react.forwardRef)(function Calendar({ className, value, defau
1324
1583
  "aria-label": "Next month",
1325
1584
  disabled: isNextMonthDisabled,
1326
1585
  onClick: () => {
1327
- setDisplayMonth((current) => clampToYearRange(addMonths(current, 1)));
1586
+ setDisplayMonth((current) => clampToYearRange(addMonths$1(current, 1)));
1328
1587
  },
1329
1588
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
1330
1589
  name: "square-caret-right",
@@ -1340,7 +1599,7 @@ var Calendar = (0, react.forwardRef)(function Calendar({ className, value, defau
1340
1599
  role: "row",
1341
1600
  style: { display: "contents" },
1342
1601
  "aria-hidden": true,
1343
- children: WEEKDAY_LABELS.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1602
+ children: WEEKDAY_LABELS$1.map((day) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1344
1603
  role: "columnheader",
1345
1604
  className: "pf-calendar__weekday",
1346
1605
  children: day
@@ -1349,8 +1608,8 @@ var Calendar = (0, react.forwardRef)(function Calendar({ className, value, defau
1349
1608
  role: "row",
1350
1609
  style: { display: "contents" },
1351
1610
  children: dayItems.slice(week * 7, (week + 1) * 7).map(({ date, inCurrentMonth }) => {
1352
- const isSelected = selectedDate ? isSameDay(selectedDate, date) : false;
1353
- const isToday = isSameDay(today, date);
1611
+ const isSelected = selectedDate ? isSameDay$1(selectedDate, date) : false;
1612
+ const isToday = isSameDay$1(today, date);
1354
1613
  const isDisabled = Boolean(disabledDates?.(date));
1355
1614
  if (!showOutsideDays && !inCurrentMonth) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1356
1615
  className: "pf-calendar__day-empty",
@@ -1393,16 +1652,16 @@ var Calendar = (0, react.forwardRef)(function Calendar({ className, value, defau
1393
1652
  Calendar.displayName = "Calendar";
1394
1653
  //#endregion
1395
1654
  //#region src/components/Carousel/Carousel.tsx
1396
- var clamp$2 = (value, min, max) => {
1655
+ var clamp$3 = (value, min, max) => {
1397
1656
  return Math.min(Math.max(value, min), max);
1398
1657
  };
1399
1658
  var Carousel = (0, react.forwardRef)(function Carousel({ className, slides, initialIndex = 0, loop = true, showIndicators = true, autoPlay = false, autoPlayInterval = 5e3, onIndexChange, "aria-label": ariaLabel = "Carousel", ...props }, ref) {
1400
1659
  const totalSlides = slides.length;
1401
- const [activeIndex, setActiveIndex] = (0, react.useState)(clamp$2(initialIndex, 0, Math.max(totalSlides - 1, 0)));
1402
- const resolvedActiveIndex = clamp$2(activeIndex, 0, Math.max(totalSlides - 1, 0));
1660
+ const [activeIndex, setActiveIndex] = (0, react.useState)(clamp$3(initialIndex, 0, Math.max(totalSlides - 1, 0)));
1661
+ const resolvedActiveIndex = clamp$3(activeIndex, 0, Math.max(totalSlides - 1, 0));
1403
1662
  const goToIndex = (nextIndex) => {
1404
1663
  if (totalSlides === 0) return;
1405
- const resolvedIndex = loop ? (nextIndex % totalSlides + totalSlides) % totalSlides : clamp$2(nextIndex, 0, totalSlides - 1);
1664
+ const resolvedIndex = loop ? (nextIndex % totalSlides + totalSlides) % totalSlides : clamp$3(nextIndex, 0, totalSlides - 1);
1406
1665
  setActiveIndex(resolvedIndex);
1407
1666
  onIndexChange?.(resolvedIndex);
1408
1667
  };
@@ -1649,6 +1908,183 @@ var CodeSnippet = (0, react.forwardRef)(function CodeSnippet({ className, code,
1649
1908
  });
1650
1909
  CodeSnippet.displayName = "CodeSnippet";
1651
1910
  //#endregion
1911
+ //#region src/components/Combobox/Combobox.tsx
1912
+ var Combobox = (0, react.forwardRef)(function Combobox({ id, options, value, defaultValue, onValueChange, label, description, error, placeholder = "Search…", emptyMessage = "No matches", name, required, className, disabled, "aria-describedby": ariaDescribedBy, ...props }, ref) {
1913
+ const generatedId = (0, react.useId)();
1914
+ const fieldId = id ?? generatedId;
1915
+ const listboxId = `${fieldId}-listbox`;
1916
+ const descriptionId = description ? `${fieldId}-description` : void 0;
1917
+ const errorId = error ? `${fieldId}-error` : void 0;
1918
+ const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId);
1919
+ const [selectedValue, setSelectedValue] = useControllableState({
1920
+ value,
1921
+ defaultValue: defaultValue ?? "",
1922
+ onChange: onValueChange
1923
+ });
1924
+ const selectedOption = options.find((option) => option.value === selectedValue);
1925
+ const [query, setQuery] = (0, react.useState)(() => selectedOption?.label ?? "");
1926
+ const [isOpen, setIsOpen] = (0, react.useState)(false);
1927
+ const [activeIndex, setActiveIndex] = (0, react.useState)(0);
1928
+ const rootRef = (0, react.useRef)(null);
1929
+ const inputRef = (0, react.useRef)(null);
1930
+ const listboxRef = (0, react.useRef)(null);
1931
+ const inputRefs = useComposedRefs(inputRef, ref);
1932
+ const { isMounted, isExiting } = usePresence(isOpen, 160);
1933
+ const menuStyle = useAnchoredPosition({
1934
+ anchorRef: rootRef,
1935
+ floatingRef: listboxRef,
1936
+ enabled: isOpen,
1937
+ matchAnchorWidth: true,
1938
+ flip: true
1939
+ });
1940
+ const filtered = (0, react.useMemo)(() => {
1941
+ const q = query.trim().toLowerCase();
1942
+ const fromSelection = selectedOption && query === selectedOption.label;
1943
+ if (!q || fromSelection) return options;
1944
+ return options.filter((option) => option.label.toLowerCase().includes(q));
1945
+ }, [
1946
+ options,
1947
+ query,
1948
+ selectedOption
1949
+ ]);
1950
+ useOutsideInteraction({
1951
+ refs: [rootRef, listboxRef],
1952
+ enabled: isOpen,
1953
+ onInteractOutside: () => closeAndRevert()
1954
+ });
1955
+ const open = () => {
1956
+ if (disabled) return;
1957
+ setIsOpen(true);
1958
+ setActiveIndex(0);
1959
+ };
1960
+ const closeAndRevert = () => {
1961
+ setIsOpen(false);
1962
+ setQuery(selectedOption?.label ?? "");
1963
+ };
1964
+ const selectOption = (option) => {
1965
+ if (option.disabled) return;
1966
+ setSelectedValue(option.value);
1967
+ setQuery(option.label);
1968
+ setIsOpen(false);
1969
+ };
1970
+ const onKeyDown = (event) => {
1971
+ if (disabled) return;
1972
+ if (event.key === Keys.ArrowDown) {
1973
+ event.preventDefault();
1974
+ if (!isOpen) {
1975
+ open();
1976
+ return;
1977
+ }
1978
+ setActiveIndex((index) => Math.min(index + 1, filtered.length - 1));
1979
+ return;
1980
+ }
1981
+ if (event.key === Keys.ArrowUp) {
1982
+ event.preventDefault();
1983
+ if (isOpen) setActiveIndex((index) => Math.max(index - 1, 0));
1984
+ return;
1985
+ }
1986
+ if (event.key === Keys.Enter) {
1987
+ if (isOpen && filtered[activeIndex]) {
1988
+ event.preventDefault();
1989
+ selectOption(filtered[activeIndex]);
1990
+ }
1991
+ return;
1992
+ }
1993
+ if (event.key === Keys.Escape) {
1994
+ if (isOpen) {
1995
+ event.preventDefault();
1996
+ closeAndRevert();
1997
+ }
1998
+ }
1999
+ };
2000
+ const activeOptionId = isOpen && filtered[activeIndex] ? `${listboxId}-option-${activeIndex}` : void 0;
2001
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
2002
+ labelFor: fieldId,
2003
+ label,
2004
+ description,
2005
+ descriptionId,
2006
+ error,
2007
+ errorId,
2008
+ required,
2009
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2010
+ className: "pf-combobox",
2011
+ ref: rootRef,
2012
+ children: [
2013
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2014
+ className: cx("pf-combobox__control", error && "pf-combobox__control--invalid"),
2015
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2016
+ ...props,
2017
+ id: fieldId,
2018
+ ref: inputRefs,
2019
+ type: "text",
2020
+ role: "combobox",
2021
+ className: cx("pf-combobox__input", className),
2022
+ value: query,
2023
+ placeholder,
2024
+ disabled,
2025
+ required,
2026
+ autoComplete: "off",
2027
+ "aria-autocomplete": "list",
2028
+ "aria-expanded": isOpen,
2029
+ "aria-controls": listboxId,
2030
+ "aria-activedescendant": activeOptionId,
2031
+ "aria-describedby": describedBy,
2032
+ onChange: (event) => {
2033
+ setQuery(event.target.value);
2034
+ setActiveIndex(0);
2035
+ if (!isOpen) setIsOpen(true);
2036
+ },
2037
+ onClick: open,
2038
+ onKeyDown
2039
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2040
+ "aria-hidden": true,
2041
+ className: cx("pf-combobox__icon", isOpen && "pf-combobox__icon--open"),
2042
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
2043
+ name: "chevron-down",
2044
+ "aria-hidden": true
2045
+ })
2046
+ })]
2047
+ }),
2048
+ name ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2049
+ type: "hidden",
2050
+ name,
2051
+ value: selectedValue
2052
+ }) : null,
2053
+ isMounted && typeof document !== "undefined" ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
2054
+ id: listboxId,
2055
+ ref: listboxRef,
2056
+ role: "listbox",
2057
+ className: cx("pf-combobox__menu", isExiting && "pf-combobox__menu--exiting"),
2058
+ style: menuStyle,
2059
+ "aria-label": label,
2060
+ children: filtered.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
2061
+ className: "pf-combobox__empty",
2062
+ role: "presentation",
2063
+ children: emptyMessage
2064
+ }) : filtered.map((option, index) => {
2065
+ const isSelected = option.value === selectedValue;
2066
+ const isActive = index === activeIndex;
2067
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
2068
+ id: `${listboxId}-option-${index}`,
2069
+ role: "option",
2070
+ "aria-selected": isSelected,
2071
+ "aria-disabled": option.disabled ? true : void 0,
2072
+ className: cx("pf-combobox__option", isSelected && "pf-combobox__option--selected", isActive && "pf-combobox__option--active", option.disabled && "pf-combobox__option--disabled"),
2073
+ onMouseEnter: () => {
2074
+ if (!option.disabled) setActiveIndex(index);
2075
+ },
2076
+ onMouseDown: (event) => event.preventDefault(),
2077
+ onClick: () => selectOption(option),
2078
+ children: option.label
2079
+ }, option.value);
2080
+ })
2081
+ }), document.body) : null
2082
+ ]
2083
+ })
2084
+ });
2085
+ });
2086
+ Combobox.displayName = "Combobox";
2087
+ //#endregion
1652
2088
  //#region src/components/ContentDivider/ContentDivider.tsx
1653
2089
  var ContentDivider = (0, react.forwardRef)(({ className, label, orientation = "horizontal", inset = false, ...props }, ref) => {
1654
2090
  if (orientation === "vertical") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -1686,7 +2122,7 @@ var ContentDivider = (0, react.forwardRef)(({ className, label, orientation = "h
1686
2122
  ContentDivider.displayName = "ContentDivider";
1687
2123
  //#endregion
1688
2124
  //#region src/components/DatePicker/DatePicker.tsx
1689
- var toMidday = (date) => {
2125
+ var toMidday$1 = (date) => {
1690
2126
  const next = new Date(date);
1691
2127
  next.setHours(12, 0, 0, 0);
1692
2128
  return next;
@@ -1698,8 +2134,8 @@ var DatePicker = (0, react.forwardRef)(function DatePicker({ id, className, valu
1698
2134
  const errorId = error ? `${pickerId}-error` : void 0;
1699
2135
  const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId);
1700
2136
  const isControlled = value !== void 0;
1701
- const [internalValue, setInternalValue] = (0, react.useState)(defaultValue ? toMidday(defaultValue) : void 0);
1702
- const selectedDate = isControlled ? value ? toMidday(value) : void 0 : internalValue;
2137
+ const [internalValue, setInternalValue] = (0, react.useState)(defaultValue ? toMidday$1(defaultValue) : void 0);
2138
+ const selectedDate = isControlled ? value ? toMidday$1(value) : void 0 : internalValue;
1703
2139
  const disclosure = useDisclosure({ disabled });
1704
2140
  const { isOpen } = disclosure;
1705
2141
  const rootRef = (0, react.useRef)(null);
@@ -1727,7 +2163,7 @@ var DatePicker = (0, react.forwardRef)(function DatePicker({ id, className, valu
1727
2163
  }).format(selectedDate);
1728
2164
  }, [selectedDate]);
1729
2165
  const selectDate = (nextDate) => {
1730
- const normalized = toMidday(nextDate);
2166
+ const normalized = toMidday$1(nextDate);
1731
2167
  if (!isControlled) setInternalValue(normalized);
1732
2168
  onValueChange?.(normalized);
1733
2169
  disclosure.close();
@@ -1807,6 +2243,372 @@ var DatePicker = (0, react.forwardRef)(function DatePicker({ id, className, valu
1807
2243
  });
1808
2244
  DatePicker.displayName = "DatePicker";
1809
2245
  //#endregion
2246
+ //#region src/components/DateRangePicker/DateRangePicker.tsx
2247
+ var WEEKDAY_LABELS = [
2248
+ "Su",
2249
+ "Mo",
2250
+ "Tu",
2251
+ "We",
2252
+ "Th",
2253
+ "Fr",
2254
+ "Sa"
2255
+ ];
2256
+ var toMidday = (d) => {
2257
+ const n = new Date(d);
2258
+ n.setHours(12, 0, 0, 0);
2259
+ return n;
2260
+ };
2261
+ var isSameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
2262
+ var startOfMonth = (d) => new Date(d.getFullYear(), d.getMonth(), 1, 12);
2263
+ var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1, 12);
2264
+ var buildDays = (monthDate) => {
2265
+ const ms = startOfMonth(monthDate);
2266
+ const firstDay = ms.getDay();
2267
+ return Array.from({ length: 42 }, (_, i) => {
2268
+ const date = new Date(ms.getFullYear(), ms.getMonth(), ms.getDate() - firstDay + i, 12);
2269
+ return {
2270
+ date,
2271
+ inCurrentMonth: date.getMonth() === monthDate.getMonth()
2272
+ };
2273
+ });
2274
+ };
2275
+ var formatDate = (d) => {
2276
+ if (!d) return "";
2277
+ return new Intl.DateTimeFormat("en-US", {
2278
+ month: "short",
2279
+ day: "numeric",
2280
+ year: "numeric"
2281
+ }).format(d);
2282
+ };
2283
+ function RangeCalendar({ monthDate, rangeStart, rangeEnd, hoverDate, onDayClick, onDayHover, disabledDates, showOutsideDays = true, isPrevDisabled, isNextDisabled, onPrev, onNext, hideNavDesktop = false }) {
2284
+ const days = (0, react.useMemo)(() => buildDays(monthDate), [monthDate]);
2285
+ const today = (0, react.useMemo)(() => toMidday(/* @__PURE__ */ new Date()), []);
2286
+ const monthLabel = new Intl.DateTimeFormat("en-US", {
2287
+ month: "long",
2288
+ year: "numeric"
2289
+ }).format(monthDate);
2290
+ const effectiveEnd = rangeEnd ?? hoverDate;
2291
+ const isInRange = (0, react.useCallback)((date) => {
2292
+ if (!rangeStart || !effectiveEnd) return false;
2293
+ return date > (rangeStart <= effectiveEnd ? rangeStart : effectiveEnd) && date < (rangeStart <= effectiveEnd ? effectiveEnd : rangeStart);
2294
+ }, [rangeStart, effectiveEnd]);
2295
+ const isRangeStart = (date) => !!rangeStart && isSameDay(date, rangeStart);
2296
+ const isRangeEnd = (date) => {
2297
+ const end = rangeEnd ?? (hoverDate && rangeStart ? hoverDate : null);
2298
+ return !!end && isSameDay(date, end);
2299
+ };
2300
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2301
+ className: "pf-daterange__calendar",
2302
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2303
+ className: cx("pf-daterange__cal-header", hideNavDesktop && "pf-daterange__cal-header--hide-nav-desktop"),
2304
+ children: [
2305
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2306
+ type: "button",
2307
+ className: "pf-daterange__nav",
2308
+ "aria-label": "Previous month",
2309
+ disabled: isPrevDisabled,
2310
+ onClick: onPrev,
2311
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
2312
+ name: "chevron-left",
2313
+ "aria-hidden": true
2314
+ })
2315
+ }),
2316
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2317
+ className: "pf-daterange__cal-title",
2318
+ children: monthLabel
2319
+ }),
2320
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2321
+ type: "button",
2322
+ className: "pf-daterange__nav",
2323
+ "aria-label": "Next month",
2324
+ disabled: isNextDisabled,
2325
+ onClick: onNext,
2326
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
2327
+ name: "chevron-right",
2328
+ "aria-hidden": true
2329
+ })
2330
+ })
2331
+ ]
2332
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2333
+ className: "pf-daterange__grid",
2334
+ role: "grid",
2335
+ "aria-label": monthLabel,
2336
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2337
+ role: "row",
2338
+ style: { display: "contents" },
2339
+ "aria-hidden": true,
2340
+ children: WEEKDAY_LABELS.map((d) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2341
+ role: "columnheader",
2342
+ className: "pf-daterange__weekday",
2343
+ children: d
2344
+ }, d))
2345
+ }), Array.from({ length: 6 }, (_, week) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2346
+ role: "row",
2347
+ style: { display: "contents" },
2348
+ children: days.slice(week * 7, (week + 1) * 7).map(({ date, inCurrentMonth }) => {
2349
+ const isToday = isSameDay(today, date);
2350
+ const isStart = isRangeStart(date);
2351
+ const isEnd = isRangeEnd(date);
2352
+ const inRng = isInRange(date);
2353
+ const isDisabled = Boolean(disabledDates?.(date));
2354
+ if (!showOutsideDays && !inCurrentMonth) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2355
+ className: "pf-daterange__day-empty",
2356
+ "aria-hidden": true
2357
+ }, date.toISOString());
2358
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2359
+ type: "button",
2360
+ role: "gridcell",
2361
+ className: cx("pf-daterange__day", !inCurrentMonth && "pf-daterange__day--outside", isToday && "pf-daterange__day--today", (isStart || isEnd) && "pf-daterange__day--selected", isStart && "pf-daterange__day--range-start", isEnd && "pf-daterange__day--range-end", inRng && "pf-daterange__day--in-range"),
2362
+ "aria-label": new Intl.DateTimeFormat("en-US", {
2363
+ month: "long",
2364
+ day: "numeric",
2365
+ year: "numeric"
2366
+ }).format(date),
2367
+ "aria-selected": isStart || isEnd || inRng,
2368
+ "aria-current": isToday ? "date" : void 0,
2369
+ disabled: isDisabled,
2370
+ onClick: () => onDayClick(date),
2371
+ onMouseEnter: () => onDayHover(date),
2372
+ onMouseLeave: () => onDayHover(null),
2373
+ children: date.getDate()
2374
+ }, date.toISOString());
2375
+ })
2376
+ }, week))]
2377
+ })]
2378
+ });
2379
+ }
2380
+ var DateRangePicker = (0, react.forwardRef)(function DateRangePicker({ id, className, value, defaultValue, onValueChange, label, description, error, startPlaceholder = "Start date", endPlaceholder = "End date", required, disabled, disabledDates, showOutsideDays = true, startYear, endYear, "aria-describedby": ariaDescribedBy, ...props }, ref) {
2381
+ const generatedId = (0, react.useId)();
2382
+ const pickerId = id ?? generatedId;
2383
+ const descriptionId = description ? `${pickerId}-description` : void 0;
2384
+ const errorId = error ? `${pickerId}-error` : void 0;
2385
+ const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId);
2386
+ const isControlled = value !== void 0;
2387
+ const [internalRange, setInternalRange] = (0, react.useState)(defaultValue ?? {
2388
+ start: null,
2389
+ end: null
2390
+ });
2391
+ const range = isControlled ? value : internalRange;
2392
+ const setRange = (next) => {
2393
+ if (!isControlled) setInternalRange(next);
2394
+ onValueChange?.(next);
2395
+ };
2396
+ const [selecting, setSelecting] = (0, react.useState)(null);
2397
+ const [hoverDate, setHoverDate] = (0, react.useState)(null);
2398
+ const yearRange = (0, react.useMemo)(() => {
2399
+ const fallbackStart = (/* @__PURE__ */ new Date()).getFullYear() - 50;
2400
+ const fallbackEnd = (/* @__PURE__ */ new Date()).getFullYear() + 50;
2401
+ return {
2402
+ start: startYear ?? fallbackStart,
2403
+ end: endYear ?? fallbackEnd
2404
+ };
2405
+ }, [startYear, endYear]);
2406
+ const clampMonth = (d) => {
2407
+ const y = d.getFullYear();
2408
+ if (y < yearRange.start) return new Date(yearRange.start, 0, 1, 12);
2409
+ if (y > yearRange.end) return new Date(yearRange.end, 11, 1, 12);
2410
+ return d;
2411
+ };
2412
+ const [leftMonth, setLeftMonth] = (0, react.useState)(() => clampMonth(startOfMonth(range.start ?? /* @__PURE__ */ new Date())));
2413
+ const rightMonth = addMonths(leftMonth, 1);
2414
+ const disclosure = useDisclosure({ disabled });
2415
+ const { isOpen } = disclosure;
2416
+ const rootRef = (0, react.useRef)(null);
2417
+ const triggerRef = (0, react.useRef)(null);
2418
+ const popoverRef = (0, react.useRef)(null);
2419
+ const popoverStyle = useAnchoredPosition({
2420
+ anchorRef: rootRef,
2421
+ floatingRef: popoverRef,
2422
+ enabled: isOpen,
2423
+ flip: true,
2424
+ matchAnchorWidth: false
2425
+ });
2426
+ useOutsideInteraction({
2427
+ refs: [rootRef, popoverRef],
2428
+ enabled: isOpen,
2429
+ eventName: "mousedown",
2430
+ onInteractOutside: () => {
2431
+ setSelecting(null);
2432
+ setHoverDate(null);
2433
+ disclosure.close();
2434
+ }
2435
+ });
2436
+ const handleDayClick = (date) => {
2437
+ if (selecting === null) {
2438
+ setRange({
2439
+ start: toMidday(date),
2440
+ end: null
2441
+ });
2442
+ setSelecting("start");
2443
+ } else {
2444
+ const start = range.start;
2445
+ const end = toMidday(date);
2446
+ if (isSameDay(start, end)) setRange({
2447
+ start: toMidday(date),
2448
+ end: null
2449
+ });
2450
+ else if (end < start) setRange({
2451
+ start: end,
2452
+ end: start
2453
+ });
2454
+ else setRange({
2455
+ start,
2456
+ end
2457
+ });
2458
+ setSelecting(null);
2459
+ setHoverDate(null);
2460
+ disclosure.close();
2461
+ }
2462
+ };
2463
+ const clearRange = () => {
2464
+ setRange({
2465
+ start: null,
2466
+ end: null
2467
+ });
2468
+ setSelecting(null);
2469
+ setHoverDate(null);
2470
+ };
2471
+ const isPrevDisabled = leftMonth.getFullYear() === yearRange.start && leftMonth.getMonth() === 0;
2472
+ const isNextDisabled = rightMonth.getFullYear() === yearRange.end && rightMonth.getMonth() === 11;
2473
+ const hasValue = range.start !== null || range.end !== null;
2474
+ const displayStart = formatDate(range.start);
2475
+ const displayEnd = formatDate(range.end);
2476
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
2477
+ labelFor: `${pickerId}-trigger`,
2478
+ label,
2479
+ description,
2480
+ descriptionId,
2481
+ error,
2482
+ errorId,
2483
+ required,
2484
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2485
+ ref,
2486
+ ...props,
2487
+ id: pickerId,
2488
+ className: cx("pf-daterange", className),
2489
+ "aria-describedby": describedBy,
2490
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2491
+ className: "pf-daterange__control-row",
2492
+ ref: rootRef,
2493
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2494
+ ref: triggerRef,
2495
+ id: `${pickerId}-trigger`,
2496
+ type: "button",
2497
+ className: cx("pf-daterange__trigger", error && "pf-daterange__trigger--invalid"),
2498
+ disabled,
2499
+ "aria-invalid": error ? true : void 0,
2500
+ "aria-haspopup": "dialog",
2501
+ "aria-expanded": isOpen,
2502
+ "aria-required": required || void 0,
2503
+ onClick: () => {
2504
+ if (!isOpen) setSelecting(null);
2505
+ disclosure.toggle();
2506
+ },
2507
+ onKeyDown: (e) => {
2508
+ if (e.key === Keys.Escape) disclosure.close();
2509
+ },
2510
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2511
+ className: "pf-daterange__value",
2512
+ children: displayStart ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2513
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: displayStart }),
2514
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2515
+ className: "pf-daterange__separator",
2516
+ "aria-hidden": true,
2517
+ children: "–"
2518
+ }),
2519
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2520
+ className: cx(!displayEnd && "pf-daterange__value--placeholder"),
2521
+ children: displayEnd || endPlaceholder
2522
+ })
2523
+ ] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2524
+ className: "pf-daterange__value--placeholder",
2525
+ children: [
2526
+ startPlaceholder,
2527
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2528
+ className: "pf-daterange__separator",
2529
+ "aria-hidden": true,
2530
+ children: [
2531
+ " ",
2532
+ "–",
2533
+ " "
2534
+ ]
2535
+ }),
2536
+ endPlaceholder
2537
+ ]
2538
+ })
2539
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
2540
+ name: "calendar",
2541
+ "aria-hidden": true
2542
+ })]
2543
+ }), hasValue ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2544
+ type: "button",
2545
+ className: "pf-date-picker__icon-button",
2546
+ "aria-label": "Clear date range",
2547
+ disabled,
2548
+ onClick: clearRange,
2549
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
2550
+ name: "circle-xmark",
2551
+ "aria-hidden": true
2552
+ })
2553
+ }) : null]
2554
+ }), isOpen && typeof document !== "undefined" ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2555
+ ref: popoverRef,
2556
+ className: "pf-daterange__popover",
2557
+ role: "dialog",
2558
+ "aria-label": "Date range picker",
2559
+ style: popoverStyle,
2560
+ onKeyDown: (e) => {
2561
+ if (e.key === Keys.Escape) {
2562
+ setSelecting(null);
2563
+ setHoverDate(null);
2564
+ disclosure.close();
2565
+ }
2566
+ },
2567
+ children: [selecting === "start" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2568
+ className: "pf-daterange__hint",
2569
+ "aria-live": "polite",
2570
+ children: "Select an end date"
2571
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2572
+ className: "pf-daterange__hint",
2573
+ "aria-live": "polite",
2574
+ children: "Select a start date"
2575
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2576
+ className: "pf-daterange__months",
2577
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RangeCalendar, {
2578
+ monthDate: leftMonth,
2579
+ rangeStart: range.start,
2580
+ rangeEnd: range.end,
2581
+ hoverDate: selecting === "start" ? hoverDate : null,
2582
+ onDayClick: handleDayClick,
2583
+ onDayHover: (d) => selecting === "start" && setHoverDate(d),
2584
+ disabledDates,
2585
+ showOutsideDays,
2586
+ isPrevDisabled,
2587
+ isNextDisabled: false,
2588
+ onPrev: () => setLeftMonth((m) => clampMonth(addMonths(m, -1))),
2589
+ onNext: () => setLeftMonth((m) => clampMonth(addMonths(m, 1)))
2590
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RangeCalendar, {
2591
+ monthDate: rightMonth,
2592
+ rangeStart: range.start,
2593
+ rangeEnd: range.end,
2594
+ hoverDate: selecting === "start" ? hoverDate : null,
2595
+ onDayClick: handleDayClick,
2596
+ onDayHover: (d) => selecting === "start" && setHoverDate(d),
2597
+ disabledDates,
2598
+ showOutsideDays,
2599
+ isPrevDisabled: false,
2600
+ isNextDisabled,
2601
+ onPrev: () => setLeftMonth((m) => clampMonth(addMonths(m, -1))),
2602
+ onNext: () => setLeftMonth((m) => clampMonth(addMonths(m, 1))),
2603
+ hideNavDesktop: true
2604
+ })]
2605
+ })]
2606
+ }), document.body) : null]
2607
+ })
2608
+ });
2609
+ });
2610
+ DateRangePicker.displayName = "DateRangePicker";
2611
+ //#endregion
1810
2612
  //#region src/components/EmptyState/EmptyState.tsx
1811
2613
  var EmptyState = (0, react.forwardRef)(function EmptyState({ className, heading, description, icon, iconName, action, size = "md", ...props }, ref) {
1812
2614
  const resolvedIcon = icon ?? (iconName ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
@@ -2127,6 +2929,18 @@ var InlineCTA = (0, react.forwardRef)(function InlineCTA({ className, heading, d
2127
2929
  });
2128
2930
  InlineCTA.displayName = "InlineCTA";
2129
2931
  //#endregion
2932
+ //#region src/components/Kbd/Kbd.tsx
2933
+ var Kbd = (0, react.forwardRef)(function Kbd({ className, keys, size = "md", separator = "+", children, ...props }, ref) {
2934
+ const content = keys && keys.length > 0 ? keys.join(` ${separator} `) : children;
2935
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("kbd", {
2936
+ ref,
2937
+ className: cx("pf-kbd", `pf-kbd--${size}`, className),
2938
+ ...props,
2939
+ children: content
2940
+ });
2941
+ });
2942
+ Kbd.displayName = "Kbd";
2943
+ //#endregion
2130
2944
  //#region src/components/GaugeChart/GaugeChart.tsx
2131
2945
  var GaugeChart = (0, react.forwardRef)(function GaugeChart({ className, value, max = 100, centerLabel, subLabel, size = 200, strokeWidth = 16, color, style, ...props }, ref) {
2132
2946
  const progress = max > 0 ? Math.min(Math.max(value, 0), max) / max : 0;
@@ -3081,6 +3895,161 @@ var Notification = (0, react.forwardRef)(({ className, variant = "info", heading
3081
3895
  });
3082
3896
  Notification.displayName = "Notification";
3083
3897
  //#endregion
3898
+ //#region src/components/NumberInput/NumberInput.tsx
3899
+ var decimalsOf = (n) => {
3900
+ const str = String(n);
3901
+ const dot = str.indexOf(".");
3902
+ return dot === -1 ? 0 : str.length - dot - 1;
3903
+ };
3904
+ var clamp$2 = (n, min, max) => Math.min(Math.max(n, min), max);
3905
+ var NumberInput = (0, react.forwardRef)(function NumberInput({ id, value, defaultValue, onValueChange, min = -Infinity, max = Infinity, step = 1, label, description, error, formatOptions, locale, decrementLabel = "Decrease", incrementLabel = "Increase", name, required, disabled, className, placeholder, "aria-describedby": ariaDescribedBy, ...props }, ref) {
3906
+ const generatedId = (0, react.useId)();
3907
+ const fieldId = id ?? generatedId;
3908
+ const descriptionId = description ? `${fieldId}-description` : void 0;
3909
+ const errorId = error ? `${fieldId}-error` : void 0;
3910
+ const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId);
3911
+ const [rawValue, setCurrentValue] = useControllableState({
3912
+ value,
3913
+ defaultValue: defaultValue ?? null,
3914
+ onChange: onValueChange
3915
+ });
3916
+ const currentValue = rawValue ?? null;
3917
+ const inputRefs = useComposedRefs((0, react.useRef)(null), ref);
3918
+ const stepDecimals = decimalsOf(step);
3919
+ const round = (n) => {
3920
+ const factor = 10 ** stepDecimals;
3921
+ return Math.round(n * factor) / factor;
3922
+ };
3923
+ const formatValue = (n) => {
3924
+ if (n === null) return "";
3925
+ if (formatOptions) return new Intl.NumberFormat(locale, formatOptions).format(n);
3926
+ return String(n);
3927
+ };
3928
+ const [focused, setFocused] = (0, react.useState)(false);
3929
+ const [draft, setDraft] = (0, react.useState)(() => formatValue(currentValue));
3930
+ const displayValue = focused ? draft : formatValue(currentValue);
3931
+ const commit = (next) => {
3932
+ if (next === null) {
3933
+ setCurrentValue(null);
3934
+ setDraft("");
3935
+ return;
3936
+ }
3937
+ const clamped = round(clamp$2(next, min, max));
3938
+ setCurrentValue(clamped);
3939
+ setDraft(focused ? String(clamped) : formatValue(clamped));
3940
+ };
3941
+ const stepBy = (direction) => {
3942
+ if (disabled) return;
3943
+ commit((currentValue ?? (Number.isFinite(min) ? min : Number.isFinite(max) ? max : 0)) + direction * step);
3944
+ };
3945
+ const atMin = currentValue !== null && currentValue <= min;
3946
+ const atMax = currentValue !== null && currentValue >= max;
3947
+ const onKeyDown = (event) => {
3948
+ if (disabled) return;
3949
+ if (event.key === Keys.ArrowUp) {
3950
+ event.preventDefault();
3951
+ stepBy(1);
3952
+ } else if (event.key === Keys.ArrowDown) {
3953
+ event.preventDefault();
3954
+ stepBy(-1);
3955
+ } else if (event.key === Keys.Home && Number.isFinite(min)) {
3956
+ event.preventDefault();
3957
+ commit(min);
3958
+ } else if (event.key === Keys.End && Number.isFinite(max)) {
3959
+ event.preventDefault();
3960
+ commit(max);
3961
+ }
3962
+ };
3963
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
3964
+ labelFor: fieldId,
3965
+ label,
3966
+ description,
3967
+ descriptionId,
3968
+ error,
3969
+ errorId,
3970
+ required,
3971
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3972
+ className: cx("pf-numberinput", error && "pf-numberinput--invalid"),
3973
+ children: [
3974
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3975
+ type: "button",
3976
+ className: "pf-numberinput__step pf-numberinput__step--decrement",
3977
+ "aria-label": decrementLabel,
3978
+ disabled: disabled || atMin,
3979
+ tabIndex: -1,
3980
+ onMouseDown: (event) => event.preventDefault(),
3981
+ onClick: () => stepBy(-1),
3982
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
3983
+ name: "minus",
3984
+ "aria-hidden": true
3985
+ })
3986
+ }),
3987
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3988
+ ...props,
3989
+ id: fieldId,
3990
+ ref: inputRefs,
3991
+ type: "text",
3992
+ inputMode: "decimal",
3993
+ role: "spinbutton",
3994
+ className: cx("pf-numberinput__input", className),
3995
+ value: displayValue,
3996
+ placeholder,
3997
+ disabled,
3998
+ required,
3999
+ autoComplete: "off",
4000
+ "aria-invalid": error ? true : void 0,
4001
+ "aria-describedby": describedBy,
4002
+ "aria-valuenow": currentValue ?? void 0,
4003
+ "aria-valuemin": Number.isFinite(min) ? min : void 0,
4004
+ "aria-valuemax": Number.isFinite(max) ? max : void 0,
4005
+ onFocus: () => {
4006
+ setFocused(true);
4007
+ setDraft(currentValue === null ? "" : String(currentValue));
4008
+ },
4009
+ onChange: (event) => {
4010
+ const raw = event.target.value;
4011
+ setDraft(raw);
4012
+ if (raw.trim() === "") {
4013
+ setCurrentValue(null);
4014
+ return;
4015
+ }
4016
+ const parsed = Number(raw);
4017
+ if (!Number.isNaN(parsed)) setCurrentValue(round(clamp$2(parsed, min, max)));
4018
+ },
4019
+ onBlur: () => {
4020
+ setFocused(false);
4021
+ if (draft.trim() === "") commit(null);
4022
+ else {
4023
+ const parsed = Number(draft);
4024
+ commit(Number.isNaN(parsed) ? currentValue : parsed);
4025
+ }
4026
+ },
4027
+ onKeyDown
4028
+ }),
4029
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
4030
+ type: "button",
4031
+ className: "pf-numberinput__step pf-numberinput__step--increment",
4032
+ "aria-label": incrementLabel,
4033
+ disabled: disabled || atMax,
4034
+ tabIndex: -1,
4035
+ onMouseDown: (event) => event.preventDefault(),
4036
+ onClick: () => stepBy(1),
4037
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
4038
+ name: "plus",
4039
+ "aria-hidden": true
4040
+ })
4041
+ }),
4042
+ name ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4043
+ type: "hidden",
4044
+ name,
4045
+ value: currentValue ?? ""
4046
+ }) : null
4047
+ ]
4048
+ })
4049
+ });
4050
+ });
4051
+ NumberInput.displayName = "NumberInput";
4052
+ //#endregion
3084
4053
  //#region src/components/PageHeader/PageHeader.tsx
3085
4054
  var PageHeaderMeta = (0, react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3086
4055
  ref,
@@ -3295,6 +4264,70 @@ var PieChart = (0, react.forwardRef)(function PieChart({ className, data, size =
3295
4264
  });
3296
4265
  PieChart.displayName = "PieChart";
3297
4266
  //#endregion
4267
+ //#region src/components/Popover/Popover.tsx
4268
+ function Popover({ trigger, children, open, defaultOpen, onOpenChange, align = "start", label, closeOnOutsideClick = true, className }) {
4269
+ const [isOpen = false, setOpen] = useControllableState({
4270
+ value: open,
4271
+ defaultValue: defaultOpen ?? false,
4272
+ onChange: onOpenChange
4273
+ });
4274
+ const contentId = (0, react.useId)();
4275
+ const triggerRef = (0, react.useRef)(null);
4276
+ const contentRef = (0, react.useRef)(null);
4277
+ const { isMounted, isExiting } = usePresence(isOpen, 160);
4278
+ const style = useAnchoredPosition({
4279
+ anchorRef: triggerRef,
4280
+ floatingRef: contentRef,
4281
+ enabled: isOpen,
4282
+ align,
4283
+ matchAnchorWidth: false,
4284
+ flip: true
4285
+ });
4286
+ useOutsideInteraction({
4287
+ refs: [triggerRef, contentRef],
4288
+ enabled: isOpen,
4289
+ onInteractOutside: () => {
4290
+ if (closeOnOutsideClick) setOpen(false);
4291
+ }
4292
+ });
4293
+ const wasOpen = (0, react.useRef)(false);
4294
+ (0, react.useEffect)(() => {
4295
+ if (isOpen) {
4296
+ wasOpen.current = true;
4297
+ contentRef.current?.focus();
4298
+ } else if (wasOpen.current) {
4299
+ wasOpen.current = false;
4300
+ triggerRef.current?.focus();
4301
+ }
4302
+ }, [isOpen]);
4303
+ const triggerProps = trigger.props;
4304
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react.cloneElement)(trigger, {
4305
+ ref: useComposedRefs(triggerRef, trigger.ref ?? triggerProps.ref),
4306
+ "aria-haspopup": "dialog",
4307
+ "aria-expanded": isOpen,
4308
+ onClick: (event) => {
4309
+ triggerProps.onClick?.(event);
4310
+ setOpen(!isOpen);
4311
+ }
4312
+ }), isMounted && typeof document !== "undefined" ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4313
+ ref: contentRef,
4314
+ id: contentId,
4315
+ role: "dialog",
4316
+ "aria-label": label,
4317
+ tabIndex: -1,
4318
+ className: cx("pf-popover", isExiting && "pf-popover--exiting", className),
4319
+ style,
4320
+ onKeyDown: (event) => {
4321
+ if (event.key === Keys.Escape) {
4322
+ event.stopPropagation();
4323
+ setOpen(false);
4324
+ }
4325
+ },
4326
+ children
4327
+ }), document.body) : null] });
4328
+ }
4329
+ Popover.displayName = "Popover";
4330
+ //#endregion
3298
4331
  //#region src/components/ProgressIndicators/ProgressIndicators.tsx
3299
4332
  var clampPercent = (value, max) => {
3300
4333
  if (max <= 0) return 0;
@@ -4812,6 +5845,130 @@ var Textarea = (0, react.forwardRef)(({ id, label, description, error, className
4812
5845
  });
4813
5846
  Textarea.displayName = "Textarea";
4814
5847
  //#endregion
5848
+ //#region src/components/Toast/Toast.tsx
5849
+ var _emit = null;
5850
+ function ToastItem({ entry, onRemove }) {
5851
+ const { id, shouldExit } = entry;
5852
+ const handleRemove = (0, react.useCallback)(() => onRemove(id), [onRemove, id]);
5853
+ (0, react.useEffect)(() => {
5854
+ if (!shouldExit) return;
5855
+ const t = setTimeout(handleRemove, 270);
5856
+ return () => clearTimeout(t);
5857
+ }, [shouldExit, handleRemove]);
5858
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Notification, {
5859
+ variant: entry.variant,
5860
+ heading: entry.heading,
5861
+ description: entry.description,
5862
+ action: entry.action,
5863
+ dismissible: entry.dismissible,
5864
+ onDismiss: handleRemove,
5865
+ className: shouldExit ? "pf-notification--exiting" : void 0,
5866
+ onAnimationEnd: (e) => {
5867
+ if (shouldExit && e.currentTarget === e.target) handleRemove();
5868
+ }
5869
+ });
5870
+ }
5871
+ function ToastProvider({ children, placement = "top-right", defaultDuration = 4e3 }) {
5872
+ const [entries, setEntries] = (0, react.useState)([]);
5873
+ const timers = (0, react.useRef)(/* @__PURE__ */ new Map());
5874
+ const remove = (0, react.useCallback)((id) => {
5875
+ timers.current.delete(id);
5876
+ setEntries((prev) => prev.filter((e) => e.id !== id));
5877
+ }, []);
5878
+ const signalExit = (0, react.useCallback)((id) => {
5879
+ timers.current.delete(id);
5880
+ setEntries((prev) => prev.map((e) => e.id === id ? {
5881
+ ...e,
5882
+ shouldExit: true
5883
+ } : e));
5884
+ }, []);
5885
+ const toast = (0, react.useCallback)((options) => {
5886
+ const id = `t-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
5887
+ const duration = options.duration !== void 0 ? options.duration : defaultDuration;
5888
+ setEntries((prev) => [{
5889
+ ...options,
5890
+ id,
5891
+ shouldExit: false,
5892
+ dismissible: options.dismissible ?? true
5893
+ }, ...prev]);
5894
+ if (typeof duration === "number" && duration > 0) {
5895
+ const t = setTimeout(() => signalExit(id), duration);
5896
+ timers.current.set(id, t);
5897
+ }
5898
+ return id;
5899
+ }, [defaultDuration, signalExit]);
5900
+ const dismiss = (0, react.useCallback)((id) => {
5901
+ const t = timers.current.get(id);
5902
+ if (t) clearTimeout(t);
5903
+ signalExit(id);
5904
+ }, [signalExit]);
5905
+ const dismissAll = (0, react.useCallback)(() => {
5906
+ timers.current.forEach(clearTimeout);
5907
+ timers.current.clear();
5908
+ setEntries((prev) => prev.map((e) => ({
5909
+ ...e,
5910
+ shouldExit: true
5911
+ })));
5912
+ }, []);
5913
+ (0, react.useEffect)(() => {
5914
+ _emit = toast;
5915
+ return () => {
5916
+ if (_emit === toast) _emit = null;
5917
+ };
5918
+ }, [toast]);
5919
+ (0, react.useEffect)(() => {
5920
+ const map = timers.current;
5921
+ return () => map.forEach(clearTimeout);
5922
+ }, []);
5923
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToastContext.Provider, {
5924
+ value: {
5925
+ toast,
5926
+ dismiss,
5927
+ dismissAll
5928
+ },
5929
+ children: [children, typeof document !== "undefined" ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NotificationStack, {
5930
+ placement,
5931
+ children: entries.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToastItem, {
5932
+ entry,
5933
+ onRemove: remove
5934
+ }, entry.id))
5935
+ }), document.body) : null]
5936
+ });
5937
+ }
5938
+ var ToastContext = (0, react.createContext)(null);
5939
+ function useToast() {
5940
+ const ctx = (0, react.useContext)(ToastContext);
5941
+ if (!ctx) throw new Error("useToast must be used inside <ToastProvider>.");
5942
+ return ctx;
5943
+ }
5944
+ /**
5945
+ * Fire a toast imperatively from anywhere — no hook needed.
5946
+ * Requires a `<ToastProvider>` to be mounted somewhere in the tree.
5947
+ */
5948
+ function toast(options) {
5949
+ if (!_emit) {
5950
+ console.warn("[pitchfork-ui] toast() called before <ToastProvider> is mounted.");
5951
+ return "";
5952
+ }
5953
+ return _emit(options);
5954
+ }
5955
+ toast.info = (opts) => toast({
5956
+ ...opts,
5957
+ variant: "info"
5958
+ });
5959
+ toast.success = (opts) => toast({
5960
+ ...opts,
5961
+ variant: "success"
5962
+ });
5963
+ toast.warning = (opts) => toast({
5964
+ ...opts,
5965
+ variant: "warning"
5966
+ });
5967
+ toast.danger = (opts) => toast({
5968
+ ...opts,
5969
+ variant: "danger"
5970
+ });
5971
+ //#endregion
4815
5972
  //#region src/components/Tooltip/Tooltip.tsx
4816
5973
  var GAP = 10;
4817
5974
  var VIEWPORT_MARGIN = 8;
@@ -5235,6 +6392,7 @@ exports.Accordion = Accordion;
5235
6392
  exports.Alert = Alert;
5236
6393
  exports.AreaChart = AreaChart;
5237
6394
  exports.Avatar = Avatar;
6395
+ exports.AvatarGroup = AvatarGroup;
5238
6396
  exports.Badge = Badge;
5239
6397
  exports.BadgeGroup = BadgeGroup;
5240
6398
  exports.BarChart = BarChart;
@@ -5249,9 +6407,12 @@ exports.CardHeader = CardHeader;
5249
6407
  exports.Carousel = Carousel;
5250
6408
  exports.Checkbox = Checkbox;
5251
6409
  exports.CodeSnippet = CodeSnippet;
6410
+ exports.Combobox = Combobox;
6411
+ exports.CommandPalette = CommandPalette;
5252
6412
  exports.ContentDivider = ContentDivider;
5253
6413
  exports.CreditCard = CreditCard;
5254
6414
  exports.DatePicker = DatePicker;
6415
+ exports.DateRangePicker = DateRangePicker;
5255
6416
  exports.Dropdown = Dropdown;
5256
6417
  exports.EmptyState = EmptyState;
5257
6418
  exports.FileUploader = FileUploader;
@@ -5261,6 +6422,7 @@ exports.Heatmap = Heatmap;
5261
6422
  exports.Icon = Icon;
5262
6423
  exports.InlineCTA = InlineCTA;
5263
6424
  exports.Input = Input;
6425
+ exports.Kbd = Kbd;
5264
6426
  exports.Keys = Keys;
5265
6427
  exports.LineChart = LineChart;
5266
6428
  exports.LoadingDots = LoadingDots;
@@ -5275,10 +6437,12 @@ exports.ModalHeader = ModalHeader;
5275
6437
  exports.MultiSelect = MultiSelect;
5276
6438
  exports.Notification = Notification;
5277
6439
  exports.NotificationStack = NotificationStack;
6440
+ exports.NumberInput = NumberInput;
5278
6441
  exports.PageHeader = PageHeader;
5279
6442
  exports.PageHeaderMeta = PageHeaderMeta;
5280
6443
  exports.Pagination = Pagination;
5281
6444
  exports.PieChart = PieChart;
6445
+ exports.Popover = Popover;
5282
6446
  exports.ProgressBar = ProgressBar;
5283
6447
  exports.ProgressCircle = ProgressCircle;
5284
6448
  exports.ProgressSteps = ProgressSteps;
@@ -5300,6 +6464,7 @@ exports.Table = Table;
5300
6464
  exports.Tabs = Tabs;
5301
6465
  exports.Tag = Tag;
5302
6466
  exports.Textarea = Textarea;
6467
+ exports.ToastProvider = ToastProvider;
5303
6468
  exports.Tooltip = Tooltip;
5304
6469
  exports.TreeView = TreeView;
5305
6470
  exports.UtilityButton = UtilityButton;
@@ -5309,6 +6474,7 @@ exports.getAvailableIconNames = getAvailableIconNames;
5309
6474
  exports.getCustomIconNames = getCustomIconNames;
5310
6475
  exports.getFocusableElements = getFocusableElements;
5311
6476
  exports.isActivationKey = isActivationKey;
6477
+ exports.toast = toast;
5312
6478
  exports.useAnchoredPosition = useAnchoredPosition;
5313
6479
  exports.useComposedRefs = useComposedRefs;
5314
6480
  exports.useControllableState = useControllableState;
@@ -5318,3 +6484,4 @@ exports.useFocusTrap = useFocusTrap;
5318
6484
  exports.useListNavigation = useListNavigation;
5319
6485
  exports.useOutsideInteraction = useOutsideInteraction;
5320
6486
  exports.usePresence = usePresence;
6487
+ exports.useToast = useToast;