@pitchfork-ui/react 0.8.0 → 0.10.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/LICENSE +21 -0
- package/dist/a11y/index.js +1 -0
- package/dist/components/Accordion/Accordion2.js +1 -0
- package/dist/components/Alert/Alert2.js +1 -0
- package/dist/components/Avatar/Avatar2.js +1 -0
- package/dist/components/AvatarGroup/AvatarGroup2.js +1 -0
- package/dist/components/Badge/Badge2.js +1 -0
- package/dist/components/BadgeGroup/BadgeGroup2.js +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs2.js +1 -0
- package/dist/components/Button/Button2.js +1 -0
- package/dist/components/ButtonGroup/ButtonGroup2.js +1 -0
- package/dist/components/Calendar/Calendar2.js +1 -0
- package/dist/components/Card/Card2.js +1 -0
- package/dist/components/Carousel/Carousel2.js +1 -0
- package/dist/components/Checkbox/Checkbox2.js +1 -0
- package/dist/components/CodeSnippet/CodeSnippet2.js +1 -0
- package/dist/components/Collapsible/Collapsible.css +86 -0
- package/dist/components/Collapsible/Collapsible2.js +65 -0
- package/dist/components/Combobox/Combobox2.js +1 -0
- package/dist/components/CommandPalette/CommandPalette2.js +1 -0
- package/dist/components/ContentDivider/ContentDivider2.js +1 -0
- package/dist/components/ContextMenu/ContextMenu.css +122 -0
- package/dist/components/ContextMenu/ContextMenu2.js +155 -0
- package/dist/components/CreditCard/CreditCard2.js +1 -0
- package/dist/components/DatePicker/DatePicker2.js +1 -0
- package/dist/components/DateRangePicker/DateRangePicker2.js +1 -0
- package/dist/components/Dropdown/Dropdown2.js +1 -0
- package/dist/components/EmptyState/EmptyState2.js +1 -0
- package/dist/components/FileUploader/FileUploader2.js +1 -0
- package/dist/components/GaugeChart/GaugeChart2.js +1 -0
- package/dist/components/HeaderNavigation/HeaderNavigation2.js +1 -0
- package/dist/components/Heatmap/Heatmap2.js +1 -0
- package/dist/components/Icon/Icon2.js +18 -0
- package/dist/components/InlineCTA/InlineCTA2.js +1 -0
- package/dist/components/Input/Input2.js +1 -0
- package/dist/components/Kbd/Kbd2.js +1 -0
- package/dist/components/LineBarCharts/LineBarChart2.js +1 -0
- package/dist/components/LoadingIndicators/LoadingIndicators2.js +1 -0
- package/dist/components/Metrics/Metrics2.js +1 -0
- package/dist/components/Modal/Modal.css +6 -3
- package/dist/components/Modal/Modal2.js +1 -0
- package/dist/components/MultiSelect/MultiSelect2.js +1 -0
- package/dist/components/Notification/Notification2.js +1 -0
- package/dist/components/NumberInput/NumberInput2.js +1 -0
- package/dist/components/PageHeader/PageHeader2.js +1 -0
- package/dist/components/Pagination/Pagination2.js +1 -0
- package/dist/components/PieChart/PieChart2.js +1 -0
- package/dist/components/Popover/Popover2.js +1 -0
- package/dist/components/ProgressIndicators/ProgressIndicators2.js +1 -0
- package/dist/components/ProgressSteps/ProgressSteps2.js +1 -0
- package/dist/components/RadarChart/RadarChart2.js +1 -0
- package/dist/components/RadioButton/RadioButton2.js +1 -0
- package/dist/components/RadioGroup/RadioGroup2.js +1 -0
- package/dist/components/Rating/Rating2.js +1 -0
- package/dist/components/Resizable/Resizable.css +79 -0
- package/dist/components/Resizable/Resizable2.js +101 -0
- package/dist/components/RichTextEditor/RichTextEditor2.js +1 -0
- package/dist/components/ScrollArea/ScrollArea.css +54 -0
- package/dist/components/ScrollArea/ScrollArea2.js +18 -0
- package/dist/components/SectionFooter/SectionFooter2.js +1 -0
- package/dist/components/SectionHeader/SectionHeader2.js +1 -0
- package/dist/components/Select/Select2.js +1 -0
- package/dist/components/SidebarNavigation/SidebarNavigation2.js +1 -0
- package/dist/components/SlideoutMenu/SlideoutMenu2.js +1 -0
- package/dist/components/Slider/Slider2.js +1 -0
- package/dist/components/Sparkline/Sparkline2.js +1 -0
- package/dist/components/Switch/Switch2.js +1 -0
- package/dist/components/Table/Table2.js +1 -0
- package/dist/components/Tabs/Tabs2.js +1 -0
- package/dist/components/Tag/Tag2.js +1 -0
- package/dist/components/TagInput/TagInput.css +72 -0
- package/dist/components/TagInput/TagInput2.js +116 -0
- package/dist/components/Textarea/Textarea2.js +1 -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/Toast/Toast.js +1 -0
- package/dist/components/Toolbar/Toolbar.css +37 -0
- package/dist/components/Toolbar/Toolbar2.js +71 -0
- package/dist/components/Tooltip/Tooltip2.js +1 -0
- package/dist/components/TreeView/TreeView2.js +1 -0
- package/dist/components/UtilityButton/UtilityButton2.js +1 -0
- package/dist/components/VideoPlayer/VideoPlayer2.js +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.css +26 -0
- package/dist/components/VisuallyHidden/VisuallyHidden2.js +21 -0
- package/dist/hooks/useAnchoredPosition.js +1 -0
- package/dist/hooks/useComposedRefs.js +1 -0
- package/dist/hooks/useControllableState.js +1 -0
- package/dist/hooks/useDisclosure.js +1 -0
- package/dist/hooks/useExitAnimation.js +1 -0
- package/dist/hooks/useFocusTrap.js +1 -0
- package/dist/hooks/useListNavigation.js +1 -0
- package/dist/hooks/useOutsideInteraction.js +1 -0
- package/dist/hooks/usePresence.js +1 -0
- package/dist/index.cjs +787 -7
- package/dist/index.js +11 -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/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/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/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 +77 -0
- package/dist/styles.css +866 -3
- package/dist/utils/FieldWrapper.js +1 -0
- package/dist/utils/cx.js +1 -0
- package/package.json +29 -3
|
@@ -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 };
|
|
@@ -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 };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { useEffect, useState } from "react";
|
|
2
3
|
//#region src/hooks/useAnchoredPosition.ts
|
|
3
4
|
function useAnchoredPosition({ anchorRef, floatingRef, enabled = true, align = "start", offset = 8, viewportPadding = 8, minWidth, matchAnchorWidth = true, flip = false }) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { useEffect, useRef, useState } from "react";
|
|
2
3
|
//#region src/hooks/usePresence.ts
|
|
3
4
|
var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|