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.
Files changed (74) hide show
  1. package/README.md +54 -9
  2. package/components.css +476 -0
  3. package/dist/components/Alert/Alert.js +7 -16
  4. package/dist/components/Badge/Badge.js +1 -6
  5. package/dist/components/BarChart/BarChart.js +19 -15
  6. package/dist/components/BarList/BarList.js +2 -16
  7. package/dist/components/Card/Card.js +5 -3
  8. package/dist/components/CategoryBar/CategoryBar.js +88 -0
  9. package/dist/components/ChartLegend/ChartLegend.js +43 -0
  10. package/dist/components/Checkbox/Checkbox.js +1 -10
  11. package/dist/components/ColumnChart/ColumnChart.js +290 -0
  12. package/dist/components/CommandPalette/CommandPalette.js +3 -9
  13. package/dist/components/DescriptionList/DescriptionList.js +11 -14
  14. package/dist/components/Dialog/Dialog.js +1 -10
  15. package/dist/components/Disclosure/Disclosure.js +1 -4
  16. package/dist/components/DonutChart/DonutChart.js +54 -50
  17. package/dist/components/Dropdown/Dropdown.js +2 -11
  18. package/dist/components/FAQ/FAQ.js +36 -46
  19. package/dist/components/FeatureGrid/FeatureGrid.js +1 -5
  20. package/dist/components/FilterPill/FilterPill.js +1 -5
  21. package/dist/components/FormField/FormField.js +2 -15
  22. package/dist/components/Grid/Grid.js +1 -9
  23. package/dist/components/Heatmap/Heatmap.js +255 -0
  24. package/dist/components/HelpButton/HelpButton.js +1 -9
  25. package/dist/components/LPFooter/LPFooter.js +1 -10
  26. package/dist/components/LineChart/LineChart.js +314 -0
  27. package/dist/components/List/List.js +2 -15
  28. package/dist/components/Logo/Logo.js +1 -10
  29. package/dist/components/Meter/Meter.js +1 -4
  30. package/dist/components/Metric/Metric.js +2 -17
  31. package/dist/components/Navbar/Navbar.js +2 -10
  32. package/dist/components/NumberField/NumberField.js +30 -7
  33. package/dist/components/Pagination/Pagination.js +37 -46
  34. package/dist/components/Pricing/Pricing.js +2 -17
  35. package/dist/components/Progress/Progress.js +3 -18
  36. package/dist/components/Radio/Radio.js +2 -14
  37. package/dist/components/Search/Search.js +10 -1
  38. package/dist/components/Section/Section.js +4 -12
  39. package/dist/components/SegmentedControl/SegmentedControl.js +120 -0
  40. package/dist/components/Sidebar/Sidebar.js +7 -31
  41. package/dist/components/SplitSection/SplitSection.js +1 -5
  42. package/dist/components/StatusBadge/StatusBadge.js +1 -11
  43. package/dist/components/Stepper/Stepper.js +29 -27
  44. package/dist/components/Table/Table.js +5 -3
  45. package/dist/components/Tabs/Tabs.js +29 -36
  46. package/dist/components/Testimonial/Testimonial.js +19 -23
  47. package/dist/components/Text/Text.js +1 -11
  48. package/dist/components/Toast/Toast.js +103 -116
  49. package/dist/components/Tooltip/Tooltip.js +89 -92
  50. package/dist/components/TopBar/TopBar.js +4 -12
  51. package/dist/hooks/useLegendToggle.js +1 -4
  52. package/dist/hooks/useTheme.js +1 -4
  53. package/dist/index.js +12 -0
  54. package/dist/lib/chartScale.js +38 -0
  55. package/dist/types/components/CategoryBar/CategoryBar.d.ts +28 -0
  56. package/dist/types/components/CategoryBar/index.d.ts +2 -0
  57. package/dist/types/components/ChartLegend/ChartLegend.d.ts +17 -0
  58. package/dist/types/components/ChartLegend/index.d.ts +2 -0
  59. package/dist/types/components/ColumnChart/ColumnChart.d.ts +33 -0
  60. package/dist/types/components/ColumnChart/index.d.ts +2 -0
  61. package/dist/types/components/Dropdown/Dropdown.d.ts +2 -3
  62. package/dist/types/components/Heatmap/Heatmap.d.ts +49 -0
  63. package/dist/types/components/Heatmap/index.d.ts +2 -0
  64. package/dist/types/components/LineChart/LineChart.d.ts +40 -0
  65. package/dist/types/components/LineChart/index.d.ts +2 -0
  66. package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +21 -0
  67. package/dist/types/components/SegmentedControl/index.d.ts +2 -0
  68. package/dist/types/components/Sidebar/index.d.ts +1 -1
  69. package/dist/types/components/Toast/Toast.d.ts +1 -1
  70. package/dist/types/components/index.d.ts +13 -1
  71. package/dist/types/hooks/useTheme.d.ts +1 -1
  72. package/dist/types/lib/chartScale.d.ts +19 -0
  73. package/dist/types/lib/utils.d.ts +1 -1
  74. package/package.json +7 -3
