@pitchfork-ui/react 0.2.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/Accordion.css +85 -0
- package/dist/components/Accordion/Accordion2.js +96 -0
- package/dist/components/Alert/Alert.css +29 -1
- package/dist/components/Alert/Alert2.js +4 -2
- package/dist/components/Avatar/Avatar.css +1 -1
- package/dist/components/BadgeGroup/BadgeGroup.css +4 -4
- package/dist/components/Button/Button.css +4 -4
- package/dist/components/ButtonGroup/ButtonGroup.css +2 -2
- package/dist/components/Carousel/Carousel.css +4 -2
- package/dist/components/Carousel/Carousel2.js +89 -76
- package/dist/components/CodeSnippet/CodeSnippet.css +2 -2
- package/dist/components/ContentDivider/ContentDivider.css +2 -2
- package/dist/components/DatePicker/DatePicker.css +1 -1
- package/dist/components/DatePicker/DatePicker2.js +3 -3
- package/dist/components/Dropdown/Dropdown.css +19 -2
- package/dist/components/Dropdown/Dropdown2.js +2 -3
- package/dist/components/GaugeChart/GaugeChart.css +18 -1
- package/dist/components/GaugeChart/GaugeChart2.js +5 -4
- package/dist/components/Heatmap/Heatmap.css +100 -0
- package/dist/components/Heatmap/Heatmap2.js +160 -0
- package/dist/components/InlineCTA/InlineCTA.css +58 -0
- package/dist/components/InlineCTA/InlineCTA2.js +14 -2
- package/dist/components/Modal/Modal.css +62 -0
- package/dist/components/Modal/Modal2.js +8 -6
- package/dist/components/MultiSelect/MultiSelect.css +19 -2
- package/dist/components/MultiSelect/MultiSelect2.js +3 -4
- package/dist/components/Notification/Notification.css +59 -4
- package/dist/components/Notification/Notification2.js +4 -2
- package/dist/components/PieChart/PieChart.css +34 -0
- package/dist/components/PieChart/PieChart2.js +1 -1
- package/dist/components/ProgressIndicators/ProgressIndicators.css +20 -2
- package/dist/components/ProgressIndicators/ProgressIndicators2.js +4 -1
- package/dist/components/ProgressSteps/ProgressSteps.css +20 -3
- package/dist/components/RadarChart/RadarChart.css +22 -0
- package/dist/components/RadarChart/RadarChart2.js +19 -13
- package/dist/components/RichTextEditor/RichTextEditor.css +1 -1
- package/dist/components/Select/Select.css +21 -2
- package/dist/components/Select/Select2.js +3 -4
- package/dist/components/SidebarNavigation/SidebarNavigation.css +1 -1
- package/dist/components/SlideoutMenu/SlideoutMenu.css +2 -2
- package/dist/components/Sparkline/Sparkline.css +48 -0
- package/dist/components/Sparkline/Sparkline2.js +3 -2
- package/dist/components/Table/Table.css +4 -4
- package/dist/components/Tabs/Tabs.css +31 -5
- package/dist/components/Tabs/Tabs2.js +51 -4
- package/dist/components/Tag/Tag.css +1 -1
- package/dist/components/Tooltip/Tooltip.css +35 -0
- package/dist/components/Tooltip/Tooltip2.js +4 -4
- package/dist/components/TreeView/TreeView.css +2 -2
- package/dist/hooks/useExitAnimation.js +25 -0
- package/dist/hooks/usePresence.js +31 -0
- package/dist/index.cjs +834 -454
- package/dist/index.js +12 -8
- package/dist/src/components/Accordion/Accordion.d.ts +20 -0
- package/dist/src/components/Accordion/Accordion.test.d.ts +1 -0
- package/dist/src/components/Accordion/index.d.ts +1 -0
- package/dist/src/components/Heatmap/Heatmap.d.ts +28 -0
- package/dist/src/components/Heatmap/Heatmap.test.d.ts +1 -0
- package/dist/src/components/Heatmap/index.d.ts +1 -0
- package/dist/src/components/InlineCTA/InlineCTA.d.ts +2 -0
- package/dist/src/components/Sparkline/Sparkline.d.ts +2 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/useExitAnimation.d.ts +18 -0
- package/dist/src/hooks/usePresence.d.ts +13 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/styles/theme.css +47 -13
- package/dist/styles.css +758 -64
- package/package.json +1 -1
- package/theme.starter.css +4 -3
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
.pf-accordion {
|
|
2
|
+
border: 1px solid var(--pf-accordion-border);
|
|
3
|
+
border-radius: var(--radius-md);
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.pf-accordion__item + .pf-accordion__item {
|
|
8
|
+
border-top: 1px solid var(--pf-accordion-border);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.pf-accordion__heading {
|
|
12
|
+
margin: 0;
|
|
13
|
+
font-size: inherit;
|
|
14
|
+
font-weight: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pf-accordion__trigger {
|
|
18
|
+
align-items: center;
|
|
19
|
+
background: transparent;
|
|
20
|
+
border: 0;
|
|
21
|
+
color: var(--pf-accordion-trigger-text);
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
display: flex;
|
|
24
|
+
font: inherit;
|
|
25
|
+
font-weight: var(--font-weight-medium);
|
|
26
|
+
gap: var(--space-3);
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
padding: var(--space-3) var(--space-4);
|
|
29
|
+
text-align: start;
|
|
30
|
+
width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.pf-accordion__trigger:hover:not(:disabled) {
|
|
34
|
+
background: var(--pf-accordion-trigger-bg-hover);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.pf-accordion__trigger:focus-visible {
|
|
38
|
+
box-shadow: var(--pf-focus-ring);
|
|
39
|
+
outline: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.pf-accordion__trigger:disabled {
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
opacity: 0.5;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.pf-accordion__icon {
|
|
48
|
+
align-items: center;
|
|
49
|
+
color: var(--pf-accordion-icon);
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
transition: transform var(--pf-transition-fast);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pf-accordion__item--open .pf-accordion__icon {
|
|
56
|
+
transform: rotate(180deg);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Animate open/close height with the grid-template-rows 0fr → 1fr technique */
|
|
60
|
+
.pf-accordion__panel {
|
|
61
|
+
display: grid;
|
|
62
|
+
grid-template-rows: 0fr;
|
|
63
|
+
transition: grid-template-rows var(--pf-transition-medium);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.pf-accordion__panel--open {
|
|
67
|
+
grid-template-rows: 1fr;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.pf-accordion__content {
|
|
71
|
+
min-height: 0;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
color: var(--pf-accordion-content-text);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.pf-accordion__content-inner {
|
|
77
|
+
padding: 0 var(--space-4) var(--space-4);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@media (prefers-reduced-motion: reduce) {
|
|
81
|
+
.pf-accordion__panel,
|
|
82
|
+
.pf-accordion__icon {
|
|
83
|
+
transition: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Keys } from "../../a11y/index.js";
|
|
2
|
+
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
3
|
+
import { cx } from "../../utils/cx.js";
|
|
4
|
+
import { Icon } from "../Icon/Icon2.js";
|
|
5
|
+
import './Accordion.css';/* empty css */
|
|
6
|
+
import { forwardRef, useId, useRef } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/Accordion/Accordion.tsx
|
|
9
|
+
var Accordion = forwardRef(function Accordion({ className, items, type = "single", value, defaultValue, onValueChange, headingLevel = 3, ...props }, ref) {
|
|
10
|
+
const baseId = useId();
|
|
11
|
+
const [expanded = [], setExpanded] = useControllableState({
|
|
12
|
+
value,
|
|
13
|
+
defaultValue: defaultValue ?? [],
|
|
14
|
+
onChange: onValueChange
|
|
15
|
+
});
|
|
16
|
+
const triggerRefs = useRef([]);
|
|
17
|
+
const toggle = (itemValue) => {
|
|
18
|
+
const isOpen = expanded.includes(itemValue);
|
|
19
|
+
if (type === "single") setExpanded(isOpen ? [] : [itemValue]);
|
|
20
|
+
else setExpanded(isOpen ? expanded.filter((v) => v !== itemValue) : [...expanded, itemValue]);
|
|
21
|
+
};
|
|
22
|
+
const enabledIndexes = items.map((item, index) => ({
|
|
23
|
+
item,
|
|
24
|
+
index
|
|
25
|
+
})).filter(({ item }) => !item.disabled).map(({ index }) => index);
|
|
26
|
+
const onTriggerKeyDown = (event, index) => {
|
|
27
|
+
if (enabledIndexes.length === 0) return;
|
|
28
|
+
const position = enabledIndexes.indexOf(index);
|
|
29
|
+
let target;
|
|
30
|
+
if (event.key === Keys.ArrowDown) target = enabledIndexes[(position + 1) % enabledIndexes.length];
|
|
31
|
+
else if (event.key === Keys.ArrowUp) target = enabledIndexes[(position - 1 + enabledIndexes.length) % enabledIndexes.length];
|
|
32
|
+
else if (event.key === Keys.Home) target = enabledIndexes[0];
|
|
33
|
+
else if (event.key === Keys.End) target = enabledIndexes[enabledIndexes.length - 1];
|
|
34
|
+
if (target !== void 0) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
triggerRefs.current[target]?.focus();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const Heading = `h${headingLevel}`;
|
|
40
|
+
return /* @__PURE__ */ jsx("div", {
|
|
41
|
+
ref,
|
|
42
|
+
className: cx("pf-accordion", className),
|
|
43
|
+
...props,
|
|
44
|
+
children: items.map((item, index) => {
|
|
45
|
+
const isOpen = expanded.includes(item.value);
|
|
46
|
+
const triggerId = `${baseId}-trigger-${item.value}`;
|
|
47
|
+
const panelId = `${baseId}-panel-${item.value}`;
|
|
48
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
49
|
+
className: cx("pf-accordion__item", isOpen && "pf-accordion__item--open"),
|
|
50
|
+
children: [/* @__PURE__ */ jsx(Heading, {
|
|
51
|
+
className: "pf-accordion__heading",
|
|
52
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
53
|
+
ref: (element) => {
|
|
54
|
+
triggerRefs.current[index] = element;
|
|
55
|
+
},
|
|
56
|
+
type: "button",
|
|
57
|
+
id: triggerId,
|
|
58
|
+
className: "pf-accordion__trigger",
|
|
59
|
+
"aria-expanded": isOpen,
|
|
60
|
+
"aria-controls": panelId,
|
|
61
|
+
disabled: item.disabled,
|
|
62
|
+
onClick: () => toggle(item.value),
|
|
63
|
+
onKeyDown: (event) => onTriggerKeyDown(event, index),
|
|
64
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
65
|
+
className: "pf-accordion__title",
|
|
66
|
+
children: item.title
|
|
67
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "pf-accordion__icon",
|
|
69
|
+
"aria-hidden": true,
|
|
70
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
71
|
+
name: "chevron-down",
|
|
72
|
+
"aria-hidden": true
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
})
|
|
76
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
77
|
+
className: cx("pf-accordion__panel", isOpen && "pf-accordion__panel--open"),
|
|
78
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
79
|
+
id: panelId,
|
|
80
|
+
role: "region",
|
|
81
|
+
"aria-labelledby": triggerId,
|
|
82
|
+
className: "pf-accordion__content",
|
|
83
|
+
...isOpen ? {} : { inert: true },
|
|
84
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
85
|
+
className: "pf-accordion__content-inner",
|
|
86
|
+
children: item.content
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
})]
|
|
90
|
+
}, item.value);
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
Accordion.displayName = "Accordion";
|
|
95
|
+
//#endregion
|
|
96
|
+
export { Accordion };
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
display: inline-flex;
|
|
74
74
|
font-size: var(--font-size-md);
|
|
75
75
|
justify-content: center;
|
|
76
|
-
margin-
|
|
76
|
+
margin-inline-start: auto;
|
|
77
77
|
padding: 0;
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -81,3 +81,31 @@
|
|
|
81
81
|
box-shadow: var(--pf-alert-focus-ring, var(--pf-focus-ring));
|
|
82
82
|
outline: none;
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
/* Exit: fade and collapse so surrounding content reflows when dismissed. */
|
|
86
|
+
.pf-alert--exiting {
|
|
87
|
+
animation: pf-alert-out var(--duration-moderate) var(--easing-accelerate) forwards;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@keyframes pf-alert-out {
|
|
93
|
+
from {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
max-height: 480px;
|
|
96
|
+
}
|
|
97
|
+
to {
|
|
98
|
+
opacity: 0;
|
|
99
|
+
max-height: 0;
|
|
100
|
+
margin-top: 0;
|
|
101
|
+
margin-bottom: 0;
|
|
102
|
+
padding-top: 0;
|
|
103
|
+
padding-bottom: 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media (prefers-reduced-motion: reduce) {
|
|
108
|
+
.pf-alert--exiting {
|
|
109
|
+
animation: none;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useExitAnimation } from "../../hooks/useExitAnimation.js";
|
|
1
2
|
import { cx } from "../../utils/cx.js";
|
|
2
3
|
import { Icon } from "../Icon/Icon2.js";
|
|
3
4
|
import './Alert.css';/* empty css */
|
|
@@ -22,9 +23,10 @@ var Alert = forwardRef(({ className, variant = "info", heading, description, dis
|
|
|
22
23
|
"aria-hidden": true
|
|
23
24
|
});
|
|
24
25
|
const body = children ?? description;
|
|
26
|
+
const { isExiting, startExit } = useExitAnimation({ onExited: onDismiss });
|
|
25
27
|
return /* @__PURE__ */ jsxs("div", {
|
|
26
28
|
ref,
|
|
27
|
-
className: cx("pf-alert", `pf-alert--${variant}`, className),
|
|
29
|
+
className: cx("pf-alert", `pf-alert--${variant}`, isExiting && "pf-alert--exiting", className),
|
|
28
30
|
role: variantRole[variant],
|
|
29
31
|
...props,
|
|
30
32
|
children: [
|
|
@@ -47,7 +49,7 @@ var Alert = forwardRef(({ className, variant = "info", heading, description, dis
|
|
|
47
49
|
type: "button",
|
|
48
50
|
className: "pf-alert__dismiss",
|
|
49
51
|
"aria-label": "Dismiss alert",
|
|
50
|
-
onClick:
|
|
52
|
+
onClick: startExit,
|
|
51
53
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
52
54
|
name: "circle-xmark",
|
|
53
55
|
"aria-hidden": true
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
top: var(--pf-avatar-status-offset);
|
|
76
76
|
height: var(--pf-avatar-status-size, 10px);
|
|
77
77
|
position: absolute;
|
|
78
|
-
|
|
78
|
+
inset-inline-end: var(--pf-avatar-status-offset);
|
|
79
79
|
width: var(--pf-avatar-status-size, 10px);
|
|
80
80
|
z-index: 1;
|
|
81
81
|
}
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.pf-badge-group--leading .pf-badge-group__text {
|
|
29
|
-
margin-
|
|
30
|
-
padding-
|
|
29
|
+
margin-inline-start: -1px;
|
|
30
|
+
padding-inline-start: calc(var(--space-2) + 2px);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.pf-badge-group--trailing .pf-badge-group__text {
|
|
34
|
-
margin-
|
|
35
|
-
padding-
|
|
34
|
+
margin-inline-end: -1px;
|
|
35
|
+
padding-inline-end: calc(var(--space-2) + 2px);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.pf-badge-group--leading .pf-badge-group__badge {
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
min-height: 40px;
|
|
13
13
|
text-decoration: none;
|
|
14
14
|
transition:
|
|
15
|
-
background-color
|
|
16
|
-
border-color
|
|
17
|
-
color
|
|
18
|
-
box-shadow
|
|
15
|
+
background-color var(--pf-transition-fast),
|
|
16
|
+
border-color var(--pf-transition-fast),
|
|
17
|
+
color var(--pf-transition-fast),
|
|
18
|
+
box-shadow var(--pf-transition-fast);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.pf-button:focus-visible {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
gap: var(--space-2);
|
|
15
15
|
justify-content: center;
|
|
16
16
|
line-height: 1;
|
|
17
|
-
margin-
|
|
17
|
+
margin-inline-start: -1px;
|
|
18
18
|
min-height: 40px;
|
|
19
19
|
padding: 0 var(--space-4);
|
|
20
20
|
position: relative;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
.pf-button-group__button:first-child {
|
|
29
29
|
border-bottom-left-radius: var(--radius-md);
|
|
30
30
|
border-top-left-radius: var(--radius-md);
|
|
31
|
-
margin-
|
|
31
|
+
margin-inline-start: 0;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.pf-button-group__button:last-child {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
.pf-carousel__track {
|
|
20
20
|
display: flex;
|
|
21
|
-
transition: transform var(--pf-carousel-transition-duration,
|
|
21
|
+
transition: transform var(--pf-carousel-transition-duration, var(--duration-moderate))
|
|
22
|
+
var(--easing-decelerate);
|
|
22
23
|
width: 100%;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -95,7 +96,8 @@
|
|
|
95
96
|
cursor: pointer;
|
|
96
97
|
height: var(--pf-carousel-indicator-size, 8px);
|
|
97
98
|
padding: 0;
|
|
98
|
-
transition: all var(--pf-carousel-indicator-transition-duration,
|
|
99
|
+
transition: all var(--pf-carousel-indicator-transition-duration, var(--duration-fast))
|
|
100
|
+
var(--easing-decelerate);
|
|
99
101
|
width: var(--pf-carousel-indicator-size, 8px);
|
|
100
102
|
}
|
|
101
103
|
|
|
@@ -45,88 +45,101 @@ var Carousel = forwardRef(function Carousel({ className, slides, initialIndex =
|
|
|
45
45
|
return /* @__PURE__ */ jsxs("div", {
|
|
46
46
|
ref,
|
|
47
47
|
className: cx("pf-carousel", className),
|
|
48
|
+
role: "region",
|
|
49
|
+
"aria-roledescription": "carousel",
|
|
48
50
|
"aria-label": ariaLabel,
|
|
49
51
|
...props,
|
|
50
|
-
children: [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
72
|
-
className: "pf-carousel__controls",
|
|
73
|
-
onKeyDown: (event) => {
|
|
74
|
-
if (event.key === "ArrowLeft") {
|
|
75
|
-
event.preventDefault();
|
|
76
|
-
goToIndex(resolvedActiveIndex - 1);
|
|
77
|
-
} else if (event.key === "ArrowRight") {
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
goToIndex(resolvedActiveIndex + 1);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
children: [
|
|
83
|
-
/* @__PURE__ */ jsx("button", {
|
|
84
|
-
type: "button",
|
|
85
|
-
className: "pf-carousel__nav",
|
|
86
|
-
"aria-label": "Previous slide",
|
|
87
|
-
disabled: isPrevDisabled || totalSlides < 2,
|
|
88
|
-
onClick: () => {
|
|
89
|
-
goToIndex(resolvedActiveIndex - 1);
|
|
90
|
-
},
|
|
91
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
92
|
-
name: "square-caret-left",
|
|
93
|
-
"aria-hidden": true
|
|
94
|
-
})
|
|
95
|
-
}),
|
|
96
|
-
showIndicators && totalSlides > 1 ? /* @__PURE__ */ jsx("div", {
|
|
97
|
-
className: "pf-carousel__indicators",
|
|
98
|
-
"aria-label": "Slide indicators",
|
|
99
|
-
children: slides.map((_, index) => {
|
|
100
|
-
const isActive = index === resolvedActiveIndex;
|
|
101
|
-
return /* @__PURE__ */ jsx("button", {
|
|
102
|
-
type: "button",
|
|
103
|
-
className: cx("pf-carousel__indicator", isActive && "pf-carousel__indicator--active"),
|
|
104
|
-
"aria-label": `Go to slide ${index + 1}`,
|
|
105
|
-
"aria-current": isActive ? "true" : void 0,
|
|
106
|
-
onClick: () => {
|
|
107
|
-
goToIndex(index);
|
|
108
|
-
}
|
|
109
|
-
}, `indicator-${index}`);
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: "pf-carousel__viewport",
|
|
55
|
+
children: totalSlides === 0 ? /* @__PURE__ */ jsx("div", {
|
|
56
|
+
className: "pf-carousel__empty",
|
|
57
|
+
role: "status",
|
|
58
|
+
children: "Add at least one slide."
|
|
59
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: "pf-carousel__track",
|
|
61
|
+
style: { transform: `translateX(-${resolvedActiveIndex * 100}%)` },
|
|
62
|
+
children: slides.map((slide, index) => {
|
|
63
|
+
const isInactive = index !== resolvedActiveIndex;
|
|
64
|
+
return /* @__PURE__ */ jsx("div", {
|
|
65
|
+
className: "pf-carousel__slide",
|
|
66
|
+
role: "group",
|
|
67
|
+
"aria-roledescription": "slide",
|
|
68
|
+
"aria-label": `Slide ${index + 1} of ${totalSlides}`,
|
|
69
|
+
"aria-hidden": isInactive,
|
|
70
|
+
...isInactive ? { inert: true } : {},
|
|
71
|
+
children: slide
|
|
72
|
+
}, `slide-${index}`);
|
|
110
73
|
})
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ jsx("div", {
|
|
77
|
+
className: "pf-sr-only",
|
|
78
|
+
"aria-live": "polite",
|
|
79
|
+
"aria-atomic": "true",
|
|
80
|
+
children: totalSlides > 0 ? slideLabel : ""
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsxs("div", {
|
|
83
|
+
className: "pf-carousel__controls",
|
|
84
|
+
onKeyDown: (event) => {
|
|
85
|
+
if (event.key === "ArrowLeft") {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
goToIndex(resolvedActiveIndex - 1);
|
|
88
|
+
} else if (event.key === "ArrowRight") {
|
|
89
|
+
event.preventDefault();
|
|
121
90
|
goToIndex(resolvedActiveIndex + 1);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsx("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
className: "pf-carousel__nav",
|
|
97
|
+
"aria-label": "Previous slide",
|
|
98
|
+
disabled: isPrevDisabled || totalSlides < 2,
|
|
99
|
+
onClick: () => {
|
|
100
|
+
goToIndex(resolvedActiveIndex - 1);
|
|
101
|
+
},
|
|
102
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
103
|
+
name: "square-caret-left",
|
|
104
|
+
"aria-hidden": true
|
|
105
|
+
})
|
|
106
|
+
}),
|
|
107
|
+
showIndicators && totalSlides > 1 ? /* @__PURE__ */ jsx("div", {
|
|
108
|
+
className: "pf-carousel__indicators",
|
|
109
|
+
role: "group",
|
|
110
|
+
"aria-label": "Slide indicators",
|
|
111
|
+
children: slides.map((_, index) => {
|
|
112
|
+
const isActive = index === resolvedActiveIndex;
|
|
113
|
+
return /* @__PURE__ */ jsx("button", {
|
|
114
|
+
type: "button",
|
|
115
|
+
className: cx("pf-carousel__indicator", isActive && "pf-carousel__indicator--active"),
|
|
116
|
+
"aria-label": `Go to slide ${index + 1}`,
|
|
117
|
+
"aria-current": isActive ? "true" : void 0,
|
|
118
|
+
onClick: () => {
|
|
119
|
+
goToIndex(index);
|
|
120
|
+
}
|
|
121
|
+
}, `indicator-${index}`);
|
|
122
|
+
})
|
|
123
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
124
|
+
className: "pf-carousel__indicator-spacer",
|
|
125
125
|
"aria-hidden": true
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ jsx("button", {
|
|
128
|
+
type: "button",
|
|
129
|
+
className: "pf-carousel__nav",
|
|
130
|
+
"aria-label": "Next slide",
|
|
131
|
+
disabled: isNextDisabled || totalSlides < 2,
|
|
132
|
+
onClick: () => {
|
|
133
|
+
goToIndex(resolvedActiveIndex + 1);
|
|
134
|
+
},
|
|
135
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
136
|
+
name: "square-caret-right",
|
|
137
|
+
"aria-hidden": true
|
|
138
|
+
})
|
|
126
139
|
})
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
140
|
+
]
|
|
141
|
+
})
|
|
142
|
+
]
|
|
130
143
|
});
|
|
131
144
|
});
|
|
132
145
|
Carousel.displayName = "Carousel";
|
|
@@ -132,8 +132,8 @@
|
|
|
132
132
|
.pf-code-snippet__line-number {
|
|
133
133
|
color: var(--pf-code-snippet-line-number, var(--color-gray-400));
|
|
134
134
|
min-width: 2.5ch;
|
|
135
|
-
padding-
|
|
136
|
-
text-align:
|
|
135
|
+
padding-inline-end: var(--space-3);
|
|
136
|
+
text-align: end;
|
|
137
137
|
user-select: none;
|
|
138
138
|
vertical-align: top;
|
|
139
139
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Keys, composeDescribedBy } from "../../a11y/index.js";
|
|
2
|
-
import { cx } from "../../utils/cx.js";
|
|
3
|
-
import { Icon } from "../Icon/Icon2.js";
|
|
4
|
-
import { FieldWrapper } from "../../utils/FieldWrapper.js";
|
|
5
2
|
import { useAnchoredPosition } from "../../hooks/useAnchoredPosition.js";
|
|
6
3
|
import { useDisclosure } from "../../hooks/useDisclosure.js";
|
|
7
4
|
import { useOutsideInteraction } from "../../hooks/useOutsideInteraction.js";
|
|
5
|
+
import { cx } from "../../utils/cx.js";
|
|
6
|
+
import { Icon } from "../Icon/Icon2.js";
|
|
7
|
+
import { FieldWrapper } from "../../utils/FieldWrapper.js";
|
|
8
8
|
import { Calendar } from "../Calendar/Calendar2.js";
|
|
9
9
|
import './DatePicker.css';/* empty css */
|
|
10
10
|
import { forwardRef, useId, useMemo, useRef, useState } from "react";
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
color: var(--pf-dropdown-text-muted);
|
|
42
42
|
display: inline-flex;
|
|
43
43
|
height: var(--pf-dropdown-icon-size);
|
|
44
|
-
transition: transform
|
|
44
|
+
transition: transform var(--pf-transition-fast);
|
|
45
45
|
width: var(--pf-dropdown-icon-size);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -65,6 +65,19 @@
|
|
|
65
65
|
padding: var(--space-1);
|
|
66
66
|
position: fixed;
|
|
67
67
|
z-index: 1000;
|
|
68
|
+
transform-origin: top center;
|
|
69
|
+
animation: pf-dropdown-menu-in var(--duration-fast) var(--easing-decelerate);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@keyframes pf-dropdown-menu-in {
|
|
73
|
+
from {
|
|
74
|
+
opacity: 0;
|
|
75
|
+
transform: translateY(-4px) scale(0.97);
|
|
76
|
+
}
|
|
77
|
+
to {
|
|
78
|
+
opacity: 1;
|
|
79
|
+
transform: translateY(0) scale(1);
|
|
80
|
+
}
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
.pf-dropdown__item {
|
|
@@ -79,7 +92,7 @@
|
|
|
79
92
|
justify-content: space-between;
|
|
80
93
|
min-height: 34px;
|
|
81
94
|
padding: 0 var(--space-2);
|
|
82
|
-
text-align:
|
|
95
|
+
text-align: start;
|
|
83
96
|
width: 100%;
|
|
84
97
|
}
|
|
85
98
|
|
|
@@ -129,4 +142,8 @@
|
|
|
129
142
|
.pf-dropdown__chevron {
|
|
130
143
|
transition: none;
|
|
131
144
|
}
|
|
145
|
+
|
|
146
|
+
.pf-dropdown__menu {
|
|
147
|
+
animation: none;
|
|
148
|
+
}
|
|
132
149
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Keys, isActivationKey } from "../../a11y/index.js";
|
|
2
|
-
import { cx } from "../../utils/cx.js";
|
|
3
|
-
import { Icon } from "../Icon/Icon2.js";
|
|
4
2
|
import { useAnchoredPosition } from "../../hooks/useAnchoredPosition.js";
|
|
5
3
|
import { useDisclosure } from "../../hooks/useDisclosure.js";
|
|
6
4
|
import { useListNavigation } from "../../hooks/useListNavigation.js";
|
|
7
5
|
import { useOutsideInteraction } from "../../hooks/useOutsideInteraction.js";
|
|
6
|
+
import { cx } from "../../utils/cx.js";
|
|
7
|
+
import { Icon } from "../Icon/Icon2.js";
|
|
8
8
|
import './Dropdown.css';/* empty css */
|
|
9
9
|
import { forwardRef, useEffect, useId, useRef } from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -85,7 +85,6 @@ var Dropdown = forwardRef(({ label = "Actions", items, align = "start", disabled
|
|
|
85
85
|
className: "pf-dropdown__trigger",
|
|
86
86
|
"aria-haspopup": "menu",
|
|
87
87
|
"aria-expanded": isOpen,
|
|
88
|
-
"aria-controls": isOpen ? menuId : void 0,
|
|
89
88
|
onClick: () => {
|
|
90
89
|
disclosure.toggle();
|
|
91
90
|
},
|
|
@@ -15,7 +15,24 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.pf-gauge__fill {
|
|
18
|
-
|
|
18
|
+
stroke-dashoffset: var(--pf-gauge-offset);
|
|
19
|
+
/* Animate the arc filling from empty to its value on mount, and smoothly
|
|
20
|
+
when the value changes afterward. */
|
|
21
|
+
animation: pf-gauge-fill var(--duration-slow) var(--easing-decelerate);
|
|
22
|
+
transition: stroke-dashoffset var(--pf-transition-medium);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@keyframes pf-gauge-fill {
|
|
26
|
+
from {
|
|
27
|
+
stroke-dashoffset: var(--pf-gauge-circumference);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media (prefers-reduced-motion: reduce) {
|
|
32
|
+
.pf-gauge__fill {
|
|
33
|
+
animation: none;
|
|
34
|
+
transition: none;
|
|
35
|
+
}
|
|
19
36
|
}
|
|
20
37
|
|
|
21
38
|
.pf-gauge__center {
|