@koide-labs/ui 0.0.0 → 0.0.2

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 (383) hide show
  1. package/README.md +53 -3
  2. package/{src/-types.ts → dist/-types.d.ts} +1 -6
  3. package/dist/-types.js +1 -0
  4. package/dist/-utils.d.ts +19 -0
  5. package/dist/-utils.js +33 -0
  6. package/dist/Button-DrPFFzo7.js +31 -0
  7. package/dist/CompositeRoot-CVk5a-pR.js +233 -0
  8. package/dist/DirectionContext-C2o_MF_i.js +9 -0
  9. package/dist/FieldItemContext-DAvk99to.js +11 -0
  10. package/dist/FloatingPortal-tWyuKRSN.js +435 -0
  11. package/dist/FloatingPortalLite-DVyq6YhV.js +28 -0
  12. package/dist/InternalBackdrop-jYAiOJ8v.js +574 -0
  13. package/dist/LabelableContext-BMvjVwor.js +169 -0
  14. package/dist/ToolbarRootContext-CvvL0Tk1.js +9 -0
  15. package/dist/clamp-D0KDAQIz.js +6 -0
  16. package/dist/clsx-OuTLNxxd.js +16 -0
  17. package/dist/components/accordion/index.d.ts +12 -0
  18. package/dist/components/accordion/index.js +699 -0
  19. package/dist/components/alert-dialog/index.d.ts +26 -0
  20. package/dist/components/alert-dialog/index.js +136 -0
  21. package/dist/components/anchor/index.d.ts +8 -0
  22. package/dist/components/anchor/index.js +38 -0
  23. package/dist/components/avatar/index.d.ts +21 -0
  24. package/dist/components/avatar/index.js +161 -0
  25. package/dist/components/badge/index.d.ts +16 -0
  26. package/dist/components/badge/index.js +40 -0
  27. package/dist/components/button/index.d.ts +24 -0
  28. package/dist/components/button/index.js +47 -0
  29. package/dist/components/checkbox/index.d.ts +9 -0
  30. package/dist/components/checkbox/index.js +269 -0
  31. package/dist/components/code/index.d.ts +9 -0
  32. package/dist/components/code/index.js +10 -0
  33. package/dist/components/collapse/index.d.ts +11 -0
  34. package/dist/components/collapse/index.js +41 -0
  35. package/dist/components/command/index.d.ts +14 -0
  36. package/dist/components/command/index.js +1695 -0
  37. package/dist/components/context-menu/index.d.ts +42 -0
  38. package/dist/components/context-menu/index.js +1444 -0
  39. package/dist/components/dialog/index.d.ts +48 -0
  40. package/dist/components/dialog/index.js +138 -0
  41. package/dist/components/heading/index.d.ts +44 -0
  42. package/dist/components/heading/index.js +56 -0
  43. package/dist/components/icon/icon-names.d.ts +1 -0
  44. package/dist/components/icon/icon-names.js +1 -0
  45. package/dist/components/icon/index.d.ts +24 -0
  46. package/dist/components/icon/index.js +43 -0
  47. package/dist/components/icon-button/index.d.ts +12 -0
  48. package/dist/components/icon-button/index.js +45 -0
  49. package/dist/components/inline-code/index.d.ts +6 -0
  50. package/dist/components/inline-code/index.js +22 -0
  51. package/dist/components/input/index.d.ts +3 -0
  52. package/dist/components/input/index.js +119 -0
  53. package/dist/components/meter/index.d.ts +18 -0
  54. package/dist/components/meter/index.js +165 -0
  55. package/dist/components/multiline-input/index.d.ts +6 -0
  56. package/dist/components/multiline-input/index.js +100 -0
  57. package/dist/components/number-input/index.d.ts +10 -0
  58. package/dist/components/number-input/index.js +1169 -0
  59. package/dist/components/password-input/index.d.ts +2 -0
  60. package/dist/components/password-input/index.js +29 -0
  61. package/dist/components/pill/index.d.ts +13 -0
  62. package/dist/components/pill/index.js +38 -0
  63. package/dist/components/popover/index.d.ts +21 -0
  64. package/dist/components/popover/index.js +636 -0
  65. package/dist/components/preview-card/index.d.ts +17 -0
  66. package/dist/components/preview-card/index.js +402 -0
  67. package/dist/components/radio/index.d.ts +13 -0
  68. package/dist/components/radio/index.js +404 -0
  69. package/dist/components/search-bar/index.d.ts +12 -0
  70. package/dist/components/search-bar/index.js +48 -0
  71. package/dist/components/select/index.d.ts +16 -0
  72. package/dist/components/select/index.js +1263 -0
  73. package/dist/components/separator/index.d.ts +7 -0
  74. package/dist/components/separator/index.js +6 -0
  75. package/dist/components/slider/index.d.ts +5 -0
  76. package/dist/components/slider/index.js +902 -0
  77. package/dist/components/spinner/index.d.ts +2 -0
  78. package/dist/components/spinner/index.js +13 -0
  79. package/dist/components/stacked-avatars/index.d.ts +14 -0
  80. package/dist/components/stacked-avatars/index.js +92 -0
  81. package/dist/components/status-banner/index.d.ts +17 -0
  82. package/dist/components/status-banner/index.js +69 -0
  83. package/dist/components/surface/index.d.ts +27 -0
  84. package/dist/components/surface/index.js +41 -0
  85. package/dist/components/switch/index.d.ts +5 -0
  86. package/dist/components/switch/index.js +196 -0
  87. package/dist/components/tabs/index.d.ts +18 -0
  88. package/dist/components/tabs/index.js +509 -0
  89. package/dist/components/text/index.d.ts +26 -0
  90. package/dist/components/text/index.js +51 -0
  91. package/dist/components/theme-provider/index.d.ts +2 -0
  92. package/dist/components/theme-provider/index.js +6 -0
  93. package/dist/components/theme-provider/theme-context.d.ts +9 -0
  94. package/dist/components/theme-provider/theme-context.js +13 -0
  95. package/dist/components/theme-provider/theme-provider.d.ts +17 -0
  96. package/dist/components/theme-provider/theme-provider.js +30 -0
  97. package/dist/components/timestamp/index.d.ts +23 -0
  98. package/dist/components/timestamp/index.js +1392 -0
  99. package/dist/components/toast/index.d.ts +2 -0
  100. package/dist/components/toast/index.js +7 -0
  101. package/dist/components/toast/toast.d.ts +2 -0
  102. package/dist/components/toast/toast.js +878 -0
  103. package/dist/components/toast/use-toast-manager.d.ts +27 -0
  104. package/dist/components/toast/use-toast-manager.js +4 -0
  105. package/dist/components/tooltip/index.d.ts +14 -0
  106. package/dist/components/tooltip/index.js +712 -0
  107. package/dist/components/tooltip/tooltip-arrow.d.ts +3 -0
  108. package/dist/components/tooltip/tooltip-arrow.js +6 -0
  109. package/dist/components/view/index.d.ts +30 -0
  110. package/dist/components/view/index.js +84 -0
  111. package/dist/components/visually-hidden/index.d.ts +1 -0
  112. package/dist/components/visually-hidden/index.js +4 -0
  113. package/dist/composite-Bx7Szd_T.js +208 -0
  114. package/dist/composite-C9L5QmZL.js +66 -0
  115. package/dist/createBaseUIEventDetails-D8M2Yl-a.js +59 -0
  116. package/dist/detectBrowser-I-s3yzIE.js +43 -0
  117. package/dist/dialog.css +1 -0
  118. package/dist/dialog.module-BeF-6XAo.js +415 -0
  119. package/dist/element-CZEOj04G.js +80 -0
  120. package/dist/event-CKoGyQEJ.js +30 -0
  121. package/dist/floating-ui.utils-C7pRWMZ_.js +128 -0
  122. package/dist/floating-ui.utils.dom-C7FS5id0.js +135 -0
  123. package/dist/formatErrorMessage-BqPuTBN-.js +7 -0
  124. package/dist/formatNumber-1UNwjeqf.js +25 -0
  125. package/dist/getDisabledMountTransitionStyles-YfHPge6T.js +1510 -0
  126. package/dist/index-BX1XbbRk.js +1206 -0
  127. package/dist/index-CeuccO-T.js +109 -0
  128. package/dist/index-DN9Bn1qm.js +29 -0
  129. package/dist/index-FMoPxlJ2.js +52 -0
  130. package/dist/index.css +1 -0
  131. package/dist/index.d.ts +42 -0
  132. package/dist/index.js +108 -0
  133. package/dist/index10.css +1 -0
  134. package/dist/index11.css +1 -0
  135. package/dist/index12.css +1 -0
  136. package/dist/index13.css +1 -0
  137. package/dist/index14.css +1 -0
  138. package/dist/index15.css +1 -0
  139. package/dist/index16.css +1 -0
  140. package/dist/index17.css +1 -0
  141. package/dist/index18.css +1 -0
  142. package/dist/index19.css +1 -0
  143. package/dist/index2.css +1 -0
  144. package/dist/index20.css +1 -0
  145. package/dist/index21.css +1 -0
  146. package/dist/index22.css +1 -0
  147. package/dist/index23.css +1 -0
  148. package/dist/index24.css +1 -0
  149. package/dist/index25.css +1 -0
  150. package/dist/index26.css +1 -0
  151. package/dist/index27.css +1 -0
  152. package/dist/index28.css +1 -0
  153. package/dist/index29.css +1 -0
  154. package/dist/index3.css +1 -0
  155. package/dist/index30.css +1 -0
  156. package/dist/index31.css +1 -0
  157. package/dist/index32.css +1 -0
  158. package/dist/index33.css +1 -0
  159. package/dist/index34.css +1 -0
  160. package/dist/index35.css +1 -0
  161. package/dist/index36.css +1 -0
  162. package/dist/index37.css +1 -0
  163. package/dist/index4.css +1 -0
  164. package/dist/index5.css +1 -0
  165. package/dist/index6.css +1 -0
  166. package/dist/index7.css +1 -0
  167. package/dist/index8.css +1 -0
  168. package/dist/index9.css +1 -0
  169. package/dist/inertValue-BCYGsdmf.js +7 -0
  170. package/dist/input.css +1 -0
  171. package/dist/input.module-DDQY_Ij6.js +7 -0
  172. package/dist/integrations/react-markdown/index.d.ts +5 -0
  173. package/dist/integrations/react-markdown/index.js +6895 -0
  174. package/dist/integrations/remix/index.d.ts +9 -0
  175. package/{src/integrations/remix.ts → dist/integrations/remix/index.js} +7 -4
  176. package/dist/integrations/tailwind.css +1 -0
  177. package/dist/integrations/twemoij/index.d.ts +3 -0
  178. package/dist/integrations/twemoij/index.js +18 -0
  179. package/dist/isElementDisabled-Cbd8W9kH.js +6 -0
  180. package/dist/owner-rKN292Q9.js +6 -0
  181. package/dist/safePolygon-DWy1dGKJ.js +308 -0
  182. package/dist/styles/core.css +1 -0
  183. package/dist/styles/tokens.d.ts +400 -0
  184. package/{src/styles/tokens.ts → dist/styles/tokens.js} +54 -96
  185. package/dist/toast.css +1 -0
  186. package/dist/tooltip-arrow-C1qXdi5T.js +24 -0
  187. package/dist/tooltip-arrow.css +1 -0
  188. package/dist/transitions.css +1 -0
  189. package/dist/transitions.module-CWX8e5cx.js +1343 -0
  190. package/dist/use-toast-manager-Dq-44AuW.js +37 -0
  191. package/dist/useAnimationFrame-451ugS_6.js +68 -0
  192. package/dist/useBaseUiId-B7WyxtIE.js +7 -0
  193. package/dist/useButton-DfIwsdb8.js +127 -0
  194. package/dist/useCompositeListItem-OkcAim_1.js +148 -0
  195. package/dist/useControlled-Du4sJyMj.js +31 -0
  196. package/dist/useHoverReferenceInteraction-SfOBPoXM.js +264 -0
  197. package/dist/useId-C5kyn6tA.js +22 -0
  198. package/dist/useIsoLayoutEffect-CIDbvm3Q.js +6 -0
  199. package/dist/useLabelableId-Ci_jDvmv.js +29 -0
  200. package/dist/useOnMount-VRW6CK2u.js +8 -0
  201. package/dist/useOpenChangeComplete-Dse9kY9E.js +61 -0
  202. package/dist/usePopupAutoResize-CNR6Ekmx.js +85 -0
  203. package/dist/useRender-CLx7dR_1.js +7 -0
  204. package/dist/useRenderElement-DwToLA61.js +244 -0
  205. package/dist/useRole-oDBdbuwQ.js +77 -0
  206. package/dist/useStableCallback-CkTrVkNX.js +29 -0
  207. package/dist/useSyncedFloatingRootContext-Dorsv-jf.js +167 -0
  208. package/dist/useTimeout-CflX-kz3.js +32 -0
  209. package/dist/useTransitionStatus-CUfcuGAV.js +42 -0
  210. package/dist/useTypeahead-D85V2IUx.js +333 -0
  211. package/dist/useValueAsRef-HURLzret.js +19 -0
  212. package/dist/useValueChanged-DL757-yD.js +14 -0
  213. package/dist/valueToPercent-DaP9qN4u.js +6 -0
  214. package/dist/view.css +1 -0
  215. package/dist/view.module-DfDLgJE0.js +6 -0
  216. package/dist/visuallyHidden-CpJ-mhai.js +16 -0
  217. package/dist/warn-CKtX8MLJ.js +11 -0
  218. package/package.json +18 -2
  219. package/.husky/pre-commit +0 -1
  220. package/.storybook/main.ts +0 -25
  221. package/.storybook/preview-head.html +0 -6
  222. package/.storybook/preview.tsx +0 -48
  223. package/.storybook/vitest.setup.ts +0 -8
  224. package/eslint.config.mjs +0 -29
  225. package/lint-staged.config.js +0 -15
  226. package/pnpm-workspace.yaml +0 -2
  227. package/postcss.config.mjs +0 -7
  228. package/prettier.config.mjs +0 -24
  229. package/scripts/build-icon-types.ts +0 -38
  230. package/src/-utils.tsx +0 -64
  231. package/src/components/accordion/accordion.module.css +0 -44
  232. package/src/components/accordion/accordion.stories.tsx +0 -36
  233. package/src/components/accordion/index.tsx +0 -67
  234. package/src/components/alert-dialog/alert-dialog.module.css +0 -5
  235. package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -53
  236. package/src/components/alert-dialog/index.tsx +0 -138
  237. package/src/components/anchor/anchor.module.css +0 -18
  238. package/src/components/anchor/anchor.stories.tsx +0 -28
  239. package/src/components/anchor/index.tsx +0 -45
  240. package/src/components/avatar/avatar.module.css +0 -56
  241. package/src/components/avatar/avatar.stories.tsx +0 -61
  242. package/src/components/avatar/index.tsx +0 -82
  243. package/src/components/badge/badge.module.css +0 -35
  244. package/src/components/badge/badge.stories.tsx +0 -60
  245. package/src/components/badge/index.tsx +0 -71
  246. package/src/components/button/button.module.css +0 -42
  247. package/src/components/button/button.stories.tsx +0 -108
  248. package/src/components/button/index.tsx +0 -63
  249. package/src/components/checkbox/checkbox.module.css +0 -36
  250. package/src/components/checkbox/checkbox.stories.tsx +0 -21
  251. package/src/components/checkbox/index.tsx +0 -41
  252. package/src/components/code/code.module.css +0 -20
  253. package/src/components/code/code.stories.tsx +0 -42
  254. package/src/components/code/index.tsx +0 -73
  255. package/src/components/collapse/collapse.module.css +0 -27
  256. package/src/components/collapse/collapse.stories.tsx +0 -27
  257. package/src/components/collapse/index.tsx +0 -59
  258. package/src/components/command/command.module.css +0 -95
  259. package/src/components/command/command.stories.tsx +0 -38
  260. package/src/components/command/index.tsx +0 -108
  261. package/src/components/context-menu/context-menu.module.css +0 -36
  262. package/src/components/context-menu/context-menu.stories.tsx +0 -99
  263. package/src/components/context-menu/index.tsx +0 -242
  264. package/src/components/dialog/dialog.module.css +0 -71
  265. package/src/components/dialog/dialog.stories.tsx +0 -29
  266. package/src/components/dialog/index.tsx +0 -148
  267. package/src/components/heading/heading.module.css +0 -3
  268. package/src/components/heading/heading.stories.tsx +0 -52
  269. package/src/components/heading/index.tsx +0 -112
  270. package/src/components/icon/icon-names.ts +0 -3189
  271. package/src/components/icon/icon.module.css +0 -36
  272. package/src/components/icon/icon.stories.tsx +0 -40
  273. package/src/components/icon/index.tsx +0 -60
  274. package/src/components/icon-button/icon-button.module.css +0 -33
  275. package/src/components/icon-button/icon-button.stories.tsx +0 -59
  276. package/src/components/icon-button/index.tsx +0 -48
  277. package/src/components/inline-code/index.tsx +0 -29
  278. package/src/components/inline-code/inline-code.module.css +0 -13
  279. package/src/components/inline-code/inline-code.stories.tsx +0 -31
  280. package/src/components/input/index.tsx +0 -22
  281. package/src/components/input/input.module.css +0 -23
  282. package/src/components/input/input.stories.tsx +0 -52
  283. package/src/components/meter/index.tsx +0 -55
  284. package/src/components/meter/meter.module.css +0 -23
  285. package/src/components/meter/meter.stories.tsx +0 -31
  286. package/src/components/multiline-input/index.tsx +0 -58
  287. package/src/components/multiline-input/multiline-input.stories.tsx +0 -26
  288. package/src/components/number-input/index.tsx +0 -74
  289. package/src/components/number-input/number-input.module.css +0 -41
  290. package/src/components/number-input/number-input.stories.tsx +0 -24
  291. package/src/components/password-input/index.tsx +0 -24
  292. package/src/components/password-input/password-input.module.css +0 -10
  293. package/src/components/password-input/password-input.stories.tsx +0 -24
  294. package/src/components/pill/index.tsx +0 -45
  295. package/src/components/pill/pill.module.css +0 -22
  296. package/src/components/pill/pill.stories.tsx +0 -83
  297. package/src/components/popover/index.tsx +0 -94
  298. package/src/components/popover/popover.module.css +0 -8
  299. package/src/components/popover/popover.stories.tsx +0 -53
  300. package/src/components/preview-card/index.tsx +0 -68
  301. package/src/components/preview-card/preview-card.module.css +0 -5
  302. package/src/components/preview-card/preview-card.stories.tsx +0 -58
  303. package/src/components/radio/index.tsx +0 -67
  304. package/src/components/radio/radio-group.module.css +0 -5
  305. package/src/components/radio/radio.module.css +0 -36
  306. package/src/components/radio/radio.stories.tsx +0 -27
  307. package/src/components/search-bar/index.tsx +0 -60
  308. package/src/components/search-bar/search-bar.module.css +0 -29
  309. package/src/components/search-bar/search-bar.stories.tsx +0 -37
  310. package/src/components/select/index.tsx +0 -132
  311. package/src/components/select/select.module.css +0 -63
  312. package/src/components/select/select.stories.tsx +0 -49
  313. package/src/components/separator/index.tsx +0 -28
  314. package/src/components/separator/separator.module.css +0 -24
  315. package/src/components/separator/separator.stories.tsx +0 -40
  316. package/src/components/slider/index.tsx +0 -28
  317. package/src/components/slider/slider.module.css +0 -52
  318. package/src/components/slider/slider.stories.tsx +0 -53
  319. package/src/components/spinner/index.tsx +0 -14
  320. package/src/components/spinner/spinner.module.css +0 -13
  321. package/src/components/spinner/spinner.stories.tsx +0 -17
  322. package/src/components/stacked-avatars/index.tsx +0 -88
  323. package/src/components/stacked-avatars/stacked-avatars.module.css +0 -79
  324. package/src/components/stacked-avatars/stacked-avatars.stories.tsx +0 -48
  325. package/src/components/status-banner/index.tsx +0 -96
  326. package/src/components/status-banner/status-banner.module.css +0 -52
  327. package/src/components/status-banner/status-banner.stories.tsx +0 -44
  328. package/src/components/surface/index.tsx +0 -83
  329. package/src/components/surface/surface.module.css +0 -35
  330. package/src/components/surface/surface.stories.tsx +0 -84
  331. package/src/components/switch/index.tsx +0 -23
  332. package/src/components/switch/switch.module.css +0 -45
  333. package/src/components/switch/switch.stories.tsx +0 -48
  334. package/src/components/tabs/index.tsx +0 -126
  335. package/src/components/tabs/tabs.module.css +0 -134
  336. package/src/components/tabs/tabs.stories.tsx +0 -88
  337. package/src/components/text/index.tsx +0 -69
  338. package/src/components/text/text.module.css +0 -76
  339. package/src/components/text/text.stories.tsx +0 -107
  340. package/src/components/theme-provider/index.ts +0 -2
  341. package/src/components/theme-provider/theme-context.tsx +0 -18
  342. package/src/components/theme-provider/theme-provider.stories.tsx +0 -47
  343. package/src/components/theme-provider/theme-provider.tsx +0 -77
  344. package/src/components/timestamp/index.tsx +0 -131
  345. package/src/components/timestamp/timestamp.module.css +0 -8
  346. package/src/components/timestamp/timestamp.stories.tsx +0 -37
  347. package/src/components/toast/index.ts +0 -2
  348. package/src/components/toast/toast.module.css +0 -163
  349. package/src/components/toast/toast.stories.tsx +0 -53
  350. package/src/components/toast/toast.tsx +0 -104
  351. package/src/components/toast/use-toast-manager.ts +0 -63
  352. package/src/components/tooltip/index.tsx +0 -61
  353. package/src/components/tooltip/tooltip-arrow.tsx +0 -17
  354. package/src/components/tooltip/tooltip.module.css +0 -44
  355. package/src/components/tooltip/tooltip.stories.tsx +0 -76
  356. package/src/components/view/index.tsx +0 -137
  357. package/src/components/view/view.module.css +0 -11
  358. package/src/components/view/view.stories.tsx +0 -131
  359. package/src/components/view/view_colorway.module.css +0 -280
  360. package/src/components/view/view_interactive.module.css +0 -127
  361. package/src/components/view/view_loading.module.css +0 -58
  362. package/src/components/visually-hidden/index.ts +0 -1
  363. package/src/index.ts +0 -49
  364. package/src/integrations/react-markdown/index.tsx +0 -134
  365. package/src/integrations/react-markdown/react-markdown.module.css +0 -62
  366. package/src/integrations/react-markdown/react-markdown.stories.tsx +0 -31
  367. package/src/integrations/tailwind.css +0 -173
  368. package/src/integrations/twemoij/index.tsx +0 -13
  369. package/src/integrations/twemoij/twemoji.module.css +0 -7
  370. package/src/integrations/twemoij/twemoji.stories.tsx +0 -40
  371. package/src/stories/components/all-variants.tsx +0 -40
  372. package/src/stories/data.ts +0 -72
  373. package/src/stories/utils.ts +0 -20
  374. package/src/styles/core.css +0 -153
  375. package/src/styles/themes/dark.css +0 -86
  376. package/src/styles/themes/light.css +0 -86
  377. package/src/styles/transitions.module.css +0 -31
  378. package/stylelint.config.mjs +0 -29
  379. package/tsconfig.app.json +0 -35
  380. package/tsconfig.json +0 -7
  381. package/tsconfig.node.json +0 -26
  382. package/vite.config.ts +0 -103
  383. package/vitest.shims.d.ts +0 -1
