@robr0/design-system 0.1.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/LICENSE +21 -0
- package/README.md +127 -0
- package/charts.d.ts +14 -0
- package/charts.js +20 -0
- package/components/Accordion/Accordion.css +119 -0
- package/components/Accordion/Accordion.d.ts +24 -0
- package/components/Accordion/Accordion.js +76 -0
- package/components/Alert/Alert.css +252 -0
- package/components/Alert/Alert.d.ts +24 -0
- package/components/Alert/Alert.js +53 -0
- package/components/AlertDialog/AlertDialog.css +131 -0
- package/components/AlertDialog/AlertDialog.d.ts +29 -0
- package/components/AlertDialog/AlertDialog.js +143 -0
- package/components/AppLayout/AppLayout.css +52 -0
- package/components/AppLayout/AppLayout.d.ts +27 -0
- package/components/AppLayout/AppLayout.js +45 -0
- package/components/AppSidebar/AppSidebar.css +434 -0
- package/components/AppSidebar/AppSidebar.d.ts +67 -0
- package/components/AppSidebar/AppSidebar.js +272 -0
- package/components/Avatar/Avatar.css +133 -0
- package/components/Avatar/Avatar.d.ts +20 -0
- package/components/Avatar/Avatar.js +56 -0
- package/components/Avatar/demoAvatars.d.ts +14 -0
- package/components/Avatar/demoAvatars.js +16 -0
- package/components/Badge/Badge.css +68 -0
- package/components/Badge/Badge.d.ts +13 -0
- package/components/Badge/Badge.js +15 -0
- package/components/Breadcrumb/Breadcrumb.css +92 -0
- package/components/Breadcrumb/Breadcrumb.d.ts +19 -0
- package/components/Breadcrumb/Breadcrumb.js +39 -0
- package/components/Button/Button.css +381 -0
- package/components/Button/Button.d.ts +39 -0
- package/components/Button/Button.js +71 -0
- package/components/ButtonGroup/ButtonGroup.css +39 -0
- package/components/ButtonGroup/ButtonGroup.d.ts +13 -0
- package/components/ButtonGroup/ButtonGroup.js +37 -0
- package/components/Card/Card.css +169 -0
- package/components/Card/Card.d.ts +30 -0
- package/components/Card/Card.js +90 -0
- package/components/Carousel/Carousel.css +112 -0
- package/components/Carousel/Carousel.d.ts +25 -0
- package/components/Carousel/Carousel.js +126 -0
- package/components/Chart/AreaChart.d.ts +36 -0
- package/components/Chart/AreaChart.js +99 -0
- package/components/Chart/BarChart.d.ts +34 -0
- package/components/Chart/BarChart.js +107 -0
- package/components/Chart/Chart.css +176 -0
- package/components/Chart/LineChart.d.ts +34 -0
- package/components/Chart/LineChart.js +90 -0
- package/components/Chart/PieChart.d.ts +34 -0
- package/components/Chart/PieChart.js +106 -0
- package/components/Chart/RadarChart.d.ts +34 -0
- package/components/Chart/RadarChart.js +91 -0
- package/components/Chart/RadialChart.d.ts +37 -0
- package/components/Chart/RadialChart.js +119 -0
- package/components/Chart/ScatterChart.d.ts +36 -0
- package/components/Chart/ScatterChart.js +109 -0
- package/components/Chart/StackedBarChart.d.ts +34 -0
- package/components/Chart/StackedBarChart.js +111 -0
- package/components/Chart/Treemap.d.ts +33 -0
- package/components/Chart/Treemap.js +109 -0
- package/components/Checkbox/Checkbox.css +164 -0
- package/components/Checkbox/Checkbox.d.ts +45 -0
- package/components/Checkbox/Checkbox.js +125 -0
- package/components/Chip/Chip.css +195 -0
- package/components/Chip/Chip.d.ts +27 -0
- package/components/Chip/Chip.js +80 -0
- package/components/CircularButton/CircularButton.css +206 -0
- package/components/CircularButton/CircularButton.d.ts +30 -0
- package/components/CircularButton/CircularButton.js +54 -0
- package/components/CodeBlock/CodeBlock.css +180 -0
- package/components/CodeBlock/CodeBlock.d.ts +23 -0
- package/components/CodeBlock/CodeBlock.js +85 -0
- package/components/ColourSwatch/ColourSwatch.css +88 -0
- package/components/ColourSwatch/ColourSwatch.d.ts +34 -0
- package/components/ColourSwatch/ColourSwatch.js +42 -0
- package/components/Combobox/Combobox.css +411 -0
- package/components/Combobox/Combobox.d.ts +73 -0
- package/components/Combobox/Combobox.js +312 -0
- package/components/CommandPalette/CommandPalette.css +310 -0
- package/components/CommandPalette/CommandPalette.d.ts +60 -0
- package/components/CommandPalette/CommandPalette.js +263 -0
- package/components/ContactCard/ContactCard.css +123 -0
- package/components/ContactCard/ContactCard.d.ts +23 -0
- package/components/ContactCard/ContactCard.js +78 -0
- package/components/ContributionGraph/ContributionGraph.css +142 -0
- package/components/ContributionGraph/ContributionGraph.d.ts +26 -0
- package/components/ContributionGraph/ContributionGraph.js +125 -0
- package/components/DateInput/DateInput.css +163 -0
- package/components/DateInput/DateInput.d.ts +43 -0
- package/components/DateInput/DateInput.js +69 -0
- package/components/DatePicker/DatePicker.css +198 -0
- package/components/DatePicker/DatePicker.d.ts +22 -0
- package/components/DatePicker/DatePicker.js +170 -0
- package/components/Dialog/Dialog.css +176 -0
- package/components/Dialog/Dialog.d.ts +28 -0
- package/components/Dialog/Dialog.js +132 -0
- package/components/Divider/Divider.css +100 -0
- package/components/Divider/Divider.d.ts +18 -0
- package/components/Divider/Divider.js +31 -0
- package/components/Drawer/Drawer.css +262 -0
- package/components/Drawer/Drawer.d.ts +30 -0
- package/components/Drawer/Drawer.js +134 -0
- package/components/Dropdown/Dropdown.css +300 -0
- package/components/Dropdown/Dropdown.d.ts +48 -0
- package/components/Dropdown/Dropdown.js +196 -0
- package/components/DropdownMenu/DropdownMenu.css +303 -0
- package/components/DropdownMenu/DropdownMenu.d.ts +42 -0
- package/components/DropdownMenu/DropdownMenu.js +322 -0
- package/components/EmptyState/EmptyState.css +115 -0
- package/components/EmptyState/EmptyState.d.ts +27 -0
- package/components/EmptyState/EmptyState.js +32 -0
- package/components/EntityCard/EntityCard.css +69 -0
- package/components/EntityCard/EntityCard.d.ts +18 -0
- package/components/EntityCard/EntityCard.js +26 -0
- package/components/Figure/Figure.css +61 -0
- package/components/Figure/Figure.d.ts +17 -0
- package/components/Figure/Figure.js +35 -0
- package/components/FileInput/FileInput.css +308 -0
- package/components/FileInput/FileInput.d.ts +54 -0
- package/components/FileInput/FileInput.js +177 -0
- package/components/Input/Input.css +193 -0
- package/components/Input/Input.d.ts +40 -0
- package/components/Input/Input.js +71 -0
- package/components/Instructions/Instructions.css +216 -0
- package/components/Instructions/Instructions.d.ts +28 -0
- package/components/Instructions/Instructions.js +32 -0
- package/components/LinkList/LinkList.css +71 -0
- package/components/LinkList/LinkList.d.ts +20 -0
- package/components/LinkList/LinkList.js +41 -0
- package/components/MotionSwatch/MotionSwatch.css +176 -0
- package/components/MotionSwatch/MotionSwatch.d.ts +25 -0
- package/components/MotionSwatch/MotionSwatch.js +74 -0
- package/components/Nav/Nav.css +51 -0
- package/components/Nav/Nav.d.ts +19 -0
- package/components/Nav/Nav.js +26 -0
- package/components/Pagination/Pagination.css +126 -0
- package/components/Pagination/Pagination.d.ts +22 -0
- package/components/Pagination/Pagination.js +83 -0
- package/components/Popover/Popover.css +99 -0
- package/components/Popover/Popover.d.ts +28 -0
- package/components/Popover/Popover.js +102 -0
- package/components/ProgressBar/ProgressBar.css +60 -0
- package/components/ProgressBar/ProgressBar.d.ts +16 -0
- package/components/ProgressBar/ProgressBar.js +27 -0
- package/components/Quote/Quote.css +79 -0
- package/components/Quote/Quote.d.ts +18 -0
- package/components/Quote/Quote.js +26 -0
- package/components/RadioButton/RadioButton.css +132 -0
- package/components/RadioButton/RadioButton.d.ts +43 -0
- package/components/RadioButton/RadioButton.js +77 -0
- package/components/SectionTitle/SectionTitle.css +37 -0
- package/components/SectionTitle/SectionTitle.d.ts +10 -0
- package/components/SectionTitle/SectionTitle.js +17 -0
- package/components/SegmentedControl/SegmentedControl.css +129 -0
- package/components/SegmentedControl/SegmentedControl.d.ts +33 -0
- package/components/SegmentedControl/SegmentedControl.js +91 -0
- package/components/SelectionCard/SelectionCard.css +251 -0
- package/components/SelectionCard/SelectionCard.d.ts +26 -0
- package/components/SelectionCard/SelectionCard.js +85 -0
- package/components/Skeleton/Skeleton.css +79 -0
- package/components/Skeleton/Skeleton.d.ts +16 -0
- package/components/Skeleton/Skeleton.js +30 -0
- package/components/Slider/Slider.css +86 -0
- package/components/Slider/Slider.d.ts +25 -0
- package/components/Slider/Slider.js +46 -0
- package/components/SpacingSwatch/SpacingSwatch.css +108 -0
- package/components/SpacingSwatch/SpacingSwatch.d.ts +20 -0
- package/components/SpacingSwatch/SpacingSwatch.js +50 -0
- package/components/Spinner/Spinner.css +73 -0
- package/components/Spinner/Spinner.d.ts +14 -0
- package/components/Spinner/Spinner.js +42 -0
- package/components/Stat/Stat.css +78 -0
- package/components/Stat/Stat.d.ts +19 -0
- package/components/Stat/Stat.js +30 -0
- package/components/Table/Table.css +186 -0
- package/components/Table/Table.d.ts +45 -0
- package/components/Table/Table.js +65 -0
- package/components/Tabs/Tabs.css +140 -0
- package/components/Tabs/Tabs.d.ts +28 -0
- package/components/Tabs/Tabs.js +77 -0
- package/components/Textarea/Textarea.css +152 -0
- package/components/Textarea/Textarea.d.ts +40 -0
- package/components/Textarea/Textarea.js +74 -0
- package/components/Timeline/Timeline.css +339 -0
- package/components/Timeline/Timeline.d.ts +63 -0
- package/components/Timeline/Timeline.js +69 -0
- package/components/Toast/Toast.css +342 -0
- package/components/Toast/Toast.d.ts +63 -0
- package/components/Toast/Toast.js +213 -0
- package/components/ToggleGroup/ToggleGroup.css +84 -0
- package/components/ToggleGroup/ToggleGroup.d.ts +30 -0
- package/components/ToggleGroup/ToggleGroup.js +53 -0
- package/components/ToggleSwitch/ToggleSwitch.css +139 -0
- package/components/ToggleSwitch/ToggleSwitch.d.ts +23 -0
- package/components/ToggleSwitch/ToggleSwitch.js +50 -0
- package/components/Tooltip/Tooltip.css +122 -0
- package/components/Tooltip/Tooltip.d.ts +21 -0
- package/components/Tooltip/Tooltip.js +63 -0
- package/components/TypographySwatch/TypographySwatch.css +81 -0
- package/components/TypographySwatch/TypographySwatch.d.ts +24 -0
- package/components/TypographySwatch/TypographySwatch.js +40 -0
- package/components/registry.d.ts +20 -0
- package/components/registry.js +7 -0
- package/components/registry.json +67 -0
- package/components/registry.json.d.ts +70 -0
- package/components/registry.json.js +8 -0
- package/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.woff2 +0 -0
- package/fonts/material-symbols.css +94 -0
- package/index.d.ts +62 -0
- package/index.js +123 -0
- package/package.json +63 -0
- package/tokens/registry.d.ts +22 -0
- package/tokens/registry.js +14 -0
- package/tokens/registry.json +203 -0
- package/tokens/registry.json.d.ts +206 -0
- package/tokens/registry.json.js +8 -0
- package/tokens/tokens-dark.css +119 -0
- package/tokens/tokens-light.css +159 -0
- package/tokens/tokens-motion.css +68 -0
- package/tokens/tokens-primitives.css +176 -0
- package/tokens/tokens-typography.css +116 -0
- package/tokens/tokens.css +11 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { ResponsiveContainer, Treemap as Treemap$1, Tooltip } from "recharts";
|
|
4
|
+
import "./Chart.css";
|
|
5
|
+
const PALETTE = [
|
|
6
|
+
"#118AB2",
|
|
7
|
+
// teal-07
|
|
8
|
+
"#06D6A0",
|
|
9
|
+
// green-07
|
|
10
|
+
"#EF476F",
|
|
11
|
+
// red-07
|
|
12
|
+
"#FFD166",
|
|
13
|
+
// yellow-07
|
|
14
|
+
"#9E47EF",
|
|
15
|
+
// purple-07
|
|
16
|
+
"#1E47B0",
|
|
17
|
+
// blue-07
|
|
18
|
+
"#EF8247"
|
|
19
|
+
// orange
|
|
20
|
+
];
|
|
21
|
+
function getCSSVar(name, fallback) {
|
|
22
|
+
if (typeof window === "undefined") return fallback;
|
|
23
|
+
return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
|
|
24
|
+
}
|
|
25
|
+
function TreemapContent(props) {
|
|
26
|
+
const { x, y, width, height, name, index, color } = props;
|
|
27
|
+
if (width < 4 || height < 4) return null;
|
|
28
|
+
const fill = color || PALETTE[index % PALETTE.length];
|
|
29
|
+
const textColor = getCSSVar("--color-text-primary", "#050505");
|
|
30
|
+
const showLabel = width > 50 && height > 28;
|
|
31
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"rect",
|
|
34
|
+
{
|
|
35
|
+
x,
|
|
36
|
+
y,
|
|
37
|
+
width,
|
|
38
|
+
height,
|
|
39
|
+
rx: 4,
|
|
40
|
+
ry: 4,
|
|
41
|
+
style: { fill, stroke: getCSSVar("--color-bg-container-primary", "#F1F1F1"), strokeWidth: 2 }
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
showLabel && /* @__PURE__ */ jsx(
|
|
45
|
+
"text",
|
|
46
|
+
{
|
|
47
|
+
x: x + width / 2,
|
|
48
|
+
y: y + height / 2,
|
|
49
|
+
textAnchor: "middle",
|
|
50
|
+
dominantBaseline: "central",
|
|
51
|
+
style: { fill: textColor, fontSize: 12, fontWeight: 600 },
|
|
52
|
+
children: name
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
function TreemapTooltip({ active, payload }) {
|
|
58
|
+
if (!active || !payload?.length) return null;
|
|
59
|
+
const entry = payload[0];
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", { className: "ds-chart__tooltip", children: [
|
|
61
|
+
/* @__PURE__ */ jsx("div", { className: "ds-chart__tooltip-label", children: entry.name }),
|
|
62
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-chart__tooltip-row", children: [
|
|
63
|
+
/* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-name", children: "Size" }),
|
|
64
|
+
/* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-value", children: entry.value?.toLocaleString() })
|
|
65
|
+
] })
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
const Treemap = ({
|
|
69
|
+
data,
|
|
70
|
+
dataKey = "size",
|
|
71
|
+
title,
|
|
72
|
+
subtitle,
|
|
73
|
+
summaryItems,
|
|
74
|
+
height = 350,
|
|
75
|
+
className = ""
|
|
76
|
+
}) => {
|
|
77
|
+
const baseClass = "ds-chart";
|
|
78
|
+
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
79
|
+
const renderTooltip = useCallback(
|
|
80
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
81
|
+
(props) => /* @__PURE__ */ jsx(TreemapTooltip, { ...props }),
|
|
82
|
+
[]
|
|
83
|
+
);
|
|
84
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, children: [
|
|
85
|
+
(title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
|
|
87
|
+
title && /* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title }),
|
|
88
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: `${baseClass}__subtitle`, children: subtitle })
|
|
89
|
+
] }),
|
|
90
|
+
summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
|
|
91
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
|
|
92
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
|
|
93
|
+
] }, i)) })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsx(
|
|
96
|
+
Treemap$1,
|
|
97
|
+
{
|
|
98
|
+
data,
|
|
99
|
+
dataKey,
|
|
100
|
+
aspectRatio: 4 / 3,
|
|
101
|
+
content: /* @__PURE__ */ jsx(TreemapContent, {}),
|
|
102
|
+
children: /* @__PURE__ */ jsx(Tooltip, { content: renderTooltip })
|
|
103
|
+
}
|
|
104
|
+
) }) })
|
|
105
|
+
] });
|
|
106
|
+
};
|
|
107
|
+
export {
|
|
108
|
+
Treemap
|
|
109
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
CHECKBOX COMPONENT
|
|
3
|
+
Custom checkbox with check / indeterminate icon
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
.ds-checkbox {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: var(--gap-sm); /* 8px */
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
user-select: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* ============================================
|
|
15
|
+
BOX
|
|
16
|
+
============================================ */
|
|
17
|
+
|
|
18
|
+
.ds-checkbox__box {
|
|
19
|
+
position: relative;
|
|
20
|
+
width: 24px;
|
|
21
|
+
height: 24px;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
border: var(--border-md) solid var(--color-bg-container-border);
|
|
24
|
+
border-radius: var(--radius-sm); /* 8px */
|
|
25
|
+
background-color: var(--color-bg-container-primary-transparent);
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
transition: background-color var(--motion-duration-base) var(--motion-ease-standard), border-color var(--motion-duration-base) var(--motion-ease-standard);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* ============================================
|
|
34
|
+
ICON
|
|
35
|
+
============================================ */
|
|
36
|
+
|
|
37
|
+
.ds-checkbox__icon {
|
|
38
|
+
width: 14px;
|
|
39
|
+
height: 14px;
|
|
40
|
+
color: var(--color-action-primary-text-active);
|
|
41
|
+
opacity: 0;
|
|
42
|
+
transition: opacity var(--motion-duration-base) var(--motion-ease-standard);
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* ============================================
|
|
47
|
+
LABEL
|
|
48
|
+
============================================ */
|
|
49
|
+
|
|
50
|
+
.ds-checkbox__label {
|
|
51
|
+
font-family: var(--font-paragraph-family);
|
|
52
|
+
font-size: var(--font-paragraph-size);
|
|
53
|
+
font-weight: var(--font-paragraph-weight);
|
|
54
|
+
line-height: var(--font-paragraph-line-height);
|
|
55
|
+
letter-spacing: var(--font-paragraph-letter-spacing);
|
|
56
|
+
color: var(--color-text-primary);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ============================================
|
|
60
|
+
CHECKED STATE
|
|
61
|
+
============================================ */
|
|
62
|
+
|
|
63
|
+
.ds-checkbox--checked .ds-checkbox__box {
|
|
64
|
+
background-color: var(--color-action-primary-bg);
|
|
65
|
+
border-color: var(--color-action-primary-bg);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ds-checkbox--checked .ds-checkbox__icon {
|
|
69
|
+
opacity: 1;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ============================================
|
|
73
|
+
INDETERMINATE STATE
|
|
74
|
+
============================================ */
|
|
75
|
+
|
|
76
|
+
.ds-checkbox--indeterminate .ds-checkbox__box {
|
|
77
|
+
background-color: var(--color-action-primary-bg);
|
|
78
|
+
border-color: var(--color-action-primary-bg);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ds-checkbox--indeterminate .ds-checkbox__icon {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* ============================================
|
|
86
|
+
HOVER STATE
|
|
87
|
+
============================================ */
|
|
88
|
+
|
|
89
|
+
.ds-checkbox:not(.ds-checkbox--disabled):hover .ds-checkbox__box {
|
|
90
|
+
border-color: var(--color-action-primary-bg);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ds-checkbox--checked:not(.ds-checkbox--disabled):hover .ds-checkbox__box {
|
|
94
|
+
background-color: var(--color-action-primary-bg-hover);
|
|
95
|
+
border-color: var(--color-action-primary-bg-hover);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* ============================================
|
|
99
|
+
FOCUS STATE
|
|
100
|
+
============================================ */
|
|
101
|
+
|
|
102
|
+
.ds-checkbox:focus-visible .ds-checkbox__box {
|
|
103
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
104
|
+
outline-offset: 2px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* ============================================
|
|
108
|
+
DISABLED STATE
|
|
109
|
+
============================================ */
|
|
110
|
+
|
|
111
|
+
.ds-checkbox--disabled {
|
|
112
|
+
opacity: 0.4;
|
|
113
|
+
cursor: not-allowed;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* ============================================
|
|
117
|
+
SIZE — COMPACT
|
|
118
|
+
============================================ */
|
|
119
|
+
|
|
120
|
+
.ds-checkbox--compact .ds-checkbox__box {
|
|
121
|
+
width: 20px;
|
|
122
|
+
height: 20px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.ds-checkbox--compact .ds-checkbox__icon {
|
|
126
|
+
width: 12px;
|
|
127
|
+
height: 12px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.ds-checkbox--compact .ds-checkbox__label {
|
|
131
|
+
font-size: var(--font-paragraph-sm-size);
|
|
132
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
133
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* ============================================
|
|
137
|
+
CHECKBOX GROUP
|
|
138
|
+
============================================ */
|
|
139
|
+
|
|
140
|
+
.ds-checkbox-group {
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
gap: var(--gap-sm); /* 8px */
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.ds-checkbox-group__label {
|
|
147
|
+
font-family: var(--font-paragraph-em-family);
|
|
148
|
+
font-size: var(--font-paragraph-em-size);
|
|
149
|
+
font-weight: var(--font-paragraph-em-weight);
|
|
150
|
+
line-height: var(--font-paragraph-em-line-height);
|
|
151
|
+
letter-spacing: var(--font-paragraph-em-letter-spacing);
|
|
152
|
+
color: var(--color-text-primary);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.ds-checkbox-group__items {
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
gap: var(--gap-sm); /* 8px */
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.ds-checkbox-group--horizontal .ds-checkbox-group__items {
|
|
162
|
+
flex-direction: row;
|
|
163
|
+
gap: var(--gap-lg); /* 20px */
|
|
164
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CheckboxProps {
|
|
3
|
+
/** Label text */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** Whether the checkbox is checked */
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
/** Whether the checkbox is in an indeterminate state */
|
|
8
|
+
indeterminate?: boolean;
|
|
9
|
+
/** Whether the checkbox is disabled */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Component size */
|
|
12
|
+
size?: 'default' | 'compact';
|
|
13
|
+
/** Callback when toggled */
|
|
14
|
+
onChange?: (checked: boolean) => void;
|
|
15
|
+
/** Additional CSS classes */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Accessible label override */
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
/** HTML name attribute */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** HTML id attribute */
|
|
22
|
+
id?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CheckboxGroupProps {
|
|
25
|
+
/** Group label */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Checkbox options */
|
|
28
|
+
items: {
|
|
29
|
+
label: string;
|
|
30
|
+
value: string;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
/** Currently selected values */
|
|
34
|
+
values?: string[];
|
|
35
|
+
/** Layout direction */
|
|
36
|
+
direction?: 'vertical' | 'horizontal';
|
|
37
|
+
/** Component size */
|
|
38
|
+
size?: 'default' | 'compact';
|
|
39
|
+
/** Callback when selection changes */
|
|
40
|
+
onChange?: (values: string[]) => void;
|
|
41
|
+
/** Additional CSS classes */
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const CheckboxGroup: ({ label, items, values, direction, size, onChange, className, }: CheckboxGroupProps) => React.JSX.Element;
|
|
45
|
+
export declare const Checkbox: ({ label, checked, indeterminate, disabled, size, onChange, className, ariaLabel, }: CheckboxProps) => React.JSX.Element;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "./Checkbox.css";
|
|
4
|
+
const CheckIcon = () => /* @__PURE__ */ jsx(
|
|
5
|
+
"svg",
|
|
6
|
+
{
|
|
7
|
+
className: "ds-checkbox__icon",
|
|
8
|
+
width: "14",
|
|
9
|
+
height: "14",
|
|
10
|
+
viewBox: "0 0 14 14",
|
|
11
|
+
fill: "none",
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
children: /* @__PURE__ */ jsx(
|
|
14
|
+
"path",
|
|
15
|
+
{
|
|
16
|
+
d: "M2 7.5L5.5 11L12 3",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
strokeWidth: "2",
|
|
19
|
+
strokeLinecap: "round",
|
|
20
|
+
strokeLinejoin: "round"
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
const MinusIcon = () => /* @__PURE__ */ jsx(
|
|
26
|
+
"svg",
|
|
27
|
+
{
|
|
28
|
+
className: "ds-checkbox__icon",
|
|
29
|
+
width: "14",
|
|
30
|
+
height: "14",
|
|
31
|
+
viewBox: "0 0 14 14",
|
|
32
|
+
fill: "none",
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
children: /* @__PURE__ */ jsx(
|
|
35
|
+
"path",
|
|
36
|
+
{
|
|
37
|
+
d: "M2 7H12",
|
|
38
|
+
stroke: "currentColor",
|
|
39
|
+
strokeWidth: "2",
|
|
40
|
+
strokeLinecap: "round"
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
const CheckboxGroup = ({
|
|
46
|
+
label,
|
|
47
|
+
items,
|
|
48
|
+
values = [],
|
|
49
|
+
direction = "vertical",
|
|
50
|
+
size = "default",
|
|
51
|
+
onChange,
|
|
52
|
+
className = ""
|
|
53
|
+
}) => {
|
|
54
|
+
const baseClass = "ds-checkbox-group";
|
|
55
|
+
const directionClass = `${baseClass}--${direction}`;
|
|
56
|
+
const classes = [baseClass, directionClass, className].filter(Boolean).join(" ");
|
|
57
|
+
const handleToggle = (itemValue) => {
|
|
58
|
+
if (!onChange) return;
|
|
59
|
+
const next = values.includes(itemValue) ? values.filter((v) => v !== itemValue) : [...values, itemValue];
|
|
60
|
+
onChange(next);
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, role: "group", "aria-label": label, children: [
|
|
63
|
+
label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label }),
|
|
64
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__items`, children: items.map((item) => /* @__PURE__ */ jsx(
|
|
65
|
+
Checkbox,
|
|
66
|
+
{
|
|
67
|
+
label: item.label,
|
|
68
|
+
checked: values.includes(item.value),
|
|
69
|
+
disabled: item.disabled,
|
|
70
|
+
size,
|
|
71
|
+
onChange: () => handleToggle(item.value)
|
|
72
|
+
},
|
|
73
|
+
item.value
|
|
74
|
+
)) })
|
|
75
|
+
] });
|
|
76
|
+
};
|
|
77
|
+
const Checkbox = ({
|
|
78
|
+
label,
|
|
79
|
+
checked = false,
|
|
80
|
+
indeterminate = false,
|
|
81
|
+
disabled = false,
|
|
82
|
+
size = "default",
|
|
83
|
+
onChange,
|
|
84
|
+
className = "",
|
|
85
|
+
ariaLabel
|
|
86
|
+
}) => {
|
|
87
|
+
const baseClass = "ds-checkbox";
|
|
88
|
+
const checkedClass = checked ? `${baseClass}--checked` : "";
|
|
89
|
+
const indeterminateClass = indeterminate && !checked ? `${baseClass}--indeterminate` : "";
|
|
90
|
+
const disabledClass = disabled ? `${baseClass}--disabled` : "";
|
|
91
|
+
const sizeClass = size === "compact" ? `${baseClass}--compact` : "";
|
|
92
|
+
const classes = [baseClass, sizeClass, checkedClass, indeterminateClass, disabledClass, className].filter(Boolean).join(" ");
|
|
93
|
+
const handleClick = () => {
|
|
94
|
+
if (!disabled && onChange) {
|
|
95
|
+
onChange(!checked);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const handleKeyDown = (e) => {
|
|
99
|
+
if (e.key === " " || e.key === "Enter") {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
handleClick();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
return /* @__PURE__ */ jsxs(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
className: classes,
|
|
108
|
+
onClick: handleClick,
|
|
109
|
+
onKeyDown: handleKeyDown,
|
|
110
|
+
role: "checkbox",
|
|
111
|
+
"aria-checked": indeterminate && !checked ? "mixed" : checked,
|
|
112
|
+
"aria-disabled": disabled,
|
|
113
|
+
"aria-label": ariaLabel || label,
|
|
114
|
+
tabIndex: disabled ? -1 : 0,
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__box`, children: indeterminate && !checked ? /* @__PURE__ */ jsx(MinusIcon, {}) : /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
117
|
+
label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
export {
|
|
123
|
+
Checkbox,
|
|
124
|
+
CheckboxGroup
|
|
125
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
CHIP COMPONENT
|
|
3
|
+
Compact pill for attributes, filters, and
|
|
4
|
+
inline metadata. Non-clickable by default;
|
|
5
|
+
clickable, selectable, and removable variants.
|
|
6
|
+
============================================ */
|
|
7
|
+
|
|
8
|
+
.ds-chip {
|
|
9
|
+
/* Layout */
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: var(--gap-sm); /* 8px */
|
|
13
|
+
|
|
14
|
+
/* Spacing — 32px tall at default size */
|
|
15
|
+
padding: var(--padding-xs) var(--padding-sm-md); /* 6px 12px */
|
|
16
|
+
|
|
17
|
+
/* Shape */
|
|
18
|
+
border: var(--border-xs) solid var(--color-bg-container-border);
|
|
19
|
+
border-radius: var(--radius-full);
|
|
20
|
+
background-color: var(--color-bg-page-primary);
|
|
21
|
+
|
|
22
|
+
/* Typography — same em style as Badge */
|
|
23
|
+
font-family: var(--font-paragraph-sm-em-family);
|
|
24
|
+
font-size: var(--font-paragraph-sm-em-size);
|
|
25
|
+
font-weight: var(--font-paragraph-sm-em-weight);
|
|
26
|
+
line-height: var(--font-paragraph-sm-em-line-height);
|
|
27
|
+
letter-spacing: var(--font-paragraph-sm-em-letter-spacing);
|
|
28
|
+
color: var(--color-text-secondary);
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
|
|
31
|
+
transition: background-color var(--motion-duration-base) var(--motion-ease-standard), border-color var(--motion-duration-base) var(--motion-ease-standard),
|
|
32
|
+
color var(--motion-duration-base) var(--motion-ease-standard), opacity var(--motion-duration-base) var(--motion-ease-standard);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* ============================================
|
|
36
|
+
SIZE — COMPACT (24px tall)
|
|
37
|
+
============================================ */
|
|
38
|
+
|
|
39
|
+
.ds-chip--compact {
|
|
40
|
+
gap: var(--gap-xs); /* 4px */
|
|
41
|
+
padding: var(--padding-xxxs) var(--padding-sm); /* 2px 8px */
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* ============================================
|
|
45
|
+
ICON (leading)
|
|
46
|
+
============================================ */
|
|
47
|
+
|
|
48
|
+
.ds-chip__icon {
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
--icon-size: var(--icon-size-sm);
|
|
51
|
+
line-height: 1;
|
|
52
|
+
color: var(--color-icon-primary);
|
|
53
|
+
transition: color var(--motion-duration-base) var(--motion-ease-standard);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ds-chip__icon svg {
|
|
57
|
+
width: 20px;
|
|
58
|
+
height: 20px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ds-chip--compact .ds-chip__icon {
|
|
62
|
+
--icon-size: var(--icon-size-sm);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ds-chip--compact .ds-chip__icon svg {
|
|
66
|
+
width: 16px;
|
|
67
|
+
height: 16px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ============================================
|
|
71
|
+
LABEL
|
|
72
|
+
============================================ */
|
|
73
|
+
|
|
74
|
+
.ds-chip__label {
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* ============================================
|
|
79
|
+
CLICKABLE (rendered as <button>)
|
|
80
|
+
============================================ */
|
|
81
|
+
|
|
82
|
+
.ds-chip--clickable {
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ds-chip--clickable:not(.ds-chip--disabled):not(.ds-chip--selected):hover {
|
|
87
|
+
background-color: var(--color-action-passive-bg-hover);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ds-chip--clickable:not(.ds-chip--disabled):not(.ds-chip--selected):active {
|
|
91
|
+
background-color: var(--color-action-passive-bg-active);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* ============================================
|
|
95
|
+
SELECTED — teal active fill, matching the
|
|
96
|
+
SegmentedControl selection convention
|
|
97
|
+
============================================ */
|
|
98
|
+
|
|
99
|
+
.ds-chip--selected {
|
|
100
|
+
background-color: var(--color-action-primary-bg);
|
|
101
|
+
border-color: var(--color-action-primary-bg);
|
|
102
|
+
color: var(--color-action-primary-text);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.ds-chip--selected .ds-chip__icon {
|
|
106
|
+
color: var(--color-action-primary-text);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.ds-chip--selected.ds-chip--clickable:not(.ds-chip--disabled):hover {
|
|
110
|
+
background-color: var(--color-action-primary-bg-hover);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.ds-chip--selected.ds-chip--clickable:not(.ds-chip--disabled):active {
|
|
114
|
+
background-color: var(--color-action-primary-bg-active);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ============================================
|
|
118
|
+
REMOVABLE — <span> container with an inner
|
|
119
|
+
main region (when clickable) + close button
|
|
120
|
+
============================================ */
|
|
121
|
+
|
|
122
|
+
.ds-chip__main {
|
|
123
|
+
display: inline-flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
gap: inherit;
|
|
126
|
+
margin: 0;
|
|
127
|
+
padding: 0;
|
|
128
|
+
border: none;
|
|
129
|
+
background: none;
|
|
130
|
+
font: inherit;
|
|
131
|
+
letter-spacing: inherit;
|
|
132
|
+
color: inherit;
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.ds-chip__remove {
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
flex-shrink: 0;
|
|
141
|
+
margin: 0;
|
|
142
|
+
padding: 0;
|
|
143
|
+
border: none;
|
|
144
|
+
background: none;
|
|
145
|
+
border-radius: var(--radius-full);
|
|
146
|
+
color: var(--color-icon-primary);
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
transition: color var(--motion-duration-base) var(--motion-ease-standard);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.ds-chip__remove .material-symbols-rounded {
|
|
152
|
+
--icon-size: var(--icon-size-sm);
|
|
153
|
+
line-height: 1;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.ds-chip--compact .ds-chip__remove .material-symbols-rounded {
|
|
157
|
+
--icon-size: var(--icon-size-sm);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ds-chip__remove:not(:disabled):hover {
|
|
161
|
+
color: var(--color-text-primary);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.ds-chip--selected .ds-chip__remove {
|
|
165
|
+
color: var(--color-action-primary-text);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.ds-chip--selected .ds-chip__remove:not(:disabled):hover {
|
|
169
|
+
color: var(--color-action-primary-text-active);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* ============================================
|
|
173
|
+
DISABLED
|
|
174
|
+
============================================ */
|
|
175
|
+
|
|
176
|
+
.ds-chip--disabled {
|
|
177
|
+
opacity: 0.4;
|
|
178
|
+
cursor: not-allowed;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.ds-chip--disabled .ds-chip__main,
|
|
182
|
+
.ds-chip--disabled .ds-chip__remove {
|
|
183
|
+
cursor: not-allowed;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* ============================================
|
|
187
|
+
FOCUS
|
|
188
|
+
============================================ */
|
|
189
|
+
|
|
190
|
+
.ds-chip--clickable:focus-visible,
|
|
191
|
+
.ds-chip__main:focus-visible,
|
|
192
|
+
.ds-chip__remove:focus-visible {
|
|
193
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
194
|
+
outline-offset: 2px;
|
|
195
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ChipProps {
|
|
3
|
+
/** Chip label — string for plain text, ReactNode for richer content (e.g. a numbered prefix) */
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
/** Leading icon — Material Symbol name (string) or custom element (ReactNode) */
|
|
6
|
+
icon?: string | React.ReactNode;
|
|
7
|
+
/** Selected state (filter-style chips) — renders the teal active fill */
|
|
8
|
+
selected?: boolean;
|
|
9
|
+
/** Disabled state */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Chip size */
|
|
12
|
+
size?: 'default' | 'compact';
|
|
13
|
+
/** Click handler — presence makes the chip an interactive <button> */
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
/** Remove handler — renders a trailing close button (input-style chips) */
|
|
16
|
+
onRemove?: () => void;
|
|
17
|
+
/** Accessible label for the remove button */
|
|
18
|
+
removeLabel?: string;
|
|
19
|
+
/** Additional CSS classes */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Chip component — compact pill for attributes, filters, and inline metadata.
|
|
24
|
+
* Non-clickable by default (renders a <span>); pass onClick for an
|
|
25
|
+
* interactive <button>, and/or onRemove for a trailing close button.
|
|
26
|
+
*/
|
|
27
|
+
export declare const Chip: ({ label, icon, selected, disabled, size, onClick, onRemove, removeLabel, className, }: ChipProps) => React.JSX.Element;
|