@pitchfork-ui/react 0.1.9 → 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/README.md +20 -5
- package/dist/components/Accordion/Accordion.css +85 -0
- package/dist/components/Accordion/Accordion2.js +96 -0
- package/dist/components/Alert/Alert.css +111 -0
- package/dist/{index8.js → components/Alert/Alert2.js} +7 -5
- package/dist/components/Avatar/Avatar.css +97 -0
- package/dist/{index10.js → components/Avatar/Avatar2.js} +2 -2
- package/dist/components/Badge/Badge.css +26 -0
- package/dist/{index23.js → components/Badge/Badge2.js} +2 -2
- package/dist/components/BadgeGroup/BadgeGroup.css +115 -0
- package/dist/{index14.js → components/BadgeGroup/BadgeGroup2.js} +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.css +45 -0
- package/dist/{index18.js → components/Breadcrumbs/Breadcrumbs2.js} +2 -2
- package/dist/components/Button/Button.css +93 -0
- package/dist/{index12.js → components/Button/Button2.js} +2 -2
- package/dist/components/ButtonGroup/ButtonGroup.css +107 -0
- package/dist/{index16.js → components/ButtonGroup/ButtonGroup2.js} +2 -2
- package/dist/components/Calendar/Calendar.css +144 -0
- package/dist/{index40.js → components/Calendar/Calendar2.js} +4 -4
- package/dist/components/Card/Card.css +23 -0
- package/dist/{index25.js → components/Card/Card2.js} +2 -2
- package/dist/components/Carousel/Carousel.css +124 -0
- package/dist/components/Carousel/Carousel2.js +147 -0
- package/dist/components/Checkbox/Checkbox.css +62 -0
- package/dist/{index29.js → components/Checkbox/Checkbox2.js} +2 -2
- package/dist/components/CodeSnippet/CodeSnippet.css +155 -0
- package/dist/{index46.js → components/CodeSnippet/CodeSnippet2.js} +6 -6
- package/dist/components/ContentDivider/ContentDivider.css +38 -0
- package/dist/{index48.js → components/ContentDivider/ContentDivider2.js} +2 -2
- package/dist/components/CreditCard/CreditCard.css +139 -0
- package/dist/{index27.js → components/CreditCard/CreditCard2.js} +2 -2
- package/dist/components/DatePicker/DatePicker.css +91 -0
- package/dist/{index50.js → components/DatePicker/DatePicker2.js} +9 -9
- package/dist/components/Dropdown/Dropdown.css +149 -0
- package/dist/{index38.js → components/Dropdown/Dropdown2.js} +8 -9
- package/dist/components/EmptyState/EmptyState.css +72 -0
- package/dist/{index52.js → components/EmptyState/EmptyState2.js} +3 -3
- package/dist/components/FileUploader/FileUploader.css +135 -0
- package/dist/{index54.js → components/FileUploader/FileUploader2.js} +4 -4
- package/dist/components/GaugeChart/GaugeChart.css +63 -0
- package/dist/components/GaugeChart/GaugeChart2.js +74 -0
- package/dist/components/HeaderNavigation/HeaderNavigation.css +87 -0
- package/dist/{index56.js → components/HeaderNavigation/HeaderNavigation2.js} +2 -2
- package/dist/components/Heatmap/Heatmap.css +100 -0
- package/dist/components/Heatmap/Heatmap2.js +160 -0
- package/dist/components/Icon/Icon.css +6 -0
- package/dist/{index6.js → components/Icon/Icon2.js} +2 -2
- package/dist/components/InlineCTA/InlineCTA.css +144 -0
- package/dist/{index58.js → components/InlineCTA/InlineCTA2.js} +17 -5
- package/dist/components/Input/Input.css +75 -0
- package/dist/{index21.js → components/Input/Input2.js} +3 -3
- package/dist/components/LineBarCharts/LineBarChart.css +122 -0
- package/dist/{index60.js → components/LineBarCharts/LineBarChart2.js} +11 -3
- package/dist/components/LoadingIndicators/LoadingIndicators.css +107 -0
- package/dist/{index62.js → components/LoadingIndicators/LoadingIndicators2.js} +2 -2
- package/dist/components/Metrics/Metrics.css +106 -0
- package/dist/{index64.js → components/Metrics/Metrics2.js} +3 -3
- package/dist/components/Modal/Modal.css +198 -0
- package/dist/{index66.js → components/Modal/Modal2.js} +11 -9
- package/dist/components/MultiSelect/MultiSelect.css +174 -0
- package/dist/{index68.js → components/MultiSelect/MultiSelect2.js} +11 -12
- package/dist/components/Notification/Notification.css +242 -0
- package/dist/{index70.js → components/Notification/Notification2.js} +7 -5
- package/dist/components/PageHeader/PageHeader.css +85 -0
- package/dist/{index72.js → components/PageHeader/PageHeader2.js} +3 -3
- package/dist/components/Pagination/Pagination.css +101 -0
- package/dist/{index74.js → components/Pagination/Pagination2.js} +2 -2
- package/dist/components/PieChart/PieChart.css +115 -0
- package/dist/{index76.js → components/PieChart/PieChart2.js} +3 -3
- package/dist/components/ProgressIndicators/ProgressIndicators.css +95 -0
- package/dist/{index78.js → components/ProgressIndicators/ProgressIndicators2.js} +6 -3
- package/dist/components/ProgressSteps/ProgressSteps.css +175 -0
- package/dist/{index80.js → components/ProgressSteps/ProgressSteps2.js} +2 -2
- package/dist/components/RadarChart/RadarChart.css +119 -0
- package/dist/{index82.js → components/RadarChart/RadarChart2.js} +21 -15
- package/dist/components/RadioButton/RadioButton.css +21 -0
- package/dist/{index84.js → components/RadioButton/RadioButton2.js} +2 -2
- package/dist/components/RadioGroup/RadioGroup.css +64 -0
- package/dist/{index86.js → components/RadioGroup/RadioGroup2.js} +2 -2
- package/dist/components/Rating/Rating.css +91 -0
- package/dist/{index88.js → components/Rating/Rating2.js} +3 -3
- package/dist/components/RichTextEditor/RichTextEditor.css +94 -0
- package/dist/{index90.js → components/RichTextEditor/RichTextEditor2.js} +4 -4
- package/dist/components/SectionFooter/SectionFooter.css +59 -0
- package/dist/{index92.js → components/SectionFooter/SectionFooter2.js} +2 -2
- package/dist/components/SectionHeader/SectionHeader.css +78 -0
- package/dist/{index94.js → components/SectionHeader/SectionHeader2.js} +2 -2
- package/dist/components/Select/Select.css +156 -0
- package/dist/{index102.js → components/Select/Select2.js} +11 -12
- package/dist/components/SidebarNavigation/SidebarNavigation.css +116 -0
- package/dist/{index96.js → components/SidebarNavigation/SidebarNavigation2.js} +2 -2
- package/dist/components/SlideoutMenu/SlideoutMenu.css +161 -0
- package/dist/{index98.js → components/SlideoutMenu/SlideoutMenu2.js} +3 -3
- package/dist/components/Slider/Slider.css +106 -0
- package/dist/{index104.js → components/Slider/Slider2.js} +2 -2
- package/dist/components/Sparkline/Sparkline.css +65 -0
- package/dist/components/Sparkline/Sparkline2.js +100 -0
- package/dist/components/Switch/Switch.css +59 -0
- package/dist/{index100.js → components/Switch/Switch2.js} +2 -2
- package/dist/components/Table/Table.css +126 -0
- package/dist/{index108.js → components/Table/Table2.js} +2 -2
- package/dist/components/Tabs/Tabs.css +138 -0
- package/dist/{index110.js → components/Tabs/Tabs2.js} +53 -6
- package/dist/components/Tag/Tag.css +64 -0
- package/dist/{index106.js → components/Tag/Tag2.js} +3 -3
- package/dist/components/Textarea/Textarea.css +52 -0
- package/dist/{index112.js → components/Textarea/Textarea2.js} +3 -3
- package/dist/components/Tooltip/Tooltip.css +61 -0
- package/dist/{index114.js → components/Tooltip/Tooltip2.js} +6 -6
- package/dist/components/TreeView/TreeView.css +109 -0
- package/dist/{index116.js → components/TreeView/TreeView2.js} +2 -2
- package/dist/components/UtilityButton/UtilityButton.css +90 -0
- package/dist/{index118.js → components/UtilityButton/UtilityButton2.js} +2 -2
- package/dist/components/VideoPlayer/VideoPlayer.css +41 -0
- package/dist/{index120.js → components/VideoPlayer/VideoPlayer2.js} +2 -2
- package/dist/{index33.js → hooks/useDisclosure.js} +1 -1
- package/dist/hooks/useExitAnimation.js +25 -0
- package/dist/{index34.js → hooks/useFocusTrap.js} +1 -1
- package/dist/hooks/usePresence.js +31 -0
- package/dist/index.cjs +1030 -4720
- package/dist/index.js +69 -63
- 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/GaugeChart/GaugeChart.d.ts +17 -0
- package/dist/src/components/GaugeChart/GaugeChart.test.d.ts +1 -0
- package/dist/src/components/GaugeChart/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/LineBarCharts/LineBarChart.d.ts +2 -0
- package/dist/src/components/Sparkline/Sparkline.d.ts +17 -0
- package/dist/src/components/Sparkline/Sparkline.test.d.ts +1 -0
- package/dist/src/components/Sparkline/index.d.ts +1 -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 +4 -0
- package/dist/styles/theme.css +813 -0
- package/dist/styles.css +881 -68
- package/dist/{index19.js → utils/FieldWrapper.js} +1 -1
- package/package.json +8 -4
- package/theme.starter.css +58 -0
- package/dist/index42.js +0 -134
- package/dist/index43.js +0 -16
- package/dist/index44.js +0 -4232
- /package/dist/{index3.js → a11y/index.js} +0 -0
- /package/dist/{index30.js → hooks/useAnchoredPosition.js} +0 -0
- /package/dist/{index31.js → hooks/useComposedRefs.js} +0 -0
- /package/dist/{index32.js → hooks/useControllableState.js} +0 -0
- /package/dist/{index35.js → hooks/useListNavigation.js} +0 -0
- /package/dist/{index36.js → hooks/useOutsideInteraction.js} +0 -0
- /package/dist/{index4.js → utils/cx.js} +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
.pf-field {
|
|
2
|
+
display: grid;
|
|
3
|
+
gap: var(--space-2);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.pf-field__label {
|
|
7
|
+
color: var(--pf-slider-text);
|
|
8
|
+
font-size: var(--font-size-sm);
|
|
9
|
+
font-weight: var(--font-weight-medium);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.pf-field__description {
|
|
13
|
+
color: var(--pf-slider-text-muted);
|
|
14
|
+
font-size: var(--font-size-sm);
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.pf-field__error {
|
|
19
|
+
color: var(--pf-slider-error-text);
|
|
20
|
+
font-size: var(--font-size-sm);
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.pf-slider__header {
|
|
25
|
+
align-items: center;
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.pf-slider__value {
|
|
31
|
+
color: var(--pf-slider-text-muted);
|
|
32
|
+
font-size: var(--font-size-sm);
|
|
33
|
+
font-weight: var(--font-weight-medium);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.pf-slider {
|
|
37
|
+
appearance: none;
|
|
38
|
+
background: linear-gradient(
|
|
39
|
+
to right,
|
|
40
|
+
var(--pf-slider-action) 0,
|
|
41
|
+
var(--pf-slider-action) var(--pf-slider-progress, 0%),
|
|
42
|
+
var(--pf-slider-border) var(--pf-slider-progress, 0%),
|
|
43
|
+
var(--pf-slider-border) 100%
|
|
44
|
+
);
|
|
45
|
+
border-radius: var(--radius-full);
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
height: var(--pf-slider-track-height);
|
|
48
|
+
width: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.pf-slider:focus {
|
|
52
|
+
outline: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pf-slider:focus-visible {
|
|
56
|
+
box-shadow: var(--pf-slider-focus-ring, var(--pf-focus-ring));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.pf-slider::-webkit-slider-thumb {
|
|
60
|
+
appearance: none;
|
|
61
|
+
background: var(--pf-slider-bg);
|
|
62
|
+
border: 2px solid var(--pf-slider-action);
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
box-shadow: var(--pf-slider-control-thumb-outline-shadow, var(--pf-control-thumb-outline-shadow));
|
|
65
|
+
height: var(--pf-slider-thumb-size);
|
|
66
|
+
margin-top: calc((var(--pf-slider-track-height) - var(--pf-slider-thumb-size)) / 2);
|
|
67
|
+
width: var(--pf-slider-thumb-size);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.pf-slider::-moz-range-thumb {
|
|
71
|
+
background: var(--pf-slider-bg);
|
|
72
|
+
border: 2px solid var(--pf-slider-action);
|
|
73
|
+
border-radius: 50%;
|
|
74
|
+
box-shadow: var(--pf-slider-control-thumb-outline-shadow, var(--pf-control-thumb-outline-shadow));
|
|
75
|
+
height: var(--pf-slider-thumb-size);
|
|
76
|
+
width: var(--pf-slider-thumb-size);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.pf-slider::-moz-range-track {
|
|
80
|
+
background: transparent;
|
|
81
|
+
border-radius: var(--radius-full);
|
|
82
|
+
height: var(--pf-slider-track-height);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.pf-slider:disabled {
|
|
86
|
+
cursor: not-allowed;
|
|
87
|
+
opacity: 0.55;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.pf-slider--invalid {
|
|
91
|
+
background: linear-gradient(
|
|
92
|
+
to right,
|
|
93
|
+
var(--pf-slider-danger-fill) 0,
|
|
94
|
+
var(--pf-slider-danger-fill) var(--pf-slider-progress, 0%),
|
|
95
|
+
var(--pf-slider-border) var(--pf-slider-progress, 0%),
|
|
96
|
+
var(--pf-slider-border) 100%
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.pf-slider--invalid::-webkit-slider-thumb {
|
|
101
|
+
border-color: var(--pf-slider-danger-fill);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.pf-slider--invalid::-moz-range-thumb {
|
|
105
|
+
border-color: var(--pf-slider-danger-fill);
|
|
106
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cx } from "
|
|
2
|
-
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './Slider.css';/* empty css */
|
|
3
3
|
import { forwardRef, useId, useMemo, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/Slider/Slider.tsx
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.pf-sparkline {
|
|
2
|
+
display: block;
|
|
3
|
+
overflow: visible;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.pf-sparkline__line {
|
|
7
|
+
stroke: var(--pf-sparkline-color-override, var(--pf-sparkline-color));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.pf-sparkline__area {
|
|
11
|
+
fill: var(--pf-sparkline-color-override, var(--pf-sparkline-color));
|
|
12
|
+
opacity: var(--pf-sparkline-area-opacity, 0.15);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.pf-sparkline__dot {
|
|
16
|
+
fill: var(--pf-sparkline-color-override, var(--pf-sparkline-color));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Opt-in mount animation: draw the line, fade in the area and end dot.
|
|
20
|
+
The line path sets pathLength="1" so dash math is length-independent. */
|
|
21
|
+
.pf-sparkline--animated .pf-sparkline__line {
|
|
22
|
+
stroke-dasharray: 1;
|
|
23
|
+
animation: pf-sparkline-draw var(--duration-slow) var(--easing-standard) both;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@keyframes pf-sparkline-draw {
|
|
27
|
+
from {
|
|
28
|
+
stroke-dashoffset: 1;
|
|
29
|
+
}
|
|
30
|
+
to {
|
|
31
|
+
stroke-dashoffset: 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.pf-sparkline--animated .pf-sparkline__area {
|
|
36
|
+
animation: pf-sparkline-fade var(--duration-slow) var(--easing-standard) both;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@keyframes pf-sparkline-fade {
|
|
40
|
+
from {
|
|
41
|
+
opacity: 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.pf-sparkline--animated .pf-sparkline__dot {
|
|
46
|
+
animation: pf-sparkline-dot var(--duration-fast) var(--easing-decelerate) var(--duration-moderate)
|
|
47
|
+
both;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@keyframes pf-sparkline-dot {
|
|
51
|
+
from {
|
|
52
|
+
opacity: 0;
|
|
53
|
+
}
|
|
54
|
+
to {
|
|
55
|
+
opacity: 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (prefers-reduced-motion: reduce) {
|
|
60
|
+
.pf-sparkline--animated .pf-sparkline__line,
|
|
61
|
+
.pf-sparkline--animated .pf-sparkline__area,
|
|
62
|
+
.pf-sparkline--animated .pf-sparkline__dot {
|
|
63
|
+
animation: none;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './Sparkline.css';/* empty css */
|
|
3
|
+
import { forwardRef, useMemo } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Sparkline/Sparkline.tsx
|
|
6
|
+
function buildPath(points, close = false) {
|
|
7
|
+
if (points.length < 2) return "";
|
|
8
|
+
const [first, ...rest] = points;
|
|
9
|
+
const d = [`M ${first[0]} ${first[1]}`];
|
|
10
|
+
for (const [x, y] of rest) d.push(`L ${x} ${y}`);
|
|
11
|
+
if (close) {
|
|
12
|
+
const lastX = points[points.length - 1][0];
|
|
13
|
+
points[points.length - 1][1];
|
|
14
|
+
d.push(`L ${lastX} ${close}`);
|
|
15
|
+
d.push(`L ${first[0]} ${close}`);
|
|
16
|
+
d.push("Z");
|
|
17
|
+
}
|
|
18
|
+
return d.join(" ");
|
|
19
|
+
}
|
|
20
|
+
function normalizePoints(data, width, height, padding) {
|
|
21
|
+
if (data.length === 0) return [];
|
|
22
|
+
const min = Math.min(...data);
|
|
23
|
+
const range = Math.max(...data) - min || 1;
|
|
24
|
+
const innerW = width - padding * 2;
|
|
25
|
+
const innerH = height - padding * 2;
|
|
26
|
+
return data.map((value, i) => {
|
|
27
|
+
return [padding + i / (data.length - 1) * innerW, padding + (1 - (value - min) / range) * innerH];
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
var Sparkline = forwardRef(function Sparkline({ className, data = [], width = 120, height = 36, variant = "line", strokeWidth = 1.5, color, endDot = false, animate = false, label, style, ...props }, ref) {
|
|
31
|
+
const padding = strokeWidth + 2;
|
|
32
|
+
const points = useMemo(() => normalizePoints(data, width, height, padding), [
|
|
33
|
+
data,
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
padding
|
|
37
|
+
]);
|
|
38
|
+
const linePath = useMemo(() => buildPath(points), [points]);
|
|
39
|
+
const areaPath = useMemo(() => {
|
|
40
|
+
if (variant !== "area" || points.length < 2) return "";
|
|
41
|
+
const [first, ...rest] = points;
|
|
42
|
+
const d = [`M ${first[0]} ${first[1]}`];
|
|
43
|
+
for (const [x, y] of rest) d.push(`L ${x} ${y}`);
|
|
44
|
+
const lastX = points[points.length - 1][0];
|
|
45
|
+
const bottom = height - padding + strokeWidth;
|
|
46
|
+
d.push(`L ${lastX} ${bottom}`);
|
|
47
|
+
d.push(`L ${first[0]} ${bottom}`);
|
|
48
|
+
d.push("Z");
|
|
49
|
+
return d.join(" ");
|
|
50
|
+
}, [
|
|
51
|
+
points,
|
|
52
|
+
variant,
|
|
53
|
+
height,
|
|
54
|
+
padding,
|
|
55
|
+
strokeWidth
|
|
56
|
+
]);
|
|
57
|
+
const lastPoint = points[points.length - 1];
|
|
58
|
+
const colorVar = color ?? "var(--pf-sparkline-color)";
|
|
59
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
60
|
+
ref,
|
|
61
|
+
width,
|
|
62
|
+
height,
|
|
63
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
64
|
+
className: cx("pf-sparkline", `pf-sparkline--${variant}`, animate && "pf-sparkline--animated", className),
|
|
65
|
+
"aria-label": label,
|
|
66
|
+
role: label ? "img" : "presentation",
|
|
67
|
+
style: {
|
|
68
|
+
"--pf-sparkline-color-override": color,
|
|
69
|
+
...style
|
|
70
|
+
},
|
|
71
|
+
...props,
|
|
72
|
+
children: [
|
|
73
|
+
variant === "area" && areaPath && /* @__PURE__ */ jsx("path", {
|
|
74
|
+
d: areaPath,
|
|
75
|
+
fill: colorVar,
|
|
76
|
+
className: "pf-sparkline__area"
|
|
77
|
+
}),
|
|
78
|
+
linePath && /* @__PURE__ */ jsx("path", {
|
|
79
|
+
d: linePath,
|
|
80
|
+
fill: "none",
|
|
81
|
+
stroke: colorVar,
|
|
82
|
+
strokeWidth,
|
|
83
|
+
strokeLinecap: "round",
|
|
84
|
+
strokeLinejoin: "round",
|
|
85
|
+
pathLength: animate ? 1 : void 0,
|
|
86
|
+
className: "pf-sparkline__line"
|
|
87
|
+
}),
|
|
88
|
+
endDot && lastPoint && /* @__PURE__ */ jsx("circle", {
|
|
89
|
+
cx: lastPoint[0],
|
|
90
|
+
cy: lastPoint[1],
|
|
91
|
+
r: strokeWidth + 1.5,
|
|
92
|
+
fill: colorVar,
|
|
93
|
+
className: "pf-sparkline__dot"
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
Sparkline.displayName = "Sparkline";
|
|
99
|
+
//#endregion
|
|
100
|
+
export { Sparkline };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.pf-switch-field {
|
|
2
|
+
align-items: center;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
gap: var(--space-2);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.pf-switch {
|
|
8
|
+
appearance: none;
|
|
9
|
+
background: var(--pf-switch-track-bg);
|
|
10
|
+
border-radius: var(--radius-full);
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
height: 24px;
|
|
13
|
+
margin: 0;
|
|
14
|
+
position: relative;
|
|
15
|
+
transition: background-color 120ms ease;
|
|
16
|
+
width: 44px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.pf-switch::after {
|
|
20
|
+
background: var(--pf-switch-thumb-bg);
|
|
21
|
+
border-radius: 50%;
|
|
22
|
+
content: '';
|
|
23
|
+
height: 20px;
|
|
24
|
+
left: 2px;
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 2px;
|
|
27
|
+
transition: transform 120ms ease;
|
|
28
|
+
width: 20px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.pf-switch:checked {
|
|
32
|
+
background: var(--pf-switch-track-checked-bg);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.pf-switch:checked::after {
|
|
36
|
+
transform: translateX(20px);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.pf-switch:focus-visible {
|
|
40
|
+
box-shadow: var(--pf-switch-focus-ring, var(--pf-focus-ring));
|
|
41
|
+
outline: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.pf-switch:disabled {
|
|
45
|
+
cursor: not-allowed;
|
|
46
|
+
opacity: 0.55;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pf-switch-field label {
|
|
50
|
+
color: var(--pf-switch-label-text);
|
|
51
|
+
font-size: var(--font-size-md);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (prefers-reduced-motion: reduce) {
|
|
55
|
+
.pf-switch,
|
|
56
|
+
.pf-switch::after {
|
|
57
|
+
transition: none;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cx } from "
|
|
2
|
-
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './Switch.css';/* empty css */
|
|
3
3
|
import { forwardRef, useId } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/Switch/Switch.tsx
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
.pf-table {
|
|
2
|
+
background: var(--pf-table-bg);
|
|
3
|
+
border: 1px solid var(--pf-table-border);
|
|
4
|
+
border-radius: var(--radius-md);
|
|
5
|
+
overflow: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.pf-table__native {
|
|
9
|
+
border-collapse: separate;
|
|
10
|
+
border-spacing: 0;
|
|
11
|
+
min-width: 620px;
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.pf-table__caption {
|
|
16
|
+
align-items: center;
|
|
17
|
+
border-bottom: 1px solid var(--pf-table-border);
|
|
18
|
+
color: var(--pf-table-text-muted);
|
|
19
|
+
display: flex;
|
|
20
|
+
font-size: var(--font-size-sm);
|
|
21
|
+
min-height: 56px;
|
|
22
|
+
padding-top: var(--space-3);
|
|
23
|
+
padding-inline-end: var(--space-4, 16px);
|
|
24
|
+
padding-bottom: var(--space-3);
|
|
25
|
+
padding-inline-start: var(--space-4, 16px);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pf-table__head-cell,
|
|
29
|
+
.pf-table__body-cell,
|
|
30
|
+
.pf-table__empty {
|
|
31
|
+
border-bottom: 1px solid var(--pf-table-border);
|
|
32
|
+
font-size: var(--font-size-sm);
|
|
33
|
+
line-height: 1.4;
|
|
34
|
+
padding: 14px var(--space-3);
|
|
35
|
+
vertical-align: middle;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (min-width: 768px) {
|
|
39
|
+
.pf-table__head-cell,
|
|
40
|
+
.pf-table__body-cell,
|
|
41
|
+
.pf-table__empty {
|
|
42
|
+
padding-inline: var(--space-4);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.pf-table__head-cell {
|
|
47
|
+
background: var(--pf-table-bg-subtle);
|
|
48
|
+
color: var(--pf-table-text-muted);
|
|
49
|
+
font-weight: var(--font-weight-semibold);
|
|
50
|
+
position: relative;
|
|
51
|
+
text-transform: none;
|
|
52
|
+
width: var(--pf-col-width, auto);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pf-table__sort-button {
|
|
56
|
+
align-items: center;
|
|
57
|
+
background: transparent;
|
|
58
|
+
border: 0;
|
|
59
|
+
color: inherit;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
font: inherit;
|
|
63
|
+
gap: var(--space-2);
|
|
64
|
+
justify-content: inherit;
|
|
65
|
+
padding: 0;
|
|
66
|
+
width: 100%;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.pf-table__sort-button:hover,
|
|
70
|
+
.pf-table__sort-button:focus-visible {
|
|
71
|
+
color: var(--pf-table-text);
|
|
72
|
+
outline: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.pf-table__sort-indicator {
|
|
76
|
+
display: inline-flex;
|
|
77
|
+
font-size: var(--font-size-2xs);
|
|
78
|
+
line-height: 1;
|
|
79
|
+
opacity: 0.7;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.pf-table__body-cell {
|
|
83
|
+
color: var(--pf-table-text);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.pf-table__native tbody tr:last-child .pf-table__body-cell,
|
|
87
|
+
.pf-table__native tbody tr:last-child .pf-table__empty {
|
|
88
|
+
border-bottom: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.pf-table--striped .pf-table__native tbody tr:nth-child(even) .pf-table__body-cell {
|
|
92
|
+
background: color-mix(in srgb, var(--pf-table-bg-subtle) 55%, transparent);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.pf-table--hoverable .pf-table__native tbody tr:hover .pf-table__body-cell {
|
|
96
|
+
background: color-mix(in srgb, var(--pf-table-bg-subtle) 70%, transparent);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.pf-table--sticky-header .pf-table__head-cell {
|
|
100
|
+
position: sticky;
|
|
101
|
+
top: 0;
|
|
102
|
+
z-index: 1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.pf-table__cell--left {
|
|
106
|
+
text-align: start;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.pf-table__cell--center {
|
|
110
|
+
text-align: center;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.pf-table__cell--right {
|
|
114
|
+
text-align: end;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.pf-table__empty {
|
|
118
|
+
color: var(--pf-table-text-muted);
|
|
119
|
+
text-align: center;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.pf-table--dense .pf-table__head-cell,
|
|
123
|
+
.pf-table--dense .pf-table__body-cell,
|
|
124
|
+
.pf-table--dense .pf-table__empty {
|
|
125
|
+
padding-block: var(--space-3);
|
|
126
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cx } from "
|
|
2
|
-
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './Table.css';/* empty css */
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/Table/Table.tsx
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
.pf-tabs {
|
|
2
|
+
display: grid;
|
|
3
|
+
gap: var(--space-3);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
@media (min-width: 768px) {
|
|
7
|
+
.pf-tabs {
|
|
8
|
+
gap: var(--space-4);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.pf-tabs__list {
|
|
13
|
+
display: flex;
|
|
14
|
+
overflow-x: auto;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.pf-tabs__indicator {
|
|
19
|
+
position: absolute;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
transition:
|
|
22
|
+
left var(--pf-transition-medium),
|
|
23
|
+
width var(--pf-transition-medium),
|
|
24
|
+
top var(--pf-transition-medium),
|
|
25
|
+
height var(--pf-transition-medium);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pf-tabs__indicator--underline {
|
|
29
|
+
bottom: 0;
|
|
30
|
+
height: var(--pf-tabs-underline-width);
|
|
31
|
+
background: var(--pf-tabs-text);
|
|
32
|
+
border-radius: var(--radius-full);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.pf-tabs__indicator--pills {
|
|
36
|
+
background: var(--pf-tabs-bg);
|
|
37
|
+
border-radius: var(--radius-sm);
|
|
38
|
+
box-shadow: var(--pf-tabs-elevation-tab-active-shadow, var(--pf-elevation-tab-active-shadow));
|
|
39
|
+
z-index: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.pf-tabs__list--full-width {
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.pf-tabs__list--underline {
|
|
47
|
+
border-bottom: 1px solid var(--pf-tabs-border);
|
|
48
|
+
gap: var(--space-1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.pf-tabs__list--pills {
|
|
52
|
+
background: var(--pf-tabs-bg-subtle);
|
|
53
|
+
border-radius: var(--radius-md);
|
|
54
|
+
gap: var(--space-1);
|
|
55
|
+
padding: var(--space-1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.pf-tabs__tab {
|
|
59
|
+
appearance: none;
|
|
60
|
+
background: transparent;
|
|
61
|
+
border: 0;
|
|
62
|
+
color: var(--pf-tabs-text-muted);
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
font-family: inherit;
|
|
65
|
+
font-weight: var(--font-weight-medium);
|
|
66
|
+
min-width: 0;
|
|
67
|
+
position: relative;
|
|
68
|
+
z-index: 1;
|
|
69
|
+
transition: color var(--pf-transition-medium);
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.pf-tabs__tab:disabled {
|
|
74
|
+
cursor: not-allowed;
|
|
75
|
+
opacity: 0.45;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.pf-tabs__tab--sm {
|
|
79
|
+
font-size: var(--font-size-sm);
|
|
80
|
+
padding: var(--space-2) var(--space-3);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.pf-tabs__tab--md {
|
|
84
|
+
font-size: var(--font-size-sm);
|
|
85
|
+
padding: var(--pf-tabs-tab-padding-y-md) var(--pf-tabs-tab-padding-x-md);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.pf-tabs__list--full-width .pf-tabs__tab {
|
|
89
|
+
flex: 1;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.pf-tabs__tab--underline {
|
|
94
|
+
border-bottom: var(--pf-tabs-underline-width) solid transparent;
|
|
95
|
+
margin-bottom: -1px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.pf-tabs__tab--underline:hover:not(:disabled),
|
|
99
|
+
.pf-tabs__tab--underline:focus-visible {
|
|
100
|
+
color: var(--pf-tabs-text);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.pf-tabs__tab--underline.pf-tabs__tab--active {
|
|
104
|
+
/* The sliding indicator draws the underline; keep the transparent border for spacing */
|
|
105
|
+
color: var(--pf-tabs-text);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.pf-tabs__tab--pills {
|
|
109
|
+
border-radius: var(--radius-sm);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.pf-tabs__tab--pills:hover:not(:disabled),
|
|
113
|
+
.pf-tabs__tab--pills:focus-visible {
|
|
114
|
+
color: var(--pf-tabs-text);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.pf-tabs__tab--pills.pf-tabs__tab--active {
|
|
118
|
+
/* The sliding indicator draws the pill background */
|
|
119
|
+
color: var(--pf-tabs-text);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.pf-tabs__tab:focus-visible {
|
|
123
|
+
outline: 2px solid color-mix(in srgb, var(--pf-tabs-text) 32%, transparent);
|
|
124
|
+
outline-offset: 2px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.pf-tabs__panel {
|
|
128
|
+
color: var(--pf-tabs-text);
|
|
129
|
+
line-height: 1.5;
|
|
130
|
+
min-width: 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media (prefers-reduced-motion: reduce) {
|
|
134
|
+
.pf-tabs__tab,
|
|
135
|
+
.pf-tabs__indicator {
|
|
136
|
+
transition: none;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { cx } from "
|
|
2
|
-
|
|
3
|
-
import { forwardRef, useId, useMemo, useRef, useState } from "react";
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './Tabs.css';/* empty css */
|
|
3
|
+
import { forwardRef, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/Tabs/Tabs.tsx
|
|
6
|
+
var useIsomorphicLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
|
6
7
|
function getFirstEnabledValue(items) {
|
|
7
8
|
return items.find((item) => !item.disabled)?.value;
|
|
8
9
|
}
|
|
@@ -13,6 +14,39 @@ var Tabs = forwardRef(function Tabs({ className, items, value, defaultValue, onV
|
|
|
13
14
|
const selectedValue = isControlled ? value : internalValue;
|
|
14
15
|
const selectedItem = useMemo(() => items.find((item) => item.value === selectedValue && !item.disabled) ?? items.find((item) => !item.disabled), [items, selectedValue]);
|
|
15
16
|
const buttonRefs = useRef([]);
|
|
17
|
+
const listRef = useRef(null);
|
|
18
|
+
const [indicator, setIndicator] = useState(null);
|
|
19
|
+
useIsomorphicLayoutEffect(() => {
|
|
20
|
+
const list = listRef.current;
|
|
21
|
+
const activeIndex = items.findIndex((item) => item.value === selectedItem?.value);
|
|
22
|
+
const activeButton = buttonRefs.current[activeIndex];
|
|
23
|
+
if (!list || !activeButton) {
|
|
24
|
+
setIndicator(null);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const measure = () => {
|
|
28
|
+
const listRect = list.getBoundingClientRect();
|
|
29
|
+
const tabRect = activeButton.getBoundingClientRect();
|
|
30
|
+
setIndicator({
|
|
31
|
+
left: tabRect.left - listRect.left + list.scrollLeft,
|
|
32
|
+
width: tabRect.width,
|
|
33
|
+
top: tabRect.top - listRect.top,
|
|
34
|
+
height: tabRect.height
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
measure();
|
|
38
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
39
|
+
const observer = new ResizeObserver(measure);
|
|
40
|
+
observer.observe(list);
|
|
41
|
+
observer.observe(activeButton);
|
|
42
|
+
return () => observer.disconnect();
|
|
43
|
+
}, [
|
|
44
|
+
items,
|
|
45
|
+
selectedItem?.value,
|
|
46
|
+
variant,
|
|
47
|
+
size,
|
|
48
|
+
fullWidth
|
|
49
|
+
]);
|
|
16
50
|
const setSelectedValue = (nextValue) => {
|
|
17
51
|
if (!isControlled) setInternalValue(nextValue);
|
|
18
52
|
onValueChange?.(nextValue);
|
|
@@ -37,11 +71,24 @@ var Tabs = forwardRef(function Tabs({ className, items, value, defaultValue, onV
|
|
|
37
71
|
ref,
|
|
38
72
|
className: cx("pf-tabs", className),
|
|
39
73
|
...props,
|
|
40
|
-
children: [/* @__PURE__ */
|
|
74
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
75
|
+
ref: listRef,
|
|
41
76
|
className: cx("pf-tabs__list", `pf-tabs__list--${variant}`, `pf-tabs__list--${size}`, fullWidth && "pf-tabs__list--full-width"),
|
|
42
77
|
role: "tablist",
|
|
43
78
|
"aria-orientation": "horizontal",
|
|
44
|
-
children:
|
|
79
|
+
children: [indicator ? /* @__PURE__ */ jsx("span", {
|
|
80
|
+
"aria-hidden": true,
|
|
81
|
+
className: cx("pf-tabs__indicator", `pf-tabs__indicator--${variant}`),
|
|
82
|
+
style: variant === "pills" ? {
|
|
83
|
+
left: indicator.left,
|
|
84
|
+
width: indicator.width,
|
|
85
|
+
top: indicator.top,
|
|
86
|
+
height: indicator.height
|
|
87
|
+
} : {
|
|
88
|
+
left: indicator.left,
|
|
89
|
+
width: indicator.width
|
|
90
|
+
}
|
|
91
|
+
}) : null, items.map((item, index) => {
|
|
45
92
|
const isSelected = item.value === selectedItem?.value;
|
|
46
93
|
const tabId = `${baseId}-tab-${item.value}`;
|
|
47
94
|
const panelId = `${baseId}-panel-${item.value}`;
|
|
@@ -80,7 +127,7 @@ var Tabs = forwardRef(function Tabs({ className, items, value, defaultValue, onV
|
|
|
80
127
|
},
|
|
81
128
|
children: item.label
|
|
82
129
|
}, item.value);
|
|
83
|
-
})
|
|
130
|
+
})]
|
|
84
131
|
}), selectedItem ? /* @__PURE__ */ jsx("div", {
|
|
85
132
|
id: `${baseId}-panel-${selectedItem.value}`,
|
|
86
133
|
className: "pf-tabs__panel",
|