@pitchfork-ui/react 0.1.9

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 (242) hide show
  1. package/README.md +60 -0
  2. package/dist/index.cjs +9010 -0
  3. package/dist/index.js +63 -0
  4. package/dist/index10.js +36 -0
  5. package/dist/index100.js +26 -0
  6. package/dist/index102.js +190 -0
  7. package/dist/index104.js +93 -0
  8. package/dist/index106.js +27 -0
  9. package/dist/index108.js +88 -0
  10. package/dist/index110.js +96 -0
  11. package/dist/index112.js +38 -0
  12. package/dist/index114.js +155 -0
  13. package/dist/index116.js +193 -0
  14. package/dist/index118.js +24 -0
  15. package/dist/index12.js +38 -0
  16. package/dist/index120.js +69 -0
  17. package/dist/index14.js +24 -0
  18. package/dist/index16.js +64 -0
  19. package/dist/index18.js +39 -0
  20. package/dist/index19.js +35 -0
  21. package/dist/index21.js +37 -0
  22. package/dist/index23.js +13 -0
  23. package/dist/index25.js +38 -0
  24. package/dist/index27.js +68 -0
  25. package/dist/index29.js +25 -0
  26. package/dist/index3.js +32 -0
  27. package/dist/index30.js +49 -0
  28. package/dist/index31.js +15 -0
  29. package/dist/index32.js +22 -0
  30. package/dist/index33.js +25 -0
  31. package/dist/index34.js +55 -0
  32. package/dist/index35.js +36 -0
  33. package/dist/index36.js +22 -0
  34. package/dist/index38.js +149 -0
  35. package/dist/index4.js +6 -0
  36. package/dist/index40.js +255 -0
  37. package/dist/index42.js +134 -0
  38. package/dist/index43.js +16 -0
  39. package/dist/index44.js +4232 -0
  40. package/dist/index46.js +123 -0
  41. package/dist/index48.js +41 -0
  42. package/dist/index50.js +135 -0
  43. package/dist/index52.js +39 -0
  44. package/dist/index54.js +186 -0
  45. package/dist/index56.js +63 -0
  46. package/dist/index58.js +45 -0
  47. package/dist/index6.js +182 -0
  48. package/dist/index60.js +264 -0
  49. package/dist/index62.js +68 -0
  50. package/dist/index64.js +69 -0
  51. package/dist/index66.js +95 -0
  52. package/dist/index68.js +202 -0
  53. package/dist/index70.js +68 -0
  54. package/dist/index72.js +50 -0
  55. package/dist/index74.js +88 -0
  56. package/dist/index76.js +92 -0
  57. package/dist/index78.js +76 -0
  58. package/dist/index8.js +61 -0
  59. package/dist/index80.js +44 -0
  60. package/dist/index82.js +116 -0
  61. package/dist/index84.js +25 -0
  62. package/dist/index86.js +56 -0
  63. package/dist/index88.js +88 -0
  64. package/dist/index90.js +167 -0
  65. package/dist/index92.js +32 -0
  66. package/dist/index94.js +40 -0
  67. package/dist/index96.js +87 -0
  68. package/dist/index98.js +185 -0
  69. package/dist/src/a11y/index.d.ts +15 -0
  70. package/dist/src/components/Alert/Alert.d.ts +10 -0
  71. package/dist/src/components/Alert/Alert.test.d.ts +1 -0
  72. package/dist/src/components/Alert/index.d.ts +1 -0
  73. package/dist/src/components/Avatar/Avatar.d.ts +10 -0
  74. package/dist/src/components/Avatar/Avatar.test.d.ts +1 -0
  75. package/dist/src/components/Avatar/index.d.ts +1 -0
  76. package/dist/src/components/Badge/Badge.d.ts +5 -0
  77. package/dist/src/components/Badge/Badge.test.d.ts +1 -0
  78. package/dist/src/components/Badge/index.d.ts +1 -0
  79. package/dist/src/components/BadgeGroup/BadgeGroup.d.ts +11 -0
  80. package/dist/src/components/BadgeGroup/BadgeGroup.test.d.ts +1 -0
  81. package/dist/src/components/BadgeGroup/index.d.ts +1 -0
  82. package/dist/src/components/Breadcrumbs/Breadcrumbs.d.ts +11 -0
  83. package/dist/src/components/Breadcrumbs/Breadcrumbs.test.d.ts +1 -0
  84. package/dist/src/components/Breadcrumbs/index.d.ts +1 -0
  85. package/dist/src/components/Button/Button.d.ts +9 -0
  86. package/dist/src/components/Button/Button.test.d.ts +1 -0
  87. package/dist/src/components/Button/index.d.ts +1 -0
  88. package/dist/src/components/ButtonGroup/ButtonGroup.d.ts +16 -0
  89. package/dist/src/components/ButtonGroup/ButtonGroup.test.d.ts +1 -0
  90. package/dist/src/components/ButtonGroup/index.d.ts +1 -0
  91. package/dist/src/components/Calendar/Calendar.d.ts +14 -0
  92. package/dist/src/components/Calendar/Calendar.test.d.ts +1 -0
  93. package/dist/src/components/Calendar/index.d.ts +1 -0
  94. package/dist/src/components/Card/Card.d.ts +20 -0
  95. package/dist/src/components/Card/Card.test.d.ts +1 -0
  96. package/dist/src/components/Card/index.d.ts +1 -0
  97. package/dist/src/components/Carousel/Carousel.d.ts +10 -0
  98. package/dist/src/components/Carousel/Carousel.test.d.ts +1 -0
  99. package/dist/src/components/Carousel/index.d.ts +1 -0
  100. package/dist/src/components/Checkbox/Checkbox.d.ts +4 -0
  101. package/dist/src/components/Checkbox/Checkbox.test.d.ts +1 -0
  102. package/dist/src/components/Checkbox/index.d.ts +1 -0
  103. package/dist/src/components/CodeSnippet/CodeSnippet.d.ts +11 -0
  104. package/dist/src/components/CodeSnippet/CodeSnippet.test.d.ts +1 -0
  105. package/dist/src/components/CodeSnippet/index.d.ts +1 -0
  106. package/dist/src/components/ContentDivider/ContentDivider.d.ts +7 -0
  107. package/dist/src/components/ContentDivider/ContentDivider.test.d.ts +1 -0
  108. package/dist/src/components/ContentDivider/index.d.ts +1 -0
  109. package/dist/src/components/CreditCard/CreditCard.d.ts +10 -0
  110. package/dist/src/components/CreditCard/CreditCard.test.d.ts +1 -0
  111. package/dist/src/components/CreditCard/index.d.ts +1 -0
  112. package/dist/src/components/DatePicker/DatePicker.d.ts +17 -0
  113. package/dist/src/components/DatePicker/DatePicker.test.d.ts +1 -0
  114. package/dist/src/components/DatePicker/index.d.ts +1 -0
  115. package/dist/src/components/Dropdown/Dropdown.d.ts +20 -0
  116. package/dist/src/components/Dropdown/Dropdown.test.d.ts +1 -0
  117. package/dist/src/components/Dropdown/index.d.ts +1 -0
  118. package/dist/src/components/EmptyState/EmptyState.d.ts +11 -0
  119. package/dist/src/components/EmptyState/EmptyState.test.d.ts +1 -0
  120. package/dist/src/components/EmptyState/index.d.ts +1 -0
  121. package/dist/src/components/FileUploader/FileUploader.d.ts +15 -0
  122. package/dist/src/components/FileUploader/FileUploader.test.d.ts +1 -0
  123. package/dist/src/components/FileUploader/index.d.ts +1 -0
  124. package/dist/src/components/HeaderNavigation/HeaderNavigation.d.ts +12 -0
  125. package/dist/src/components/HeaderNavigation/HeaderNavigation.test.d.ts +1 -0
  126. package/dist/src/components/HeaderNavigation/index.d.ts +1 -0
  127. package/dist/src/components/Icon/Icon.d.ts +12 -0
  128. package/dist/src/components/Icon/Icon.test.d.ts +1 -0
  129. package/dist/src/components/Icon/index.d.ts +1 -0
  130. package/dist/src/components/InlineCTA/InlineCTA.d.ts +11 -0
  131. package/dist/src/components/InlineCTA/InlineCTA.test.d.ts +1 -0
  132. package/dist/src/components/InlineCTA/index.d.ts +1 -0
  133. package/dist/src/components/Input/Input.d.ts +6 -0
  134. package/dist/src/components/Input/Input.test.d.ts +1 -0
  135. package/dist/src/components/Input/index.d.ts +1 -0
  136. package/dist/src/components/LineBarCharts/LineBarChart.d.ts +29 -0
  137. package/dist/src/components/LineBarCharts/LineBarChart.test.d.ts +1 -0
  138. package/dist/src/components/LineBarCharts/index.d.ts +1 -0
  139. package/dist/src/components/LoadingIndicators/LoadingIndicators.d.ts +17 -0
  140. package/dist/src/components/LoadingIndicators/LoadingIndicators.test.d.ts +1 -0
  141. package/dist/src/components/LoadingIndicators/index.d.ts +1 -0
  142. package/dist/src/components/Metrics/Metrics.d.ts +15 -0
  143. package/dist/src/components/Metrics/Metrics.test.d.ts +1 -0
  144. package/dist/src/components/Metrics/index.d.ts +1 -0
  145. package/dist/src/components/Modal/Modal.d.ts +16 -0
  146. package/dist/src/components/Modal/Modal.test.d.ts +1 -0
  147. package/dist/src/components/Modal/index.d.ts +1 -0
  148. package/dist/src/components/MultiSelect/MultiSelect.d.ts +18 -0
  149. package/dist/src/components/MultiSelect/MultiSelect.test.d.ts +1 -0
  150. package/dist/src/components/MultiSelect/index.d.ts +1 -0
  151. package/dist/src/components/Notification/Notification.d.ts +16 -0
  152. package/dist/src/components/Notification/Notification.test.d.ts +1 -0
  153. package/dist/src/components/Notification/index.d.ts +1 -0
  154. package/dist/src/components/PageHeader/PageHeader.d.ts +12 -0
  155. package/dist/src/components/PageHeader/PageHeader.test.d.ts +1 -0
  156. package/dist/src/components/PageHeader/index.d.ts +1 -0
  157. package/dist/src/components/Pagination/Pagination.d.ts +14 -0
  158. package/dist/src/components/Pagination/Pagination.test.d.ts +1 -0
  159. package/dist/src/components/Pagination/index.d.ts +1 -0
  160. package/dist/src/components/PieChart/PieChart.d.ts +14 -0
  161. package/dist/src/components/PieChart/PieChart.test.d.ts +1 -0
  162. package/dist/src/components/PieChart/index.d.ts +1 -0
  163. package/dist/src/components/ProgressIndicators/ProgressIndicators.d.ts +16 -0
  164. package/dist/src/components/ProgressIndicators/ProgressIndicators.test.d.ts +1 -0
  165. package/dist/src/components/ProgressIndicators/index.d.ts +1 -0
  166. package/dist/src/components/ProgressSteps/ProgressSteps.d.ts +12 -0
  167. package/dist/src/components/ProgressSteps/ProgressSteps.test.d.ts +1 -0
  168. package/dist/src/components/ProgressSteps/index.d.ts +1 -0
  169. package/dist/src/components/RadarChart/RadarChart.d.ts +15 -0
  170. package/dist/src/components/RadarChart/RadarChart.test.d.ts +1 -0
  171. package/dist/src/components/RadarChart/index.d.ts +1 -0
  172. package/dist/src/components/RadioButton/RadioButton.d.ts +4 -0
  173. package/dist/src/components/RadioButton/RadioButton.test.d.ts +1 -0
  174. package/dist/src/components/RadioButton/index.d.ts +1 -0
  175. package/dist/src/components/RadioGroup/RadioGroup.d.ts +17 -0
  176. package/dist/src/components/RadioGroup/RadioGroup.test.d.ts +1 -0
  177. package/dist/src/components/RadioGroup/index.d.ts +1 -0
  178. package/dist/src/components/Rating/Rating.d.ts +15 -0
  179. package/dist/src/components/Rating/Rating.test.d.ts +1 -0
  180. package/dist/src/components/Rating/index.d.ts +1 -0
  181. package/dist/src/components/RichTextEditor/RichTextEditor.d.ts +14 -0
  182. package/dist/src/components/RichTextEditor/RichTextEditor.test.d.ts +1 -0
  183. package/dist/src/components/RichTextEditor/index.d.ts +1 -0
  184. package/dist/src/components/SectionFooter/SectionFooter.d.ts +8 -0
  185. package/dist/src/components/SectionFooter/SectionFooter.test.d.ts +1 -0
  186. package/dist/src/components/SectionFooter/index.d.ts +1 -0
  187. package/dist/src/components/SectionHeader/SectionHeader.d.ts +10 -0
  188. package/dist/src/components/SectionHeader/SectionHeader.test.d.ts +1 -0
  189. package/dist/src/components/SectionHeader/index.d.ts +1 -0
  190. package/dist/src/components/Select/Select.d.ts +22 -0
  191. package/dist/src/components/Select/Select.test.d.ts +1 -0
  192. package/dist/src/components/Select/index.d.ts +1 -0
  193. package/dist/src/components/SidebarNavigation/SidebarNavigation.d.ts +19 -0
  194. package/dist/src/components/SidebarNavigation/SidebarNavigation.test.d.ts +1 -0
  195. package/dist/src/components/SidebarNavigation/index.d.ts +1 -0
  196. package/dist/src/components/SlideoutMenu/SlideoutMenu.d.ts +17 -0
  197. package/dist/src/components/SlideoutMenu/SlideoutMenu.test.d.ts +1 -0
  198. package/dist/src/components/SlideoutMenu/index.d.ts +1 -0
  199. package/dist/src/components/Slider/Slider.d.ts +10 -0
  200. package/dist/src/components/Slider/Slider.test.d.ts +1 -0
  201. package/dist/src/components/Slider/index.d.ts +1 -0
  202. package/dist/src/components/Switch/Switch.d.ts +4 -0
  203. package/dist/src/components/Switch/Switch.test.d.ts +1 -0
  204. package/dist/src/components/Switch/index.d.ts +1 -0
  205. package/dist/src/components/Table/Table.d.ts +34 -0
  206. package/dist/src/components/Table/Table.test.d.ts +1 -0
  207. package/dist/src/components/Table/index.d.ts +1 -0
  208. package/dist/src/components/Tabs/Tabs.d.ts +18 -0
  209. package/dist/src/components/Tabs/Tabs.test.d.ts +1 -0
  210. package/dist/src/components/Tabs/index.d.ts +1 -0
  211. package/dist/src/components/Tag/Tag.d.ts +7 -0
  212. package/dist/src/components/Tag/Tag.test.d.ts +1 -0
  213. package/dist/src/components/Tag/index.d.ts +1 -0
  214. package/dist/src/components/Textarea/Textarea.d.ts +6 -0
  215. package/dist/src/components/Textarea/Textarea.test.d.ts +1 -0
  216. package/dist/src/components/Textarea/index.d.ts +1 -0
  217. package/dist/src/components/Tooltip/Tooltip.d.ts +11 -0
  218. package/dist/src/components/Tooltip/Tooltip.test.d.ts +1 -0
  219. package/dist/src/components/Tooltip/index.d.ts +1 -0
  220. package/dist/src/components/TreeView/TreeView.d.ts +22 -0
  221. package/dist/src/components/TreeView/TreeView.test.d.ts +1 -0
  222. package/dist/src/components/TreeView/index.d.ts +1 -0
  223. package/dist/src/components/UtilityButton/UtilityButton.d.ts +9 -0
  224. package/dist/src/components/UtilityButton/UtilityButton.test.d.ts +1 -0
  225. package/dist/src/components/UtilityButton/index.d.ts +1 -0
  226. package/dist/src/components/VideoPlayer/VideoPlayer.d.ts +20 -0
  227. package/dist/src/components/VideoPlayer/VideoPlayer.test.d.ts +1 -0
  228. package/dist/src/components/VideoPlayer/index.d.ts +1 -0
  229. package/dist/src/hooks/index.d.ts +7 -0
  230. package/dist/src/hooks/useAnchoredPosition.d.ts +12 -0
  231. package/dist/src/hooks/useComposedRefs.d.ts +1 -0
  232. package/dist/src/hooks/useControllableState.d.ts +6 -0
  233. package/dist/src/hooks/useDisclosure.d.ts +13 -0
  234. package/dist/src/hooks/useFocusTrap.d.ts +7 -0
  235. package/dist/src/hooks/useListNavigation.d.ts +15 -0
  236. package/dist/src/hooks/useOutsideInteraction.d.ts +7 -0
  237. package/dist/src/index.d.ts +55 -0
  238. package/dist/src/test/setup.d.ts +0 -0
  239. package/dist/src/utils/FieldWrapper.d.ts +15 -0
  240. package/dist/src/utils/cx.d.ts +1 -0
  241. package/dist/styles.css +5676 -0
  242. package/package.json +43 -0
