kaze-design-system 0.10.2 → 0.10.4
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/CHANGELOG.md +14 -0
- package/dist/components/Alert/Alert.js +28 -28
- package/dist/components/Avatar/Avatar.js +22 -21
- package/dist/components/Badge/Badge.js +19 -25
- package/dist/components/BarChart/BarChart.js +48 -38
- package/dist/components/BarList/BarList.js +42 -43
- package/dist/components/Breadcrumb/Breadcrumb.js +27 -10
- package/dist/components/Button/Button.js +21 -44
- package/dist/components/CTABanner/CTABanner.js +25 -14
- package/dist/components/Card/Card.js +52 -54
- package/dist/components/CategoryBar/CategoryBar.js +88 -86
- package/dist/components/ChartLegend/ChartLegend.js +32 -41
- package/dist/components/Checkbox/Checkbox.js +20 -25
- package/dist/components/ColumnChart/ColumnChart.js +274 -268
- package/dist/components/CommandPalette/CommandPalette.js +166 -233
- package/dist/components/DescriptionList/DescriptionList.js +22 -23
- package/dist/components/Dialog/Dialog.js +133 -153
- package/dist/components/Disclosure/Disclosure.js +94 -139
- package/dist/components/Divider/Divider.js +17 -28
- package/dist/components/DonutChart/DonutChart.js +91 -105
- package/dist/components/Dropdown/Dropdown.js +236 -244
- package/dist/components/EmptyState/EmptyState.js +28 -22
- package/dist/components/FAB/FAB.js +25 -49
- package/dist/components/FAQ/FAQ.js +58 -55
- package/dist/components/FeatureGrid/FeatureGrid.js +33 -28
- package/dist/components/FilterPill/FilterPill.js +23 -26
- package/dist/components/FormField/FormField.js +61 -55
- package/dist/components/Grid/Grid.js +35 -39
- package/dist/components/Heading/Heading.js +15 -27
- package/dist/components/Heatmap/Heatmap.js +245 -253
- package/dist/components/HelpButton/HelpButton.js +101 -116
- package/dist/components/Hero/Hero.js +47 -38
- package/dist/components/Icon/Icon.js +26 -18
- package/dist/components/Input/Input.js +13 -19
- package/dist/components/LPFooter/LPFooter.js +40 -25
- package/dist/components/Layout/Layout.js +18 -16
- package/dist/components/LineChart/LineChart.js +275 -290
- package/dist/components/List/List.js +55 -47
- package/dist/components/Logo/Logo.js +50 -57
- package/dist/components/Meter/Meter.js +56 -75
- package/dist/components/Metric/Metric.js +25 -14
- package/dist/components/Navbar/Navbar.js +35 -46
- package/dist/components/NumberField/NumberField.js +228 -220
- package/dist/components/Pagination/Pagination.js +60 -84
- package/dist/components/Pricing/Pricing.js +65 -60
- package/dist/components/Progress/Progress.js +36 -39
- package/dist/components/Radio/Radio.js +62 -61
- package/dist/components/Search/Search.js +62 -91
- package/dist/components/Section/Section.js +29 -32
- package/dist/components/SegmentedControl/SegmentedControl.js +88 -118
- package/dist/components/Select/Select.js +14 -20
- package/dist/components/Sidebar/Sidebar.js +58 -51
- package/dist/components/Skeleton/Skeleton.js +15 -17
- package/dist/components/Sparkline/Sparkline.js +35 -50
- package/dist/components/SplitSection/SplitSection.js +21 -24
- package/dist/components/Stats/Stats.js +33 -20
- package/dist/components/StatusBadge/StatusBadge.js +37 -18
- package/dist/components/Stepper/Stepper.js +48 -65
- package/dist/components/Switch/Switch.js +30 -26
- package/dist/components/Table/Table.js +56 -40
- package/dist/components/Tabs/Tabs.js +152 -164
- package/dist/components/Testimonial/Testimonial.js +40 -26
- package/dist/components/Text/Text.js +10 -25
- package/dist/components/Textarea/Textarea.js +13 -19
- package/dist/components/Timeline/Timeline.js +35 -26
- package/dist/components/Toast/Toast.js +230 -242
- package/dist/components/Tooltip/Tooltip.js +175 -182
- package/dist/components/TopBar/TopBar.js +15 -13
- package/dist/components/Tracker/Tracker.js +40 -46
- package/dist/components/Watermark/Watermark.js +51 -78
- package/dist/components/_internal/aria.js +7 -7
- package/dist/hooks/ThemeScript.js +14 -5
- package/dist/hooks/useFocusTrap.js +57 -55
- package/dist/hooks/useLegendToggle.js +51 -44
- package/dist/hooks/useTheme.js +83 -91
- package/dist/hooks.js +2 -8
- package/dist/index.js +57 -167
- package/dist/lib/Slot.js +42 -43
- package/dist/lib/chartColors.js +16 -16
- package/dist/lib/chartScale.js +35 -30
- package/dist/lib/composeEventHandlers.js +11 -7
- package/dist/lib/deprecate.js +24 -20
- package/dist/lib/jaText.js +26 -13
- package/dist/lib/useChartWidth.js +29 -25
- package/dist/lib/utils.js +3 -4
- package/dist/marketing.js +7 -27
- package/dist/tokens.js +93 -93
- package/dist/utils/scrollLock.js +40 -29
- package/package.json +8 -9
|
@@ -1,88 +1,90 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
1
|
import { cn } from "../../lib/utils.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
)
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/CategoryBar/CategoryBar.tsx
|
|
5
|
+
var PALETTE_SIZE = 8;
|
|
6
|
+
var defaultFormat = (v) => v.toLocaleString("ja-JP");
|
|
7
|
+
var formatPercent = (ratio) => `${Math.round(ratio * 1e3) / 10}%`;
|
|
8
|
+
var CategoryBar = forwardRef(({ data, marker, showLabels = true, showPercent = false, height = 8, formatValue = defaultFormat, className, "aria-label": ariaLabel, ...rest }, ref) => {
|
|
9
|
+
const items = data.map((d, i) => ({
|
|
10
|
+
...d,
|
|
11
|
+
value: Math.max(0, Number.isFinite(d.value) ? d.value : 0),
|
|
12
|
+
color: d.color ?? `var(--chart-${i % PALETTE_SIZE + 1})`
|
|
13
|
+
}));
|
|
14
|
+
const total = items.reduce((sum, d) => sum + d.value, 0);
|
|
15
|
+
const ratioOf = (v) => total > 0 ? v / total : 0;
|
|
16
|
+
const markerPos = marker && total > 0 ? Math.min(1, Math.max(0, ratioOf(marker.value))) : null;
|
|
17
|
+
const describe = (d) => `${d.label} ${formatValue(d.value)}${showPercent ? ` (${formatPercent(ratioOf(d.value))})` : ""}`;
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
ref,
|
|
20
|
+
role: "img",
|
|
21
|
+
"aria-label": ariaLabel,
|
|
22
|
+
className: cn("category-bar", className),
|
|
23
|
+
...rest,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsxs("span", {
|
|
26
|
+
className: "sr-only",
|
|
27
|
+
children: [items.map(describe).join("、"), marker ? `。${marker.label ?? "目標"} ${formatValue(marker.value)}` : ""]
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: "category-bar__track",
|
|
31
|
+
style: { height },
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
children: [items.map((d) => d.value > 0 && /* @__PURE__ */ jsx("div", {
|
|
34
|
+
className: "category-bar__segment",
|
|
35
|
+
style: {
|
|
36
|
+
flexGrow: d.value,
|
|
37
|
+
background: d.color
|
|
38
|
+
},
|
|
39
|
+
title: describe(d)
|
|
40
|
+
}, d.label)), markerPos !== null && marker && /* @__PURE__ */ jsx("div", {
|
|
41
|
+
className: "category-bar__marker",
|
|
42
|
+
style: {
|
|
43
|
+
left: `${markerPos * 100}%`,
|
|
44
|
+
height: height + 8
|
|
45
|
+
},
|
|
46
|
+
title: `${marker.label ?? "目標"} ${formatValue(marker.value)}`
|
|
47
|
+
})]
|
|
48
|
+
}),
|
|
49
|
+
showLabels && /* @__PURE__ */ jsxs("ul", {
|
|
50
|
+
className: "category-bar__legend",
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
children: [items.map((d) => /* @__PURE__ */ jsxs("li", {
|
|
53
|
+
className: "category-bar__legend-item",
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: "category-bar__swatch",
|
|
57
|
+
style: { background: d.color }
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: "category-bar__label",
|
|
61
|
+
children: d.label
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ jsxs("span", {
|
|
64
|
+
className: "category-bar__value",
|
|
65
|
+
children: [formatValue(d.value), showPercent && /* @__PURE__ */ jsxs("span", {
|
|
66
|
+
className: "category-bar__percent",
|
|
67
|
+
children: [" ", formatPercent(ratioOf(d.value))]
|
|
68
|
+
})]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
}, d.label)), marker?.label && /* @__PURE__ */ jsxs("li", {
|
|
72
|
+
className: "category-bar__legend-item",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx("span", { className: "category-bar__swatch category-bar__swatch--marker" }),
|
|
75
|
+
/* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "category-bar__label",
|
|
77
|
+
children: marker.label
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx("span", {
|
|
80
|
+
className: "category-bar__value",
|
|
81
|
+
children: formatValue(marker.value)
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})]
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
});
|
|
85
89
|
CategoryBar.displayName = "CategoryBar";
|
|
86
|
-
export {
|
|
87
|
-
CategoryBar
|
|
88
|
-
};
|
|
90
|
+
export { CategoryBar };
|
|
@@ -1,43 +1,34 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
1
|
import { cn } from "../../lib/utils.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
item.key
|
|
36
|
-
);
|
|
37
|
-
}) });
|
|
38
|
-
}
|
|
39
|
-
);
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/ChartLegend/ChartLegend.tsx
|
|
5
|
+
var ChartLegend = forwardRef(({ items, hidden = [], onToggle, className, ...rest }, ref) => {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
ref,
|
|
8
|
+
className: cn("chart-legend", className),
|
|
9
|
+
...rest,
|
|
10
|
+
children: items.map((item) => {
|
|
11
|
+
const isHidden = hidden.includes(item.key);
|
|
12
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
13
|
+
className: "chart-legend__swatch",
|
|
14
|
+
style: { background: item.color },
|
|
15
|
+
"aria-hidden": "true"
|
|
16
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
17
|
+
className: "chart-legend__label",
|
|
18
|
+
children: item.label
|
|
19
|
+
})] });
|
|
20
|
+
return onToggle ? /* @__PURE__ */ jsx("button", {
|
|
21
|
+
type: "button",
|
|
22
|
+
className: cn("chart-legend__item", isHidden && "chart-legend__item--hidden"),
|
|
23
|
+
"aria-pressed": !isHidden,
|
|
24
|
+
onClick: () => onToggle(item.key),
|
|
25
|
+
children: content
|
|
26
|
+
}, item.key) : /* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: cn("chart-legend__item", isHidden && "chart-legend__item--hidden"),
|
|
28
|
+
children: content
|
|
29
|
+
}, item.key);
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
});
|
|
40
33
|
ChartLegend.displayName = "ChartLegend";
|
|
41
|
-
export {
|
|
42
|
-
ChartLegend
|
|
43
|
-
};
|
|
34
|
+
export { ChartLegend };
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useId } from "react";
|
|
3
1
|
import { cn } from "../../lib/utils.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
5
|
+
var Checkbox = forwardRef(({ label, error, className, id: idProp, "aria-invalid": ariaInvalid, ...rest }, ref) => {
|
|
6
|
+
const generatedId = useId();
|
|
7
|
+
const id = idProp ?? generatedId;
|
|
8
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
9
|
+
htmlFor: id,
|
|
10
|
+
className: cn("checkbox", className),
|
|
11
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
12
|
+
ref,
|
|
13
|
+
id,
|
|
14
|
+
type: "checkbox",
|
|
15
|
+
className: "checkbox__input",
|
|
16
|
+
"aria-invalid": error ? "true" : ariaInvalid,
|
|
17
|
+
...rest
|
|
18
|
+
}), label && /* @__PURE__ */ jsx("span", { children: label })]
|
|
19
|
+
});
|
|
20
|
+
});
|
|
24
21
|
Checkbox.displayName = "Checkbox";
|
|
25
|
-
export {
|
|
26
|
-
Checkbox
|
|
27
|
-
};
|
|
22
|
+
export { Checkbox };
|