@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,41 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "./LinkList.css";
|
|
3
|
+
import "../../fonts/material-symbols.css";
|
|
4
|
+
const LinkList = ({ items, className = "" }) => {
|
|
5
|
+
const classes = ["ds-link-list", className].filter(Boolean).join(" ");
|
|
6
|
+
return /* @__PURE__ */ jsx("div", { className: classes, children: items.map((item) => {
|
|
7
|
+
const subs = item.sub ? Array.isArray(item.sub) ? item.sub : [item.sub] : [];
|
|
8
|
+
return /* @__PURE__ */ jsxs(
|
|
9
|
+
"a",
|
|
10
|
+
{
|
|
11
|
+
href: item.href,
|
|
12
|
+
target: "_blank",
|
|
13
|
+
rel: "noopener noreferrer",
|
|
14
|
+
className: "ds-link-list__item",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx("span", { className: "ds-link-list__icon-wrap", "aria-hidden": "true", children: item.logo ? /* @__PURE__ */ jsx(
|
|
17
|
+
"img",
|
|
18
|
+
{
|
|
19
|
+
src: item.logo,
|
|
20
|
+
alt: item.logoAlt ?? "",
|
|
21
|
+
className: "ds-link-list__logo",
|
|
22
|
+
width: 28,
|
|
23
|
+
height: 28
|
|
24
|
+
}
|
|
25
|
+
) : /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded ds-link-list__symbol", children: item.icon ?? "link" }) }),
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-link-list__content", children: [
|
|
27
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-link-list__title", children: [
|
|
28
|
+
/* @__PURE__ */ jsx("span", { children: item.label }),
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: "material-symbols-rounded ds-link-list__open-icon", "aria-hidden": "true", children: "open_in_new" })
|
|
30
|
+
] }),
|
|
31
|
+
subs.map((s, i) => /* @__PURE__ */ jsx("span", { className: "ds-link-list__sub", children: s }, i))
|
|
32
|
+
] })
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
item.href + item.label
|
|
36
|
+
);
|
|
37
|
+
}) });
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
LinkList
|
|
41
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
MOTION SWATCH COMPONENT
|
|
3
|
+
Card that displays a motion token with a live
|
|
4
|
+
animation preview, token name, and value.
|
|
5
|
+
Click the preview to replay one-shot demos.
|
|
6
|
+
============================================ */
|
|
7
|
+
|
|
8
|
+
.ds-motion-swatch {
|
|
9
|
+
/* Layout */
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: var(--gap-sm); /* 8px */
|
|
14
|
+
|
|
15
|
+
/* Sizing */
|
|
16
|
+
flex: 1 1 0;
|
|
17
|
+
min-width: 140px;
|
|
18
|
+
|
|
19
|
+
/* Appearance */
|
|
20
|
+
background: var(--color-bg-container-primary-semi);
|
|
21
|
+
border: var(--border-xs) solid var(--color-bg-container-border);
|
|
22
|
+
border-radius: var(--radius-xl); /* 24px */
|
|
23
|
+
padding: var(--padding-lg); /* 20px */
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* ============================================
|
|
27
|
+
PREVIEW AREA
|
|
28
|
+
A button so the demo can be replayed by click
|
|
29
|
+
or keyboard.
|
|
30
|
+
============================================ */
|
|
31
|
+
|
|
32
|
+
.ds-motion-swatch__preview {
|
|
33
|
+
position: relative;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
align-self: stretch;
|
|
38
|
+
min-height: 60px;
|
|
39
|
+
margin-bottom: var(--gap-md); /* 12px */
|
|
40
|
+
|
|
41
|
+
/* Reset button chrome */
|
|
42
|
+
background: none;
|
|
43
|
+
border: none;
|
|
44
|
+
padding: 0;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
font: inherit;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ds-motion-swatch__preview:focus-visible {
|
|
50
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
51
|
+
outline-offset: 2px;
|
|
52
|
+
border-radius: var(--radius-sm);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ds-motion-swatch__replay-icon {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 0;
|
|
58
|
+
right: 0;
|
|
59
|
+
--icon-size: var(--icon-size-sm);
|
|
60
|
+
color: var(--color-text-tertiary);
|
|
61
|
+
opacity: 0;
|
|
62
|
+
transition: opacity var(--motion-duration-fast) var(--motion-ease-standard);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ds-motion-swatch__preview:hover .ds-motion-swatch__replay-icon,
|
|
66
|
+
.ds-motion-swatch__preview:focus-visible .ds-motion-swatch__replay-icon {
|
|
67
|
+
opacity: 1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ============================================
|
|
71
|
+
SLIDE DEMO
|
|
72
|
+
Dot travels the track using the token's
|
|
73
|
+
duration or easing.
|
|
74
|
+
============================================ */
|
|
75
|
+
|
|
76
|
+
.ds-motion-swatch__track {
|
|
77
|
+
display: block;
|
|
78
|
+
width: 120px;
|
|
79
|
+
height: 16px;
|
|
80
|
+
border-radius: var(--radius-full);
|
|
81
|
+
background: var(--color-bg-container-secondary);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ds-motion-swatch__dot {
|
|
85
|
+
display: block;
|
|
86
|
+
width: 16px;
|
|
87
|
+
height: 16px;
|
|
88
|
+
border-radius: var(--radius-full);
|
|
89
|
+
background: var(--color-core-accent-violet);
|
|
90
|
+
animation-name: ds-motion-swatch-slide;
|
|
91
|
+
animation-fill-mode: forwards;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@keyframes ds-motion-swatch-slide {
|
|
95
|
+
from {
|
|
96
|
+
transform: translateX(0);
|
|
97
|
+
}
|
|
98
|
+
to {
|
|
99
|
+
transform: translateX(104px); /* track width minus dot */
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* ============================================
|
|
104
|
+
SPIN DEMO
|
|
105
|
+
Continuous rotation loop (spinner timing).
|
|
106
|
+
============================================ */
|
|
107
|
+
|
|
108
|
+
.ds-motion-swatch__spinner {
|
|
109
|
+
display: block;
|
|
110
|
+
width: 32px;
|
|
111
|
+
height: 32px;
|
|
112
|
+
border-radius: var(--radius-full);
|
|
113
|
+
border: var(--border-md) solid var(--color-bg-container-secondary);
|
|
114
|
+
border-top-color: var(--color-core-accent-violet);
|
|
115
|
+
animation-name: ds-motion-swatch-spin;
|
|
116
|
+
animation-iteration-count: infinite;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@keyframes ds-motion-swatch-spin {
|
|
120
|
+
to {
|
|
121
|
+
transform: rotate(360deg);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* ============================================
|
|
126
|
+
SHIMMER DEMO
|
|
127
|
+
Continuous gradient sweep (skeleton timing).
|
|
128
|
+
============================================ */
|
|
129
|
+
|
|
130
|
+
.ds-motion-swatch__shimmer {
|
|
131
|
+
display: block;
|
|
132
|
+
width: 120px;
|
|
133
|
+
height: 16px;
|
|
134
|
+
border-radius: var(--radius-full);
|
|
135
|
+
background: linear-gradient(
|
|
136
|
+
90deg,
|
|
137
|
+
var(--color-bg-container-secondary) 25%,
|
|
138
|
+
var(--color-bg-container-tertiary) 50%,
|
|
139
|
+
var(--color-bg-container-secondary) 75%
|
|
140
|
+
);
|
|
141
|
+
background-size: 200% 100%;
|
|
142
|
+
animation-name: ds-motion-swatch-shimmer;
|
|
143
|
+
animation-iteration-count: infinite;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@keyframes ds-motion-swatch-shimmer {
|
|
147
|
+
from {
|
|
148
|
+
background-position: 200% 0;
|
|
149
|
+
}
|
|
150
|
+
to {
|
|
151
|
+
background-position: -200% 0;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* ============================================
|
|
156
|
+
LABEL & VALUE
|
|
157
|
+
============================================ */
|
|
158
|
+
|
|
159
|
+
.ds-motion-swatch__label {
|
|
160
|
+
font-family: var(--font-paragraph-family);
|
|
161
|
+
font-size: var(--font-paragraph-size);
|
|
162
|
+
font-weight: var(--font-heading-3-weight);
|
|
163
|
+
line-height: var(--font-paragraph-line-height);
|
|
164
|
+
color: var(--color-text-primary);
|
|
165
|
+
text-align: center;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.ds-motion-swatch__value {
|
|
169
|
+
font-family: var(--font-paragraph-family);
|
|
170
|
+
font-size: var(--font-paragraph-sm-size);
|
|
171
|
+
font-weight: var(--font-paragraph-weight);
|
|
172
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
173
|
+
color: var(--color-text-tertiary);
|
|
174
|
+
text-align: center;
|
|
175
|
+
overflow-wrap: anywhere;
|
|
176
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type MotionSwatchKind = 'duration' | 'easing';
|
|
2
|
+
export type MotionSwatchDemo = 'slide' | 'spin' | 'shimmer';
|
|
3
|
+
export interface MotionSwatchProps {
|
|
4
|
+
/** Token name label (e.g. "Fast", "Standard") */
|
|
5
|
+
label: string;
|
|
6
|
+
/** CSS custom property being demonstrated (e.g. "--motion-duration-fast") */
|
|
7
|
+
token: string;
|
|
8
|
+
/** Resolved value to display (e.g. "150ms", "ease") */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Whether the token is a duration or an easing curve */
|
|
11
|
+
kind: MotionSwatchKind;
|
|
12
|
+
/** Which preview animation to render (default "slide") */
|
|
13
|
+
demo?: MotionSwatchDemo;
|
|
14
|
+
/** Additional CSS classes */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* MotionSwatch component.
|
|
19
|
+
* Displays a motion token card with a live animation preview,
|
|
20
|
+
* token name, and value. Duration swatches animate at the
|
|
21
|
+
* token's speed; easing swatches trace the token's curve at a
|
|
22
|
+
* fixed readable duration. Click the preview to replay.
|
|
23
|
+
* Loop demos (spin, shimmer) run continuously.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MotionSwatch: ({ label, token, value, kind, demo, className, }: MotionSwatchProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import "./MotionSwatch.css";
|
|
4
|
+
const MotionSwatch = ({
|
|
5
|
+
label,
|
|
6
|
+
token,
|
|
7
|
+
value,
|
|
8
|
+
kind,
|
|
9
|
+
demo = "slide",
|
|
10
|
+
className = ""
|
|
11
|
+
}) => {
|
|
12
|
+
const [playCount, setPlayCount] = useState(0);
|
|
13
|
+
const baseClass = "ds-motion-swatch";
|
|
14
|
+
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
15
|
+
const isLoop = demo === "spin" || demo === "shimmer";
|
|
16
|
+
const animationStyle = kind === "duration" ? {
|
|
17
|
+
animationDuration: `var(${token})`,
|
|
18
|
+
animationTimingFunction: isLoop ? "var(--motion-ease-linear)" : "var(--motion-ease-emphasized)"
|
|
19
|
+
} : {
|
|
20
|
+
animationDuration: "var(--motion-duration-slower)",
|
|
21
|
+
animationTimingFunction: `var(${token})`
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, children: [
|
|
24
|
+
/* @__PURE__ */ jsxs(
|
|
25
|
+
"button",
|
|
26
|
+
{
|
|
27
|
+
type: "button",
|
|
28
|
+
className: `${baseClass}__preview`,
|
|
29
|
+
onClick: () => setPlayCount((count) => count + 1),
|
|
30
|
+
"aria-label": `Replay ${label} animation`,
|
|
31
|
+
children: [
|
|
32
|
+
demo === "slide" && /* @__PURE__ */ jsx("span", { className: `${baseClass}__track`, children: /* @__PURE__ */ jsx(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
className: `${baseClass}__dot`,
|
|
36
|
+
style: animationStyle
|
|
37
|
+
},
|
|
38
|
+
playCount
|
|
39
|
+
) }),
|
|
40
|
+
demo === "spin" && /* @__PURE__ */ jsx(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
className: `${baseClass}__spinner`,
|
|
44
|
+
style: animationStyle
|
|
45
|
+
},
|
|
46
|
+
playCount
|
|
47
|
+
),
|
|
48
|
+
demo === "shimmer" && /* @__PURE__ */ jsx(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
className: `${baseClass}__shimmer`,
|
|
52
|
+
style: animationStyle
|
|
53
|
+
},
|
|
54
|
+
playCount
|
|
55
|
+
),
|
|
56
|
+
!isLoop && /* @__PURE__ */ jsx(
|
|
57
|
+
"span",
|
|
58
|
+
{
|
|
59
|
+
className: `material-symbols-rounded ${baseClass}__replay-icon`,
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
children: "replay"
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label }),
|
|
68
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__value`, children: /* @__PURE__ */ jsx("code", { children: token }) }),
|
|
69
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__value`, children: value })
|
|
70
|
+
] });
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
MotionSwatch
|
|
74
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
NAV COMPONENT
|
|
3
|
+
Top navigation bar using ButtonGroup
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
.ds-nav {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
width: 100%;
|
|
11
|
+
max-width: 1440px;
|
|
12
|
+
height: 78px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* ============================================
|
|
16
|
+
BRAND / LOGO
|
|
17
|
+
============================================ */
|
|
18
|
+
|
|
19
|
+
.ds-nav__brand {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: var(--gap-lg); /* 20px */
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
color: var(--color-text-primary);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-nav__brand-icon {
|
|
29
|
+
width: 24px;
|
|
30
|
+
height: 24px;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ds-nav__brand-text {
|
|
35
|
+
font-family: var(--font-paragraph-em-family);
|
|
36
|
+
font-size: var(--font-paragraph-em-size);
|
|
37
|
+
font-weight: var(--font-paragraph-em-weight);
|
|
38
|
+
line-height: var(--font-paragraph-em-line-height);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* ============================================
|
|
42
|
+
RIGHT SECTION
|
|
43
|
+
============================================ */
|
|
44
|
+
|
|
45
|
+
.ds-nav__right {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: var(--gap-xl); /* 24px */
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
flex-wrap: nowrap;
|
|
51
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonGroupProps } from '../ButtonGroup/ButtonGroup';
|
|
3
|
+
export interface NavProps {
|
|
4
|
+
/** Brand/logo text */
|
|
5
|
+
brandText?: string;
|
|
6
|
+
/** Brand icon element (img, svg, etc.) */
|
|
7
|
+
brandIcon?: React.ReactNode;
|
|
8
|
+
/** Navigation buttons config — passed directly to ButtonGroup */
|
|
9
|
+
buttons: ButtonGroupProps['buttons'];
|
|
10
|
+
/** Additional elements rendered after the button group (e.g. ToggleSwitch) */
|
|
11
|
+
trailing?: React.ReactNode;
|
|
12
|
+
/** Additional CSS classes */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Nav component from Figma design system
|
|
17
|
+
* Renders a horizontal navigation bar using ButtonGroup
|
|
18
|
+
*/
|
|
19
|
+
export declare const Nav: ({ brandText, brandIcon, buttons, trailing, className, }: NavProps) => React.JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { ButtonGroup } from "../ButtonGroup/ButtonGroup.js";
|
|
4
|
+
import "./Nav.css";
|
|
5
|
+
const Nav = ({
|
|
6
|
+
brandText,
|
|
7
|
+
brandIcon,
|
|
8
|
+
buttons,
|
|
9
|
+
trailing,
|
|
10
|
+
className = ""
|
|
11
|
+
}) => {
|
|
12
|
+
const baseClass = "ds-nav";
|
|
13
|
+
return /* @__PURE__ */ jsxs("nav", { className: `${baseClass} ${className}`, children: [
|
|
14
|
+
(brandText || brandIcon) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__brand`, children: [
|
|
15
|
+
brandIcon && /* @__PURE__ */ jsx("span", { className: `${baseClass}__brand-icon`, children: brandIcon }),
|
|
16
|
+
brandText && /* @__PURE__ */ jsx("span", { className: `${baseClass}__brand-text`, children: brandText })
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__right`, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(ButtonGroup, { orientation: "horizontal", buttons }),
|
|
20
|
+
trailing
|
|
21
|
+
] })
|
|
22
|
+
] });
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
Nav
|
|
26
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
PAGINATION COMPONENT
|
|
3
|
+
Page navigation for long datasets
|
|
4
|
+
============================================ */
|
|
5
|
+
|
|
6
|
+
.ds-pagination {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: var(--gap-xs); /* 4px */
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ds-pagination__list {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: var(--gap-xs); /* 4px */
|
|
16
|
+
list-style: none;
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* ============================================
|
|
22
|
+
PAGE BUTTONS
|
|
23
|
+
Pill-shaped, matching CircularButton sizing
|
|
24
|
+
============================================ */
|
|
25
|
+
|
|
26
|
+
.ds-pagination__page,
|
|
27
|
+
.ds-pagination__arrow {
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
width: 40px;
|
|
32
|
+
height: 40px;
|
|
33
|
+
padding: 0;
|
|
34
|
+
border: none;
|
|
35
|
+
border-radius: var(--radius-full); /* pill */
|
|
36
|
+
background-color: transparent;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
transition: background-color var(--motion-duration-base) var(--motion-ease-standard), color var(--motion-duration-base) var(--motion-ease-standard);
|
|
39
|
+
font-family: var(--font-paragraph-em-family);
|
|
40
|
+
font-size: var(--font-paragraph-em-size);
|
|
41
|
+
font-weight: var(--font-paragraph-em-weight);
|
|
42
|
+
line-height: var(--font-paragraph-em-line-height);
|
|
43
|
+
letter-spacing: var(--font-paragraph-em-letter-spacing);
|
|
44
|
+
color: var(--color-text-secondary);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.ds-pagination__page:hover:not(:disabled):not(.ds-pagination__page--current),
|
|
48
|
+
.ds-pagination__arrow:hover:not(:disabled) {
|
|
49
|
+
background-color: var(--color-action-passive-bg-hover);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ds-pagination__page:focus-visible,
|
|
53
|
+
.ds-pagination__arrow:focus-visible {
|
|
54
|
+
outline: 2px solid var(--color-action-primary-bg);
|
|
55
|
+
outline-offset: 2px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ============================================
|
|
59
|
+
CURRENT PAGE
|
|
60
|
+
Same active treatment as SegmentedControl
|
|
61
|
+
============================================ */
|
|
62
|
+
|
|
63
|
+
.ds-pagination__page--current {
|
|
64
|
+
background-color: var(--color-action-primary-bg);
|
|
65
|
+
color: var(--color-action-primary-text);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ds-pagination__page--current:hover {
|
|
69
|
+
background-color: var(--color-action-primary-bg-hover);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ============================================
|
|
73
|
+
ARROWS
|
|
74
|
+
============================================ */
|
|
75
|
+
|
|
76
|
+
.ds-pagination__icon {
|
|
77
|
+
--icon-size: var(--icon-size-md);
|
|
78
|
+
line-height: 1;
|
|
79
|
+
color: var(--color-icon-primary);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ds-pagination__arrow:disabled {
|
|
83
|
+
opacity: 0.4;
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* ============================================
|
|
88
|
+
ELLIPSIS
|
|
89
|
+
============================================ */
|
|
90
|
+
|
|
91
|
+
.ds-pagination__ellipsis {
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
width: 40px;
|
|
96
|
+
height: 40px;
|
|
97
|
+
font-family: var(--font-paragraph-family);
|
|
98
|
+
font-size: var(--font-paragraph-size);
|
|
99
|
+
color: var(--color-text-tertiary);
|
|
100
|
+
user-select: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* ============================================
|
|
104
|
+
COMPACT
|
|
105
|
+
Prev/next arrows with a page readout
|
|
106
|
+
============================================ */
|
|
107
|
+
|
|
108
|
+
.ds-pagination--compact .ds-pagination__arrow {
|
|
109
|
+
width: 32px;
|
|
110
|
+
height: 32px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.ds-pagination--compact .ds-pagination__icon {
|
|
114
|
+
--icon-size: var(--icon-size-sm);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ds-pagination__readout {
|
|
118
|
+
padding: 0 var(--padding-sm); /* 8px */
|
|
119
|
+
font-family: var(--font-paragraph-sm-family);
|
|
120
|
+
font-size: var(--font-paragraph-sm-size);
|
|
121
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
122
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
123
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
124
|
+
color: var(--color-text-secondary);
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface PaginationProps {
|
|
2
|
+
/** Current page (1-based) */
|
|
3
|
+
page: number;
|
|
4
|
+
/** Total number of pages */
|
|
5
|
+
pageCount: number;
|
|
6
|
+
/** Callback with the requested page */
|
|
7
|
+
onPageChange: (page: number) => void;
|
|
8
|
+
/** Pages shown on each side of the current page */
|
|
9
|
+
siblingCount?: number;
|
|
10
|
+
/** Component size — compact swaps the numbers for a "Page X of Y" readout */
|
|
11
|
+
size?: 'default' | 'compact';
|
|
12
|
+
/** Accessible label for the nav landmark */
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
/** Additional CSS classes */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Pagination component — page navigation for long datasets.
|
|
19
|
+
* Numbered pages with ellipses for large ranges, or a compact
|
|
20
|
+
* prev/next readout. Pairs with Table.
|
|
21
|
+
*/
|
|
22
|
+
export declare const Pagination: ({ page, pageCount, onPageChange, siblingCount, size, ariaLabel, className, }: PaginationProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "./Pagination.css";
|
|
3
|
+
import "../../fonts/material-symbols.css";
|
|
4
|
+
const range = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
5
|
+
const getPageItems = (page, pageCount, siblingCount) => {
|
|
6
|
+
const totalNumbers = siblingCount * 2 + 5;
|
|
7
|
+
if (pageCount <= totalNumbers) {
|
|
8
|
+
return range(1, pageCount);
|
|
9
|
+
}
|
|
10
|
+
const leftSibling = Math.max(page - siblingCount, 1);
|
|
11
|
+
const rightSibling = Math.min(page + siblingCount, pageCount);
|
|
12
|
+
const showLeftEllipsis = leftSibling > 2;
|
|
13
|
+
const showRightEllipsis = rightSibling < pageCount - 1;
|
|
14
|
+
if (!showLeftEllipsis && showRightEllipsis) {
|
|
15
|
+
return [...range(1, 3 + 2 * siblingCount), "end-ellipsis", pageCount];
|
|
16
|
+
}
|
|
17
|
+
if (showLeftEllipsis && !showRightEllipsis) {
|
|
18
|
+
return [1, "start-ellipsis", ...range(pageCount - (2 + 2 * siblingCount), pageCount)];
|
|
19
|
+
}
|
|
20
|
+
return [1, "start-ellipsis", ...range(leftSibling, rightSibling), "end-ellipsis", pageCount];
|
|
21
|
+
};
|
|
22
|
+
const Pagination = ({
|
|
23
|
+
page,
|
|
24
|
+
pageCount,
|
|
25
|
+
onPageChange,
|
|
26
|
+
siblingCount = 1,
|
|
27
|
+
size = "default",
|
|
28
|
+
ariaLabel = "Pagination",
|
|
29
|
+
className = ""
|
|
30
|
+
}) => {
|
|
31
|
+
const baseClass = "ds-pagination";
|
|
32
|
+
const compact = size === "compact";
|
|
33
|
+
const clampedPage = Math.min(Math.max(page, 1), Math.max(pageCount, 1));
|
|
34
|
+
const isFirst = clampedPage <= 1;
|
|
35
|
+
const isLast = clampedPage >= pageCount;
|
|
36
|
+
const goTo = (target) => {
|
|
37
|
+
const next = Math.min(Math.max(target, 1), pageCount);
|
|
38
|
+
if (next !== clampedPage) onPageChange(next);
|
|
39
|
+
};
|
|
40
|
+
const classes = [baseClass, compact ? `${baseClass}--compact` : "", className].filter(Boolean).join(" ");
|
|
41
|
+
const arrowButton = (direction) => {
|
|
42
|
+
const disabled = direction === "previous" ? isFirst : isLast;
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
"button",
|
|
45
|
+
{
|
|
46
|
+
type: "button",
|
|
47
|
+
className: `${baseClass}__arrow`,
|
|
48
|
+
onClick: () => goTo(direction === "previous" ? clampedPage - 1 : clampedPage + 1),
|
|
49
|
+
disabled,
|
|
50
|
+
"aria-label": direction === "previous" ? "Previous page" : "Next page",
|
|
51
|
+
children: /* @__PURE__ */ jsx("span", { className: `${baseClass}__icon material-symbols-rounded`, "aria-hidden": "true", children: direction === "previous" ? "chevron_left" : "chevron_right" })
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ jsxs("nav", { className: classes, "aria-label": ariaLabel, children: [
|
|
56
|
+
arrowButton("previous"),
|
|
57
|
+
compact ? /* @__PURE__ */ jsxs("span", { className: `${baseClass}__readout`, "aria-live": "polite", children: [
|
|
58
|
+
"Page ",
|
|
59
|
+
clampedPage,
|
|
60
|
+
" of ",
|
|
61
|
+
pageCount
|
|
62
|
+
] }) : /* @__PURE__ */ jsx("ul", { className: `${baseClass}__list`, children: getPageItems(clampedPage, pageCount, siblingCount).map(
|
|
63
|
+
(item) => typeof item === "number" ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
64
|
+
"button",
|
|
65
|
+
{
|
|
66
|
+
type: "button",
|
|
67
|
+
className: [
|
|
68
|
+
`${baseClass}__page`,
|
|
69
|
+
item === clampedPage ? `${baseClass}__page--current` : ""
|
|
70
|
+
].filter(Boolean).join(" "),
|
|
71
|
+
onClick: () => goTo(item),
|
|
72
|
+
"aria-current": item === clampedPage ? "page" : void 0,
|
|
73
|
+
"aria-label": `Page ${item}`,
|
|
74
|
+
children: item
|
|
75
|
+
}
|
|
76
|
+
) }, item) : /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("span", { className: `${baseClass}__ellipsis`, "aria-hidden": "true", children: "…" }) }, item)
|
|
77
|
+
) }),
|
|
78
|
+
arrowButton("next")
|
|
79
|
+
] });
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
Pagination
|
|
83
|
+
};
|