@pitchfork-ui/react 0.9.0 → 0.11.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.
- package/dist/components/Badge/Badge.css +4 -0
- package/dist/components/Button/Button.css +7 -0
- package/dist/components/Collapsible/Collapsible.css +86 -0
- package/dist/components/Collapsible/Collapsible2.js +65 -0
- package/dist/components/ContextMenu/ContextMenu.css +122 -0
- package/dist/components/ContextMenu/ContextMenu2.js +155 -0
- package/dist/components/Icon/Icon2.js +17 -0
- package/dist/components/InlineCTA/InlineCTA.css +4 -0
- package/dist/components/Modal/Modal.css +6 -1
- package/dist/components/Resizable/Resizable.css +79 -0
- package/dist/components/Resizable/Resizable2.js +101 -0
- package/dist/components/ScrollArea/ScrollArea.css +54 -0
- package/dist/components/ScrollArea/ScrollArea2.js +18 -0
- package/dist/components/Tag/Tag.css +4 -0
- package/dist/components/TagInput/TagInput.css +72 -0
- package/dist/components/TagInput/TagInput2.js +116 -0
- package/dist/components/TimePicker/TimePicker.css +179 -0
- package/dist/components/TimePicker/TimePicker2.js +239 -0
- package/dist/components/Timeline/Timeline.css +128 -0
- package/dist/components/Timeline/Timeline2.js +49 -0
- package/dist/components/Toolbar/Toolbar.css +37 -0
- package/dist/components/Toolbar/Toolbar2.js +71 -0
- package/dist/components/UtilityButton/UtilityButton.css +6 -6
- package/dist/components/VisuallyHidden/VisuallyHidden.css +26 -0
- package/dist/components/VisuallyHidden/VisuallyHidden2.js +21 -0
- package/dist/index.cjs +786 -7
- package/dist/index.js +10 -1
- package/dist/src/components/Badge/Badge.d.ts +1 -1
- package/dist/src/components/Button/Button.d.ts +1 -1
- package/dist/src/components/Collapsible/Collapsible.d.ts +11 -0
- package/dist/src/components/Collapsible/Collapsible.test.d.ts +1 -0
- package/dist/src/components/Collapsible/index.d.ts +1 -0
- package/dist/src/components/ContextMenu/ContextMenu.d.ts +20 -0
- package/dist/src/components/ContextMenu/ContextMenu.test.d.ts +1 -0
- package/dist/src/components/ContextMenu/index.d.ts +1 -0
- package/dist/src/components/InlineCTA/InlineCTA.d.ts +1 -1
- package/dist/src/components/Resizable/Resizable.d.ts +19 -0
- package/dist/src/components/Resizable/Resizable.test.d.ts +1 -0
- package/dist/src/components/Resizable/index.d.ts +1 -0
- package/dist/src/components/ScrollArea/ScrollArea.d.ts +12 -0
- package/dist/src/components/ScrollArea/ScrollArea.test.d.ts +1 -0
- package/dist/src/components/ScrollArea/index.d.ts +1 -0
- package/dist/src/components/Tag/Tag.d.ts +1 -1
- package/dist/src/components/TagInput/TagInput.d.ts +23 -0
- package/dist/src/components/TagInput/TagInput.test.d.ts +1 -0
- package/dist/src/components/TagInput/index.d.ts +1 -0
- package/dist/src/components/TimePicker/TimePicker.d.ts +18 -0
- package/dist/src/components/TimePicker/TimePicker.test.d.ts +1 -0
- package/dist/src/components/TimePicker/index.d.ts +1 -0
- package/dist/src/components/Timeline/Timeline.d.ts +16 -0
- package/dist/src/components/Timeline/Timeline.test.d.ts +1 -0
- package/dist/src/components/Timeline/index.d.ts +1 -0
- package/dist/src/components/Toolbar/Toolbar.d.ts +8 -0
- package/dist/src/components/Toolbar/Toolbar.test.d.ts +1 -0
- package/dist/src/components/Toolbar/index.d.ts +1 -0
- package/dist/src/components/UtilityButton/UtilityButton.d.ts +1 -1
- package/dist/src/components/VisuallyHidden/VisuallyHidden.d.ts +15 -0
- package/dist/src/components/VisuallyHidden/VisuallyHidden.test.d.ts +1 -0
- package/dist/src/components/VisuallyHidden/index.d.ts +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/styles/theme.css +89 -4
- package/dist/styles.css +903 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -449,6 +449,23 @@ var customIcons = {
|
|
|
449
449
|
"aria-hidden": "true",
|
|
450
450
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 5v14" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 12h14" })]
|
|
451
451
|
}),
|
|
452
|
+
clock: /* @__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: "12",
|
|
465
|
+
cy: "12",
|
|
466
|
+
r: "9"
|
|
467
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 7v5l3 2" })]
|
|
468
|
+
}),
|
|
452
469
|
"magnifying-glass": /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
453
470
|
width: "1em",
|
|
454
471
|
height: "1em",
|
|
@@ -968,6 +985,149 @@ function CommandPalette({ open, onOpenChange, items, placeholder = "Search comma
|
|
|
968
985
|
}), document.body);
|
|
969
986
|
}
|
|
970
987
|
//#endregion
|
|
988
|
+
//#region src/components/ContextMenu/ContextMenu.tsx
|
|
989
|
+
var isSeparator = (entry) => entry.separator === true;
|
|
990
|
+
var VIEWPORT_PADDING = 8;
|
|
991
|
+
var ContextMenu = (0, react.forwardRef)(function ContextMenu({ className, items, disabled = false, onOpenChange, children, onContextMenu, ...props }, ref) {
|
|
992
|
+
const menuId = (0, react.useId)();
|
|
993
|
+
const [isOpen, setIsOpen] = (0, react.useState)(false);
|
|
994
|
+
const [point, setPoint] = (0, react.useState)({
|
|
995
|
+
x: 0,
|
|
996
|
+
y: 0
|
|
997
|
+
});
|
|
998
|
+
const [coords, setCoords] = (0, react.useState)(null);
|
|
999
|
+
const rootRefs = useComposedRefs((0, react.useRef)(null), ref);
|
|
1000
|
+
const menuRef = (0, react.useRef)(null);
|
|
1001
|
+
const { isMounted, isExiting } = usePresence(isOpen, 140);
|
|
1002
|
+
const actionable = items.filter((e) => !isSeparator(e));
|
|
1003
|
+
const { activeIndex, move, setActiveIndex } = useListNavigation({
|
|
1004
|
+
items: actionable,
|
|
1005
|
+
isDisabled: (item) => Boolean(item.disabled)
|
|
1006
|
+
});
|
|
1007
|
+
const setOpen = (open) => {
|
|
1008
|
+
setIsOpen(open);
|
|
1009
|
+
onOpenChange?.(open);
|
|
1010
|
+
};
|
|
1011
|
+
useOutsideInteraction({
|
|
1012
|
+
refs: [menuRef],
|
|
1013
|
+
enabled: isOpen,
|
|
1014
|
+
onInteractOutside: () => setOpen(false)
|
|
1015
|
+
});
|
|
1016
|
+
(0, react.useLayoutEffect)(() => {
|
|
1017
|
+
if (!isMounted || !menuRef.current) return;
|
|
1018
|
+
const rect = menuRef.current.getBoundingClientRect();
|
|
1019
|
+
const maxLeft = window.innerWidth - rect.width - VIEWPORT_PADDING;
|
|
1020
|
+
const maxTop = window.innerHeight - rect.height - VIEWPORT_PADDING;
|
|
1021
|
+
setCoords({
|
|
1022
|
+
left: Math.max(VIEWPORT_PADDING, Math.min(point.x, maxLeft)),
|
|
1023
|
+
top: Math.max(VIEWPORT_PADDING, Math.min(point.y, maxTop))
|
|
1024
|
+
});
|
|
1025
|
+
}, [
|
|
1026
|
+
isMounted,
|
|
1027
|
+
point.x,
|
|
1028
|
+
point.y
|
|
1029
|
+
]);
|
|
1030
|
+
const handleContextMenu = (event) => {
|
|
1031
|
+
onContextMenu?.(event);
|
|
1032
|
+
if (disabled || event.defaultPrevented) return;
|
|
1033
|
+
event.preventDefault();
|
|
1034
|
+
setPoint({
|
|
1035
|
+
x: event.clientX,
|
|
1036
|
+
y: event.clientY
|
|
1037
|
+
});
|
|
1038
|
+
setCoords(null);
|
|
1039
|
+
setActiveIndex(actionable.findIndex((item) => !item.disabled));
|
|
1040
|
+
setOpen(true);
|
|
1041
|
+
};
|
|
1042
|
+
const select = (item) => {
|
|
1043
|
+
if (item.disabled) return;
|
|
1044
|
+
item.onSelect?.();
|
|
1045
|
+
setOpen(false);
|
|
1046
|
+
};
|
|
1047
|
+
const onMenuKeyDown = (event) => {
|
|
1048
|
+
if (event.key === Keys.Escape) {
|
|
1049
|
+
event.preventDefault();
|
|
1050
|
+
setOpen(false);
|
|
1051
|
+
} else if (event.key === Keys.ArrowDown) {
|
|
1052
|
+
event.preventDefault();
|
|
1053
|
+
move("next");
|
|
1054
|
+
} else if (event.key === Keys.ArrowUp) {
|
|
1055
|
+
event.preventDefault();
|
|
1056
|
+
move("previous");
|
|
1057
|
+
} else if (event.key === Keys.Home) {
|
|
1058
|
+
event.preventDefault();
|
|
1059
|
+
move("first");
|
|
1060
|
+
} else if (event.key === Keys.End) {
|
|
1061
|
+
event.preventDefault();
|
|
1062
|
+
move("last");
|
|
1063
|
+
} else if (event.key === Keys.Enter || event.key === Keys.Space) {
|
|
1064
|
+
event.preventDefault();
|
|
1065
|
+
const item = actionable[activeIndex];
|
|
1066
|
+
if (item) select(item);
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
(0, react.useLayoutEffect)(() => {
|
|
1070
|
+
if (isMounted && coords) menuRef.current?.focus();
|
|
1071
|
+
}, [isMounted, coords]);
|
|
1072
|
+
let actionableIndex = -1;
|
|
1073
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1074
|
+
ref: rootRefs,
|
|
1075
|
+
className: cx("pf-context-menu", className),
|
|
1076
|
+
onContextMenu: handleContextMenu,
|
|
1077
|
+
...props,
|
|
1078
|
+
children: [children, isMounted && typeof document !== "undefined" ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1079
|
+
id: menuId,
|
|
1080
|
+
ref: menuRef,
|
|
1081
|
+
role: "menu",
|
|
1082
|
+
"aria-label": "Context menu",
|
|
1083
|
+
tabIndex: -1,
|
|
1084
|
+
className: cx("pf-context-menu__menu", isExiting && "pf-context-menu__menu--exiting"),
|
|
1085
|
+
style: {
|
|
1086
|
+
position: "fixed",
|
|
1087
|
+
left: coords?.left ?? point.x,
|
|
1088
|
+
top: coords?.top ?? point.y,
|
|
1089
|
+
visibility: coords ? "visible" : "hidden"
|
|
1090
|
+
},
|
|
1091
|
+
onKeyDown: onMenuKeyDown,
|
|
1092
|
+
children: items.map((entry, index) => {
|
|
1093
|
+
if (isSeparator(entry)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1094
|
+
role: "separator",
|
|
1095
|
+
className: "pf-context-menu__separator"
|
|
1096
|
+
}, `sep-${index}`);
|
|
1097
|
+
actionableIndex += 1;
|
|
1098
|
+
const itemIndex = actionableIndex;
|
|
1099
|
+
const isActive = itemIndex === activeIndex;
|
|
1100
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1101
|
+
type: "button",
|
|
1102
|
+
role: "menuitem",
|
|
1103
|
+
disabled: entry.disabled,
|
|
1104
|
+
className: cx("pf-context-menu__item", isActive && "pf-context-menu__item--active", entry.destructive && "pf-context-menu__item--destructive"),
|
|
1105
|
+
onMouseEnter: () => {
|
|
1106
|
+
if (!entry.disabled) setActiveIndex(itemIndex);
|
|
1107
|
+
},
|
|
1108
|
+
onClick: () => select(entry),
|
|
1109
|
+
children: [
|
|
1110
|
+
entry.icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1111
|
+
className: "pf-context-menu__item-icon",
|
|
1112
|
+
"aria-hidden": true,
|
|
1113
|
+
children: entry.icon
|
|
1114
|
+
}) : null,
|
|
1115
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1116
|
+
className: "pf-context-menu__item-label",
|
|
1117
|
+
children: entry.label
|
|
1118
|
+
}),
|
|
1119
|
+
entry.shortcut ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("kbd", {
|
|
1120
|
+
className: "pf-context-menu__item-shortcut",
|
|
1121
|
+
children: entry.shortcut
|
|
1122
|
+
}) : null
|
|
1123
|
+
]
|
|
1124
|
+
}, entry.id ?? `${entry.label}-${index}`);
|
|
1125
|
+
})
|
|
1126
|
+
}), document.body) : null]
|
|
1127
|
+
});
|
|
1128
|
+
});
|
|
1129
|
+
ContextMenu.displayName = "ContextMenu";
|
|
1130
|
+
//#endregion
|
|
971
1131
|
//#region src/components/BadgeGroup/BadgeGroup.tsx
|
|
972
1132
|
var BadgeGroup = (0, react.forwardRef)(({ label, message, color = "gray", appearance = "pill", badgePosition = "leading", className, ...props }, ref) => {
|
|
973
1133
|
const badge = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -1652,16 +1812,16 @@ var Calendar = (0, react.forwardRef)(function Calendar({ className, value, defau
|
|
|
1652
1812
|
Calendar.displayName = "Calendar";
|
|
1653
1813
|
//#endregion
|
|
1654
1814
|
//#region src/components/Carousel/Carousel.tsx
|
|
1655
|
-
var clamp$
|
|
1815
|
+
var clamp$4 = (value, min, max) => {
|
|
1656
1816
|
return Math.min(Math.max(value, min), max);
|
|
1657
1817
|
};
|
|
1658
1818
|
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) {
|
|
1659
1819
|
const totalSlides = slides.length;
|
|
1660
|
-
const [activeIndex, setActiveIndex] = (0, react.useState)(clamp$
|
|
1661
|
-
const resolvedActiveIndex = clamp$
|
|
1820
|
+
const [activeIndex, setActiveIndex] = (0, react.useState)(clamp$4(initialIndex, 0, Math.max(totalSlides - 1, 0)));
|
|
1821
|
+
const resolvedActiveIndex = clamp$4(activeIndex, 0, Math.max(totalSlides - 1, 0));
|
|
1662
1822
|
const goToIndex = (nextIndex) => {
|
|
1663
1823
|
if (totalSlides === 0) return;
|
|
1664
|
-
const resolvedIndex = loop ? (nextIndex % totalSlides + totalSlides) % totalSlides : clamp$
|
|
1824
|
+
const resolvedIndex = loop ? (nextIndex % totalSlides + totalSlides) % totalSlides : clamp$4(nextIndex, 0, totalSlides - 1);
|
|
1665
1825
|
setActiveIndex(resolvedIndex);
|
|
1666
1826
|
onIndexChange?.(resolvedIndex);
|
|
1667
1827
|
};
|
|
@@ -1908,6 +2068,62 @@ var CodeSnippet = (0, react.forwardRef)(function CodeSnippet({ className, code,
|
|
|
1908
2068
|
});
|
|
1909
2069
|
CodeSnippet.displayName = "CodeSnippet";
|
|
1910
2070
|
//#endregion
|
|
2071
|
+
//#region src/components/Collapsible/Collapsible.tsx
|
|
2072
|
+
var Collapsible = (0, react.forwardRef)(function Collapsible({ className, trigger, open, defaultOpen, onOpenChange, disabled = false, showChevron = true, children, ...props }, ref) {
|
|
2073
|
+
const baseId = (0, react.useId)();
|
|
2074
|
+
const triggerId = `${baseId}-trigger`;
|
|
2075
|
+
const contentId = `${baseId}-content`;
|
|
2076
|
+
const disclosure = useDisclosure({
|
|
2077
|
+
open,
|
|
2078
|
+
defaultOpen,
|
|
2079
|
+
onOpenChange,
|
|
2080
|
+
disabled
|
|
2081
|
+
});
|
|
2082
|
+
const isOpen = disclosure.isOpen ?? false;
|
|
2083
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2084
|
+
ref,
|
|
2085
|
+
className: cx("pf-collapsible", isOpen && "pf-collapsible--open", className),
|
|
2086
|
+
...props,
|
|
2087
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2088
|
+
id: triggerId,
|
|
2089
|
+
type: "button",
|
|
2090
|
+
className: "pf-collapsible__trigger",
|
|
2091
|
+
disabled,
|
|
2092
|
+
"aria-expanded": isOpen,
|
|
2093
|
+
"aria-controls": contentId,
|
|
2094
|
+
onClick: () => disclosure.toggle(),
|
|
2095
|
+
onKeyDown: (event) => {
|
|
2096
|
+
if (event.key === Keys.Escape && isOpen) disclosure.close();
|
|
2097
|
+
},
|
|
2098
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2099
|
+
className: "pf-collapsible__label",
|
|
2100
|
+
children: trigger
|
|
2101
|
+
}), showChevron ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2102
|
+
className: "pf-collapsible__icon",
|
|
2103
|
+
"aria-hidden": true,
|
|
2104
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
2105
|
+
name: "chevron-down",
|
|
2106
|
+
"aria-hidden": true
|
|
2107
|
+
})
|
|
2108
|
+
}) : null]
|
|
2109
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2110
|
+
id: contentId,
|
|
2111
|
+
role: "region",
|
|
2112
|
+
"aria-labelledby": triggerId,
|
|
2113
|
+
className: cx("pf-collapsible__panel", isOpen && "pf-collapsible__panel--open"),
|
|
2114
|
+
...!isOpen ? { inert: true } : {},
|
|
2115
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2116
|
+
className: "pf-collapsible__content",
|
|
2117
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2118
|
+
className: "pf-collapsible__content-inner",
|
|
2119
|
+
children
|
|
2120
|
+
})
|
|
2121
|
+
})
|
|
2122
|
+
})]
|
|
2123
|
+
});
|
|
2124
|
+
});
|
|
2125
|
+
Collapsible.displayName = "Collapsible";
|
|
2126
|
+
//#endregion
|
|
1911
2127
|
//#region src/components/Combobox/Combobox.tsx
|
|
1912
2128
|
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
2129
|
const generatedId = (0, react.useId)();
|
|
@@ -3901,7 +4117,7 @@ var decimalsOf = (n) => {
|
|
|
3901
4117
|
const dot = str.indexOf(".");
|
|
3902
4118
|
return dot === -1 ? 0 : str.length - dot - 1;
|
|
3903
4119
|
};
|
|
3904
|
-
var clamp$
|
|
4120
|
+
var clamp$3 = (n, min, max) => Math.min(Math.max(n, min), max);
|
|
3905
4121
|
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
4122
|
const generatedId = (0, react.useId)();
|
|
3907
4123
|
const fieldId = id ?? generatedId;
|
|
@@ -3934,7 +4150,7 @@ var NumberInput = (0, react.forwardRef)(function NumberInput({ id, value, defaul
|
|
|
3934
4150
|
setDraft("");
|
|
3935
4151
|
return;
|
|
3936
4152
|
}
|
|
3937
|
-
const clamped = round(clamp$
|
|
4153
|
+
const clamped = round(clamp$3(next, min, max));
|
|
3938
4154
|
setCurrentValue(clamped);
|
|
3939
4155
|
setDraft(focused ? String(clamped) : formatValue(clamped));
|
|
3940
4156
|
};
|
|
@@ -4014,7 +4230,7 @@ var NumberInput = (0, react.forwardRef)(function NumberInput({ id, value, defaul
|
|
|
4014
4230
|
return;
|
|
4015
4231
|
}
|
|
4016
4232
|
const parsed = Number(raw);
|
|
4017
|
-
if (!Number.isNaN(parsed)) setCurrentValue(round(clamp$
|
|
4233
|
+
if (!Number.isNaN(parsed)) setCurrentValue(round(clamp$3(parsed, min, max)));
|
|
4018
4234
|
},
|
|
4019
4235
|
onBlur: () => {
|
|
4020
4236
|
setFocused(false);
|
|
@@ -4711,6 +4927,98 @@ var RatingBadge = (0, react.forwardRef)(function RatingBadge({ value, max = 5, r
|
|
|
4711
4927
|
});
|
|
4712
4928
|
RatingBadge.displayName = "RatingBadge";
|
|
4713
4929
|
//#endregion
|
|
4930
|
+
//#region src/components/Resizable/Resizable.tsx
|
|
4931
|
+
var clamp$2 = (n, min, max) => Math.min(Math.max(n, min), max);
|
|
4932
|
+
var Resizable = (0, react.forwardRef)(function Resizable({ className, orientation = "horizontal", size, defaultSize = 50, onSizeChange, min = 10, max = 90, step = 2, handleLabel = "Resize panels", children, ...props }, ref) {
|
|
4933
|
+
const handleId = (0, react.useId)();
|
|
4934
|
+
const containerRef = (0, react.useRef)(null);
|
|
4935
|
+
const containerRefs = useComposedRefs(containerRef, ref);
|
|
4936
|
+
const draggingRef = (0, react.useRef)(false);
|
|
4937
|
+
const [current, setCurrent] = useControllableState({
|
|
4938
|
+
value: size,
|
|
4939
|
+
defaultValue: defaultSize,
|
|
4940
|
+
onChange: onSizeChange
|
|
4941
|
+
});
|
|
4942
|
+
const value = clamp$2(current ?? defaultSize, min, max);
|
|
4943
|
+
const isHorizontal = orientation === "horizontal";
|
|
4944
|
+
const panels = react.Children.toArray(children);
|
|
4945
|
+
const first = panels[0] ?? null;
|
|
4946
|
+
const second = panels[1] ?? null;
|
|
4947
|
+
const setFromPointer = (clientX, clientY) => {
|
|
4948
|
+
const el = containerRef.current;
|
|
4949
|
+
if (!el) return;
|
|
4950
|
+
const rect = el.getBoundingClientRect();
|
|
4951
|
+
const pct = isHorizontal ? (clientX - rect.left) / rect.width * 100 : (clientY - rect.top) / rect.height * 100;
|
|
4952
|
+
setCurrent(clamp$2(Math.round(pct), min, max));
|
|
4953
|
+
};
|
|
4954
|
+
const onPointerDown = (event) => {
|
|
4955
|
+
event.preventDefault();
|
|
4956
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
4957
|
+
draggingRef.current = true;
|
|
4958
|
+
};
|
|
4959
|
+
const onPointerMove = (event) => {
|
|
4960
|
+
if (!draggingRef.current) return;
|
|
4961
|
+
setFromPointer(event.clientX, event.clientY);
|
|
4962
|
+
};
|
|
4963
|
+
const onPointerUp = (event) => {
|
|
4964
|
+
draggingRef.current = false;
|
|
4965
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
4966
|
+
};
|
|
4967
|
+
const onKeyDown = (event) => {
|
|
4968
|
+
const decKey = isHorizontal ? Keys.ArrowLeft : Keys.ArrowUp;
|
|
4969
|
+
const incKey = isHorizontal ? Keys.ArrowRight : Keys.ArrowDown;
|
|
4970
|
+
if (event.key === decKey) {
|
|
4971
|
+
event.preventDefault();
|
|
4972
|
+
setCurrent(clamp$2(value - step, min, max));
|
|
4973
|
+
} else if (event.key === incKey) {
|
|
4974
|
+
event.preventDefault();
|
|
4975
|
+
setCurrent(clamp$2(value + step, min, max));
|
|
4976
|
+
} else if (event.key === Keys.Home) {
|
|
4977
|
+
event.preventDefault();
|
|
4978
|
+
setCurrent(min);
|
|
4979
|
+
} else if (event.key === Keys.End) {
|
|
4980
|
+
event.preventDefault();
|
|
4981
|
+
setCurrent(max);
|
|
4982
|
+
}
|
|
4983
|
+
};
|
|
4984
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4985
|
+
ref: containerRefs,
|
|
4986
|
+
className: cx("pf-resizable", `pf-resizable--${orientation}`, className),
|
|
4987
|
+
...props,
|
|
4988
|
+
children: [
|
|
4989
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4990
|
+
className: "pf-resizable__panel",
|
|
4991
|
+
style: { flexBasis: `${value}%` },
|
|
4992
|
+
children: first
|
|
4993
|
+
}),
|
|
4994
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4995
|
+
id: handleId,
|
|
4996
|
+
role: "separator",
|
|
4997
|
+
tabIndex: 0,
|
|
4998
|
+
"aria-orientation": isHorizontal ? "vertical" : "horizontal",
|
|
4999
|
+
"aria-label": handleLabel,
|
|
5000
|
+
"aria-valuenow": value,
|
|
5001
|
+
"aria-valuemin": min,
|
|
5002
|
+
"aria-valuemax": max,
|
|
5003
|
+
className: "pf-resizable__handle",
|
|
5004
|
+
onPointerDown,
|
|
5005
|
+
onPointerMove,
|
|
5006
|
+
onPointerUp,
|
|
5007
|
+
onKeyDown,
|
|
5008
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5009
|
+
className: "pf-resizable__grip",
|
|
5010
|
+
"aria-hidden": true
|
|
5011
|
+
})
|
|
5012
|
+
}),
|
|
5013
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5014
|
+
className: "pf-resizable__panel pf-resizable__panel--fill",
|
|
5015
|
+
children: second
|
|
5016
|
+
})
|
|
5017
|
+
]
|
|
5018
|
+
});
|
|
5019
|
+
});
|
|
5020
|
+
Resizable.displayName = "Resizable";
|
|
5021
|
+
//#endregion
|
|
4714
5022
|
//#region src/components/RichTextEditor/RichTextEditor.tsx
|
|
4715
5023
|
var stripOuterPTags = (html) => {
|
|
4716
5024
|
if (!html) return "";
|
|
@@ -4871,6 +5179,18 @@ var RichTextEditor = (0, react.forwardRef)(({ id, label, description, error, val
|
|
|
4871
5179
|
});
|
|
4872
5180
|
RichTextEditor.displayName = "RichTextEditor";
|
|
4873
5181
|
//#endregion
|
|
5182
|
+
//#region src/components/ScrollArea/ScrollArea.tsx
|
|
5183
|
+
var ScrollArea = (0, react.forwardRef)(function ScrollArea({ className, orientation = "vertical", focusable = true, tabIndex, children, ...props }, ref) {
|
|
5184
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5185
|
+
ref,
|
|
5186
|
+
className: cx("pf-scroll-area", `pf-scroll-area--${orientation}`, className),
|
|
5187
|
+
tabIndex: tabIndex ?? (focusable ? 0 : void 0),
|
|
5188
|
+
...props,
|
|
5189
|
+
children
|
|
5190
|
+
});
|
|
5191
|
+
});
|
|
5192
|
+
ScrollArea.displayName = "ScrollArea";
|
|
5193
|
+
//#endregion
|
|
4874
5194
|
//#region src/components/SectionFooter/SectionFooter.tsx
|
|
4875
5195
|
var SectionFooter = (0, react.forwardRef)(function SectionFooter({ className, heading, description, actions, divider = true, align = "between", children, ...props }, ref) {
|
|
4876
5196
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
@@ -5592,6 +5912,111 @@ var Tag = (0, react.forwardRef)(({ className, variant = "neutral", dismissible =
|
|
|
5592
5912
|
}));
|
|
5593
5913
|
Tag.displayName = "Tag";
|
|
5594
5914
|
//#endregion
|
|
5915
|
+
//#region src/components/TagInput/TagInput.tsx
|
|
5916
|
+
var TagInput = (0, react.forwardRef)(function TagInput({ id, value, defaultValue, onValueChange, label, description, error, placeholder = "Add a tag…", max, allowDuplicates = false, delimiters = [Keys.Enter, ","], validate, tagVariant = "neutral", name, required, disabled, className, "aria-describedby": ariaDescribedBy, ...props }, ref) {
|
|
5917
|
+
const generatedId = (0, react.useId)();
|
|
5918
|
+
const fieldId = id ?? generatedId;
|
|
5919
|
+
const descriptionId = description ? `${fieldId}-description` : void 0;
|
|
5920
|
+
const errorId = error ? `${fieldId}-error` : void 0;
|
|
5921
|
+
const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId);
|
|
5922
|
+
const [tags, setTags] = useControllableState({
|
|
5923
|
+
value,
|
|
5924
|
+
defaultValue: defaultValue ?? [],
|
|
5925
|
+
onChange: onValueChange
|
|
5926
|
+
});
|
|
5927
|
+
const currentTags = tags ?? [];
|
|
5928
|
+
const [draft, setDraft] = (0, react.useState)("");
|
|
5929
|
+
const inputRef = (0, react.useRef)(null);
|
|
5930
|
+
const inputRefs = useComposedRefs(inputRef, ref);
|
|
5931
|
+
const atMax = max !== void 0 && currentTags.length >= max;
|
|
5932
|
+
const addTag = (raw) => {
|
|
5933
|
+
const tag = raw.trim();
|
|
5934
|
+
if (!tag) return;
|
|
5935
|
+
if (atMax) return;
|
|
5936
|
+
if (validate && !validate(tag)) return;
|
|
5937
|
+
const exists = currentTags.some((t) => t.toLowerCase() === tag.toLowerCase());
|
|
5938
|
+
if (!allowDuplicates && exists) {
|
|
5939
|
+
setDraft("");
|
|
5940
|
+
return;
|
|
5941
|
+
}
|
|
5942
|
+
setTags([...currentTags, tag]);
|
|
5943
|
+
setDraft("");
|
|
5944
|
+
};
|
|
5945
|
+
const removeTag = (index) => {
|
|
5946
|
+
setTags(currentTags.filter((_, i) => i !== index));
|
|
5947
|
+
};
|
|
5948
|
+
const onKeyDown = (event) => {
|
|
5949
|
+
if (disabled) return;
|
|
5950
|
+
if (delimiters.includes(event.key)) {
|
|
5951
|
+
if (draft.trim()) {
|
|
5952
|
+
event.preventDefault();
|
|
5953
|
+
addTag(draft);
|
|
5954
|
+
} else if (event.key !== Keys.Enter) event.preventDefault();
|
|
5955
|
+
return;
|
|
5956
|
+
}
|
|
5957
|
+
if (event.key === "Backspace" && draft === "" && currentTags.length > 0) {
|
|
5958
|
+
event.preventDefault();
|
|
5959
|
+
removeTag(currentTags.length - 1);
|
|
5960
|
+
}
|
|
5961
|
+
};
|
|
5962
|
+
const onPaste = (event) => {
|
|
5963
|
+
const text = event.clipboardData.getData("text");
|
|
5964
|
+
if (!/[,\n\t]/.test(text)) return;
|
|
5965
|
+
event.preventDefault();
|
|
5966
|
+
text.split(/[,\n\t]+/).map((t) => t.trim()).filter(Boolean).forEach((t) => addTag(t));
|
|
5967
|
+
};
|
|
5968
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
|
|
5969
|
+
labelFor: fieldId,
|
|
5970
|
+
label,
|
|
5971
|
+
description,
|
|
5972
|
+
descriptionId,
|
|
5973
|
+
error,
|
|
5974
|
+
errorId,
|
|
5975
|
+
required,
|
|
5976
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5977
|
+
className: cx("pf-taginput", error && "pf-taginput--invalid", disabled && "pf-taginput--disabled"),
|
|
5978
|
+
onClick: () => inputRef.current?.focus(),
|
|
5979
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("ul", {
|
|
5980
|
+
className: "pf-taginput__tags",
|
|
5981
|
+
children: [currentTags.map((tag, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
5982
|
+
className: "pf-taginput__tag",
|
|
5983
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
|
|
5984
|
+
variant: tagVariant,
|
|
5985
|
+
dismissible: !disabled,
|
|
5986
|
+
onDismiss: () => removeTag(index),
|
|
5987
|
+
children: tag
|
|
5988
|
+
})
|
|
5989
|
+
}, `${tag}-${index}`)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
5990
|
+
className: "pf-taginput__field",
|
|
5991
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
5992
|
+
...props,
|
|
5993
|
+
id: fieldId,
|
|
5994
|
+
ref: inputRefs,
|
|
5995
|
+
type: "text",
|
|
5996
|
+
className: cx("pf-taginput__input", className),
|
|
5997
|
+
value: draft,
|
|
5998
|
+
placeholder: currentTags.length === 0 ? placeholder : "",
|
|
5999
|
+
disabled: disabled || atMax,
|
|
6000
|
+
required: required && currentTags.length === 0,
|
|
6001
|
+
autoComplete: "off",
|
|
6002
|
+
"aria-invalid": error ? true : void 0,
|
|
6003
|
+
"aria-describedby": describedBy,
|
|
6004
|
+
onChange: (event) => setDraft(event.target.value),
|
|
6005
|
+
onKeyDown,
|
|
6006
|
+
onPaste,
|
|
6007
|
+
onBlur: () => addTag(draft)
|
|
6008
|
+
})
|
|
6009
|
+
})]
|
|
6010
|
+
}), name ? currentTags.map((tag, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
6011
|
+
type: "hidden",
|
|
6012
|
+
name,
|
|
6013
|
+
value: tag
|
|
6014
|
+
}, index)) : null]
|
|
6015
|
+
})
|
|
6016
|
+
});
|
|
6017
|
+
});
|
|
6018
|
+
TagInput.displayName = "TagInput";
|
|
6019
|
+
//#endregion
|
|
5595
6020
|
//#region src/components/Table/Table.tsx
|
|
5596
6021
|
function Table({ className, columns, rows, caption, dense = false, striped = false, hoverable = true, stickyHeader = false, emptyState = "No data available.", defaultSortState, sortState, onSortStateChange, getRowKey, ...props }) {
|
|
5597
6022
|
const [internalSortState, setInternalSortState] = (0, react.useState)(defaultSortState);
|
|
@@ -5845,6 +6270,272 @@ var Textarea = (0, react.forwardRef)(({ id, label, description, error, className
|
|
|
5845
6270
|
});
|
|
5846
6271
|
Textarea.displayName = "Textarea";
|
|
5847
6272
|
//#endregion
|
|
6273
|
+
//#region src/components/Timeline/Timeline.tsx
|
|
6274
|
+
var Timeline = (0, react.forwardRef)(function Timeline({ className, items, ...props }, ref) {
|
|
6275
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
|
|
6276
|
+
ref,
|
|
6277
|
+
className: cx("pf-timeline", className),
|
|
6278
|
+
...props,
|
|
6279
|
+
children: items.map((item, index) => {
|
|
6280
|
+
const tone = item.tone ?? "default";
|
|
6281
|
+
const isLast = index === items.length - 1;
|
|
6282
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
6283
|
+
className: cx("pf-timeline__item", isLast && "pf-timeline__item--last"),
|
|
6284
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6285
|
+
className: "pf-timeline__rail",
|
|
6286
|
+
"aria-hidden": true,
|
|
6287
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6288
|
+
className: cx("pf-timeline__marker", `pf-timeline__marker--${tone}`),
|
|
6289
|
+
children: item.icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6290
|
+
className: "pf-timeline__marker-icon",
|
|
6291
|
+
children: item.icon
|
|
6292
|
+
}) : null
|
|
6293
|
+
}), !isLast ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "pf-timeline__connector" }) : null]
|
|
6294
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6295
|
+
className: "pf-timeline__content",
|
|
6296
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6297
|
+
className: "pf-timeline__header",
|
|
6298
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
6299
|
+
className: "pf-timeline__title",
|
|
6300
|
+
children: item.title
|
|
6301
|
+
}), item.timestamp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6302
|
+
className: "pf-timeline__timestamp",
|
|
6303
|
+
children: item.timestamp
|
|
6304
|
+
}) : null]
|
|
6305
|
+
}), item.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6306
|
+
className: "pf-timeline__description",
|
|
6307
|
+
children: item.description
|
|
6308
|
+
}) : null]
|
|
6309
|
+
})]
|
|
6310
|
+
}, item.id ?? index);
|
|
6311
|
+
})
|
|
6312
|
+
});
|
|
6313
|
+
});
|
|
6314
|
+
Timeline.displayName = "Timeline";
|
|
6315
|
+
//#endregion
|
|
6316
|
+
//#region src/components/TimePicker/TimePicker.tsx
|
|
6317
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
6318
|
+
var parseValue = (value) => {
|
|
6319
|
+
const match = /^(\d{1,2}):(\d{2})$/.exec(value.trim());
|
|
6320
|
+
if (!match) return {
|
|
6321
|
+
hour: null,
|
|
6322
|
+
minute: null
|
|
6323
|
+
};
|
|
6324
|
+
const hour = Number(match[1]);
|
|
6325
|
+
const minute = Number(match[2]);
|
|
6326
|
+
if (hour > 23 || minute > 59) return {
|
|
6327
|
+
hour: null,
|
|
6328
|
+
minute: null
|
|
6329
|
+
};
|
|
6330
|
+
return {
|
|
6331
|
+
hour,
|
|
6332
|
+
minute
|
|
6333
|
+
};
|
|
6334
|
+
};
|
|
6335
|
+
var formatDisplay = (parts, hourCycle) => {
|
|
6336
|
+
if (parts.hour === null || parts.minute === null) return "";
|
|
6337
|
+
if (hourCycle === 24) return `${pad(parts.hour)}:${pad(parts.minute)}`;
|
|
6338
|
+
const meridiem = parts.hour < 12 ? "AM" : "PM";
|
|
6339
|
+
return `${parts.hour % 12 === 0 ? 12 : parts.hour % 12}:${pad(parts.minute)} ${meridiem}`;
|
|
6340
|
+
};
|
|
6341
|
+
var range = (length, step = 1) => Array.from({ length: Math.ceil(length / step) }, (_, i) => i * step);
|
|
6342
|
+
var TimePicker = (0, react.forwardRef)(function TimePicker({ id, value, defaultValue, onValueChange, hourCycle = 24, minuteStep = 1, label, description, error, placeholder = "Select time", required, name, disabled, className, "aria-describedby": ariaDescribedBy, ...props }, ref) {
|
|
6343
|
+
const generatedId = (0, react.useId)();
|
|
6344
|
+
const fieldId = id ?? generatedId;
|
|
6345
|
+
const panelId = `${fieldId}-panel`;
|
|
6346
|
+
const descriptionId = description ? `${fieldId}-description` : void 0;
|
|
6347
|
+
const errorId = error ? `${fieldId}-error` : void 0;
|
|
6348
|
+
const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId);
|
|
6349
|
+
const [current, setCurrent] = useControllableState({
|
|
6350
|
+
value,
|
|
6351
|
+
defaultValue: defaultValue ?? "",
|
|
6352
|
+
onChange: onValueChange
|
|
6353
|
+
});
|
|
6354
|
+
const parts = parseValue(current ?? "");
|
|
6355
|
+
const disclosure = useDisclosure({ disabled });
|
|
6356
|
+
const isOpen = disclosure.isOpen ?? false;
|
|
6357
|
+
const rootRef = (0, react.useRef)(null);
|
|
6358
|
+
const triggerRefs = useComposedRefs((0, react.useRef)(null), ref);
|
|
6359
|
+
const panelRef = (0, react.useRef)(null);
|
|
6360
|
+
const { isMounted, isExiting } = usePresence(isOpen, 160);
|
|
6361
|
+
const panelStyle = useAnchoredPosition({
|
|
6362
|
+
anchorRef: rootRef,
|
|
6363
|
+
floatingRef: panelRef,
|
|
6364
|
+
enabled: isOpen,
|
|
6365
|
+
matchAnchorWidth: false,
|
|
6366
|
+
flip: true
|
|
6367
|
+
});
|
|
6368
|
+
useOutsideInteraction({
|
|
6369
|
+
refs: [rootRef, panelRef],
|
|
6370
|
+
enabled: isOpen,
|
|
6371
|
+
onInteractOutside: () => disclosure.close()
|
|
6372
|
+
});
|
|
6373
|
+
const hours = hourCycle === 24 ? range(24) : range(12).map((h) => h + 1);
|
|
6374
|
+
const minutes = range(60, minuteStep);
|
|
6375
|
+
const meridiems = ["AM", "PM"];
|
|
6376
|
+
const selectedMeridiem = parts.hour === null ? null : parts.hour < 12 ? "AM" : "PM";
|
|
6377
|
+
const selectedHourDisplay = parts.hour === null ? null : hourCycle === 24 ? parts.hour : parts.hour % 12 === 0 ? 12 : parts.hour % 12;
|
|
6378
|
+
const emit = (next) => {
|
|
6379
|
+
if (next.hour === null || next.minute === null) return;
|
|
6380
|
+
setCurrent(`${pad(next.hour)}:${pad(next.minute)}`);
|
|
6381
|
+
};
|
|
6382
|
+
const selectHour = (h) => {
|
|
6383
|
+
let hour24;
|
|
6384
|
+
if (hourCycle === 24) hour24 = h;
|
|
6385
|
+
else {
|
|
6386
|
+
const meridiem = selectedMeridiem ?? "AM";
|
|
6387
|
+
const base = h % 12;
|
|
6388
|
+
hour24 = meridiem === "PM" ? base + 12 : base;
|
|
6389
|
+
}
|
|
6390
|
+
emit({
|
|
6391
|
+
hour: hour24,
|
|
6392
|
+
minute: parts.minute ?? 0
|
|
6393
|
+
});
|
|
6394
|
+
};
|
|
6395
|
+
const selectMinute = (m) => {
|
|
6396
|
+
emit({
|
|
6397
|
+
hour: parts.hour ?? (hourCycle === 12 ? 0 : 0),
|
|
6398
|
+
minute: m
|
|
6399
|
+
});
|
|
6400
|
+
};
|
|
6401
|
+
const selectMeridiem = (mer) => {
|
|
6402
|
+
const base = (parts.hour ?? 0) % 12;
|
|
6403
|
+
emit({
|
|
6404
|
+
hour: mer === "PM" ? base + 12 : base,
|
|
6405
|
+
minute: parts.minute ?? 0
|
|
6406
|
+
});
|
|
6407
|
+
};
|
|
6408
|
+
const display = formatDisplay(parts, hourCycle);
|
|
6409
|
+
(0, react.useEffect)(() => {
|
|
6410
|
+
if (!isMounted) return;
|
|
6411
|
+
const frame = requestAnimationFrame(() => {
|
|
6412
|
+
panelRef.current?.querySelectorAll("[data-selected=\"true\"]").forEach((el) => el.scrollIntoView({ block: "center" }));
|
|
6413
|
+
});
|
|
6414
|
+
return () => cancelAnimationFrame(frame);
|
|
6415
|
+
}, [isMounted]);
|
|
6416
|
+
const onColumnKeyDown = (event) => {
|
|
6417
|
+
if (event.key !== Keys.ArrowDown && event.key !== Keys.ArrowUp) return;
|
|
6418
|
+
const buttons = Array.from(event.currentTarget.querySelectorAll("button:not(:disabled)"));
|
|
6419
|
+
const index = buttons.indexOf(document.activeElement);
|
|
6420
|
+
if (index === -1) return;
|
|
6421
|
+
event.preventDefault();
|
|
6422
|
+
buttons[event.key === Keys.ArrowDown ? Math.min(index + 1, buttons.length - 1) : Math.max(index - 1, 0)]?.focus();
|
|
6423
|
+
};
|
|
6424
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
|
|
6425
|
+
labelFor: fieldId,
|
|
6426
|
+
label,
|
|
6427
|
+
description,
|
|
6428
|
+
descriptionId,
|
|
6429
|
+
error,
|
|
6430
|
+
errorId,
|
|
6431
|
+
required,
|
|
6432
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6433
|
+
className: "pf-timepicker",
|
|
6434
|
+
ref: rootRef,
|
|
6435
|
+
children: [
|
|
6436
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
6437
|
+
...props,
|
|
6438
|
+
id: fieldId,
|
|
6439
|
+
ref: triggerRefs,
|
|
6440
|
+
type: "button",
|
|
6441
|
+
className: cx("pf-timepicker__trigger", isOpen && "pf-timepicker__trigger--open", error && "pf-timepicker__trigger--invalid", className),
|
|
6442
|
+
disabled,
|
|
6443
|
+
"aria-haspopup": "dialog",
|
|
6444
|
+
"aria-expanded": isOpen,
|
|
6445
|
+
"aria-required": required || void 0,
|
|
6446
|
+
"aria-invalid": error ? true : void 0,
|
|
6447
|
+
"aria-describedby": describedBy,
|
|
6448
|
+
onClick: () => disclosure.toggle(),
|
|
6449
|
+
onKeyDown: (event) => {
|
|
6450
|
+
if (event.key === Keys.Escape) disclosure.close();
|
|
6451
|
+
},
|
|
6452
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6453
|
+
className: cx("pf-timepicker__value", !display && "pf-timepicker__value--placeholder"),
|
|
6454
|
+
children: display || placeholder
|
|
6455
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6456
|
+
"aria-hidden": true,
|
|
6457
|
+
className: "pf-timepicker__icon",
|
|
6458
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
6459
|
+
name: "clock",
|
|
6460
|
+
"aria-hidden": true
|
|
6461
|
+
})
|
|
6462
|
+
})]
|
|
6463
|
+
}),
|
|
6464
|
+
name ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
6465
|
+
type: "hidden",
|
|
6466
|
+
name,
|
|
6467
|
+
value: current ?? ""
|
|
6468
|
+
}) : null,
|
|
6469
|
+
isMounted && typeof document !== "undefined" ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6470
|
+
id: panelId,
|
|
6471
|
+
ref: panelRef,
|
|
6472
|
+
role: "dialog",
|
|
6473
|
+
"aria-label": label ? `${label} picker` : "Time picker",
|
|
6474
|
+
className: cx("pf-timepicker__panel", isExiting && "pf-timepicker__panel--exiting"),
|
|
6475
|
+
style: panelStyle,
|
|
6476
|
+
children: [
|
|
6477
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6478
|
+
className: "pf-timepicker__column",
|
|
6479
|
+
role: "listbox",
|
|
6480
|
+
"aria-label": "Hour",
|
|
6481
|
+
onKeyDown: onColumnKeyDown,
|
|
6482
|
+
children: hours.map((h) => {
|
|
6483
|
+
const isSel = selectedHourDisplay === h;
|
|
6484
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
6485
|
+
type: "button",
|
|
6486
|
+
role: "option",
|
|
6487
|
+
"aria-selected": isSel,
|
|
6488
|
+
"data-selected": isSel,
|
|
6489
|
+
className: cx("pf-timepicker__option", isSel && "pf-timepicker__option--selected"),
|
|
6490
|
+
onClick: () => selectHour(h),
|
|
6491
|
+
children: pad(h)
|
|
6492
|
+
}, h);
|
|
6493
|
+
})
|
|
6494
|
+
}),
|
|
6495
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6496
|
+
className: "pf-timepicker__column",
|
|
6497
|
+
role: "listbox",
|
|
6498
|
+
"aria-label": "Minute",
|
|
6499
|
+
onKeyDown: onColumnKeyDown,
|
|
6500
|
+
children: minutes.map((m) => {
|
|
6501
|
+
const isSel = parts.minute === m;
|
|
6502
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
6503
|
+
type: "button",
|
|
6504
|
+
role: "option",
|
|
6505
|
+
"aria-selected": isSel,
|
|
6506
|
+
"data-selected": isSel,
|
|
6507
|
+
className: cx("pf-timepicker__option", isSel && "pf-timepicker__option--selected"),
|
|
6508
|
+
onClick: () => selectMinute(m),
|
|
6509
|
+
children: pad(m)
|
|
6510
|
+
}, m);
|
|
6511
|
+
})
|
|
6512
|
+
}),
|
|
6513
|
+
hourCycle === 12 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6514
|
+
className: "pf-timepicker__column pf-timepicker__column--meridiem",
|
|
6515
|
+
role: "listbox",
|
|
6516
|
+
"aria-label": "AM or PM",
|
|
6517
|
+
onKeyDown: onColumnKeyDown,
|
|
6518
|
+
children: meridiems.map((mer) => {
|
|
6519
|
+
const isSel = selectedMeridiem === mer;
|
|
6520
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
6521
|
+
type: "button",
|
|
6522
|
+
role: "option",
|
|
6523
|
+
"aria-selected": isSel,
|
|
6524
|
+
"data-selected": isSel,
|
|
6525
|
+
className: cx("pf-timepicker__option", isSel && "pf-timepicker__option--selected"),
|
|
6526
|
+
onClick: () => selectMeridiem(mer),
|
|
6527
|
+
children: mer
|
|
6528
|
+
}, mer);
|
|
6529
|
+
})
|
|
6530
|
+
}) : null
|
|
6531
|
+
]
|
|
6532
|
+
}), document.body) : null
|
|
6533
|
+
]
|
|
6534
|
+
})
|
|
6535
|
+
});
|
|
6536
|
+
});
|
|
6537
|
+
TimePicker.displayName = "TimePicker";
|
|
6538
|
+
//#endregion
|
|
5848
6539
|
//#region src/components/Toast/Toast.tsx
|
|
5849
6540
|
var _emit = null;
|
|
5850
6541
|
function ToastItem({ entry, onRemove }) {
|
|
@@ -5969,6 +6660,69 @@ toast.danger = (opts) => toast({
|
|
|
5969
6660
|
variant: "danger"
|
|
5970
6661
|
});
|
|
5971
6662
|
//#endregion
|
|
6663
|
+
//#region src/components/Toolbar/Toolbar.tsx
|
|
6664
|
+
var ITEM_SELECTOR = "button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [data-toolbar-item]:not([aria-disabled=\"true\"])";
|
|
6665
|
+
var Toolbar = (0, react.forwardRef)(function Toolbar({ className, orientation = "horizontal", onKeyDown, onFocus, children, ...props }, ref) {
|
|
6666
|
+
const rootRef = (0, react.useRef)(null);
|
|
6667
|
+
const refs = useComposedRefs(rootRef, ref);
|
|
6668
|
+
const getItems = () => rootRef.current ? Array.from(rootRef.current.querySelectorAll(ITEM_SELECTOR)) : [];
|
|
6669
|
+
(0, react.useEffect)(() => {
|
|
6670
|
+
const items = getItems();
|
|
6671
|
+
if (items.length === 0) return;
|
|
6672
|
+
const current = items.find((el) => el.getAttribute("tabindex") === "0");
|
|
6673
|
+
items.forEach((el, i) => {
|
|
6674
|
+
el.tabIndex = (current ? el === current : i === 0) ? 0 : -1;
|
|
6675
|
+
});
|
|
6676
|
+
});
|
|
6677
|
+
const handleFocus = (event) => {
|
|
6678
|
+
const items = getItems();
|
|
6679
|
+
const target = event.target;
|
|
6680
|
+
if (items.includes(target)) items.forEach((el) => {
|
|
6681
|
+
el.tabIndex = el === target ? 0 : -1;
|
|
6682
|
+
});
|
|
6683
|
+
onFocus?.(event);
|
|
6684
|
+
};
|
|
6685
|
+
const handleKeyDown = (event) => {
|
|
6686
|
+
onKeyDown?.(event);
|
|
6687
|
+
if (event.defaultPrevented) return;
|
|
6688
|
+
const nextKey = orientation === "vertical" ? Keys.ArrowDown : Keys.ArrowRight;
|
|
6689
|
+
const prevKey = orientation === "vertical" ? Keys.ArrowUp : Keys.ArrowLeft;
|
|
6690
|
+
const items = getItems();
|
|
6691
|
+
if (items.length === 0) return;
|
|
6692
|
+
const currentIndex = items.indexOf(document.activeElement);
|
|
6693
|
+
if (currentIndex === -1) return;
|
|
6694
|
+
let nextIndex = -1;
|
|
6695
|
+
if (event.key === nextKey) nextIndex = (currentIndex + 1) % items.length;
|
|
6696
|
+
else if (event.key === prevKey) nextIndex = (currentIndex - 1 + items.length) % items.length;
|
|
6697
|
+
else if (event.key === Keys.Home) nextIndex = 0;
|
|
6698
|
+
else if (event.key === Keys.End) nextIndex = items.length - 1;
|
|
6699
|
+
if (nextIndex >= 0) {
|
|
6700
|
+
event.preventDefault();
|
|
6701
|
+
items[nextIndex].focus();
|
|
6702
|
+
}
|
|
6703
|
+
};
|
|
6704
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6705
|
+
ref: refs,
|
|
6706
|
+
role: "toolbar",
|
|
6707
|
+
"aria-orientation": orientation,
|
|
6708
|
+
className: cx("pf-toolbar", `pf-toolbar--${orientation}`, className),
|
|
6709
|
+
onKeyDown: handleKeyDown,
|
|
6710
|
+
onFocus: handleFocus,
|
|
6711
|
+
...props,
|
|
6712
|
+
children
|
|
6713
|
+
});
|
|
6714
|
+
});
|
|
6715
|
+
Toolbar.displayName = "Toolbar";
|
|
6716
|
+
var ToolbarSeparator = (0, react.forwardRef)(function ToolbarSeparator({ className, ...props }, ref) {
|
|
6717
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6718
|
+
ref,
|
|
6719
|
+
role: "separator",
|
|
6720
|
+
className: cx("pf-toolbar__separator", className),
|
|
6721
|
+
...props
|
|
6722
|
+
});
|
|
6723
|
+
});
|
|
6724
|
+
ToolbarSeparator.displayName = "ToolbarSeparator";
|
|
6725
|
+
//#endregion
|
|
5972
6726
|
//#region src/components/Tooltip/Tooltip.tsx
|
|
5973
6727
|
var GAP = 10;
|
|
5974
6728
|
var VIEWPORT_MARGIN = 8;
|
|
@@ -6388,6 +7142,21 @@ var VideoPlayer = (0, react.forwardRef)(({ id, label, description, error, aspect
|
|
|
6388
7142
|
});
|
|
6389
7143
|
VideoPlayer.displayName = "VideoPlayer";
|
|
6390
7144
|
//#endregion
|
|
7145
|
+
//#region src/components/VisuallyHidden/VisuallyHidden.tsx
|
|
7146
|
+
/**
|
|
7147
|
+
* Hides content visually while keeping it available to screen readers and other
|
|
7148
|
+
* assistive technology. Use for labels, instructions, and status text that are
|
|
7149
|
+
* implied visually but need to be announced.
|
|
7150
|
+
*/
|
|
7151
|
+
var VisuallyHidden = (0, react.forwardRef)(function VisuallyHidden({ as = "span", focusable = false, className, ...props }, ref) {
|
|
7152
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(as, {
|
|
7153
|
+
ref,
|
|
7154
|
+
className: cx("pf-visually-hidden", focusable && "pf-visually-hidden--focusable", className),
|
|
7155
|
+
...props
|
|
7156
|
+
});
|
|
7157
|
+
});
|
|
7158
|
+
VisuallyHidden.displayName = "VisuallyHidden";
|
|
7159
|
+
//#endregion
|
|
6391
7160
|
exports.Accordion = Accordion;
|
|
6392
7161
|
exports.Alert = Alert;
|
|
6393
7162
|
exports.AreaChart = AreaChart;
|
|
@@ -6407,9 +7176,11 @@ exports.CardHeader = CardHeader;
|
|
|
6407
7176
|
exports.Carousel = Carousel;
|
|
6408
7177
|
exports.Checkbox = Checkbox;
|
|
6409
7178
|
exports.CodeSnippet = CodeSnippet;
|
|
7179
|
+
exports.Collapsible = Collapsible;
|
|
6410
7180
|
exports.Combobox = Combobox;
|
|
6411
7181
|
exports.CommandPalette = CommandPalette;
|
|
6412
7182
|
exports.ContentDivider = ContentDivider;
|
|
7183
|
+
exports.ContextMenu = ContextMenu;
|
|
6413
7184
|
exports.CreditCard = CreditCard;
|
|
6414
7185
|
exports.DatePicker = DatePicker;
|
|
6415
7186
|
exports.DateRangePicker = DateRangePicker;
|
|
@@ -6451,7 +7222,9 @@ exports.RadioButton = RadioButton;
|
|
|
6451
7222
|
exports.RadioGroup = RadioGroup;
|
|
6452
7223
|
exports.RatingBadge = RatingBadge;
|
|
6453
7224
|
exports.RatingStars = RatingStars;
|
|
7225
|
+
exports.Resizable = Resizable;
|
|
6454
7226
|
exports.RichTextEditor = RichTextEditor;
|
|
7227
|
+
exports.ScrollArea = ScrollArea;
|
|
6455
7228
|
exports.SectionFooter = SectionFooter;
|
|
6456
7229
|
exports.SectionHeader = SectionHeader;
|
|
6457
7230
|
exports.Select = Select;
|
|
@@ -6463,12 +7236,18 @@ exports.Switch = Switch;
|
|
|
6463
7236
|
exports.Table = Table;
|
|
6464
7237
|
exports.Tabs = Tabs;
|
|
6465
7238
|
exports.Tag = Tag;
|
|
7239
|
+
exports.TagInput = TagInput;
|
|
6466
7240
|
exports.Textarea = Textarea;
|
|
7241
|
+
exports.TimePicker = TimePicker;
|
|
7242
|
+
exports.Timeline = Timeline;
|
|
6467
7243
|
exports.ToastProvider = ToastProvider;
|
|
7244
|
+
exports.Toolbar = Toolbar;
|
|
7245
|
+
exports.ToolbarSeparator = ToolbarSeparator;
|
|
6468
7246
|
exports.Tooltip = Tooltip;
|
|
6469
7247
|
exports.TreeView = TreeView;
|
|
6470
7248
|
exports.UtilityButton = UtilityButton;
|
|
6471
7249
|
exports.VideoPlayer = VideoPlayer;
|
|
7250
|
+
exports.VisuallyHidden = VisuallyHidden;
|
|
6472
7251
|
exports.composeDescribedBy = composeDescribedBy;
|
|
6473
7252
|
exports.getAvailableIconNames = getAvailableIconNames;
|
|
6474
7253
|
exports.getCustomIconNames = getCustomIconNames;
|