@@ -1,99 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
-
3
- import { tokens } from "~/styles/tokens";
4
-
5
- import {
6
- ContextMenu,
7
- ContextMenuCheckboxItem,
8
- ContextMenuGroup,
9
- ContextMenuItem,
10
- ContextMenuMore,
11
- ContextMenuRadioGroup,
12
- ContextMenuRadioItem,
13
- ContextMenuSeparator,
14
- } from ".";
15
- import { Text } from "../text";
16
- import { View } from "../view";
17
-
18
- const meta = {
19
- title: "ContextMenu",
20
- component: ContextMenu,
21
- parameters: { layout: "centered" },
22
- } satisfies Meta<typeof ContextMenu>;
23
-
24
- export default meta;
25
-
26
- type Story = StoryObj<typeof meta>;
27
-
28
- export const Default: Story = {
29
- render: () => (
30
- <>
31
- <ContextMenu
32
- style={{ width: "200px" }}
33
- trigger={
34
- <View
35
- style={{
36
- height: tokens.space128,
37
- width: tokens.space256,
38
- border: `1px dashed ${tokens.primaryDefault}`,
39
- backgroundColor: tokens.primaryDimmest,
40
- borderRadius: tokens.borderRadiusDefault,
41
- color: tokens.primaryDefault,
42
- alignItems: "center",
43
- justifyContent: "center",
44
- }}
45
- >
46
- <Text color="inherit">Right click here</Text>
47
- </View>
48
- }
49
- >
50
- <ContextMenuGroup>
51
- <ContextMenuItem icon="arrow-left-line" disabled shortcut="⌘+[">
52
- Back
53
- </ContextMenuItem>
54
- <ContextMenuItem icon="arrow-right-line" shortcut="⌘+]">
55
- Forward
56
- </ContextMenuItem>
57
- <ContextMenuItem icon="refresh-line">Reload</ContextMenuItem>
58
- <ContextMenuMore icon="tools-line" label="More Tools">
59
- <ContextMenuGroup>
60
- <ContextMenuItem icon="download-line">
61
- Save Page As
62
- </ContextMenuItem>
63
- <ContextMenuItem icon="links-line">
64
- Create Shortcut
65
- </ContextMenuItem>
66
- <ContextMenuItem icon="window-2-line">
67
- Name Window
68
- </ContextMenuItem>
69
- </ContextMenuGroup>
70
- <ContextMenuSeparator />
71
- <ContextMenuItem icon="terminal-box-line">
72
- Developer Tools
73
- </ContextMenuItem>
74
- </ContextMenuMore>
75
- </ContextMenuGroup>
76
-
77
- <ContextMenuSeparator />
78
-
79
- <ContextMenuGroup>
80
- <ContextMenuCheckboxItem value="bookmarks">
81
- Show Bookmarks
82
- </ContextMenuCheckboxItem>
83
- <ContextMenuCheckboxItem value="show_full_urls">
84
- Show Full URLs
85
- </ContextMenuCheckboxItem>
86
- </ContextMenuGroup>
87
-
88
- <ContextMenuSeparator />
89
-
90
- <ContextMenuGroup label="People">
91
- <ContextMenuRadioGroup defaultValue="a">
92
- <ContextMenuRadioItem value="a">Pedro Duarte</ContextMenuRadioItem>
93
- <ContextMenuRadioItem value="b">Colm Tuite</ContextMenuRadioItem>
94
- </ContextMenuRadioGroup>
95
- </ContextMenuGroup>
96
- </ContextMenu>
97
- </>
98
- ),
99
- };
@@ -1,242 +0,0 @@
1
- import { ContextMenu as ContextMenuPrimitive } from "@base-ui/react/context-menu";
2
- import clsx from "clsx";
3
- import {
4
- createContext,
5
- useContext,
6
- type CSSProperties,
7
- type ReactElement,
8
- type ReactNode,
9
- } from "react";
10
-
11
- import { textify } from "~/-utils";
12
- import { tokens } from "~/styles/tokens";
13
-
14
- import { Icon } from "../icon";
15
- import type { IconName } from "../icon/icon-names";
16
- import { Separator, type SeparatorProps } from "../separator";
17
- import { Surface, type Background } from "../surface";
18
- import { Text } from "../text";
19
- import { View } from "../view";
20
-
21
- import transitionStyles from "../../styles/transitions.module.css";
22
- import styles from "./context-menu.module.css";
23
-
24
- export type ContextMenuProps = ContextMenuPrimitive.Root.Props & {
25
- /** Specify trigger to open context menu. */
26
- trigger?: ReactElement;
27
-
28
- /** Surface background popup should use. Defaults to "root". Propogates to submenus. */
29
- background?: Background;
30
-
31
- /** Context menu content */
32
- children?: ReactNode;
33
-
34
- /** Apply className to ContextMenuPrimitive.Popup */
35
- className?: string;
36
-
37
- /** Apply styles to ContextMenuPrimitive.Popup */
38
- style?: CSSProperties;
39
- };
40
-
41
- const ContextMenuContext = createContext<Background>("root");
42
-
43
- export function ContextMenu({
44
- trigger,
45
- background = "root",
46
- className,
47
- children,
48
- style,
49
- ...props
50
- }: ContextMenuProps) {
51
- return (
52
- <ContextMenuContext.Provider value={background}>
53
- <ContextMenuPrimitive.Root {...props}>
54
- {trigger ? <ContextMenuPrimitive.Trigger render={trigger} /> : null}
55
- <ContextMenuPrimitive.Portal>
56
- <ContextMenuPrimitive.Positioner>
57
- <ContextMenuPrimitive.Popup
58
- render={<Surface background={background} />}
59
- className={clsx(
60
- styles["context-menu"],
61
- transitionStyles["transition_fade-out"],
62
- className,
63
- )}
64
- style={style}
65
- >
66
- {children}
67
- </ContextMenuPrimitive.Popup>
68
- </ContextMenuPrimitive.Positioner>
69
- </ContextMenuPrimitive.Portal>
70
- </ContextMenuPrimitive.Root>
71
- </ContextMenuContext.Provider>
72
- );
73
- }
74
-
75
- export function ContextMenuItem({
76
- icon,
77
- shortcut,
78
- className,
79
- children,
80
- ...props
81
- }: ContextMenuPrimitive.Item.Props & {
82
- /** Optional item icon to communicate purpose */
83
- icon?: IconName;
84
-
85
- /** Indicate that this action can be triggered by a keyboard shortcut */
86
- shortcut?: string;
87
- }) {
88
- return (
89
- <View
90
- render={<ContextMenuPrimitive.Item {...props} />}
91
- interactive="list-item"
92
- className={clsx(styles["context-menu__item"], className)}
93
- >
94
- {icon ? (
95
- <Icon name={icon} className={styles["context-menu__item-icon"]} />
96
- ) : null}
97
- {textify(children)}
98
- {shortcut ? (
99
- <Text
100
- className={styles["context-menu__item-shortcut"]}
101
- color="dimmest"
102
- size="sm"
103
- >
104
- {shortcut}
105
- </Text>
106
- ) : null}
107
- </View>
108
- );
109
- }
110
-
111
- export function ContextMenuSeparator(
112
- props: ContextMenuPrimitive.Separator.Props & SeparatorProps,
113
- ) {
114
- return <Separator render={<ContextMenuPrimitive.Separator />} {...props} />;
115
- }
116
-
117
- export function ContextMenuGroup({
118
- label,
119
- children,
120
- ...props
121
- }: ContextMenuPrimitive.Group.Props & {
122
- label?: string;
123
- }) {
124
- return (
125
- <ContextMenuPrimitive.Group {...props}>
126
- {label ? (
127
- <Text
128
- render={<ContextMenuPrimitive.GroupLabel />}
129
- className={styles["context-menu__label"]}
130
- color="dimmest"
131
- size="sm"
132
- >
133
- {label}
134
- </Text>
135
- ) : null}
136
- {children}
137
- </ContextMenuPrimitive.Group>
138
- );
139
- }
140
-
141
- export const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
142
-
143
- export function ContextMenuRadioItem({
144
- className,
145
- children,
146
- ...props
147
- }: ContextMenuPrimitive.RadioItem.Props) {
148
- return (
149
- <View
150
- interactive="list-item"
151
- render={<ContextMenuPrimitive.RadioItem {...props} />}
152
- className={clsx(styles["context-menu__item"], className)}
153
- >
154
- <ContextMenuPrimitive.RadioItemIndicator
155
- className={styles["context-menu__item-icon"]}
156
- >
157
- <Icon name="checkbox-circle-line" color={tokens.primaryDefault} />
158
- </ContextMenuPrimitive.RadioItemIndicator>
159
- {textify(children)}
160
- </View>
161
- );
162
- }
163
-
164
- export function ContextMenuCheckboxItem({
165
- className,
166
- children,
167
- ...props
168
- }: ContextMenuPrimitive.RadioItem.Props) {
169
- return (
170
- <View
171
- interactive="list-item"
172
- render={<ContextMenuPrimitive.CheckboxItem {...props} />}
173
- className={clsx(styles["context-menu__item"], className)}
174
- >
175
- <ContextMenuPrimitive.CheckboxItemIndicator
176
- className={styles["context-menu__item-icon"]}
177
- >
178
- <Icon name="check-line" color={tokens.primaryDefault} />
179
- </ContextMenuPrimitive.CheckboxItemIndicator>
180
- {textify(children)}
181
- </View>
182
- );
183
- }
184
-
185
- export function ContextMenuMore({
186
- label,
187
- icon,
188
- children,
189
- className,
190
- style,
191
- ...props
192
- }: ContextMenuPrimitive.SubmenuRoot.Props & {
193
- label: string;
194
-
195
- /** Optional item icon to communicate purpose */
196
- icon?: IconName;
197
-
198
- /** Context menu content */
199
- children?: ReactNode;
200
-
201
- /** Apply className to ContextMenuPrimitive.Popup */
202
- className?: string;
203
-
204
- /** Apply styles to ContextMenuPrimitive.Popup */
205
- style?: CSSProperties;
206
- }) {
207
- const background = useContext(ContextMenuContext);
208
-
209
- return (
210
- <ContextMenuPrimitive.SubmenuRoot {...props}>
211
- <View
212
- render={<ContextMenuPrimitive.SubmenuTrigger />}
213
- className={styles["context-menu__item"]}
214
- >
215
- {icon ? (
216
- <Icon name={icon} className={styles["context-menu__item-icon"]} />
217
- ) : null}
218
- {textify(label)}
219
- <Icon
220
- name="arrow-right-line"
221
- className={styles["context-menu__item-shortcut"]}
222
- />
223
- </View>
224
-
225
- <ContextMenuPrimitive.Portal>
226
- <ContextMenuPrimitive.Positioner alignOffset={-4} sideOffset={-4}>
227
- <ContextMenuPrimitive.Popup
228
- render={<Surface background={background} />}
229
- className={clsx(
230
- styles["context-menu"],
231
- transitionStyles["transition_scale"],
232
- className,
233
- )}
234
- style={style}
235
- >
236
- {children}
237
- </ContextMenuPrimitive.Popup>
238
- </ContextMenuPrimitive.Positioner>
239
- </ContextMenuPrimitive.Portal>
240
- </ContextMenuPrimitive.SubmenuRoot>
241
- );
242
- }
@@ -1,71 +0,0 @@
1
- .dialog__backdrop {
2
- position: fixed;
3
- z-index: 50;
4
- inset: 0;
5
- background-color: var(--background-overlay);
6
-
7
- /* iOS 26+: Ensure the backdrop covers the entire visible viewport. */
8
- @supports (-webkit-touch-callout: none) {
9
- position: absolute;
10
- }
11
- }
12
-
13
- .dialog__popup {
14
- display: block;
15
- position: fixed;
16
- z-index: 51;
17
- inset: 0;
18
- isolation: isolate;
19
- padding: var(--space-16);
20
- height: 100%;
21
- overflow: auto;
22
- }
23
-
24
- .dialog__popup_centered {
25
- display: flex;
26
- place-items: center;
27
-
28
- @media screen and (width >= 512px) {
29
- padding: var(--space-32);
30
- padding-top: var(--space-64);
31
- padding-bottom: var(--space-64);
32
- }
33
- }
34
-
35
- .dialog__content {
36
- position: relative;
37
- flex-grow: 1;
38
- flex-shrink: 1;
39
- gap: var(--space-16);
40
- margin: 0 auto;
41
- outline: none;
42
- box-shadow: var(--shadow-2);
43
- border: 1px solid var(--outline-dimmest);
44
- border-radius: var(--border-radius-default);
45
- padding: var(--space-16);
46
- width: 100%;
47
- height: auto;
48
- overflow: hidden;
49
- }
50
-
51
- .dialog__content_width_sm {
52
- max-width: 384px;
53
- }
54
-
55
- .dialog__content_width_md {
56
- max-width: 512px;
57
- }
58
-
59
- .dialog__content_width_lg {
60
- max-width: 872px;
61
- }
62
-
63
- .dialog__header {
64
- gap: var(--space-4);
65
- }
66
-
67
- .dialog__close {
68
- position: absolute;
69
- top: var(--space-8);
70
- right: var(--space-8);
71
- }
@@ -1,29 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
-
3
- import { Dialog } from ".";
4
- import { Button } from "../button";
5
-
6
- const meta = {
7
- title: "Dialog/Standard Dialog",
8
- component: Dialog,
9
- parameters: { layout: "centered" },
10
- } satisfies Meta<typeof Dialog>;
11
-
12
- export default meta;
13
-
14
- type Story = StoryObj<typeof meta>;
15
-
16
- export const Default: Story = {
17
- args: {
18
- title: "On color",
19
- description:
20
- "Lots of different, solid, highly saturated colors all over the UI. This makes it hard to tell what's important, and means users will be easily distracted.",
21
- },
22
- render: (args) => (
23
- <Dialog
24
- closable
25
- trigger={<Button leftIcon="palette-line" children="Open Dialog" />}
26
- {...args}
27
- />
28
- ),
29
- };
@@ -1,148 +0,0 @@
1
- import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
2
- import clsx from "clsx";
3
- import type { ComponentProps, ReactElement, ReactNode } from "react";
4
-
5
- import type { Size } from "~/styles/tokens";
6
-
7
- import { Button, type ButtonProps } from "../button";
8
- import { IconButton } from "../icon-button";
9
- import { Surface, type Background } from "../surface";
10
- import { Text } from "../text";
11
- import { View } from "../view";
12
-
13
- import transitionStyles from "../../styles/transitions.module.css";
14
- import styles from "./dialog.module.css";
15
-
16
- export type BaseDialogProps = {
17
- /**
18
- * The title of the dialog.
19
- * Renders DialogPrimitive.Title at "2xl" size.
20
- */
21
- title?: string;
22
-
23
- /**
24
- * The description of the dialog.
25
- * Renders DialogPrimitive.Description at default size & dimmer color.
26
- */
27
- description?: string;
28
-
29
- /** Dialog content */
30
- children?: ReactNode;
31
-
32
- /**
33
- * Specify trigger to open alert. You can still used a {@link https://base-ui.com/react/components/dialog#detached-triggers detached trigger}
34
- */
35
- trigger?: ReactElement;
36
-
37
- /**
38
- * Maximum width of the dialog. Defaults to "md".
39
- */
40
- width?: Extract<Size, "sm" | "md" | "lg">;
41
-
42
- /**
43
- * Override popup background. Defaults to "root"
44
- */
45
- background?: Background;
46
-
47
- /**
48
- * Vertically center dialog (or not). You probably shouldn't if you suspect
49
- * content will overflow.
50
- */
51
- centered?: boolean;
52
-
53
- /**
54
- * Apply className to the dialog content
55
- */
56
- className?: string;
57
- };
58
-
59
- export type DialogProps = ComponentProps<typeof DialogPrimitive.Root> &
60
- BaseDialogProps & {
61
- /**
62
- * Show close icon
63
- */
64
- closable?: boolean;
65
- };
66
-
67
- export function Dialog({
68
- title,
69
- description,
70
- trigger,
71
- width = "md",
72
- background = "root",
73
- centered,
74
- closable,
75
- children,
76
- className,
77
- ...props
78
- }: DialogProps) {
79
- return (
80
- <DialogPrimitive.Root {...props}>
81
- {trigger ? <DialogPrimitive.Trigger render={trigger} /> : null}
82
- <DialogPrimitive.Portal>
83
- <DialogPrimitive.Backdrop
84
- className={clsx(
85
- styles["dialog__backdrop"],
86
- transitionStyles["transition_opacity"],
87
- )}
88
- />
89
- <DialogPrimitive.Popup
90
- className={clsx(
91
- styles["dialog__popup"],
92
- centered && styles["dialog__popup_centered"],
93
- transitionStyles["transition_scale"],
94
- )}
95
- >
96
- <Surface
97
- background={background}
98
- className={clsx(
99
- styles["dialog__content"],
100
- styles[`dialog__content_width_${width}`],
101
- className,
102
- )}
103
- >
104
- {title || description ? (
105
- <View className={styles["dialog__header"]}>
106
- {title ? (
107
- <Text render={<DialogPrimitive.Title />} size="2xl">
108
- {title}
109
- </Text>
110
- ) : null}
111
- {description ? (
112
- <Text
113
- multiline
114
- color="dimmer"
115
- render={<DialogPrimitive.Description />}
116
- >
117
- {description}
118
- </Text>
119
- ) : null}
120
- </View>
121
- ) : null}
122
-
123
- {children}
124
-
125
- {closable ? (
126
- <DialogPrimitive.Close
127
- data-framework-close
128
- className={styles["dialog__close"]}
129
- render={
130
- <IconButton
131
- size="sm"
132
- icon="close-line"
133
- alt="Close"
134
- interactive="no-fill"
135
- />
136
- }
137
- />
138
- ) : null}
139
- </Surface>
140
- </DialogPrimitive.Popup>
141
- </DialogPrimitive.Portal>
142
- </DialogPrimitive.Root>
143
- );
144
- }
145
-
146
- export function DialogClose(props: ButtonProps) {
147
- return <DialogPrimitive.Close render={<Button {...props} />} />;
148
- }
@@ -1,3 +0,0 @@
1
- .heading {
2
- font-weight: var(--font-weight-medium);
3
- }
@@ -1,52 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
-
3
- import { Heading, Section, type HeadingProps } from ".";
4
-
5
- const meta = {
6
- title: "Typography/Heading",
7
- component: Heading,
8
- parameters: { layout: "centered" },
9
- argTypes: {
10
- level: {
11
- control: "select",
12
- },
13
- },
14
- } satisfies Meta<HeadingProps>;
15
-
16
- export default meta;
17
-
18
- type Story = StoryObj<typeof meta>;
19
-
20
- export const Default: Story = {
21
- args: {
22
- level: 1,
23
- },
24
- render: ({ level }) => (
25
- <Heading level={level}>Hello World (h{level})</Heading>
26
- ),
27
- };
28
-
29
- export const AutoLevel: Story = {
30
- args: {
31
- level: 1,
32
- },
33
- parameters: {
34
- docs: {
35
- description: {
36
- story:
37
- "When nested within `Section` components, `Heading` will automatically determine its level based on the current section depth.",
38
- },
39
- },
40
- },
41
- render: (props) => (
42
- <Section {...props}>
43
- <Heading>Hello World</Heading>
44
- <Section>
45
- <Heading>Hello World</Heading>
46
- <Section>
47
- <Heading>Hello World</Heading>
48
- </Section>
49
- </Section>
50
- </Section>
51
- ),
52
- };