@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,84 @@
1
+ /* ============================================
2
+ TOGGLE GROUP COMPONENT
3
+ A set of two-state buttons
4
+ ============================================ */
5
+
6
+ .ds-toggle-group {
7
+ display: inline-flex;
8
+ border: var(--border-xs) solid var(--color-bg-container-border);
9
+ border-radius: var(--radius-sm);
10
+ overflow: hidden;
11
+ }
12
+
13
+ /* ============================================
14
+ ITEM
15
+ ============================================ */
16
+
17
+ .ds-toggle-group__item {
18
+ display: inline-flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ padding: var(--padding-xs) var(--padding-sm);
22
+ font-family: var(--font-paragraph-sm-em-family);
23
+ font-size: var(--font-paragraph-sm-em-size);
24
+ font-weight: var(--font-paragraph-sm-em-weight);
25
+ line-height: var(--font-paragraph-sm-em-line-height);
26
+ letter-spacing: var(--font-paragraph-sm-em-letter-spacing);
27
+ color: var(--color-text-secondary);
28
+ background: transparent;
29
+ border: none;
30
+ cursor: pointer;
31
+ transition: background-color var(--motion-duration-fast) var(--motion-ease-standard), color var(--motion-duration-fast) var(--motion-ease-standard);
32
+ }
33
+
34
+ .ds-toggle-group__item + .ds-toggle-group__item {
35
+ border-left: var(--border-xs) solid var(--color-bg-container-border);
36
+ }
37
+
38
+ .ds-toggle-group__item .material-symbols-rounded {
39
+ --icon-size: var(--icon-size-sm);
40
+ }
41
+
42
+ /* ============================================
43
+ ITEM — HOVER
44
+ ============================================ */
45
+
46
+ .ds-toggle-group__item:hover {
47
+ background-color: var(--color-bg-container-secondary);
48
+ color: var(--color-text-primary);
49
+ }
50
+
51
+ /* ============================================
52
+ ITEM — ACTIVE
53
+ ============================================ */
54
+
55
+ .ds-toggle-group__item--active {
56
+ background-color: var(--color-action-primary-bg);
57
+ color: var(--color-action-primary-text);
58
+ }
59
+
60
+ .ds-toggle-group__item--active:hover {
61
+ background-color: var(--color-action-primary-bg-hover);
62
+ color: var(--color-action-primary-text);
63
+ }
64
+
65
+ /* ============================================
66
+ COMPACT
67
+ ============================================ */
68
+
69
+ .ds-toggle-group--compact .ds-toggle-group__item {
70
+ padding: var(--padding-xxs) var(--padding-xs);
71
+ }
72
+
73
+ .ds-toggle-group--compact .ds-toggle-group__item .material-symbols-rounded {
74
+ --icon-size: var(--icon-size-sm);
75
+ }
76
+
77
+ /* ============================================
78
+ DISABLED
79
+ ============================================ */
80
+
81
+ .ds-toggle-group--disabled {
82
+ opacity: 0.4;
83
+ pointer-events: none;
84
+ }
@@ -0,0 +1,30 @@
1
+ export interface ToggleGroupItem {
2
+ /** Unique value */
3
+ value: string;
4
+ /** Display label or icon name (Material Symbols) */
5
+ label: string;
6
+ /** Use Material Symbol icon instead of text */
7
+ icon?: boolean;
8
+ }
9
+ export interface ToggleGroupProps {
10
+ /** Available items */
11
+ items: ToggleGroupItem[];
12
+ /** Currently active value(s) */
13
+ value?: string | string[];
14
+ /** Allow multiple selection */
15
+ multiple?: boolean;
16
+ /** Size */
17
+ size?: 'default' | 'compact';
18
+ /** Disabled state */
19
+ disabled?: boolean;
20
+ /** Change handler */
21
+ onChange?: (value: string | string[]) => void;
22
+ /** Accessible label for the group */
23
+ ariaLabel?: string;
24
+ /** Additional CSS classes */
25
+ className?: string;
26
+ }
27
+ /**
28
+ * ToggleGroup is a set of two-state buttons that can be toggled on or off.
29
+ */
30
+ export declare const ToggleGroup: ({ items, value, multiple, size, disabled, onChange, ariaLabel, className, }: ToggleGroupProps) => import("react").JSX.Element;
@@ -0,0 +1,53 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "./ToggleGroup.css";
3
+ const ToggleGroup = ({
4
+ items,
5
+ value = [],
6
+ multiple = false,
7
+ size = "default",
8
+ disabled = false,
9
+ onChange,
10
+ ariaLabel,
11
+ className = ""
12
+ }) => {
13
+ const baseClass = "ds-toggle-group";
14
+ const classes = [
15
+ baseClass,
16
+ `${baseClass}--${size}`,
17
+ disabled ? `${baseClass}--disabled` : "",
18
+ className
19
+ ].filter(Boolean).join(" ");
20
+ const activeValues = Array.isArray(value) ? value : [value];
21
+ const handleClick = (itemValue) => {
22
+ if (disabled) return;
23
+ if (multiple) {
24
+ const next = activeValues.includes(itemValue) ? activeValues.filter((v) => v !== itemValue) : [...activeValues, itemValue];
25
+ onChange?.(next);
26
+ } else {
27
+ onChange?.(itemValue);
28
+ }
29
+ };
30
+ return /* @__PURE__ */ jsx("div", { className: classes, role: "group", "aria-label": ariaLabel, children: items.map((item) => {
31
+ const isActive = activeValues.includes(item.value);
32
+ const btnClass = [
33
+ `${baseClass}__item`,
34
+ isActive ? `${baseClass}__item--active` : ""
35
+ ].filter(Boolean).join(" ");
36
+ return /* @__PURE__ */ jsx(
37
+ "button",
38
+ {
39
+ className: btnClass,
40
+ onClick: () => handleClick(item.value),
41
+ "aria-pressed": isActive,
42
+ "aria-label": item.icon ? item.label : void 0,
43
+ disabled,
44
+ type: "button",
45
+ children: item.icon ? /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", "aria-hidden": "true", children: item.label }) : item.label
46
+ },
47
+ item.value
48
+ );
49
+ }) });
50
+ };
51
+ export {
52
+ ToggleGroup
53
+ };
@@ -0,0 +1,139 @@
1
+ /* ============================================
2
+ TOGGLE SWITCH COMPONENT
3
+ Dark/Light mode toggle with check icon
4
+ ============================================ */
5
+
6
+ .ds-toggle-switch {
7
+ /* Layout */
8
+ display: inline-flex;
9
+ align-items: center;
10
+ gap: var(--gap-sm); /* 8px */
11
+
12
+ /* Reset */
13
+ background: none;
14
+ border: none;
15
+ cursor: pointer;
16
+ padding: 0;
17
+ color: var(--color-text-primary);
18
+ font-family: var(--font-paragraph-family);
19
+ }
20
+
21
+ /* ============================================
22
+ TRACK
23
+ ============================================ */
24
+
25
+ .ds-toggle-switch__track {
26
+ position: relative;
27
+ width: 42px;
28
+ height: 24px;
29
+ border-radius: var(--radius-full);
30
+ background: var(--color-action-primary-bg);
31
+ transition: background-color var(--motion-duration-slow) var(--motion-ease-standard);
32
+ flex-shrink: 0;
33
+ }
34
+
35
+ /* ============================================
36
+ THUMB
37
+ ============================================ */
38
+
39
+ .ds-toggle-switch__thumb {
40
+ position: absolute;
41
+ top: 2px;
42
+ right: 2px;
43
+ width: 20px;
44
+ height: 20px;
45
+ background: var(--color-control-thumb);
46
+ border-radius: 50%;
47
+ display: flex;
48
+ align-items: center;
49
+ justify-content: center;
50
+ overflow: hidden;
51
+ transition: transform var(--motion-duration-slow) var(--motion-ease-spring);
52
+ }
53
+
54
+ .ds-toggle-switch__thumb-icon {
55
+ /* Intentionally off the --icon-size-* scale. This check sits inside the
56
+ 20x20 thumb; the smallest scale step is also 20px, which would fill the
57
+ thumb edge to edge. Control-internal glyph, not a UI icon.
58
+
59
+ Set via --icon-size (not font-size): .material-symbols-rounded derives
60
+ font-size, width, and height from it together. Overriding font-size
61
+ alone leaves the box at the 24px default, so the glyph hangs off-centre
62
+ inside the thumb. */
63
+ --icon-size: 14px;
64
+ color: var(--color-action-primary-bg);
65
+ }
66
+
67
+ /* ============================================
68
+ LABEL
69
+ ============================================ */
70
+
71
+ .ds-toggle-switch__label {
72
+ font-family: var(--font-paragraph-family);
73
+ font-size: var(--font-paragraph-size);
74
+ font-weight: var(--font-paragraph-weight);
75
+ line-height: var(--font-paragraph-line-height);
76
+ min-width: 95px;
77
+ }
78
+
79
+ /* ============================================
80
+ STATES
81
+ ============================================ */
82
+
83
+ /* Off / Unchecked state — thumb moves to the left */
84
+ .ds-toggle-switch--off .ds-toggle-switch__track {
85
+ background: var(--color-text-secondary);
86
+ }
87
+
88
+ .ds-toggle-switch--off .ds-toggle-switch__thumb {
89
+ transform: translateX(-18px);
90
+ }
91
+
92
+ /* ============================================
93
+ FOCUS
94
+ ============================================ */
95
+
96
+ .ds-toggle-switch:focus-visible {
97
+ outline: 2px solid var(--color-action-primary-bg);
98
+ outline-offset: 2px;
99
+ }
100
+
101
+ /* ============================================
102
+ DISABLED STATE
103
+ ============================================ */
104
+
105
+ .ds-toggle-switch--disabled {
106
+ opacity: 0.4;
107
+ cursor: not-allowed;
108
+ }
109
+
110
+ /* ============================================
111
+ SIZE — COMPACT
112
+ ============================================ */
113
+
114
+ .ds-toggle-switch--compact .ds-toggle-switch__track {
115
+ width: 34px;
116
+ height: 20px;
117
+ }
118
+
119
+ .ds-toggle-switch--compact .ds-toggle-switch__thumb {
120
+ width: 16px;
121
+ height: 16px;
122
+ }
123
+
124
+ .ds-toggle-switch--compact .ds-toggle-switch__thumb-icon {
125
+ /* Off-scale for the same reason as the default size — the compact thumb
126
+ is only 16x16. */
127
+ --icon-size: 12px;
128
+ }
129
+
130
+ .ds-toggle-switch--compact .ds-toggle-switch__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
+ min-width: 80px;
135
+ }
136
+
137
+ .ds-toggle-switch--compact.ds-toggle-switch--off .ds-toggle-switch__thumb {
138
+ transform: translateX(-14px);
139
+ }
@@ -0,0 +1,23 @@
1
+ export interface ToggleSwitchProps {
2
+ /** Whether the toggle is on (checked) */
3
+ checked?: boolean;
4
+ /** Label text displayed next to the toggle */
5
+ label?: string;
6
+ /** Whether to show the label */
7
+ showLabel?: boolean;
8
+ /** Whether the toggle is disabled */
9
+ disabled?: boolean;
10
+ /** Component size */
11
+ size?: 'default' | 'compact';
12
+ /** Callback when toggled */
13
+ onChange?: (checked: boolean) => void;
14
+ /** Additional CSS classes */
15
+ className?: string;
16
+ /** Accessible label for the button */
17
+ ariaLabel?: string;
18
+ }
19
+ /**
20
+ * ToggleSwitch component from Figma design system
21
+ * Used for binary on/off settings like theme switching
22
+ */
23
+ export declare const ToggleSwitch: ({ checked, label, showLabel, disabled, size, onChange, className, ariaLabel, }: ToggleSwitchProps) => import("react").JSX.Element;
@@ -0,0 +1,50 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import "./ToggleSwitch.css";
3
+ import "../../fonts/material-symbols.css";
4
+ const ToggleSwitch = ({
5
+ checked = true,
6
+ label = "Toggle",
7
+ showLabel = true,
8
+ disabled = false,
9
+ size = "default",
10
+ onChange,
11
+ className = "",
12
+ ariaLabel
13
+ }) => {
14
+ const baseClass = "ds-toggle-switch";
15
+ const stateClass = checked ? "" : `${baseClass}--off`;
16
+ const disabledClass = disabled ? `${baseClass}--disabled` : "";
17
+ const sizeClass = size === "compact" ? `${baseClass}--compact` : "";
18
+ const classes = [baseClass, sizeClass, stateClass, disabledClass, className].filter(Boolean).join(" ");
19
+ const handleClick = () => {
20
+ if (!disabled && onChange) {
21
+ onChange(!checked);
22
+ }
23
+ };
24
+ return /* @__PURE__ */ jsxs(
25
+ "button",
26
+ {
27
+ type: "button",
28
+ className: classes,
29
+ onClick: handleClick,
30
+ disabled,
31
+ role: "switch",
32
+ "aria-checked": checked,
33
+ "aria-label": ariaLabel || label,
34
+ children: [
35
+ /* @__PURE__ */ jsx("div", { className: `${baseClass}__track`, children: /* @__PURE__ */ jsx("div", { className: `${baseClass}__thumb`, children: /* @__PURE__ */ jsx(
36
+ "span",
37
+ {
38
+ className: `${baseClass}__thumb-icon material-symbols-rounded`,
39
+ "aria-hidden": "true",
40
+ children: "check"
41
+ }
42
+ ) }) }),
43
+ showLabel && /* @__PURE__ */ jsx("span", { className: `${baseClass}__label`, children: label })
44
+ ]
45
+ }
46
+ );
47
+ };
48
+ export {
49
+ ToggleSwitch
50
+ };
@@ -0,0 +1,122 @@
1
+ /* ============================================
2
+ TOOLTIP COMPONENT
3
+ Contextual text label on hover / focus
4
+ ============================================ */
5
+
6
+ .ds-tooltip {
7
+ position: relative;
8
+ display: inline-flex;
9
+ }
10
+
11
+ /* ============================================
12
+ PANEL
13
+ ============================================ */
14
+
15
+ .ds-tooltip__panel {
16
+ position: absolute;
17
+ z-index: 50;
18
+ padding: var(--padding-xs) var(--padding-sm); /* 6px 8px */
19
+ border-radius: var(--radius-xs); /* 4px */
20
+ background-color: var(--color-bg-container-inverse);
21
+ color: var(--color-text-on-inverse);
22
+ font-family: var(--font-paragraph-sm-family);
23
+ font-size: var(--font-paragraph-sm-size);
24
+ font-weight: var(--font-paragraph-sm-weight);
25
+ line-height: var(--font-paragraph-sm-line-height);
26
+ white-space: nowrap;
27
+ pointer-events: none;
28
+ opacity: 0;
29
+ transition: opacity var(--motion-duration-fast) var(--motion-ease-standard), transform var(--motion-duration-fast) var(--motion-ease-standard);
30
+ }
31
+
32
+ .ds-tooltip__panel--visible {
33
+ opacity: 1;
34
+ }
35
+
36
+ /* ============================================
37
+ POSITIONS
38
+ ============================================ */
39
+
40
+ .ds-tooltip__panel--top {
41
+ bottom: 100%;
42
+ left: 50%;
43
+ transform: translateX(-50%) translateY(4px);
44
+ margin-bottom: var(--gap-xs); /* 4px */
45
+ }
46
+
47
+ .ds-tooltip__panel--top.ds-tooltip__panel--visible {
48
+ transform: translateX(-50%) translateY(0);
49
+ }
50
+
51
+ .ds-tooltip__panel--bottom {
52
+ top: 100%;
53
+ left: 50%;
54
+ transform: translateX(-50%) translateY(-4px);
55
+ margin-top: var(--gap-xs);
56
+ }
57
+
58
+ .ds-tooltip__panel--bottom.ds-tooltip__panel--visible {
59
+ transform: translateX(-50%) translateY(0);
60
+ }
61
+
62
+ .ds-tooltip__panel--left {
63
+ right: 100%;
64
+ top: 50%;
65
+ transform: translateY(-50%) translateX(4px);
66
+ margin-right: var(--gap-xs);
67
+ }
68
+
69
+ .ds-tooltip__panel--left.ds-tooltip__panel--visible {
70
+ transform: translateY(-50%) translateX(0);
71
+ }
72
+
73
+ .ds-tooltip__panel--right {
74
+ left: 100%;
75
+ top: 50%;
76
+ transform: translateY(-50%) translateX(-4px);
77
+ margin-left: var(--gap-xs);
78
+ }
79
+
80
+ .ds-tooltip__panel--right.ds-tooltip__panel--visible {
81
+ transform: translateY(-50%) translateX(0);
82
+ }
83
+
84
+ /* ============================================
85
+ ARROW
86
+ ============================================ */
87
+
88
+ .ds-tooltip__arrow {
89
+ position: absolute;
90
+ width: 8px;
91
+ height: 8px;
92
+ background-color: var(--color-bg-container-inverse);
93
+ transform: rotate(45deg);
94
+ }
95
+
96
+ /* Arrow — top position (arrow points down) */
97
+ .ds-tooltip__panel--top .ds-tooltip__arrow {
98
+ bottom: -4px;
99
+ left: 50%;
100
+ margin-left: -4px;
101
+ }
102
+
103
+ /* Arrow — bottom position (arrow points up) */
104
+ .ds-tooltip__panel--bottom .ds-tooltip__arrow {
105
+ top: -4px;
106
+ left: 50%;
107
+ margin-left: -4px;
108
+ }
109
+
110
+ /* Arrow — left position (arrow points right) */
111
+ .ds-tooltip__panel--left .ds-tooltip__arrow {
112
+ right: -4px;
113
+ top: 50%;
114
+ margin-top: -4px;
115
+ }
116
+
117
+ /* Arrow — right position (arrow points left) */
118
+ .ds-tooltip__panel--right .ds-tooltip__arrow {
119
+ left: -4px;
120
+ top: 50%;
121
+ margin-top: -4px;
122
+ }
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ export interface TooltipProps {
3
+ /** Trigger element */
4
+ children?: ReactNode;
5
+ /** Tooltip text content */
6
+ content: string;
7
+ /** Preferred position */
8
+ position?: 'top' | 'bottom' | 'left' | 'right';
9
+ /** Delay before showing (in ms) */
10
+ showDelay?: number;
11
+ /** Delay before hiding (in ms) */
12
+ hideDelay?: number;
13
+ /** Additional CSS classes */
14
+ className?: string;
15
+ }
16
+ /**
17
+ * Tooltip component for contextual text labels.
18
+ * Appears on hover or focus with a short delay.
19
+ * Uses inverted colours (dark background in light theme).
20
+ */
21
+ export declare const Tooltip: ({ children, content, position, showDelay, hideDelay, className, }: TooltipProps) => import("react").JSX.Element;
@@ -0,0 +1,63 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useRef, useId, isValidElement, cloneElement } from "react";
3
+ import "./Tooltip.css";
4
+ const Tooltip = ({
5
+ children,
6
+ content,
7
+ position = "top",
8
+ showDelay = 300,
9
+ hideDelay = 150,
10
+ className = ""
11
+ }) => {
12
+ const [visible, setVisible] = useState(false);
13
+ const showTimeoutRef = useRef(void 0);
14
+ const hideTimeoutRef = useRef(void 0);
15
+ const tooltipId = useId();
16
+ const baseClass = "ds-tooltip";
17
+ const show = () => {
18
+ clearTimeout(hideTimeoutRef.current);
19
+ showTimeoutRef.current = setTimeout(() => setVisible(true), showDelay);
20
+ };
21
+ const hide = () => {
22
+ clearTimeout(showTimeoutRef.current);
23
+ hideTimeoutRef.current = setTimeout(() => setVisible(false), hideDelay);
24
+ };
25
+ const trigger = isValidElement(children) ? cloneElement(children, {
26
+ "aria-describedby": tooltipId
27
+ }) : children;
28
+ const containerClasses = [baseClass, className].filter(Boolean).join(" ");
29
+ const panelClasses = [
30
+ `${baseClass}__panel`,
31
+ `${baseClass}__panel--${position}`,
32
+ visible ? `${baseClass}__panel--visible` : ""
33
+ ].filter(Boolean).join(" ");
34
+ return /* @__PURE__ */ jsxs(
35
+ "span",
36
+ {
37
+ className: containerClasses,
38
+ onMouseEnter: show,
39
+ onMouseLeave: hide,
40
+ onFocus: show,
41
+ onBlur: hide,
42
+ children: [
43
+ trigger,
44
+ /* @__PURE__ */ jsxs(
45
+ "span",
46
+ {
47
+ className: panelClasses,
48
+ role: "tooltip",
49
+ id: tooltipId,
50
+ "aria-hidden": !visible,
51
+ children: [
52
+ content,
53
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__arrow` })
54
+ ]
55
+ }
56
+ )
57
+ ]
58
+ }
59
+ );
60
+ };
61
+ export {
62
+ Tooltip
63
+ };
@@ -0,0 +1,81 @@
1
+ /* ============================================
2
+ TYPOGRAPHY SWATCH COMPONENT
3
+ Card that displays a type style with a live
4
+ preview and four value columns.
5
+ ============================================ */
6
+
7
+ .ds-typography-swatch {
8
+ /* Layout */
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: var(--gap-xl); /* 40px */
12
+
13
+ /* Sizing */
14
+ width: 100%;
15
+
16
+ /* Appearance */
17
+ background: var(--color-bg-container-primary);
18
+ border: var(--border-xs) solid var(--color-bg-container-border);
19
+ border-radius: var(--radius-xl); /* 24px */
20
+ padding: var(--padding-xl) var(--padding-lg) var(--padding-lg); /* 40px top, 20px sides/bottom */
21
+ overflow: hidden;
22
+ }
23
+
24
+ /* ============================================
25
+ PREVIEW TEXT
26
+ Rendered at the actual font properties via
27
+ inline style — inherits colour from tokens.
28
+ ============================================ */
29
+
30
+ .ds-typography-swatch__preview {
31
+ color: var(--color-text-primary);
32
+ word-break: break-word;
33
+ }
34
+
35
+ /* ============================================
36
+ DIVIDER
37
+ ============================================ */
38
+
39
+ .ds-typography-swatch__divider {
40
+ width: 100%;
41
+ border: none;
42
+ border-top: 1px solid var(--color-bg-container-border);
43
+ margin: 0;
44
+ }
45
+
46
+ /* ============================================
47
+ VALUES ROW
48
+ Four equal columns showing the metrics.
49
+ ============================================ */
50
+
51
+ .ds-typography-swatch__values {
52
+ display: flex;
53
+ flex-wrap: wrap;
54
+ gap: 10px;
55
+ width: 100%;
56
+ }
57
+
58
+ .ds-typography-swatch__value-item {
59
+ flex: 1;
60
+ min-width: 0;
61
+ display: flex;
62
+ flex-direction: column;
63
+ gap: 0;
64
+ }
65
+
66
+ .ds-typography-swatch__value-number {
67
+ font-family: var(--font-title-body-family);
68
+ font-size: var(--font-title-body-size);
69
+ font-weight: var(--font-title-body-weight);
70
+ line-height: var(--font-title-body-line-height);
71
+ letter-spacing: var(--font-title-body-letter-spacing);
72
+ color: var(--color-text-primary);
73
+ }
74
+
75
+ .ds-typography-swatch__value-label {
76
+ font-family: var(--font-paragraph-family);
77
+ font-size: var(--font-paragraph-size);
78
+ font-weight: var(--font-paragraph-weight);
79
+ line-height: var(--font-paragraph-line-height);
80
+ color: var(--color-text-secondary);
81
+ }
@@ -0,0 +1,24 @@
1
+ import { default as React } from 'react';
2
+ export interface TypographySwatchProps {
3
+ /** Display name rendered as the preview text (e.g. "Mega 1") */
4
+ name: string;
5
+ /** Font weight label (e.g. "Light", "SemiBold", "Regular") */
6
+ weight: string;
7
+ /** Font size value (e.g. "132", "16") */
8
+ size: string;
9
+ /** Line height value (e.g. "85%", "44px") */
10
+ lineHeight: string;
11
+ /** Letter spacing value (e.g. "2%", "-1%", "0") */
12
+ letterSpacing: string;
13
+ /** Inline style object applied to the preview text for live rendering */
14
+ previewStyle?: React.CSSProperties;
15
+ /** Additional CSS classes */
16
+ className?: string;
17
+ }
18
+ /**
19
+ * TypographySwatch component from Figma design system.
20
+ * Displays a typography style in a card with a live preview
21
+ * of the text and four value columns showing font weight,
22
+ * size, line height, and letter spacing.
23
+ */
24
+ export declare const TypographySwatch: ({ name, weight, size, lineHeight, letterSpacing, previewStyle, className, }: TypographySwatchProps) => React.JSX.Element;