@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/index68.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Keys, composeDescribedBy, isActivationKey } 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 { useComposedRefs } from "./index31.js";
|
|
7
|
+
import { useControllableState } from "./index32.js";
|
|
8
|
+
import { useDisclosure } from "./index33.js";
|
|
9
|
+
import { useListNavigation } from "./index35.js";
|
|
10
|
+
import { useOutsideInteraction } from "./index36.js";
|
|
11
|
+
/* empty css */
|
|
12
|
+
import { forwardRef, useEffect, useId, useMemo, useRef } from "react";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { createPortal } from "react-dom";
|
|
15
|
+
//#region src/components/MultiSelect/MultiSelect.tsx
|
|
16
|
+
var MultiSelect = forwardRef(({ id, options, value, defaultValue, onValueChange, placeholder = "Select options", name, label, description, error, className, disabled, required, "aria-describedby": ariaDescribedBy, ...props }, ref) => {
|
|
17
|
+
const generatedId = useId();
|
|
18
|
+
const selectId = id ?? generatedId;
|
|
19
|
+
const descriptionId = description ? `${selectId}-description` : void 0;
|
|
20
|
+
const errorId = error ? `${selectId}-error` : void 0;
|
|
21
|
+
const listboxId = `${selectId}-listbox`;
|
|
22
|
+
const describedBy = composeDescribedBy(ariaDescribedBy, descriptionId, errorId);
|
|
23
|
+
const [controllableSelectedValues, setSelectedValues] = useControllableState({
|
|
24
|
+
value,
|
|
25
|
+
defaultValue: defaultValue ?? [],
|
|
26
|
+
onChange: onValueChange
|
|
27
|
+
});
|
|
28
|
+
const selectedValues = useMemo(() => controllableSelectedValues ?? [], [controllableSelectedValues]);
|
|
29
|
+
const selectedSet = useMemo(() => new Set(selectedValues), [selectedValues]);
|
|
30
|
+
const selectedOptions = useMemo(() => options.filter((option) => selectedSet.has(option.value)), [options, selectedSet]);
|
|
31
|
+
const selectedIndex = options.findIndex((option) => selectedSet.has(option.value) && !option.disabled);
|
|
32
|
+
const disclosure = useDisclosure({ disabled });
|
|
33
|
+
const { isOpen } = disclosure;
|
|
34
|
+
const { activeIndex, firstEnabledIndex, lastEnabledIndex, move, setActiveIndex } = useListNavigation({
|
|
35
|
+
items: options,
|
|
36
|
+
isDisabled: (option) => Boolean(option.disabled),
|
|
37
|
+
initialIndex: selectedIndex >= 0 ? selectedIndex : void 0
|
|
38
|
+
});
|
|
39
|
+
const rootRef = useRef(null);
|
|
40
|
+
const triggerRef = useRef(null);
|
|
41
|
+
const menuRef = useRef(null);
|
|
42
|
+
const triggerRefs = useComposedRefs(triggerRef, ref);
|
|
43
|
+
const menuStyle = useAnchoredPosition({
|
|
44
|
+
anchorRef: triggerRef,
|
|
45
|
+
enabled: isOpen,
|
|
46
|
+
matchAnchorWidth: true
|
|
47
|
+
});
|
|
48
|
+
useOutsideInteraction({
|
|
49
|
+
refs: [rootRef, menuRef],
|
|
50
|
+
enabled: isOpen,
|
|
51
|
+
onInteractOutside: disclosure.close
|
|
52
|
+
});
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!isOpen) return;
|
|
55
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : firstEnabledIndex);
|
|
56
|
+
}, [
|
|
57
|
+
firstEnabledIndex,
|
|
58
|
+
isOpen,
|
|
59
|
+
selectedIndex,
|
|
60
|
+
setActiveIndex
|
|
61
|
+
]);
|
|
62
|
+
const updateValue = (nextValue) => {
|
|
63
|
+
setSelectedValues(nextValue);
|
|
64
|
+
};
|
|
65
|
+
const toggleValue = (nextValue) => {
|
|
66
|
+
if (selectedSet.has(nextValue)) {
|
|
67
|
+
updateValue(selectedValues.filter((valueItem) => valueItem !== nextValue));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
updateValue([...selectedValues, nextValue]);
|
|
71
|
+
};
|
|
72
|
+
const onTriggerKeyDown = (event) => {
|
|
73
|
+
if (disabled) return;
|
|
74
|
+
if (event.key === Keys.ArrowDown || event.key === Keys.ArrowUp) {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
if (!isOpen) {
|
|
77
|
+
disclosure.open();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const startIndex = activeIndex >= 0 ? activeIndex : 0;
|
|
81
|
+
move(event.key === Keys.ArrowDown ? "next" : "previous", startIndex);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (event.key === Keys.Home) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
if (firstEnabledIndex >= 0) setActiveIndex(firstEnabledIndex);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (event.key === Keys.End) {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
if (lastEnabledIndex >= 0) setActiveIndex(lastEnabledIndex);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (isActivationKey(event.key)) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
if (!isOpen) {
|
|
97
|
+
disclosure.open();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const activeOption = options[activeIndex];
|
|
101
|
+
if (activeOption && !activeOption.disabled) toggleValue(activeOption.value);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (event.key === Keys.Escape) disclosure.close();
|
|
105
|
+
};
|
|
106
|
+
return /* @__PURE__ */ jsx(FieldWrapper, {
|
|
107
|
+
labelFor: selectId,
|
|
108
|
+
label,
|
|
109
|
+
description,
|
|
110
|
+
descriptionId,
|
|
111
|
+
error,
|
|
112
|
+
errorId,
|
|
113
|
+
required,
|
|
114
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
115
|
+
className: "pf-multi-select",
|
|
116
|
+
ref: rootRef,
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsxs("button", {
|
|
119
|
+
...props,
|
|
120
|
+
id: selectId,
|
|
121
|
+
ref: triggerRefs,
|
|
122
|
+
type: "button",
|
|
123
|
+
className: cx("pf-multi-select__trigger", isOpen && "pf-multi-select__trigger--open", error && "pf-multi-select__trigger--invalid", className),
|
|
124
|
+
disabled,
|
|
125
|
+
"aria-haspopup": "listbox",
|
|
126
|
+
"aria-expanded": isOpen,
|
|
127
|
+
"aria-required": required || void 0,
|
|
128
|
+
"aria-controls": isOpen ? listboxId : void 0,
|
|
129
|
+
"aria-describedby": describedBy,
|
|
130
|
+
onClick: () => {
|
|
131
|
+
disclosure.toggle();
|
|
132
|
+
},
|
|
133
|
+
onKeyDown: onTriggerKeyDown,
|
|
134
|
+
children: [selectedOptions.length > 0 ? /* @__PURE__ */ jsx("span", {
|
|
135
|
+
className: "pf-multi-select__chips",
|
|
136
|
+
children: selectedOptions.map((option) => /* @__PURE__ */ jsx("span", {
|
|
137
|
+
className: "pf-multi-select__chip",
|
|
138
|
+
children: option.label
|
|
139
|
+
}, option.value))
|
|
140
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
141
|
+
className: "pf-multi-select__placeholder",
|
|
142
|
+
children: placeholder
|
|
143
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
144
|
+
"aria-hidden": true,
|
|
145
|
+
className: cx("pf-multi-select__icon", isOpen && "pf-multi-select__icon--open"),
|
|
146
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
147
|
+
name: "chevron-down",
|
|
148
|
+
"aria-hidden": true
|
|
149
|
+
})
|
|
150
|
+
})]
|
|
151
|
+
}),
|
|
152
|
+
name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsx("input", {
|
|
153
|
+
type: "hidden",
|
|
154
|
+
name,
|
|
155
|
+
value: selectedValue
|
|
156
|
+
}, selectedValue)) : null,
|
|
157
|
+
isOpen && typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx("ul", {
|
|
158
|
+
id: listboxId,
|
|
159
|
+
ref: menuRef,
|
|
160
|
+
className: "pf-multi-select__menu",
|
|
161
|
+
style: menuStyle,
|
|
162
|
+
role: "listbox",
|
|
163
|
+
"aria-multiselectable": "true",
|
|
164
|
+
"aria-labelledby": label ? selectId : void 0,
|
|
165
|
+
children: options.map((option, index) => {
|
|
166
|
+
const isSelected = selectedSet.has(option.value);
|
|
167
|
+
const isActive = index === activeIndex;
|
|
168
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
169
|
+
id: `${listboxId}-option-${index}`,
|
|
170
|
+
role: "option",
|
|
171
|
+
"aria-selected": isSelected,
|
|
172
|
+
"aria-disabled": option.disabled ? true : void 0,
|
|
173
|
+
className: cx("pf-multi-select__option", isSelected && "pf-multi-select__option--selected", isActive && "pf-multi-select__option--active", option.disabled && "pf-multi-select__option--disabled"),
|
|
174
|
+
onMouseEnter: () => {
|
|
175
|
+
if (!option.disabled) setActiveIndex(index);
|
|
176
|
+
},
|
|
177
|
+
onMouseDown: (event) => {
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
},
|
|
180
|
+
onClick: () => {
|
|
181
|
+
if (option.disabled) return;
|
|
182
|
+
toggleValue(option.value);
|
|
183
|
+
triggerRef.current?.focus();
|
|
184
|
+
},
|
|
185
|
+
children: [/* @__PURE__ */ jsx("span", { children: option.label }), isSelected ? /* @__PURE__ */ jsx("span", {
|
|
186
|
+
className: "pf-multi-select__check",
|
|
187
|
+
"aria-hidden": true,
|
|
188
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
189
|
+
name: "square-check",
|
|
190
|
+
"aria-hidden": true
|
|
191
|
+
})
|
|
192
|
+
}) : null]
|
|
193
|
+
}, option.value);
|
|
194
|
+
})
|
|
195
|
+
}), document.body) : null
|
|
196
|
+
]
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
MultiSelect.displayName = "MultiSelect";
|
|
201
|
+
//#endregion
|
|
202
|
+
export { MultiSelect };
|
package/dist/index70.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
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/Notification/Notification.tsx
|
|
7
|
+
var variantIcon = {
|
|
8
|
+
info: "circle-info",
|
|
9
|
+
success: "circle-check",
|
|
10
|
+
warning: "triangle-exclamation",
|
|
11
|
+
danger: "circle-xmark"
|
|
12
|
+
};
|
|
13
|
+
var NotificationStack = forwardRef(({ className, placement = "top-right", ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
14
|
+
ref,
|
|
15
|
+
className: cx("pf-notification-stack", `pf-notification-stack--${placement}`, className),
|
|
16
|
+
...props
|
|
17
|
+
}));
|
|
18
|
+
NotificationStack.displayName = "NotificationStack";
|
|
19
|
+
var Notification = forwardRef(({ className, variant = "info", heading, description, icon, action, dismissible = false, onDismiss, children, ...props }, ref) => {
|
|
20
|
+
const resolvedIcon = icon ?? /* @__PURE__ */ jsx(Icon, {
|
|
21
|
+
name: variantIcon[variant],
|
|
22
|
+
"aria-hidden": true
|
|
23
|
+
});
|
|
24
|
+
const body = children ?? description;
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
ref,
|
|
27
|
+
className: cx("pf-notification", `pf-notification--${variant}`, className),
|
|
28
|
+
role: "status",
|
|
29
|
+
...props,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx("span", {
|
|
32
|
+
className: "pf-notification__icon",
|
|
33
|
+
"aria-hidden": true,
|
|
34
|
+
children: resolvedIcon
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsxs("div", {
|
|
37
|
+
className: "pf-notification__content",
|
|
38
|
+
children: [
|
|
39
|
+
heading ? /* @__PURE__ */ jsx("p", {
|
|
40
|
+
className: "pf-notification__title",
|
|
41
|
+
children: heading
|
|
42
|
+
}) : null,
|
|
43
|
+
body ? /* @__PURE__ */ jsx("div", {
|
|
44
|
+
className: "pf-notification__description",
|
|
45
|
+
children: body
|
|
46
|
+
}) : null,
|
|
47
|
+
action ? /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: "pf-notification__action",
|
|
49
|
+
children: action
|
|
50
|
+
}) : null
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
dismissible ? /* @__PURE__ */ jsx("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
className: "pf-notification__dismiss",
|
|
56
|
+
"aria-label": "Dismiss notification",
|
|
57
|
+
onClick: () => onDismiss?.(),
|
|
58
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
59
|
+
name: "circle-xmark",
|
|
60
|
+
"aria-hidden": true
|
|
61
|
+
})
|
|
62
|
+
}) : null
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
Notification.displayName = "Notification";
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Notification, NotificationStack };
|
package/dist/index72.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { cx } from "./index4.js";
|
|
2
|
+
import { Breadcrumbs } from "./index18.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/PageHeader/PageHeader.tsx
|
|
7
|
+
var PageHeaderMeta = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
8
|
+
ref,
|
|
9
|
+
className: cx("pf-page-header__meta", className),
|
|
10
|
+
...props
|
|
11
|
+
}));
|
|
12
|
+
PageHeaderMeta.displayName = "PageHeaderMeta";
|
|
13
|
+
var PageHeader = forwardRef(function PageHeader({ className, eyebrow, heading, description, breadcrumbs, metadata, actions, children, ...props }, ref) {
|
|
14
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
15
|
+
ref,
|
|
16
|
+
className: cx("pf-page-header", className),
|
|
17
|
+
...props,
|
|
18
|
+
children: [breadcrumbs?.length ? /* @__PURE__ */ jsx(Breadcrumbs, {
|
|
19
|
+
items: breadcrumbs,
|
|
20
|
+
className: "pf-page-header__breadcrumbs"
|
|
21
|
+
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: "pf-page-header__row",
|
|
23
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
24
|
+
className: "pf-page-header__content",
|
|
25
|
+
children: [
|
|
26
|
+
eyebrow ? /* @__PURE__ */ jsx("p", {
|
|
27
|
+
className: "pf-page-header__eyebrow",
|
|
28
|
+
children: eyebrow
|
|
29
|
+
}) : null,
|
|
30
|
+
/* @__PURE__ */ jsx("h1", {
|
|
31
|
+
className: "pf-page-header__heading",
|
|
32
|
+
children: heading
|
|
33
|
+
}),
|
|
34
|
+
description ? /* @__PURE__ */ jsx("p", {
|
|
35
|
+
className: "pf-page-header__description",
|
|
36
|
+
children: description
|
|
37
|
+
}) : null,
|
|
38
|
+
metadata ? /* @__PURE__ */ jsx(PageHeaderMeta, { children: metadata }) : null,
|
|
39
|
+
children
|
|
40
|
+
]
|
|
41
|
+
}), actions ? /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "pf-page-header__actions",
|
|
43
|
+
children: actions
|
|
44
|
+
}) : null]
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
PageHeader.displayName = "PageHeader";
|
|
49
|
+
//#endregion
|
|
50
|
+
export { PageHeader, PageHeaderMeta };
|
package/dist/index74.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { cx } from "./index4.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Pagination/Pagination.tsx
|
|
6
|
+
function clampPage(page, totalPages) {
|
|
7
|
+
if (totalPages <= 0) return 1;
|
|
8
|
+
return Math.min(Math.max(page, 1), totalPages);
|
|
9
|
+
}
|
|
10
|
+
function getPaginationItems(currentPage, totalPages, siblingCount, boundaryCount) {
|
|
11
|
+
const safeTotal = Math.max(totalPages, 1);
|
|
12
|
+
const safeCurrent = clampPage(currentPage, safeTotal);
|
|
13
|
+
const safeSiblingCount = Math.max(siblingCount, 0);
|
|
14
|
+
const safeBoundaryCount = Math.max(boundaryCount, 0);
|
|
15
|
+
const leftBoundaryEnd = Math.min(safeBoundaryCount, safeTotal);
|
|
16
|
+
const rightBoundaryStart = Math.max(safeTotal - safeBoundaryCount + 1, 1);
|
|
17
|
+
const start = Math.max(safeCurrent - safeSiblingCount, leftBoundaryEnd + 1);
|
|
18
|
+
const end = Math.min(safeCurrent + safeSiblingCount, rightBoundaryStart - 1);
|
|
19
|
+
const items = [];
|
|
20
|
+
for (let page = 1; page <= leftBoundaryEnd; page += 1) items.push(page);
|
|
21
|
+
if (start > leftBoundaryEnd + 1) items.push("ellipsis-left");
|
|
22
|
+
for (let page = start; page <= end; page += 1) items.push(page);
|
|
23
|
+
if (end < rightBoundaryStart - 1) items.push("ellipsis-right");
|
|
24
|
+
for (let page = rightBoundaryStart; page <= safeTotal; page += 1) if (page > leftBoundaryEnd) items.push(page);
|
|
25
|
+
if (!items.length) return [1];
|
|
26
|
+
return items;
|
|
27
|
+
}
|
|
28
|
+
var Pagination = React.forwardRef(function Pagination({ className, page, defaultPage = 1, totalPages, siblingCount = 1, boundaryCount = 1, showPrevNext = true, disabled = false, onPageChange, prevLabel = "Previous", nextLabel = "Next", "aria-label": ariaLabel = "Pagination", ...props }, ref) {
|
|
29
|
+
const safeTotalPages = Math.max(totalPages, 1);
|
|
30
|
+
const [internalPage, setInternalPage] = React.useState(() => clampPage(defaultPage, safeTotalPages));
|
|
31
|
+
const currentPage = clampPage(page ?? internalPage, safeTotalPages);
|
|
32
|
+
const items = getPaginationItems(currentPage, safeTotalPages, siblingCount, boundaryCount);
|
|
33
|
+
const canGoPrev = currentPage > 1;
|
|
34
|
+
const canGoNext = currentPage < safeTotalPages;
|
|
35
|
+
const setPage = React.useCallback((nextPage) => {
|
|
36
|
+
const clamped = clampPage(nextPage, safeTotalPages);
|
|
37
|
+
if (page === void 0) setInternalPage(clamped);
|
|
38
|
+
onPageChange?.(clamped);
|
|
39
|
+
}, [
|
|
40
|
+
onPageChange,
|
|
41
|
+
page,
|
|
42
|
+
safeTotalPages
|
|
43
|
+
]);
|
|
44
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
45
|
+
ref,
|
|
46
|
+
className: cx("pf-pagination", disabled && "pf-pagination--disabled", className),
|
|
47
|
+
"aria-label": ariaLabel,
|
|
48
|
+
...props,
|
|
49
|
+
children: [
|
|
50
|
+
showPrevNext ? /* @__PURE__ */ jsx("button", {
|
|
51
|
+
type: "button",
|
|
52
|
+
className: "pf-pagination__nav",
|
|
53
|
+
onClick: () => setPage(currentPage - 1),
|
|
54
|
+
disabled: disabled || !canGoPrev,
|
|
55
|
+
children: prevLabel
|
|
56
|
+
}) : null,
|
|
57
|
+
/* @__PURE__ */ jsx("ol", {
|
|
58
|
+
className: "pf-pagination__list",
|
|
59
|
+
children: items.map((item, index) => {
|
|
60
|
+
if (typeof item !== "number") return /* @__PURE__ */ jsx("li", {
|
|
61
|
+
className: "pf-pagination__ellipsis",
|
|
62
|
+
"aria-hidden": true,
|
|
63
|
+
children: "..."
|
|
64
|
+
}, `${item}-${index}`);
|
|
65
|
+
const isCurrent = item === currentPage;
|
|
66
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("button", {
|
|
67
|
+
type: "button",
|
|
68
|
+
className: cx("pf-pagination__page", isCurrent && "pf-pagination__page--active"),
|
|
69
|
+
onClick: () => setPage(item),
|
|
70
|
+
disabled,
|
|
71
|
+
"aria-current": isCurrent ? "page" : void 0,
|
|
72
|
+
children: item
|
|
73
|
+
}) }, item);
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
showPrevNext ? /* @__PURE__ */ jsx("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
className: "pf-pagination__nav",
|
|
79
|
+
onClick: () => setPage(currentPage + 1),
|
|
80
|
+
disabled: disabled || !canGoNext,
|
|
81
|
+
children: nextLabel
|
|
82
|
+
}) : null
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
Pagination.displayName = "Pagination";
|
|
87
|
+
//#endregion
|
|
88
|
+
export { Pagination };
|
package/dist/index76.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
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/PieChart/PieChart.tsx
|
|
6
|
+
var fallbackColors = [
|
|
7
|
+
"var(--color-brand-600)",
|
|
8
|
+
"var(--color-brand-500)",
|
|
9
|
+
"var(--color-gray-500)",
|
|
10
|
+
"#06b6d4",
|
|
11
|
+
"#22c55e",
|
|
12
|
+
"var(--color-gray-500)"
|
|
13
|
+
];
|
|
14
|
+
function clampCutout(value) {
|
|
15
|
+
return Math.min(Math.max(value, 0), .88);
|
|
16
|
+
}
|
|
17
|
+
function prepareSegments(data) {
|
|
18
|
+
const normalized = data.map((item, index) => ({
|
|
19
|
+
...item,
|
|
20
|
+
value: Math.max(item.value, 0),
|
|
21
|
+
color: item.color ?? fallbackColors[index % fallbackColors.length]
|
|
22
|
+
}));
|
|
23
|
+
const total = normalized.reduce((sum, item) => sum + item.value, 0);
|
|
24
|
+
if (total <= 0) return [];
|
|
25
|
+
return normalized.filter((item) => item.value > 0).map((item) => ({
|
|
26
|
+
...item,
|
|
27
|
+
percentage: item.value / total * 100
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
function toConicGradient(segments) {
|
|
31
|
+
let cursor = 0;
|
|
32
|
+
return `conic-gradient(${segments.map((segment) => {
|
|
33
|
+
const start = cursor;
|
|
34
|
+
const end = cursor + segment.percentage;
|
|
35
|
+
cursor = end;
|
|
36
|
+
return `${segment.color} ${start}% ${end}%`;
|
|
37
|
+
}).join(", ")})`;
|
|
38
|
+
}
|
|
39
|
+
var PieChart = forwardRef(function PieChart({ className, data, size = 192, cutout = .58, showLegend = true, centerLabel, emptyLabel = "No data", ...props }, ref) {
|
|
40
|
+
const segments = prepareSegments(data);
|
|
41
|
+
const hasData = segments.length > 0;
|
|
42
|
+
const chartSize = Math.max(size, 120);
|
|
43
|
+
const safeCutout = clampCutout(cutout);
|
|
44
|
+
const centerSize = Math.round(chartSize * safeCutout);
|
|
45
|
+
const conicGradient = hasData ? toConicGradient(segments) : "conic-gradient(var(--color-semantic-background-subtle) 0% 100%)";
|
|
46
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
47
|
+
ref,
|
|
48
|
+
className: cx("pf-pie-chart", className),
|
|
49
|
+
...props,
|
|
50
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
51
|
+
className: cx("pf-pie-chart__visual", !hasData && "pf-pie-chart__visual--empty"),
|
|
52
|
+
style: {
|
|
53
|
+
width: chartSize,
|
|
54
|
+
height: chartSize,
|
|
55
|
+
backgroundImage: conicGradient
|
|
56
|
+
},
|
|
57
|
+
role: "img",
|
|
58
|
+
"aria-label": "Pie chart",
|
|
59
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: "pf-pie-chart__center",
|
|
61
|
+
style: {
|
|
62
|
+
width: centerSize,
|
|
63
|
+
height: centerSize
|
|
64
|
+
},
|
|
65
|
+
children: hasData ? centerLabel : emptyLabel
|
|
66
|
+
})
|
|
67
|
+
}), showLegend && hasData ? /* @__PURE__ */ jsx("ul", {
|
|
68
|
+
className: "pf-pie-chart__legend",
|
|
69
|
+
children: segments.map((segment, index) => /* @__PURE__ */ jsxs("li", {
|
|
70
|
+
className: "pf-pie-chart__legend-item",
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx("span", {
|
|
73
|
+
className: "pf-pie-chart__legend-dot",
|
|
74
|
+
style: { background: segment.color },
|
|
75
|
+
"aria-hidden": true
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx("span", {
|
|
78
|
+
className: "pf-pie-chart__legend-label",
|
|
79
|
+
children: segment.label
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ jsxs("span", {
|
|
82
|
+
className: "pf-pie-chart__legend-value",
|
|
83
|
+
children: [Math.round(segment.percentage), "%"]
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
}, `${index}-${segment.value}`))
|
|
87
|
+
}) : null]
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
PieChart.displayName = "PieChart";
|
|
91
|
+
//#endregion
|
|
92
|
+
export { PieChart };
|
package/dist/index78.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
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/ProgressIndicators/ProgressIndicators.tsx
|
|
6
|
+
var clampPercent = (value, max) => {
|
|
7
|
+
if (max <= 0) return 0;
|
|
8
|
+
return Math.max(0, Math.min(100, value / max * 100));
|
|
9
|
+
};
|
|
10
|
+
var ProgressBar = forwardRef(function ProgressBar({ value, max = 100, showValue = true, label, className, ...props }, ref) {
|
|
11
|
+
const percent = clampPercent(value, max);
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
ref,
|
|
14
|
+
className: cx("pf-progress-bar", className),
|
|
15
|
+
role: "progressbar",
|
|
16
|
+
"aria-label": label,
|
|
17
|
+
"aria-valuemin": 0,
|
|
18
|
+
"aria-valuemax": max,
|
|
19
|
+
"aria-valuenow": Math.round(percent / 100 * max),
|
|
20
|
+
...props,
|
|
21
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: "pf-progress-bar__track",
|
|
23
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
24
|
+
className: "pf-progress-bar__fill",
|
|
25
|
+
style: { "--pf-progress-fill": `${percent}%` }
|
|
26
|
+
})
|
|
27
|
+
}), showValue ? /* @__PURE__ */ jsxs("span", {
|
|
28
|
+
className: "pf-progress-bar__value",
|
|
29
|
+
children: [Math.round(percent), "%"]
|
|
30
|
+
}) : null]
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
ProgressBar.displayName = "ProgressBar";
|
|
34
|
+
var ProgressCircle = forwardRef(function ProgressCircle({ value, max = 100, size = 64, strokeWidth = 6, showValue = true, label, className, ...props }, ref) {
|
|
35
|
+
const percent = clampPercent(value, max);
|
|
36
|
+
const radius = (size - strokeWidth) / 2;
|
|
37
|
+
const circumference = 2 * Math.PI * radius;
|
|
38
|
+
const dashOffset = circumference * (1 - percent / 100);
|
|
39
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
40
|
+
ref,
|
|
41
|
+
className: cx("pf-progress-circle", className),
|
|
42
|
+
style: { "--pf-progress-circle-size": `${size}px` },
|
|
43
|
+
role: "progressbar",
|
|
44
|
+
"aria-label": label,
|
|
45
|
+
"aria-valuemin": 0,
|
|
46
|
+
"aria-valuemax": max,
|
|
47
|
+
"aria-valuenow": Math.round(percent / 100 * max),
|
|
48
|
+
...props,
|
|
49
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
50
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
51
|
+
className: "pf-progress-circle__svg",
|
|
52
|
+
"aria-hidden": true,
|
|
53
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
54
|
+
className: "pf-progress-circle__track",
|
|
55
|
+
cx: size / 2,
|
|
56
|
+
cy: size / 2,
|
|
57
|
+
r: radius,
|
|
58
|
+
strokeWidth
|
|
59
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
60
|
+
className: "pf-progress-circle__fill",
|
|
61
|
+
cx: size / 2,
|
|
62
|
+
cy: size / 2,
|
|
63
|
+
r: radius,
|
|
64
|
+
strokeWidth,
|
|
65
|
+
strokeDasharray: circumference,
|
|
66
|
+
strokeDashoffset: dashOffset
|
|
67
|
+
})]
|
|
68
|
+
}), showValue ? /* @__PURE__ */ jsxs("span", {
|
|
69
|
+
className: "pf-progress-circle__value",
|
|
70
|
+
children: [Math.round(percent), "%"]
|
|
71
|
+
}) : null]
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
ProgressCircle.displayName = "ProgressCircle";
|
|
75
|
+
//#endregion
|
|
76
|
+
export { ProgressBar, ProgressCircle };
|
package/dist/index8.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
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/Alert/Alert.tsx
|
|
7
|
+
var variantIcon = {
|
|
8
|
+
info: "circle-info",
|
|
9
|
+
success: "circle-check",
|
|
10
|
+
warning: "triangle-exclamation",
|
|
11
|
+
danger: "circle-xmark"
|
|
12
|
+
};
|
|
13
|
+
var variantRole = {
|
|
14
|
+
info: "status",
|
|
15
|
+
success: "status",
|
|
16
|
+
warning: "alert",
|
|
17
|
+
danger: "alert"
|
|
18
|
+
};
|
|
19
|
+
var Alert = forwardRef(({ className, variant = "info", heading, description, dismissible = false, onDismiss, icon, children, ...props }, ref) => {
|
|
20
|
+
const resolvedIcon = icon ?? /* @__PURE__ */ jsx(Icon, {
|
|
21
|
+
name: variantIcon[variant],
|
|
22
|
+
"aria-hidden": true
|
|
23
|
+
});
|
|
24
|
+
const body = children ?? description;
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
ref,
|
|
27
|
+
className: cx("pf-alert", `pf-alert--${variant}`, className),
|
|
28
|
+
role: variantRole[variant],
|
|
29
|
+
...props,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx("span", {
|
|
32
|
+
className: "pf-alert__icon",
|
|
33
|
+
"aria-hidden": true,
|
|
34
|
+
children: resolvedIcon
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ jsxs("div", {
|
|
37
|
+
className: "pf-alert__content",
|
|
38
|
+
children: [heading ? /* @__PURE__ */ jsx("p", {
|
|
39
|
+
className: "pf-alert__title",
|
|
40
|
+
children: heading
|
|
41
|
+
}) : null, body ? /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "pf-alert__description",
|
|
43
|
+
children: body
|
|
44
|
+
}) : null]
|
|
45
|
+
}),
|
|
46
|
+
dismissible ? /* @__PURE__ */ jsx("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
className: "pf-alert__dismiss",
|
|
49
|
+
"aria-label": "Dismiss alert",
|
|
50
|
+
onClick: () => onDismiss?.(),
|
|
51
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
52
|
+
name: "circle-xmark",
|
|
53
|
+
"aria-hidden": true
|
|
54
|
+
})
|
|
55
|
+
}) : null
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
Alert.displayName = "Alert";
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Alert };
|
package/dist/index80.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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/ProgressSteps/ProgressSteps.tsx
|
|
6
|
+
function inferStatus(index, steps) {
|
|
7
|
+
const firstCurrent = steps.findIndex((step) => step.status === "current");
|
|
8
|
+
if (steps[index]?.status) return steps[index].status;
|
|
9
|
+
if (firstCurrent === -1) return index === 0 ? "current" : "upcoming";
|
|
10
|
+
if (index < firstCurrent) return "complete";
|
|
11
|
+
return index === firstCurrent ? "current" : "upcoming";
|
|
12
|
+
}
|
|
13
|
+
var ProgressSteps = forwardRef(function ProgressSteps({ className, steps, orientation = "horizontal", ...props }, ref) {
|
|
14
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
15
|
+
ref,
|
|
16
|
+
className: cx("pf-progress-steps", `pf-progress-steps--${orientation}`, className),
|
|
17
|
+
...props,
|
|
18
|
+
children: steps.map((step, index) => {
|
|
19
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
20
|
+
className: cx("pf-progress-steps__item", `pf-progress-steps__item--${inferStatus(index, steps)}`),
|
|
21
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: "pf-progress-steps__marker-wrap",
|
|
23
|
+
"aria-hidden": true,
|
|
24
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
25
|
+
className: "pf-progress-steps__marker",
|
|
26
|
+
children: index + 1
|
|
27
|
+
}), index < steps.length - 1 ? /* @__PURE__ */ jsx("span", { className: "pf-progress-steps__connector" }) : null]
|
|
28
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: "pf-progress-steps__content",
|
|
30
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
31
|
+
className: "pf-progress-steps__title",
|
|
32
|
+
children: step.title
|
|
33
|
+
}), step.description ? /* @__PURE__ */ jsx("p", {
|
|
34
|
+
className: "pf-progress-steps__description",
|
|
35
|
+
children: step.description
|
|
36
|
+
}) : null]
|
|
37
|
+
})]
|
|
38
|
+
}, step.id ?? `step-${index}`);
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
ProgressSteps.displayName = "ProgressSteps";
|
|
43
|
+
//#endregion
|
|
44
|
+
export { ProgressSteps };
|