@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.
- package/README.md +60 -0
- package/dist/index.cjs +9010 -0
- package/dist/index.js +63 -0
- package/dist/index10.js +36 -0
- package/dist/index100.js +26 -0
- package/dist/index102.js +190 -0
- package/dist/index104.js +93 -0
- package/dist/index106.js +27 -0
- package/dist/index108.js +88 -0
- package/dist/index110.js +96 -0
- package/dist/index112.js +38 -0
- package/dist/index114.js +155 -0
- package/dist/index116.js +193 -0
- package/dist/index118.js +24 -0
- package/dist/index12.js +38 -0
- package/dist/index120.js +69 -0
- package/dist/index14.js +24 -0
- package/dist/index16.js +64 -0
- package/dist/index18.js +39 -0
- package/dist/index19.js +35 -0
- package/dist/index21.js +37 -0
- package/dist/index23.js +13 -0
- package/dist/index25.js +38 -0
- package/dist/index27.js +68 -0
- package/dist/index29.js +25 -0
- package/dist/index3.js +32 -0
- package/dist/index30.js +49 -0
- package/dist/index31.js +15 -0
- package/dist/index32.js +22 -0
- package/dist/index33.js +25 -0
- package/dist/index34.js +55 -0
- package/dist/index35.js +36 -0
- package/dist/index36.js +22 -0
- package/dist/index38.js +149 -0
- package/dist/index4.js +6 -0
- package/dist/index40.js +255 -0
- package/dist/index42.js +134 -0
- package/dist/index43.js +16 -0
- package/dist/index44.js +4232 -0
- package/dist/index46.js +123 -0
- package/dist/index48.js +41 -0
- package/dist/index50.js +135 -0
- package/dist/index52.js +39 -0
- package/dist/index54.js +186 -0
- package/dist/index56.js +63 -0
- package/dist/index58.js +45 -0
- package/dist/index6.js +182 -0
- package/dist/index60.js +264 -0
- package/dist/index62.js +68 -0
- package/dist/index64.js +69 -0
- package/dist/index66.js +95 -0
- package/dist/index68.js +202 -0
- package/dist/index70.js +68 -0
- package/dist/index72.js +50 -0
- package/dist/index74.js +88 -0
- package/dist/index76.js +92 -0
- package/dist/index78.js +76 -0
- package/dist/index8.js +61 -0
- package/dist/index80.js +44 -0
- package/dist/index82.js +116 -0
- package/dist/index84.js +25 -0
- package/dist/index86.js +56 -0
- package/dist/index88.js +88 -0
- package/dist/index90.js +167 -0
- package/dist/index92.js +32 -0
- package/dist/index94.js +40 -0
- package/dist/index96.js +87 -0
- package/dist/index98.js +185 -0
- package/dist/src/a11y/index.d.ts +15 -0
- package/dist/src/components/Alert/Alert.d.ts +10 -0
- package/dist/src/components/Alert/Alert.test.d.ts +1 -0
- package/dist/src/components/Alert/index.d.ts +1 -0
- package/dist/src/components/Avatar/Avatar.d.ts +10 -0
- package/dist/src/components/Avatar/Avatar.test.d.ts +1 -0
- package/dist/src/components/Avatar/index.d.ts +1 -0
- package/dist/src/components/Badge/Badge.d.ts +5 -0
- package/dist/src/components/Badge/Badge.test.d.ts +1 -0
- package/dist/src/components/Badge/index.d.ts +1 -0
- package/dist/src/components/BadgeGroup/BadgeGroup.d.ts +11 -0
- package/dist/src/components/BadgeGroup/BadgeGroup.test.d.ts +1 -0
- package/dist/src/components/BadgeGroup/index.d.ts +1 -0
- package/dist/src/components/Breadcrumbs/Breadcrumbs.d.ts +11 -0
- package/dist/src/components/Breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/dist/src/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/src/components/Button/Button.d.ts +9 -0
- package/dist/src/components/Button/Button.test.d.ts +1 -0
- package/dist/src/components/Button/index.d.ts +1 -0
- package/dist/src/components/ButtonGroup/ButtonGroup.d.ts +16 -0
- package/dist/src/components/ButtonGroup/ButtonGroup.test.d.ts +1 -0
- package/dist/src/components/ButtonGroup/index.d.ts +1 -0
- package/dist/src/components/Calendar/Calendar.d.ts +14 -0
- package/dist/src/components/Calendar/Calendar.test.d.ts +1 -0
- package/dist/src/components/Calendar/index.d.ts +1 -0
- package/dist/src/components/Card/Card.d.ts +20 -0
- package/dist/src/components/Card/Card.test.d.ts +1 -0
- package/dist/src/components/Card/index.d.ts +1 -0
- package/dist/src/components/Carousel/Carousel.d.ts +10 -0
- package/dist/src/components/Carousel/Carousel.test.d.ts +1 -0
- package/dist/src/components/Carousel/index.d.ts +1 -0
- package/dist/src/components/Checkbox/Checkbox.d.ts +4 -0
- package/dist/src/components/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/src/components/Checkbox/index.d.ts +1 -0
- package/dist/src/components/CodeSnippet/CodeSnippet.d.ts +11 -0
- package/dist/src/components/CodeSnippet/CodeSnippet.test.d.ts +1 -0
- package/dist/src/components/CodeSnippet/index.d.ts +1 -0
- package/dist/src/components/ContentDivider/ContentDivider.d.ts +7 -0
- package/dist/src/components/ContentDivider/ContentDivider.test.d.ts +1 -0
- package/dist/src/components/ContentDivider/index.d.ts +1 -0
- package/dist/src/components/CreditCard/CreditCard.d.ts +10 -0
- package/dist/src/components/CreditCard/CreditCard.test.d.ts +1 -0
- package/dist/src/components/CreditCard/index.d.ts +1 -0
- package/dist/src/components/DatePicker/DatePicker.d.ts +17 -0
- package/dist/src/components/DatePicker/DatePicker.test.d.ts +1 -0
- package/dist/src/components/DatePicker/index.d.ts +1 -0
- package/dist/src/components/Dropdown/Dropdown.d.ts +20 -0
- package/dist/src/components/Dropdown/Dropdown.test.d.ts +1 -0
- package/dist/src/components/Dropdown/index.d.ts +1 -0
- package/dist/src/components/EmptyState/EmptyState.d.ts +11 -0
- package/dist/src/components/EmptyState/EmptyState.test.d.ts +1 -0
- package/dist/src/components/EmptyState/index.d.ts +1 -0
- package/dist/src/components/FileUploader/FileUploader.d.ts +15 -0
- package/dist/src/components/FileUploader/FileUploader.test.d.ts +1 -0
- package/dist/src/components/FileUploader/index.d.ts +1 -0
- package/dist/src/components/HeaderNavigation/HeaderNavigation.d.ts +12 -0
- package/dist/src/components/HeaderNavigation/HeaderNavigation.test.d.ts +1 -0
- package/dist/src/components/HeaderNavigation/index.d.ts +1 -0
- package/dist/src/components/Icon/Icon.d.ts +12 -0
- package/dist/src/components/Icon/Icon.test.d.ts +1 -0
- package/dist/src/components/Icon/index.d.ts +1 -0
- package/dist/src/components/InlineCTA/InlineCTA.d.ts +11 -0
- package/dist/src/components/InlineCTA/InlineCTA.test.d.ts +1 -0
- package/dist/src/components/InlineCTA/index.d.ts +1 -0
- package/dist/src/components/Input/Input.d.ts +6 -0
- package/dist/src/components/Input/Input.test.d.ts +1 -0
- package/dist/src/components/Input/index.d.ts +1 -0
- package/dist/src/components/LineBarCharts/LineBarChart.d.ts +29 -0
- package/dist/src/components/LineBarCharts/LineBarChart.test.d.ts +1 -0
- package/dist/src/components/LineBarCharts/index.d.ts +1 -0
- package/dist/src/components/LoadingIndicators/LoadingIndicators.d.ts +17 -0
- package/dist/src/components/LoadingIndicators/LoadingIndicators.test.d.ts +1 -0
- package/dist/src/components/LoadingIndicators/index.d.ts +1 -0
- package/dist/src/components/Metrics/Metrics.d.ts +15 -0
- package/dist/src/components/Metrics/Metrics.test.d.ts +1 -0
- package/dist/src/components/Metrics/index.d.ts +1 -0
- package/dist/src/components/Modal/Modal.d.ts +16 -0
- package/dist/src/components/Modal/Modal.test.d.ts +1 -0
- package/dist/src/components/Modal/index.d.ts +1 -0
- package/dist/src/components/MultiSelect/MultiSelect.d.ts +18 -0
- package/dist/src/components/MultiSelect/MultiSelect.test.d.ts +1 -0
- package/dist/src/components/MultiSelect/index.d.ts +1 -0
- package/dist/src/components/Notification/Notification.d.ts +16 -0
- package/dist/src/components/Notification/Notification.test.d.ts +1 -0
- package/dist/src/components/Notification/index.d.ts +1 -0
- package/dist/src/components/PageHeader/PageHeader.d.ts +12 -0
- package/dist/src/components/PageHeader/PageHeader.test.d.ts +1 -0
- package/dist/src/components/PageHeader/index.d.ts +1 -0
- package/dist/src/components/Pagination/Pagination.d.ts +14 -0
- package/dist/src/components/Pagination/Pagination.test.d.ts +1 -0
- package/dist/src/components/Pagination/index.d.ts +1 -0
- package/dist/src/components/PieChart/PieChart.d.ts +14 -0
- package/dist/src/components/PieChart/PieChart.test.d.ts +1 -0
- package/dist/src/components/PieChart/index.d.ts +1 -0
- package/dist/src/components/ProgressIndicators/ProgressIndicators.d.ts +16 -0
- package/dist/src/components/ProgressIndicators/ProgressIndicators.test.d.ts +1 -0
- package/dist/src/components/ProgressIndicators/index.d.ts +1 -0
- package/dist/src/components/ProgressSteps/ProgressSteps.d.ts +12 -0
- package/dist/src/components/ProgressSteps/ProgressSteps.test.d.ts +1 -0
- package/dist/src/components/ProgressSteps/index.d.ts +1 -0
- package/dist/src/components/RadarChart/RadarChart.d.ts +15 -0
- package/dist/src/components/RadarChart/RadarChart.test.d.ts +1 -0
- package/dist/src/components/RadarChart/index.d.ts +1 -0
- package/dist/src/components/RadioButton/RadioButton.d.ts +4 -0
- package/dist/src/components/RadioButton/RadioButton.test.d.ts +1 -0
- package/dist/src/components/RadioButton/index.d.ts +1 -0
- package/dist/src/components/RadioGroup/RadioGroup.d.ts +17 -0
- package/dist/src/components/RadioGroup/RadioGroup.test.d.ts +1 -0
- package/dist/src/components/RadioGroup/index.d.ts +1 -0
- package/dist/src/components/Rating/Rating.d.ts +15 -0
- package/dist/src/components/Rating/Rating.test.d.ts +1 -0
- package/dist/src/components/Rating/index.d.ts +1 -0
- package/dist/src/components/RichTextEditor/RichTextEditor.d.ts +14 -0
- package/dist/src/components/RichTextEditor/RichTextEditor.test.d.ts +1 -0
- package/dist/src/components/RichTextEditor/index.d.ts +1 -0
- package/dist/src/components/SectionFooter/SectionFooter.d.ts +8 -0
- package/dist/src/components/SectionFooter/SectionFooter.test.d.ts +1 -0
- package/dist/src/components/SectionFooter/index.d.ts +1 -0
- package/dist/src/components/SectionHeader/SectionHeader.d.ts +10 -0
- package/dist/src/components/SectionHeader/SectionHeader.test.d.ts +1 -0
- package/dist/src/components/SectionHeader/index.d.ts +1 -0
- package/dist/src/components/Select/Select.d.ts +22 -0
- package/dist/src/components/Select/Select.test.d.ts +1 -0
- package/dist/src/components/Select/index.d.ts +1 -0
- package/dist/src/components/SidebarNavigation/SidebarNavigation.d.ts +19 -0
- package/dist/src/components/SidebarNavigation/SidebarNavigation.test.d.ts +1 -0
- package/dist/src/components/SidebarNavigation/index.d.ts +1 -0
- package/dist/src/components/SlideoutMenu/SlideoutMenu.d.ts +17 -0
- package/dist/src/components/SlideoutMenu/SlideoutMenu.test.d.ts +1 -0
- package/dist/src/components/SlideoutMenu/index.d.ts +1 -0
- package/dist/src/components/Slider/Slider.d.ts +10 -0
- package/dist/src/components/Slider/Slider.test.d.ts +1 -0
- package/dist/src/components/Slider/index.d.ts +1 -0
- package/dist/src/components/Switch/Switch.d.ts +4 -0
- package/dist/src/components/Switch/Switch.test.d.ts +1 -0
- package/dist/src/components/Switch/index.d.ts +1 -0
- package/dist/src/components/Table/Table.d.ts +34 -0
- package/dist/src/components/Table/Table.test.d.ts +1 -0
- package/dist/src/components/Table/index.d.ts +1 -0
- package/dist/src/components/Tabs/Tabs.d.ts +18 -0
- package/dist/src/components/Tabs/Tabs.test.d.ts +1 -0
- package/dist/src/components/Tabs/index.d.ts +1 -0
- package/dist/src/components/Tag/Tag.d.ts +7 -0
- package/dist/src/components/Tag/Tag.test.d.ts +1 -0
- package/dist/src/components/Tag/index.d.ts +1 -0
- package/dist/src/components/Textarea/Textarea.d.ts +6 -0
- package/dist/src/components/Textarea/Textarea.test.d.ts +1 -0
- package/dist/src/components/Textarea/index.d.ts +1 -0
- package/dist/src/components/Tooltip/Tooltip.d.ts +11 -0
- package/dist/src/components/Tooltip/Tooltip.test.d.ts +1 -0
- package/dist/src/components/Tooltip/index.d.ts +1 -0
- package/dist/src/components/TreeView/TreeView.d.ts +22 -0
- package/dist/src/components/TreeView/TreeView.test.d.ts +1 -0
- package/dist/src/components/TreeView/index.d.ts +1 -0
- package/dist/src/components/UtilityButton/UtilityButton.d.ts +9 -0
- package/dist/src/components/UtilityButton/UtilityButton.test.d.ts +1 -0
- package/dist/src/components/UtilityButton/index.d.ts +1 -0
- package/dist/src/components/VideoPlayer/VideoPlayer.d.ts +20 -0
- package/dist/src/components/VideoPlayer/VideoPlayer.test.d.ts +1 -0
- package/dist/src/components/VideoPlayer/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts +7 -0
- package/dist/src/hooks/useAnchoredPosition.d.ts +12 -0
- package/dist/src/hooks/useComposedRefs.d.ts +1 -0
- package/dist/src/hooks/useControllableState.d.ts +6 -0
- package/dist/src/hooks/useDisclosure.d.ts +13 -0
- package/dist/src/hooks/useFocusTrap.d.ts +7 -0
- package/dist/src/hooks/useListNavigation.d.ts +15 -0
- package/dist/src/hooks/useOutsideInteraction.d.ts +7 -0
- package/dist/src/index.d.ts +55 -0
- package/dist/src/test/setup.d.ts +0 -0
- package/dist/src/utils/FieldWrapper.d.ts +15 -0
- package/dist/src/utils/cx.d.ts +1 -0
- package/dist/styles.css +5676 -0
- package/package.json +43 -0
package/dist/index6.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { cx } from "./index4.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { faBarChart, faCalendar, faCircleCheck, faCircleQuestion, faCircleXmark, faCopy, faCreditCard, faSquareCaretLeft, faSquareCaretRight, faSquareCheck, faStar, faUser } from "@fortawesome/free-regular-svg-icons";
|
|
4
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Icon/Icon.tsx
|
|
7
|
+
var customIcons = {
|
|
8
|
+
"chevron-down": /* @__PURE__ */ jsx("svg", {
|
|
9
|
+
width: "1em",
|
|
10
|
+
height: "1em",
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
fill: "none",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
strokeWidth: "3",
|
|
15
|
+
strokeLinecap: "round",
|
|
16
|
+
strokeLinejoin: "round",
|
|
17
|
+
focusable: "false",
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "5 9 12 18 19 9" })
|
|
20
|
+
}),
|
|
21
|
+
"chevron-up": /* @__PURE__ */ jsx("svg", {
|
|
22
|
+
width: "1em",
|
|
23
|
+
height: "1em",
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: "3",
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
strokeLinejoin: "round",
|
|
30
|
+
focusable: "false",
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "5 15 12 6 19 15" })
|
|
33
|
+
}),
|
|
34
|
+
"chevron-left": /* @__PURE__ */ jsx("svg", {
|
|
35
|
+
width: "1em",
|
|
36
|
+
height: "1em",
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
fill: "none",
|
|
39
|
+
stroke: "currentColor",
|
|
40
|
+
strokeWidth: "3",
|
|
41
|
+
strokeLinecap: "round",
|
|
42
|
+
strokeLinejoin: "round",
|
|
43
|
+
focusable: "false",
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "15 5 6 12 15 19" })
|
|
46
|
+
}),
|
|
47
|
+
"chevron-right": /* @__PURE__ */ jsx("svg", {
|
|
48
|
+
width: "1em",
|
|
49
|
+
height: "1em",
|
|
50
|
+
viewBox: "0 0 24 24",
|
|
51
|
+
fill: "none",
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
strokeWidth: "3",
|
|
54
|
+
strokeLinecap: "round",
|
|
55
|
+
strokeLinejoin: "round",
|
|
56
|
+
focusable: "false",
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "9 5 18 12 9 19" })
|
|
59
|
+
}),
|
|
60
|
+
"circle-info": /* @__PURE__ */ jsxs("svg", {
|
|
61
|
+
width: "1em",
|
|
62
|
+
height: "1em",
|
|
63
|
+
viewBox: "0 0 24 24",
|
|
64
|
+
fill: "none",
|
|
65
|
+
stroke: "currentColor",
|
|
66
|
+
strokeWidth: "2",
|
|
67
|
+
strokeLinecap: "round",
|
|
68
|
+
strokeLinejoin: "round",
|
|
69
|
+
focusable: "false",
|
|
70
|
+
"aria-hidden": "true",
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx("circle", {
|
|
73
|
+
cx: "12",
|
|
74
|
+
cy: "12",
|
|
75
|
+
r: "10"
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx("path", { d: "M12 16v-4" }),
|
|
78
|
+
/* @__PURE__ */ jsx("path", { d: "M12 8h.01" })
|
|
79
|
+
]
|
|
80
|
+
}),
|
|
81
|
+
"triangle-exclamation": /* @__PURE__ */ jsxs("svg", {
|
|
82
|
+
width: "1em",
|
|
83
|
+
height: "1em",
|
|
84
|
+
viewBox: "0 0 24 24",
|
|
85
|
+
fill: "none",
|
|
86
|
+
stroke: "currentColor",
|
|
87
|
+
strokeWidth: "2",
|
|
88
|
+
strokeLinecap: "round",
|
|
89
|
+
strokeLinejoin: "round",
|
|
90
|
+
focusable: "false",
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
|
|
94
|
+
/* @__PURE__ */ jsx("path", { d: "M12 9v4" }),
|
|
95
|
+
/* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
|
|
96
|
+
]
|
|
97
|
+
}),
|
|
98
|
+
"file-arrow-up": /* @__PURE__ */ jsxs("svg", {
|
|
99
|
+
width: "1em",
|
|
100
|
+
height: "1em",
|
|
101
|
+
viewBox: "0 0 24 24",
|
|
102
|
+
fill: "none",
|
|
103
|
+
stroke: "currentColor",
|
|
104
|
+
strokeWidth: "2",
|
|
105
|
+
strokeLinecap: "round",
|
|
106
|
+
strokeLinejoin: "round",
|
|
107
|
+
focusable: "false",
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsx("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
111
|
+
/* @__PURE__ */ jsx("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
112
|
+
/* @__PURE__ */ jsx("path", { d: "M12 12v6" }),
|
|
113
|
+
/* @__PURE__ */ jsx("path", { d: "m15 15-3-3-3 3" })
|
|
114
|
+
]
|
|
115
|
+
})
|
|
116
|
+
};
|
|
117
|
+
var regularIcons = {
|
|
118
|
+
calendar: faCalendar,
|
|
119
|
+
"chart-bar": faBarChart,
|
|
120
|
+
"circle-check": faCircleCheck,
|
|
121
|
+
"circle-question": faCircleQuestion,
|
|
122
|
+
"circle-xmark": faCircleXmark,
|
|
123
|
+
copy: faCopy,
|
|
124
|
+
"credit-card": faCreditCard,
|
|
125
|
+
"square-caret-left": faSquareCaretLeft,
|
|
126
|
+
"square-caret-right": faSquareCaretRight,
|
|
127
|
+
"square-check": faSquareCheck,
|
|
128
|
+
star: faStar,
|
|
129
|
+
user: faUser
|
|
130
|
+
};
|
|
131
|
+
var toAliasLookup = (icons) => {
|
|
132
|
+
const lookup = {};
|
|
133
|
+
Object.values(icons).forEach((icon) => {
|
|
134
|
+
const aliases = icon.icon?.[2];
|
|
135
|
+
if (!Array.isArray(aliases)) return;
|
|
136
|
+
aliases.forEach((alias) => {
|
|
137
|
+
if (typeof alias === "string") lookup[alias] = icon;
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
return lookup;
|
|
141
|
+
};
|
|
142
|
+
var regularAliases = toAliasLookup(regularIcons);
|
|
143
|
+
var legacyAliases = {
|
|
144
|
+
circleCheck: "circle-check",
|
|
145
|
+
circleQuestion: "circle-question",
|
|
146
|
+
circleInfo: "circle-info"
|
|
147
|
+
};
|
|
148
|
+
var toKebabCase = (value) => {
|
|
149
|
+
return value.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
|
|
150
|
+
};
|
|
151
|
+
var normalizeName = (name) => {
|
|
152
|
+
return legacyAliases[name] ?? toKebabCase(name);
|
|
153
|
+
};
|
|
154
|
+
var getAvailableIconNames = () => {
|
|
155
|
+
return [...new Set([...Object.keys(regularIcons), ...Object.keys(customIcons)])].sort();
|
|
156
|
+
};
|
|
157
|
+
var getCustomIconNames = () => Object.keys(customIcons).sort();
|
|
158
|
+
function Icon({ name, label, className, style, ...props }) {
|
|
159
|
+
const customIcon = customIcons[name];
|
|
160
|
+
if (customIcon !== void 0) return /* @__PURE__ */ jsx("span", {
|
|
161
|
+
className: cx("pf-icon", className),
|
|
162
|
+
"aria-hidden": label ? void 0 : true,
|
|
163
|
+
"aria-label": label,
|
|
164
|
+
style,
|
|
165
|
+
...props,
|
|
166
|
+
children: customIcon
|
|
167
|
+
});
|
|
168
|
+
const normalizedName = normalizeName(name);
|
|
169
|
+
const faIcon = regularIcons[normalizedName] ?? regularAliases[normalizedName];
|
|
170
|
+
if (!faIcon) return null;
|
|
171
|
+
return /* @__PURE__ */ jsx(FontAwesomeIcon, {
|
|
172
|
+
icon: faIcon,
|
|
173
|
+
className: cx("pf-icon", className),
|
|
174
|
+
"aria-hidden": label ? void 0 : true,
|
|
175
|
+
"aria-label": label,
|
|
176
|
+
style,
|
|
177
|
+
...props
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
Icon.displayName = "Icon";
|
|
181
|
+
//#endregion
|
|
182
|
+
export { Icon, getAvailableIconNames, getCustomIconNames };
|
package/dist/index60.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
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/LineBarCharts/LineBarChart.tsx
|
|
6
|
+
var CHART_COLORS = [
|
|
7
|
+
"var(--pf-chart-color-1)",
|
|
8
|
+
"var(--pf-chart-color-2)",
|
|
9
|
+
"var(--pf-chart-color-3)",
|
|
10
|
+
"var(--pf-chart-color-4)",
|
|
11
|
+
"var(--pf-chart-color-5)",
|
|
12
|
+
"var(--pf-chart-color-6)"
|
|
13
|
+
];
|
|
14
|
+
var PAD = {
|
|
15
|
+
top: 24,
|
|
16
|
+
right: 32,
|
|
17
|
+
bottom: 40,
|
|
18
|
+
left: 56
|
|
19
|
+
};
|
|
20
|
+
var VIEW_W = 560;
|
|
21
|
+
var VIEW_H = 240;
|
|
22
|
+
var PLOT_W = VIEW_W - PAD.left - PAD.right;
|
|
23
|
+
var PLOT_H = VIEW_H - PAD.top - PAD.bottom;
|
|
24
|
+
function resolveColor(series, index) {
|
|
25
|
+
return series.color ?? CHART_COLORS[index % CHART_COLORS.length];
|
|
26
|
+
}
|
|
27
|
+
function niceYTicks(maxVal, count = 5) {
|
|
28
|
+
if (maxVal <= 0) return [
|
|
29
|
+
0,
|
|
30
|
+
1,
|
|
31
|
+
2,
|
|
32
|
+
3,
|
|
33
|
+
4,
|
|
34
|
+
5
|
|
35
|
+
];
|
|
36
|
+
const rough = maxVal / count;
|
|
37
|
+
const mag = Math.pow(10, Math.floor(Math.log10(rough)));
|
|
38
|
+
const step = ([
|
|
39
|
+
1,
|
|
40
|
+
2,
|
|
41
|
+
2.5,
|
|
42
|
+
5,
|
|
43
|
+
10
|
|
44
|
+
].find((s) => s * mag >= rough) ?? 10) * mag;
|
|
45
|
+
const ticks = [];
|
|
46
|
+
for (let v = 0; v <= maxVal * 1.001; v += step) ticks.push(v);
|
|
47
|
+
if (ticks[ticks.length - 1] < maxVal) ticks.push(ticks[ticks.length - 1] + step);
|
|
48
|
+
return ticks;
|
|
49
|
+
}
|
|
50
|
+
function formatTick(value, formatter) {
|
|
51
|
+
if (formatter) return formatter(value);
|
|
52
|
+
if (value >= 1e6) return `${(value / 1e6).toFixed(1)}M`;
|
|
53
|
+
if (value >= 1e3) return `${(value / 1e3).toFixed(value % 1e3 === 0 ? 0 : 1)}k`;
|
|
54
|
+
return String(Math.round(value));
|
|
55
|
+
}
|
|
56
|
+
function toY(value, maxTick) {
|
|
57
|
+
return PAD.top + PLOT_H - value / maxTick * PLOT_H;
|
|
58
|
+
}
|
|
59
|
+
function toX(index, count) {
|
|
60
|
+
if (count <= 1) return PAD.left + PLOT_W / 2;
|
|
61
|
+
return PAD.left + index / (count - 1) * PLOT_W;
|
|
62
|
+
}
|
|
63
|
+
function smoothPath(points) {
|
|
64
|
+
if (points.length === 0) return "";
|
|
65
|
+
if (points.length === 1) return `M ${points[0].x},${points[0].y}`;
|
|
66
|
+
if (points.length === 2) return `M ${points[0].x},${points[0].y} L ${points[1].x},${points[1].y}`;
|
|
67
|
+
let d = `M ${points[0].x},${points[0].y}`;
|
|
68
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
69
|
+
const p0 = points[Math.max(0, i - 1)];
|
|
70
|
+
const p1 = points[i];
|
|
71
|
+
const p2 = points[i + 1];
|
|
72
|
+
const p3 = points[Math.min(points.length - 1, i + 2)];
|
|
73
|
+
const cp1x = p1.x + (p2.x - p0.x) / 6;
|
|
74
|
+
const cp1y = p1.y + (p2.y - p0.y) / 6;
|
|
75
|
+
const cp2x = p2.x - (p3.x - p1.x) / 6;
|
|
76
|
+
const cp2y = p2.y - (p3.y - p1.y) / 6;
|
|
77
|
+
d += ` C ${cp1x.toFixed(2)},${cp1y.toFixed(2)} ${cp2x.toFixed(2)},${cp2y.toFixed(2)} ${p2.x},${p2.y}`;
|
|
78
|
+
}
|
|
79
|
+
return d;
|
|
80
|
+
}
|
|
81
|
+
function ChartLegend({ series }) {
|
|
82
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
83
|
+
className: "pf-chart-legend",
|
|
84
|
+
children: series.map((s) => /* @__PURE__ */ jsxs("li", {
|
|
85
|
+
className: "pf-chart-legend__item",
|
|
86
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
87
|
+
className: "pf-chart-legend__swatch",
|
|
88
|
+
style: { background: s.color },
|
|
89
|
+
"aria-hidden": "true"
|
|
90
|
+
}), s.label]
|
|
91
|
+
}, s.key))
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function Axes({ yTicks, xLabels, xPositions, maxTick, yAxisLabel, valueFormatter }) {
|
|
95
|
+
const n = xLabels.length;
|
|
96
|
+
const labelStep = Math.max(1, Math.ceil(n / 12));
|
|
97
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
98
|
+
yTicks.map((tick) => {
|
|
99
|
+
const y = toY(tick, maxTick);
|
|
100
|
+
return /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
|
|
101
|
+
x1: PAD.left,
|
|
102
|
+
y1: y,
|
|
103
|
+
x2: PAD.left + PLOT_W,
|
|
104
|
+
y2: y,
|
|
105
|
+
className: "pf-chart__grid"
|
|
106
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
107
|
+
x: PAD.left - 8,
|
|
108
|
+
y,
|
|
109
|
+
className: "pf-chart__tick pf-chart__tick--y",
|
|
110
|
+
children: formatTick(tick, valueFormatter)
|
|
111
|
+
})] }, tick);
|
|
112
|
+
}),
|
|
113
|
+
xLabels.map((label, i) => i % labelStep !== 0 ? null : /* @__PURE__ */ jsx("text", {
|
|
114
|
+
x: xPositions ? xPositions[i] : toX(i, n),
|
|
115
|
+
y: PAD.top + PLOT_H + 20,
|
|
116
|
+
className: "pf-chart__tick pf-chart__tick--x",
|
|
117
|
+
children: label
|
|
118
|
+
}, i)),
|
|
119
|
+
yAxisLabel ? /* @__PURE__ */ jsx("text", {
|
|
120
|
+
x: -(PAD.top + PLOT_H / 2),
|
|
121
|
+
y: 14,
|
|
122
|
+
transform: "rotate(-90)",
|
|
123
|
+
className: "pf-chart__axis-label",
|
|
124
|
+
children: yAxisLabel
|
|
125
|
+
}) : null
|
|
126
|
+
] });
|
|
127
|
+
}
|
|
128
|
+
var LineChart = forwardRef(function LineChart({ className, data, series, yAxisLabel, showLegend = true, area = false, curved = true, valueFormatter, ...props }, ref) {
|
|
129
|
+
if (!data.length || !series.length) return /* @__PURE__ */ jsx("div", {
|
|
130
|
+
ref,
|
|
131
|
+
className: cx("pf-chart", className),
|
|
132
|
+
...props,
|
|
133
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
134
|
+
className: "pf-chart__empty",
|
|
135
|
+
children: "No data"
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
const allValues = series.flatMap((s) => data.map((d) => Number(d[s.key] ?? 0)));
|
|
139
|
+
const yTicks = niceYTicks(Math.max(...allValues, 0));
|
|
140
|
+
const maxTick = yTicks[yTicks.length - 1];
|
|
141
|
+
const n = data.length;
|
|
142
|
+
const resolvedSeries = series.map((s, i) => ({
|
|
143
|
+
...s,
|
|
144
|
+
color: resolveColor(s, i)
|
|
145
|
+
}));
|
|
146
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
147
|
+
ref,
|
|
148
|
+
className: cx("pf-chart", className),
|
|
149
|
+
...props,
|
|
150
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
151
|
+
viewBox: `0 0 ${VIEW_W} ${VIEW_H}`,
|
|
152
|
+
className: "pf-chart__svg",
|
|
153
|
+
role: "img",
|
|
154
|
+
"aria-label": yAxisLabel ?? "Line chart",
|
|
155
|
+
children: [/* @__PURE__ */ jsx(Axes, {
|
|
156
|
+
yTicks,
|
|
157
|
+
xLabels: data.map((d) => d.label),
|
|
158
|
+
maxTick,
|
|
159
|
+
yAxisLabel,
|
|
160
|
+
valueFormatter
|
|
161
|
+
}), resolvedSeries.map((s) => {
|
|
162
|
+
const points = data.map((d, i) => ({
|
|
163
|
+
x: toX(i, n),
|
|
164
|
+
y: toY(Number(d[s.key] ?? 0), maxTick)
|
|
165
|
+
}));
|
|
166
|
+
const linePath = curved ? smoothPath(points) : `M ${points.map((p) => `${p.x},${p.y}`).join(" L ")}`;
|
|
167
|
+
const areaPath = area ? `${linePath} L ${points[n - 1].x},${PAD.top + PLOT_H} L ${points[0].x},${PAD.top + PLOT_H} Z` : null;
|
|
168
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
169
|
+
areaPath ? /* @__PURE__ */ jsx("path", {
|
|
170
|
+
d: areaPath,
|
|
171
|
+
fill: s.color,
|
|
172
|
+
fillOpacity: .12,
|
|
173
|
+
stroke: "none"
|
|
174
|
+
}) : null,
|
|
175
|
+
/* @__PURE__ */ jsx("path", {
|
|
176
|
+
d: linePath,
|
|
177
|
+
fill: "none",
|
|
178
|
+
stroke: s.color,
|
|
179
|
+
strokeWidth: 2,
|
|
180
|
+
strokeLinecap: "round",
|
|
181
|
+
strokeLinejoin: "round",
|
|
182
|
+
strokeDasharray: s.dashed ? "6 4" : void 0
|
|
183
|
+
}),
|
|
184
|
+
points.map((pt, i) => /* @__PURE__ */ jsx("circle", {
|
|
185
|
+
cx: pt.x,
|
|
186
|
+
cy: pt.y,
|
|
187
|
+
r: 3.5,
|
|
188
|
+
fill: s.color,
|
|
189
|
+
className: "pf-chart__dot",
|
|
190
|
+
children: /* @__PURE__ */ jsx("title", { children: `${data[i].label}: ${formatTick(Number(data[i][s.key] ?? 0), valueFormatter)}` })
|
|
191
|
+
}, i))
|
|
192
|
+
] }, s.key);
|
|
193
|
+
})]
|
|
194
|
+
}), showLegend && resolvedSeries.length > 1 ? /* @__PURE__ */ jsx(ChartLegend, { series: resolvedSeries }) : null]
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
LineChart.displayName = "LineChart";
|
|
198
|
+
var BarChart = forwardRef(function BarChart({ className, data, series, yAxisLabel, showLegend = true, stacked = false, valueFormatter, ...props }, ref) {
|
|
199
|
+
if (!data.length || !series.length) return /* @__PURE__ */ jsx("div", {
|
|
200
|
+
ref,
|
|
201
|
+
className: cx("pf-chart", className),
|
|
202
|
+
...props,
|
|
203
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
204
|
+
className: "pf-chart__empty",
|
|
205
|
+
children: "No data"
|
|
206
|
+
})
|
|
207
|
+
});
|
|
208
|
+
const n = data.length;
|
|
209
|
+
const m = series.length;
|
|
210
|
+
const groupMaxValues = stacked ? data.map((d) => series.reduce((sum, s) => sum + Number(d[s.key] ?? 0), 0)) : series.flatMap((s) => data.map((d) => Number(d[s.key] ?? 0)));
|
|
211
|
+
const yTicks = niceYTicks(Math.max(...groupMaxValues, 0));
|
|
212
|
+
const maxTick = yTicks[yTicks.length - 1];
|
|
213
|
+
const groupWidth = PLOT_W / n;
|
|
214
|
+
const totalBarW = groupWidth * .72;
|
|
215
|
+
const gap = Math.max(2, groupWidth * .06);
|
|
216
|
+
const barW = stacked ? totalBarW : (totalBarW - gap * (m - 1)) / m;
|
|
217
|
+
const barXPositions = data.map((_, i) => PAD.left + (i + .5) * groupWidth);
|
|
218
|
+
const resolvedSeries = series.map((s, i) => ({
|
|
219
|
+
...s,
|
|
220
|
+
color: resolveColor(s, i)
|
|
221
|
+
}));
|
|
222
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
223
|
+
ref,
|
|
224
|
+
className: cx("pf-chart", className),
|
|
225
|
+
...props,
|
|
226
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
227
|
+
viewBox: `0 0 ${VIEW_W} ${VIEW_H}`,
|
|
228
|
+
className: "pf-chart__svg",
|
|
229
|
+
role: "img",
|
|
230
|
+
"aria-label": yAxisLabel ?? "Bar chart",
|
|
231
|
+
children: [/* @__PURE__ */ jsx(Axes, {
|
|
232
|
+
yTicks,
|
|
233
|
+
xLabels: data.map((d) => d.label),
|
|
234
|
+
xPositions: barXPositions,
|
|
235
|
+
maxTick,
|
|
236
|
+
yAxisLabel,
|
|
237
|
+
valueFormatter
|
|
238
|
+
}), data.map((d, di) => {
|
|
239
|
+
const groupLeft = PAD.left + (di + .5) * groupWidth - totalBarW / 2;
|
|
240
|
+
let stackBase = 0;
|
|
241
|
+
return /* @__PURE__ */ jsx("g", { children: resolvedSeries.map((s, si) => {
|
|
242
|
+
const value = Math.max(0, Number(d[s.key] ?? 0));
|
|
243
|
+
const barH = value / maxTick * PLOT_H;
|
|
244
|
+
const barX = stacked ? groupLeft : groupLeft + si * (barW + gap);
|
|
245
|
+
const barY = stacked ? toY(stackBase + value, maxTick) : PAD.top + PLOT_H - barH;
|
|
246
|
+
if (stacked) stackBase += value;
|
|
247
|
+
return /* @__PURE__ */ jsx("rect", {
|
|
248
|
+
x: barX,
|
|
249
|
+
y: barY,
|
|
250
|
+
width: barW,
|
|
251
|
+
height: Math.max(0, barH),
|
|
252
|
+
fill: s.color,
|
|
253
|
+
rx: 2,
|
|
254
|
+
className: "pf-chart__bar",
|
|
255
|
+
children: /* @__PURE__ */ jsx("title", { children: `${d.label} — ${s.label}: ${formatTick(value, valueFormatter)}` })
|
|
256
|
+
}, s.key);
|
|
257
|
+
}) }, `group-${di}`);
|
|
258
|
+
})]
|
|
259
|
+
}), showLegend && resolvedSeries.length > 1 ? /* @__PURE__ */ jsx(ChartLegend, { series: resolvedSeries }) : null]
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
BarChart.displayName = "BarChart";
|
|
263
|
+
//#endregion
|
|
264
|
+
export { BarChart, LineChart };
|
package/dist/index62.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
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/LoadingIndicators/LoadingIndicators.tsx
|
|
6
|
+
var LoadingSpinner = forwardRef(function LoadingSpinner({ className, size = 24, label = "Loading", ...props }, ref) {
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
ref,
|
|
9
|
+
className: cx("pf-loading-spinner", className),
|
|
10
|
+
style: { "--pf-spinner-size": `${size}px` },
|
|
11
|
+
role: "status",
|
|
12
|
+
"aria-label": label,
|
|
13
|
+
...props,
|
|
14
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
15
|
+
className: "pf-sr-only",
|
|
16
|
+
children: label
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
LoadingSpinner.displayName = "LoadingSpinner";
|
|
21
|
+
var LoadingDots = forwardRef(function LoadingDots({ className, size = "md", label = "Loading", ...props }, ref) {
|
|
22
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
23
|
+
ref,
|
|
24
|
+
className: cx("pf-loading-dots", `pf-loading-dots--${size}`, className),
|
|
25
|
+
role: "status",
|
|
26
|
+
"aria-label": label,
|
|
27
|
+
...props,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx("span", {
|
|
30
|
+
className: "pf-loading-dots__dot",
|
|
31
|
+
"aria-hidden": true
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ jsx("span", {
|
|
34
|
+
className: "pf-loading-dots__dot",
|
|
35
|
+
"aria-hidden": true
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: "pf-loading-dots__dot",
|
|
39
|
+
"aria-hidden": true
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "pf-sr-only",
|
|
43
|
+
children: label
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
LoadingDots.displayName = "LoadingDots";
|
|
49
|
+
var LoadingSkeleton = forwardRef(function LoadingSkeleton({ className, width = "100%", height = 16, rounded = false, label = "Loading content", ...props }, ref) {
|
|
50
|
+
return /* @__PURE__ */ jsx("div", {
|
|
51
|
+
ref,
|
|
52
|
+
className: cx("pf-loading-skeleton", rounded ? "pf-loading-skeleton--rounded" : void 0, className),
|
|
53
|
+
style: {
|
|
54
|
+
"--pf-skeleton-width": typeof width === "number" ? `${width}px` : width,
|
|
55
|
+
"--pf-skeleton-height": typeof height === "number" ? `${height}px` : height
|
|
56
|
+
},
|
|
57
|
+
role: "status",
|
|
58
|
+
"aria-label": label,
|
|
59
|
+
...props,
|
|
60
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
61
|
+
className: "pf-sr-only",
|
|
62
|
+
children: label
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
LoadingSkeleton.displayName = "LoadingSkeleton";
|
|
67
|
+
//#endregion
|
|
68
|
+
export { LoadingDots, LoadingSkeleton, LoadingSpinner };
|
package/dist/index64.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
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/Metrics/Metrics.tsx
|
|
7
|
+
var trendSymbol = {
|
|
8
|
+
positive: "+",
|
|
9
|
+
negative: "-",
|
|
10
|
+
neutral: "="
|
|
11
|
+
};
|
|
12
|
+
var MetricGrid = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
13
|
+
ref,
|
|
14
|
+
className: cx("pf-metric-grid", className),
|
|
15
|
+
...props
|
|
16
|
+
}));
|
|
17
|
+
MetricGrid.displayName = "MetricGrid";
|
|
18
|
+
var MetricCard = forwardRef(function MetricCard({ className, heading, value, description, trend = "neutral", trendLabel, icon, iconName, action, children, ...props }, ref) {
|
|
19
|
+
const resolvedIcon = icon ?? (iconName ? /* @__PURE__ */ jsx(Icon, {
|
|
20
|
+
name: iconName,
|
|
21
|
+
"aria-hidden": true
|
|
22
|
+
}) : null);
|
|
23
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
24
|
+
ref,
|
|
25
|
+
className: cx("pf-metric-card", className),
|
|
26
|
+
...props,
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: "pf-metric-card__header",
|
|
30
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
31
|
+
className: "pf-metric-card__heading-wrap",
|
|
32
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
33
|
+
className: "pf-metric-card__heading",
|
|
34
|
+
children: heading
|
|
35
|
+
}), resolvedIcon ? /* @__PURE__ */ jsx("span", {
|
|
36
|
+
className: "pf-metric-card__icon",
|
|
37
|
+
"aria-hidden": true,
|
|
38
|
+
children: resolvedIcon
|
|
39
|
+
}) : null]
|
|
40
|
+
}), action ? /* @__PURE__ */ jsx("div", {
|
|
41
|
+
className: "pf-metric-card__action",
|
|
42
|
+
children: action
|
|
43
|
+
}) : null]
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsxs("div", {
|
|
46
|
+
className: "pf-metric-card__body",
|
|
47
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
48
|
+
className: "pf-metric-card__value",
|
|
49
|
+
children: value
|
|
50
|
+
}), trendLabel ? /* @__PURE__ */ jsxs("span", {
|
|
51
|
+
className: cx("pf-metric-card__trend", `pf-metric-card__trend--${trend}`),
|
|
52
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
53
|
+
className: "pf-metric-card__trend-symbol",
|
|
54
|
+
"aria-hidden": true,
|
|
55
|
+
children: trendSymbol[trend]
|
|
56
|
+
}), trendLabel]
|
|
57
|
+
}) : null]
|
|
58
|
+
}),
|
|
59
|
+
description ? /* @__PURE__ */ jsx("p", {
|
|
60
|
+
className: "pf-metric-card__description",
|
|
61
|
+
children: description
|
|
62
|
+
}) : null,
|
|
63
|
+
children
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
MetricCard.displayName = "MetricCard";
|
|
68
|
+
//#endregion
|
|
69
|
+
export { MetricCard, MetricGrid };
|
package/dist/index66.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { cx } from "./index4.js";
|
|
2
|
+
import { Icon } from "./index6.js";
|
|
3
|
+
import { useFocusTrap } from "./index34.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { forwardRef, useEffect, useId, useImperativeHandle, useRef } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal } from "react-dom";
|
|
8
|
+
//#region src/components/Modal/Modal.tsx
|
|
9
|
+
var ModalHeader = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
10
|
+
ref,
|
|
11
|
+
className: cx("pf-modal__header", className),
|
|
12
|
+
...props
|
|
13
|
+
}));
|
|
14
|
+
ModalHeader.displayName = "ModalHeader";
|
|
15
|
+
var ModalBody = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
16
|
+
ref,
|
|
17
|
+
className: cx("pf-modal__body", className),
|
|
18
|
+
...props
|
|
19
|
+
}));
|
|
20
|
+
ModalBody.displayName = "ModalBody";
|
|
21
|
+
var ModalFooter = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
22
|
+
ref,
|
|
23
|
+
className: cx("pf-modal__footer", className),
|
|
24
|
+
...props
|
|
25
|
+
}));
|
|
26
|
+
ModalFooter.displayName = "ModalFooter";
|
|
27
|
+
var Modal = forwardRef(function Modal({ className, open, onOpenChange, title, description, footer, size = "md", closeOnOverlayClick = true, showCloseButton = true, children, ...props }, ref) {
|
|
28
|
+
const titleId = useId();
|
|
29
|
+
const descriptionId = useId();
|
|
30
|
+
const dialogRef = useRef(null);
|
|
31
|
+
useImperativeHandle(ref, () => dialogRef.current, []);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!open || typeof document === "undefined") return;
|
|
34
|
+
const originalOverflow = document.body.style.overflow;
|
|
35
|
+
document.body.style.overflow = "hidden";
|
|
36
|
+
return () => {
|
|
37
|
+
document.body.style.overflow = originalOverflow;
|
|
38
|
+
};
|
|
39
|
+
}, [open]);
|
|
40
|
+
useFocusTrap({
|
|
41
|
+
containerRef: dialogRef,
|
|
42
|
+
enabled: open,
|
|
43
|
+
onEscape: () => onOpenChange?.(false)
|
|
44
|
+
});
|
|
45
|
+
if (!open || typeof document === "undefined") return null;
|
|
46
|
+
return createPortal(/* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: "pf-modal__portal",
|
|
48
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: "pf-modal__overlay",
|
|
50
|
+
onClick: () => {
|
|
51
|
+
if (closeOnOverlayClick) onOpenChange?.(false);
|
|
52
|
+
}
|
|
53
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: "pf-modal__viewport",
|
|
55
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
56
|
+
ref: dialogRef,
|
|
57
|
+
className: cx("pf-modal", `pf-modal--${size}`, className),
|
|
58
|
+
role: "dialog",
|
|
59
|
+
"aria-modal": "true",
|
|
60
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
61
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
62
|
+
tabIndex: -1,
|
|
63
|
+
...props,
|
|
64
|
+
children: [
|
|
65
|
+
title || description || showCloseButton ? /* @__PURE__ */ jsxs(ModalHeader, { children: [/* @__PURE__ */ jsxs("div", {
|
|
66
|
+
className: "pf-modal__heading-group",
|
|
67
|
+
children: [title ? /* @__PURE__ */ jsx("h2", {
|
|
68
|
+
className: "pf-modal__title",
|
|
69
|
+
id: titleId,
|
|
70
|
+
children: title
|
|
71
|
+
}) : null, description ? /* @__PURE__ */ jsx("p", {
|
|
72
|
+
className: "pf-modal__description",
|
|
73
|
+
id: descriptionId,
|
|
74
|
+
children: description
|
|
75
|
+
}) : null]
|
|
76
|
+
}), showCloseButton ? /* @__PURE__ */ jsx("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
className: "pf-modal__close",
|
|
79
|
+
"aria-label": "Close modal",
|
|
80
|
+
onClick: () => onOpenChange?.(false),
|
|
81
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
82
|
+
name: "circle-xmark",
|
|
83
|
+
"aria-hidden": true
|
|
84
|
+
})
|
|
85
|
+
}) : null] }) : null,
|
|
86
|
+
/* @__PURE__ */ jsx(ModalBody, { children }),
|
|
87
|
+
footer ? /* @__PURE__ */ jsx(ModalFooter, { children: footer }) : null
|
|
88
|
+
]
|
|
89
|
+
})
|
|
90
|
+
})]
|
|
91
|
+
}), document.body);
|
|
92
|
+
});
|
|
93
|
+
Modal.displayName = "Modal";
|
|
94
|
+
//#endregion
|
|
95
|
+
export { Modal, ModalBody, ModalFooter, ModalHeader };
|