@pitchfork-ui/react 0.2.0 → 0.7.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 +104 -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/Pagination/Pagination.css +5 -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 +767 -66
- package/package.json +1 -1
- package/theme.starter.css +4 -3
|
@@ -24,3 +24,38 @@
|
|
|
24
24
|
position: fixed;
|
|
25
25
|
z-index: 1100;
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
/* Entrance animation — uses motion tokens via theme aliases */
|
|
29
|
+
@keyframes pf-tooltip-in {
|
|
30
|
+
from {
|
|
31
|
+
opacity: 0;
|
|
32
|
+
transform: translateY(2px);
|
|
33
|
+
}
|
|
34
|
+
to {
|
|
35
|
+
opacity: 1;
|
|
36
|
+
transform: translateY(0);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.pf-tooltip {
|
|
41
|
+
animation: pf-tooltip-in var(--pf-transition-fast);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Exit fade — plays while the tooltip is dismissed (presence handling) */
|
|
45
|
+
@keyframes pf-tooltip-out {
|
|
46
|
+
to {
|
|
47
|
+
opacity: 0;
|
|
48
|
+
transform: translateY(2px);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.pf-tooltip--exiting {
|
|
53
|
+
animation: pf-tooltip-out var(--duration-fast) var(--easing-accelerate) forwards;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (prefers-reduced-motion: reduce) {
|
|
57
|
+
.pf-tooltip,
|
|
58
|
+
.pf-tooltip--exiting {
|
|
59
|
+
animation: none;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { usePresence } from "../../hooks/usePresence.js";
|
|
1
2
|
import { cx } from "../../utils/cx.js";
|
|
2
3
|
import './Tooltip.css';/* empty css */
|
|
3
4
|
import { forwardRef, useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -87,6 +88,7 @@ var Tooltip = forwardRef(function Tooltip({ content, children, open, placement =
|
|
|
87
88
|
const [resolvedPlacement, setResolvedPlacement] = useState(placement);
|
|
88
89
|
const isControlled = open !== void 0;
|
|
89
90
|
const isVisible = !disabled && (isControlled ? open : isOpen);
|
|
91
|
+
const { isMounted, isExiting } = usePresence(Boolean(isVisible), 160);
|
|
90
92
|
const clearShowTimer = () => {
|
|
91
93
|
if (showTimerRef.current !== void 0) {
|
|
92
94
|
window.clearTimeout(showTimerRef.current);
|
|
@@ -105,8 +107,6 @@ var Tooltip = forwardRef(function Tooltip({ content, children, open, placement =
|
|
|
105
107
|
clearShowTimer();
|
|
106
108
|
if (isControlled) return;
|
|
107
109
|
setIsOpen(false);
|
|
108
|
-
setStyle({ visibility: "hidden" });
|
|
109
|
-
setResolvedPlacement(placement);
|
|
110
110
|
};
|
|
111
111
|
useEffect(() => {
|
|
112
112
|
return () => {
|
|
@@ -141,11 +141,11 @@ var Tooltip = forwardRef(function Tooltip({ content, children, open, placement =
|
|
|
141
141
|
},
|
|
142
142
|
"aria-describedby": isVisible ? tooltipId : void 0,
|
|
143
143
|
children: children ?? /* @__PURE__ */ jsx("span", {})
|
|
144
|
-
}),
|
|
144
|
+
}), isMounted && typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx("div", {
|
|
145
145
|
id: tooltipId,
|
|
146
146
|
ref: tooltipRef,
|
|
147
147
|
role: "tooltip",
|
|
148
|
-
className: cx("pf-tooltip", `pf-tooltip--${resolvedPlacement}`, className),
|
|
148
|
+
className: cx("pf-tooltip", `pf-tooltip--${resolvedPlacement}`, isExiting && "pf-tooltip--exiting", className),
|
|
149
149
|
style,
|
|
150
150
|
children: content
|
|
151
151
|
}), document.body) : null] });
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
display: grid;
|
|
21
21
|
grid-template-columns: auto 1fr;
|
|
22
22
|
min-width: 0;
|
|
23
|
-
padding-
|
|
23
|
+
padding-inline-start: calc(var(--pf-tree-level, 0) * var(--space-4));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.pf-tree-view__toggle-wrap {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
min-height: 34px;
|
|
70
70
|
min-width: 0;
|
|
71
71
|
padding: 0 var(--space-2);
|
|
72
|
-
text-align:
|
|
72
|
+
text-align: start;
|
|
73
73
|
width: 100%;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
//#region src/hooks/useExitAnimation.ts
|
|
3
|
+
var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
4
|
+
/**
|
|
5
|
+
* Plays an exit animation before signalling removal. Apply `isExiting` to a CSS
|
|
6
|
+
* class that runs the exit keyframes; `onExited` fires after `duration`. When the
|
|
7
|
+
* user prefers reduced motion, `onExited` fires immediately with no animation.
|
|
8
|
+
*/
|
|
9
|
+
function useExitAnimation({ onExited, duration = 220 } = {}) {
|
|
10
|
+
const [isExiting, setIsExiting] = useState(false);
|
|
11
|
+
const startExit = () => {
|
|
12
|
+
if (prefersReducedMotion()) {
|
|
13
|
+
onExited?.();
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
setIsExiting(true);
|
|
17
|
+
window.setTimeout(() => onExited?.(), duration);
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
isExiting,
|
|
21
|
+
startExit
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { useExitAnimation };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
//#region src/hooks/usePresence.ts
|
|
3
|
+
var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
4
|
+
/**
|
|
5
|
+
* Keeps a conditionally-rendered element mounted long enough to play an exit
|
|
6
|
+
* animation. Drive it with the `present` prop (e.g. a Modal's `open`): when it
|
|
7
|
+
* flips to false, the element stays mounted with `isExiting` true for `duration`
|
|
8
|
+
* ms, then unmounts. Reduced motion unmounts immediately.
|
|
9
|
+
*/
|
|
10
|
+
function usePresence(present, duration = 200) {
|
|
11
|
+
const [isExiting, setIsExiting] = useState(false);
|
|
12
|
+
const wasPresent = useRef(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (present) {
|
|
15
|
+
wasPresent.current = true;
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!wasPresent.current || prefersReducedMotion()) return;
|
|
19
|
+
wasPresent.current = false;
|
|
20
|
+
setIsExiting(true);
|
|
21
|
+
const timer = window.setTimeout(() => setIsExiting(false), duration);
|
|
22
|
+
return () => window.clearTimeout(timer);
|
|
23
|
+
}, [present, duration]);
|
|
24
|
+
const exiting = !present && isExiting;
|
|
25
|
+
return {
|
|
26
|
+
isMounted: present || exiting,
|
|
27
|
+
isExiting: exiting
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { usePresence };
|