@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.
Files changed (130) hide show
  1. package/LICENSE +21 -0
  2. package/dist/a11y/index.js +1 -0
  3. package/dist/components/Accordion/Accordion2.js +1 -0
  4. package/dist/components/Alert/Alert2.js +1 -0
  5. package/dist/components/Avatar/Avatar2.js +1 -0
  6. package/dist/components/AvatarGroup/AvatarGroup2.js +1 -0
  7. package/dist/components/Badge/Badge2.js +1 -0
  8. package/dist/components/BadgeGroup/BadgeGroup2.js +1 -0
  9. package/dist/components/Breadcrumbs/Breadcrumbs2.js +1 -0
  10. package/dist/components/Button/Button2.js +1 -0
  11. package/dist/components/ButtonGroup/ButtonGroup2.js +1 -0
  12. package/dist/components/Calendar/Calendar2.js +1 -0
  13. package/dist/components/Card/Card2.js +1 -0
  14. package/dist/components/Carousel/Carousel2.js +1 -0
  15. package/dist/components/Checkbox/Checkbox2.js +1 -0
  16. package/dist/components/CodeSnippet/CodeSnippet2.js +1 -0
  17. package/dist/components/Collapsible/Collapsible.css +86 -0
  18. package/dist/components/Collapsible/Collapsible2.js +65 -0
  19. package/dist/components/Combobox/Combobox2.js +1 -0
  20. package/dist/components/CommandPalette/CommandPalette2.js +1 -0
  21. package/dist/components/ContentDivider/ContentDivider2.js +1 -0
  22. package/dist/components/ContextMenu/ContextMenu.css +122 -0
  23. package/dist/components/ContextMenu/ContextMenu2.js +155 -0
  24. package/dist/components/CreditCard/CreditCard2.js +1 -0
  25. package/dist/components/DatePicker/DatePicker2.js +1 -0
  26. package/dist/components/DateRangePicker/DateRangePicker2.js +1 -0
  27. package/dist/components/Dropdown/Dropdown2.js +1 -0
  28. package/dist/components/EmptyState/EmptyState2.js +1 -0
  29. package/dist/components/FileUploader/FileUploader2.js +1 -0
  30. package/dist/components/GaugeChart/GaugeChart2.js +1 -0
  31. package/dist/components/HeaderNavigation/HeaderNavigation2.js +1 -0
  32. package/dist/components/Heatmap/Heatmap2.js +1 -0
  33. package/dist/components/Icon/Icon2.js +18 -0
  34. package/dist/components/InlineCTA/InlineCTA2.js +1 -0
  35. package/dist/components/Input/Input2.js +1 -0
  36. package/dist/components/Kbd/Kbd2.js +1 -0
  37. package/dist/components/LineBarCharts/LineBarChart2.js +1 -0
  38. package/dist/components/LoadingIndicators/LoadingIndicators2.js +1 -0
  39. package/dist/components/Metrics/Metrics2.js +1 -0
  40. package/dist/components/Modal/Modal.css +6 -3
  41. package/dist/components/Modal/Modal2.js +1 -0
  42. package/dist/components/MultiSelect/MultiSelect2.js +1 -0
  43. package/dist/components/Notification/Notification2.js +1 -0
  44. package/dist/components/NumberInput/NumberInput2.js +1 -0
  45. package/dist/components/PageHeader/PageHeader2.js +1 -0
  46. package/dist/components/Pagination/Pagination2.js +1 -0
  47. package/dist/components/PieChart/PieChart2.js +1 -0
  48. package/dist/components/Popover/Popover2.js +1 -0
  49. package/dist/components/ProgressIndicators/ProgressIndicators2.js +1 -0
  50. package/dist/components/ProgressSteps/ProgressSteps2.js +1 -0
  51. package/dist/components/RadarChart/RadarChart2.js +1 -0
  52. package/dist/components/RadioButton/RadioButton2.js +1 -0
  53. package/dist/components/RadioGroup/RadioGroup2.js +1 -0
  54. package/dist/components/Rating/Rating2.js +1 -0
  55. package/dist/components/Resizable/Resizable.css +79 -0
  56. package/dist/components/Resizable/Resizable2.js +101 -0
  57. package/dist/components/RichTextEditor/RichTextEditor2.js +1 -0
  58. package/dist/components/ScrollArea/ScrollArea.css +54 -0
  59. package/dist/components/ScrollArea/ScrollArea2.js +18 -0
  60. package/dist/components/SectionFooter/SectionFooter2.js +1 -0
  61. package/dist/components/SectionHeader/SectionHeader2.js +1 -0
  62. package/dist/components/Select/Select2.js +1 -0
  63. package/dist/components/SidebarNavigation/SidebarNavigation2.js +1 -0
  64. package/dist/components/SlideoutMenu/SlideoutMenu2.js +1 -0
  65. package/dist/components/Slider/Slider2.js +1 -0
  66. package/dist/components/Sparkline/Sparkline2.js +1 -0
  67. package/dist/components/Switch/Switch2.js +1 -0
  68. package/dist/components/Table/Table2.js +1 -0
  69. package/dist/components/Tabs/Tabs2.js +1 -0
  70. package/dist/components/Tag/Tag2.js +1 -0
  71. package/dist/components/TagInput/TagInput.css +72 -0
  72. package/dist/components/TagInput/TagInput2.js +116 -0
  73. package/dist/components/Textarea/Textarea2.js +1 -0
  74. package/dist/components/TimePicker/TimePicker.css +179 -0
  75. package/dist/components/TimePicker/TimePicker2.js +239 -0
  76. package/dist/components/Timeline/Timeline.css +128 -0
  77. package/dist/components/Timeline/Timeline2.js +49 -0
  78. package/dist/components/Toast/Toast.js +1 -0
  79. package/dist/components/Toolbar/Toolbar.css +37 -0
  80. package/dist/components/Toolbar/Toolbar2.js +71 -0
  81. package/dist/components/Tooltip/Tooltip2.js +1 -0
  82. package/dist/components/TreeView/TreeView2.js +1 -0
  83. package/dist/components/UtilityButton/UtilityButton2.js +1 -0
  84. package/dist/components/VideoPlayer/VideoPlayer2.js +1 -0
  85. package/dist/components/VisuallyHidden/VisuallyHidden.css +26 -0
  86. package/dist/components/VisuallyHidden/VisuallyHidden2.js +21 -0
  87. package/dist/hooks/useAnchoredPosition.js +1 -0
  88. package/dist/hooks/useComposedRefs.js +1 -0
  89. package/dist/hooks/useControllableState.js +1 -0
  90. package/dist/hooks/useDisclosure.js +1 -0
  91. package/dist/hooks/useExitAnimation.js +1 -0
  92. package/dist/hooks/useFocusTrap.js +1 -0
  93. package/dist/hooks/useListNavigation.js +1 -0
  94. package/dist/hooks/useOutsideInteraction.js +1 -0
  95. package/dist/hooks/usePresence.js +1 -0
  96. package/dist/index.cjs +787 -7
  97. package/dist/index.js +11 -1
  98. package/dist/src/components/Collapsible/Collapsible.d.ts +11 -0
  99. package/dist/src/components/Collapsible/Collapsible.test.d.ts +1 -0
  100. package/dist/src/components/Collapsible/index.d.ts +1 -0
  101. package/dist/src/components/ContextMenu/ContextMenu.d.ts +20 -0
  102. package/dist/src/components/ContextMenu/ContextMenu.test.d.ts +1 -0
  103. package/dist/src/components/ContextMenu/index.d.ts +1 -0
  104. package/dist/src/components/Resizable/Resizable.d.ts +19 -0
  105. package/dist/src/components/Resizable/Resizable.test.d.ts +1 -0
  106. package/dist/src/components/Resizable/index.d.ts +1 -0
  107. package/dist/src/components/ScrollArea/ScrollArea.d.ts +12 -0
  108. package/dist/src/components/ScrollArea/ScrollArea.test.d.ts +1 -0
  109. package/dist/src/components/ScrollArea/index.d.ts +1 -0
  110. package/dist/src/components/TagInput/TagInput.d.ts +23 -0
  111. package/dist/src/components/TagInput/TagInput.test.d.ts +1 -0
  112. package/dist/src/components/TagInput/index.d.ts +1 -0
  113. package/dist/src/components/TimePicker/TimePicker.d.ts +18 -0
  114. package/dist/src/components/TimePicker/TimePicker.test.d.ts +1 -0
  115. package/dist/src/components/TimePicker/index.d.ts +1 -0
  116. package/dist/src/components/Timeline/Timeline.d.ts +16 -0
  117. package/dist/src/components/Timeline/Timeline.test.d.ts +1 -0
  118. package/dist/src/components/Timeline/index.d.ts +1 -0
  119. package/dist/src/components/Toolbar/Toolbar.d.ts +8 -0
  120. package/dist/src/components/Toolbar/Toolbar.test.d.ts +1 -0
  121. package/dist/src/components/Toolbar/index.d.ts +1 -0
  122. package/dist/src/components/VisuallyHidden/VisuallyHidden.d.ts +15 -0
  123. package/dist/src/components/VisuallyHidden/VisuallyHidden.test.d.ts +1 -0
  124. package/dist/src/components/VisuallyHidden/index.d.ts +1 -0
  125. package/dist/src/index.d.ts +9 -0
  126. package/dist/styles/theme.css +77 -0
  127. package/dist/styles.css +866 -3
  128. package/dist/utils/FieldWrapper.js +1 -0
  129. package/dist/utils/cx.js +1 -0
  130. 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 };
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { usePresence } from "../../hooks/usePresence.js";
2
3
  import { cx } from "../../utils/cx.js";
