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,33 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
export interface ColumnChartSeries {
|
|
3
|
+
/** Key of the numeric field in each data row */
|
|
4
|
+
key: string;
|
|
5
|
+
/** Display label (legend and tooltip) */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Any CSS color. Defaults to the shared chart palette */
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ColumnChartProps extends Omit<HTMLAttributes<HTMLDivElement>, "aria-label"> {
|
|
11
|
+
/** Rows of data. Each row holds a category label under `index` and one number per series key */
|
|
12
|
+
data: Record<string, string | number>[];
|
|
13
|
+
/** Field holding the category label (x axis) */
|
|
14
|
+
index: string;
|
|
15
|
+
series: ColumnChartSeries[];
|
|
16
|
+
/** "grouped" places series side by side, "stacked" stacks them (positive and negative separately) */
|
|
17
|
+
layout?: "grouped" | "stacked";
|
|
18
|
+
/** Chart height in px (legend excluded) */
|
|
19
|
+
height?: number;
|
|
20
|
+
showGrid?: boolean;
|
|
21
|
+
showXAxis?: boolean;
|
|
22
|
+
showYAxis?: boolean;
|
|
23
|
+
showLegend?: boolean;
|
|
24
|
+
/** Width in px reserved for y axis labels */
|
|
25
|
+
yAxisWidth?: number;
|
|
26
|
+
/** Formats axis labels and tooltip values */
|
|
27
|
+
formatValue?: (value: number) => string;
|
|
28
|
+
/** Corner radius of the bar end that faces away from the baseline */
|
|
29
|
+
barRadius?: number;
|
|
30
|
+
/** Accessible label for the chart (required for accessibility) */
|
|
31
|
+
"aria-label": string;
|
|
32
|
+
}
|
|
33
|
+
export declare const ColumnChart: import("react").ForwardRefExoticComponent<ColumnChartProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -15,10 +15,9 @@ export interface DropdownItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
children: ReactNode;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
19
|
-
}
|
|
18
|
+
export type DropdownSeparatorProps = Record<string, never>;
|
|
20
19
|
export declare const Dropdown: import("react").ForwardRefExoticComponent<DropdownProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
20
|
export declare const DropdownTrigger: import("react").ForwardRefExoticComponent<DropdownTriggerProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
22
21
|
export declare const DropdownMenu: import("react").ForwardRefExoticComponent<DropdownMenuProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
23
22
|
export declare const DropdownItem: import("react").ForwardRefExoticComponent<DropdownItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
-
export declare const DropdownSeparator: import("react").ForwardRefExoticComponent<DropdownSeparatorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
23
|
+
export declare const DropdownSeparator: import("react").ForwardRefExoticComponent<Omit<DropdownSeparatorProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
export interface HeatmapDatum {
|
|
3
|
+
/** Local calendar date as `YYYY-MM-DD` (no time zone conversion is applied) */
|
|
4
|
+
date: string;
|
|
5
|
+
value: number;
|
|
6
|
+
}
|
|
7
|
+
/** The cell passed to `formatTooltip`. `value` is `null` when there is no data. */
|
|
8
|
+
export interface HeatmapCell {
|
|
9
|
+
row?: string;
|
|
10
|
+
column?: string;
|
|
11
|
+
date?: string;
|
|
12
|
+
value: number | null;
|
|
13
|
+
}
|
|
14
|
+
export interface HeatmapProps extends Omit<HTMLAttributes<HTMLDivElement>, "aria-label"> {
|
|
15
|
+
/** `matrix`: arbitrary rows x columns / `calendar`: one cell per day, a week per column */
|
|
16
|
+
variant?: "matrix" | "calendar";
|
|
17
|
+
/** matrix: row labels (top to bottom) */
|
|
18
|
+
rows?: string[];
|
|
19
|
+
/** matrix: column labels (left to right) */
|
|
20
|
+
columns?: string[];
|
|
21
|
+
/** matrix: `values[row][column]`. `null` renders an empty cell with no data */
|
|
22
|
+
values?: (number | null)[][];
|
|
23
|
+
/** calendar: daily values. Duplicate dates are summed */
|
|
24
|
+
data?: HeatmapDatum[];
|
|
25
|
+
/** calendar: first day (`YYYY-MM-DD`). Defaults to the earliest date in `data` */
|
|
26
|
+
startDate?: string;
|
|
27
|
+
/** calendar: last day (`YYYY-MM-DD`). Defaults to the latest date in `data` */
|
|
28
|
+
endDate?: string;
|
|
29
|
+
/** calendar: first weekday of a week row. 0 = Sunday, 1 = Monday (default) */
|
|
30
|
+
weekStartsOn?: 0 | 1;
|
|
31
|
+
/** Base color of the scale (any CSS color). Default `var(--chart-1)` */
|
|
32
|
+
color?: string;
|
|
33
|
+
/** Number of non-empty steps (default 5) */
|
|
34
|
+
levels?: number;
|
|
35
|
+
/** Value that maps to the darkest step. Defaults to the data maximum */
|
|
36
|
+
max?: number;
|
|
37
|
+
/** Cell edge length in px (default 16) */
|
|
38
|
+
cellSize?: number;
|
|
39
|
+
/** Gap between cells in px (default 3) */
|
|
40
|
+
gap?: number;
|
|
41
|
+
/** Show the "少 ... 多" legend (default true) */
|
|
42
|
+
showLegend?: boolean;
|
|
43
|
+
formatValue?: (value: number) => string;
|
|
44
|
+
/** Replace the tooltip text. When omitted a title and value row are shown */
|
|
45
|
+
formatTooltip?: (cell: HeatmapCell) => string;
|
|
46
|
+
/** Accessible label for the chart (required for accessibility) */
|
|
47
|
+
"aria-label": string;
|
|
48
|
+
}
|
|
49
|
+
export declare const Heatmap: import("react").ForwardRefExoticComponent<HeatmapProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
export interface LineChartSeries {
|
|
3
|
+
/** Key of the value in each data row */
|
|
4
|
+
key: string;
|
|
5
|
+
/** Display label (legend and tooltip) */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Stroke color (defaults to the shared chart palette by series order) */
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
export type LineChartDatum = Record<string, string | number | null | undefined>;
|
|
11
|
+
export interface LineChartProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
12
|
+
/** One row per x point. Missing values (null / undefined) break the line. */
|
|
13
|
+
data: LineChartDatum[];
|
|
14
|
+
/** Key of the x axis label in each row (e.g. "month") */
|
|
15
|
+
index: string;
|
|
16
|
+
series: LineChartSeries[];
|
|
17
|
+
/** Chart height in px (default: 240) */
|
|
18
|
+
height?: number;
|
|
19
|
+
/** Fill the area under each line with a flat low-opacity color */
|
|
20
|
+
area?: boolean;
|
|
21
|
+
/** "monotone" is a monotone cubic interpolation that never overshoots (default: "linear") */
|
|
22
|
+
curve?: "linear" | "monotone";
|
|
23
|
+
/** Show horizontal grid lines (default: true) */
|
|
24
|
+
showGrid?: boolean;
|
|
25
|
+
/** Show x axis labels (default: true) */
|
|
26
|
+
showXAxis?: boolean;
|
|
27
|
+
/** Show y axis labels (default: true) */
|
|
28
|
+
showYAxis?: boolean;
|
|
29
|
+
/** Show the toggleable legend (default: true) */
|
|
30
|
+
showLegend?: boolean;
|
|
31
|
+
/** Always show point markers. The hovered point is shown regardless (default: false) */
|
|
32
|
+
showDots?: boolean;
|
|
33
|
+
/** Width reserved for y axis labels in px (default: 48) */
|
|
34
|
+
yAxisWidth?: number;
|
|
35
|
+
/** Format values for y axis and tooltip */
|
|
36
|
+
formatValue?: (value: number) => string;
|
|
37
|
+
/** Accessible description of the chart (required) */
|
|
38
|
+
"aria-label": string;
|
|
39
|
+
}
|
|
40
|
+
export declare const LineChart: import("react").ForwardRefExoticComponent<LineChartProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface SegmentedControlOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface SegmentedControlProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue" | "children"> {
|
|
8
|
+
options: SegmentedControlOption[];
|
|
9
|
+
/** Controlled value */
|
|
10
|
+
value?: string;
|
|
11
|
+
/** Initial value when uncontrolled */
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
size?: "sm" | "md";
|
|
15
|
+
/** Stretch to the container width with equal-width segments */
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
/** Group name, emitted on a hidden input for native form submission */
|
|
18
|
+
name?: string;
|
|
19
|
+
"aria-label": string;
|
|
20
|
+
}
|
|
21
|
+
export declare const SegmentedControl: import("react").ForwardRefExoticComponent<SegmentedControlProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Sidebar, NavItem, SidebarGroupLabel, SidebarDivider } from "./Sidebar";
|
|
2
|
-
export type { SidebarProps, NavItemProps, SidebarGroupLabelProps, SidebarDividerProps } from "./Sidebar";
|
|
2
|
+
export type { SidebarProps, NavItemProps, SidebarGroupLabelProps, SidebarDividerProps, } from "./Sidebar";
|
|
@@ -24,7 +24,7 @@ interface ToastContextValue {
|
|
|
24
24
|
toast: (options: ToastOptions) => void;
|
|
25
25
|
}
|
|
26
26
|
export declare function useToast(): ToastContextValue;
|
|
27
|
-
export declare function ToastProvider({ children, closeLabel, containerLabel }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare function ToastProvider({ children, closeLabel, containerLabel, }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export declare namespace ToastProvider {
|
|
29
29
|
var displayName: string;
|
|
30
30
|
}
|
|
@@ -14,6 +14,8 @@ export { Disclosure } from "./Disclosure";
|
|
|
14
14
|
export type { DisclosureProps, DisclosureIcon, DisclosureIconPosition, DisclosureSize, DisclosureVariant, } from "./Disclosure";
|
|
15
15
|
export { FilterPill } from "./FilterPill";
|
|
16
16
|
export type { FilterPillProps } from "./FilterPill";
|
|
17
|
+
export { SegmentedControl } from "./SegmentedControl";
|
|
18
|
+
export type { SegmentedControlProps, SegmentedControlOption } from "./SegmentedControl";
|
|
17
19
|
export { Input } from "./Input";
|
|
18
20
|
export type { InputProps } from "./Input";
|
|
19
21
|
export { Select } from "./Select";
|
|
@@ -41,7 +43,7 @@ export type { DialogProps, DialogHeaderProps, DialogTitleProps, DialogBodyProps,
|
|
|
41
43
|
export { Divider } from "./Divider";
|
|
42
44
|
export type { DividerProps } from "./Divider";
|
|
43
45
|
export { Sidebar, NavItem, SidebarGroupLabel, SidebarDivider } from "./Sidebar";
|
|
44
|
-
export type { SidebarProps, NavItemProps, SidebarGroupLabelProps, SidebarDividerProps } from "./Sidebar";
|
|
46
|
+
export type { SidebarProps, NavItemProps, SidebarGroupLabelProps, SidebarDividerProps, } from "./Sidebar";
|
|
45
47
|
export { TopBar } from "./TopBar";
|
|
46
48
|
export type { TopBarProps } from "./TopBar";
|
|
47
49
|
export { AppLayout } from "./Layout";
|
|
@@ -76,6 +78,16 @@ export { DonutChart } from "./DonutChart";
|
|
|
76
78
|
export type { DonutChartProps, DonutChartSegment } from "./DonutChart";
|
|
77
79
|
export { Sparkline } from "./Sparkline";
|
|
78
80
|
export type { SparklineProps } from "./Sparkline";
|
|
81
|
+
export { LineChart } from "./LineChart";
|
|
82
|
+
export type { LineChartProps, LineChartSeries, LineChartDatum } from "./LineChart";
|
|
83
|
+
export { ColumnChart } from "./ColumnChart";
|
|
84
|
+
export type { ColumnChartProps, ColumnChartSeries } from "./ColumnChart";
|
|
85
|
+
export { Heatmap } from "./Heatmap";
|
|
86
|
+
export type { HeatmapProps, HeatmapCell, HeatmapDatum } from "./Heatmap";
|
|
87
|
+
export { CategoryBar } from "./CategoryBar";
|
|
88
|
+
export type { CategoryBarProps, CategoryBarItem, CategoryBarMarker } from "./CategoryBar";
|
|
89
|
+
export { ChartLegend } from "./ChartLegend";
|
|
90
|
+
export type { ChartLegendProps, ChartLegendItem } from "./ChartLegend";
|
|
79
91
|
export { Alert } from "./Alert";
|
|
80
92
|
export type { AlertProps, AlertVariant } from "./Alert";
|
|
81
93
|
export { Progress } from "./Progress";
|
|
@@ -13,5 +13,5 @@ export interface ThemeProviderProps {
|
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
defaultTheme?: Theme;
|
|
15
15
|
}
|
|
16
|
-
export declare function ThemeProvider({ children, defaultTheme
|
|
16
|
+
export declare function ThemeProvider({ children, defaultTheme }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export declare function useTheme(): ThemeContextValue;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Shared numeric helpers for SVG charts (no runtime dependencies). */
|
|
2
|
+
export interface NiceScale {
|
|
3
|
+
/** Lower bound of the axis (a multiple of `step`) */
|
|
4
|
+
min: number;
|
|
5
|
+
/** Upper bound of the axis (a multiple of `step`) */
|
|
6
|
+
max: number;
|
|
7
|
+
step: number;
|
|
8
|
+
ticks: number[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Compute axis bounds and evenly spaced ticks that cover [min, max].
|
|
12
|
+
* Zero is always included when the data does not cross it, so bars and areas
|
|
13
|
+
* have a meaningful baseline.
|
|
14
|
+
*/
|
|
15
|
+
export declare function niceScale(dataMin: number, dataMax: number, tickCount?: number): NiceScale;
|
|
16
|
+
/** Linear map from a domain to a range. */
|
|
17
|
+
export declare function linearScale(domain: [number, number], range: [number, number]): (value: number) => number;
|
|
18
|
+
/** Default compact number formatter for axis labels (1,200 / 1.2万 style is left to callers). */
|
|
19
|
+
export declare function defaultFormat(value: number): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ClassValue } from "./types";
|
|
2
2
|
export declare function cn(...inputs: ClassValue[]): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kaze-design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/yuki930/kaze-design-system/issues"
|
|
14
14
|
},
|
|
15
|
-
"description": "Minimal React design system for dashboards, landing pages and Japanese UI: warm neutral grays,
|
|
15
|
+
"description": "Minimal React design system for dashboards, landing pages and Japanese UI: warm neutral grays, 69 components, SVG charts with zero dependencies, light/dark themes, typography tuned for CJK text",
|
|
16
16
|
"keywords": [
|
|
17
17
|
"design-system",
|
|
18
18
|
"react",
|
|
@@ -80,7 +80,10 @@
|
|
|
80
80
|
"build:lib": "rm -rf dist && vite build --config vite.config.lib.ts && tsc -p tsconfig.build.json",
|
|
81
81
|
"storybook": "storybook dev -p 6006",
|
|
82
82
|
"build-storybook": "storybook build",
|
|
83
|
-
"typecheck": "tsc --noEmit"
|
|
83
|
+
"typecheck": "tsc --noEmit",
|
|
84
|
+
"lint": "biome lint .",
|
|
85
|
+
"format": "biome format .",
|
|
86
|
+
"format:fix": "biome check --write ."
|
|
84
87
|
},
|
|
85
88
|
"peerDependencies": {
|
|
86
89
|
"lucide-react": "^0.575.0",
|
|
@@ -93,6 +96,7 @@
|
|
|
93
96
|
}
|
|
94
97
|
},
|
|
95
98
|
"devDependencies": {
|
|
99
|
+
"@biomejs/biome": "2.6.3",
|
|
96
100
|
"@chromatic-com/storybook": "^5.0.1",
|
|
97
101
|
"@storybook/addon-a11y": "^10.2.10",
|
|
98
102
|
"@storybook/addon-docs": "^10.2.10",
|