@@ -2,13 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { cn } from "../../lib/utils.js";
4
4
  const BarList = forwardRef(
5
- ({
6
- data,
7
- sortOrder = "descending",
8
- valueFormatter,
9
- className,
10
- ...rest
11
- }, ref) => {
5
+ ({ data, sortOrder = "descending", valueFormatter, className, ...rest }, ref) => {
12
6
  const sorted = sortOrder === "none" ? data : [...data].sort(
13
7
  (a, b) => sortOrder === "ascending" ? a.value - b.value : b.value - a.value
14
8
  );
@@ -33,15 +27,7 @@ const BarList = forwardRef(
33
27
  /* @__PURE__ */ jsx("span", { className: "barlist__value", children: display })
34
28
  ] });
35
29
  const LinkComponent = item.as ?? "a";
36
- return item.href ? /* @__PURE__ */ jsx(
37
- LinkComponent,
38
- {
39
- href: item.href,
40
- className: "barlist__row barlist__row--link",
41
- children: content
42
- },
43
- i
44
- ) : /* @__PURE__ */ jsx("div", { className: "barlist__row", children: content }, i);
30
+ return item.href ? /* @__PURE__ */ jsx(LinkComponent, { href: item.href, className: "barlist__row barlist__row--link", children: content }, i) : /* @__PURE__ */ jsx("div", { className: "barlist__row", children: content }, i);
45
31
  }) });
46
32
  }
47
33
  );
@@ -33,9 +33,11 @@ const CardTitle = forwardRef(
33
33
  }
34
34
  );
35
35
  CardTitle.displayName = "CardTitle";
36
- const CardDescription = forwardRef(({ className, children, ...rest }, ref) => {
37
- return /* @__PURE__ */ jsx("p", { ref, className: cn("card__description", className), ...rest, children });
38
- });
36
+ const CardDescription = forwardRef(
37
+ ({ className, children, ...rest }, ref) => {
38
+ return /* @__PURE__ */ jsx("p", { ref, className: cn("card__description", className), ...rest, children });
39
+ }
40
+ );
39
41
  CardDescription.displayName = "CardDescription";
