@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.
Files changed (223) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +127 -0
  3. package/charts.d.ts +14 -0
  4. package/charts.js +20 -0
  5. package/components/Accordion/Accordion.css +119 -0
  6. package/components/Accordion/Accordion.d.ts +24 -0
  7. package/components/Accordion/Accordion.js +76 -0
  8. package/components/Alert/Alert.css +252 -0
  9. package/components/Alert/Alert.d.ts +24 -0
  10. package/components/Alert/Alert.js +53 -0
  11. package/components/AlertDialog/AlertDialog.css +131 -0
  12. package/components/AlertDialog/AlertDialog.d.ts +29 -0
  13. package/components/AlertDialog/AlertDialog.js +143 -0
  14. package/components/AppLayout/AppLayout.css +52 -0
  15. package/components/AppLayout/AppLayout.d.ts +27 -0
  16. package/components/AppLayout/AppLayout.js +45 -0
  17. package/components/AppSidebar/AppSidebar.css +434 -0
  18. package/components/AppSidebar/AppSidebar.d.ts +67 -0
  19. package/components/AppSidebar/AppSidebar.js +272 -0
  20. package/components/Avatar/Avatar.css +133 -0
  21. package/components/Avatar/Avatar.d.ts +20 -0
  22. package/components/Avatar/Avatar.js +56 -0
  23. package/components/Avatar/demoAvatars.d.ts +14 -0
  24. package/components/Avatar/demoAvatars.js +16 -0
  25. package/components/Badge/Badge.css +68 -0
  26. package/components/Badge/Badge.d.ts +13 -0
  27. package/components/Badge/Badge.js +15 -0
  28. package/components/Breadcrumb/Breadcrumb.css +92 -0
  29. package/components/Breadcrumb/Breadcrumb.d.ts +19 -0
  30. package/components/Breadcrumb/Breadcrumb.js +39 -0
  31. package/components/Button/Button.css +381 -0
  32. package/components/Button/Button.d.ts +39 -0
  33. package/components/Button/Button.js +71 -0
  34. package/components/ButtonGroup/ButtonGroup.css +39 -0
  35. package/components/ButtonGroup/ButtonGroup.d.ts +13 -0
  36. package/components/ButtonGroup/ButtonGroup.js +37 -0
  37. package/components/Card/Card.css +169 -0
  38. package/components/Card/Card.d.ts +30 -0
  39. package/components/Card/Card.js +90 -0
  40. package/components/Carousel/Carousel.css +112 -0
  41. package/components/Carousel/Carousel.d.ts +25 -0
  42. package/components/Carousel/Carousel.js +126 -0
  43. package/components/Chart/AreaChart.d.ts +36 -0
  44. package/components/Chart/AreaChart.js +99 -0
  45. package/components/Chart/BarChart.d.ts +34 -0
  46. package/components/Chart/BarChart.js +107 -0
  47. package/components/Chart/Chart.css +176 -0
  48. package/components/Chart/LineChart.d.ts +34 -0
  49. package/components/Chart/LineChart.js +90 -0
  50. package/components/Chart/PieChart.d.ts +34 -0
  51. package/components/Chart/PieChart.js +106 -0
  52. package/components/Chart/RadarChart.d.ts +34 -0
  53. package/components/Chart/RadarChart.js +91 -0
  54. package/components/Chart/RadialChart.d.ts +37 -0
  55. package/components/Chart/RadialChart.js +119 -0
  56. package/components/Chart/ScatterChart.d.ts +36 -0
  57. package/components/Chart/ScatterChart.js +109 -0
  58. package/components/Chart/StackedBarChart.d.ts +34 -0
  59. package/components/Chart/StackedBarChart.js +111 -0
  60. package/components/Chart/Treemap.d.ts +33 -0
  61. package/components/Chart/Treemap.js +109 -0
  62. package/components/Checkbox/Checkbox.css +164 -0
  63. package/components/Checkbox/Checkbox.d.ts +45 -0
  64. package/components/Checkbox/Checkbox.js +125 -0
  65. package/components/Chip/Chip.css +195 -0
  66. package/components/Chip/Chip.d.ts +27 -0
  67. package/components/Chip/Chip.js +80 -0
  68. package/components/CircularButton/CircularButton.css +206 -0
  69. package/components/CircularButton/CircularButton.d.ts +30 -0
  70. package/components/CircularButton/CircularButton.js +54 -0
  71. package/components/CodeBlock/CodeBlock.css +180 -0
  72. package/components/CodeBlock/CodeBlock.d.ts +23 -0
  73. package/components/CodeBlock/CodeBlock.js +85 -0
  74. package/components/ColourSwatch/ColourSwatch.css +88 -0
  75. package/components/ColourSwatch/ColourSwatch.d.ts +34 -0
  76. package/components/ColourSwatch/ColourSwatch.js +42 -0
  77. package/components/Combobox/Combobox.css +411 -0
  78. package/components/Combobox/Combobox.d.ts +73 -0
  79. package/components/Combobox/Combobox.js +312 -0
  80. package/components/CommandPalette/CommandPalette.css +310 -0
  81. package/components/CommandPalette/CommandPalette.d.ts +60 -0
  82. package/components/CommandPalette/CommandPalette.js +263 -0
  83. package/components/ContactCard/ContactCard.css +123 -0
  84. package/components/ContactCard/ContactCard.d.ts +23 -0
  85. package/components/ContactCard/ContactCard.js +78 -0
  86. package/components/ContributionGraph/ContributionGraph.css +142 -0
  87. package/components/ContributionGraph/ContributionGraph.d.ts +26 -0
  88. package/components/ContributionGraph/ContributionGraph.js +125 -0
  89. package/components/DateInput/DateInput.css +163 -0
  90. package/components/DateInput/DateInput.d.ts +43 -0
  91. package/components/DateInput/DateInput.js +69 -0
  92. package/components/DatePicker/DatePicker.css +198 -0
  93. package/components/DatePicker/DatePicker.d.ts +22 -0
  94. package/components/DatePicker/DatePicker.js +170 -0
  95. package/components/Dialog/Dialog.css +176 -0
  96. package/components/Dialog/Dialog.d.ts +28 -0
  97. package/components/Dialog/Dialog.js +132 -0
  98. package/components/Divider/Divider.css +100 -0
  99. package/components/Divider/Divider.d.ts +18 -0
  100. package/components/Divider/Divider.js +31 -0
  101. package/components/Drawer/Drawer.css +262 -0
  102. package/components/Drawer/Drawer.d.ts +30 -0
  103. package/components/Drawer/Drawer.js +134 -0
  104. package/components/Dropdown/Dropdown.css +300 -0
  105. package/components/Dropdown/Dropdown.d.ts +48 -0
  106. package/components/Dropdown/Dropdown.js +196 -0
  107. package/components/DropdownMenu/DropdownMenu.css +303 -0
  108. package/components/DropdownMenu/DropdownMenu.d.ts +42 -0
  109. package/components/DropdownMenu/DropdownMenu.js +322 -0
  110. package/components/EmptyState/EmptyState.css +115 -0
  111. package/components/EmptyState/EmptyState.d.ts +27 -0
  112. package/components/EmptyState/EmptyState.js +32 -0
  113. package/components/EntityCard/EntityCard.css +69 -0
  114. package/components/EntityCard/EntityCard.d.ts +18 -0
  115. package/components/EntityCard/EntityCard.js +26 -0
  116. package/components/Figure/Figure.css +61 -0
  117. package/components/Figure/Figure.d.ts +17 -0
  118. package/components/Figure/Figure.js +35 -0
  119. package/components/FileInput/FileInput.css +308 -0
  120. package/components/FileInput/FileInput.d.ts +54 -0
  121. package/components/FileInput/FileInput.js +177 -0
  122. package/components/Input/Input.css +193 -0
  123. package/components/Input/Input.d.ts +40 -0
  124. package/components/Input/Input.js +71 -0
  125. package/components/Instructions/Instructions.css +216 -0
  126. package/components/Instructions/Instructions.d.ts +28 -0
  127. package/components/Instructions/Instructions.js +32 -0
  128. package/components/LinkList/LinkList.css +71 -0
  129. package/components/LinkList/LinkList.d.ts +20 -0
  130. package/components/LinkList/LinkList.js +41 -0
  131. package/components/MotionSwatch/MotionSwatch.css +176 -0
  132. package/components/MotionSwatch/MotionSwatch.d.ts +25 -0
  133. package/components/MotionSwatch/MotionSwatch.js +74 -0
  134. package/components/Nav/Nav.css +51 -0
  135. package/components/Nav/Nav.d.ts +19 -0
  136. package/components/Nav/Nav.js +26 -0
  137. package/components/Pagination/Pagination.css +126 -0
  138. package/components/Pagination/Pagination.d.ts +22 -0
  139. package/components/Pagination/Pagination.js +83 -0
  140. package/components/Popover/Popover.css +99 -0
  141. package/components/Popover/Popover.d.ts +28 -0
  142. package/components/Popover/Popover.js +102 -0
  143. package/components/ProgressBar/ProgressBar.css +60 -0
  144. package/components/ProgressBar/ProgressBar.d.ts +16 -0
  145. package/components/ProgressBar/ProgressBar.js +27 -0
  146. package/components/Quote/Quote.css +79 -0
  147. package/components/Quote/Quote.d.ts +18 -0
  148. package/components/Quote/Quote.js +26 -0
  149. package/components/RadioButton/RadioButton.css +132 -0
  150. package/components/RadioButton/RadioButton.d.ts +43 -0
  151. package/components/RadioButton/RadioButton.js +77 -0
  152. package/components/SectionTitle/SectionTitle.css +37 -0
  153. package/components/SectionTitle/SectionTitle.d.ts +10 -0
  154. package/components/SectionTitle/SectionTitle.js +17 -0
  155. package/components/SegmentedControl/SegmentedControl.css +129 -0
  156. package/components/SegmentedControl/SegmentedControl.d.ts +33 -0
  157. package/components/SegmentedControl/SegmentedControl.js +91 -0
  158. package/components/SelectionCard/SelectionCard.css +251 -0
  159. package/components/SelectionCard/SelectionCard.d.ts +26 -0
  160. package/components/SelectionCard/SelectionCard.js +85 -0
  161. package/components/Skeleton/Skeleton.css +79 -0
  162. package/components/Skeleton/Skeleton.d.ts +16 -0
  163. package/components/Skeleton/Skeleton.js +30 -0
  164. package/components/Slider/Slider.css +86 -0
  165. package/components/Slider/Slider.d.ts +25 -0
  166. package/components/Slider/Slider.js +46 -0
  167. package/components/SpacingSwatch/SpacingSwatch.css +108 -0
  168. package/components/SpacingSwatch/SpacingSwatch.d.ts +20 -0
  169. package/components/SpacingSwatch/SpacingSwatch.js +50 -0
  170. package/components/Spinner/Spinner.css +73 -0
  171. package/components/Spinner/Spinner.d.ts +14 -0
  172. package/components/Spinner/Spinner.js +42 -0
  173. package/components/Stat/Stat.css +78 -0
  174. package/components/Stat/Stat.d.ts +19 -0
  175. package/components/Stat/Stat.js +30 -0
  176. package/components/Table/Table.css +186 -0
  177. package/components/Table/Table.d.ts +45 -0
  178. package/components/Table/Table.js +65 -0
  179. package/components/Tabs/Tabs.css +140 -0
  180. package/components/Tabs/Tabs.d.ts +28 -0
  181. package/components/Tabs/Tabs.js +77 -0
  182. package/components/Textarea/Textarea.css +152 -0
  183. package/components/Textarea/Textarea.d.ts +40 -0
  184. package/components/Textarea/Textarea.js +74 -0
  185. package/components/Timeline/Timeline.css +339 -0
  186. package/components/Timeline/Timeline.d.ts +63 -0
  187. package/components/Timeline/Timeline.js +69 -0
  188. package/components/Toast/Toast.css +342 -0
  189. package/components/Toast/Toast.d.ts +63 -0
  190. package/components/Toast/Toast.js +213 -0
  191. package/components/ToggleGroup/ToggleGroup.css +84 -0
  192. package/components/ToggleGroup/ToggleGroup.d.ts +30 -0
  193. package/components/ToggleGroup/ToggleGroup.js +53 -0
  194. package/components/ToggleSwitch/ToggleSwitch.css +139 -0
  195. package/components/ToggleSwitch/ToggleSwitch.d.ts +23 -0
  196. package/components/ToggleSwitch/ToggleSwitch.js +50 -0
  197. package/components/Tooltip/Tooltip.css +122 -0
  198. package/components/Tooltip/Tooltip.d.ts +21 -0
  199. package/components/Tooltip/Tooltip.js +63 -0
  200. package/components/TypographySwatch/TypographySwatch.css +81 -0
  201. package/components/TypographySwatch/TypographySwatch.d.ts +24 -0
  202. package/components/TypographySwatch/TypographySwatch.js +40 -0
  203. package/components/registry.d.ts +20 -0
  204. package/components/registry.js +7 -0
  205. package/components/registry.json +67 -0
  206. package/components/registry.json.d.ts +70 -0
  207. package/components/registry.json.js +8 -0
  208. package/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.woff2 +0 -0
  209. package/fonts/material-symbols.css +94 -0
  210. package/index.d.ts +62 -0
  211. package/index.js +123 -0
  212. package/package.json +63 -0
  213. package/tokens/registry.d.ts +22 -0
  214. package/tokens/registry.js +14 -0
  215. package/tokens/registry.json +203 -0
  216. package/tokens/registry.json.d.ts +206 -0
  217. package/tokens/registry.json.js +8 -0
  218. package/tokens/tokens-dark.css +119 -0
  219. package/tokens/tokens-light.css +159 -0
  220. package/tokens/tokens-motion.css +68 -0
  221. package/tokens/tokens-primitives.css +176 -0
  222. package/tokens/tokens-typography.css +116 -0
  223. package/tokens/tokens.css +11 -0
