@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
@@ -0,0 +1,98 @@
1
+ .pf-numberinput {
2
+ align-items: stretch;
3
+ background: var(--pf-numberinput-bg);
4
+ border: 1px solid var(--pf-numberinput-border);
5
+ border-radius: var(--radius-md);
6
+ display: inline-flex;
7
+ min-height: 40px;
8
+ overflow: hidden;
9
+ width: 100%;
10
+ transition:
11
+ border 0.2s,
12
+ box-shadow 0.2s;
13
+ }
14
+
15
+ .pf-numberinput:focus-within {
16
+ border-color: var(--pf-numberinput-focus-border);
17
+ box-shadow: var(--pf-numberinput-focus-ring, var(--pf-focus-ring));
18
+ }
19
+
20
+ .pf-numberinput--invalid {
21
+ border-color: var(--pf-numberinput-invalid-border);
22
+ }
23
+
24
+ .pf-numberinput__input {
25
+ background: transparent;
26
+ border: none;
27
+ color: var(--pf-numberinput-text);
28
+ flex: 1;
29
+ font: inherit;
30
+ min-width: 0;
31
+ outline: none;
32
+ padding: 0 var(--space-3);
33
+ text-align: center;
34
+ width: 100%;
35
+ }
36
+
37
+ .pf-numberinput__input::placeholder {
38
+ color: var(--pf-numberinput-placeholder);
39
+ }
40
+
41
+ .pf-numberinput__input:disabled {
42
+ cursor: not-allowed;
43
+ }
44
+
45
+ .pf-numberinput:has(.pf-numberinput__input:disabled) {
46
+ background: var(--pf-control-bg-disabled);
47
+ border-color: var(--pf-control-border-disabled);
48
+ color: var(--pf-control-text-disabled);
49
+ opacity: 0.6;
50
+ }
51
+
52
+ .pf-numberinput__step {
53
+ align-items: center;
54
+ align-self: stretch;
55
+ background: var(--pf-numberinput-step-bg);
56
+ border: none;
57
+ color: var(--pf-numberinput-step-text);
58
+ cursor: pointer;
59
+ display: inline-flex;
60
+ flex-shrink: 0;
61
+ justify-content: center;
62
+ padding: 0;
63
+ width: 40px;
64
+ transition:
65
+ background 0.15s,
66
+ color 0.15s;
67
+ }
68
+
69
+ .pf-numberinput__step:hover:not(:disabled) {
70
+ background: var(--pf-numberinput-step-hover-bg);
71
+ color: var(--pf-numberinput-step-hover-text);
72
+ }
73
+
74
+ .pf-numberinput__step:disabled {
75
+ cursor: not-allowed;
76
+ opacity: 0.45;
77
+ }
78
+
79
+ .pf-numberinput__step--decrement {
80
+ border-inline-end: 1px solid var(--pf-numberinput-border);
81
+ }
82
+
83
+ .pf-numberinput__step--increment {
84
+ border-inline-start: 1px solid var(--pf-numberinput-border);
85
+ }
86
+
87
+ .pf-numberinput__step svg {
88
+ display: block;
89
+ height: 16px;
90
+ width: 16px;
91
+ }
92
+
93
+ @media (prefers-reduced-motion: reduce) {
94
+ .pf-numberinput,
95
+ .pf-numberinput__step {
96
+ transition: none;
97
+ }
98
+ }
@@ -0,0 +1,166 @@
1
+ "use client";
2
+ import { Keys, composeDescribedBy } 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 { Icon } from "../Icon/Icon2.js";
7
+ import { FieldWrapper } from "../../utils/FieldWrapper.js";
8
+ import './NumberInput.css';/* empty css */
9
+ import { forwardRef, useId, useRef, useState } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ //#region src/components/NumberInput/NumberInput.tsx
12
+ var decimalsOf = (n) => {
13
+ const str = String(n);
14
+ const dot = str.indexOf(".");
15
+ return dot === -1 ? 0 : str.length - dot - 1;
16
+ };
17
+ var clamp = (n, min, max) => Math.min(Math.max(n, min), max);
18
+ var NumberInput = 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) {
19
+ const generatedId = useId();
20
+ const fieldId = id ?? generatedId;
21
+ const descriptionId = description ? `${fieldId}-description` : void 0;
22
+ const errorId = error ? `${fieldId}-error` : void 0;
23
+ const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId);
24
+ const [rawValue, setCurrentValue] = useControllableState({
25
+ value,
26
+ defaultValue: defaultValue ?? null,
27
+ onChange: onValueChange
28
+ });
29
+ const currentValue = rawValue ?? null;
30
+ const inputRefs = useComposedRefs(useRef(null), ref);
31
+ const stepDecimals = decimalsOf(step);
32
+ const round = (n) => {
33
+ const factor = 10 ** stepDecimals;
34
+ return Math.round(n * factor) / factor;
35
+ };
36
+ const formatValue = (n) => {
37
+ if (n === null) return "";
38
+ if (formatOptions) return new Intl.NumberFormat(locale, formatOptions).format(n);
39
+ return String(n);
40
+ };
41
+ const [focused, setFocused] = useState(false);
42
+ const [draft, setDraft] = useState(() => formatValue(currentValue));
43
+ const displayValue = focused ? draft : formatValue(currentValue);
44
+ const commit = (next) => {
45
+ if (next === null) {
46
+ setCurrentValue(null);
47
+ setDraft("");
48
+ return;
49
+ }
50
+ const clamped = round(clamp(next, min, max));
51
+ setCurrentValue(clamped);
52
+ setDraft(focused ? String(clamped) : formatValue(clamped));
53
+ };
54
+ const stepBy = (direction) => {
55
+ if (disabled) return;
56
+ commit((currentValue ?? (Number.isFinite(min) ? min : Number.isFinite(max) ? max : 0)) + direction * step);
57
+ };
58
+ const atMin = currentValue !== null && currentValue <= min;
59
+ const atMax = currentValue !== null && currentValue >= max;
60
+ const onKeyDown = (event) => {
61
+ if (disabled) return;
62
+ if (event.key === Keys.ArrowUp) {
63
+ event.preventDefault();
64
+ stepBy(1);
65
+ } else if (event.key === Keys.ArrowDown) {
66
+ event.preventDefault();
67
+ stepBy(-1);
68
+ } else if (event.key === Keys.Home && Number.isFinite(min)) {
69
+ event.preventDefault();
70
+ commit(min);
71
+ } else if (event.key === Keys.End && Number.isFinite(max)) {
72
+ event.preventDefault();
73
+ commit(max);
74
+ }
75
+ };
76
+ return /* @__PURE__ */ jsx(FieldWrapper, {
77
+ labelFor: fieldId,
78
+ label,
79
+ description,
80
+ descriptionId,
81
+ error,
82
+ errorId,
83
+ required,
84
+ children: /* @__PURE__ */ jsxs("div", {
85
+ className: cx("pf-numberinput", error && "pf-numberinput--invalid"),
86
+ children: [
87
+ /* @__PURE__ */ jsx("button", {
88
+ type: "button",
89
+ className: "pf-numberinput__step pf-numberinput__step--decrement",
90
+ "aria-label": decrementLabel,
91
+ disabled: disabled || atMin,
92
+ tabIndex: -1,
93
+ onMouseDown: (event) => event.preventDefault(),
94
+ onClick: () => stepBy(-1),
95
+ children: /* @__PURE__ */ jsx(Icon, {
96
+ name: "minus",
97
+ "aria-hidden": true
98
+ })
99
+ }),
100
+ /* @__PURE__ */ jsx("input", {
101
+ ...props,
102
+ id: fieldId,
103
+ ref: inputRefs,
104
+ type: "text",
105
+ inputMode: "decimal",
106
+ role: "spinbutton",
107
+ className: cx("pf-numberinput__input", className),
108
+ value: displayValue,
109
+ placeholder,
110
+ disabled,
111
+ required,
112
+ autoComplete: "off",
113
+ "aria-invalid": error ? true : void 0,
114
+ "aria-describedby": describedBy,
115
+ "aria-valuenow": currentValue ?? void 0,
116
+ "aria-valuemin": Number.isFinite(min) ? min : void 0,
117
+ "aria-valuemax": Number.isFinite(max) ? max : void 0,
118
+ onFocus: () => {
119
+ setFocused(true);
120
+ setDraft(currentValue === null ? "" : String(currentValue));
121
+ },
122
+ onChange: (event) => {
123
+ const raw = event.target.value;
124
+ setDraft(raw);
125
+ if (raw.trim() === "") {
126
+ setCurrentValue(null);
127
+ return;
128
+ }
129
+ const parsed = Number(raw);
130
+ if (!Number.isNaN(parsed)) setCurrentValue(round(clamp(parsed, min, max)));
131
+ },
132
+ onBlur: () => {
133
+ setFocused(false);
134
+ if (draft.trim() === "") commit(null);
135
+ else {
136
+ const parsed = Number(draft);
137
+ commit(Number.isNaN(parsed) ? currentValue : parsed);
138
+ }
139
+ },
140
+ onKeyDown
141
+ }),
142
+ /* @__PURE__ */ jsx("button", {
143
+ type: "button",
144
+ className: "pf-numberinput__step pf-numberinput__step--increment",
145
+ "aria-label": incrementLabel,
146
+ disabled: disabled || atMax,
147
+ tabIndex: -1,
148
+ onMouseDown: (event) => event.preventDefault(),
149
+ onClick: () => stepBy(1),
150
+ children: /* @__PURE__ */ jsx(Icon, {
151
+ name: "plus",
152
+ "aria-hidden": true
153
+ })
154
+ }),
155
+ name ? /* @__PURE__ */ jsx("input", {
156
+ type: "hidden",
157
+ name,
158
+ value: currentValue ?? ""
159
+ }) : null
160
+ ]
161
+ })
162
+ });
163
+ });
164
+ NumberInput.displayName = "NumberInput";
165
+ //#endregion
166
+ export { NumberInput };
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import { Breadcrumbs } from "../Breadcrumbs/Breadcrumbs2.js";
3
4
  import './PageHeader.css';/* empty css */
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './Pagination.css';/* empty css */
3
4
  import * as React from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './PieChart.css';/* empty css */