40
42
  const CardBody = forwardRef(
41
43
  ({ className, children, ...rest }, ref) => {
@@ -0,0 +1,88 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { cn } from "../../lib/utils.js";
4
+ const PALETTE_SIZE = 8;
5
+ const defaultFormat = (v) => v.toLocaleString("ja-JP");
6
+ const formatPercent = (ratio) => `${Math.round(ratio * 1e3) / 10}%`;
7
+ const CategoryBar = forwardRef(
8
+ ({
9
+ data,
10
+ marker,
11
+ showLabels = true,
12
+ showPercent = false,
13
+ height = 8,
14
+ formatValue = defaultFormat,
15
+ className,
16
+ "aria-label": ariaLabel,
17
+ ...rest
18
+ }, ref) => {
19
+ const items = data.map((d, i) => ({
20
+ ...d,
21
+ value: Math.max(0, Number.isFinite(d.value) ? d.value : 0),
22
+ color: d.color ?? `var(--chart-${i % PALETTE_SIZE + 1})`
23
+ }));
24
+ const total = items.reduce((sum, d) => sum + d.value, 0);
25
+ const ratioOf = (v) => total > 0 ? v / total : 0;
26
+ const markerPos = marker && total > 0 ? Math.min(1, Math.max(0, ratioOf(marker.value))) : null;
27
+ const describe = (d) => `${d.label} ${formatValue(d.value)}${showPercent ? ` (${formatPercent(ratioOf(d.value))})` : ""}`;
28
+ return /* @__PURE__ */ jsxs(
29
+ "div",
30
+ {
31
+ ref,
32
+ role: "img",
33
+ "aria-label": ariaLabel,
34
+ className: cn("category-bar", className),
35
+ ...rest,
36
+ children: [
37
+ /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
38
+ items.map(describe).join("、"),
39
+ marker ? `。${marker.label ?? "目標"} ${formatValue(marker.value)}` : ""
40
+ ] }),
41
+ /* @__PURE__ */ jsxs("div", { className: "category-bar__track", style: { height }, "aria-hidden": "true", children: [
42
+ items.map(
43
+ (d) => d.value > 0 && /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ className: "category-bar__segment",
47
+ style: { flexGrow: d.value, background: d.color },
48
+ title: describe(d)
49
+ },
50
+ d.label
51
+ )
52
+ ),
53
+ markerPos !== null && marker && /* @__PURE__ */ jsx(
54
+ "div",
55
+ {
56
+ className: "category-bar__marker",
57
+ style: { left: `${markerPos * 100}%`, height: height + 8 },
58
+ title: `${marker.label ?? "目標"} ${formatValue(marker.value)}`
59
+ }
60
+ )
61
+ ] }),
62
+ showLabels && /* @__PURE__ */ jsxs("ul", { className: "category-bar__legend", "aria-hidden": "true", children: [
63
+ items.map((d) => /* @__PURE__ */ jsxs("li", { className: "category-bar__legend-item", children: [
64
+ /* @__PURE__ */ jsx("span", { className: "category-bar__swatch", style: { background: d.color } }),
65
+ /* @__PURE__ */ jsx("span", { className: "category-bar__label", children: d.label }),
66
+ /* @__PURE__ */ jsxs("span", { className: "category-bar__value", children: [
67
+ formatValue(d.value),
68
+ showPercent && /* @__PURE__ */ jsxs("span", { className: "category-bar__percent", children: [
69
+ " ",
70
+ formatPercent(ratioOf(d.value))
71
+ ] })
72
+ ] })
73
+ ] }, d.label)),
74
+ marker?.label && /* @__PURE__ */ jsxs("li", { className: "category-bar__legend-item", children: [
75
+ /* @__PURE__ */ jsx("span", { className: "category-bar__swatch category-bar__swatch--marker" }),
76
+ /* @__PURE__ */ jsx("span", { className: "category-bar__label", children: marker.label }),
77
+ /* @__PURE__ */ jsx("span", { className: "category-bar__value", children: formatValue(marker.value) })
78
+ ] })
79
+ ] })
80
+ ]
81
+ }
82
+ );
83
+ }
84
+ );
85
+ CategoryBar.displayName = "CategoryBar";
86
+ export {
87
+ CategoryBar
88
+ };
@@ -0,0 +1,43 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { cn } from "../../lib/utils.js";
4
+ const ChartLegend = forwardRef(
5
+ ({ items, hidden = [], onToggle, className, ...rest }, ref) => {
6
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("chart-legend", className), ...rest, children: items.map((item) => {
7
+ const isHidden = hidden.includes(item.key);
8
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
9
+ /* @__PURE__ */ jsx(
10
+ "span",
11
+ {
12
+ className: "chart-legend__swatch",
13
+ style: { background: item.color },
14
+ "aria-hidden": "true"
15
+ }
16
+ ),
17
+ /* @__PURE__ */ jsx("span", { className: "chart-legend__label", children: item.label })
18
+ ] });
19
+ return onToggle ? /* @__PURE__ */ jsx(
20
+ "button",
21
+ {
22
+ type: "button",
23
+ className: cn("chart-legend__item", isHidden && "chart-legend__item--hidden"),
24
+ "aria-pressed": !isHidden,
25
+ onClick: () => onToggle(item.key),
26
+ children: content
27
+ },
28
+ item.key
29
+ ) : /* @__PURE__ */ jsx(
30
+ "span",
31
+ {
32
+ className: cn("chart-legend__item", isHidden && "chart-legend__item--hidden"),
33
+ children: content
34
+ },
35
+ item.key
36
+ );
37
+ }) });
38
+ }
39
+ );
40
+ ChartLegend.displayName = "ChartLegend";
41
+ export {
42
+ ChartLegend
43
+ };
@@ -6,16 +6,7 @@ const Checkbox = forwardRef(
6
6
  const generatedId = useId();
7
7
  const id = idProp ?? generatedId;
8
8
  return /* @__PURE__ */ jsxs("label", { htmlFor: id, className: cn("checkbox", className), children: [
9
- /* @__PURE__ */ jsx(
10
- "input",
11
- {
12
- ref,
13
- id,
14
- type: "checkbox",
15
- className: "checkbox__input",
16
- ...rest
17
- }
18
- ),
9
+ /* @__PURE__ */ jsx("input", { ref, id, type: "checkbox", className: "checkbox__input", ...rest }),
19
10
  label && /* @__PURE__ */ jsx("span", { children: label })
20
11
  ] });
21
12
  }
