@pitchfork-ui/react 0.9.0 → 0.11.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/Badge/Badge.css +4 -0
- package/dist/components/Button/Button.css +7 -0
- package/dist/components/Collapsible/Collapsible.css +86 -0
- package/dist/components/Collapsible/Collapsible2.js +65 -0
- package/dist/components/ContextMenu/ContextMenu.css +122 -0
- package/dist/components/ContextMenu/ContextMenu2.js +155 -0
- package/dist/components/Icon/Icon2.js +17 -0
- package/dist/components/InlineCTA/InlineCTA.css +4 -0
- package/dist/components/Modal/Modal.css +6 -1
- package/dist/components/Resizable/Resizable.css +79 -0
- package/dist/components/Resizable/Resizable2.js +101 -0
- package/dist/components/ScrollArea/ScrollArea.css +54 -0
- package/dist/components/ScrollArea/ScrollArea2.js +18 -0
- package/dist/components/Tag/Tag.css +4 -0
- package/dist/components/TagInput/TagInput.css +72 -0
- package/dist/components/TagInput/TagInput2.js +116 -0
- package/dist/components/TimePicker/TimePicker.css +179 -0
- package/dist/components/TimePicker/TimePicker2.js +239 -0
- package/dist/components/Timeline/Timeline.css +128 -0
- package/dist/components/Timeline/Timeline2.js +49 -0
- package/dist/components/Toolbar/Toolbar.css +37 -0
- package/dist/components/Toolbar/Toolbar2.js +71 -0
- package/dist/components/UtilityButton/UtilityButton.css +6 -6
- package/dist/components/VisuallyHidden/VisuallyHidden.css +26 -0
- package/dist/components/VisuallyHidden/VisuallyHidden2.js +21 -0
- package/dist/index.cjs +786 -7
- package/dist/index.js +10 -1
- package/dist/src/components/Badge/Badge.d.ts +1 -1
- package/dist/src/components/Button/Button.d.ts +1 -1
- package/dist/src/components/Collapsible/Collapsible.d.ts +11 -0
- package/dist/src/components/Collapsible/Collapsible.test.d.ts +1 -0
- package/dist/src/components/Collapsible/index.d.ts +1 -0
- package/dist/src/components/ContextMenu/ContextMenu.d.ts +20 -0
- package/dist/src/components/ContextMenu/ContextMenu.test.d.ts +1 -0
- package/dist/src/components/ContextMenu/index.d.ts +1 -0
- package/dist/src/components/InlineCTA/InlineCTA.d.ts +1 -1
- package/dist/src/components/Resizable/Resizable.d.ts +19 -0
- package/dist/src/components/Resizable/Resizable.test.d.ts +1 -0
- package/dist/src/components/Resizable/index.d.ts +1 -0
- package/dist/src/components/ScrollArea/ScrollArea.d.ts +12 -0
- package/dist/src/components/ScrollArea/ScrollArea.test.d.ts +1 -0
- package/dist/src/components/ScrollArea/index.d.ts +1 -0
- package/dist/src/components/Tag/Tag.d.ts +1 -1
- package/dist/src/components/TagInput/TagInput.d.ts +23 -0
- package/dist/src/components/TagInput/TagInput.test.d.ts +1 -0
- package/dist/src/components/TagInput/index.d.ts +1 -0
- package/dist/src/components/TimePicker/TimePicker.d.ts +18 -0
- package/dist/src/components/TimePicker/TimePicker.test.d.ts +1 -0
- package/dist/src/components/TimePicker/index.d.ts +1 -0
- package/dist/src/components/Timeline/Timeline.d.ts +16 -0
- package/dist/src/components/Timeline/Timeline.test.d.ts +1 -0
- package/dist/src/components/Timeline/index.d.ts +1 -0
- package/dist/src/components/Toolbar/Toolbar.d.ts +8 -0
- package/dist/src/components/Toolbar/Toolbar.test.d.ts +1 -0
- package/dist/src/components/Toolbar/index.d.ts +1 -0
- package/dist/src/components/UtilityButton/UtilityButton.d.ts +1 -1
- package/dist/src/components/VisuallyHidden/VisuallyHidden.d.ts +15 -0
- package/dist/src/components/VisuallyHidden/VisuallyHidden.test.d.ts +1 -0
- package/dist/src/components/VisuallyHidden/index.d.ts +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/styles/theme.css +89 -4
- package/dist/styles.css +903 -11
- package/package.json +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
.pf-timeline {
|
|
2
|
+
display: grid;
|
|
3
|
+
gap: 0;
|
|
4
|
+
list-style: none;
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.pf-timeline__item {
|
|
10
|
+
/* Shared line height for the title; markers center themselves on it. */
|
|
11
|
+
--pf-timeline-line: 1.375rem;
|
|
12
|
+
--pf-timeline-marker-size: 16px;
|
|
13
|
+
column-gap: var(--space-3);
|
|
14
|
+
display: grid;
|
|
15
|
+
grid-template-columns: auto 1fr;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* ── Rail (marker + connector) ────────────────────────────────────────────── */
|
|
19
|
+
|
|
20
|
+
.pf-timeline__rail {
|
|
21
|
+
align-items: center;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.pf-timeline__marker {
|
|
27
|
+
align-items: center;
|
|
28
|
+
background: var(--pf-timeline-marker-bg);
|
|
29
|
+
border: 2px solid var(--pf-timeline-marker-border);
|
|
30
|
+
border-radius: var(--radius-full);
|
|
31
|
+
color: var(--pf-timeline-marker-icon);
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
height: var(--pf-timeline-marker-size);
|
|
35
|
+
justify-content: center;
|
|
36
|
+
/* Vertically center the marker on the title's first line. */
|
|
37
|
+
margin-top: calc((var(--pf-timeline-line) - var(--pf-timeline-marker-size)) / 2);
|
|
38
|
+
width: var(--pf-timeline-marker-size);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Markers carrying an icon are larger to fit it. */
|
|
42
|
+
.pf-timeline__marker:has(.pf-timeline__marker-icon) {
|
|
43
|
+
--pf-timeline-marker-size: 28px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.pf-timeline__marker-icon {
|
|
47
|
+
align-items: center;
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
font-size: 0.8rem;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.pf-timeline__marker-icon svg {
|
|
54
|
+
display: block;
|
|
55
|
+
height: 14px;
|
|
56
|
+
width: 14px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.pf-timeline__marker--default {
|
|
60
|
+
background: var(--pf-timeline-default-bg);
|
|
61
|
+
border-color: var(--pf-timeline-default-border);
|
|
62
|
+
color: var(--pf-timeline-default-icon);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.pf-timeline__marker--success {
|
|
66
|
+
background: var(--pf-timeline-success-bg);
|
|
67
|
+
border-color: var(--pf-timeline-success-border);
|
|
68
|
+
color: var(--pf-timeline-success-icon);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.pf-timeline__marker--warning {
|
|
72
|
+
background: var(--pf-timeline-warning-bg);
|
|
73
|
+
border-color: var(--pf-timeline-warning-border);
|
|
74
|
+
color: var(--pf-timeline-warning-icon);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.pf-timeline__marker--danger {
|
|
78
|
+
background: var(--pf-timeline-danger-bg);
|
|
79
|
+
border-color: var(--pf-timeline-danger-border);
|
|
80
|
+
color: var(--pf-timeline-danger-icon);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.pf-timeline__connector {
|
|
84
|
+
background: var(--pf-timeline-connector);
|
|
85
|
+
flex: 1;
|
|
86
|
+
margin: var(--space-1) 0;
|
|
87
|
+
min-height: var(--space-4);
|
|
88
|
+
width: 2px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* ── Content ──────────────────────────────────────────────────────────────── */
|
|
92
|
+
|
|
93
|
+
.pf-timeline__content {
|
|
94
|
+
padding-bottom: var(--space-5);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.pf-timeline__item--last .pf-timeline__content {
|
|
98
|
+
padding-bottom: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.pf-timeline__header {
|
|
102
|
+
align-items: baseline;
|
|
103
|
+
column-gap: var(--space-2);
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-wrap: wrap;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.pf-timeline__title {
|
|
110
|
+
color: var(--pf-timeline-title);
|
|
111
|
+
font-size: var(--font-size-sm);
|
|
112
|
+
font-weight: var(--font-weight-medium);
|
|
113
|
+
line-height: var(--pf-timeline-line);
|
|
114
|
+
margin: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.pf-timeline__timestamp {
|
|
118
|
+
color: var(--pf-timeline-timestamp);
|
|
119
|
+
font-size: var(--font-size-xs);
|
|
120
|
+
flex-shrink: 0;
|
|
121
|
+
white-space: nowrap;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.pf-timeline__description {
|
|
125
|
+
color: var(--pf-timeline-description);
|
|
126
|
+
font-size: var(--font-size-sm);
|
|
127
|
+
margin-top: var(--space-1);
|
|
128
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import './Timeline.css';/* empty css */
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Timeline/Timeline.tsx
|
|
7
|
+
var Timeline = forwardRef(function Timeline({ className, items, ...props }, ref) {
|
|
8
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
9
|
+
ref,
|
|
10
|
+
className: cx("pf-timeline", className),
|
|
11
|
+
...props,
|
|
12
|
+
children: items.map((item, index) => {
|
|
13
|
+
const tone = item.tone ?? "default";
|
|
14
|
+
const isLast = index === items.length - 1;
|
|
15
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
16
|
+
className: cx("pf-timeline__item", isLast && "pf-timeline__item--last"),
|
|
17
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: "pf-timeline__rail",
|
|
19
|
+
"aria-hidden": true,
|
|
20
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: cx("pf-timeline__marker", `pf-timeline__marker--${tone}`),
|
|
22
|
+
children: item.icon ? /* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: "pf-timeline__marker-icon",
|
|
24
|
+
children: item.icon
|
|
25
|
+
}) : null
|
|
26
|
+
}), !isLast ? /* @__PURE__ */ jsx("span", { className: "pf-timeline__connector" }) : null]
|
|
27
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
className: "pf-timeline__content",
|
|
29
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: "pf-timeline__header",
|
|
31
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
32
|
+
className: "pf-timeline__title",
|
|
33
|
+
children: item.title
|
|
34
|
+
}), item.timestamp ? /* @__PURE__ */ jsx("span", {
|
|
35
|
+
className: "pf-timeline__timestamp",
|
|
36
|
+
children: item.timestamp
|
|
37
|
+
}) : null]
|
|
38
|
+
}), item.description ? /* @__PURE__ */ jsx("div", {
|
|
39
|
+
className: "pf-timeline__description",
|
|
40
|
+
children: item.description
|
|
41
|
+
}) : null]
|
|
42
|
+
})]
|
|
43
|
+
}, item.id ?? index);
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
Timeline.displayName = "Timeline";
|
|
48
|
+
//#endregion
|
|
49
|
+
export { Timeline };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.pf-toolbar {
|
|
2
|
+
align-items: center;
|
|
3
|
+
background: var(--pf-toolbar-bg);
|
|
4
|
+
border: 1px solid var(--pf-toolbar-border);
|
|
5
|
+
border-radius: var(--radius-md);
|
|
6
|
+
display: flex;
|
|
7
|
+
gap: var(--space-1);
|
|
8
|
+
padding: var(--space-1);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.pf-toolbar--horizontal {
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.pf-toolbar--vertical {
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
width: fit-content;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* ── Separator ────────────────────────────────────────────────────────────── */
|
|
22
|
+
|
|
23
|
+
.pf-toolbar__separator {
|
|
24
|
+
background: var(--pf-toolbar-separator);
|
|
25
|
+
flex-shrink: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pf-toolbar--horizontal .pf-toolbar__separator {
|
|
29
|
+
align-self: stretch;
|
|
30
|
+
margin: var(--space-1) var(--space-1);
|
|
31
|
+
width: 1px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.pf-toolbar--vertical .pf-toolbar__separator {
|
|
35
|
+
height: 1px;
|
|
36
|
+
margin: var(--space-1) var(--space-1);
|
|
37
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Keys } from "../../a11y/index.js";
|
|
3
|
+
import { useComposedRefs } from "../../hooks/useComposedRefs.js";
|
|
4
|
+
import { cx } from "../../utils/cx.js";
|
|
5
|
+
import './Toolbar.css';/* empty css */
|
|
6
|
+
import { forwardRef, useEffect, useRef } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/Toolbar/Toolbar.tsx
|
|
9
|
+
var ITEM_SELECTOR = "button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [data-toolbar-item]:not([aria-disabled=\"true\"])";
|
|
10
|
+
var Toolbar = forwardRef(function Toolbar({ className, orientation = "horizontal", onKeyDown, onFocus, children, ...props }, ref) {
|
|
11
|
+
const rootRef = useRef(null);
|
|
12
|
+
const refs = useComposedRefs(rootRef, ref);
|
|
13
|
+
const getItems = () => rootRef.current ? Array.from(rootRef.current.querySelectorAll(ITEM_SELECTOR)) : [];
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const items = getItems();
|
|
16
|
+
if (items.length === 0) return;
|
|
17
|
+
const current = items.find((el) => el.getAttribute("tabindex") === "0");
|
|
18
|
+
items.forEach((el, i) => {
|
|
19
|
+
el.tabIndex = (current ? el === current : i === 0) ? 0 : -1;
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
const handleFocus = (event) => {
|
|
23
|
+
const items = getItems();
|
|
24
|
+
const target = event.target;
|
|
25
|
+
if (items.includes(target)) items.forEach((el) => {
|
|
26
|
+
el.tabIndex = el === target ? 0 : -1;
|
|
27
|
+
});
|
|
28
|
+
onFocus?.(event);
|
|
29
|
+
};
|
|
30
|
+
const handleKeyDown = (event) => {
|
|
31
|
+
onKeyDown?.(event);
|
|
32
|
+
if (event.defaultPrevented) return;
|
|
33
|
+
const nextKey = orientation === "vertical" ? Keys.ArrowDown : Keys.ArrowRight;
|
|
34
|
+
const prevKey = orientation === "vertical" ? Keys.ArrowUp : Keys.ArrowLeft;
|
|
35
|
+
const items = getItems();
|
|
36
|
+
if (items.length === 0) return;
|
|
37
|
+
const currentIndex = items.indexOf(document.activeElement);
|
|
38
|
+
if (currentIndex === -1) return;
|
|
39
|
+
let nextIndex = -1;
|
|
40
|
+
if (event.key === nextKey) nextIndex = (currentIndex + 1) % items.length;
|
|
41
|
+
else if (event.key === prevKey) nextIndex = (currentIndex - 1 + items.length) % items.length;
|
|
42
|
+
else if (event.key === Keys.Home) nextIndex = 0;
|
|
43
|
+
else if (event.key === Keys.End) nextIndex = items.length - 1;
|
|
44
|
+
if (nextIndex >= 0) {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
items[nextIndex].focus();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ jsx("div", {
|
|
50
|
+
ref: refs,
|
|
51
|
+
role: "toolbar",
|
|
52
|
+
"aria-orientation": orientation,
|
|
53
|
+
className: cx("pf-toolbar", `pf-toolbar--${orientation}`, className),
|
|
54
|
+
onKeyDown: handleKeyDown,
|
|
55
|
+
onFocus: handleFocus,
|
|
56
|
+
...props,
|
|
57
|
+
children
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
Toolbar.displayName = "Toolbar";
|
|
61
|
+
var ToolbarSeparator = forwardRef(function ToolbarSeparator({ className, ...props }, ref) {
|
|
62
|
+
return /* @__PURE__ */ jsx("span", {
|
|
63
|
+
ref,
|
|
64
|
+
role: "separator",
|
|
65
|
+
className: cx("pf-toolbar__separator", className),
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
ToolbarSeparator.displayName = "ToolbarSeparator";
|
|
70
|
+
//#endregion
|
|
71
|
+
export { Toolbar, ToolbarSeparator };
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
background: var(--pf-utility-btn-brand-bg-hover);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
.pf-utility-button--
|
|
63
|
-
background: var(--pf-utility-btn-
|
|
64
|
-
border-color: var(--pf-utility-btn-
|
|
65
|
-
color: var(--pf-utility-btn-
|
|
62
|
+
.pf-utility-button--destructive {
|
|
63
|
+
background: var(--pf-utility-btn-destructive-bg);
|
|
64
|
+
border-color: var(--pf-utility-btn-destructive-border);
|
|
65
|
+
color: var(--pf-utility-btn-destructive-text);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
.pf-utility-button--
|
|
69
|
-
background: var(--pf-utility-btn-
|
|
68
|
+
.pf-utility-button--destructive:hover:not(:disabled) {
|
|
69
|
+
background: var(--pf-utility-btn-destructive-bg-hover);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
.pf-utility-button__icon {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.pf-visually-hidden {
|
|
2
|
+
border: 0;
|
|
3
|
+
clip: rect(0 0 0 0);
|
|
4
|
+
clip-path: inset(50%);
|
|
5
|
+
height: 1px;
|
|
6
|
+
margin: -1px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
padding: 0;
|
|
9
|
+
position: absolute;
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
width: 1px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* Reveal on keyboard focus (skip-link pattern). */
|
|
15
|
+
.pf-visually-hidden--focusable:focus,
|
|
16
|
+
.pf-visually-hidden--focusable:focus-within {
|
|
17
|
+
clip: auto;
|
|
18
|
+
clip-path: none;
|
|
19
|
+
height: auto;
|
|
20
|
+
margin: 0;
|
|
21
|
+
overflow: visible;
|
|
22
|
+
/* Flow back into layout so the revealed content doesn't overlap siblings. */
|
|
23
|
+
position: static;
|
|
24
|
+
white-space: normal;
|
|
25
|
+
width: auto;
|
|
26
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import './VisuallyHidden.css';/* empty css */
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/VisuallyHidden/VisuallyHidden.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Hides content visually while keeping it available to screen readers and other
|
|
9
|
+
* assistive technology. Use for labels, instructions, and status text that are
|
|
10
|
+
* implied visually but need to be announced.
|
|
11
|
+
*/
|
|
12
|
+
var VisuallyHidden = forwardRef(function VisuallyHidden({ as = "span", focusable = false, className, ...props }, ref) {
|
|
13
|
+
return /* @__PURE__ */ jsx(as, {
|
|
14
|
+
ref,
|
|
15
|
+
className: cx("pf-visually-hidden", focusable && "pf-visually-hidden--focusable", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
VisuallyHidden.displayName = "VisuallyHidden";
|
|
20
|
+
//#endregion
|
|
21
|
+
export { VisuallyHidden };
|