kaze-design-system 0.6.0 → 0.7.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 +54 -9
- package/components.css +476 -0
- package/dist/components/Alert/Alert.js +7 -16
- package/dist/components/Badge/Badge.js +1 -6
- package/dist/components/BarChart/BarChart.js +19 -15
- package/dist/components/BarList/BarList.js +2 -16
- package/dist/components/Card/Card.js +5 -3
- package/dist/components/CategoryBar/CategoryBar.js +88 -0
- package/dist/components/ChartLegend/ChartLegend.js +43 -0
- package/dist/components/Checkbox/Checkbox.js +1 -10
- package/dist/components/ColumnChart/ColumnChart.js +290 -0
- package/dist/components/CommandPalette/CommandPalette.js +3 -9
- package/dist/components/DescriptionList/DescriptionList.js +11 -14
- package/dist/components/Dialog/Dialog.js +1 -10
- package/dist/components/Disclosure/Disclosure.js +1 -4
- package/dist/components/DonutChart/DonutChart.js +54 -50
- package/dist/components/Dropdown/Dropdown.js +2 -11
- package/dist/components/FAQ/FAQ.js +36 -46
- package/dist/components/FeatureGrid/FeatureGrid.js +1 -5
- package/dist/components/FilterPill/FilterPill.js +1 -5
- package/dist/components/FormField/FormField.js +2 -15
- package/dist/components/Grid/Grid.js +1 -9
- package/dist/components/Heatmap/Heatmap.js +255 -0
- package/dist/components/HelpButton/HelpButton.js +1 -9
- package/dist/components/LPFooter/LPFooter.js +1 -10
- package/dist/components/LineChart/LineChart.js +314 -0
- package/dist/components/List/List.js +2 -15
- package/dist/components/Logo/Logo.js +1 -10
- package/dist/components/Meter/Meter.js +1 -4
- package/dist/components/Metric/Metric.js +2 -17
- package/dist/components/Navbar/Navbar.js +2 -10
- package/dist/components/NumberField/NumberField.js +30 -7
- package/dist/components/Pagination/Pagination.js +37 -46
- package/dist/components/Pricing/Pricing.js +2 -17
- package/dist/components/Progress/Progress.js +3 -18
- package/dist/components/Radio/Radio.js +2 -14
- package/dist/components/Search/Search.js +10 -1
- package/dist/components/Section/Section.js +4 -12
- package/dist/components/SegmentedControl/SegmentedControl.js +120 -0
- package/dist/components/Sidebar/Sidebar.js +7 -31
- package/dist/components/SplitSection/SplitSection.js +1 -5
- package/dist/components/StatusBadge/StatusBadge.js +1 -11
- package/dist/components/Stepper/Stepper.js +29 -27
- package/dist/components/Table/Table.js +5 -3
- package/dist/components/Tabs/Tabs.js +29 -36
- package/dist/components/Testimonial/Testimonial.js +19 -23
- package/dist/components/Text/Text.js +1 -11
- package/dist/components/Toast/Toast.js +103 -116
- package/dist/components/Tooltip/Tooltip.js +89 -92
- package/dist/components/TopBar/TopBar.js +4 -12
- package/dist/hooks/useLegendToggle.js +1 -4
- package/dist/hooks/useTheme.js +1 -4
- package/dist/index.js +12 -0
- package/dist/lib/chartScale.js +38 -0
- package/dist/types/components/CategoryBar/CategoryBar.d.ts +28 -0
- package/dist/types/components/CategoryBar/index.d.ts +2 -0
- package/dist/types/components/ChartLegend/ChartLegend.d.ts +17 -0
- package/dist/types/components/ChartLegend/index.d.ts +2 -0
- package/dist/types/components/ColumnChart/ColumnChart.d.ts +33 -0
- package/dist/types/components/ColumnChart/index.d.ts +2 -0
- package/dist/types/components/Dropdown/Dropdown.d.ts +2 -3
- package/dist/types/components/Heatmap/Heatmap.d.ts +49 -0
- package/dist/types/components/Heatmap/index.d.ts +2 -0
- package/dist/types/components/LineChart/LineChart.d.ts +40 -0
- package/dist/types/components/LineChart/index.d.ts +2 -0
- package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +21 -0
- package/dist/types/components/SegmentedControl/index.d.ts +2 -0
- package/dist/types/components/Sidebar/index.d.ts +1 -1
- package/dist/types/components/Toast/Toast.d.ts +1 -1
- package/dist/types/components/index.d.ts +13 -1
- package/dist/types/hooks/useTheme.d.ts +1 -1
- package/dist/types/lib/chartScale.d.ts +19 -0
- package/dist/types/lib/utils.d.ts +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useRef, useState, useEffect, useCallback } from "react";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { CHART_COLORS } from "../../lib/chartColors.js";
|
|
6
|
+
import { niceScale, linearScale, defaultFormat } from "../../lib/chartScale.js";
|
|
7
|
+
import { ChartLegend } from "../ChartLegend/ChartLegend.js";
|
|
8
|
+
const PAD_TOP = 8;
|
|
9
|
+
const PAD_BOTTOM = 24;
|
|
10
|
+
const PAD_RIGHT = 12;
|
|
11
|
+
const X_LABEL_MIN_GAP = 64;
|
|
12
|
+
const INITIAL_WIDTH = 600;
|
|
13
|
+
const num = (v) => Number(v.toFixed(2));
|
|
14
|
+
function toNumber(v) {
|
|
15
|
+
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
16
|
+
}
|
|
17
|
+
function splitRuns(points) {
|
|
18
|
+
const runs = [];
|
|
19
|
+
let cur = [];
|
|
20
|
+
for (const p of points) {
|
|
21
|
+
if (p) cur.push(p);
|
|
22
|
+
else if (cur.length) {
|
|
23
|
+
runs.push(cur);
|
|
24
|
+
cur = [];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (cur.length) runs.push(cur);
|
|
28
|
+
return runs;
|
|
29
|
+
}
|
|
30
|
+
const at = (arr, i) => arr[i];
|
|
31
|
+
function monotoneTangents(pts) {
|
|
32
|
+
const n = pts.length;
|
|
33
|
+
const d = [];
|
|
34
|
+
for (let i = 0; i < n - 1; i++) {
|
|
35
|
+
const p0 = at(pts, i);
|
|
36
|
+
const p1 = at(pts, i + 1);
|
|
37
|
+
d.push((p1.y - p0.y) / (p1.x - p0.x || 1));
|
|
38
|
+
}
|
|
39
|
+
const m = new Array(n).fill(0);
|
|
40
|
+
m[0] = at(d, 0);
|
|
41
|
+
m[n - 1] = at(d, n - 2);
|
|
42
|
+
for (let i = 1; i < n - 1; i++) {
|
|
43
|
+
const prev = at(d, i - 1);
|
|
44
|
+
const next = at(d, i);
|
|
45
|
+
m[i] = prev * next <= 0 ? 0 : (prev + next) / 2;
|
|
46
|
+
}
|
|
47
|
+
for (let i = 0; i < n - 1; i++) {
|
|
48
|
+
const di = at(d, i);
|
|
49
|
+
if (di === 0) {
|
|
50
|
+
m[i] = 0;
|
|
51
|
+
m[i + 1] = 0;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const a = at(m, i) / di;
|
|
55
|
+
const b = at(m, i + 1) / di;
|
|
56
|
+
const s = a * a + b * b;
|
|
57
|
+
if (s > 9) {
|
|
58
|
+
const t = 3 / Math.sqrt(s);
|
|
59
|
+
m[i] = t * a * di;
|
|
60
|
+
m[i + 1] = t * b * di;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return m;
|
|
64
|
+
}
|
|
65
|
+
function linePath(run, curve) {
|
|
66
|
+
const first = at(run, 0);
|
|
67
|
+
let d = `M${num(first.x)},${num(first.y)}`;
|
|
68
|
+
if (curve === "monotone" && run.length > 2) {
|
|
69
|
+
const m = monotoneTangents(run);
|
|
70
|
+
for (let i = 0; i < run.length - 1; i++) {
|
|
71
|
+
const p0 = at(run, i);
|
|
72
|
+
const p1 = at(run, i + 1);
|
|
73
|
+
const dx = (p1.x - p0.x) / 3;
|
|
74
|
+
d += `C${num(p0.x + dx)},${num(p0.y + at(m, i) * dx)},${num(p1.x - dx)},${num(p1.y - at(m, i + 1) * dx)},${num(p1.x)},${num(p1.y)}`;
|
|
75
|
+
}
|
|
76
|
+
return d;
|
|
77
|
+
}
|
|
78
|
+
for (let i = 1; i < run.length; i++) {
|
|
79
|
+
const p = at(run, i);
|
|
80
|
+
d += `L${num(p.x)},${num(p.y)}`;
|
|
81
|
+
}
|
|
82
|
+
return d;
|
|
83
|
+
}
|
|
84
|
+
const LineChart = forwardRef(
|
|
85
|
+
({
|
|
86
|
+
data,
|
|
87
|
+
index,
|
|
88
|
+
series,
|
|
89
|
+
height = 240,
|
|
90
|
+
area = false,
|
|
91
|
+
curve = "linear",
|
|
92
|
+
showGrid = true,
|
|
93
|
+
showXAxis = true,
|
|
94
|
+
showYAxis = true,
|
|
95
|
+
showLegend = true,
|
|
96
|
+
showDots = false,
|
|
97
|
+
yAxisWidth = 48,
|
|
98
|
+
formatValue = defaultFormat,
|
|
99
|
+
"aria-label": ariaLabel,
|
|
100
|
+
className,
|
|
101
|
+
...rest
|
|
102
|
+
}, ref) => {
|
|
103
|
+
const wrapRef = useRef(null);
|
|
104
|
+
const svgRef = useRef(null);
|
|
105
|
+
const [width, setWidth] = useState(INITIAL_WIDTH);
|
|
106
|
+
const [hidden, setHidden] = useState([]);
|
|
107
|
+
const [active, setActive] = useState(null);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const el = wrapRef.current;
|
|
110
|
+
if (!el) return;
|
|
111
|
+
const measure = () => {
|
|
112
|
+
const w = Math.round(el.getBoundingClientRect().width);
|
|
113
|
+
if (w > 0) setWidth(w);
|
|
114
|
+
};
|
|
115
|
+
measure();
|
|
116
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
117
|
+
const ro = new ResizeObserver(measure);
|
|
118
|
+
ro.observe(el);
|
|
119
|
+
return () => ro.disconnect();
|
|
120
|
+
}, []);
|
|
121
|
+
const toggle = useCallback((key) => {
|
|
122
|
+
setHidden((h) => h.includes(key) ? h.filter((k) => k !== key) : [...h, key]);
|
|
123
|
+
}, []);
|
|
124
|
+
const items = series.map((s, i) => ({
|
|
125
|
+
key: s.key,
|
|
126
|
+
label: s.label,
|
|
127
|
+
color: s.color ?? CHART_COLORS[i % CHART_COLORS.length] ?? "var(--chart-emerald)"
|
|
128
|
+
}));
|
|
129
|
+
const visible = items.filter((s) => !hidden.includes(s.key));
|
|
130
|
+
const n = data.length;
|
|
131
|
+
const padLeft = showYAxis ? yAxisWidth : 8;
|
|
132
|
+
const padBottom = showXAxis ? PAD_BOTTOM : 4;
|
|
133
|
+
const plotW = Math.max(width - padLeft - PAD_RIGHT, 1);
|
|
134
|
+
const plotH = Math.max(height - PAD_TOP - padBottom, 1);
|
|
135
|
+
let lo = Number.POSITIVE_INFINITY;
|
|
136
|
+
let hi = Number.NEGATIVE_INFINITY;
|
|
137
|
+
for (const s of visible) {
|
|
138
|
+
for (const row of data) {
|
|
139
|
+
const v = toNumber(row[s.key]);
|
|
140
|
+
if (v === null) continue;
|
|
141
|
+
lo = Math.min(lo, v);
|
|
142
|
+
hi = Math.max(hi, v);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (!Number.isFinite(lo)) {
|
|
146
|
+
lo = 0;
|
|
147
|
+
hi = 1;
|
|
148
|
+
}
|
|
149
|
+
const scale = niceScale(lo, hi, 5);
|
|
150
|
+
const yOf = linearScale([scale.min, scale.max], [PAD_TOP + plotH, PAD_TOP]);
|
|
151
|
+
const xOf = (i) => padLeft + (n <= 1 ? plotW / 2 : i / (n - 1) * plotW);
|
|
152
|
+
const labelStep = Math.max(1, Math.ceil(X_LABEL_MIN_GAP / (n <= 1 ? plotW : plotW / (n - 1))));
|
|
153
|
+
const indexFromPointer = (e) => {
|
|
154
|
+
const rect = svgRef.current?.getBoundingClientRect();
|
|
155
|
+
if (!rect || n === 0) return null;
|
|
156
|
+
const scaleX = rect.width ? width / rect.width : 1;
|
|
157
|
+
const x = (e.clientX - rect.left) * scaleX - padLeft;
|
|
158
|
+
if (n === 1) return 0;
|
|
159
|
+
return Math.min(n - 1, Math.max(0, Math.round(x / plotW * (n - 1))));
|
|
160
|
+
};
|
|
161
|
+
const onKeyDown = (e) => {
|
|
162
|
+
if (n === 0) return;
|
|
163
|
+
if (e.key === "ArrowRight") {
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
setActive((a) => a === null ? 0 : Math.min(n - 1, a + 1));
|
|
166
|
+
} else if (e.key === "ArrowLeft") {
|
|
167
|
+
e.preventDefault();
|
|
168
|
+
setActive((a) => a === null ? n - 1 : Math.max(0, a - 1));
|
|
169
|
+
} else if (e.key === "Home") {
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
setActive(0);
|
|
172
|
+
} else if (e.key === "End") {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
setActive(n - 1);
|
|
175
|
+
} else if (e.key === "Escape") {
|
|
176
|
+
setActive(null);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const activeX = active !== null && active < n ? xOf(active) : null;
|
|
180
|
+
const activeRow = active !== null ? data[active] : void 0;
|
|
181
|
+
const flip = activeX !== null && activeX > width / 2;
|
|
182
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cn("line-chart", className), ...rest, children: [
|
|
183
|
+
/* @__PURE__ */ jsxs("div", { ref: wrapRef, className: "chart", children: [
|
|
184
|
+
/* @__PURE__ */ jsxs(
|
|
185
|
+
"svg",
|
|
186
|
+
{
|
|
187
|
+
ref: svgRef,
|
|
188
|
+
className: "chart__svg line-chart__svg",
|
|
189
|
+
role: "img",
|
|
190
|
+
"aria-label": ariaLabel,
|
|
191
|
+
width,
|
|
192
|
+
height,
|
|
193
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
194
|
+
tabIndex: 0,
|
|
195
|
+
onPointerMove: (e) => setActive(indexFromPointer(e)),
|
|
196
|
+
onPointerLeave: () => setActive(null),
|
|
197
|
+
onKeyDown,
|
|
198
|
+
onBlur: () => setActive(null),
|
|
199
|
+
children: [
|
|
200
|
+
showGrid && /* @__PURE__ */ jsx("g", { className: "chart-grid", children: scale.ticks.map((t) => /* @__PURE__ */ jsx("line", { x1: padLeft, x2: padLeft + plotW, y1: yOf(t), y2: yOf(t) }, t)) }),
|
|
201
|
+
showYAxis && /* @__PURE__ */ jsx("g", { className: "chart-axis", children: scale.ticks.map((t) => /* @__PURE__ */ jsx(
|
|
202
|
+
"text",
|
|
203
|
+
{
|
|
204
|
+
x: padLeft - 8,
|
|
205
|
+
y: yOf(t),
|
|
206
|
+
textAnchor: "end",
|
|
207
|
+
dominantBaseline: "middle",
|
|
208
|
+
children: formatValue(t)
|
|
209
|
+
},
|
|
210
|
+
t
|
|
211
|
+
)) }),
|
|
212
|
+
showXAxis && /* @__PURE__ */ jsx("g", { className: "chart-axis", children: data.map(
|
|
213
|
+
(row, i) => i % labelStep === 0 ? /* @__PURE__ */ jsx(
|
|
214
|
+
"text",
|
|
215
|
+
{
|
|
216
|
+
x: xOf(i),
|
|
217
|
+
y: PAD_TOP + plotH + 16,
|
|
218
|
+
textAnchor: "middle",
|
|
219
|
+
children: String(row[index] ?? "")
|
|
220
|
+
},
|
|
221
|
+
i
|
|
222
|
+
) : null
|
|
223
|
+
) }),
|
|
224
|
+
visible.map((s) => {
|
|
225
|
+
const pts = data.map((row, i) => {
|
|
226
|
+
const v = toNumber(row[s.key]);
|
|
227
|
+
return v === null ? null : { x: xOf(i), y: yOf(v) };
|
|
228
|
+
});
|
|
229
|
+
const runs = splitRuns(pts);
|
|
230
|
+
const base = yOf(Math.max(scale.min, Math.min(0, scale.max)));
|
|
231
|
+
return /* @__PURE__ */ jsxs("g", { className: "line-chart__series", style: { color: s.color }, children: [
|
|
232
|
+
area && runs.filter((r) => r.length > 1).map((r) => /* @__PURE__ */ jsx(
|
|
233
|
+
"path",
|
|
234
|
+
{
|
|
235
|
+
className: "line-chart__area",
|
|
236
|
+
d: `${linePath(r, curve)}L${num(at(r, r.length - 1).x)},${num(base)}L${num(at(r, 0).x)},${num(base)}Z`
|
|
237
|
+
},
|
|
238
|
+
`a${at(r, 0).x}`
|
|
239
|
+
)),
|
|
240
|
+
runs.map(
|
|
241
|
+
(r) => r.length > 1 ? /* @__PURE__ */ jsx(
|
|
242
|
+
"path",
|
|
243
|
+
{
|
|
244
|
+
className: "line-chart__line",
|
|
245
|
+
d: linePath(r, curve)
|
|
246
|
+
},
|
|
247
|
+
`l${at(r, 0).x}`
|
|
248
|
+
) : /* @__PURE__ */ jsx(
|
|
249
|
+
"circle",
|
|
250
|
+
{
|
|
251
|
+
className: "line-chart__dot",
|
|
252
|
+
cx: at(r, 0).x,
|
|
253
|
+
cy: at(r, 0).y,
|
|
254
|
+
r: 3
|
|
255
|
+
},
|
|
256
|
+
`s${at(r, 0).x}`
|
|
257
|
+
)
|
|
258
|
+
),
|
|
259
|
+
showDots && runs.filter((r) => r.length > 1).flat().map((p) => /* @__PURE__ */ jsx("circle", { className: "line-chart__dot", cx: p.x, cy: p.y, r: 3 }, p.x)),
|
|
260
|
+
active !== null && pts[active] && /* @__PURE__ */ jsx(
|
|
261
|
+
"circle",
|
|
262
|
+
{
|
|
263
|
+
className: "line-chart__dot line-chart__dot--active",
|
|
264
|
+
cx: pts[active]?.x,
|
|
265
|
+
cy: pts[active]?.y,
|
|
266
|
+
r: 4.5
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
] }, s.key);
|
|
270
|
+
}),
|
|
271
|
+
activeX !== null && /* @__PURE__ */ jsx(
|
|
272
|
+
"line",
|
|
273
|
+
{
|
|
274
|
+
className: "chart-crosshair",
|
|
275
|
+
x1: activeX,
|
|
276
|
+
x2: activeX,
|
|
277
|
+
y1: PAD_TOP,
|
|
278
|
+
y2: PAD_TOP + plotH
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
activeRow && activeX !== null && /* @__PURE__ */ jsxs(
|
|
285
|
+
"div",
|
|
286
|
+
{
|
|
287
|
+
className: "chart-tooltip line-chart__tooltip",
|
|
288
|
+
style: {
|
|
289
|
+
left: activeX,
|
|
290
|
+
top: PAD_TOP,
|
|
291
|
+
transform: `translateX(${flip ? "calc(-100% - 12px)" : "12px"})`
|
|
292
|
+
},
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ jsx("div", { className: "chart-tooltip__title", children: String(activeRow[index] ?? "") }),
|
|
295
|
+
visible.map((s) => {
|
|
296
|
+
const v = toNumber(activeRow[s.key]);
|
|
297
|
+
return /* @__PURE__ */ jsxs("div", { className: "chart-tooltip__row", children: [
|
|
298
|
+
/* @__PURE__ */ jsx("span", { className: "chart-tooltip__swatch", style: { background: s.color } }),
|
|
299
|
+
/* @__PURE__ */ jsx("span", { className: "chart-tooltip__label", children: s.label }),
|
|
300
|
+
/* @__PURE__ */ jsx("span", { className: "chart-tooltip__value", children: v === null ? "-" : formatValue(v) })
|
|
301
|
+
] }, s.key);
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
] }),
|
|
307
|
+
showLegend && /* @__PURE__ */ jsx(ChartLegend, { items, hidden, onToggle: toggle })
|
|
308
|
+
] });
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
LineChart.displayName = "LineChart";
|
|
312
|
+
export {
|
|
313
|
+
LineChart
|
|
314
|
+
};
|
|
@@ -22,24 +22,11 @@ const List = forwardRef(
|
|
|
22
22
|
);
|
|
23
23
|
List.displayName = "List";
|
|
24
24
|
const ListItem = forwardRef(
|
|
25
|
-
({
|
|
26
|
-
leading,
|
|
27
|
-
trailing,
|
|
28
|
-
title,
|
|
29
|
-
description,
|
|
30
|
-
interactive,
|
|
31
|
-
className,
|
|
32
|
-
children,
|
|
33
|
-
...rest
|
|
34
|
-
}, ref) => /* @__PURE__ */ jsxs(
|
|
25
|
+
({ leading, trailing, title, description, interactive, className, children, ...rest }, ref) => /* @__PURE__ */ jsxs(
|
|
35
26
|
"li",
|
|
36
27
|
{
|
|
37
28
|
ref,
|
|
38
|
-
className: cn(
|
|
39
|
-
"list-item",
|
|
40
|
-
interactive && "list-item--interactive",
|
|
41
|
-
className
|
|
42
|
-
),
|
|
29
|
+
className: cn("list-item", interactive && "list-item--interactive", className),
|
|
43
30
|
...rest,
|
|
44
31
|
children: [
|
|
45
32
|
leading && /* @__PURE__ */ jsx("span", { className: "list-item__leading", children: leading }),
|
|
@@ -47,16 +47,7 @@ const Logo = forwardRef(
|
|
|
47
47
|
({ size = "md", showText = true, className, ...rest }, ref) => {
|
|
48
48
|
const iconSize = size === "sm" ? 18 : size === "lg" ? 32 : 22;
|
|
49
49
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("logo", className), ...rest, children: [
|
|
50
|
-
/* @__PURE__ */ jsx(
|
|
51
|
-
"div",
|
|
52
|
-
{
|
|
53
|
-
className: cn(
|
|
54
|
-
"logo__mark",
|
|
55
|
-
`logo__mark--${size}`
|
|
56
|
-
),
|
|
57
|
-
children: /* @__PURE__ */ jsx(WindMark, { size: iconSize })
|
|
58
|
-
}
|
|
59
|
-
),
|
|
50
|
+
/* @__PURE__ */ jsx("div", { className: cn("logo__mark", `logo__mark--${size}`), children: /* @__PURE__ */ jsx(WindMark, { size: iconSize }) }),
|
|
60
51
|
showText && /* @__PURE__ */ jsxs("span", { className: cn("logo__text", size === "lg" && "logo__text--lg"), children: [
|
|
61
52
|
"kaze",
|
|
62
53
|
/* @__PURE__ */ jsx("span", { className: "logo__kanji", children: "風" })
|
|
@@ -35,10 +35,7 @@ const Meter = forwardRef(
|
|
|
35
35
|
/* @__PURE__ */ jsxs(
|
|
36
36
|
"div",
|
|
37
37
|
{
|
|
38
|
-
className: cn(
|
|
39
|
-
"meter__track",
|
|
40
|
-
size !== "md" && `meter__track--${size}`
|
|
41
|
-
),
|
|
38
|
+
className: cn("meter__track", size !== "md" && `meter__track--${size}`),
|
|
42
39
|
role: "meter",
|
|
43
40
|
"aria-valuenow": value,
|
|
44
41
|
"aria-valuemin": min,
|
|
@@ -5,23 +5,8 @@ const Metric = forwardRef(
|
|
|
5
5
|
({ label, value, large, change, className, ...rest }, ref) => {
|
|
6
6
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("metric", className), ...rest, children: [
|
|
7
7
|
/* @__PURE__ */ jsx("span", { className: "metric__label", children: label }),
|
|
8
|
-
/* @__PURE__ */ jsx(
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
className: cn("metric__value", large && "metric__value--lg"),
|
|
12
|
-
children: value
|
|
13
|
-
}
|
|
14
|
-
),
|
|
15
|
-
change && /* @__PURE__ */ jsx(
|
|
16
|
-
"span",
|
|
17
|
-
{
|
|
18
|
-
className: cn(
|
|
19
|
-
"metric__change",
|
|
20
|
-
`metric__change--${change.trend}`
|
|
21
|
-
),
|
|
22
|
-
children: change.value
|
|
23
|
-
}
|
|
24
|
-
)
|
|
8
|
+
/* @__PURE__ */ jsx("span", { className: cn("metric__value", large && "metric__value--lg"), children: value }),
|
|
9
|
+
change && /* @__PURE__ */ jsx("span", { className: cn("metric__change", `metric__change--${change.trend}`), children: change.value })
|
|
25
10
|
] });
|
|
26
11
|
}
|
|
27
12
|
);
|
|
@@ -7,11 +7,7 @@ const Navbar = forwardRef(
|
|
|
7
7
|
"nav",
|
|
8
8
|
{
|
|
9
9
|
ref,
|
|
10
|
-
className: cn(
|
|
11
|
-
"navbar",
|
|
12
|
-
transparent && "navbar--transparent",
|
|
13
|
-
className
|
|
14
|
-
),
|
|
10
|
+
className: cn("navbar", transparent && "navbar--transparent", className),
|
|
15
11
|
...rest,
|
|
16
12
|
children: [
|
|
17
13
|
/* @__PURE__ */ jsxs("div", { className: "navbar__left", children: [
|
|
@@ -37,11 +33,7 @@ const NavbarLink = forwardRef(
|
|
|
37
33
|
Component,
|
|
38
34
|
{
|
|
39
35
|
ref,
|
|
40
|
-
className: cn(
|
|
41
|
-
"navbar__link",
|
|
42
|
-
active && "navbar__link--active",
|
|
43
|
-
className
|
|
44
|
-
),
|
|
36
|
+
className: cn("navbar__link", active && "navbar__link--active", className),
|
|
45
37
|
...rest,
|
|
46
38
|
children
|
|
47
39
|
}
|
|
@@ -23,7 +23,7 @@ function formatNumber(value, locale, currency) {
|
|
|
23
23
|
function parseLocaleNumber(str) {
|
|
24
24
|
const cleaned = str.replace(/[^\d.\-,]/g, "").replace(/,/g, "");
|
|
25
25
|
const num = Number(cleaned);
|
|
26
|
-
return isNaN(num) ? null : num;
|
|
26
|
+
return Number.isNaN(num) ? null : num;
|
|
27
27
|
}
|
|
28
28
|
const NumberField = forwardRef(
|
|
29
29
|
({
|
|
@@ -108,7 +108,8 @@ const NumberField = forwardRef(
|
|
|
108
108
|
};
|
|
109
109
|
useEffect(() => {
|
|
110
110
|
if (typeof ref === "function") ref(innerRef.current);
|
|
111
|
-
else if (ref)
|
|
111
|
+
else if (ref)
|
|
112
|
+
ref.current = innerRef.current;
|
|
112
113
|
});
|
|
113
114
|
const displayValue = editing ? editValue : value != null ? formatNumber(value, locale, currency) : "";
|
|
114
115
|
return /* @__PURE__ */ jsxs("div", { className: cn("number-field", error && "number-field--error", className), children: [
|
|
@@ -123,7 +124,18 @@ const NumberField = forwardRef(
|
|
|
123
124
|
disabled: disabled || min !== void 0 && (value ?? 0) <= min,
|
|
124
125
|
tabIndex: -1,
|
|
125
126
|
"aria-label": decrementLabel,
|
|
126
|
-
children: /* @__PURE__ */ jsx(
|
|
127
|
+
children: /* @__PURE__ */ jsx(
|
|
128
|
+
"svg",
|
|
129
|
+
{
|
|
130
|
+
width: "12",
|
|
131
|
+
height: "12",
|
|
132
|
+
viewBox: "0 0 12 12",
|
|
133
|
+
fill: "none",
|
|
134
|
+
stroke: "currentColor",
|
|
135
|
+
strokeWidth: "2",
|
|
136
|
+
children: /* @__PURE__ */ jsx("line", { x1: "2", y1: "6", x2: "10", y2: "6" })
|
|
137
|
+
}
|
|
138
|
+
)
|
|
127
139
|
}
|
|
128
140
|
),
|
|
129
141
|
resolvedPrefix && /* @__PURE__ */ jsx("span", { className: "number-field__affix", children: resolvedPrefix }),
|
|
@@ -156,10 +168,21 @@ const NumberField = forwardRef(
|
|
|
156
168
|
disabled: disabled || max !== void 0 && (value ?? 0) >= max,
|
|
157
169
|
tabIndex: -1,
|
|
158
170
|
"aria-label": incrementLabel,
|
|
159
|
-
children: /* @__PURE__ */ jsxs(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
171
|
+
children: /* @__PURE__ */ jsxs(
|
|
172
|
+
"svg",
|
|
173
|
+
{
|
|
174
|
+
width: "12",
|
|
175
|
+
height: "12",
|
|
176
|
+
viewBox: "0 0 12 12",
|
|
177
|
+
fill: "none",
|
|
178
|
+
stroke: "currentColor",
|
|
179
|
+
strokeWidth: "2",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "2", x2: "6", y2: "10" }),
|
|
182
|
+
/* @__PURE__ */ jsx("line", { x1: "2", y1: "6", x2: "10", y2: "6" })
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
)
|
|
163
186
|
}
|
|
164
187
|
)
|
|
165
188
|
] }),
|
|
@@ -25,52 +25,43 @@ const Pagination = forwardRef(
|
|
|
25
25
|
...rest
|
|
26
26
|
}, ref) => {
|
|
27
27
|
const pages = getPages(currentPage, totalPages, siblingCount);
|
|
28
|
-
return /* @__PURE__ */ jsxs(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
disabled: currentPage >= totalPages,
|
|
66
|
-
onClick: () => onPageChange?.(currentPage + 1),
|
|
67
|
-
"aria-label": nextLabel,
|
|
68
|
-
children: "›"
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
);
|
|
28
|
+
return /* @__PURE__ */ jsxs("nav", { ref, "aria-label": label, className: cn("pagination", className), ...rest, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
type: "button",
|
|
33
|
+
className: "pagination__btn",
|
|
34
|
+
disabled: currentPage <= 1,
|
|
35
|
+
onClick: () => onPageChange?.(currentPage - 1),
|
|
36
|
+
"aria-label": prevLabel,
|
|
37
|
+
children: "‹"
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
pages.map(
|
|
41
|
+
(page, i) => page === "..." ? /* @__PURE__ */ jsx("span", { className: "pagination__ellipsis", children: "…" }, `e${i}`) : /* @__PURE__ */ jsx(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
className: cn("pagination__btn", page === currentPage && "pagination__btn--active"),
|
|
46
|
+
onClick: () => onPageChange?.(page),
|
|
47
|
+
"aria-current": page === currentPage ? "page" : void 0,
|
|
48
|
+
children: page
|
|
49
|
+
},
|
|
50
|
+
page
|
|
51
|
+
)
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
type: "button",
|
|
57
|
+
className: "pagination__btn",
|
|
58
|
+
disabled: currentPage >= totalPages,
|
|
59
|
+
onClick: () => onPageChange?.(currentPage + 1),
|
|
60
|
+
"aria-label": nextLabel,
|
|
61
|
+
children: "›"
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] });
|
|
74
65
|
}
|
|
75
66
|
);
|
|
76
67
|
Pagination.displayName = "Pagination";
|
|
@@ -8,27 +8,12 @@ const PricingGrid = forwardRef(
|
|
|
8
8
|
);
|
|
9
9
|
PricingGrid.displayName = "PricingGrid";
|
|
10
10
|
const PricingCard = forwardRef(
|
|
11
|
-
({
|
|
12
|
-
name,
|
|
13
|
-
description,
|
|
14
|
-
price,
|
|
15
|
-
period,
|
|
16
|
-
features,
|
|
17
|
-
featured,
|
|
18
|
-
badge,
|
|
19
|
-
className,
|
|
20
|
-
children,
|
|
21
|
-
...rest
|
|
22
|
-
}, ref) => {
|
|
11
|
+
({ name, description, price, period, features, featured, badge, className, children, ...rest }, ref) => {
|
|
23
12
|
return /* @__PURE__ */ jsxs(
|
|
24
13
|
"div",
|
|
25
14
|
{
|
|
26
15
|
ref,
|
|
27
|
-
className: cn(
|
|
28
|
-
"pricing-card",
|
|
29
|
-
featured && "pricing-card--featured",
|
|
30
|
-
className
|
|
31
|
-
),
|
|
16
|
+
className: cn("pricing-card", featured && "pricing-card--featured", className),
|
|
32
17
|
...rest,
|
|
33
18
|
children: [
|
|
34
19
|
badge && /* @__PURE__ */ jsx("span", { className: "pricing-card__badge", children: badge }),
|
|
@@ -2,16 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { cn } from "../../lib/utils.js";
|
|
4
4
|
const Progress = forwardRef(
|
|
5
|
-
({
|
|
6
|
-
value,
|
|
7
|
-
max = 100,
|
|
8
|
-
label,
|
|
9
|
-
showValue,
|
|
10
|
-
color = "default",
|
|
11
|
-
size = "md",
|
|
12
|
-
className,
|
|
13
|
-
...rest
|
|
14
|
-
}, ref) => {
|
|
5
|
+
({ value, max = 100, label, showValue, color = "default", size = "md", className, ...rest }, ref) => {
|
|
15
6
|
const pct = Math.min(100, Math.max(0, value / max * 100));
|
|
16
7
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("progress", className), ...rest, children: [
|
|
17
8
|
(label || showValue) && /* @__PURE__ */ jsxs("div", { className: "progress__label-row", children: [
|
|
@@ -24,10 +15,7 @@ const Progress = forwardRef(
|
|
|
24
15
|
/* @__PURE__ */ jsx(
|
|
25
16
|
"div",
|
|
26
17
|
{
|
|
27
|
-
className: cn(
|
|
28
|
-
"progress__track",
|
|
29
|
-
size !== "md" && `progress__track--${size}`
|
|
30
|
-
),
|
|
18
|
+
className: cn("progress__track", size !== "md" && `progress__track--${size}`),
|
|
31
19
|
role: "progressbar",
|
|
32
20
|
"aria-label": label,
|
|
33
21
|
"aria-valuenow": value,
|
|
@@ -36,10 +24,7 @@ const Progress = forwardRef(
|
|
|
36
24
|
children: /* @__PURE__ */ jsx(
|
|
37
25
|
"div",
|
|
38
26
|
{
|
|
39
|
-
className: cn(
|
|
40
|
-
"progress__fill",
|
|
41
|
-
color !== "default" && `progress__fill--${color}`
|
|
42
|
-
),
|
|
27
|
+
className: cn("progress__fill", color !== "default" && `progress__fill--${color}`),
|
|
43
28
|
style: { width: `${pct}%` }
|
|
44
29
|
}
|
|
45
30
|
)
|