@ds-mo/ui 0.2.4 → 0.4.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 (356) hide show
  1. package/dist/components/ds-accordion.d.ts +11 -0
  2. package/dist/components/ds-accordion.js +2 -0
  3. package/dist/components/ds-accordion.js.map +1 -0
  4. package/dist/components/ds-badge.d.ts +11 -0
  5. package/dist/components/ds-badge.js +2 -0
  6. package/dist/components/ds-badge.js.map +1 -0
  7. package/dist/components/ds-banner.d.ts +11 -0
  8. package/dist/components/ds-banner.js +2 -0
  9. package/dist/components/ds-banner.js.map +1 -0
  10. package/dist/components/ds-breadcrumb.d.ts +11 -0
  11. package/dist/components/ds-breadcrumb.js +2 -0
  12. package/dist/components/ds-breadcrumb.js.map +1 -0
  13. package/dist/components/ds-button.d.ts +11 -0
  14. package/dist/components/ds-button.js +2 -0
  15. package/dist/components/ds-button.js.map +1 -0
  16. package/dist/components/ds-card.d.ts +11 -0
  17. package/dist/components/ds-card.js +2 -0
  18. package/dist/components/ds-card.js.map +1 -0
  19. package/dist/components/ds-checkbox.d.ts +11 -0
  20. package/dist/components/ds-checkbox.js +2 -0
  21. package/dist/components/ds-checkbox.js.map +1 -0
  22. package/dist/components/ds-divider.d.ts +11 -0
  23. package/dist/components/ds-divider.js +2 -0
  24. package/dist/components/ds-divider.js.map +1 -0
  25. package/dist/components/ds-empty-state.d.ts +11 -0
  26. package/dist/components/ds-empty-state.js +2 -0
  27. package/dist/components/ds-empty-state.js.map +1 -0
  28. package/dist/components/ds-fade.d.ts +11 -0
  29. package/dist/components/ds-fade.js +2 -0
  30. package/dist/components/ds-fade.js.map +1 -0
  31. package/dist/components/ds-field.d.ts +11 -0
  32. package/dist/components/ds-field.js +2 -0
  33. package/dist/components/ds-field.js.map +1 -0
  34. package/dist/components/ds-header.d.ts +11 -0
  35. package/dist/components/ds-header.js +2 -0
  36. package/dist/components/ds-header.js.map +1 -0
  37. package/dist/components/ds-input.d.ts +11 -0
  38. package/dist/components/ds-input.js +2 -0
  39. package/dist/components/ds-input.js.map +1 -0
  40. package/dist/components/ds-loader.d.ts +11 -0
  41. package/dist/components/ds-loader.js +2 -0
  42. package/dist/components/ds-loader.js.map +1 -0
  43. package/dist/components/ds-menu.d.ts +11 -0
  44. package/dist/components/ds-menu.js +2 -0
  45. package/dist/components/ds-menu.js.map +1 -0
  46. package/dist/components/ds-modal.d.ts +11 -0
  47. package/dist/components/ds-modal.js +2 -0
  48. package/dist/components/ds-modal.js.map +1 -0
  49. package/dist/components/ds-pagination.d.ts +11 -0
  50. package/dist/components/ds-pagination.js +2 -0
  51. package/dist/components/ds-pagination.js.map +1 -0
  52. package/dist/components/ds-radio-group.d.ts +11 -0
  53. package/dist/components/ds-radio-group.js +2 -0
  54. package/dist/components/ds-radio-group.js.map +1 -0
  55. package/dist/components/ds-scrollbar.d.ts +11 -0
  56. package/dist/components/ds-scrollbar.js +2 -0
  57. package/dist/components/ds-scrollbar.js.map +1 -0
  58. package/dist/components/ds-sidebar.d.ts +11 -0
  59. package/dist/components/ds-sidebar.js +2 -0
  60. package/dist/components/ds-sidebar.js.map +1 -0
  61. package/dist/components/ds-skeleton.d.ts +11 -0
  62. package/dist/components/ds-skeleton.js +2 -0
  63. package/dist/components/ds-skeleton.js.map +1 -0
  64. package/dist/components/ds-slider.d.ts +11 -0
  65. package/dist/components/ds-slider.js +2 -0
  66. package/dist/components/ds-slider.js.map +1 -0
  67. package/dist/components/ds-surface.d.ts +11 -0
  68. package/dist/components/ds-surface.js +2 -0
  69. package/dist/components/ds-surface.js.map +1 -0
  70. package/dist/components/ds-tab-group.d.ts +11 -0
  71. package/dist/components/ds-tab-group.js +2 -0
  72. package/dist/components/ds-tab-group.js.map +1 -0
  73. package/dist/components/ds-table.d.ts +11 -0
  74. package/dist/components/ds-table.js +2 -0
  75. package/dist/components/ds-table.js.map +1 -0
  76. package/dist/components/ds-tag.d.ts +11 -0
  77. package/dist/components/ds-tag.js +2 -0
  78. package/dist/components/ds-tag.js.map +1 -0
  79. package/dist/components/ds-text.d.ts +11 -0
  80. package/dist/components/ds-text.js +2 -0
  81. package/dist/components/ds-text.js.map +1 -0
  82. package/dist/components/ds-toast-provider.d.ts +11 -0
  83. package/dist/components/ds-toast-provider.js +2 -0
  84. package/dist/components/ds-toast-provider.js.map +1 -0
  85. package/dist/components/ds-toggle.d.ts +11 -0
  86. package/dist/components/ds-toggle.js +2 -0
  87. package/dist/components/ds-toggle.js.map +1 -0
  88. package/dist/components/ds-tooltip.d.ts +11 -0
  89. package/dist/components/ds-tooltip.js +2 -0
  90. package/dist/components/ds-tooltip.js.map +1 -0
  91. package/dist/components/index.d.ts +33 -0
  92. package/dist/components/index.js +2 -0
  93. package/dist/components/index.js.map +1 -0
  94. package/dist/components/p-BcuUR5Ao.js +2 -0
  95. package/dist/components/p-BcuUR5Ao.js.map +1 -0
  96. package/dist/types/.stencil/Accordion/Accordion.d.ts +28 -0
  97. package/dist/types/.stencil/Badge/Badge.d.ts +8 -0
  98. package/dist/types/.stencil/Badge/index.d.ts +2 -0
  99. package/dist/types/.stencil/Banner/Banner.d.ts +29 -0
  100. package/dist/types/.stencil/Breadcrumb/Breadcrumb.d.ts +16 -0
  101. package/dist/types/.stencil/Button/Button.d.ts +38 -0
  102. package/dist/types/.stencil/Button/index.d.ts +2 -0
  103. package/dist/types/.stencil/Card/Card.d.ts +8 -0
  104. package/dist/types/.stencil/Checkbox/Checkbox.d.ts +13 -0
  105. package/dist/types/.stencil/Checkbox/index.d.ts +2 -0
  106. package/dist/types/.stencil/Divider/Divider.d.ts +7 -0
  107. package/dist/types/.stencil/Divider/index.d.ts +2 -0
  108. package/dist/types/.stencil/EmptyState/EmptyState.d.ts +7 -0
  109. package/dist/types/.stencil/Fade/Fade.d.ts +10 -0
  110. package/dist/types/.stencil/Fade/index.d.ts +2 -0
  111. package/dist/types/.stencil/Field/Field.d.ts +8 -0
  112. package/dist/types/.stencil/Header/Header.d.ts +7 -0
  113. package/dist/types/.stencil/Input/Input.d.ts +26 -0
  114. package/dist/types/.stencil/Input/index.d.ts +2 -0
  115. package/dist/types/.stencil/Loader/Loader.d.ts +12 -0
  116. package/dist/types/.stencil/Loader/index.d.ts +2 -0
  117. package/dist/types/.stencil/Menu/Menu.d.ts +60 -0
  118. package/dist/types/.stencil/Modal/Modal.d.ts +31 -0
  119. package/dist/types/.stencil/Pagination/Pagination.d.ts +11 -0
  120. package/dist/types/.stencil/RadioGroup/RadioGroup.d.ts +21 -0
  121. package/dist/types/.stencil/RadioGroup/index.d.ts +2 -0
  122. package/dist/types/.stencil/Scrollbar/Scrollbar.d.ts +27 -0
  123. package/dist/types/.stencil/Sidebar/Sidebar.d.ts +29 -0
  124. package/dist/types/.stencil/Skeleton/Skeleton.d.ts +16 -0
  125. package/dist/types/.stencil/Skeleton/index.d.ts +2 -0
  126. package/dist/types/.stencil/Slider/Slider.d.ts +18 -0
  127. package/dist/types/.stencil/Slider/index.d.ts +2 -0
  128. package/dist/types/.stencil/Surface/Surface.d.ts +22 -0
  129. package/dist/types/.stencil/TabGroup/TabGroup.d.ts +29 -0
  130. package/dist/types/.stencil/Table/Table.d.ts +50 -0
  131. package/dist/types/.stencil/Tag/Tag.d.ts +32 -0
  132. package/dist/types/.stencil/Tag/index.d.ts +2 -0
  133. package/dist/types/.stencil/Text/Text.d.ts +22 -0
  134. package/dist/types/.stencil/Text/index.d.ts +2 -0
  135. package/dist/types/.stencil/Toast/Toast.d.ts +15 -0
  136. package/dist/types/.stencil/Toast/toast-service.d.ts +24 -0
  137. package/dist/types/.stencil/Toggle/Toggle.d.ts +10 -0
  138. package/dist/types/.stencil/Toggle/index.d.ts +2 -0
  139. package/dist/types/.stencil/Tooltip/Tooltip.d.ts +36 -0
  140. package/dist/types/components.d.ts +2024 -0
  141. package/dist/types/stencil-public-runtime.d.ts +1860 -0
  142. package/package.json +33 -29
  143. package/src/angular/angular-component-lib/utils.ts +65 -0
  144. package/src/angular/index.ts +35 -0
  145. package/src/angular/proxies.ts +819 -0
  146. package/dist/index.css +0 -2
  147. package/dist/index.d.ts +0 -969
  148. package/dist/index.js +0 -2492
  149. package/dist/index.js.map +0 -1
  150. package/dist/r/accordion.json +0 -79
  151. package/dist/r/badge.json +0 -69
  152. package/dist/r/banner.json +0 -90
  153. package/dist/r/breadcrumb.json +0 -70
  154. package/dist/r/button-group.json +0 -65
  155. package/dist/r/button.json +0 -137
  156. package/dist/r/card.json +0 -82
  157. package/dist/r/checkbox.json +0 -91
  158. package/dist/r/divider.json +0 -57
  159. package/dist/r/empty-state.json +0 -69
  160. package/dist/r/error-boundary.json +0 -66
  161. package/dist/r/fade.json +0 -65
  162. package/dist/r/field.json +0 -71
  163. package/dist/r/header.json +0 -67
  164. package/dist/r/input.json +0 -77
  165. package/dist/r/loader.json +0 -54
  166. package/dist/r/menu.json +0 -130
  167. package/dist/r/modal.json +0 -93
  168. package/dist/r/pagination.json +0 -80
  169. package/dist/r/radio.json +0 -85
  170. package/dist/r/registry.json +0 -1600
  171. package/dist/r/scrollbar.json +0 -68
  172. package/dist/r/select.json +0 -93
  173. package/dist/r/sidebar.json +0 -105
  174. package/dist/r/skeleton.json +0 -72
  175. package/dist/r/slider.json +0 -87
  176. package/dist/r/surface.json +0 -97
  177. package/dist/r/tab-group.json +0 -72
  178. package/dist/r/tab.json +0 -71
  179. package/dist/r/table.json +0 -110
  180. package/dist/r/tag.json +0 -110
  181. package/dist/r/text.json +0 -94
  182. package/dist/r/toast.json +0 -77
  183. package/dist/r/toggle-button-group.json +0 -65
  184. package/dist/r/toggle-button.json +0 -94
  185. package/dist/r/toggle.json +0 -65
  186. package/dist/r/tooltip.json +0 -86
  187. package/src/components/Accordion/Accordion.module.css +0 -66
  188. package/src/components/Accordion/Accordion.stories.tsx +0 -95
  189. package/src/components/Accordion/Accordion.tsx +0 -122
  190. package/src/components/Accordion/index.ts +0 -2
  191. package/src/components/Badge/Badge.module.css +0 -6
  192. package/src/components/Badge/Badge.stories.tsx +0 -99
  193. package/src/components/Badge/Badge.tsx +0 -23
  194. package/src/components/Badge/index.ts +0 -2
  195. package/src/components/Banner/Banner.module.css +0 -67
  196. package/src/components/Banner/Banner.stories.tsx +0 -81
  197. package/src/components/Banner/Banner.tsx +0 -109
  198. package/src/components/Banner/index.ts +0 -2
  199. package/src/components/Breadcrumb/Breadcrumb.module.css +0 -46
  200. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +0 -72
  201. package/src/components/Breadcrumb/Breadcrumb.tsx +0 -68
  202. package/src/components/Breadcrumb/index.ts +0 -2
  203. package/src/components/Button/Button.mdx +0 -143
  204. package/src/components/Button/Button.module.css +0 -343
  205. package/src/components/Button/Button.stories.tsx +0 -575
  206. package/src/components/Button/Button.tsx +0 -201
  207. package/src/components/Button/index.ts +0 -10
  208. package/src/components/ButtonGroup/ButtonGroup.module.css +0 -157
  209. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -384
  210. package/src/components/ButtonGroup/ButtonGroup.tsx +0 -122
  211. package/src/components/ButtonGroup/index.ts +0 -2
  212. package/src/components/Card/Card.module.css +0 -36
  213. package/src/components/Card/Card.stories.tsx +0 -78
  214. package/src/components/Card/Card.tsx +0 -53
  215. package/src/components/Card/index.ts +0 -2
  216. package/src/components/Checkbox/Checkbox.module.css +0 -47
  217. package/src/components/Checkbox/Checkbox.stories.tsx +0 -129
  218. package/src/components/Checkbox/Checkbox.tsx +0 -68
  219. package/src/components/Checkbox/index.ts +0 -2
  220. package/src/components/Divider/Divider.module.css +0 -19
  221. package/src/components/Divider/Divider.stories.tsx +0 -55
  222. package/src/components/Divider/Divider.tsx +0 -28
  223. package/src/components/Divider/index.ts +0 -2
  224. package/src/components/EmptyState/EmptyState.module.css +0 -8
  225. package/src/components/EmptyState/EmptyState.stories.tsx +0 -53
  226. package/src/components/EmptyState/EmptyState.tsx +0 -31
  227. package/src/components/EmptyState/index.ts +0 -2
  228. package/src/components/ErrorBoundary/ErrorBoundary.module.css +0 -18
  229. package/src/components/ErrorBoundary/ErrorBoundary.stories.tsx +0 -38
  230. package/src/components/ErrorBoundary/ErrorBoundary.tsx +0 -50
  231. package/src/components/ErrorBoundary/index.ts +0 -2
  232. package/src/components/Fade/Fade.module.css +0 -31
  233. package/src/components/Fade/Fade.stories.tsx +0 -35
  234. package/src/components/Fade/Fade.tsx +0 -33
  235. package/src/components/Fade/index.ts +0 -2
  236. package/src/components/Field/Field.module.css +0 -5
  237. package/src/components/Field/Field.stories.tsx +0 -111
  238. package/src/components/Field/Field.tsx +0 -22
  239. package/src/components/Field/index.ts +0 -2
  240. package/src/components/Header/Header.module.css +0 -33
  241. package/src/components/Header/Header.stories.tsx +0 -52
  242. package/src/components/Header/Header.tsx +0 -42
  243. package/src/components/Header/index.ts +0 -2
  244. package/src/components/Input/Input.module.css +0 -71
  245. package/src/components/Input/Input.stories.tsx +0 -135
  246. package/src/components/Input/Input.tsx +0 -76
  247. package/src/components/Input/index.ts +0 -2
  248. package/src/components/LabelWrap/LabelWrap.module.css +0 -34
  249. package/src/components/LabelWrap/LabelWrap.tsx +0 -32
  250. package/src/components/LabelWrap/index.ts +0 -1
  251. package/src/components/Loader/Loader.module.css +0 -9
  252. package/src/components/Loader/Loader.stories.tsx +0 -44
  253. package/src/components/Loader/Loader.tsx +0 -43
  254. package/src/components/Loader/index.ts +0 -2
  255. package/src/components/Menu/DestructiveMenuItem.module.css +0 -57
  256. package/src/components/Menu/DestructiveMenuItem.tsx +0 -64
  257. package/src/components/Menu/Menu.module.css +0 -49
  258. package/src/components/Menu/Menu.stories.tsx +0 -129
  259. package/src/components/Menu/Menu.tsx +0 -269
  260. package/src/components/Menu/MenuItem.module.css +0 -84
  261. package/src/components/Menu/MenuItem.tsx +0 -101
  262. package/src/components/Menu/index.ts +0 -6
  263. package/src/components/Modal/Modal.module.css +0 -67
  264. package/src/components/Modal/Modal.stories.tsx +0 -71
  265. package/src/components/Modal/Modal.tsx +0 -122
  266. package/src/components/Modal/index.ts +0 -2
  267. package/src/components/Pagination/Pagination.module.css +0 -64
  268. package/src/components/Pagination/Pagination.stories.tsx +0 -51
  269. package/src/components/Pagination/Pagination.tsx +0 -103
  270. package/src/components/Pagination/index.ts +0 -2
  271. package/src/components/Radio/Radio.module.css +0 -61
  272. package/src/components/Radio/Radio.stories.tsx +0 -101
  273. package/src/components/Radio/Radio.tsx +0 -108
  274. package/src/components/Radio/index.ts +0 -2
  275. package/src/components/Scrollbar/Scrollbar.module.css +0 -81
  276. package/src/components/Scrollbar/Scrollbar.stories.tsx +0 -46
  277. package/src/components/Scrollbar/Scrollbar.tsx +0 -187
  278. package/src/components/Scrollbar/index.ts +0 -2
  279. package/src/components/Select/Select.module.css +0 -31
  280. package/src/components/Select/Select.stories.tsx +0 -59
  281. package/src/components/Select/Select.tsx +0 -92
  282. package/src/components/Select/index.ts +0 -2
  283. package/src/components/Sidebar/Sidebar.module.css +0 -161
  284. package/src/components/Sidebar/Sidebar.stories.tsx +0 -125
  285. package/src/components/Sidebar/Sidebar.tsx +0 -129
  286. package/src/components/Sidebar/SidebarItem.tsx +0 -57
  287. package/src/components/Sidebar/SidebarSection.tsx +0 -42
  288. package/src/components/Sidebar/index.ts +0 -6
  289. package/src/components/Skeleton/Skeleton.module.css +0 -53
  290. package/src/components/Skeleton/Skeleton.stories.tsx +0 -89
  291. package/src/components/Skeleton/Skeleton.tsx +0 -66
  292. package/src/components/Skeleton/index.ts +0 -2
  293. package/src/components/Slider/Slider.module.css +0 -62
  294. package/src/components/Slider/Slider.stories.tsx +0 -120
  295. package/src/components/Slider/Slider.tsx +0 -74
  296. package/src/components/Slider/index.ts +0 -2
  297. package/src/components/Surface/Surface.module.css +0 -222
  298. package/src/components/Surface/Surface.stories.tsx +0 -213
  299. package/src/components/Surface/Surface.tsx +0 -219
  300. package/src/components/Surface/index.ts +0 -12
  301. package/src/components/Tab/Tab.module.css +0 -66
  302. package/src/components/Tab/Tab.stories.tsx +0 -103
  303. package/src/components/Tab/Tab.tsx +0 -41
  304. package/src/components/Tab/index.ts +0 -2
  305. package/src/components/TabGroup/TabGroup.module.css +0 -26
  306. package/src/components/TabGroup/TabGroup.stories.tsx +0 -60
  307. package/src/components/TabGroup/TabGroup.tsx +0 -83
  308. package/src/components/TabGroup/index.ts +0 -2
  309. package/src/components/Table/Table.module.css +0 -130
  310. package/src/components/Table/Table.stories.tsx +0 -111
  311. package/src/components/Table/Table.tsx +0 -226
  312. package/src/components/Table/index.ts +0 -11
  313. package/src/components/Tag/Tag.module.css +0 -270
  314. package/src/components/Tag/Tag.stories.tsx +0 -399
  315. package/src/components/Tag/Tag.tsx +0 -162
  316. package/src/components/Tag/index.ts +0 -2
  317. package/src/components/Text/Text.module.css +0 -166
  318. package/src/components/Text/Text.stories.tsx +0 -212
  319. package/src/components/Text/Text.tsx +0 -181
  320. package/src/components/Text/index.ts +0 -13
  321. package/src/components/Toast/Toast.module.css +0 -91
  322. package/src/components/Toast/Toast.stories.tsx +0 -66
  323. package/src/components/Toast/Toast.tsx +0 -182
  324. package/src/components/Toast/index.ts +0 -8
  325. package/src/components/Toggle/Toggle.module.css +0 -87
  326. package/src/components/Toggle/Toggle.stories.tsx +0 -85
  327. package/src/components/Toggle/Toggle.tsx +0 -52
  328. package/src/components/Toggle/index.ts +0 -2
  329. package/src/components/ToggleButton/ToggleButton.module.css +0 -172
  330. package/src/components/ToggleButton/ToggleButton.stories.tsx +0 -299
  331. package/src/components/ToggleButton/ToggleButton.tsx +0 -118
  332. package/src/components/ToggleButton/index.ts +0 -2
  333. package/src/components/ToggleButtonGroup/ToggleButtonGroup.module.css +0 -163
  334. package/src/components/ToggleButtonGroup/ToggleButtonGroup.stories.tsx +0 -341
  335. package/src/components/ToggleButtonGroup/ToggleButtonGroup.tsx +0 -111
  336. package/src/components/ToggleButtonGroup/index.ts +0 -2
  337. package/src/components/Tooltip/Tooltip.module.css +0 -45
  338. package/src/components/Tooltip/Tooltip.stories.tsx +0 -46
  339. package/src/components/Tooltip/Tooltip.tsx +0 -224
  340. package/src/components/Tooltip/index.ts +0 -2
  341. package/src/css-modules.d.ts +0 -4
  342. package/src/docs/ColorUsage.mdx +0 -195
  343. package/src/docs/ElevationUsage.mdx +0 -95
  344. package/src/docs/Introduction.mdx +0 -97
  345. package/src/docs/OpticalSizing.mdx +0 -178
  346. package/src/docs/TypographyUsage.mdx +0 -121
  347. package/src/index.ts +0 -154
  348. package/src/stories/Colors.stories.tsx +0 -528
  349. package/src/stories/Dimensions.stories.tsx +0 -200
  350. package/src/stories/Effects.stories.tsx +0 -231
  351. package/src/stories/Icons.stories.tsx +0 -159
  352. package/src/stories/Typography.stories.tsx +0 -157
  353. package/src/types/icons.ts +0 -15
  354. package/src/types/index.ts +0 -1
  355. package/src/utils/cn.ts +0 -6
  356. package/src/utils/css-tokens.ts +0 -22
