@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,100 @@
|
|
|
1
|
+
.pf-heatmap {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font-family: var(--font-family-sans);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.pf-heatmap__empty {
|
|
7
|
+
color: var(--color-semantic-text-muted);
|
|
8
|
+
font-size: var(--font-size-sm);
|
|
9
|
+
padding: var(--space-4);
|
|
10
|
+
text-align: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.pf-heatmap__body {
|
|
14
|
+
display: flex;
|
|
15
|
+
gap: var(--pf-heatmap-cell-gap);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.pf-heatmap__weekdays {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.pf-heatmap__weekday-spacer {
|
|
24
|
+
display: block;
|
|
25
|
+
height: calc(var(--font-size-xs) + var(--space-1));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pf-heatmap__weekday-grid {
|
|
29
|
+
display: grid;
|
|
30
|
+
grid-template-rows: repeat(7, var(--pf-heatmap-cell-size));
|
|
31
|
+
gap: var(--pf-heatmap-cell-gap);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.pf-heatmap__weekday {
|
|
35
|
+
align-items: center;
|
|
36
|
+
color: var(--pf-heatmap-label-color);
|
|
37
|
+
display: flex;
|
|
38
|
+
font-size: var(--font-size-xs);
|
|
39
|
+
line-height: 1;
|
|
40
|
+
padding-inline-end: var(--space-1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.pf-heatmap__main {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: var(--space-1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pf-heatmap__months {
|
|
50
|
+
display: grid;
|
|
51
|
+
gap: var(--pf-heatmap-cell-gap);
|
|
52
|
+
height: var(--font-size-xs);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pf-heatmap__month {
|
|
56
|
+
color: var(--pf-heatmap-label-color);
|
|
57
|
+
font-size: var(--font-size-xs);
|
|
58
|
+
line-height: 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.pf-heatmap__grid {
|
|
62
|
+
display: grid;
|
|
63
|
+
grid-template-rows: repeat(7, var(--pf-heatmap-cell-size));
|
|
64
|
+
grid-auto-flow: column;
|
|
65
|
+
grid-auto-columns: var(--pf-heatmap-cell-size);
|
|
66
|
+
gap: var(--pf-heatmap-cell-gap);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.pf-heatmap__cell {
|
|
70
|
+
border-radius: var(--pf-heatmap-cell-radius);
|
|
71
|
+
height: var(--pf-heatmap-cell-size);
|
|
72
|
+
width: var(--pf-heatmap-cell-size);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.pf-heatmap__cell--empty {
|
|
76
|
+
background: transparent;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Staggered fade-in on mount — per-column animation-delay is set inline so
|
|
80
|
+
the grid wipes in left-to-right (oldest week → newest). */
|
|
81
|
+
.pf-heatmap__cell {
|
|
82
|
+
animation: pf-heatmap-cell-in var(--duration-moderate) var(--easing-decelerate) both;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@keyframes pf-heatmap-cell-in {
|
|
86
|
+
from {
|
|
87
|
+
opacity: 0;
|
|
88
|
+
transform: scale(0.6);
|
|
89
|
+
}
|
|
90
|
+
to {
|
|
91
|
+
opacity: 1;
|
|
92
|
+
transform: scale(1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@media (prefers-reduced-motion: reduce) {
|
|
97
|
+
.pf-heatmap__cell {
|
|
98
|
+
animation: none;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './Heatmap.css';/* empty css */
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Heatmap/Heatmap.tsx
|
|
6
|
+
var MONTHS = [
|
|
7
|
+
"Jan",
|
|
8
|
+
"Feb",
|
|
9
|
+
"Mar",
|
|
10
|
+
"Apr",
|
|
11
|
+
"May",
|
|
12
|
+
"Jun",
|
|
13
|
+
"Jul",
|
|
14
|
+
"Aug",
|
|
15
|
+
"Sep",
|
|
16
|
+
"Oct",
|
|
17
|
+
"Nov",
|
|
18
|
+
"Dec"
|
|
19
|
+
];
|
|
20
|
+
var WEEKDAYS = [
|
|
21
|
+
"Sun",
|
|
22
|
+
"Mon",
|
|
23
|
+
"Tue",
|
|
24
|
+
"Wed",
|
|
25
|
+
"Thu",
|
|
26
|
+
"Fri",
|
|
27
|
+
"Sat"
|
|
28
|
+
];
|
|
29
|
+
function parseISO(s) {
|
|
30
|
+
const [y, m, d] = s.split("-").map(Number);
|
|
31
|
+
return new Date(y, m - 1, d);
|
|
32
|
+
}
|
|
33
|
+
function toISO(d) {
|
|
34
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
35
|
+
}
|
|
36
|
+
function addDays(d, n) {
|
|
37
|
+
const r = new Date(d);
|
|
38
|
+
r.setDate(r.getDate() + n);
|
|
39
|
+
return r;
|
|
40
|
+
}
|
|
41
|
+
var Heatmap = forwardRef(function Heatmap({ className, data, startDate, endDate, levels = 5, weekStartsOn = 0, cellSize = 12, cellGap = 3, showWeekdayLabels = true, showMonthLabels = true, valueFormatter, label, emptyLabel = "No data", style, ...props }, ref) {
|
|
42
|
+
const sortedDates = data.map((d) => d.date).sort();
|
|
43
|
+
if (!Boolean(startDate || endDate || data.length)) return /* @__PURE__ */ jsx("div", {
|
|
44
|
+
ref,
|
|
45
|
+
className: cx("pf-heatmap", className),
|
|
46
|
+
...props,
|
|
47
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: "pf-heatmap__empty",
|
|
49
|
+
children: emptyLabel
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
const valueByDate = new Map(data.map((d) => [d.date, d.value]));
|
|
53
|
+
const maxValue = data.reduce((max, d) => Math.max(max, d.value), 0);
|
|
54
|
+
const total = data.reduce((sum, d) => sum + d.value, 0);
|
|
55
|
+
const levelCount = Math.max(2, levels);
|
|
56
|
+
const start = parseISO(startDate ?? sortedDates[0]);
|
|
57
|
+
const end = parseISO(endDate ?? sortedDates[sortedDates.length - 1]);
|
|
58
|
+
const gridStart = addDays(start, -((start.getDay() - weekStartsOn + 7) % 7));
|
|
59
|
+
const weeks = [];
|
|
60
|
+
let cursor = gridStart;
|
|
61
|
+
while (cursor <= end) {
|
|
62
|
+
const week = [];
|
|
63
|
+
for (let i = 0; i < 7; i++) {
|
|
64
|
+
week.push({
|
|
65
|
+
iso: toISO(cursor),
|
|
66
|
+
date: new Date(cursor),
|
|
67
|
+
inRange: cursor >= start && cursor <= end
|
|
68
|
+
});
|
|
69
|
+
cursor = addDays(cursor, 1);
|
|
70
|
+
}
|
|
71
|
+
weeks.push(week);
|
|
72
|
+
}
|
|
73
|
+
function levelFor(value) {
|
|
74
|
+
if (value <= 0 || maxValue <= 0) return 0;
|
|
75
|
+
return Math.min(levelCount - 1, Math.max(1, Math.ceil(value / maxValue * (levelCount - 1))));
|
|
76
|
+
}
|
|
77
|
+
function cellColor(level) {
|
|
78
|
+
if (level === 0) return "var(--pf-heatmap-empty)";
|
|
79
|
+
return `color-mix(in srgb, var(--pf-heatmap-color) ${Math.round(level / (levelCount - 1) * 100)}%, var(--pf-heatmap-empty))`;
|
|
80
|
+
}
|
|
81
|
+
const monthLabels = [];
|
|
82
|
+
let lastMonth = -1;
|
|
83
|
+
weeks.forEach((week, col) => {
|
|
84
|
+
const firstInRange = week.find((c) => c.inRange);
|
|
85
|
+
if (!firstInRange) return;
|
|
86
|
+
const month = firstInRange.date.getMonth();
|
|
87
|
+
if (month !== lastMonth) {
|
|
88
|
+
monthLabels.push({
|
|
89
|
+
col: col + 1,
|
|
90
|
+
label: MONTHS[month]
|
|
91
|
+
});
|
|
92
|
+
lastMonth = month;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const styleVars = {
|
|
96
|
+
"--pf-heatmap-cell-size": `${cellSize}px`,
|
|
97
|
+
"--pf-heatmap-cell-gap": `${cellGap}px`,
|
|
98
|
+
...style
|
|
99
|
+
};
|
|
100
|
+
const ariaLabel = label ?? `Activity heatmap from ${toISO(start)} to ${toISO(end)}, ${total} total`;
|
|
101
|
+
return /* @__PURE__ */ jsx("div", {
|
|
102
|
+
ref,
|
|
103
|
+
className: cx("pf-heatmap", className),
|
|
104
|
+
style: styleVars,
|
|
105
|
+
role: "img",
|
|
106
|
+
"aria-label": ariaLabel,
|
|
107
|
+
...props,
|
|
108
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
109
|
+
className: "pf-heatmap__body",
|
|
110
|
+
children: [showWeekdayLabels ? /* @__PURE__ */ jsxs("div", {
|
|
111
|
+
className: "pf-heatmap__weekdays",
|
|
112
|
+
children: [showMonthLabels ? /* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: "pf-heatmap__weekday-spacer",
|
|
114
|
+
"aria-hidden": "true"
|
|
115
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
116
|
+
className: "pf-heatmap__weekday-grid",
|
|
117
|
+
children: Array.from({ length: 7 }, (_, i) => {
|
|
118
|
+
const dow = (weekStartsOn + i) % 7;
|
|
119
|
+
return /* @__PURE__ */ jsx("span", {
|
|
120
|
+
className: "pf-heatmap__weekday",
|
|
121
|
+
children: i % 2 === 1 ? WEEKDAYS[dow] : ""
|
|
122
|
+
}, i);
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
126
|
+
className: "pf-heatmap__main",
|
|
127
|
+
children: [showMonthLabels ? /* @__PURE__ */ jsx("div", {
|
|
128
|
+
className: "pf-heatmap__months",
|
|
129
|
+
style: { gridTemplateColumns: `repeat(${weeks.length}, var(--pf-heatmap-cell-size))` },
|
|
130
|
+
"aria-hidden": "true",
|
|
131
|
+
children: monthLabels.map((m) => /* @__PURE__ */ jsx("span", {
|
|
132
|
+
className: "pf-heatmap__month",
|
|
133
|
+
style: { gridColumnStart: m.col },
|
|
134
|
+
children: m.label
|
|
135
|
+
}, `${m.label}-${m.col}`))
|
|
136
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
137
|
+
className: "pf-heatmap__grid",
|
|
138
|
+
children: weeks.flatMap((week, wi) => week.map((cell, di) => {
|
|
139
|
+
if (!cell.inRange) return /* @__PURE__ */ jsx("span", { className: "pf-heatmap__cell pf-heatmap__cell--empty" }, `${wi}-${di}`);
|
|
140
|
+
const value = valueByDate.get(cell.iso) ?? 0;
|
|
141
|
+
const level = levelFor(value);
|
|
142
|
+
const title = valueFormatter ? valueFormatter(value, cell.iso) : `${cell.iso}: ${value}`;
|
|
143
|
+
return /* @__PURE__ */ jsx("span", {
|
|
144
|
+
className: "pf-heatmap__cell",
|
|
145
|
+
style: {
|
|
146
|
+
background: cellColor(level),
|
|
147
|
+
animationDelay: `${wi * 8}ms`
|
|
148
|
+
},
|
|
149
|
+
title,
|
|
150
|
+
"data-level": level
|
|
151
|
+
}, `${wi}-${di}`);
|
|
152
|
+
}))
|
|
153
|
+
})]
|
|
154
|
+
})]
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
Heatmap.displayName = "Heatmap";
|
|
159
|
+
//#endregion
|
|
160
|
+
export { Heatmap };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cx } from "
|
|
2
|
-
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './Icon.css';/* empty css */
|
|
3
3
|
import { faBarChart, faCalendar, faCircleCheck, faCircleQuestion, faCircleXmark, faCopy, faCreditCard, faSquareCaretLeft, faSquareCaretRight, faSquareCheck, faStar, faUser } from "@fortawesome/free-regular-svg-icons";
|
|
4
4
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
.pf-inline-cta {
|
|
2
|
+
align-items: start;
|
|
3
|
+
background: var(--pf-inline-cta-bg);
|
|
4
|
+
border: 1px solid var(--pf-inline-cta-border);
|
|
5
|
+
border-radius: var(--radius-md);
|
|
6
|
+
display: grid;
|
|
7
|
+
gap: var(--space-3);
|
|
8
|
+
grid-template-columns: auto 1fr;
|
|
9
|
+
padding: var(--space-3);
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Leave room for the centered dismiss button so content/action don't crowd it */
|
|
14
|
+
.pf-inline-cta--dismissible {
|
|
15
|
+
padding-inline-end: var(--space-12);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.pf-inline-cta__dismiss {
|
|
19
|
+
align-items: center;
|
|
20
|
+
background: transparent;
|
|
21
|
+
border: 0;
|
|
22
|
+
border-radius: var(--radius-sm);
|
|
23
|
+
color: var(--color-semantic-text-muted);
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
height: 28px;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
position: absolute;
|
|
29
|
+
inset-inline-end: var(--space-3);
|
|
30
|
+
top: 50%;
|
|
31
|
+
transform: translateY(-50%);
|
|
32
|
+
width: 28px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.pf-inline-cta__dismiss:hover,
|
|
36
|
+
.pf-inline-cta__dismiss:focus-visible {
|
|
37
|
+
background: var(--color-semantic-background-subtle);
|
|
38
|
+
color: var(--color-semantic-text-default);
|
|
39
|
+
outline: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Exit: fade and collapse so surrounding content reflows when dismissed. */
|
|
43
|
+
.pf-inline-cta--exiting {
|
|
44
|
+
animation: pf-inline-cta-out var(--duration-moderate) var(--easing-accelerate) forwards;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes pf-inline-cta-out {
|
|
50
|
+
from {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
max-height: 480px;
|
|
53
|
+
}
|
|
54
|
+
to {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
max-height: 0;
|
|
57
|
+
margin-top: 0;
|
|
58
|
+
margin-bottom: 0;
|
|
59
|
+
padding-top: 0;
|
|
60
|
+
padding-bottom: 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media (prefers-reduced-motion: reduce) {
|
|
65
|
+
.pf-inline-cta--exiting {
|
|
66
|
+
animation: none;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (min-width: 768px) {
|
|
71
|
+
.pf-inline-cta {
|
|
72
|
+
align-items: center;
|
|
73
|
+
grid-template-columns: auto 1fr auto;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.pf-inline-cta__icon {
|
|
78
|
+
align-items: center;
|
|
79
|
+
color: var(--pf-inline-cta-text-muted);
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
font-size: var(--font-size-md);
|
|
82
|
+
justify-content: center;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.pf-inline-cta__content {
|
|
86
|
+
display: grid;
|
|
87
|
+
gap: 2px;
|
|
88
|
+
min-width: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.pf-inline-cta__heading {
|
|
92
|
+
color: var(--pf-inline-cta-text);
|
|
93
|
+
font-size: var(--font-size-sm);
|
|
94
|
+
font-weight: var(--font-weight-semibold);
|
|
95
|
+
margin: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.pf-inline-cta__description {
|
|
99
|
+
color: var(--pf-inline-cta-text-muted);
|
|
100
|
+
font-size: var(--font-size-sm);
|
|
101
|
+
margin: 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.pf-inline-cta__action {
|
|
105
|
+
align-items: center;
|
|
106
|
+
display: inline-flex;
|
|
107
|
+
gap: var(--space-2);
|
|
108
|
+
grid-column: 1 / -1;
|
|
109
|
+
justify-content: flex-start;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@media (min-width: 768px) {
|
|
113
|
+
.pf-inline-cta__action {
|
|
114
|
+
grid-column: auto;
|
|
115
|
+
justify-content: initial;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.pf-inline-cta--info {
|
|
120
|
+
background: color-mix(in srgb, var(--pf-inline-cta-info-bg) 70%, var(--color-base-white));
|
|
121
|
+
border-color: var(--pf-inline-cta-info-border);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.pf-inline-cta--info .pf-inline-cta__icon {
|
|
125
|
+
color: var(--pf-inline-cta-info-icon);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.pf-inline-cta--info .pf-inline-cta__heading {
|
|
129
|
+
color: var(--pf-inline-cta-info-heading);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.pf-inline-cta--info .pf-inline-cta__description {
|
|
133
|
+
color: var(--pf-inline-cta-info-description);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.pf-inline-cta--success {
|
|
137
|
+
background: color-mix(in srgb, var(--pf-inline-cta-success-bg) 55%, var(--color-base-white));
|
|
138
|
+
border-color: var(--pf-inline-cta-success-border);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.pf-inline-cta--warning {
|
|
142
|
+
background: color-mix(in srgb, var(--pf-inline-cta-warning-bg) 60%, var(--color-base-white));
|
|
143
|
+
border-color: var(--pf-inline-cta-warning-border);
|
|
144
|
+
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { useExitAnimation } from "../../hooks/useExitAnimation.js";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import { Icon } from "../Icon/Icon2.js";
|
|
4
|
+
import './InlineCTA.css';/* empty css */
|
|
4
5
|
import { forwardRef } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/InlineCTA/InlineCTA.tsx
|
|
7
|
-
var InlineCTA = forwardRef(function InlineCTA({ className, heading, description, action, icon, iconName = "circle-question", tone = "default", children, ...props }, ref) {
|
|
8
|
+
var InlineCTA = forwardRef(function InlineCTA({ className, heading, description, action, icon, iconName = "circle-question", tone = "default", dismissible = false, onDismiss, children, ...props }, ref) {
|
|
8
9
|
const resolvedIcon = icon ?? /* @__PURE__ */ jsx(Icon, {
|
|
9
10
|
name: iconName,
|
|
10
11
|
"aria-hidden": true
|
|
11
12
|
});
|
|
13
|
+
const { isExiting, startExit } = useExitAnimation({ onExited: onDismiss });
|
|
12
14
|
return /* @__PURE__ */ jsxs("div", {
|
|
13
15
|
ref,
|
|
14
|
-
className: cx("pf-inline-cta", `pf-inline-cta--${tone}`, className),
|
|
16
|
+
className: cx("pf-inline-cta", `pf-inline-cta--${tone}`, dismissible && "pf-inline-cta--dismissible", isExiting && "pf-inline-cta--exiting", className),
|
|
15
17
|
...props,
|
|
16
18
|
children: [
|
|
17
19
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -36,6 +38,16 @@ var InlineCTA = forwardRef(function InlineCTA({ className, heading, description,
|
|
|
36
38
|
action ? /* @__PURE__ */ jsx("div", {
|
|
37
39
|
className: "pf-inline-cta__action",
|
|
38
40
|
children: action
|
|
41
|
+
}) : null,
|
|
42
|
+
dismissible ? /* @__PURE__ */ jsx("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
className: "pf-inline-cta__dismiss",
|
|
45
|
+
"aria-label": "Dismiss",
|
|
46
|
+
onClick: startExit,
|
|
47
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
48
|
+
name: "circle-xmark",
|
|
49
|
+
"aria-hidden": true
|
|
50
|
+
})
|
|
39
51
|
}) : null
|
|
40
52
|
]
|
|
41
53
|
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.pf-field {
|
|
2
|
+
display: grid;
|
|
3
|
+
gap: var(--space-2);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.pf-field__label {
|
|
7
|
+
color: var(--pf-input-field-label, var(--pf-field-label));
|
|
8
|
+
font-size: var(--font-size-sm);
|
|
9
|
+
font-weight: var(--font-weight-medium);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.pf-field__required {
|
|
13
|
+
color: var(--pf-field-required);
|
|
14
|
+
margin-inline-start: var(--space-1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pf-field__description {
|
|
18
|
+
color: var(--pf-input-field-description, var(--pf-field-description));
|
|
19
|
+
font-size: var(--font-size-sm);
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.pf-field__error {
|
|
24
|
+
color: var(--pf-input-field-error, var(--pf-field-error));
|
|
25
|
+
font-size: var(--font-size-sm);
|
|
26
|
+
margin: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.pf-input {
|
|
30
|
+
background: var(--pf-input-bg);
|
|
31
|
+
border: 1px solid var(--pf-input-border);
|
|
32
|
+
border-radius: var(--radius-md);
|
|
33
|
+
color: var(--pf-input-text);
|
|
34
|
+
font: inherit;
|
|
35
|
+
min-height: 40px;
|
|
36
|
+
padding: 0 var(--space-3);
|
|
37
|
+
width: 100%;
|
|
38
|
+
transition:
|
|
39
|
+
background 0.2s,
|
|
40
|
+
border 0.2s,
|
|
41
|
+
color 0.2s,
|
|
42
|
+
opacity 0.2s;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.pf-input:disabled,
|
|
46
|
+
.pf-input[aria-disabled='true'] {
|
|
47
|
+
background: var(--pf-control-bg-disabled);
|
|
48
|
+
border-color: var(--pf-control-border-disabled);
|
|
49
|
+
color: var(--pf-control-text-disabled);
|
|
50
|
+
cursor: not-allowed;
|
|
51
|
+
opacity: 0.6;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.pf-input:focus {
|
|
55
|
+
outline: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.pf-input:focus-visible {
|
|
59
|
+
border-color: var(--pf-input-focus-border);
|
|
60
|
+
box-shadow: var(--pf-input-focus-ring, var(--pf-focus-ring));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.pf-input::placeholder {
|
|
64
|
+
color: var(--pf-input-placeholder);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.pf-input--invalid {
|
|
68
|
+
border-color: var(--pf-input-invalid-border);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media (prefers-reduced-motion: reduce) {
|
|
72
|
+
.pf-input {
|
|
73
|
+
transition: none;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cx } from "
|
|
2
|
-
import { FieldWrapper } from "
|
|
3
|
-
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import { FieldWrapper } from "../../utils/FieldWrapper.js";
|
|
3
|
+
import './Input.css';/* empty css */
|
|
4
4
|
import { forwardRef, useId } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/Input/Input.tsx
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* ─── Chart color palette ─────────────────────────────────────────────── */
|
|
2
|
+
:root {
|
|
3
|
+
--pf-chart-color-1: var(--color-brand-600);
|
|
4
|
+
--pf-chart-color-2: var(--color-brand-400);
|
|
5
|
+
--pf-chart-color-3: var(--color-gray-500);
|
|
6
|
+
--pf-chart-color-4: var(--color-gray-400);
|
|
7
|
+
--pf-chart-color-5: #0ea5e9;
|
|
8
|
+
--pf-chart-color-6: #22c55e;
|
|
9
|
+
--pf-chart-grid: var(--color-semantic-border-default);
|
|
10
|
+
--pf-chart-text-muted: var(--color-semantic-text-muted);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[data-theme='dark'] {
|
|
14
|
+
--pf-chart-color-1: var(--color-brand-400);
|
|
15
|
+
--pf-chart-color-2: var(--color-brand-300);
|
|
16
|
+
--pf-chart-color-3: var(--color-gray-400);
|
|
17
|
+
--pf-chart-color-4: var(--color-gray-500);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* ─── Container ──────────────────────────────────────────────────────── */
|
|
21
|
+
.pf-chart {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: var(--space-3);
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pf-chart__svg {
|
|
29
|
+
display: block;
|
|
30
|
+
height: auto;
|
|
31
|
+
overflow: visible;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.pf-chart__empty {
|
|
36
|
+
align-items: center;
|
|
37
|
+
color: var(--pf-chart-text-muted);
|
|
38
|
+
display: flex;
|
|
39
|
+
font-size: var(--font-size-sm);
|
|
40
|
+
height: 120px;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* ─── Grid & axes ────────────────────────────────────────────────────── */
|
|
45
|
+
.pf-chart__grid {
|
|
46
|
+
stroke: var(--pf-chart-grid);
|
|
47
|
+
stroke-width: 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.pf-chart__tick {
|
|
51
|
+
fill: var(--pf-chart-text-muted);
|
|
52
|
+
font-family: inherit;
|
|
53
|
+
font-size: var(--font-size-2xs);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.pf-chart__tick--y {
|
|
57
|
+
dominant-baseline: middle;
|
|
58
|
+
text-anchor: end;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.pf-chart__tick--x {
|
|
62
|
+
dominant-baseline: hanging;
|
|
63
|
+
text-anchor: middle;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.pf-chart__axis-label {
|
|
67
|
+
fill: var(--pf-chart-text-muted);
|
|
68
|
+
font-family: inherit;
|
|
69
|
+
font-size: var(--font-size-2xs);
|
|
70
|
+
text-anchor: middle;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* ─── Line dots ──────────────────────────────────────────────────────── */
|
|
74
|
+
.pf-chart__dot {
|
|
75
|
+
opacity: 0;
|
|
76
|
+
transition: opacity 80ms ease;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.pf-chart__svg:hover .pf-chart__dot {
|
|
80
|
+
opacity: 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* ─── Bars ───────────────────────────────────────────────────────────── */
|
|
84
|
+
.pf-chart__bar {
|
|
85
|
+
transition: opacity 80ms ease;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.pf-chart__bar:hover {
|
|
89
|
+
opacity: 0.75;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* ─── Legend ─────────────────────────────────────────────────────────── */
|
|
93
|
+
.pf-chart-legend {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-wrap: wrap;
|
|
96
|
+
gap: var(--space-2) var(--space-4);
|
|
97
|
+
list-style: none;
|
|
98
|
+
margin: 0;
|
|
99
|
+
padding: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.pf-chart-legend__item {
|
|
103
|
+
align-items: center;
|
|
104
|
+
color: var(--pf-chart-text-muted);
|
|
105
|
+
display: flex;
|
|
106
|
+
font-size: var(--font-size-sm);
|
|
107
|
+
gap: var(--space-2);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.pf-chart-legend__swatch {
|
|
111
|
+
border-radius: 50%;
|
|
112
|
+
flex-shrink: 0;
|
|
113
|
+
height: 8px;
|
|
114
|
+
width: 8px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@media (prefers-reduced-motion: reduce) {
|
|
118
|
+
.pf-chart__dot,
|
|
119
|
+
.pf-chart__bar {
|
|
120
|
+
transition: none;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cx } from "
|
|
2
|
-
|
|
1
|
+
import { cx } from "../../utils/cx.js";
|
|
2
|
+
import './LineBarChart.css';/* empty css */
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/LineBarCharts/LineBarChart.tsx
|
|
@@ -195,6 +195,14 @@ var LineChart = forwardRef(function LineChart({ className, data, series, yAxisLa
|
|
|
195
195
|
});
|
|
196
196
|
});
|
|
197
197
|
LineChart.displayName = "LineChart";
|
|
198
|
+
var AreaChart = forwardRef(function AreaChart(props, ref) {
|
|
199
|
+
return /* @__PURE__ */ jsx(LineChart, {
|
|
200
|
+
...props,
|
|
201
|
+
area: true,
|
|
202
|
+
ref
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
AreaChart.displayName = "AreaChart";
|
|
198
206
|
var BarChart = forwardRef(function BarChart({ className, data, series, yAxisLabel, showLegend = true, stacked = false, valueFormatter, ...props }, ref) {
|
|
199
207
|
if (!data.length || !series.length) return /* @__PURE__ */ jsx("div", {
|
|
200
208
|
ref,
|
|
@@ -261,4 +269,4 @@ var BarChart = forwardRef(function BarChart({ className, data, series, yAxisLabe
|
|
|
261
269
|
});
|
|
262
270
|
BarChart.displayName = "BarChart";
|
|
263
271
|
//#endregion
|
|
264
|
-
export { BarChart, LineChart };
|
|
272
|
+
export { AreaChart, BarChart, LineChart };
|