@@ -0,0 +1,290 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { forwardRef, useRef, useState, useEffect, useCallback, useMemo } 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 FALLBACK_WIDTH = 640;
9
+ const PAD_TOP = 8;
10
+ const PAD_RIGHT = 8;
11
+ const BAR_GAP = 2;
12
+ function toNumber(v) {
13
+ const n = typeof v === "number" ? v : Number(v);
14
+ return Number.isFinite(n) ? n : 0;
15
+ }
16
+ function barPath(x, y0, y1, w, radius, roundEnd) {
17
+ const h = Math.abs(y1 - y0);
18
+ if (h === 0 || w <= 0) return "";
19
+ const r = roundEnd ? Math.min(radius, w / 2, h) : 0;
20
+ const x1 = x + w;
21
+ if (y1 <= y0) {
22
+ return `M${x},${y0}V${y1 + r}${r ? `Q${x},${y1} ${x + r},${y1}` : ""}H${x1 - r}${r ? `Q${x1},${y1} ${x1},${y1 + r}` : ""}V${y0}Z`;
23
+ }
24
+ return `M${x},${y0}V${y1 - r}${r ? `Q${x},${y1} ${x + r},${y1}` : ""}H${x1 - r}${r ? `Q${x1},${y1} ${x1},${y1 - r}` : ""}V${y0}Z`;
25
+ }
26
+ const ColumnChart = forwardRef(
27
+ ({
28
+ data,
29
+ index,
30
+ series,
31
+ layout = "grouped",
32
+ height = 240,
33
+ showGrid = true,
34
+ showXAxis = true,
35
+ showYAxis = true,
36
+ showLegend = true,
37
+ yAxisWidth = 48,
38
+ formatValue = defaultFormat,
39
+ barRadius = 2,
40
+ "aria-label": ariaLabel,
41
+ className,
42
+ onKeyDown,
43
+ onBlur,
44
+ ...rest
45
+ }, ref) => {
46
+ const wrapRef = useRef(null);
47
+ const [width, setWidth] = useState(FALLBACK_WIDTH);
48
+ const [hidden, setHidden] = useState([]);
49
+ const [active, setActive] = useState(null);
50
+ useEffect(() => {
51
+ const el = wrapRef.current;
52
+ if (!el) return;
53
+ const measure = () => {
54
+ const w = el.clientWidth;
55
+ if (w > 0) setWidth(w);
56
+ };
57
+ measure();
58
+ if (typeof ResizeObserver === "undefined") return;
59
+ const ro = new ResizeObserver(measure);
60
+ ro.observe(el);
61
+ return () => ro.disconnect();
62
+ }, []);
63
+ const toggle = useCallback((key) => {
64
+ setHidden((prev) => prev.includes(key) ? prev.filter((k) => k !== key) : [...prev, key]);
65
+ }, []);
66
+ const colorOf = (s, i) => s.color ?? CHART_COLORS[i % CHART_COLORS.length] ?? "var(--chart-1)";
67
+ const visible = useMemo(() => series.filter((s) => !hidden.includes(s.key)), [series, hidden]);
68
+ const stacked = layout === "stacked";
69
+ const left = showYAxis ? yAxisWidth : 4;
70
+ const bottom = showXAxis ? 24 : 4;
71
+ const plotW = Math.max(width - left - PAD_RIGHT, 1);
72
+ const plotH = Math.max(height - PAD_TOP - bottom, 1);
73
+ const n = data.length;
74
+ const step = n > 0 ? plotW / n : plotW;
75
+ const scale = useMemo(() => {
76
+ let lo = 0;
77
+ let hi = 0;
78
+ for (const row of data) {
79
+ let pos = 0;
80
+ let neg = 0;
81
+ for (const s of visible) {
82
+ const v = toNumber(row[s.key]);
83
+ if (stacked) {
84
+ if (v >= 0) pos += v;
85
+ else neg += v;
86
+ } else {
87
+ lo = Math.min(lo, v);
88
+ hi = Math.max(hi, v);
89
+ }
90
+ }
91
+ if (stacked) {
92
+ lo = Math.min(lo, neg);
93
+ hi = Math.max(hi, pos);
94
+ }
95
+ }
96
+ return niceScale(lo, hi);
97
+ }, [data, visible, stacked]);
98
+ const y = linearScale([scale.min, scale.max], [PAD_TOP + plotH, PAD_TOP]);
99
+ const y0 = y(0);
100
+ const columns = useMemo(() => {
101
+ const groupW = step * 0.7;
102
+ return data.map((row, ci) => {
103
+ const gx = left + ci * step + (step - groupW) / 2;
104
+ const bars = [];
105
+ if (stacked) {
106
+ let pos = 0;
107
+ let neg = 0;
108
+ const lastPos = [...visible].reverse().find((s) => toNumber(row[s.key]) > 0)?.key;
109
+ const lastNeg = [...visible].reverse().find((s) => toNumber(row[s.key]) < 0)?.key;
110
+ for (const s of visible) {
111
+ const v = toNumber(row[s.key]);
112
+ if (v === 0) continue;
113
+ const from = v > 0 ? pos : neg;
114
+ const to = from + v;
115
+ if (v > 0) pos = to;
116
+ else neg = to;
117
+ bars.push({
118
+ key: s.key,
119
+ x: gx,
120
+ width: groupW,
121
+ from,
122
+ to,
123
+ roundEnd: s.key === (v > 0 ? lastPos : lastNeg)
124
+ });
125
+ }
126
+ } else {
127
+ const k = Math.max(visible.length, 1);
128
+ const bw = Math.max((groupW - BAR_GAP * (k - 1)) / k, 1);
129
+ visible.forEach((s, si) => {
130
+ bars.push({
131
+ key: s.key,
132
+ x: gx + si * (bw + BAR_GAP),
133
+ width: bw,
134
+ from: 0,
135
+ to: toNumber(row[s.key]),
136
+ roundEnd: true
137
+ });
138
+ });
139
+ }
140
+ return bars;
141
+ });
142
+ }, [data, visible, stacked, step, left]);
143
+ const labels = data.map((row) => String(row[index] ?? ""));
144
+ const longest = labels.reduce((m, l) => Math.max(m, l.length), 0);
145
+ const labelEvery = Math.max(1, Math.ceil((longest * 8 + 12) / step));
146
+ const onKey = (e) => {
147
+ onKeyDown?.(e);
148
+ if (e.defaultPrevented || n === 0) return;
149
+ let next;
150
+ if (e.key === "ArrowRight") next = active === null ? 0 : Math.min(active + 1, n - 1);
151
+ else if (e.key === "ArrowLeft") next = active === null ? n - 1 : Math.max(active - 1, 0);
152
+ else if (e.key === "Home") next = 0;
153
+ else if (e.key === "End") next = n - 1;
154
+ else if (e.key === "Escape") next = null;
155
+ else return;
156
+ e.preventDefault();
157
+ setActive(next ?? null);
158
+ };
159
+ const activeRow = active !== null ? data[active] : void 0;
160
+ const activeCenter = active !== null ? left + (active + 0.5) * step : 0;
161
+ const activeTotal = activeRow ? visible.reduce((sum, s) => sum + toNumber(activeRow[s.key]), 0) : 0;
162
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("chart", "column-chart", className), ...rest, children: [
163
+ /* @__PURE__ */ jsxs("div", { ref: wrapRef, className: "column-chart__plot", children: [
164
+ /* @__PURE__ */ jsx(
165
+ "div",
166
+ {
167
+ role: "img",
168
+ "aria-label": ariaLabel,
169
+ tabIndex: 0,
170
+ className: "column-chart__figure",
171
+ onKeyDown: onKey,
172
+ onBlur: (e) => {
173
+ onBlur?.(e);
174
+ setActive(null);
175
+ },
176
+ children: /* @__PURE__ */ jsxs(
177
+ "svg",
178
+ {
179
+ className: "chart__svg column-chart__svg",
180
+ width,
181
+ height,
182
+ viewBox: `0 0 ${width} ${height}`,
183
+ onPointerLeave: () => setActive(null),
184
+ "aria-hidden": "true",
185
+ children: [
186
+ showGrid && /* @__PURE__ */ jsx("g", { className: "chart-grid", children: scale.ticks.map((t) => /* @__PURE__ */ jsx("line", { x1: left, x2: left + plotW, y1: y(t), y2: y(t) }, t)) }),
187
+ showYAxis && /* @__PURE__ */ jsx("g", { className: "chart-axis column-chart__y-axis", children: scale.ticks.map((t) => /* @__PURE__ */ jsx("text", { x: left - 8, y: y(t), textAnchor: "end", dominantBaseline: "middle", children: formatValue(t) }, t)) }),
188
+ active !== null && /* @__PURE__ */ jsx(
189
+ "rect",
190
+ {
191
+ className: "column-chart__band",
192
+ x: left + active * step,
193
+ y: PAD_TOP,
194
+ width: step,
195
+ height: plotH
196
+ }
197
+ ),
198
+ columns.map((bars, ci) => /* @__PURE__ */ jsx("g", { className: "column-chart__column", children: bars.map((b) => {
199
+ const s = series.find((x) => x.key === b.key);
200
+ if (!s) return null;
201
+ return /* @__PURE__ */ jsx(
202
+ "path",
203
+ {
204
+ className: "column-chart__bar",
205
+ d: barPath(b.x, y(b.from), y(b.to), b.width, barRadius, b.roundEnd),
206
+ fill: colorOf(s, series.indexOf(s))
207
+ },
208
+ b.key
209
+ );
210
+ }) }, labels[ci] + String(ci))),
211
+ /* @__PURE__ */ jsxs("g", { className: "chart-axis", children: [
212
+ /* @__PURE__ */ jsx("line", { x1: left, x2: left + plotW, y1: y0, y2: y0 }),
213
+ showXAxis && labels.map(
214
+ (l, ci) => ci % labelEvery === 0 ? /* @__PURE__ */ jsx(
215
+ "text",
216
+ {
217
+ x: left + (ci + 0.5) * step,
218
+ y: PAD_TOP + plotH + 16,
219
+ textAnchor: "middle",
220
+ children: l
221
+ },
222
+ ci
223
+ ) : null
224
+ )
225
+ ] }),
226
+ labels.map((l, ci) => /* @__PURE__ */ jsx(
227
+ "rect",
228
+ {
229
+ className: "column-chart__hit",
230
+ x: left + ci * step,
231
+ y: PAD_TOP,
232
+ width: step,
233
+ height: plotH,
234
+ onPointerEnter: () => setActive(ci),
235
+ children: /* @__PURE__ */ jsx("title", { children: l })
236
+ },
237
+ ci
238
+ ))
239
+ ]
240
+ }
241
+ )
242
+ }
243
+ ),
244
+ activeRow && /* @__PURE__ */ jsxs(
245
+ "div",
246
+ {
247
+ className: "chart-tooltip column-chart__tooltip",
248
+ role: "status",
249
+ style: {
250
+ left: activeCenter,
251
+ top: PAD_TOP,
252
+ transform: activeCenter > width / 2 ? "translateX(calc(-100% - 12px))" : "translateX(12px)"
253
+ },
254
+ children: [
255
+ /* @__PURE__ */ jsx("div", { className: "chart-tooltip__title", children: labels[active ?? 0] }),
256
+ visible.map((s) => /* @__PURE__ */ jsxs("div", { className: "chart-tooltip__row", children: [
257
+ /* @__PURE__ */ jsx(
258
+ "span",
259
+ {
260
+ className: "chart-tooltip__swatch",
261
+ style: { background: colorOf(s, series.indexOf(s)) }
262
+ }
263
+ ),
264
+ /* @__PURE__ */ jsx("span", { className: "chart-tooltip__label", children: s.label }),
265
+ /* @__PURE__ */ jsx("span", { className: "chart-tooltip__value", children: formatValue(toNumber(activeRow[s.key])) })
266
+ ] }, s.key)),
267
+ stacked && visible.length > 1 && /* @__PURE__ */ jsxs("div", { className: "chart-tooltip__row column-chart__total", children: [
268
+ /* @__PURE__ */ jsx("span", { className: "chart-tooltip__label", children: "合計" }),
269
+ /* @__PURE__ */ jsx("span", { className: "chart-tooltip__value", children: formatValue(activeTotal) })
270
+ ] })
271
+ ]
272
+ }
273
+ )
274
+ ] }),
275
+ showLegend && /* @__PURE__ */ jsx(
276
+ ChartLegend,
277
+ {
278
+ className: "column-chart__legend",
279
+ items: series.map((s, i) => ({ key: s.key, label: s.label, color: colorOf(s, i) })),
280
+ hidden,
281
+ onToggle: toggle
282
+ }
283
+ )
284
+ ] });
285
+ }
286
+ );
287
+ ColumnChart.displayName = "ColumnChart";
288
+ export {
289
+ ColumnChart
290
+ };
@@ -62,9 +62,7 @@ const CommandPalette = forwardRef(
62
62
  }, [open]);
