@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.
Files changed (63) hide show
  1. package/dist/components/Badge/Badge.css +4 -0
  2. package/dist/components/Button/Button.css +7 -0
  3. package/dist/components/Collapsible/Collapsible.css +86 -0
  4. package/dist/components/Collapsible/Collapsible2.js +65 -0
  5. package/dist/components/ContextMenu/ContextMenu.css +122 -0
  6. package/dist/components/ContextMenu/ContextMenu2.js +155 -0
  7. package/dist/components/Icon/Icon2.js +17 -0
  8. package/dist/components/InlineCTA/InlineCTA.css +4 -0
  9. package/dist/components/Modal/Modal.css +6 -1
  10. package/dist/components/Resizable/Resizable.css +79 -0
  11. package/dist/components/Resizable/Resizable2.js +101 -0
  12. package/dist/components/ScrollArea/ScrollArea.css +54 -0
  13. package/dist/components/ScrollArea/ScrollArea2.js +18 -0
  14. package/dist/components/Tag/Tag.css +4 -0
  15. package/dist/components/TagInput/TagInput.css +72 -0
  16. package/dist/components/TagInput/TagInput2.js +116 -0
  17. package/dist/components/TimePicker/TimePicker.css +179 -0
  18. package/dist/components/TimePicker/TimePicker2.js +239 -0
  19. package/dist/components/Timeline/Timeline.css +128 -0
  20. package/dist/components/Timeline/Timeline2.js +49 -0
  21. package/dist/components/Toolbar/Toolbar.css +37 -0
  22. package/dist/components/Toolbar/Toolbar2.js +71 -0
  23. package/dist/components/UtilityButton/UtilityButton.css +6 -6
  24. package/dist/components/VisuallyHidden/VisuallyHidden.css +26 -0
  25. package/dist/components/VisuallyHidden/VisuallyHidden2.js +21 -0
  26. package/dist/index.cjs +786 -7
  27. package/dist/index.js +10 -1
  28. package/dist/src/components/Badge/Badge.d.ts +1 -1
  29. package/dist/src/components/Button/Button.d.ts +1 -1
  30. package/dist/src/components/Collapsible/Collapsible.d.ts +11 -0
  31. package/dist/src/components/Collapsible/Collapsible.test.d.ts +1 -0
  32. package/dist/src/components/Collapsible/index.d.ts +1 -0
  33. package/dist/src/components/ContextMenu/ContextMenu.d.ts +20 -0
  34. package/dist/src/components/ContextMenu/ContextMenu.test.d.ts +1 -0
  35. package/dist/src/components/ContextMenu/index.d.ts +1 -0
  36. package/dist/src/components/InlineCTA/InlineCTA.d.ts +1 -1
  37. package/dist/src/components/Resizable/Resizable.d.ts +19 -0
  38. package/dist/src/components/Resizable/Resizable.test.d.ts +1 -0
  39. package/dist/src/components/Resizable/index.d.ts +1 -0
  40. package/dist/src/components/ScrollArea/ScrollArea.d.ts +12 -0
  41. package/dist/src/components/ScrollArea/ScrollArea.test.d.ts +1 -0
  42. package/dist/src/components/ScrollArea/index.d.ts +1 -0
  43. package/dist/src/components/Tag/Tag.d.ts +1 -1
  44. package/dist/src/components/TagInput/TagInput.d.ts +23 -0
  45. package/dist/src/components/TagInput/TagInput.test.d.ts +1 -0
  46. package/dist/src/components/TagInput/index.d.ts +1 -0
  47. package/dist/src/components/TimePicker/TimePicker.d.ts +18 -0
  48. package/dist/src/components/TimePicker/TimePicker.test.d.ts +1 -0
  49. package/dist/src/components/TimePicker/index.d.ts +1 -0
  50. package/dist/src/components/Timeline/Timeline.d.ts +16 -0
  51. package/dist/src/components/Timeline/Timeline.test.d.ts +1 -0
  52. package/dist/src/components/Timeline/index.d.ts +1 -0
  53. package/dist/src/components/Toolbar/Toolbar.d.ts +8 -0
  54. package/dist/src/components/Toolbar/Toolbar.test.d.ts +1 -0
  55. package/dist/src/components/Toolbar/index.d.ts +1 -0
  56. package/dist/src/components/UtilityButton/UtilityButton.d.ts +1 -1
  57. package/dist/src/components/VisuallyHidden/VisuallyHidden.d.ts +15 -0
  58. package/dist/src/components/VisuallyHidden/VisuallyHidden.test.d.ts +1 -0
  59. package/dist/src/components/VisuallyHidden/index.d.ts +1 -0
  60. package/dist/src/index.d.ts +9 -0
  61. package/dist/styles/theme.css +89 -4
  62. package/dist/styles.css +903 -11
  63. package/package.json +1 -1