@@ -0,0 +1,123 @@
1
+ import { cx } from "./index4.js";
2
+ import { Icon } from "./index6.js";
3
+ import { Highlight2, themes_exports } from "./index44.js";
4
+ /* empty css */
5
+ import { forwardRef, useEffect, useId, useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/CodeSnippet/CodeSnippet.tsx
8
+ var CodeSnippet = forwardRef(function CodeSnippet({ className, code, language, title, showLineNumbers = false, maxHeight, copyLabel = "Copy", copiedLabel = "Copied", onCodeCopy, ...props }, ref) {
9
+ const [copied, setCopied] = useState(false);
10
+ const [copyError, setCopyError] = useState(false);
11
+ const liveRegionId = useId();
12
+ useEffect(() => {
13
+ if (!copied) return;
14
+ const timeout = window.setTimeout(() => {
15
+ setCopied(false);
16
+ }, 1600);
17
+ return () => {
18
+ window.clearTimeout(timeout);
19
+ };
20
+ }, [copied]);
21
+ const handleCopy = async () => {
22
+ try {
23
+ if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) await navigator.clipboard.writeText(code);
24
+ setCopied(true);
25
+ setCopyError(false);
26
+ onCodeCopy?.(code);
27
+ } catch {
28
+ setCopied(false);
29
+ setCopyError(true);
30
+ }
31
+ };
32
+ return /* @__PURE__ */ jsxs("figure", {
33
+ ref,
34
+ className: cx("pf-code-snippet", className),
35
+ ...props,
36
+ children: [
37
+ (title || language) && /* @__PURE__ */ jsxs("figcaption", {
38
+ className: "pf-code-snippet__header",
39
+ children: [/* @__PURE__ */ jsxs("div", {
40
+ className: "pf-code-snippet__meta",
41
+ children: [title ? /* @__PURE__ */ jsx("span", {
42
+ className: "pf-code-snippet__title",
43
+ children: title
44
+ }) : null, language ? /* @__PURE__ */ jsx("span", {
45
+ className: "pf-code-snippet__language",
46
+ children: language
47
+ }) : null]
48
+ }), /* @__PURE__ */ jsxs("button", {
49
+ type: "button",
50
+ className: "pf-code-snippet__copy",
51
+ onClick: () => {
52
+ handleCopy();
53
+ },
54
+ "aria-describedby": liveRegionId,
55
+ children: [/* @__PURE__ */ jsx(Icon, {
56
+ name: copied ? "circle-check" : "copy",
57
+ "aria-hidden": true
58
+ }), /* @__PURE__ */ jsx("span", { children: copied ? copiedLabel : copyLabel })]
59
+ })]
60
+ }),
61
+ !(title || language) ? /* @__PURE__ */ jsx("div", {
62
+ className: "pf-code-snippet__toolbar",
63
+ children: /* @__PURE__ */ jsxs("button", {
64
+ type: "button",
65
+ className: "pf-code-snippet__copy",
66
+ onClick: () => {
67
+ handleCopy();
68
+ },
69
+ "aria-describedby": liveRegionId,
70
+ children: [/* @__PURE__ */ jsx(Icon, {
71
+ name: copied ? "circle-check" : "copy",
72
+ "aria-hidden": true
73
+ }), /* @__PURE__ */ jsx("span", { children: copied ? copiedLabel : copyLabel })]
74
+ })
75
+ }) : null,
76
+ /* @__PURE__ */ jsx(Highlight2, {
77
+ code,
78
+ language: language || "tsx",
79
+ theme: themes_exports.vsDark,
80
+ children: ({ className: prismClass, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ jsx("pre", {
81
+ className: cx("pf-code-snippet__pre", prismClass),
82
+ style: {
83
+ ...style,
84
+ ...maxHeight ? {
85
+ maxHeight,
86
+ overflow: "auto"
87
+ } : void 0
88
+ },
89
+ children: /* @__PURE__ */ jsx("code", { children: showLineNumbers ? /* @__PURE__ */ jsx("table", {
90
+ className: "pf-code-snippet__table",
91
+ role: "presentation",
92
+ children: /* @__PURE__ */ jsx("tbody", { children: tokens.map((line, i) => /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("td", {
93
+ className: "pf-code-snippet__line-number",
94
+ "aria-hidden": true,
95
+ children: i + 1
96
+ }), /* @__PURE__ */ jsx("td", {
97
+ className: "pf-code-snippet__line-content",
98
+ children: line.map((token, key) => {
99
+ return /* @__PURE__ */ jsx("span", { ...getTokenProps({ token }) }, key);
100
+ })
101
+ })] }, i)) })
102
+ }) : tokens.map((line, i) => {
103
+ return /* @__PURE__ */ jsx("div", {
104
+ ...getLineProps({ line }),
105
+ children: line.map((token, key) => {
106
+ return /* @__PURE__ */ jsx("span", { ...getTokenProps({ token }) }, key);
107
+ })
108
+ }, i);
109
+ }) })
110
+ })
111
+ }),
112
+ /* @__PURE__ */ jsx("span", {
113
+ id: liveRegionId,
114
+ className: "pf-code-snippet__sr-only",
115
+ "aria-live": "polite",
116
+ children: copyError ? "Copy failed" : copied ? copiedLabel : ""
117
+ })
118
+ ]
119
+ });
120
+ });
121
+ CodeSnippet.displayName = "CodeSnippet";
122
+ //#endregion
123
+ export { CodeSnippet };
@@ -0,0 +1,41 @@
1
+ import { cx } from "./index4.js";
2
+ /* empty css */
3
+ import { forwardRef } from "react";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/components/ContentDivider/ContentDivider.tsx
6
+ var ContentDivider = forwardRef(({ className, label, orientation = "horizontal", inset = false, ...props }, ref) => {
7
+ if (orientation === "vertical") return /* @__PURE__ */ jsx("div", {
8
+ ref,
9
+ ...props,
10
+ className: cx("pf-content-divider", "pf-content-divider--vertical", inset && "pf-content-divider--inset", className),
11
+ role: "separator",
12
+ "aria-orientation": "vertical"
13
+ });
14
+ return /* @__PURE__ */ jsx("div", {
15
+ ref,
16
+ ...props,
17
+ className: cx("pf-content-divider", inset && "pf-content-divider--inset", className),
18
+ role: "separator",
19
+ "aria-orientation": "horizontal",
20
+ children: label ? /* @__PURE__ */ jsxs(Fragment, { children: [
21
+ /* @__PURE__ */ jsx("span", {
22
+ className: "pf-content-divider__line",
23
+ "aria-hidden": true
24
+ }),
25
+ /* @__PURE__ */ jsx("span", {
26
+ className: "pf-content-divider__label",
27
+ children: label
28
+ }),
29
+ /* @__PURE__ */ jsx("span", {
30
+ className: "pf-content-divider__line",
31
+ "aria-hidden": true
32
+ })
33
+ ] }) : /* @__PURE__ */ jsx("span", {
34
+ className: "pf-content-divider__line",
35
+ "aria-hidden": true
36
+ })
37
+ });
38
+ });
39
+ ContentDivider.displayName = "ContentDivider";
40
+ //#endregion
41
+ export { ContentDivider };
@@ -0,0 +1,135 @@
1
+ import { Keys, composeDescribedBy } from "./index3.js";
2
+ import { cx } from "./index4.js";
3
+ import { Icon } from "./index6.js";
4
+ import { FieldWrapper } from "./index19.js";
5
+ import { useAnchoredPosition } from "./index30.js";
6
+ import { useDisclosure } from "./index33.js";
7
+ import { useOutsideInteraction } from "./index36.js";
8
+ import { Calendar } from "./index40.js";
9
+ /* empty css */
10
+ import { forwardRef, useId, useMemo, useRef, useState } from "react";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { createPortal } from "react-dom";
13
+ //#region src/components/DatePicker/DatePicker.tsx
14
+ var toMidday = (date) => {
15
+ const next = new Date(date);
16
+ next.setHours(12, 0, 0, 0);
17
+ return next;
18
+ };
19
+ var DatePicker = forwardRef(function DatePicker({ id, className, value, defaultValue, onValueChange, label, description, error, placeholder = "Select a date", required = false, disabled = false, allowClear = false, disabledDates, showOutsideDays = true, startYear, endYear, "aria-describedby": ariaDescribedBy, ...props }, ref) {
20
+ const generatedId = useId();
21
+ const pickerId = id ?? generatedId;
22
+ const descriptionId = description ? `${pickerId}-description` : void 0;
23
+ const errorId = error ? `${pickerId}-error` : void 0;
24
+ const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId);
25
+ const isControlled = value !== void 0;
26
+ const [internalValue, setInternalValue] = useState(defaultValue ? toMidday(defaultValue) : void 0);
27
+ const selectedDate = isControlled ? value ? toMidday(value) : void 0 : internalValue;
28
+ const disclosure = useDisclosure({ disabled });
29
+ const { isOpen } = disclosure;
30
+ const rootRef = useRef(null);
31
+ const triggerRef = useRef(null);
32
+ const popoverRef = useRef(null);
33
+ const popoverStyle = useAnchoredPosition({
34
+ anchorRef: triggerRef,
35
+ floatingRef: popoverRef,
36
+ enabled: isOpen,
37
+ flip: true,
38
+ matchAnchorWidth: false
39
+ });
40
+ useOutsideInteraction({
41
+ refs: [rootRef, popoverRef],
42
+ enabled: isOpen,
43
+ eventName: "mousedown",
44
+ onInteractOutside: disclosure.close
45
+ });
46
+ const formattedDate = useMemo(() => {
47
+ if (!selectedDate) return "";
48
+ return new Intl.DateTimeFormat("en-US", {
49
+ month: "short",
50
+ day: "numeric",
51
+ year: "numeric"
52
+ }).format(selectedDate);
53
+ }, [selectedDate]);
54
+ const selectDate = (nextDate) => {
55
+ const normalized = toMidday(nextDate);
56
+ if (!isControlled) setInternalValue(normalized);
57
+ onValueChange?.(normalized);
58
+ disclosure.close();
59
+ };
60
+ const clearDate = () => {
61
+ if (!isControlled) setInternalValue(void 0);
62
+ onValueChange?.(void 0);
63
+ };
64
+ return /* @__PURE__ */ jsx(FieldWrapper, {
65
+ ref: rootRef,
66
+ labelFor: `${pickerId}-trigger`,
67
+ label,
68
+ description,
69
+ descriptionId,
70
+ error,
71
+ errorId,
72
+ required,
73
+ children: /* @__PURE__ */ jsxs("div", {
74
+ ref,
75
+ ...props,
76
+ id: pickerId,
77
+ className: cx("pf-date-picker", className),
78
+ "aria-describedby": describedBy,
79
+ children: [/* @__PURE__ */ jsxs("div", {
80
+ className: "pf-date-picker__control-row",
81
+ children: [/* @__PURE__ */ jsxs("button", {
82
+ ref: triggerRef,
83
+ id: `${pickerId}-trigger`,
84
+ type: "button",
85
+ className: cx("pf-date-picker__trigger", error && "pf-date-picker__trigger--invalid"),
86
+ disabled,
87
+ "aria-invalid": error ? true : void 0,
88
+ "aria-haspopup": "dialog",
89
+ "aria-expanded": isOpen,
90
+ "aria-required": required || void 0,
91
+ onClick: () => {
92
+ disclosure.toggle();
93
+ },
94
+ onKeyDown: (event) => {
95
+ if (event.key === Keys.Escape) disclosure.close();
96
+ },
97
+ children: [/* @__PURE__ */ jsx("span", {
98
+ className: cx("pf-date-picker__value", !selectedDate && "pf-date-picker__value--placeholder"),
99
+ children: formattedDate || placeholder
100
+ }), /* @__PURE__ */ jsx(Icon, {
101
+ name: "calendar",
102
+ "aria-hidden": true
103
+ })]
104
+ }), allowClear && selectedDate ? /* @__PURE__ */ jsx("button", {
105
+ type: "button",
106
+ className: "pf-date-picker__icon-button",
107
+ "aria-label": "Clear selected date",
108
+ disabled,
109
+ onClick: clearDate,
110
+ children: /* @__PURE__ */ jsx(Icon, {
111
+ name: "circle-xmark",
112
+ "aria-hidden": true
113
+ })
114
+ }) : null]
115
+ }), isOpen && typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx("div", {
116
+ ref: popoverRef,
117
+ className: "pf-date-picker__popover",
118
+ role: "dialog",
119
+ "aria-label": "Date picker calendar",
120
+ style: popoverStyle,
121
+ children: /* @__PURE__ */ jsx(Calendar, {
122
+ value: selectedDate,
123
+ onValueChange: selectDate,
124
+ disabledDates,
125
+ showOutsideDays,
126
+ startYear,
127
+ endYear
128
+ })
129
+ }), document.body) : null]
130
+ })
131
+ });
132
+ });
133
+ DatePicker.displayName = "DatePicker";
134
+ //#endregion
135
+ export { DatePicker };
@@ -0,0 +1,39 @@
1
+ import { cx } from "./index4.js";
2
+ import { Icon } from "./index6.js";
3
+ /* empty css */
4
+ import { forwardRef } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/EmptyState/EmptyState.tsx
7
+ var EmptyState = forwardRef(function EmptyState({ className, heading, description, icon, iconName, action, size = "md", ...props }, ref) {
8
+ const resolvedIcon = icon ?? (iconName ? /* @__PURE__ */ jsx(Icon, {
9
+ name: iconName,
10
+ "aria-hidden": true
11
+ }) : null);
12
+ return /* @__PURE__ */ jsxs("div", {
13
+ ref,
14
+ className: cx("pf-empty-state", `pf-empty-state--${size}`, className),
15
+ ...props,
16
+ children: [
17
+ resolvedIcon ? /* @__PURE__ */ jsx("span", {
18
+ className: "pf-empty-state__icon",
19
+ "aria-hidden": true,
20
+ children: resolvedIcon
21
+ }) : null,
22
+ /* @__PURE__ */ jsx("p", {
23
+ className: "pf-empty-state__heading",
24
+ children: heading
25
+ }),
26
+ description ? /* @__PURE__ */ jsx("p", {
27
+ className: "pf-empty-state__description",
28
+ children: description
29
+ }) : null,
30
+ action ? /* @__PURE__ */ jsx("div", {
31
+ className: "pf-empty-state__action",
32
+ children: action
33
+ }) : null
34
+ ]
35
+ });
36
+ });
37
+ EmptyState.displayName = "EmptyState";
38
+ //#endregion
39
+ export { EmptyState };
@@ -0,0 +1,186 @@
1
+ import { cx } from "./index4.js";
2
+ import { Icon } from "./index6.js";
3
+ import { FieldWrapper } from "./index19.js";
4
+ /* empty css */
5
+ import { forwardRef, useId, useMemo, useRef, useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/FileUploader/FileUploader.tsx
8
+ var bytesToSize = (bytes) => {
9
+ if (bytes < 1024) return `${bytes} B`;
10
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
11
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
12
+ };
13
+ var FileUploader = forwardRef(function FileUploader({ id, className, label, description, error, accept, multiple = true, maxFiles, maxFileSize, required, disabled = false, value, defaultValue = [], onFilesChange, "aria-describedby": ariaDescribedBy, ...props }, ref) {
14
+ const generatedId = useId();
15
+ const uploaderId = id ?? generatedId;
16
+ const inputId = `${uploaderId}-input`;
17
+ const descriptionId = description ? `${uploaderId}-description` : void 0;
18
+ const errorId = error ? `${uploaderId}-error` : void 0;
19
+ const internalErrorId = `${uploaderId}-internal-error`;
20
+ const describedBy = [
21
+ ariaDescribedBy,
22
+ descriptionId,
23
+ errorId,
24
+ internalErrorId
25
+ ].filter(Boolean).join(" ") || void 0;
26
+ const isControlled = value !== void 0;
27
+ const [internalFiles, setInternalFiles] = useState(defaultValue);
28
+ const [dragActive, setDragActive] = useState(false);
29
+ const [internalError, setInternalError] = useState(void 0);
30
+ const files = isControlled ? value ?? [] : internalFiles;
31
+ const inputRef = useRef(null);
32
+ const setFiles = (nextFiles) => {
33
+ if (!isControlled) setInternalFiles(nextFiles);
34
+ onFilesChange?.(nextFiles);
35
+ };
36
+ const validateFiles = (incoming) => {
37
+ if (maxFileSize) {
38
+ const oversized = incoming.find((file) => file.size > maxFileSize);
39
+ if (oversized) return `"${oversized.name}" exceeds the ${bytesToSize(maxFileSize)} size limit.`;
40
+ }
41
+ if (maxFiles && incoming.length > maxFiles) return `You can upload up to ${maxFiles} file${maxFiles === 1 ? "" : "s"}.`;
42
+ };
43
+ const addFiles = (selected) => {
44
+ if (!selected || disabled) return;
45
+ const incoming = Array.from(selected);
46
+ const merged = multiple ? [...files, ...incoming] : incoming.slice(0, 1);
47
+ const deduped = Array.from(new Map(merged.map((file) => [`${file.name}-${file.size}-${file.lastModified}`, file])).values());
48
+ const nextFiles = maxFiles ? deduped.slice(0, maxFiles) : deduped;
49
+ const nextError = validateFiles(nextFiles);
50
+ if (nextError) {
51
+ setInternalError(nextError);
52
+ return;
53
+ }
54
+ setInternalError(void 0);
55
+ setFiles(nextFiles);
56
+ if (inputRef.current) inputRef.current.value = "";
57
+ };
58
+ const removeFile = (index) => {
59
+ const next = files.filter((_, fileIndex) => fileIndex !== index);
60
+ setInternalError(void 0);
61
+ setFiles(next);
62
+ };
63
+ const hintText = useMemo(() => {
64
+ const parts = [];
65
+ if (accept) parts.push(`Accepted: ${accept}`);
66
+ if (maxFileSize) parts.push(`Max size: ${bytesToSize(maxFileSize)}`);
67
+ if (maxFiles) parts.push(`Max files: ${maxFiles}`);
68
+ return parts.join(" | ");
69
+ }, [
70
+ accept,
71
+ maxFileSize,
72
+ maxFiles
73
+ ]);
74
+ return /* @__PURE__ */ jsx(FieldWrapper, {
75
+ labelFor: inputId,
76
+ label,
77
+ description,
78
+ descriptionId,
79
+ error,
80
+ errorId,
81
+ required,
82
+ footer: internalError ? /* @__PURE__ */ jsx("p", {
83
+ className: "pf-field__error",
84
+ id: internalErrorId,
85
+ children: internalError
86
+ }) : null,
87
+ children: /* @__PURE__ */ jsxs("div", {
88
+ ref,
89
+ ...props,
90
+ id: uploaderId,
91
+ className: cx("pf-file-uploader", className),
92
+ children: [
93
+ /* @__PURE__ */ jsx("input", {
94
+ ref: inputRef,
95
+ id: inputId,
96
+ type: "file",
97
+ className: "pf-file-uploader__input",
98
+ accept,
99
+ multiple,
100
+ required,
101
+ disabled,
102
+ onChange: (event) => {
103
+ addFiles(event.target.files);
104
+ }
105
+ }),
106
+ /* @__PURE__ */ jsxs("button", {
107
+ type: "button",
108
+ className: cx("pf-file-uploader__dropzone", dragActive && "pf-file-uploader__dropzone--active", (error || internalError) && "pf-file-uploader__dropzone--invalid"),
109
+ onClick: () => {
110
+ inputRef.current?.click();
111
+ },
112
+ onDragEnter: (event) => {
113
+ event.preventDefault();
114
+ if (!disabled) setDragActive(true);
115
+ },
116
+ onDragOver: (event) => {
117
+ event.preventDefault();
118
+ },
119
+ onDragLeave: (event) => {
120
+ event.preventDefault();
121
+ setDragActive(false);
122
+ },
123
+ onDrop: (event) => {
124
+ event.preventDefault();
125
+ setDragActive(false);
126
+ addFiles(event.dataTransfer.files);
127
+ },
128
+ disabled,
129
+ "aria-invalid": error || internalError ? true : void 0,
130
+ "aria-describedby": describedBy,
131
+ children: [
132
+ /* @__PURE__ */ jsx("span", {
133
+ className: "pf-file-uploader__icon",
134
+ "aria-hidden": true,
135
+ children: /* @__PURE__ */ jsx(Icon, { name: "file-arrow-up" })
136
+ }),
137
+ /* @__PURE__ */ jsx("span", {
138
+ className: "pf-file-uploader__title",
139
+ children: "Upload files"
140
+ }),
141
+ /* @__PURE__ */ jsx("span", {
142
+ className: "pf-file-uploader__subtitle",
143
+ children: "Drag and drop files here, or click to browse."
144
+ }),
145
+ hintText ? /* @__PURE__ */ jsx("span", {
146
+ className: "pf-file-uploader__hint",
147
+ children: hintText
148
+ }) : null
149
+ ]
150
+ }),
151
+ files.length > 0 ? /* @__PURE__ */ jsx("ul", {
152
+ className: "pf-file-uploader__list",
153
+ "aria-label": "Selected files",
154
+ children: files.map((file, index) => /* @__PURE__ */ jsxs("li", {
155
+ className: "pf-file-uploader__list-item",
156
+ children: [/* @__PURE__ */ jsxs("span", {
157
+ className: "pf-file-uploader__file-meta",
158
+ children: [/* @__PURE__ */ jsx("span", {
159
+ className: "pf-file-uploader__file-name",
160
+ children: file.name
161
+ }), /* @__PURE__ */ jsx("span", {
162
+ className: "pf-file-uploader__file-size",
163
+ children: bytesToSize(file.size)
164
+ })]
165
+ }), /* @__PURE__ */ jsx("button", {
166
+ type: "button",
167
+ className: "pf-file-uploader__remove",
168
+ onClick: () => {
169
+ removeFile(index);
170
+ },
171
+ "aria-label": `Remove ${file.name}`,
172
+ disabled,
173
+ children: /* @__PURE__ */ jsx(Icon, {
174
+ name: "circle-xmark",
175
+ "aria-hidden": true
176
+ })
177
+ })]
178
+ }, `${file.name}-${file.size}-${file.lastModified}`))
179
+ }) : null
180
+ ]
181
+ })
182
+ });
183
+ });
184
+ FileUploader.displayName = "FileUploader";
185
+ //#endregion
186
+ export { FileUploader };
@@ -0,0 +1,63 @@
1
+ import { cx } from "./index4.js";
2
+ /* empty css */
3
+ import { forwardRef } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/components/HeaderNavigation/HeaderNavigation.tsx
6
+ var HeaderNavigation = forwardRef(function HeaderNavigation({ className, brand, items, actions, "aria-label": ariaLabel = "Header navigation", ...props }, ref) {
7
+ return /* @__PURE__ */ jsx("header", {
8
+ ref,
9
+ className: cx("pf-header-navigation", className),
10
+ ...props,
11
+ children: /* @__PURE__ */ jsxs("nav", {
12
+ className: "pf-header-navigation__nav",
13
+ "aria-label": ariaLabel,
14
+ children: [
15
+ brand ? /* @__PURE__ */ jsx("div", {
16
+ className: "pf-header-navigation__brand",
17
+ children: brand
18
+ }) : null,
19
+ /* @__PURE__ */ jsx("ul", {
20
+ className: "pf-header-navigation__list",
21
+ children: items.map((item, index) => {
22
+ const key = `${index}-${typeof item.label === "string" ? item.label : "item"}`;
23
+ if (item.href) return /* @__PURE__ */ jsx("li", {
24
+ className: "pf-header-navigation__item",
25
+ children: /* @__PURE__ */ jsx("a", {
26
+ href: item.href,
27
+ onClick: item.onClick,
28
+ className: cx("pf-header-navigation__link", item.active && "pf-header-navigation__link--active"),
29
+ "aria-current": item.active ? "page" : void 0,
30
+ children: item.label
31
+ })
32
+ }, key);
33
+ if (item.onClick) return /* @__PURE__ */ jsx("li", {
34
+ className: "pf-header-navigation__item",
35
+ children: /* @__PURE__ */ jsx("button", {
36
+ type: "button",
37
+ onClick: item.onClick,
38
+ className: cx("pf-header-navigation__link", item.active && "pf-header-navigation__link--active"),
39
+ "aria-current": item.active ? "page" : void 0,
40
+ children: item.label
41
+ })
42
+ }, key);
43
+ return /* @__PURE__ */ jsx("li", {
44
+ className: "pf-header-navigation__item",
45
+ children: /* @__PURE__ */ jsx("span", {
46
+ className: cx("pf-header-navigation__link", item.active && "pf-header-navigation__link--active"),
47
+ "aria-current": item.active ? "page" : void 0,
48
+ children: item.label
49
+ })
50
+ }, key);
51
+ })
52
+ }),
53
+ actions ? /* @__PURE__ */ jsx("div", {
54
+ className: "pf-header-navigation__actions",
55
+ children: actions
56
+ }) : null
57
+ ]
58
+ })
59
+ });
60
+ });
61
+ HeaderNavigation.displayName = "HeaderNavigation";
62
+ //#endregion
63
+ export { HeaderNavigation };
@@ -0,0 +1,45 @@
1
+ import { cx } from "./index4.js";
2
+ import { Icon } from "./index6.js";
3
+ /* empty css */
4
+ import { forwardRef } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/InlineCTA/InlineCTA.tsx
7
+ var InlineCTA = forwardRef(function InlineCTA({ className, heading, description, action, icon, iconName = "circle-question", tone = "default", children, ...props }, ref) {
8
+ const resolvedIcon = icon ?? /* @__PURE__ */ jsx(Icon, {
9
+ name: iconName,
10
+ "aria-hidden": true
11
+ });
12
+ return /* @__PURE__ */ jsxs("div", {
13
+ ref,
14
+ className: cx("pf-inline-cta", `pf-inline-cta--${tone}`, className),
15
+ ...props,
16
+ children: [
17
+ /* @__PURE__ */ jsx("span", {
18
+ className: "pf-inline-cta__icon",
19
+ "aria-hidden": true,
20
+ children: resolvedIcon
21
+ }),
22
+ /* @__PURE__ */ jsxs("div", {
23
+ className: "pf-inline-cta__content",
24
+ children: [
25
+ heading ? /* @__PURE__ */ jsx("p", {
26
+ className: "pf-inline-cta__heading",
27
+ children: heading
28
+ }) : null,
29
+ description ? /* @__PURE__ */ jsx("p", {
30
+ className: "pf-inline-cta__description",
31
+ children: description
32
+ }) : null,
33
+ children
34
+ ]
35
+ }),
36
+ action ? /* @__PURE__ */ jsx("div", {
37
+ className: "pf-inline-cta__action",
38
+ children: action
39
+ }) : null
40
+ ]
41
+ });
42
+ });
43
+ InlineCTA.displayName = "InlineCTA";
44
+ //#endregion
45
+ export { InlineCTA };