63
63
  useEffect(() => {
64
64
  if (!listRef.current) return;
65
- const items = listRef.current.querySelectorAll(
66
- "[data-command-item]"
67
- );
65
+ const items = listRef.current.querySelectorAll("[data-command-item]");
68
66
  const highlighted = items[highlightedIndex];
69
67
  highlighted?.scrollIntoView({ block: "nearest" });
70
68
  }, [highlightedIndex]);
@@ -84,16 +82,12 @@ const CommandPalette = forwardRef(
84
82
  switch (e.key) {
85
83
  case "ArrowDown": {
86
84
  e.preventDefault();
87
- setHighlightedIndex(
88
- (prev) => prev < flatList.length - 1 ? prev + 1 : 0
89
- );
85
+ setHighlightedIndex((prev) => prev < flatList.length - 1 ? prev + 1 : 0);
90
86
  break;
91
87
  }
92
88
  case "ArrowUp": {
93
89
  e.preventDefault();
94
- setHighlightedIndex(
95
- (prev) => prev > 0 ? prev - 1 : flatList.length - 1
96
- );
90
+ setHighlightedIndex((prev) => prev > 0 ? prev - 1 : flatList.length - 1);
97
91
  break;
98
92
  }
99
93
  case "Enter": {
@@ -1,20 +1,17 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { cn } from "../../lib/utils.js";
4
- const DescriptionList = forwardRef(({ horizontal, bordered, className, children, ...rest }, ref) => /* @__PURE__ */ jsx(
5
- "dl",
6
- {
7
- ref,
8
- className: cn(
9
- "dl",
10
- horizontal && "dl--horizontal",
11
- bordered && "dl--bordered",
12
- className
13
- ),
14
- ...rest,
15
- children
16
- }
17
- ));
4
+ const DescriptionList = forwardRef(
5
+ ({ horizontal, bordered, className, children, ...rest }, ref) => /* @__PURE__ */ jsx(
6
+ "dl",
7
+ {
8
+ ref,
9
+ className: cn("dl", horizontal && "dl--horizontal", bordered && "dl--bordered", className),
10
+ ...rest,
11
+ children
12
+ }
13
+ )
14
+ );
18
15
  DescriptionList.displayName = "DescriptionList";
19
16
  const DescriptionItem = forwardRef(
20
17
  ({ term, className, children, ...rest }, ref) => /* @__PURE__ */ jsxs("div", { ref, className: cn("dl__group", className), ...rest, children: [
@@ -97,16 +97,7 @@ DialogHeader.displayName = "DialogHeader";
97
97
  const DialogTitle = forwardRef(
98
98
  ({ className, children, id, ...rest }, ref) => {
99
99
  const contextId = useContext(DialogTitleIdContext);
100
- return /* @__PURE__ */ jsx(
101
- "h2",
102
- {
103
- ref,
104
- id: id ?? contextId,
105
- className: cn("dialog__title", className),
106
- ...rest,
107
- children
108
- }
109
- );
100
+ return /* @__PURE__ */ jsx("h2", { ref, id: id ?? contextId, className: cn("dialog__title", className), ...rest, children });
110
101
  }
111
102
  );
112
103
  DialogTitle.displayName = "DialogTitle";
@@ -100,10 +100,7 @@ const Disclosure = forwardRef(
100
100
  iconPosition === "left" && /* @__PURE__ */ jsx(
101
101
  "span",
102
102
  {
103
- className: cn(
104
- "disclosure__icon",
105
- isBuiltInIcon && "disclosure__icon--rotate"
106
- ),
103
+ className: cn("disclosure__icon", isBuiltInIcon && "disclosure__icon--rotate"),
107
104
  "aria-hidden": "true",
108
105
  children: markerNode
109
106
  }