3
4
  import './Tooltip.css';/* empty css */
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './TreeView.css';/* empty css */
3
4
  import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './UtilityButton.css';/* empty css */
3
4
  import { forwardRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { cx } from "../../utils/cx.js";
2
3
  import './VideoPlayer.css';/* empty css */
3
4
  import { forwardRef, useId } from "react";
@@ -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
  //#region src/hooks/useComposedRefs.ts
2
3
  function useComposedRefs(...refs) {
3
4
  return (node) => {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useCallback, useState } from "react";
2
3
  //#region src/hooks/useControllableState.ts
3
4
  function useControllableState({ value, defaultValue, onChange }) {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useControllableState } from "./useControllableState.js";
2
3
  import { useCallback } from "react";
3
4
  //#region src/hooks/useDisclosure.ts
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useState } from "react";
2
3
  //#region src/hooks/useExitAnimation.ts
3
4
  var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Keys, getFocusableElements } from "../a11y/index.js";
2
3
  import { useEffect } from "react";
3
4
  //#region src/hooks/useFocusTrap.ts
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useCallback, useMemo, useState } from "react";
2
3
  //#region src/hooks/useListNavigation.ts
3
4
  function useListNavigation({ items, isDisabled = () => false, initialIndex }) {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useEffect } from "react";
2
3
  //#region src/hooks/useOutsideInteraction.ts
3
4
  function useOutsideInteraction({ refs, enabled = true, onInteractOutside, eventName = "pointerdown" }) {
@@ -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;