@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,116 @@
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/RadarChart/RadarChart.tsx
6
+ function polarToCartesian(cx, cy, radius, angle) {
7
+ return {
8
+ x: cx + radius * Math.cos(angle),
9
+ y: cy + radius * Math.sin(angle)
10
+ };
11
+ }
12
+ function toPointsString(points) {
13
+ return points.map((point) => `${point.x.toFixed(2)},${point.y.toFixed(2)}`).join(" ");
14
+ }
15
+ var RadarChart = forwardRef(function RadarChart({ className, data, size = 280, max, levels = 4, showAxes = true, showLegend = true, strokeColor = "var(--color-semantic-action-primary)", fillColor = "rgb(249 115 22 / 0.18)", ...props }, ref) {
16
+ const safeData = data.filter((item) => item.value >= 0);
17
+ const count = safeData.length;
18
+ const safeSize = Math.max(size, 180);
19
+ const safeLevels = Math.max(2, levels);
20
+ if (count < 3) return /* @__PURE__ */ jsx("div", {
21
+ ref,
22
+ className: cx("pf-radar-chart", className),
23
+ ...props,
24
+ children: /* @__PURE__ */ jsx("div", {
25
+ className: "pf-radar-chart__empty",
26
+ children: "RadarChart needs at least 3 data points."
27
+ })
28
+ });
29
+ const center = safeSize / 2;
30
+ const outerRadius = center - 36;
31
+ const computedMax = max ?? Math.max(...safeData.map((item) => item.value), 1);
32
+ const safeMax = computedMax > 0 ? computedMax : 1;
33
+ const baseAngle = -Math.PI / 2;
34
+ const angleStep = 2 * Math.PI / count;
35
+ const axes = safeData.map((item, index) => {
36
+ const angle = baseAngle + index * angleStep;
37
+ return {
38
+ item,
39
+ angle,
40
+ end: polarToCartesian(center, center, outerRadius, angle)
41
+ };
42
+ });
43
+ const gridPolygons = Array.from({ length: safeLevels }, (_, levelIndex) => {
44
+ const ratio = (levelIndex + 1) / safeLevels;
45
+ return toPointsString(axes.map((axis) => polarToCartesian(center, center, outerRadius * ratio, axis.angle)));
46
+ });
47
+ const valuePoints = axes.map((axis) => {
48
+ return polarToCartesian(center, center, outerRadius * Math.max(0, Math.min(1, axis.item.value / safeMax)), axis.angle);
49
+ });
50
+ const valuePolygon = toPointsString(valuePoints);
51
+ return /* @__PURE__ */ jsxs("div", {
52
+ ref,
53
+ className: cx("pf-radar-chart", className),
54
+ ...props,
55
+ children: [/* @__PURE__ */ jsxs("svg", {
56
+ className: "pf-radar-chart__svg",
57
+ viewBox: `0 0 ${safeSize} ${safeSize}`,
58
+ role: "img",
59
+ "aria-label": "Radar chart",
60
+ children: [
61
+ gridPolygons.map((points, index) => /* @__PURE__ */ jsx("polygon", {
62
+ className: "pf-radar-chart__grid",
63
+ points
64
+ }, `grid-${index}`)),
65
+ showAxes ? axes.map((axis, index) => /* @__PURE__ */ jsx("line", {
66
+ className: "pf-radar-chart__axis",
67
+ x1: center,
68
+ y1: center,
69
+ x2: axis.end.x,
70
+ y2: axis.end.y
71
+ }, `axis-${index}`)) : null,
72
+ /* @__PURE__ */ jsx("polygon", {
73
+ className: "pf-radar-chart__area",
74
+ points: valuePolygon,
75
+ style: {
76
+ fill: fillColor,
77
+ stroke: strokeColor
78
+ }
79
+ }),
80
+ valuePoints.map((point, index) => /* @__PURE__ */ jsx("circle", {
81
+ className: "pf-radar-chart__point",
82
+ cx: point.x,
83
+ cy: point.y,
84
+ r: 3,
85
+ style: { fill: strokeColor }
86
+ }, `point-${index}`)),
87
+ axes.map((axis, index) => {
88
+ const labelPoint = polarToCartesian(center, center, outerRadius + 18, axis.angle);
89
+ return /* @__PURE__ */ jsx("text", {
90
+ className: "pf-radar-chart__label",
91
+ x: labelPoint.x,
92
+ y: labelPoint.y,
93
+ textAnchor: "middle",
94
+ dominantBaseline: "middle",
95
+ children: axis.item.label
96
+ }, `label-${index}`);
97
+ })
98
+ ]
99
+ }), showLegend ? /* @__PURE__ */ jsx("ul", {
100
+ className: "pf-radar-chart__legend",
101
+ children: safeData.map((item, index) => /* @__PURE__ */ jsxs("li", {
102
+ className: "pf-radar-chart__legend-item",
103
+ children: [/* @__PURE__ */ jsx("span", {
104
+ className: "pf-radar-chart__legend-label",
105
+ children: item.label
106
+ }), /* @__PURE__ */ jsx("span", {
107
+ className: "pf-radar-chart__legend-value",
108
+ children: item.value
109
+ })]
110
+ }, `${index}-${item.value}`))
111
+ }) : null]
112
+ });
113
+ });
114
+ RadarChart.displayName = "RadarChart";
115
+ //#endregion
116
+ export { RadarChart };
@@ -0,0 +1,25 @@
1
+ import { cx } from "./index4.js";
2
+ /* empty css */
3
+ import { forwardRef, useId } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/components/RadioButton/RadioButton.tsx
6
+ var RadioButton = forwardRef(({ id, label, className, ...props }, ref) => {
7
+ const generatedId = useId();
8
+ const radioId = id ?? generatedId;
9
+ return /* @__PURE__ */ jsxs("div", {
10
+ className: "pf-radio-field",
11
+ children: [/* @__PURE__ */ jsx("input", {
12
+ ref,
13
+ id: radioId,
14
+ type: "radio",
15
+ className: cx("pf-radio", className),
16
+ ...props
17
+ }), label ? /* @__PURE__ */ jsx("label", {
18
+ htmlFor: radioId,
19
+ children: label
20
+ }) : null]
21
+ });
22
+ });
23
+ RadioButton.displayName = "RadioButton";
24
+ //#endregion
25
+ export { RadioButton };
@@ -0,0 +1,56 @@
1
+ import { cx } from "./index4.js";
2
+ /* empty css */
3
+ import { forwardRef, useId, useState } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/components/RadioGroup/RadioGroup.tsx
6
+ var RadioGroup = forwardRef(({ name, legend, options, value, defaultValue, onValueChange, disabled = false, orientation = "vertical", className, ...props }, ref) => {
7
+ const generatedName = useId();
8
+ const groupName = name ?? generatedName;
9
+ const isControlled = value !== void 0;
10
+ const [internalValue, setInternalValue] = useState(defaultValue);
11
+ const selectedValue = isControlled ? value : internalValue;
12
+ const handleChange = (nextValue) => {
13
+ if (!isControlled) setInternalValue(nextValue);
14
+ onValueChange?.(nextValue);
15
+ };
16
+ return /* @__PURE__ */ jsxs("fieldset", {
17
+ ref,
18
+ className: cx("pf-radio-group", orientation === "horizontal" && "pf-radio-group--horizontal", className),
19
+ disabled,
20
+ ...props,
21
+ children: [legend ? /* @__PURE__ */ jsx("legend", {
22
+ className: "pf-radio-group__legend",
23
+ children: legend
24
+ }) : null, options.map((option) => {
25
+ const optionId = `${groupName}-${option.value}`;
26
+ const checked = selectedValue === option.value;
27
+ const optionDisabled = disabled || option.disabled;
28
+ return /* @__PURE__ */ jsxs("div", {
29
+ className: "pf-radio-group__item",
30
+ children: [/* @__PURE__ */ jsx("input", {
31
+ id: optionId,
32
+ className: "pf-radio-group__input",
33
+ type: "radio",
34
+ name: groupName,
35
+ value: option.value,
36
+ checked,
37
+ disabled: optionDisabled,
38
+ onChange: () => handleChange(option.value)
39
+ }), /* @__PURE__ */ jsxs("label", {
40
+ htmlFor: optionId,
41
+ className: "pf-radio-group__label",
42
+ children: [/* @__PURE__ */ jsx("span", {
43
+ className: "pf-radio-group__label-text",
44
+ children: option.label
45
+ }), option.description ? /* @__PURE__ */ jsx("span", {
46
+ className: "pf-radio-group__description",
47
+ children: option.description
48
+ }) : null]
49
+ })]
50
+ }, option.value);
51
+ })]
52
+ });
53
+ });
54
+ RadioGroup.displayName = "RadioGroup";
55
+ //#endregion
56
+ export { RadioGroup };
@@ -0,0 +1,88 @@
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/Rating/Rating.tsx
7
+ var clampRating = (value, max) => Math.min(Math.max(value, 0), max);
8
+ var getStarFillPercent = (value, index) => {
9
+ if (value >= index + 1) return 100;
10
+ if (value > index) return Math.round((value - index) * 100);
11
+ return 0;
12
+ };
13
+ var RatingStars = forwardRef(function RatingStars({ value, max = 5, size = 18, showValue = false, ariaLabel, className, ...props }, ref) {
14
+ const clampedValue = clampRating(value, max);
15
+ return /* @__PURE__ */ jsxs("div", {
16
+ ref,
17
+ className: cx("pf-rating-stars", className),
18
+ role: "img",
19
+ "aria-label": ariaLabel ?? `Rating ${clampedValue} out of ${max}`,
20
+ ...props,
21
+ children: [/* @__PURE__ */ jsx("div", {
22
+ className: "pf-rating-stars__track",
23
+ "aria-hidden": true,
24
+ children: Array.from({ length: max }, (_, index) => {
25
+ return /* @__PURE__ */ jsxs("span", {
26
+ className: "pf-rating-stars__star",
27
+ style: {
28
+ "--pf-rating-fill": `${getStarFillPercent(clampedValue, index)}%`,
29
+ "--pf-rating-size": `${size}px`
30
+ },
31
+ children: [/* @__PURE__ */ jsx(Icon, {
32
+ name: "star",
33
+ "aria-hidden": true,
34
+ className: "pf-rating-stars__star-icon pf-rating-stars__star-icon--base"
35
+ }), /* @__PURE__ */ jsx("span", {
36
+ className: "pf-rating-stars__star-fill",
37
+ "aria-hidden": true,
38
+ children: /* @__PURE__ */ jsx(Icon, {
39
+ name: "star",
40
+ className: "pf-rating-stars__star-icon pf-rating-stars__star-icon--fill"
41
+ })
42
+ })]
43
+ }, index);
44
+ })
45
+ }), showValue ? /* @__PURE__ */ jsx("span", {
46
+ className: "pf-rating-stars__value",
47
+ children: clampedValue.toFixed(1)
48
+ }) : null]
49
+ });
50
+ });
51
+ RatingStars.displayName = "RatingStars";
52
+ var RatingBadge = forwardRef(function RatingBadge({ value, max = 5, reviews, size = "md", className, ...props }, ref) {
53
+ const clampedValue = clampRating(value, max);
54
+ return /* @__PURE__ */ jsxs("span", {
55
+ ref,
56
+ className: cx("pf-rating-badge", `pf-rating-badge--${size}`, className),
57
+ ...props,
58
+ children: [
59
+ /* @__PURE__ */ jsx(Icon, {
60
+ name: "star",
61
+ "aria-hidden": true,
62
+ className: "pf-rating-badge__icon"
63
+ }),
64
+ /* @__PURE__ */ jsxs("span", {
65
+ className: "pf-rating-badge__value",
66
+ children: [
67
+ clampedValue.toFixed(1),
68
+ /* @__PURE__ */ jsx("span", {
69
+ className: "pf-rating-badge__separator",
70
+ children: "/"
71
+ }),
72
+ max.toFixed(1)
73
+ ]
74
+ }),
75
+ typeof reviews === "number" ? /* @__PURE__ */ jsxs("span", {
76
+ className: "pf-rating-badge__reviews",
77
+ children: [
78
+ "(",
79
+ reviews.toLocaleString(),
80
+ ")"
81
+ ]
82
+ }) : null
83
+ ]
84
+ });
85
+ });
86
+ RatingBadge.displayName = "RatingBadge";
87
+ //#endregion
88
+ export { RatingBadge, RatingStars };
@@ -0,0 +1,167 @@
1
+ import { composeDescribedBy } from "./index3.js";
2
+ import { cx } from "./index4.js";
3
+ import { FieldWrapper } from "./index19.js";
4
+ /* empty css */
5
+ import { forwardRef, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/RichTextEditor/RichTextEditor.tsx
8
+ var stripOuterPTags = (html) => {
9
+ if (!html) return "";
10
+ const trimmed = html.trim();
11
+ if (trimmed.startsWith("<p>") && trimmed.endsWith("</p>") && trimmed.indexOf("<p>") === 0 && trimmed.lastIndexOf("</p>") === trimmed.length - 4) return trimmed.slice(3, -4);
12
+ return html;
13
+ };
14
+ var normalizeHtml = (value) => stripOuterPTags(value ?? "");
15
+ var getTextLength = (element) => element.textContent?.length ?? 0;
16
+ var RichTextEditor = forwardRef(({ id, label, description, error, value, defaultValue, onChange, placeholder = "Start typing...", minHeight = 140, characterMax, required = false, disabled = false, className, "aria-describedby": ariaDescribedBy, ...props }, ref) => {
17
+ const generatedId = useId();
18
+ const editorId = id ?? generatedId;
19
+ const descriptionId = description ? `${editorId}-description` : void 0;
20
+ const errorId = error ? `${editorId}-error` : void 0;
21
+ const countId = typeof characterMax === "number" ? `${editorId}-count` : void 0;
22
+ const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId, countId);
23
+ const editorRef = useRef(null);
24
+ const lastValidHtmlRef = useRef("");
25
+ const [characterCount, setCharacterCount] = useState(0);
26
+ const isControlled = value !== void 0;
27
+ useImperativeHandle(ref, () => editorRef.current, []);
28
+ useEffect(() => {
29
+ if (!editorRef.current) return;
30
+ const nextValue = normalizeHtml(isControlled ? value : defaultValue);
31
+ if (editorRef.current.innerHTML !== nextValue) editorRef.current.innerHTML = nextValue;
32
+ lastValidHtmlRef.current = nextValue;
33
+ setCharacterCount(getTextLength(editorRef.current));
34
+ }, [
35
+ defaultValue,
36
+ isControlled,
37
+ value
38
+ ]);
39
+ const emitChange = () => {
40
+ if (!editorRef.current) return;
41
+ onChange?.(editorRef.current.innerHTML);
42
+ };
43
+ const enforceLimitAndEmit = () => {
44
+ if (!editorRef.current) return;
45
+ const nextLength = getTextLength(editorRef.current);
46
+ if (typeof characterMax === "number" && nextLength > characterMax) {
47
+ editorRef.current.innerHTML = lastValidHtmlRef.current;
48
+ setCharacterCount(getTextLength(editorRef.current));
49
+ return;
50
+ }
51
+ lastValidHtmlRef.current = editorRef.current.innerHTML;
52
+ setCharacterCount(nextLength);
53
+ emitChange();
54
+ };
55
+ const handleCommand = (command) => {
56
+ if (!editorRef.current || disabled) return;
57
+ editorRef.current.focus();
58
+ document.execCommand(command);
59
+ enforceLimitAndEmit();
60
+ };
61
+ return /* @__PURE__ */ jsxs(FieldWrapper, {
62
+ labelFor: editorId,
63
+ label,
64
+ description,
65
+ descriptionId,
66
+ error,
67
+ errorId,
68
+ required,
69
+ children: [/* @__PURE__ */ jsxs("div", {
70
+ className: cx("pf-rte", error && "pf-rte--invalid", disabled && "pf-rte--disabled", className),
71
+ children: [/* @__PURE__ */ jsxs("div", {
72
+ className: "pf-rte__toolbar",
73
+ role: "toolbar",
74
+ "aria-label": "Formatting options",
75
+ children: [
76
+ /* @__PURE__ */ jsx("button", {
77
+ type: "button",
78
+ className: "pf-rte__tool",
79
+ onMouseDown: (event) => event.preventDefault(),
80
+ onClick: () => handleCommand("bold"),
81
+ disabled,
82
+ "aria-label": "Bold",
83
+ children: "B"
84
+ }),
85
+ /* @__PURE__ */ jsx("button", {
86
+ type: "button",
87
+ className: "pf-rte__tool",
88
+ onMouseDown: (event) => event.preventDefault(),
89
+ onClick: () => handleCommand("italic"),
90
+ disabled,
91
+ "aria-label": "Italic",
92
+ children: "I"
93
+ }),
94
+ /* @__PURE__ */ jsx("button", {
95
+ type: "button",
96
+ className: "pf-rte__tool",
97
+ onMouseDown: (event) => event.preventDefault(),
98
+ onClick: () => handleCommand("underline"),
99
+ disabled,
100
+ "aria-label": "Underline",
101
+ children: "U"
102
+ }),
103
+ /* @__PURE__ */ jsx("span", {
104
+ className: "pf-rte__divider",
105
+ "aria-hidden": true
106
+ }),
107
+ /* @__PURE__ */ jsx("button", {
108
+ type: "button",
109
+ className: "pf-rte__tool",
110
+ onMouseDown: (event) => event.preventDefault(),
111
+ onClick: () => handleCommand("insertUnorderedList"),
112
+ disabled,
113
+ "aria-label": "Bulleted list",
114
+ children: "• List"
115
+ }),
116
+ /* @__PURE__ */ jsx("button", {
117
+ type: "button",
118
+ className: "pf-rte__tool",
119
+ onMouseDown: (event) => event.preventDefault(),
120
+ onClick: () => handleCommand("insertOrderedList"),
121
+ disabled,
122
+ "aria-label": "Numbered list",
123
+ children: "1. List"
124
+ }),
125
+ /* @__PURE__ */ jsx("button", {
126
+ type: "button",
127
+ className: "pf-rte__tool",
128
+ onMouseDown: (event) => event.preventDefault(),
129
+ onClick: () => handleCommand("removeFormat"),
130
+ disabled,
131
+ "aria-label": "Clear formatting",
132
+ children: "Clear"
133
+ })
134
+ ]
135
+ }), /* @__PURE__ */ jsx("div", {
136
+ id: editorId,
137
+ ref: editorRef,
138
+ className: "pf-rte__editor",
139
+ contentEditable: !disabled,
140
+ role: "textbox",
141
+ "aria-multiline": "true",
142
+ "aria-labelledby": label ? `${editorId}-label` : void 0,
143
+ "aria-required": required || void 0,
144
+ "aria-invalid": error ? true : void 0,
145
+ "aria-describedby": describedBy,
146
+ "aria-disabled": disabled ? true : void 0,
147
+ "data-placeholder": placeholder,
148
+ suppressContentEditableWarning: true,
149
+ onInput: enforceLimitAndEmit,
150
+ style: { "--pf-rte-min-height": `${minHeight}px` },
151
+ ...props
152
+ })]
153
+ }), typeof characterMax === "number" ? /* @__PURE__ */ jsxs("p", {
154
+ className: "pf-rte__count",
155
+ id: countId,
156
+ "aria-live": "polite",
157
+ children: [
158
+ characterCount,
159
+ "/",
160
+ characterMax
161
+ ]
162
+ }) : null]
163
+ });
164
+ });
165
+ RichTextEditor.displayName = "RichTextEditor";
166
+ //#endregion
167
+ export { RichTextEditor };
@@ -0,0 +1,32 @@
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/SectionFooter/SectionFooter.tsx
6
+ var SectionFooter = forwardRef(function SectionFooter({ className, heading, description, actions, divider = true, align = "between", children, ...props }, ref) {
7
+ return /* @__PURE__ */ jsxs("footer", {
8
+ ref,
9
+ className: cx("pf-section-footer", divider && "pf-section-footer--divider", `pf-section-footer--${align}`, className),
10
+ ...props,
11
+ children: [/* @__PURE__ */ jsxs("div", {
12
+ className: "pf-section-footer__content",
13
+ children: [
14
+ heading ? /* @__PURE__ */ jsx("h3", {
15
+ className: "pf-section-footer__heading",
16
+ children: heading
17
+ }) : null,
18
+ description ? /* @__PURE__ */ jsx("p", {
19
+ className: "pf-section-footer__description",
20
+ children: description
21
+ }) : null,
22
+ children
23
+ ]
24
+ }), actions ? /* @__PURE__ */ jsx("div", {
25
+ className: "pf-section-footer__actions",
26
+ children: actions
27
+ }) : null]
28
+ });
29
+ });
30
+ SectionFooter.displayName = "SectionFooter";
31
+ //#endregion
32
+ export { SectionFooter };
@@ -0,0 +1,40 @@
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/SectionHeader/SectionHeader.tsx
6
+ var SectionHeader = forwardRef(function SectionHeader({ className, eyebrow, heading, description, metadata, actions, divider = false, align = "between", children, ...props }, ref) {
7
+ return /* @__PURE__ */ jsxs("header", {
8
+ ref,
9
+ className: cx("pf-section-header", divider && "pf-section-header--divider", `pf-section-header--${align}`, className),
10
+ ...props,
11
+ children: [/* @__PURE__ */ jsxs("div", {
12
+ className: "pf-section-header__content",
13
+ children: [
14
+ eyebrow ? /* @__PURE__ */ jsx("p", {
15
+ className: "pf-section-header__eyebrow",
16
+ children: eyebrow
17
+ }) : null,
18
+ /* @__PURE__ */ jsx("h2", {
19
+ className: "pf-section-header__heading",
20
+ children: heading
21
+ }),
22
+ description ? /* @__PURE__ */ jsx("p", {
23
+ className: "pf-section-header__description",
24
+ children: description
25
+ }) : null,
26
+ metadata ? /* @__PURE__ */ jsx("div", {
27
+ className: "pf-section-header__metadata",
28
+ children: metadata
29
+ }) : null,
30
+ children
31
+ ]
32
+ }), actions ? /* @__PURE__ */ jsx("div", {
33
+ className: "pf-section-header__actions",
34
+ children: actions
35
+ }) : null]
36
+ });
37
+ });
38
+ SectionHeader.displayName = "SectionHeader";
39
+ //#endregion
40
+ export { SectionHeader };
@@ -0,0 +1,87 @@
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/SidebarNavigation/SidebarNavigation.tsx
6
+ function renderItem(item, key) {
7
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
8
+ item.icon ? /* @__PURE__ */ jsx("span", {
9
+ className: "pf-sidebar-navigation__icon",
10
+ children: item.icon
11
+ }) : null,
12
+ /* @__PURE__ */ jsx("span", {
13
+ className: "pf-sidebar-navigation__label",
14
+ children: item.label
15
+ }),
16
+ item.badge ? /* @__PURE__ */ jsx("span", {
17
+ className: "pf-sidebar-navigation__badge",
18
+ children: item.badge
19
+ }) : null
20
+ ] });
21
+ const className = cx("pf-sidebar-navigation__link", item.active && "pf-sidebar-navigation__link--active", item.disabled && "pf-sidebar-navigation__link--disabled");
22
+ if (item.href && !item.disabled) return /* @__PURE__ */ jsx("li", {
23
+ className: "pf-sidebar-navigation__item",
24
+ children: /* @__PURE__ */ jsx("a", {
25
+ href: item.href,
26
+ onClick: item.onClick,
27
+ className,
28
+ "aria-current": item.active ? "page" : void 0,
29
+ children: content
30
+ })
31
+ }, key);
32
+ if (item.onClick) return /* @__PURE__ */ jsx("li", {
33
+ className: "pf-sidebar-navigation__item",
34
+ children: /* @__PURE__ */ jsx("button", {
35
+ type: "button",
36
+ onClick: item.onClick,
37
+ className,
38
+ disabled: item.disabled,
39
+ "aria-current": item.active ? "page" : void 0,
40
+ children: content
41
+ })
42
+ }, key);
43
+ return /* @__PURE__ */ jsx("li", {
44
+ className: "pf-sidebar-navigation__item",
45
+ children: /* @__PURE__ */ jsx("span", {
46
+ className,
47
+ "aria-current": item.active ? "page" : void 0,
48
+ children: content
49
+ })
50
+ }, key);
51
+ }
52
+ var SidebarNavigation = forwardRef(function SidebarNavigation({ className, sections, header, footer, "aria-label": ariaLabel = "Sidebar navigation", ...props }, ref) {
53
+ return /* @__PURE__ */ jsxs("aside", {
54
+ ref,
55
+ className: cx("pf-sidebar-navigation", className),
56
+ ...props,
57
+ children: [
58
+ header ? /* @__PURE__ */ jsx("div", {
59
+ className: "pf-sidebar-navigation__header",
60
+ children: header
61
+ }) : null,
62
+ /* @__PURE__ */ jsx("nav", {
63
+ className: "pf-sidebar-navigation__nav",
64
+ "aria-label": ariaLabel,
65
+ children: sections.map((section, sectionIndex) => /* @__PURE__ */ jsxs("div", {
66
+ className: "pf-sidebar-navigation__section",
67
+ children: [section.title ? /* @__PURE__ */ jsx("p", {
68
+ className: "pf-sidebar-navigation__section-title",
69
+ children: section.title
70
+ }) : null, /* @__PURE__ */ jsx("ul", {
71
+ className: "pf-sidebar-navigation__list",
72
+ children: section.items.map((item, itemIndex) => {
73
+ return renderItem(item, `${sectionIndex}-${itemIndex}-${typeof item.label === "string" ? item.label : "item"}`);
74
+ })
75
+ })]
76
+ }, `section-${sectionIndex}`))
77
+ }),
78
+ footer ? /* @__PURE__ */ jsx("div", {
79
+ className: "pf-sidebar-navigation__footer",
80
+ children: footer
81
+ }) : null
82
+ ]
83
+ });
84
+ });
85
+ SidebarNavigation.displayName = "SidebarNavigation";
86
+ //#endregion
87
+ export { SidebarNavigation };