3
4
  import { forwardRef } from "react";
@@ -0,0 +1,46 @@
1
+ .pf-popover {
2
+ position: fixed;
3
+ z-index: 1100;
4
+ max-width: min(360px, calc(100vw - 16px));
5
+ background: var(--pf-popover-bg);
6
+ border: 1px solid var(--pf-popover-border);
7
+ border-radius: var(--radius-md);
8
+ box-shadow: var(--pf-popover-elevation-popover-shadow, var(--pf-elevation-popover-shadow));
9
+ color: var(--pf-popover-text);
10
+ padding: var(--space-4);
11
+ transform-origin: top center;
12
+ animation: pf-popover-in var(--duration-fast) var(--easing-decelerate);
13
+ }
14
+
15
+ .pf-popover:focus-visible {
16
+ outline: none;
17
+ }
18
+
19
+ @keyframes pf-popover-in {
20
+ from {
21
+ opacity: 0;
22
+ transform: translateY(-4px) scale(0.97);
23
+ }
24
+ to {
25
+ opacity: 1;
26
+ transform: translateY(0) scale(1);
27
+ }
28
+ }
29
+
30
+ .pf-popover--exiting {
31
+ animation: pf-popover-out var(--duration-fast) var(--easing-accelerate) forwards;
32
+ }
33
+
34
+ @keyframes pf-popover-out {
35
+ to {
36
+ opacity: 0;
37
+ transform: translateY(-4px) scale(0.97);
38
+ }
39
+ }
40
+
41
+ @media (prefers-reduced-motion: reduce) {
42
+ .pf-popover,
43
+ .pf-popover--exiting {
44
+ animation: none;
45
+ }
46
+ }
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { Keys } from "../../a11y/index.js";
3
+ import { useAnchoredPosition } from "../../hooks/useAnchoredPosition.js";
4
+ import { useComposedRefs } from "../../hooks/useComposedRefs.js";
5
+ import { useControllableState } from "../../hooks/useControllableState.js";
6
+ import { useOutsideInteraction } from "../../hooks/useOutsideInteraction.js";
7
+ import { usePresence } from "../../hooks/usePresence.js";
8
+ import { cx } from "../../utils/cx.js";
9
+ import './Popover.css';/* empty css */
10
+ import { cloneElement, useEffect, useId, useRef } from "react";
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ import { createPortal } from "react-dom";
13
+ //#region src/components/Popover/Popover.tsx
14
+ function Popover({ trigger, children, open, defaultOpen, onOpenChange, align = "start", label, closeOnOutsideClick = true, className }) {
15
+ const [isOpen = false, setOpen] = useControllableState({
16
+ value: open,
17
+ defaultValue: defaultOpen ?? false,
18
+ onChange: onOpenChange
19
+ });
20
+ const contentId = useId();
21
+ const triggerRef = useRef(null);
22
+ const contentRef = useRef(null);
23
+ const { isMounted, isExiting } = usePresence(isOpen, 160);
24
+ const style = useAnchoredPosition({
25
+ anchorRef: triggerRef,
26
+ floatingRef: contentRef,
27
+ enabled: isOpen,
28
+ align,
29
+ matchAnchorWidth: false,
30
+ flip: true
31
+ });
32
+ useOutsideInteraction({
33
+ refs: [triggerRef, contentRef],
34
+ enabled: isOpen,
35
+ onInteractOutside: () => {
36
+ if (closeOnOutsideClick) setOpen(false);
37
+ }
38
+ });
39
+ const wasOpen = useRef(false);
40
+ useEffect(() => {
41
+ if (isOpen) {
42
+ wasOpen.current = true;
43
+ contentRef.current?.focus();
44
+ } else if (wasOpen.current) {
45
+ wasOpen.current = false;
46
+ triggerRef.current?.focus();
47
+ }
48
+ }, [isOpen]);
49
+ const triggerProps = trigger.props;
50
+ return /* @__PURE__ */ jsxs(Fragment, { children: [cloneElement(trigger, {
51
+ ref: useComposedRefs(triggerRef, trigger.ref ?? triggerProps.ref),
52
+ "aria-haspopup": "dialog",
53
+ "aria-expanded": isOpen,
54
+ onClick: (event) => {
55
+ triggerProps.onClick?.(event);
56
+ setOpen(!isOpen);
57
+ }
58
+ }), isMounted && typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx("div", {
59
+ ref: contentRef,
60
+ id: contentId,
61
+ role: "dialog",
62
+ "aria-label": label,
63
+ tabIndex: -1,
64
+ className: cx("pf-popover", isExiting && "pf-popover--exiting", className),
65
+ style,
66
+ onKeyDown: (event) => {
67
+ if (event.key === Keys.Escape) {
68
+ event.stopPropagation();
69
+ setOpen(false);
70
+ }
71
+ },
72
+ children
73
+ }), document.body) : null] });
74
+ }
75
+ Popover.displayName = "Popover";
76
+ //#endregion
77
+ export { Popover };
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './ProgressIndicators.css';/* empty css */
3
4
  import { forwardRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './ProgressSteps.css';/* empty css */
3
4
  import { forwardRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './RadarChart.css';/* empty css */
3
4
  import { forwardRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './RadioButton.css';/* empty css */
3
4
  import { forwardRef, useId } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './RadioGroup.css';/* empty css */
3
4
  import { forwardRef, useId, useState } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import { Icon } from "../Icon/Icon2.js";
3
4
  import './Rating.css';/* empty css */
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { composeDescribedBy } from "../../a11y/index.js";
2
3
  import { cx } from "../../utils/cx.js";
3
4
  import { FieldWrapper } from "../../utils/FieldWrapper.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './SectionFooter.css';/* empty css */
3
4
  import { forwardRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './SectionHeader.css';/* empty css */
3
4
  import { forwardRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Keys, composeDescribedBy, isActivationKey } from "../../a11y/index.js";
2
3
  import { useAnchoredPosition } from "../../hooks/useAnchoredPosition.js";
3
4
  import { useComposedRefs } from "../../hooks/useComposedRefs.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './SidebarNavigation.css';/* empty css */
3
4
  import { forwardRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import { Icon } from "../Icon/Icon2.js";
3
4
  import './SlideoutMenu.css';/* empty css */
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './Slider.css';/* empty css */
3
4
  import { forwardRef, useId, useMemo, useState } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './Sparkline.css';/* empty css */
3
4
  import { forwardRef, useMemo } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './Switch.css';/* empty css */
3
4
  import { forwardRef, useId } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './Table.css';/* empty css */
3
4
  import { useMemo, useState } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './Tabs.css';/* empty css */
3
4
  import { forwardRef, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import { Icon } from "../Icon/Icon2.js";
3
4
  import './Tag.css';/* empty css */
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import { FieldWrapper } from "../../utils/FieldWrapper.js";
3
4
  import './Textarea.css';/* empty css */
@@ -0,0 +1,130 @@
1
+ "use client";
2
+ import { Notification, NotificationStack } from "../Notification/Notification2.js";
3
+ import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { createPortal } from "react-dom";
6
+ //#region src/components/Toast/Toast.tsx
7
+ var _emit = null;
8
+ function ToastItem({ entry, onRemove }) {
9
+ const { id, shouldExit } = entry;
10
+ const handleRemove = useCallback(() => onRemove(id), [onRemove, id]);
11
+ useEffect(() => {
12
+ if (!shouldExit) return;
13
+ const t = setTimeout(handleRemove, 270);
14
+ return () => clearTimeout(t);
15
+ }, [shouldExit, handleRemove]);
16
+ return /* @__PURE__ */ jsx(Notification, {
17
+ variant: entry.variant,
18
+ heading: entry.heading,
19
+ description: entry.description,
20
+ action: entry.action,
21
+ dismissible: entry.dismissible,
22
+ onDismiss: handleRemove,
23
+ className: shouldExit ? "pf-notification--exiting" : void 0,
24
+ onAnimationEnd: (e) => {
25
+ if (shouldExit && e.currentTarget === e.target) handleRemove();
26
+ }
27
+ });
28
+ }
29
+ function ToastProvider({ children, placement = "top-right", defaultDuration = 4e3 }) {
30
+ const [entries, setEntries] = useState([]);
31
+ const timers = useRef(/* @__PURE__ */ new Map());
32
+ const remove = useCallback((id) => {
33
+ timers.current.delete(id);
34
+ setEntries((prev) => prev.filter((e) => e.id !== id));
35
+ }, []);
36
+ const signalExit = useCallback((id) => {
37
+ timers.current.delete(id);
38
+ setEntries((prev) => prev.map((e) => e.id === id ? {
39
+ ...e,
40
+ shouldExit: true
41
+ } : e));
42
+ }, []);
43
+ const toast = useCallback((options) => {
44
+ const id = `t-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
45
+ const duration = options.duration !== void 0 ? options.duration : defaultDuration;
46
+ setEntries((prev) => [{
47
+ ...options,
48
+ id,
49
+ shouldExit: false,
50
+ dismissible: options.dismissible ?? true
51
+ }, ...prev]);
52
+ if (typeof duration === "number" && duration > 0) {
53
+ const t = setTimeout(() => signalExit(id), duration);
54
+ timers.current.set(id, t);
55
+ }
56
+ return id;
57
+ }, [defaultDuration, signalExit]);
58
+ const dismiss = useCallback((id) => {
59
+ const t = timers.current.get(id);
60
+ if (t) clearTimeout(t);
61
+ signalExit(id);
62
+ }, [signalExit]);
63
+ const dismissAll = useCallback(() => {
64
+ timers.current.forEach(clearTimeout);
65
+ timers.current.clear();
66
+ setEntries((prev) => prev.map((e) => ({
67
+ ...e,
68
+ shouldExit: true
69
+ })));
70
+ }, []);
71
+ useEffect(() => {
72
+ _emit = toast;
73
+ return () => {
74
+ if (_emit === toast) _emit = null;
75
+ };
76
+ }, [toast]);
77
+ useEffect(() => {
78
+ const map = timers.current;
79
+ return () => map.forEach(clearTimeout);
80
+ }, []);
81
+ return /* @__PURE__ */ jsxs(ToastContext.Provider, {
82
+ value: {
83
+ toast,
84
+ dismiss,
85
+ dismissAll
86
+ },
87
+ children: [children, typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx(NotificationStack, {
88
+ placement,
89
+ children: entries.map((entry) => /* @__PURE__ */ jsx(ToastItem, {
90
+ entry,
91
+ onRemove: remove
92
+ }, entry.id))
93
+ }), document.body) : null]
94
+ });
95
+ }
96
+ var ToastContext = createContext(null);
97
+ function useToast() {
98
+ const ctx = useContext(ToastContext);
99
+ if (!ctx) throw new Error("useToast must be used inside <ToastProvider>.");
100
+ return ctx;
101
+ }
102
+ /**
103
+ * Fire a toast imperatively from anywhere — no hook needed.
104
+ * Requires a `<ToastProvider>` to be mounted somewhere in the tree.
105
+ */
106
+ function toast(options) {
107
+ if (!_emit) {
108
+ console.warn("[pitchfork-ui] toast() called before <ToastProvider> is mounted.");
109
+ return "";
110
+ }
111
+ return _emit(options);
112
+ }
113
+ toast.info = (opts) => toast({
114
+ ...opts,
115
+ variant: "info"
116
+ });
117
+ toast.success = (opts) => toast({
118
+ ...opts,
119
+ variant: "success"
120
+ });
121
+ toast.warning = (opts) => toast({
122
+ ...opts,
123
+ variant: "warning"
124
+ });
125
+ toast.danger = (opts) => toast({
126
+ ...opts,
127
+ variant: "danger"
128
+ });
129
+ //#endregion
130
+ export { ToastProvider, toast, useToast };
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { usePresence } from "../../hooks/usePresence.js";
2
3
  import { cx } from "../../utils/cx.js";
3
4
  import './Tooltip.css';/* empty css */
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './TreeView.css';/* empty css */
3
4
  import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './UtilityButton.css';/* empty css */
3
4
  import { forwardRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './VideoPlayer.css';/* empty css */
3
4
  import { forwardRef, useId } from "react";