@@ -24,3 +24,7 @@
24
24
  background: var(--pf-badge-warning-background, var(--color-semantic-status-warning-background));
25
25
  color: var(--pf-badge-warning-foreground, var(--color-semantic-status-warning-foreground));
26
26
  }
27
+ .pf-badge--danger {
28
+ background: var(--pf-badge-danger-background, var(--color-semantic-status-danger-background));
29
+ color: var(--pf-badge-danger-foreground, var(--color-semantic-status-danger-foreground));
30
+ }
@@ -70,6 +70,13 @@
70
70
  .pf-button--ghost:hover:not(:disabled) {
71
71
  background: var(--pf-button-ghost-bg-hover);
72
72
  }
73
+ .pf-button--destructive {
74
+ background: var(--pf-button-destructive-bg);
75
+ color: var(--pf-button-destructive-text);
76
+ }
77
+ .pf-button--destructive:hover:not(:disabled) {
78
+ background: var(--pf-button-destructive-bg-hover);
79
+ }
73
80
 
74
81
  .pf-button--loading:disabled {
75
82
  cursor: wait;
@@ -0,0 +1,86 @@
1
+ .pf-collapsible {
2
+ border: 1px solid var(--pf-collapsible-border);
3
+ border-radius: var(--radius-md);
4
+ }
5
+
6
+ .pf-collapsible__trigger {
7
+ align-items: center;
8
+ background: transparent;
9
+ border: 0;
10
+ border-radius: var(--radius-md);
11
+ color: var(--pf-collapsible-trigger-text);
12
+ cursor: pointer;
13
+ display: flex;
14
+ font: inherit;
15
+ font-weight: var(--font-weight-medium);
16
+ gap: var(--space-2);
17
+ justify-content: space-between;
18
+ padding: var(--space-3);
19
+ text-align: start;
20
+ width: 100%;
21
+ }
22
+
23
+ .pf-collapsible__trigger:hover:not(:disabled) {
24
+ background: var(--pf-collapsible-trigger-hover-bg);
25
+ }
26
+
27
+ .pf-collapsible__trigger:focus-visible {
28
+ box-shadow: var(--pf-collapsible-focus-ring, var(--pf-focus-ring));
29
+ outline: none;
30
+ }
31
+
32
+ .pf-collapsible__trigger:disabled {
33
+ color: var(--pf-control-text-disabled);
34
+ cursor: not-allowed;
35
+ }
36
+
37
+ .pf-collapsible__label {
38
+ min-width: 0;
39
+ }
40
+
41
+ .pf-collapsible__icon {
42
+ align-items: center;
43
+ color: var(--pf-collapsible-icon);
44
+ display: inline-flex;
45
+ flex-shrink: 0;
46
+ transition: transform var(--pf-transition-fast);
47
+ }
48
+
49
+ .pf-collapsible__icon svg {
50
+ display: block;
51
+ height: 16px;
52
+ width: 16px;
53
+ }
54
+
55
+ .pf-collapsible--open .pf-collapsible__icon {
56
+ transform: rotate(180deg);
57
+ }
58
+
59
+ /* Height animation via the grid-template-rows 0fr → 1fr technique. */
60
+ .pf-collapsible__panel {
61
+ display: grid;
62
+ grid-template-rows: 0fr;
63
+ transition: grid-template-rows var(--pf-transition-medium);
64
+ }
65
+
66
+ .pf-collapsible__panel--open {
67
+ grid-template-rows: 1fr;
68
+ }
69
+
70
+ .pf-collapsible__content {
71
+ min-height: 0;
72
+ overflow: hidden;
73
+ }
74
+
75
+ .pf-collapsible__content-inner {
76
+ border-top: 1px solid var(--pf-collapsible-border);
77
+ color: var(--pf-collapsible-content-text);
78
+ padding: var(--space-3);
79
+ }
80
+
81
+ @media (prefers-reduced-motion: reduce) {
82
+ .pf-collapsible__panel,
83
+ .pf-collapsible__icon {
84
+ transition: none;
85
+ }
86
+ }
@@ -0,0 +1,65 @@
1
+ "use client";
2
+ import { Keys } from "../../a11y/index.js";
3
+ import { useDisclosure } from "../../hooks/useDisclosure.js";
4
+ import { cx } from "../../utils/cx.js";
5
+ import { Icon } from "../Icon/Icon2.js";
6
+ import './Collapsible.css';/* empty css */
7
+ import { forwardRef, useId } from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ //#region src/components/Collapsible/Collapsible.tsx
10
+ var Collapsible = forwardRef(function Collapsible({ className, trigger, open, defaultOpen, onOpenChange, disabled = false, showChevron = true, children, ...props }, ref) {
11
+ const baseId = useId();
12
+ const triggerId = `${baseId}-trigger`;
13
+ const contentId = `${baseId}-content`;
14
+ const disclosure = useDisclosure({
15
+ open,
16
+ defaultOpen,
17
+ onOpenChange,
18
+ disabled
19
+ });
20
+ const isOpen = disclosure.isOpen ?? false;
21
+ return /* @__PURE__ */ jsxs("div", {
22
+ ref,
23
+ className: cx("pf-collapsible", isOpen && "pf-collapsible--open", className),
24
+ ...props,
25
+ children: [/* @__PURE__ */ jsxs("button", {
26
+ id: triggerId,
27
+ type: "button",
28
+ className: "pf-collapsible__trigger",
29
+ disabled,
30
+ "aria-expanded": isOpen,
31
+ "aria-controls": contentId,
32
+ onClick: () => disclosure.toggle(),
33
+ onKeyDown: (event) => {
34
+ if (event.key === Keys.Escape && isOpen) disclosure.close();
35
+ },
36
+ children: [/* @__PURE__ */ jsx("span", {
37
+ className: "pf-collapsible__label",
38
+ children: trigger
39
+ }), showChevron ? /* @__PURE__ */ jsx("span", {
40
+ className: "pf-collapsible__icon",
41
+ "aria-hidden": true,
42
+ children: /* @__PURE__ */ jsx(Icon, {
43
+ name: "chevron-down",
44
+ "aria-hidden": true
45
+ })
46
+ }) : null]
47
+ }), /* @__PURE__ */ jsx("div", {
48
+ id: contentId,
49
+ role: "region",
50
+ "aria-labelledby": triggerId,
51
+ className: cx("pf-collapsible__panel", isOpen && "pf-collapsible__panel--open"),
52
+ ...!isOpen ? { inert: true } : {},
53
+ children: /* @__PURE__ */ jsx("div", {
54
+ className: "pf-collapsible__content",
55
+ children: /* @__PURE__ */ jsx("div", {
56
+ className: "pf-collapsible__content-inner",
57
+ children
58
+ })
59
+ })
60
+ })]
61
+ });
62
+ });
63
+ Collapsible.displayName = "Collapsible";
64
+ //#endregion
65
+ export { Collapsible };
@@ -0,0 +1,122 @@
1
+ .pf-context-menu {
2
+ display: contents;
3
+ }
4
+
5
+ .pf-context-menu__menu {
6
+ animation: pf-context-menu-in var(--duration-fast) var(--easing-decelerate);
7
+ background: var(--pf-contextmenu-bg);
8
+ border: 1px solid var(--pf-contextmenu-border);
9
+ border-radius: var(--radius-md);
10
+ box-shadow: var(--pf-elevation-popover-shadow);
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: 2px;
14
+ min-width: 180px;
15
+ outline: none;
16
+ padding: var(--space-1);
17
+ z-index: 1100;
18
+ }
19
+
20
+ .pf-context-menu__menu--exiting {
21
+ animation: pf-context-menu-out var(--duration-fast) var(--easing-accelerate) forwards;
22
+ }
23
+
24
+ @keyframes pf-context-menu-in {
25
+ from {
26
+ opacity: 0;
27
+ transform: scale(0.96);
28
+ }
29
+ to {
30
+ opacity: 1;
31
+ transform: scale(1);
32
+ }
33
+ }
34
+
35
+ @keyframes pf-context-menu-out {
36
+ from {
37
+ opacity: 1;
38
+ transform: scale(1);
39
+ }
40
+ to {
41
+ opacity: 0;
42
+ transform: scale(0.96);
43
+ }
44
+ }
45
+
46
+ .pf-context-menu__item {
47
+ align-items: center;
48
+ background: var(--pf-contextmenu-bg);
49
+ border: 0;
50
+ border-radius: var(--radius-sm);
51
+ color: var(--pf-contextmenu-text);
52
+ cursor: pointer;
53
+ display: flex;
54
+ font: inherit;
55
+ gap: var(--space-2);
56
+ padding: var(--space-2) var(--space-3);
57
+ text-align: start;
58
+ width: 100%;
59
+ }
60
+
61
+ .pf-context-menu__item--active {
62
+ background: var(--pf-contextmenu-item-active-bg);
63
+ color: var(--pf-contextmenu-item-active-text);
64
+ }
65
+
66
+ .pf-context-menu__item:disabled {
67
+ color: var(--pf-contextmenu-text-muted);
68
+ cursor: not-allowed;
69
+ }
70
+
71
+ .pf-context-menu__item--destructive {
72
+ color: var(--pf-contextmenu-text-danger);
73
+ }
74
+
75
+ .pf-context-menu__item--destructive.pf-context-menu__item--active {
76
+ background: var(--pf-contextmenu-danger-active-bg);
77
+ color: var(--pf-contextmenu-danger-active-text);
78
+ }
79
+
80
+ .pf-context-menu__item-icon {
81
+ align-items: center;
82
+ display: inline-flex;
83
+ flex-shrink: 0;
84
+ height: 1rem;
85
+ justify-content: center;
86
+ width: 1rem;
87
+ }
88
+
89
+ .pf-context-menu__item-icon svg {
90
+ display: block;
91
+ height: 1rem;
92
+ width: 1rem;
93
+ }
94
+
95
+ .pf-context-menu__item-label {
96
+ flex: 1;
97
+ min-width: 0;
98
+ }
99
+
100
+ .pf-context-menu__item-shortcut {
101
+ color: var(--pf-contextmenu-text-muted);
102
+ flex-shrink: 0;
103
+ font-family: var(--font-family-mono, ui-monospace, monospace);
104
+ font-size: var(--font-size-xs);
105
+ }
106
+
107
+ .pf-context-menu__item--active .pf-context-menu__item-shortcut {
108
+ color: inherit;
109
+ }
110
+
111
+ .pf-context-menu__separator {
112
+ background: var(--pf-contextmenu-separator);
113
+ height: 1px;
114
+ margin: var(--space-1) 0;
115
+ }
116
+
117
+ @media (prefers-reduced-motion: reduce) {
118
+ .pf-context-menu__menu,
119
+ .pf-context-menu__menu--exiting {
120
+ animation: none;
121
+ }
122
+ }
@@ -0,0 +1,155 @@
1
+ "use client";
2
+ import { Keys } from "../../a11y/index.js";
3
+ import { useComposedRefs } from "../../hooks/useComposedRefs.js";
4
+ import { useListNavigation } from "../../hooks/useListNavigation.js";
5
+ import { useOutsideInteraction } from "../../hooks/useOutsideInteraction.js";
6
+ import { usePresence } from "../../hooks/usePresence.js";
7
+ import { cx } from "../../utils/cx.js";
8
+ import './ContextMenu.css';/* empty css */
9
+ import { forwardRef, useId, useLayoutEffect, useRef, useState } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { createPortal } from "react-dom";
12
+ //#region src/components/ContextMenu/ContextMenu.tsx
13
+ var isSeparator = (entry) => entry.separator === true;
14
+ var VIEWPORT_PADDING = 8;
15
+ var ContextMenu = forwardRef(function ContextMenu({ className, items, disabled = false, onOpenChange, children, onContextMenu, ...props }, ref) {
16
+ const menuId = useId();
17
+ const [isOpen, setIsOpen] = useState(false);
18
+ const [point, setPoint] = useState({
19
+ x: 0,
20
+ y: 0
21
+ });
22
+ const [coords, setCoords] = useState(null);
23
+ const rootRefs = useComposedRefs(useRef(null), ref);
24
+ const menuRef = useRef(null);
25
+ const { isMounted, isExiting } = usePresence(isOpen, 140);
26
+ const actionable = items.filter((e) => !isSeparator(e));
27
+ const { activeIndex, move, setActiveIndex } = useListNavigation({
28
+ items: actionable,
29
+ isDisabled: (item) => Boolean(item.disabled)
30
+ });
31
+ const setOpen = (open) => {
32
+ setIsOpen(open);
33
+ onOpenChange?.(open);
34
+ };
35
+ useOutsideInteraction({
36
+ refs: [menuRef],
37
+ enabled: isOpen,
38
+ onInteractOutside: () => setOpen(false)
39
+ });
40
+ useLayoutEffect(() => {
41
+ if (!isMounted || !menuRef.current) return;
42
+ const rect = menuRef.current.getBoundingClientRect();
43
+ const maxLeft = window.innerWidth - rect.width - VIEWPORT_PADDING;
44
+ const maxTop = window.innerHeight - rect.height - VIEWPORT_PADDING;
45
+ setCoords({
46
+ left: Math.max(VIEWPORT_PADDING, Math.min(point.x, maxLeft)),
47
+ top: Math.max(VIEWPORT_PADDING, Math.min(point.y, maxTop))
48
+ });
49
+ }, [
50
+ isMounted,
51
+ point.x,
52
+ point.y
53
+ ]);
54
+ const handleContextMenu = (event) => {
55
+ onContextMenu?.(event);
56
+ if (disabled || event.defaultPrevented) return;
57
+ event.preventDefault();
58
+ setPoint({
59
+ x: event.clientX,
60
+ y: event.clientY
61
+ });
62
+ setCoords(null);
63
+ setActiveIndex(actionable.findIndex((item) => !item.disabled));
64
+ setOpen(true);
65
+ };
66
+ const select = (item) => {
67
+ if (item.disabled) return;
68
+ item.onSelect?.();
69
+ setOpen(false);
70
+ };
71
+ const onMenuKeyDown = (event) => {
72
+ if (event.key === Keys.Escape) {
73
+ event.preventDefault();
74
+ setOpen(false);
75
+ } else if (event.key === Keys.ArrowDown) {
76
+ event.preventDefault();
77
+ move("next");
78
+ } else if (event.key === Keys.ArrowUp) {
79
+ event.preventDefault();
80
+ move("previous");
81
+ } else if (event.key === Keys.Home) {
82
+ event.preventDefault();
83
+ move("first");
84
+ } else if (event.key === Keys.End) {
85
+ event.preventDefault();
86
+ move("last");
87
+ } else if (event.key === Keys.Enter || event.key === Keys.Space) {
88
+ event.preventDefault();
89
+ const item = actionable[activeIndex];
90
+ if (item) select(item);
91
+ }
92
+ };
93
+ useLayoutEffect(() => {
94
+ if (isMounted && coords) menuRef.current?.focus();
95
+ }, [isMounted, coords]);
96
+ let actionableIndex = -1;
97
+ return /* @__PURE__ */ jsxs("div", {
98
+ ref: rootRefs,
99
+ className: cx("pf-context-menu", className),
100
+ onContextMenu: handleContextMenu,
101
+ ...props,
102
+ children: [children, isMounted && typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx("div", {
103
+ id: menuId,
104
+ ref: menuRef,
105
+ role: "menu",
106
+ "aria-label": "Context menu",
107
+ tabIndex: -1,
108
+ className: cx("pf-context-menu__menu", isExiting && "pf-context-menu__menu--exiting"),
109
+ style: {
110
+ position: "fixed",
111
+ left: coords?.left ?? point.x,
112
+ top: coords?.top ?? point.y,
113
+ visibility: coords ? "visible" : "hidden"
114
+ },
115
+ onKeyDown: onMenuKeyDown,
116
+ children: items.map((entry, index) => {
117
+ if (isSeparator(entry)) return /* @__PURE__ */ jsx("div", {
118
+ role: "separator",
119
+ className: "pf-context-menu__separator"
120
+ }, `sep-${index}`);
121
+ actionableIndex += 1;
122
+ const itemIndex = actionableIndex;
123
+ const isActive = itemIndex === activeIndex;
124
+ return /* @__PURE__ */ jsxs("button", {
125
+ type: "button",
126
+ role: "menuitem",
127
+ disabled: entry.disabled,
128
+ className: cx("pf-context-menu__item", isActive && "pf-context-menu__item--active", entry.destructive && "pf-context-menu__item--destructive"),
129
+ onMouseEnter: () => {
130
+ if (!entry.disabled) setActiveIndex(itemIndex);
131
+ },
132
+ onClick: () => select(entry),
133
+ children: [
134
+ entry.icon ? /* @__PURE__ */ jsx("span", {
135
+ className: "pf-context-menu__item-icon",
136
+ "aria-hidden": true,
137
+ children: entry.icon
138
+ }) : null,
139
+ /* @__PURE__ */ jsx("span", {
140
+ className: "pf-context-menu__item-label",
141
+ children: entry.label
142
+ }),
143
+ entry.shortcut ? /* @__PURE__ */ jsx("kbd", {
144
+ className: "pf-context-menu__item-shortcut",
145
+ children: entry.shortcut
146
+ }) : null
147
+ ]
148
+ }, entry.id ?? `${entry.label}-${index}`);
149
+ })
150
+ }), document.body) : null]
151
+ });
152
+ });
153
+ ContextMenu.displayName = "ContextMenu";
154
+ //#endregion
155
+ export { ContextMenu };
@@ -127,6 +127,23 @@ var customIcons = {
127
127
  "aria-hidden": "true",
128
128
  children: [/* @__PURE__ */ jsx("path", { d: "M12 5v14" }), /* @__PURE__ */ jsx("path", { d: "M5 12h14" })]
129
129
  }),
