@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,162 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import { cn } from '@/utils/cn';
3
- import { Text } from '@/components/Text';
4
- import { LabelWrap } from '@/components/LabelWrap';
5
- import { Cross } from '@ds-mo/icons';
6
- import type { IconComponent } from '@/types/icons';
7
- import styles from './Tag.module.css';
8
-
9
- export type TagIntent = 'neutral' | 'brand' | 'ai' | 'negative' | 'warning' | 'caution' | 'positive';
10
- export type TagContrast = 'strong' | 'bold' | 'medium' | 'faint';
11
- export type TagElevation = 'none' | 'flat' | 'elevated';
12
- export type TagSize = 'md' | 'sm' | 'xs';
13
- export type TagBackground = 'faint' | 'medium' | 'bold' | 'strong' | 'always-dark';
14
-
15
- export interface TagProps {
16
- label: string;
17
- intent?: TagIntent;
18
- contrast?: TagContrast;
19
- /**
20
- * Visual chrome level.
21
- * none — filled with intent bg, no border, no shadow [default]
22
- * flat — transparent bg + intent-coloured border ring
23
- * elevated — filled with intent bg + elevated shadow
24
- */
25
- elevation?: TagElevation;
26
- size?: TagSize;
27
- rounded?: boolean;
28
- /** Leading icon component. */
29
- icon?: IconComponent;
30
- removable?: boolean;
31
- onRemove?: () => void;
32
- /** Override the default Cross remove icon. */
33
- removeIcon?: IconComponent;
34
- maxWidth?: string | number;
35
- inactive?: boolean;
36
- /** Parent surface context. Adjusts hover tokens for tags on colored backgrounds. */
37
- background?: TagBackground;
38
- /** Makes the tag clickable. Pair with pressed/onPressedChange for filter-chip behaviour. */
39
- onClick?: () => void;
40
- pressed?: boolean;
41
- onPressedChange?: (pressed: boolean) => void;
42
- className?: string;
43
- }
44
-
45
- const ICON_SIZE: Record<TagSize, number> = { md: 20, sm: 16, xs: 12 };
46
-
47
- const TEXT_STYLE_MAP: Record<TagSize, string> = {
48
- md: 'text-body-medium',
49
- sm: 'text-body-small',
50
- xs: 'text-caption',
51
- };
52
-
53
- export const Tag = forwardRef<HTMLDivElement, TagProps>(
54
- (
55
- {
56
- label,
57
- intent = 'neutral',
58
- contrast = 'faint',
59
- elevation = 'none',
60
- size = 'md',
61
- rounded = false,
62
- icon: Icon,
63
- removable = false,
64
- onRemove,
65
- removeIcon: RemoveIcon,
66
- maxWidth,
67
- inactive = false,
68
- background,
69
- onClick,
70
- pressed,
71
- onPressedChange,
72
- className,
73
- },
74
- ref
75
- ) => {
76
- const isInteractive = !!onClick || !!onPressedChange;
77
- const hasRemove = removable && !!onRemove;
78
- const iconSize = ICON_SIZE[size];
79
- const textStyle = TEXT_STYLE_MAP[size];
80
- const elevKey = elevation.charAt(0).toUpperCase() + elevation.slice(1);
81
- const sizeKey = size.toUpperCase() as 'MD' | 'SM' | 'XS';
82
-
83
- const classes = cn(
84
- styles.tag,
85
- styles[`intent${intent.charAt(0).toUpperCase() + intent.slice(1)}`],
86
- styles[`contrast${contrast.charAt(0).toUpperCase() + contrast.slice(1)}`],
87
- styles[`elevation${elevKey}`],
88
- styles[`size${size.charAt(0).toUpperCase() + size.slice(1)}`],
89
- rounded && styles.rounded,
90
- // Pill padding correction — extra space-050 on bare sides (no content anchor)
91
- rounded && !Icon && (styles as Record<string, string>)[`roundedLeft${sizeKey}`],
92
- rounded && !hasRemove && (styles as Record<string, string>)[`roundedRight${sizeKey}`],
93
- // Icon-edge correction — reduce padding to (height − icon) / 2 on icon sides
94
- !!Icon && (styles as Record<string, string>)[`iconLeft${sizeKey}`],
95
- hasRemove && (styles as Record<string, string>)[`iconRight${sizeKey}`],
96
- removable && styles.removable,
97
- isInteractive && styles.interactive,
98
- background && background !== 'faint' && styles[
99
- background === 'always-dark' ? 'onAlwaysDark'
100
- : `on${background.charAt(0).toUpperCase() + background.slice(1)}`
101
- ],
102
- inactive && styles.inactive,
103
- pressed && styles.pressed,
104
- className,
105
- );
106
-
107
- const style = maxWidth != null
108
- ? { maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth }
109
- : undefined;
110
-
111
- const handleInteract = isInteractive && !inactive
112
- ? () => {
113
- onPressedChange?.(!pressed);
114
- onClick?.();
115
- }
116
- : undefined;
117
-
118
- const handleKeyDown = isInteractive && !inactive
119
- ? (e: React.KeyboardEvent<HTMLDivElement>) => {
120
- if (e.key === 'Enter' || e.key === ' ') {
121
- e.preventDefault();
122
- onPressedChange?.(!pressed);
123
- onClick?.();
124
- }
125
- }
126
- : undefined;
127
-
128
- return (
129
- <div
130
- ref={ref}
131
- className={classes}
132
- style={style}
133
- onClick={handleInteract}
134
- onKeyDown={handleKeyDown}
135
- role={isInteractive ? 'button' : undefined}
136
- tabIndex={isInteractive && !inactive ? 0 : undefined}
137
- aria-pressed={onPressedChange != null ? pressed : undefined}
138
- aria-disabled={inactive || undefined}
139
- >
140
- {Icon && <Icon size={iconSize} />}
141
- <LabelWrap size={size}>
142
- <Text variant={textStyle as never} as="span" color="inherit">
143
- {label}
144
- </Text>
145
- </LabelWrap>
146
- {removable && onRemove && (
147
- <button
148
- type="button"
149
- className={styles.removeButton}
150
- onClick={(e) => { e.stopPropagation(); onRemove(); }}
151
- aria-label={`Remove ${label}`}
152
- tabIndex={-1}
153
- >
154
- {RemoveIcon ? <RemoveIcon size={iconSize} /> : <Cross size={iconSize} />}
155
- </button>
156
- )}
157
- </div>
158
- );
159
- }
160
- );
161
-
162
- Tag.displayName = 'Tag';
@@ -1,2 +0,0 @@
1
- export { Tag } from './Tag';
2
- export type { TagProps, TagIntent, TagContrast, TagElevation, TagSize, TagBackground } from './Tag';
@@ -1,166 +0,0 @@
1
- .text {
2
- margin: 0;
3
- }
4
-
5
- /* ============================================
6
- LINE TRUNCATION
7
- ============================================ */
8
-
9
- .truncate1Line {
10
- overflow: hidden;
11
- text-overflow: ellipsis;
12
- white-space: nowrap;
13
- }
14
-
15
- .truncate2Lines {
16
- overflow: hidden;
17
- display: -webkit-box;
18
- -webkit-line-clamp: 2;
19
- -webkit-box-orient: vertical;
20
- text-overflow: ellipsis;
21
- word-break: break-word;
22
- }
23
-
24
- .truncate3Lines {
25
- overflow: hidden;
26
- display: -webkit-box;
27
- -webkit-line-clamp: 3;
28
- -webkit-box-orient: vertical;
29
- text-overflow: ellipsis;
30
- word-break: break-word;
31
- }
32
-
33
- .truncate4Lines {
34
- overflow: hidden;
35
- display: -webkit-box;
36
- -webkit-line-clamp: 4;
37
- -webkit-box-orient: vertical;
38
- text-overflow: ellipsis;
39
- word-break: break-word;
40
- }
41
-
42
- .truncate5Lines {
43
- overflow: hidden;
44
- display: -webkit-box;
45
- -webkit-line-clamp: 5;
46
- -webkit-box-orient: vertical;
47
- text-overflow: ellipsis;
48
- word-break: break-word;
49
- }
50
-
51
- .noTruncation {
52
- word-break: break-word;
53
- white-space: normal;
54
- }
55
-
56
- .wrapNowrap {
57
- white-space: nowrap;
58
- word-break: normal;
59
- overflow: hidden;
60
- text-overflow: ellipsis;
61
- min-width: 0;
62
- }
63
-
64
- .wrapBalance {
65
- text-wrap: balance;
66
- }
67
-
68
- .wrapPretty {
69
- text-wrap: pretty;
70
- }
71
-
72
- /* ============================================
73
- TEXT COLOR - Semantic Tokens
74
- ============================================ */
75
-
76
- .colorPrimary {
77
- color: var(--color-foreground-primary);
78
- }
79
-
80
- .colorSecondary {
81
- color: var(--color-foreground-secondary);
82
- }
83
-
84
- .colorTertiary {
85
- color: var(--color-foreground-tertiary);
86
- }
87
-
88
- .colorBrand {
89
- color: var(--color-foreground-bold-brand);
90
- }
91
-
92
- .colorNegative {
93
- color: var(--color-foreground-bold-negative);
94
- }
95
-
96
- .colorPositive {
97
- color: var(--color-foreground-bold-positive);
98
- }
99
-
100
- .colorWarning {
101
- color: var(--color-foreground-bold-warning);
102
- }
103
-
104
- .colorCaution {
105
- color: var(--color-foreground-bold-caution);
106
- }
107
-
108
- .colorAi {
109
- color: var(--color-foreground-bold-ai);
110
- }
111
-
112
- .colorOnStrong {
113
- color: var(--color-foreground-on-strong-background-primary);
114
- }
115
-
116
- .colorOnBold {
117
- color: var(--color-foreground-on-bold-background-primary);
118
- }
119
-
120
- .colorInherit {
121
- color: inherit;
122
- }
123
-
124
- /* ============================================
125
- TEXT DECORATION
126
- ============================================ */
127
-
128
- .decorationNone {
129
- text-decoration: none;
130
- }
131
-
132
- .decorationUnderline {
133
- text-decoration: underline;
134
- text-underline-offset: 2px;
135
- text-decoration-thickness: 1px;
136
- }
137
-
138
- .decorationDottedUnderline {
139
- text-decoration: underline dotted;
140
- text-underline-offset: 2px;
141
- text-decoration-thickness: 1px;
142
- }
143
-
144
- /* ============================================
145
- FONT STYLE
146
- ============================================ */
147
-
148
- .italic {
149
- font-style: italic;
150
- }
151
-
152
- /* ============================================
153
- TEXT ALIGNMENT
154
- ============================================ */
155
-
156
- .alignLeft {
157
- text-align: left;
158
- }
159
-
160
- .alignCenter {
161
- text-align: center;
162
- }
163
-
164
- .alignRight {
165
- text-align: right;
166
- }
@@ -1,212 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import React from 'react';
3
- import { Text } from './Text';
4
- import type { TextVariant, TextColorToken } from './Text';
5
-
6
- const VARIANTS: TextVariant[] = [
7
- 'text-display-medium',
8
- 'text-display-small',
9
- 'text-title-large',
10
- 'text-title-medium',
11
- 'text-title-small',
12
- 'text-body-large',
13
- 'text-body-large-emphasis',
14
- 'text-body-medium',
15
- 'text-body-medium-emphasis',
16
- 'text-body-small',
17
- 'text-body-small-emphasis',
18
- 'text-caption',
19
- 'text-caption-emphasis',
20
- ];
21
-
22
- const COLORS: TextColorToken[] = [
23
- 'primary', 'secondary', 'tertiary',
24
- 'brand', 'negative', 'positive', 'warning', 'caution', 'ai',
25
- 'on-strong', 'on-bold', 'inherit',
26
- ];
27
-
28
- const meta: Meta<typeof Text> = {
29
- title: 'Primitives (Reviewed)/Text',
30
- component: Text,
31
- args: {
32
- variant: 'text-body-medium',
33
- children: 'The quick brown fox jumps over the lazy dog',
34
- },
35
- argTypes: {
36
- variant: { control: 'select', options: VARIANTS },
37
- color: { control: 'select', options: COLORS },
38
- as: { control: 'select', options: ['p', 'span', 'div', 'label', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'] },
39
- align: { control: 'select', options: ['left', 'center', 'right'] },
40
- decoration: { control: 'select', options: ['none', 'underline', 'dotted-underline'] },
41
- italic: { control: 'boolean' },
42
- lineTruncation:{ control: 'select', options: [1, 2, 3, 4, 5, 'none'] },
43
- wrap: { control: 'select', options: ['wrap', 'nowrap', 'balance', 'pretty'] },
44
- },
45
- };
46
-
47
- export default meta;
48
- type Story = StoryObj<typeof Text>;
49
-
50
- // ─── Helpers ──────────────────────────────────────────────────────────────────
51
-
52
- const monoLabel = (text: string) => (
53
- <span style={{ fontSize: 10, fontFamily: 'monospace', color: 'var(--color-foreground-tertiary)', minWidth: 210, flexShrink: 0, paddingTop: 2 }}>
54
- {text}
55
- </span>
56
- );
57
-
58
- const sectionHeading = (title: string) => (
59
- <div style={{ fontSize: 10, fontFamily: 'monospace', fontWeight: 700, textTransform: 'uppercase', letterSpacing: '0.08em', color: 'var(--color-foreground-tertiary)', marginTop: 12, marginBottom: 2 }}>
60
- {title}
61
- </div>
62
- );
63
-
64
- const divider = <hr style={{ border: 'none', borderTop: '1px solid var(--color-border-tertiary)', margin: '12px 0' }} />;
65
-
66
- const SAMPLE = 'The quick brown fox jumps over the lazy dog';
67
- const SHORT_SAMPLE = 'Bright vixens jump dozy fowl quack';
68
- const LONG_SAMPLE = 'This text is intentionally long to demonstrate how the component behaves when content exceeds the available width and must either wrap or truncate gracefully.';
69
-
70
- // ─── Stories ──────────────────────────────────────────────────────────────────
71
-
72
- export const Playground: Story = {};
73
-
74
- export const TypeScale: Story = {
75
- name: 'Type Scale',
76
- parameters: { layout: 'padded' },
77
- render: () => (
78
- <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
79
- {sectionHeading('Display')}
80
- {(['text-display-medium', 'text-display-small'] as TextVariant[]).map(v => (
81
- <div key={v} style={{ display: 'flex', alignItems: 'baseline', gap: 16 }}>
82
- {monoLabel(v)}
83
- <Text variant={v}>{SHORT_SAMPLE}</Text>
84
- </div>
85
- ))}
86
- {divider}
87
- {sectionHeading('Title')}
88
- {(['text-title-large', 'text-title-medium', 'text-title-small'] as TextVariant[]).map(v => (
89
- <div key={v} style={{ display: 'flex', alignItems: 'baseline', gap: 16 }}>
90
- {monoLabel(v)}
91
- <Text variant={v}>{SAMPLE}</Text>
92
- </div>
93
- ))}
94
- {divider}
95
- {sectionHeading('Body')}
96
- {([
97
- 'text-body-large', 'text-body-large-emphasis',
98
- 'text-body-medium', 'text-body-medium-emphasis',
99
- 'text-body-small', 'text-body-small-emphasis',
100
- ] as TextVariant[]).map(v => (
101
- <div key={v} style={{ display: 'flex', alignItems: 'baseline', gap: 16 }}>
102
- {monoLabel(v)}
103
- <Text variant={v}>{SAMPLE}</Text>
104
- </div>
105
- ))}
106
- {divider}
107
- {sectionHeading('Caption')}
108
- {(['text-caption', 'text-caption-emphasis'] as TextVariant[]).map(v => (
109
- <div key={v} style={{ display: 'flex', alignItems: 'baseline', gap: 16 }}>
110
- {monoLabel(v)}
111
- <Text variant={v}>{SAMPLE}</Text>
112
- </div>
113
- ))}
114
- </div>
115
- ),
116
- };
117
-
118
- export const Colors: Story = {
119
- parameters: { layout: 'padded' },
120
- render: () => (
121
- <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
122
- {(['primary', 'secondary', 'tertiary'] as TextColorToken[]).map(color => (
123
- <div key={color} style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
124
- {monoLabel(color)}
125
- <Text variant="text-body-medium" color={color}>{SAMPLE}</Text>
126
- </div>
127
- ))}
128
- {divider}
129
- {(['brand', 'negative', 'positive', 'warning', 'caution', 'ai'] as TextColorToken[]).map(color => (
130
- <div key={color} style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
131
- {monoLabel(color)}
132
- <Text variant="text-body-medium" color={color}>{SAMPLE}</Text>
133
- </div>
134
- ))}
135
- {divider}
136
- {/* on-strong and on-bold require a colored background to be legible */}
137
- <div style={{ display: 'flex', gap: 12 }}>
138
- <div style={{ background: 'var(--color-background-strong-brand)', borderRadius: 8, padding: '12px 16px', flex: 1, display: 'flex', gap: 16, alignItems: 'center' }}>
139
- {monoLabel('on-strong')}
140
- <Text variant="text-body-medium" color="on-strong">{SAMPLE}</Text>
141
- </div>
142
- </div>
143
- <div style={{ display: 'flex', gap: 12 }}>
144
- <div style={{ background: 'var(--color-background-bold-brand)', borderRadius: 8, padding: '12px 16px', flex: 1, display: 'flex', gap: 16, alignItems: 'center' }}>
145
- {monoLabel('on-bold')}
146
- <Text variant="text-body-medium" color="on-bold">{SAMPLE}</Text>
147
- </div>
148
- </div>
149
- </div>
150
- ),
151
- };
152
-
153
- export const Decorations: Story = {
154
- parameters: { layout: 'padded' },
155
- render: () => (
156
- <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
157
- {([
158
- { label: 'underline', props: { decoration: 'underline' as const } },
159
- { label: 'dotted-underline', props: { decoration: 'dotted-underline' as const } },
160
- { label: 'italic', props: { italic: true } },
161
- { label: 'italic + underline', props: { italic: true, decoration: 'underline' as const } },
162
- ]).map(({ label, props }) => (
163
- <div key={label} style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
164
- {monoLabel(label)}
165
- <Text variant="text-body-medium" {...props}>{SAMPLE}</Text>
166
- </div>
167
- ))}
168
- </div>
169
- ),
170
- };
171
-
172
- export const Alignment: Story = {
173
- parameters: { layout: 'padded' },
174
- render: () => (
175
- <div style={{ display: 'flex', flexDirection: 'column', gap: 8, width: 480 }}>
176
- {(['left', 'center', 'right'] as const).map(align => (
177
- <div key={align} style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
178
- {monoLabel(align)}
179
- <Text
180
- variant="text-body-medium"
181
- align={align}
182
- style={{ flex: 1, background: 'var(--color-background-secondary)', borderRadius: 6, padding: '8px 12px' }}
183
- >
184
- The quick brown fox
185
- </Text>
186
- </div>
187
- ))}
188
- </div>
189
- ),
190
- };
191
-
192
- export const Truncation: Story = {
193
- parameters: { layout: 'padded' },
194
- render: () => (
195
- <div style={{ maxWidth: 400, display: 'flex', flexDirection: 'column', gap: 12 }}>
196
- {([1, 2, 3] as const).map(lines => (
197
- <div key={lines} style={{ display: 'flex', gap: 16, alignItems: 'flex-start' }}>
198
- {monoLabel(`${lines} line${lines > 1 ? 's' : ''}`)}
199
- <Text variant="text-body-medium" lineTruncation={lines} style={{ flex: 1 }}>
200
- {LONG_SAMPLE}
201
- </Text>
202
- </div>
203
- ))}
204
- <div style={{ display: 'flex', gap: 16, alignItems: 'flex-start' }}>
205
- {monoLabel('no truncation')}
206
- <Text variant="text-body-medium" style={{ flex: 1 }}>
207
- {LONG_SAMPLE}
208
- </Text>
209
- </div>
210
- </div>
211
- ),
212
- };