@@ -0,0 +1,77 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import "./RadioButton.css";
4
+ const RadioButton = ({
5
+ label,
6
+ checked = false,
7
+ disabled = false,
8
+ value = "",
9
+ onChange,
10
+ className = "",
11
+ ariaLabel
12
+ }) => {
13
+ const baseClass = "ds-radio";
14
+ const checkedClass = checked ? `${baseClass}--checked` : "";
15
+ const disabledClass = disabled ? `${baseClass}--disabled` : "";
16
+ const classes = [baseClass, checkedClass, disabledClass, className].filter(Boolean).join(" ");
17
+ const handleClick = () => {
18
+ if (!disabled && onChange) {
19
+ onChange(value);
20
+ }
21
+ };
22
+ const handleKeyDown = (e) => {
23
+ if (e.key === " " || e.key === "Enter") {
24
+ e.preventDefault();
25
+ handleClick();
26
+ }
27
+ };
28
+ return /* @__PURE__ */ jsxs(
29
+ "div",
30
+ {
31
+ className: classes,
32
+ onClick: handleClick,
33
+ onKeyDown: handleKeyDown,
34
+ role: "radio",
35
+ "aria-checked": checked,
36
+ "aria-disabled": disabled,
37
+ "aria-label": ariaLabel || label,
38
+ tabIndex: disabled ? -1 : 0,
39
+ children: [
40
+ /* @__PURE__ */ jsx("div", { className: `${baseClass}__circle`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__dot` }) }),
41
+ label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label })
42
+ ]
43
+ }
44
+ );
45
+ };
46
+ const RadioGroup = ({
47
+ label,
48
+ value,
49
+ name,
50
+ options,
51
+ direction = "vertical",
52
+ onChange,
53
+ className = ""
54
+ }) => {
55
+ const baseClass = "ds-radio-group";
56
+ const directionClass = `${baseClass}--${direction}`;
57
+ const classes = [baseClass, directionClass, className].filter(Boolean).join(" ");
58
+ return /* @__PURE__ */ jsxs("div", { className: classes, role: "radiogroup", "aria-label": label, children: [
59
+ label && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label }),
60
+ /* @__PURE__ */ jsx("div", { className: `${baseClass}__options`, children: options.map((option) => /* @__PURE__ */ jsx(
61
+ RadioButton,
62
+ {
63
+ label: option.label,
64
+ value: option.value,
65
+ name,
66
+ checked: value === option.value,
67
+ disabled: option.disabled,
68
+ onChange
69
+ },
70
+ option.value
71
+ )) })
72
+ ] });
73
+ };
74
+ export {
75
+ RadioButton,
76
+ RadioGroup
77
+ };
@@ -0,0 +1,37 @@
1
+ /* ============================================
2
+ SECTION TITLE COMPONENT
3
+ Heading with divider line, optional trailing content
4
+ ============================================ */
5
+
6
+ .ds-section-title {
7
+ display: flex;
8
+ align-items: baseline;
9
+ gap: var(--gap-md);
10
+ border-bottom: 1px solid var(--color-divider);
11
+ padding-bottom: var(--padding-xl);
12
+ }
13
+
14
+ /* ============================================
15
+ HEADING
16
+ ============================================ */
17
+
18
+ .ds-section-title__heading {
19
+ font-family: var(--font-heading-2-family);
20
+ font-size: var(--font-heading-2-size);
21
+ font-weight: var(--font-heading-2-weight);
22
+ line-height: var(--font-heading-2-line-height);
23
+ letter-spacing: var(--font-heading-2-letter-spacing);
24
+ color: var(--color-text-secondary);
25
+ }
26
+
27
+ /* ============================================
28
+ TRAILING CONTENT (count, badge, metadata)
29
+ ============================================ */
30
+
31
+ .ds-section-title__trailing {
32
+ font-family: var(--font-paragraph-family);
33
+ font-size: var(--font-paragraph-size);
34
+ font-weight: var(--font-paragraph-weight);
35
+ line-height: var(--font-paragraph-line-height);
36
+ color: var(--color-text-tertiary);
37
+ }
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ export interface SectionTitleProps {
3
+ /** Section heading text */
4
+ title: string;
5
+ /** Optional trailing content (count, badge, metadata) */
6
+ trailing?: React.ReactNode;
7
+ /** Additional CSS classes */
8
+ className?: string;
9
+ }
10
+ export declare function SectionTitle({ title, trailing, className, }: SectionTitleProps): React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import "./SectionTitle.css";
4
+ function SectionTitle({
5
+ title,
6
+ trailing,
7
+ className
8
+ }) {
9
+ const classes = ["ds-section-title", className].filter(Boolean).join(" ");
10
+ return /* @__PURE__ */ jsxs("div", { className: classes, children: [
11
+ /* @__PURE__ */ jsx("h2", { className: "ds-section-title__heading", children: title }),
12
+ trailing !== void 0 && trailing !== null && /* @__PURE__ */ jsx("span", { className: "ds-section-title__trailing", children: trailing })
13
+ ] });
14
+ }
15
+ export {
16
+ SectionTitle
17
+ };
@@ -0,0 +1,129 @@
1
+ /* ============================================
2
+ SEGMENTED CONTROL COMPONENT
3
+ Pill-style toggle between related views
4
+ ============================================ */
5
+
6
+ .ds-segmented-control {
7
+ display: inline-flex;
8
+ align-items: center;
9
+ gap: var(--gap-xxs); /* 2px */
10
+ padding: var(--padding-xxs); /* 4px */
11
+ border-radius: var(--radius-full); /* pill shape */
12
+ background-color: var(--color-bg-container-primary);
13
+ border: var(--border-xs) solid var(--color-bg-container-border);
14
+ }
15
+
16
+ /* ============================================
17
+ FULL WIDTH
18
+ ============================================ */
19
+
20
+ .ds-segmented-control--full-width {
21
+ width: 100%;
22
+ }
23
+
24
+ .ds-segmented-control--full-width .ds-segmented-control__segment {
25
+ flex: 1;
26
+ }
27
+
28
+ /* ============================================
29
+ SEGMENT BUTTON
30
+ ============================================ */
31
+
32
+ .ds-segmented-control__segment {
33
+ display: inline-flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ gap: var(--gap-sm); /* 8px */
37
+ padding: var(--padding-sm) var(--padding-md); /* 8px 16px */
38
+ border: none;
39
+ border-radius: var(--radius-full); /* pill shape */
40
+ background-color: transparent;
41
+ cursor: pointer;
42
+ transition: background-color var(--motion-duration-base) var(--motion-ease-standard), color var(--motion-duration-base) var(--motion-ease-standard);
43
+ white-space: nowrap;
44
+ position: relative;
45
+ }
46
+
47
+ /* Typography — paragraph em (medium weight) for clickable controls */
48
+ .ds-segmented-control__label {
49
+ font-family: var(--font-paragraph-em-family);
50
+ font-size: var(--font-paragraph-em-size);
51
+ font-weight: var(--font-paragraph-em-weight);
52
+ line-height: var(--font-paragraph-em-line-height);
53
+ letter-spacing: var(--font-paragraph-em-letter-spacing);
54
+ color: var(--color-text-secondary);
55
+ transition: color var(--motion-duration-base) var(--motion-ease-standard);
56
+ }
57
+
58
+ /* Icon */
59
+ .ds-segmented-control__icon {
60
+ flex-shrink: 0;
61
+ --icon-size: var(--icon-size-md);
62
+ line-height: 1;
63
+ color: var(--color-icon-secondary);
64
+ transition: color var(--motion-duration-base) var(--motion-ease-standard);
65
+ }
66
+
67
+ /* ============================================
68
+ HOVER STATE
69
+ ============================================ */
70
+
71
+ .ds-segmented-control__segment:not(.ds-segmented-control__segment--active):not(.ds-segmented-control__segment--disabled):hover {
72
+ background-color: var(--color-action-passive-bg-hover);
73
+ }
74
+
75
+ /* ============================================
76
+ ACTIVE STATE
77
+ ============================================ */
78
+
79
+ .ds-segmented-control__segment--active {
80
+ background-color: var(--color-action-primary-bg);
81
+ }
82
+
83
+ .ds-segmented-control__segment--active .ds-segmented-control__label {
84
+ color: var(--color-action-primary-text);
85
+ }
86
+
87
+ .ds-segmented-control__segment--active .ds-segmented-control__icon {
88
+ color: var(--color-action-primary-text);
89
+ }
90
+
91
+ .ds-segmented-control__segment--active:hover {
92
+ background-color: var(--color-action-primary-bg-hover);
93
+ }
94
+
95
+ /* ============================================
96
+ DISABLED STATE
97
+ ============================================ */
98
+
99
+ .ds-segmented-control__segment--disabled {
100
+ opacity: 0.4;
101
+ cursor: not-allowed;
102
+ }
103
+
104
+ /* ============================================
105
+ FOCUS
106
+ ============================================ */
107
+
108
+ .ds-segmented-control__segment:focus-visible {
109
+ outline: 2px solid var(--color-action-primary-bg);
110
+ outline-offset: 2px;
111
+ }
112
+
113
+ /* ============================================
114
+ SIZE — COMPACT
115
+ ============================================ */
116
+
117
+ .ds-segmented-control--compact .ds-segmented-control__segment {
118
+ padding: var(--padding-xs) var(--padding-sm-md); /* 6px 12px */
119
+ }
120
+
121
+ .ds-segmented-control--compact .ds-segmented-control__label {
122
+ font-size: var(--font-paragraph-sm-em-size);
123
+ line-height: var(--font-paragraph-sm-em-line-height);
124
+ letter-spacing: var(--font-paragraph-sm-em-letter-spacing);
125
+ }
126
+
127
+ .ds-segmented-control--compact .ds-segmented-control__icon {
128
+ --icon-size: var(--icon-size-sm);
129
+ }
@@ -0,0 +1,33 @@
1
+ import { default as React } from 'react';
2
+ export interface Segment {
3
+ /** Unique value for this segment */
4
+ value: string;
5
+ /** Display label */
6
+ label: string;
7
+ /** Optional Material Symbol icon name */
8
+ icon?: string;
9
+ /** Whether disabled */
10
+ disabled?: boolean;
11
+ }
12
+ export interface SegmentedControlProps {
13
+ /** Array of segments */
14
+ segments: Segment[];
15
+ /** Currently active segment value */
16
+ activeSegment: string;
17
+ /** Callback when segment changes */
18
+ onSegmentChange?: (value: string) => void;
19
+ /** Component size */
20
+ size?: 'default' | 'compact';
21
+ /** Full width — segments fill container */
22
+ fullWidth?: boolean;
23
+ /** Accessible label for the tablist */
24
+ ariaLabel?: string;
25
+ /** Additional CSS classes */
26
+ className?: string;
27
+ }
28
+ /**
29
+ * Segmented control for toggling between related views.
30
+ * A horizontal set of mutually exclusive options with a
31
+ * pill-shaped active indicator. Supports icons and keyboard navigation.
32
+ */
33
+ export declare const SegmentedControl: ({ segments, activeSegment, onSegmentChange, size, fullWidth, ariaLabel, className, }: SegmentedControlProps) => React.JSX.Element;
@@ -0,0 +1,91 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import "./SegmentedControl.css";
4
+ import "../../fonts/material-symbols.css";
5
+ const SegmentedControl = ({
6
+ segments,
7
+ activeSegment,
8
+ onSegmentChange,
9
+ size = "default",
10
+ fullWidth = false,
11
+ ariaLabel,
12
+ className = ""
13
+ }) => {
14
+ const baseClass = "ds-segmented-control";
15
+ const sizeClass = `${baseClass}--${size}`;
16
+ const fullWidthClass = fullWidth ? `${baseClass}--full-width` : "";
17
+ const containerRef = useRef(null);
18
+ const classes = [baseClass, sizeClass, fullWidthClass, className].filter(Boolean).join(" ");
19
+ const handleKeyDown = (e, idx) => {
20
+ const enabledSegments = segments.filter((s) => !s.disabled);
21
+ const currentEnabledIdx = enabledSegments.findIndex((s) => s.value === segments[idx].value);
22
+ let nextIdx = -1;
23
+ if (e.key === "ArrowRight") {
24
+ e.preventDefault();
25
+ nextIdx = (currentEnabledIdx + 1) % enabledSegments.length;
26
+ } else if (e.key === "ArrowLeft") {
27
+ e.preventDefault();
28
+ nextIdx = (currentEnabledIdx - 1 + enabledSegments.length) % enabledSegments.length;
29
+ } else if (e.key === "Home") {
30
+ e.preventDefault();
31
+ nextIdx = 0;
32
+ } else if (e.key === "End") {
33
+ e.preventDefault();
34
+ nextIdx = enabledSegments.length - 1;
35
+ }
36
+ if (nextIdx >= 0) {
37
+ const nextSegment = enabledSegments[nextIdx];
38
+ onSegmentChange?.(nextSegment.value);
39
+ const buttons = containerRef.current?.querySelectorAll(
40
+ `[data-segment-value]`
41
+ );
42
+ buttons?.forEach((btn) => {
43
+ if (btn.dataset.segmentValue === nextSegment.value) {
44
+ btn.focus();
45
+ }
46
+ });
47
+ }
48
+ };
49
+ return /* @__PURE__ */ jsx("div", { className: classes, role: "tablist", "aria-label": ariaLabel, ref: containerRef, children: segments.map((segment, idx) => {
50
+ const isActive = segment.value === activeSegment;
51
+ const btnClasses = [
52
+ `${baseClass}__segment`,
53
+ isActive ? `${baseClass}__segment--active` : "",
54
+ segment.disabled ? `${baseClass}__segment--disabled` : ""
55
+ ].filter(Boolean).join(" ");
56
+ return /* @__PURE__ */ jsxs(
57
+ "button",
58
+ {
59
+ type: "button",
60
+ role: "tab",
61
+ className: btnClasses,
62
+ "aria-selected": isActive,
63
+ "aria-disabled": segment.disabled || void 0,
64
+ disabled: segment.disabled,
65
+ tabIndex: isActive ? 0 : -1,
66
+ "data-segment-value": segment.value,
67
+ onClick: () => {
68
+ if (!segment.disabled) {
69
+ onSegmentChange?.(segment.value);
70
+ }
71
+ },
72
+ onKeyDown: (e) => handleKeyDown(e, idx),
73
+ children: [
74
+ segment.icon && /* @__PURE__ */ jsx(
75
+ "span",
76
+ {
77
+ className: `${baseClass}__icon material-symbols-rounded`,
78
+ "aria-hidden": "true",
79
+ children: segment.icon
80
+ }
81
+ ),
82
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: segment.label })
83
+ ]
84
+ },
85
+ segment.value
86
+ );
87
+ }) });
88
+ };
89
+ export {
90
+ SegmentedControl
91
+ };
@@ -0,0 +1,251 @@
1
+ /* ============================================
2
+ SELECTION CARD COMPONENT
3
+ Large selectable option cards with radio or
4
+ checkbox indicators. Used for high-visibility
5
+ choice interfaces like settings and onboarding.
6
+ ============================================ */
7
+
8
+ /* ============================================
9
+ GROUP — vertical stack of cards
10
+ ============================================ */
11
+
12
+ .ds-selection-card-group {
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: var(--gap-sm); /* 8px */
16
+ }
17
+
18
+ /* ============================================
19
+ CARD — single option
20
+ ============================================ */
21
+
22
+ .ds-selection-card {
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: space-between;
26
+ gap: var(--gap-lg); /* 20px */
27
+ padding: var(--padding-md); /* 16px */
28
+ border: var(--border-xs) solid var(--color-bg-container-border);
29
+ border-radius: var(--radius-md); /* 12px */
30
+ background-color: transparent;
31
+ cursor: pointer;
32
+ user-select: none;
33
+ transition: border-color var(--motion-duration-base) var(--motion-ease-standard), background-color var(--motion-duration-base) var(--motion-ease-standard);
34
+ }
35
+
36
+ /* ============================================
37
+ HOVER STATE
38
+ ============================================ */
39
+
40
+ .ds-selection-card:not(.ds-selection-card--disabled):hover {
41
+ border-color: var(--color-action-primary-border);
42
+ }
43
+
44
+ /* ============================================
45
+ SELECTED STATE
46
+ ============================================ */
47
+
48
+ .ds-selection-card--selected {
49
+ border-color: var(--color-action-primary-border);
50
+ background-color: var(--color-bg-container-primary-semi);
51
+ }
52
+
53
+ /* ============================================
54
+ DISABLED STATE
55
+ ============================================ */
56
+
57
+ .ds-selection-card--disabled {
58
+ opacity: 0.4;
59
+ cursor: not-allowed;
60
+ }
61
+
62
+ /* ============================================
63
+ FOCUS STATE
64
+ ============================================ */
65
+
66
+ .ds-selection-card:focus-visible {
67
+ outline: 2px solid var(--color-action-primary-bg);
68
+ outline-offset: 2px;
69
+ }
70
+
71
+ /* ============================================
72
+ CONTENT — label + description
73
+ ============================================ */
74
+
75
+ .ds-selection-card__content {
76
+ display: flex;
77
+ flex-direction: column;
78
+ gap: var(--gap-xxs); /* 4px */
79
+ min-width: 0;
80
+ }
81
+
82
+ .ds-selection-card__label {
83
+ font-family: var(--font-paragraph-em-family);
84
+ font-size: var(--font-paragraph-em-size);
85
+ font-weight: var(--font-paragraph-em-weight);
86
+ line-height: var(--font-paragraph-em-line-height);
87
+ letter-spacing: var(--font-paragraph-em-letter-spacing);
88
+ color: var(--color-text-primary);
89
+ }
90
+
91
+ .ds-selection-card__description {
92
+ font-family: var(--font-paragraph-sm-family);
93
+ font-size: var(--font-paragraph-sm-size);
94
+ font-weight: var(--font-paragraph-sm-weight);
95
+ line-height: var(--font-paragraph-sm-line-height);
96
+ letter-spacing: var(--font-paragraph-sm-letter-spacing);
97
+ color: var(--color-text-secondary);
98
+ }
99
+
100
+ /* ============================================
101
+ INDICATOR — radio, checkbox, or toggle
102
+ ============================================ */
103
+
104
+ .ds-selection-card__indicator {
105
+ flex-shrink: 0;
106
+ }
107
+
108
+ /* ============================================
109
+ RADIO INDICATOR
110
+ ============================================ */
111
+
112
+ .ds-selection-card__radio {
113
+ width: 24px;
114
+ height: 24px;
115
+ border: var(--border-md) solid var(--color-bg-container-border);
116
+ border-radius: var(--radius-full);
117
+ background-color: var(--color-bg-container-primary-transparent);
118
+ display: flex;
119
+ align-items: center;
120
+ justify-content: center;
121
+ transition: border-color var(--motion-duration-base) var(--motion-ease-standard);
122
+ }
123
+
124
+ .ds-selection-card__radio-dot {
125
+ width: 12px;
126
+ height: 12px;
127
+ border-radius: var(--radius-full);
128
+ background-color: var(--color-action-primary-bg);
129
+ transform: scale(0);
130
+ transition: transform var(--motion-duration-base) var(--motion-ease-standard);
131
+ }
132
+
133
+ /* Selected radio */
134
+ .ds-selection-card--selected .ds-selection-card__radio {
135
+ border-color: var(--color-action-primary-bg);
136
+ }
137
+
138
+ .ds-selection-card--selected .ds-selection-card__radio-dot {
139
+ transform: scale(1);
140
+ }
141
+
142
+ /* Hover radio (unselected) */
143
+ .ds-selection-card:not(.ds-selection-card--disabled):not(.ds-selection-card--selected):hover .ds-selection-card__radio {
144
+ border-color: var(--color-action-primary-bg);
145
+ }
146
+
147
+ /* Hover radio (selected) */
148
+ .ds-selection-card--selected:not(.ds-selection-card--disabled):hover .ds-selection-card__radio {
149
+ border-color: var(--color-action-primary-bg-hover);
150
+ }
151
+
152
+ .ds-selection-card--selected:not(.ds-selection-card--disabled):hover .ds-selection-card__radio-dot {
153
+ background-color: var(--color-action-primary-bg-hover);
154
+ }
155
+
156
+ /* ============================================
157
+ CHECKBOX INDICATOR
158
+ ============================================ */
159
+
160
+ .ds-selection-card__checkbox {
161
+ width: 24px;
162
+ height: 24px;
163
+ box-sizing: border-box;
164
+ border: var(--border-md) solid var(--color-bg-container-border);
165
+ border-radius: var(--radius-sm); /* 8px */
166
+ background-color: var(--color-bg-container-primary-transparent);
167
+ display: flex;
168
+ align-items: center;
169
+ justify-content: center;
170
+ transition: background-color var(--motion-duration-base) var(--motion-ease-standard), border-color var(--motion-duration-base) var(--motion-ease-standard);
171
+ }
172
+
173
+ .ds-selection-card__check-icon {
174
+ width: 14px;
175
+ height: 14px;
176
+ color: var(--color-action-primary-text-active);
177
+ opacity: 0;
178
+ transition: opacity var(--motion-duration-base) var(--motion-ease-standard);
179
+ }
180
+
181
+ /* Selected checkbox */
182
+ .ds-selection-card--selected .ds-selection-card__checkbox {
183
+ background-color: var(--color-action-primary-bg);
184
+ border-color: var(--color-action-primary-bg);
185
+ }
186
+
187
+ .ds-selection-card--selected .ds-selection-card__check-icon {
188
+ opacity: 1;
189
+ }
190
+
191
+ /* Hover checkbox (unselected) */
192
+ .ds-selection-card:not(.ds-selection-card--disabled):not(.ds-selection-card--selected):hover .ds-selection-card__checkbox {
193
+ border-color: var(--color-action-primary-bg);
194
+ }
195
+
196
+ /* Hover checkbox (selected) */
197
+ .ds-selection-card--selected:not(.ds-selection-card--disabled):hover .ds-selection-card__checkbox {
198
+ background-color: var(--color-action-primary-bg-hover);
199
+ border-color: var(--color-action-primary-bg-hover);
200
+ }
201
+
202
+ /* ============================================
203
+ TOGGLE INDICATOR
204
+ Matches ToggleSwitch component styling
205
+ ============================================ */
206
+
207
+ .ds-selection-card__toggle {
208
+ position: relative;
209
+ width: 42px;
210
+ height: 24px;
211
+ border-radius: var(--radius-full);
212
+ background: var(--color-action-primary-bg);
213
+ transition: background-color var(--motion-duration-base) var(--motion-ease-standard);
214
+ flex-shrink: 0;
215
+ }
216
+
217
+ .ds-selection-card__toggle-thumb {
218
+ position: absolute;
219
+ top: 2px;
220
+ right: 2px;
221
+ width: 20px;
222
+ height: 20px;
223
+ background: var(--color-control-thumb);
224
+ border-radius: 50%;
225
+ display: flex;
226
+ align-items: center;
227
+ justify-content: center;
228
+ overflow: hidden;
229
+ transition: transform var(--motion-duration-base) var(--motion-ease-standard);
230
+ }
231
+
232
+ .ds-selection-card__toggle-icon {
233
+ /* Intentionally off the --icon-size-* scale — same reason as ToggleSwitch:
234
+ this glyph lives inside the 20x20 toggle thumb, and the smallest scale
235
+ step (20px) would fill it completely. */
236
+ font-size: 14px;
237
+ color: var(--color-action-primary-bg);
238
+ }
239
+
240
+ /* Off state — thumb moves left, track goes grey */
241
+ .ds-selection-card__toggle--off {
242
+ background: var(--color-text-secondary);
243
+ }
244
+
245
+ .ds-selection-card__toggle--off .ds-selection-card__toggle-thumb {
246
+ transform: translateX(-18px);
247
+ }
248
+
249
+ .ds-selection-card__toggle--off .ds-selection-card__toggle-icon {
250
+ color: var(--color-text-secondary);
251
+ }
@@ -0,0 +1,26 @@
1
+ import { default as React } from 'react';
2
+ export interface SelectionCardOption {
3
+ /** Unique value for this option */
4
+ value: string;
5
+ /** Primary label */
6
+ label: string;
7
+ /** Optional description text below the label */
8
+ description?: string;
9
+ /** Whether this option is disabled */
10
+ disabled?: boolean;
11
+ }
12
+ export interface SelectionCardProps {
13
+ /** Selection mode — radio (single), checkbox (multi), or toggle (each card is an on/off switch) */
14
+ mode?: 'radio' | 'checkbox' | 'toggle';
15
+ /** Available options */
16
+ options: SelectionCardOption[];
17
+ /** Currently selected value(s) — string for radio, string[] for checkbox */
18
+ value?: string | string[];
19
+ /** Callback when selection changes — returns string for radio, string[] for checkbox */
20
+ onChange?: (value: string | string[]) => void;
21
+ /** Group name (used for aria-label on the group) */
22
+ name?: string;
23
+ /** Additional CSS classes */
24
+ className?: string;
25
+ }
26
+ export declare const SelectionCard: ({ mode, options, value, onChange, name, className, }: SelectionCardProps) => React.JSX.Element;