130
+ clock: /* @__PURE__ */ jsxs("svg", {
131
+ width: "1em",
132
+ height: "1em",
133
+ viewBox: "0 0 24 24",
134
+ fill: "none",
135
+ stroke: "currentColor",
136
+ strokeWidth: "2",
137
+ strokeLinecap: "round",
138
+ strokeLinejoin: "round",
139
+ focusable: "false",
140
+ "aria-hidden": "true",
141
+ children: [/* @__PURE__ */ jsx("circle", {
142
+ cx: "12",
143
+ cy: "12",
144
+ r: "9"
145
+ }), /* @__PURE__ */ jsx("path", { d: "M12 7v5l3 2" })]
146
+ }),
130
147
  "magnifying-glass": /* @__PURE__ */ jsxs("svg", {
131
148
  width: "1em",
132
149
  height: "1em",
@@ -142,3 +142,7 @@
142
142
  background: color-mix(in srgb, var(--pf-inline-cta-warning-bg) 60%, var(--color-base-white));
143
143
  border-color: var(--pf-inline-cta-warning-border);
144
144
  }
145
+ .pf-inline-cta--danger {
146
+ background: color-mix(in srgb, var(--pf-inline-cta-danger-bg) 55%, var(--color-base-white));
147
+ border-color: var(--pf-inline-cta-danger-border);
148
+ }
@@ -15,7 +15,9 @@
15
15
  display: flex;
16
16
  inset: 0;
17
17
  justify-content: center;
18
- overflow-y: auto;
18
+ /* visible so the modal's drop shadow isn't clipped; the modal self-caps its
19
+ height and scrolls internally, so the viewport never needs to scroll. */
20
+ overflow: visible;
19
21
  padding: var(--space-2);
20
22
  position: relative;
21
23
  }