@@ -1,181 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import styles from './Text.module.css';
3
-
4
- /**
5
- * Text variant options.
6
- * Each variant maps to a TokoMo typography class with predefined font-size, line-height,
7
- * font-weight, and letter-spacing.
8
- */
9
- export type TextVariant =
10
- | 'text-display-medium'
11
- | 'text-display-small'
12
- | 'text-title-large'
13
- | 'text-title-medium'
14
- | 'text-title-small'
15
- | 'text-body-large'
16
- | 'text-body-large-emphasis'
17
- | 'text-body-medium'
18
- | 'text-body-medium-emphasis'
19
- | 'text-body-small'
20
- | 'text-body-small-emphasis'
21
- | 'text-caption'
22
- | 'text-caption-emphasis';
23
-
24
- /** @deprecated Use `TextVariant` instead. */
25
- export type TextStyle = TextVariant;
26
-
27
- /**
28
- * Semantic color tokens for text.
29
- * Maps to TokoMo --color-foreground-* CSS custom properties.
30
- */
31
- export type TextColorToken =
32
- | 'primary'
33
- | 'secondary'
34
- | 'tertiary'
35
- | 'brand'
36
- | 'negative'
37
- | 'positive'
38
- | 'warning'
39
- | 'caution'
40
- | 'ai'
41
- | 'on-strong'
42
- | 'on-bold'
43
- | 'inherit';
44
-
45
- /** Text color — semantic token or CSS variable escape hatch. */
46
- export type TextColor = TextColorToken | `var(--${string})`;
47
-
48
- export type TextDecoration = 'none' | 'underline' | 'dotted-underline';
49
- export type TextAlign = 'left' | 'center' | 'right';
50
- export type LineTruncation = 1 | 2 | 3 | 4 | 5 | 'none';
51
- export type TextWrap = 'wrap' | 'nowrap' | 'balance' | 'pretty';
52
- export type TextElement = 'p' | 'span' | 'div' | 'label' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
53
-
54
- export interface TextProps {
55
- /** Typography variant. Maps to a TokoMo typography class. Defaults to 'text-body-medium'. */
56
- variant?: TextVariant;
57
- children: React.ReactNode;
58
-
59
- // Appearance
60
- color?: TextColor;
61
- decoration?: TextDecoration;
62
- italic?: boolean;
63
- align?: TextAlign;
64
-
65
- // Truncation / wrap
66
- /** Max lines before ellipsis. Ignored when wrap is 'nowrap'. Defaults to 'none'. */
67
- lineTruncation?: LineTruncation;
68
- /** 'nowrap' = single line, truncates with ellipsis when constrained. */
69
- wrap?: TextWrap;
70
-
71
- // Semantic HTML
72
- as?: TextElement;
73
- id?: string;
74
- htmlFor?: string;
75
-
76
- // Escape hatches
77
- className?: string;
78
- style?: React.CSSProperties;
79
- }
80
-
81
- const colorClassMap: Record<TextColorToken, string> = {
82
- primary: styles.colorPrimary,
83
- secondary: styles.colorSecondary,
84
- tertiary: styles.colorTertiary,
85
- brand: styles.colorBrand,
86
- negative: styles.colorNegative,
87
- positive: styles.colorPositive,
88
- warning: styles.colorWarning,
89
- caution: styles.colorCaution,
90
- ai: styles.colorAi,
91
- 'on-strong': styles.colorOnStrong,
92
- 'on-bold': styles.colorOnBold,
93
- inherit: styles.colorInherit,
94
- };
95
-
96
- const decorationClassMap: Record<TextDecoration, string> = {
97
- none: styles.decorationNone,
98
- underline: styles.decorationUnderline,
99
- 'dotted-underline': styles.decorationDottedUnderline,
100
- };
101
-
102
- const alignClassMap: Record<TextAlign, string> = {
103
- left: styles.alignLeft,
104
- center: styles.alignCenter,
105
- right: styles.alignRight,
106
- };
107
-
108
- const truncationClassMap: Record<LineTruncation, string> = {
109
- 1: styles.truncate1Line,
110
- 2: styles.truncate2Lines,
111
- 3: styles.truncate3Lines,
112
- 4: styles.truncate4Lines,
113
- 5: styles.truncate5Lines,
114
- none: styles.noTruncation,
115
- };
116
-
117
- const isCustomColor = (color: TextColor): color is `var(--${string})` =>
118
- color.startsWith('var(--');
119
-
120
- export const Text = forwardRef<HTMLElement, TextProps>(
121
- (
122
- {
123
- variant = 'text-body-medium',
124
- children,
125
- color,
126
- decoration,
127
- italic,
128
- align,
129
- lineTruncation = 'none',
130
- wrap,
131
- as: Component = 'p',
132
- id,
133
- htmlFor,
134
- className = '',
135
- style,
136
- },
137
- ref
138
- ) => {
139
- const wrapClass =
140
- wrap === 'nowrap' ? styles.wrapNowrap
141
- : wrap === 'balance' ? styles.wrapBalance
142
- : wrap === 'pretty' ? styles.wrapPretty
143
- : '';
144
- const truncationClass =
145
- wrap === 'nowrap' ? '' : truncationClassMap[lineTruncation];
146
-
147
- const classes = [
148
- variant,
149
- styles.text,
150
- wrapClass,
151
- truncationClass,
152
- color && !isCustomColor(color) ? colorClassMap[color] : '',
153
- decoration ? decorationClassMap[decoration] : '',
154
- italic ? styles.italic : '',
155
- align ? alignClassMap[align] : '',
156
- className,
157
- ]
158
- .filter(Boolean)
159
- .join(' ');
160
-
161
- const computedStyle: React.CSSProperties = {
162
- ...style,
163
- ...(color && isCustomColor(color) ? { color } : {}),
164
- };
165
-
166
- const props: React.HTMLAttributes<HTMLElement> & { htmlFor?: string } = {
167
- className: classes,
168
- style: Object.keys(computedStyle).length > 0 ? computedStyle : undefined,
169
- ...(id ? { id } : {}),
170
- ...(Component === 'label' && htmlFor ? { htmlFor } : {}),
171
- };
172
-
173
- return (
174
- <Component ref={ref as React.Ref<never>} {...props}>
175
- {children}
176
- </Component>
177
- );
178
- }
179
- );
180
-
181
- Text.displayName = 'Text';
@@ -1,13 +0,0 @@
1
- export { Text } from './Text';
2
- export type {
3
- TextProps,
4
- TextVariant,
5
- TextStyle,
6
- TextColor,
7
- TextColorToken,
8
- TextDecoration,
9
- TextAlign,
10
- LineTruncation,
11
- TextWrap,
12
- TextElement,
13
- } from './Text';
@@ -1,91 +0,0 @@
1
- /* ─── Container ─────────────────────────────────────────────────────────────── */
2
-
3
- .container {
4
- position: fixed;
5
- z-index: 9999;
6
- display: flex;
7
- flex-direction: column;
8
- gap: var(--dimension-space-075);
9
- pointer-events: none;
10
- padding: var(--dimension-space-100);
11
- max-width: 480px;
12
- width: 100%;
13
- box-sizing: border-box;
14
- }
15
-
16
- .topCenter {
17
- top: 0;
18
- left: 50%;
19
- transform: translateX(-50%);
20
- align-items: center;
21
- }
22
-
23
- .topRight {
24
- top: 0;
25
- right: 0;
26
- align-items: flex-end;
27
- }
28
-
29
- .bottomCenter {
30
- bottom: 0;
31
- left: 50%;
32
- transform: translateX(-50%);
33
- align-items: center;
34
- }
35
-
36
- .bottomRight {
37
- bottom: 0;
38
- right: 0;
39
- align-items: flex-end;
40
- }
41
-
42
- /* ─── Toast ─────────────────────────────────────────────────────────────────── */
43
-
44
- .toast {
45
- display: flex;
46
- align-items: center;
47
- gap: var(--dimension-space-075);
48
- padding: var(--dimension-space-075) var(--dimension-space-100);
49
- min-height: var(--dimension-size-400);
50
- pointer-events: auto;
51
- animation: slideIn var(--effect-motion-short-3) ease-out;
52
- }
53
-
54
- .toastExit {
55
- animation: fadeOut 200ms ease-in forwards;
56
- }
57
-
58
- .dismiss {
59
- background: none;
60
- border: none;
61
- color: inherit;
62
- cursor: pointer;
63
- padding: var(--dimension-space-025);
64
- margin-left: auto;
65
- font-size: 16px;
66
- line-height: 1;
67
- opacity: 0.7;
68
- border-radius: var(--dimension-radius-050);
69
- transition: opacity var(--effect-motion-short-2);
70
- flex-shrink: 0;
71
- }
72
-
73
- .dismiss:hover { opacity: 1; }
74
-
75
- /* ─── Animations ────────────────────────────────────────────────────────────── */
76
-
77
- @keyframes slideIn {
78
- from {
79
- opacity: 0;
80
- transform: translateY(-8px);
81
- }
82
- to {
83
- opacity: 1;
84
- transform: translateY(0);
85
- }
86
- }
87
-
88
- @keyframes fadeOut {
89
- from { opacity: 1; }
90
- to { opacity: 0; }
91
- }
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import { ToastContainer, toast } from './Toast';
4
- import type { ToastIntent } from './Toast';
5
-
6
- const meta: Meta<typeof ToastContainer> = {
7
- title: 'Classic/Toast',
8
- component: ToastContainer,
9
- args: {
10
- position: 'top-center',
11
- },
12
- argTypes: {
13
- position: { control: 'select', options: ['top-center', 'top-right', 'bottom-center', 'bottom-right'] },
14
- },
15
- };
16
-
17
- export default meta;
18
- type Story = StoryObj<typeof ToastContainer>;
19
-
20
- const INTENTS: ToastIntent[] = ['neutral', 'brand', 'positive', 'negative', 'warning', 'caution'];
21
-
22
- const row: React.CSSProperties = { display: 'flex', gap: 8, flexWrap: 'wrap' };
23
-
24
- const ToastDemo = (props: React.ComponentProps<typeof ToastContainer>) => (
25
- <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
26
- <div style={row}>
27
- <button onClick={() => toast.info('This is an info message.')}>Info</button>
28
- <button onClick={() => toast.success('Operation completed successfully.')}>Success</button>
29
- <button onClick={() => toast.error('Something went wrong.')}>Error</button>
30
- <button onClick={() => toast.warning('Please check your input.')}>Warning</button>
31
- </div>
32
- <div style={row}>
33
- {INTENTS.map(intent => (
34
- <button
35
- key={intent}
36
- onClick={() => toast.show({ message: `Toast with ${intent} intent`, intent })}
37
- >
38
- {intent}
39
- </button>
40
- ))}
41
- </div>
42
- <div style={row}>
43
- <button onClick={() => toast.show({ message: 'Persistent toast (no auto-dismiss)', intent: 'brand', duration: 0 })}>
44
- No auto-dismiss
45
- </button>
46
- <button onClick={() => toast.dismissAll()}>Dismiss all</button>
47
- </div>
48
- <ToastContainer {...props} />
49
- </div>
50
- );
51
-
52
- export const Playground: Story = {
53
- render: args => <ToastDemo {...args} />,
54
- };
55
-
56
- export const Default: Story = {
57
- render: () => <ToastDemo />,
58
- };
59
-
60
- export const TopRight: Story = {
61
- render: () => <ToastDemo position="top-right" />,
62
- };
63
-
64
- export const BottomCenter: Story = {
65
- render: () => <ToastDemo position="bottom-center" />,
66
- };
@@ -1,182 +0,0 @@
1
- import React, { forwardRef, useEffect, useState, useCallback, useRef, useSyncExternalStore } from 'react';
2
- import ReactDOM from 'react-dom';
3
- import { cn } from '@/utils/cn';
4
- import { Text } from '@/components/Text';
5
- import { Surface } from '@/components/Surface';
6
- import type { SurfaceIntent } from '@/components/Surface';
7
- import styles from './Toast.module.css';
8
-
9
- /* ─── Toast Types ───────────────────────────────────────────────────────────── */
10
-
11
- export type ToastIntent = 'neutral' | 'brand' | 'positive' | 'negative' | 'warning' | 'caution';
12
- export type ToastPosition = 'top-center' | 'top-right' | 'bottom-center' | 'bottom-right';
13
-
14
- export interface ToastData {
15
- id: string;
16
- message: string;
17
- intent?: ToastIntent;
18
- duration?: number;
19
- onDismiss?: () => void;
20
- }
21
-
22
- export interface ToastOptions {
23
- message: string;
24
- intent?: ToastIntent;
25
- /** Auto-dismiss duration in ms. 0 = no auto-dismiss. Default 4000. */
26
- duration?: number;
27
- onDismiss?: () => void;
28
- }
29
-
30
- /* ─── Toast Store (external, framework-agnostic) ────────────────────────────── */
31
-
32
- let toasts: ToastData[] = [];
33
- const listeners = new Set<() => void>();
34
-
35
- function emit() {
36
- listeners.forEach(fn => fn());
37
- }
38
-
39
- function getSnapshot(): ToastData[] {
40
- return toasts;
41
- }
42
-
43
- function subscribe(listener: () => void) {
44
- listeners.add(listener);
45
- return () => { listeners.delete(listener); };
46
- }
47
-
48
- let idCounter = 0;
49
-
50
- export const toast = {
51
- show(options: ToastOptions): string {
52
- const id = `toast-${++idCounter}`;
53
- toasts = [...toasts, { id, ...options }];
54
- emit();
55
- return id;
56
- },
57
- info(message: string, options?: Omit<ToastOptions, 'message'>): string {
58
- return toast.show({ message, intent: 'neutral', ...options });
59
- },
60
- success(message: string, options?: Omit<ToastOptions, 'message'>): string {
61
- return toast.show({ message, intent: 'positive', ...options });
62
- },
63
- error(message: string, options?: Omit<ToastOptions, 'message'>): string {
64
- return toast.show({ message, intent: 'negative', ...options });
65
- },
66
- warning(message: string, options?: Omit<ToastOptions, 'message'>): string {
67
- return toast.show({ message, intent: 'warning', ...options });
68
- },
69
- dismiss(id: string) {
70
- toasts = toasts.filter(t => t.id !== id);
71
- emit();
72
- },
73
- dismissAll() {
74
- toasts = [];
75
- emit();
76
- },
77
- };
78
-
79
- /* ─── useToasts hook ────────────────────────────────────────────────────────── */
80
-
81
- export function useToasts(): ToastData[] {
82
- return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
83
- }
84
-
85
- /* ─── Single Toast ──────────────────────────────────────────────────────────── */
86
-
87
- const INTENT_MAP: Record<ToastIntent, SurfaceIntent> = {
88
- neutral: 'neutral',
89
- brand: 'brand',
90
- positive: 'positive',
91
- negative: 'negative',
92
- warning: 'warning',
93
- caution: 'caution',
94
- };
95
-
96
- interface ToastItemProps {
97
- data: ToastData;
98
- }
99
-
100
- const ToastItem: React.FC<ToastItemProps> = ({ data }) => {
101
- const [exiting, setExiting] = useState(false);
102
- const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
103
-
104
- const dismiss = useCallback(() => {
105
- setExiting(true);
106
- setTimeout(() => {
107
- toast.dismiss(data.id);
108
- data.onDismiss?.();
109
- }, 200);
110
- }, [data]);
111
-
112
- useEffect(() => {
113
- const duration = data.duration ?? 4000;
114
- if (duration > 0) {
115
- timerRef.current = setTimeout(dismiss, duration);
116
- }
117
- return () => { if (timerRef.current) clearTimeout(timerRef.current); };
118
- }, [data.duration, dismiss]);
119
-
120
- return (
121
- <Surface
122
- intent={INTENT_MAP[data.intent ?? 'neutral']}
123
- contrast="bold"
124
- elevation="floating"
125
- radius="lg"
126
- className={cn(styles.toast, exiting && styles.toastExit)}
127
- role="status"
128
- aria-live="polite"
129
- >
130
- <Text variant="text-body-medium" as="span" color="inherit">
131
- {data.message}
132
- </Text>
133
- <button
134
- type="button"
135
- className={styles.dismiss}
136
- onClick={dismiss}
137
- aria-label="Dismiss"
138
- >
139
- &times;
140
- </button>
141
- </Surface>
142
- );
143
- };
144
-
145
- /* ─── ToastContainer ────────────────────────────────────────────────────────── */
146
-
147
- export interface ToastContainerProps {
148
- /** Where to render toasts on screen. */
149
- position?: ToastPosition;
150
- }
151
-
152
- export const ToastContainer = forwardRef<HTMLDivElement, ToastContainerProps>(
153
- ({ position = 'top-center' }, ref) => {
154
- const items = useToasts();
155
-
156
- if (typeof document === 'undefined') return null;
157
-
158
- return ReactDOM.createPortal(
159
- <div
160
- ref={ref}
161
- className={cn(styles.container, styles[positionClass(position)])}
162
- aria-label="Notifications"
163
- >
164
- {items.map(item => (
165
- <ToastItem key={item.id} data={item} />
166
- ))}
167
- </div>,
168
- document.body
169
- );
170
- }
171
- );
172
-
173
- ToastContainer.displayName = 'ToastContainer';
174
-
175
- function positionClass(position: ToastPosition): string {
176
- switch (position) {
177
- case 'top-center': return 'topCenter';
178
- case 'top-right': return 'topRight';
179
- case 'bottom-center': return 'bottomCenter';
180
- case 'bottom-right': return 'bottomRight';
181
- }
182
- }
@@ -1,8 +0,0 @@
1
- export { ToastContainer, toast, useToasts } from './Toast';
2
- export type {
3
- ToastContainerProps,
4
- ToastData,
5
- ToastOptions,
6
- ToastIntent,
7
- ToastPosition,
8
- } from './Toast';
@@ -1,87 +0,0 @@
1
- .toggle {
2
- position: relative;
3
- display: inline-flex;
4
- align-items: center;
5
- justify-content: flex-start;
6
- width: var(--dimension-size-400);
7
- height: var(--dimension-size-250);
8
- padding: 0 var(--dimension-space-025);
9
- border: none;
10
- border-radius: var(--dimension-radius-half);
11
- cursor: pointer;
12
- -webkit-user-select: none;
13
- user-select: none;
14
- outline: none;
15
- flex-shrink: 0;
16
- background-color: var(--color-background-medium-neutral);
17
- box-shadow: var(--effect-highlight-depressed-sm);
18
- transition: background-color var(--effect-motion-short-2);
19
- }
20
-
21
- .toggle::before {
22
- content: '';
23
- position: absolute;
24
- inset: 0;
25
- border-radius: inherit;
26
- box-shadow: var(--effect-shadow-depressed-sm);
27
- pointer-events: none;
28
- }
29
-
30
- .toggle:focus-visible {
31
- outline: var(--dimension-stroke-width-025) solid var(--color-interaction-focus);
32
- outline-offset: var(--dimension-space-025);
33
- }
34
-
35
- .checked {
36
- background-color: var(--color-foreground-bold-brand) !important;
37
- }
38
-
39
- .thumb {
40
- position: relative;
41
- flex-shrink: 0;
42
- width: var(--dimension-size-200);
43
- height: var(--dimension-size-200);
44
- background-color: var(--color-background-primary);
45
- border-radius: var(--dimension-radius-half);
46
- box-shadow: var(--effect-elevation-elevated-sm);
47
- transition: transform var(--effect-motion-short-2);
48
- transform: translateX(0);
49
- z-index: 1;
50
- }
51
-
52
- .thumb::after {
53
- content: '';
54
- position: absolute;
55
- inset: 0;
56
- background-color: transparent;
57
- border-radius: inherit;
58
- transition: var(--effect-transition-interaction-background-instant);
59
- pointer-events: none;
60
- }
61
-
62
- .toggle:hover:not(.inactive) .thumb::after {
63
- background-color: var(--color-interaction-hover);
64
- }
65
-
66
- .toggle:active:not(.inactive) .thumb::after {
67
- background-color: var(--color-interaction-pressed);
68
- }
69
-
70
- .checked .thumb {
71
- transform: translateX(var(--dimension-offset-150));
72
- }
73
-
74
- .toggle:active:not(.inactive) .thumb {
75
- transform: translateX(0) scale(var(--dimension-scale-subtle)) !important;
76
- transition: transform var(--effect-motion-instant);
77
- }
78
-
79
- .checked.toggle:active:not(.inactive) .thumb {
80
- transform: translateX(var(--dimension-offset-150)) scale(var(--dimension-scale-subtle)) !important;
81
- transition: transform var(--effect-motion-instant);
82
- }
83
-
84
- .inactive {
85
- cursor: not-allowed;
86
- opacity: 0.5;
87
- }