@@ -35,7 +37,9 @@
35
37
  color: var(--pf-modal-text);
36
38
  display: flex;
37
39
  flex-direction: column;
40
+ /* dvh keeps the modal within the visible viewport on mobile (browser chrome). */
38
41
  max-height: 92vh;
42
+ max-height: 92dvh;
39
43
  overflow: hidden;
40
44
  width: 100%;
41
45
  }
@@ -43,6 +47,7 @@
43
47
  @media (min-width: 768px) {
44
48
  .pf-modal {
45
49
  max-height: min(90vh, 720px);
50
+ max-height: min(90dvh, 720px);
46
51
  }
47
52
  }
48
53
 
@@ -0,0 +1,79 @@
1
+ .pf-resizable {
2
+ display: flex;
3
+ overflow: hidden;
4
+ }
5
+
6
+ .pf-resizable--horizontal {
7
+ flex-direction: row;
8
+ }
9
+
10
+ .pf-resizable--vertical {
11
+ flex-direction: column;
12
+ }
13
+
14
+ .pf-resizable__panel {
15
+ flex-grow: 0;
16
+ flex-shrink: 0;
17
+ min-height: 0;
18
+ min-width: 0;
19
+ overflow: auto;
20
+ }
21
+
22
+ .pf-resizable__panel--fill {
23
+ flex: 1 1 0;
24
+ }
25
+
26
+ /* ── Handle ───────────────────────────────────────────────────────────────── */
27
+
28
+ .pf-resizable__handle {
29
+ align-items: center;
30
+ background: var(--pf-resizable-handle-bg);
31
+ display: flex;
32
+ flex-shrink: 0;
33
+ justify-content: center;
34
+ position: relative;
35
+ touch-action: none;
36
+ transition: background var(--pf-transition-fast);
37
+ }
38
+
39
+ .pf-resizable__handle:hover,
40
+ .pf-resizable__handle:focus-visible {
41
+ background: var(--pf-resizable-handle-active-bg);
42
+ }
43
+
44
+ .pf-resizable__handle:focus-visible {
45
+ outline: none;
46
+ box-shadow: var(--pf-resizable-focus-ring, var(--pf-focus-ring));
47
+ }
48
+
49
+ .pf-resizable--horizontal .pf-resizable__handle {
50
+ cursor: col-resize;
51
+ width: var(--pf-resizable-handle-size, 6px);
52
+ }
53
+
54
+ .pf-resizable--vertical .pf-resizable__handle {
55
+ cursor: row-resize;
56
+ height: var(--pf-resizable-handle-size, 6px);
57
+ }
58
+
59
+ /* Grip affordance (dots/line) centered in the handle. */
60
+ .pf-resizable__grip {
61
+ background: var(--pf-resizable-grip);
62
+ border-radius: var(--radius-full);
63
+ }
64
+
65
+ .pf-resizable--horizontal .pf-resizable__grip {
66
+ height: 24px;
67
+ width: 2px;
68
+ }
69
+
70
+ .pf-resizable--vertical .pf-resizable__grip {
71
+ height: 2px;
72
+ width: 24px;
73
+ }
74
+
75
+ @media (prefers-reduced-motion: reduce) {
76
+ .pf-resizable__handle {
77
+ transition: none;
78
+ }
79
+ }
@@ -0,0 +1,101 @@
1
+ "use client";
2
+ import { Keys } from "../../a11y/index.js";
3
+ import { useComposedRefs } from "../../hooks/useComposedRefs.js";
4
+ import { useControllableState } from "../../hooks/useControllableState.js";
5
+ import { cx } from "../../utils/cx.js";
6
+ import './Resizable.css';/* empty css */
7
+ import { Children, forwardRef, useId, useRef } from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ //#region src/components/Resizable/Resizable.tsx
10
+ var clamp = (n, min, max) => Math.min(Math.max(n, min), max);
11
+ var Resizable = forwardRef(function Resizable({ className, orientation = "horizontal", size, defaultSize = 50, onSizeChange, min = 10, max = 90, step = 2, handleLabel = "Resize panels", children, ...props }, ref) {
12
+ const handleId = useId();
13
+ const containerRef = useRef(null);
14
+ const containerRefs = useComposedRefs(containerRef, ref);
15
+ const draggingRef = useRef(false);
16
+ const [current, setCurrent] = useControllableState({
17
+ value: size,
18
+ defaultValue: defaultSize,
19
+ onChange: onSizeChange
20
+ });
21
+ const value = clamp(current ?? defaultSize, min, max);
22
+ const isHorizontal = orientation === "horizontal";
23
+ const panels = Children.toArray(children);
24
+ const first = panels[0] ?? null;
25
+ const second = panels[1] ?? null;
26
+ const setFromPointer = (clientX, clientY) => {
27
+ const el = containerRef.current;
28
+ if (!el) return;
29
+ const rect = el.getBoundingClientRect();
30
+ const pct = isHorizontal ? (clientX - rect.left) / rect.width * 100 : (clientY - rect.top) / rect.height * 100;
31
+ setCurrent(clamp(Math.round(pct), min, max));
32
+ };
33
+ const onPointerDown = (event) => {
34
+ event.preventDefault();
35
+ event.currentTarget.setPointerCapture(event.pointerId);
36
+ draggingRef.current = true;
37
+ };
38
+ const onPointerMove = (event) => {
39
+ if (!draggingRef.current) return;
40
+ setFromPointer(event.clientX, event.clientY);
41
+ };
42
+ const onPointerUp = (event) => {
43
+ draggingRef.current = false;
44
+ event.currentTarget.releasePointerCapture(event.pointerId);
45
+ };
46
+ const onKeyDown = (event) => {
47
+ const decKey = isHorizontal ? Keys.ArrowLeft : Keys.ArrowUp;
48
+ const incKey = isHorizontal ? Keys.ArrowRight : Keys.ArrowDown;
49
+ if (event.key === decKey) {
50
+ event.preventDefault();
51
+ setCurrent(clamp(value - step, min, max));
52
+ } else if (event.key === incKey) {
53
+ event.preventDefault();
54
+ setCurrent(clamp(value + step, min, max));
55
+ } else if (event.key === Keys.Home) {
56
+ event.preventDefault();
57
+ setCurrent(min);
58
+ } else if (event.key === Keys.End) {
59
+ event.preventDefault();
60
+ setCurrent(max);
61
+ }
62
+ };
63
+ return /* @__PURE__ */ jsxs("div", {
64
+ ref: containerRefs,
65
+ className: cx("pf-resizable", `pf-resizable--${orientation}`, className),
66
+ ...props,
67
+ children: [
68
+ /* @__PURE__ */ jsx("div", {
69
+ className: "pf-resizable__panel",
70
+ style: { flexBasis: `${value}%` },
71
+ children: first
72
+ }),
73
+ /* @__PURE__ */ jsx("div", {
74
+ id: handleId,
75
+ role: "separator",
76
+ tabIndex: 0,
77
+ "aria-orientation": isHorizontal ? "vertical" : "horizontal",
78
+ "aria-label": handleLabel,
79
+ "aria-valuenow": value,
80
+ "aria-valuemin": min,
81
+ "aria-valuemax": max,
82
+ className: "pf-resizable__handle",
83
+ onPointerDown,
84
+ onPointerMove,
85
+ onPointerUp,
86
+ onKeyDown,
87
+ children: /* @__PURE__ */ jsx("span", {
88
+ className: "pf-resizable__grip",
89
+ "aria-hidden": true
90
+ })
91
+ }),
92
+ /* @__PURE__ */ jsx("div", {
93
+ className: "pf-resizable__panel pf-resizable__panel--fill",
94
+ children: second
95
+ })
96
+ ]
97
+ });
98
+ });
99
+ Resizable.displayName = "Resizable";
100
+ //#endregion
101
+ export { Resizable };