@accelint/design-system 0.1.0 → 0.1.1

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 (365) hide show
  1. package/dist/assets/components/button/button.css +55 -0
  2. package/dist/assets/components/checkbox/checkbox.css +73 -0
  3. package/dist/assets/components/chip/chip.css +62 -0
  4. package/dist/assets/components/combo-box/combo-box.css +66 -0
  5. package/dist/assets/components/dialog/dialog.css +51 -0
  6. package/dist/assets/components/drawer/drawer.css +135 -0
  7. package/dist/assets/components/group/group.css +33 -0
  8. package/dist/assets/components/icon/icon.css +19 -0
  9. package/dist/assets/components/input/input.css +29 -0
  10. package/dist/assets/components/menu/menu.css +83 -0
  11. package/dist/assets/components/options/options.css +80 -0
  12. package/dist/assets/components/picker/picker.css +47 -0
  13. package/dist/assets/components/popover/popover.css +26 -0
  14. package/dist/assets/components/query-builder/query-builder.css +129 -0
  15. package/dist/assets/components/radio/radio.css +67 -0
  16. package/dist/assets/components/search-field/search-field.css +62 -0
  17. package/dist/assets/components/select/select.css +33 -0
  18. package/dist/assets/components/switch/switch.css +62 -0
  19. package/dist/assets/components/tabs/tabs.css +144 -0
  20. package/dist/assets/components/textarea/textarea.css +32 -0
  21. package/dist/assets/components/tooltip/tooltip.css +54 -0
  22. package/dist/assets/components/tree/tree.css +157 -0
  23. package/dist/assets/hooks/use-theme/use-theme.css +6 -0
  24. package/dist/assets/src/components/button/button.css.ts.vanilla-9uttMYGm.css +55 -0
  25. package/dist/assets/src/components/checkbox/checkbox.css.ts.vanilla-Bewmypyn.css +73 -0
  26. package/dist/assets/src/components/chip/chip.css.ts.vanilla-CsGhxrlu.css +62 -0
  27. package/dist/assets/src/components/combo-box/combo-box.css.ts.vanilla-BNEPKjPm.css +66 -0
  28. package/dist/assets/src/components/dialog/dialog.css.ts.vanilla-CG0m-NJD.css +51 -0
  29. package/dist/assets/src/components/drawer/drawer.css.ts.vanilla-DEfHnoNS.css +135 -0
  30. package/dist/assets/src/components/group/group.css.ts.vanilla-DR69xgQy.css +33 -0
  31. package/dist/assets/src/components/icon/icon.css.ts.vanilla-CoUAfp2F.css +19 -0
  32. package/dist/assets/src/components/input/input.css.ts.vanilla-DoK5h9SX.css +29 -0
  33. package/dist/assets/src/components/menu/menu.css.ts.vanilla-CSnDqc5E.css +83 -0
  34. package/dist/assets/src/components/options/options.css.ts.vanilla-ngVt12W4.css +80 -0
  35. package/dist/assets/src/components/picker/picker.css.ts.vanilla-Fe0YXv-c.css +47 -0
  36. package/dist/assets/src/components/popover/popover.css.ts.vanilla-C5YGwwVD.css +26 -0
  37. package/dist/assets/src/components/query-builder/query-builder.css.ts.vanilla-B3P9cbCv.css +129 -0
  38. package/dist/assets/src/components/radio/radio.css.ts.vanilla-gi-KedQc.css +67 -0
  39. package/dist/assets/src/components/search-field/search-field.css.ts.vanilla-B_JL53f8.css +62 -0
  40. package/dist/assets/src/components/select/select.css.ts.vanilla-C94A60jf.css +33 -0
  41. package/dist/assets/src/components/switch/switch.css.ts.vanilla-DkQwtRa6.css +62 -0
  42. package/dist/assets/src/components/tabs/tabs.css.ts.vanilla-BygIflpl.css +144 -0
  43. package/dist/assets/src/components/textarea/textarea.css.ts.vanilla-Ba6E5HFc.css +32 -0
  44. package/dist/assets/src/components/tooltip/tooltip.css.ts.vanilla-BntxAlwN.css +54 -0
  45. package/dist/assets/src/components/tree/tree.css.ts.vanilla-SLmhk0zZ.css +157 -0
  46. package/dist/assets/src/hooks/use-theme/use-theme.css.ts.vanilla-zkVHnGkP.css +6 -0
  47. package/dist/assets/src/styles/layers.css.ts.vanilla-B2GUgnOF.css +21 -0
  48. package/dist/assets/src/styles/reset.css.ts.vanilla-C8PShXm0.css +31 -0
  49. package/dist/assets/src/styles/space.css.ts.vanilla-Md6Whc4G.css +18 -0
  50. package/dist/assets/src/styles/surfaces.css.ts.vanilla-Ckztx7VT.css +24 -0
  51. package/dist/assets/src/styles/theme.css.ts.vanilla-aDPSIzBK.css +208 -0
  52. package/dist/assets/src/styles/typography.css.ts.vanilla-DRT9H7rd.css +150 -0
  53. package/dist/assets/styles/layers.css +21 -0
  54. package/dist/assets/styles/reset.css +31 -0
  55. package/dist/assets/styles/space.css +18 -0
  56. package/dist/assets/styles/surfaces.css +24 -0
  57. package/dist/assets/styles/theme.css +208 -0
  58. package/dist/assets/styles/typography.css +150 -0
  59. package/dist/components/aria/aria.d.ts +19 -0
  60. package/dist/components/aria/aria.js +36 -0
  61. package/dist/components/aria/aria.js.map +1 -0
  62. package/dist/components/aria/index.d.ts +1 -0
  63. package/dist/components/button/button.css.d.ts +33 -0
  64. package/dist/components/button/button.d.ts +39 -0
  65. package/dist/components/button/button.js +71 -0
  66. package/dist/components/button/button.js.map +1 -0
  67. package/dist/components/button/button.vanilla.js +8 -0
  68. package/dist/components/button/button.vanilla.js.map +1 -0
  69. package/dist/components/button/index.d.ts +3 -0
  70. package/dist/components/button/types.d.ts +28 -0
  71. package/dist/components/checkbox/checkbox.css.d.ts +35 -0
  72. package/dist/components/checkbox/checkbox.d.ts +21 -0
  73. package/dist/components/checkbox/checkbox.js +68 -0
  74. package/dist/components/checkbox/checkbox.js.map +1 -0
  75. package/dist/components/checkbox/checkbox.vanilla.js +9 -0
  76. package/dist/components/checkbox/checkbox.vanilla.js.map +1 -0
  77. package/dist/components/checkbox/index.d.ts +3 -0
  78. package/dist/components/checkbox/types.d.ts +38 -0
  79. package/dist/components/chip/chip.css.d.ts +31 -0
  80. package/dist/components/chip/chip.d.ts +30 -0
  81. package/dist/components/chip/chip.js +106 -0
  82. package/dist/components/chip/chip.js.map +1 -0
  83. package/dist/components/chip/chip.vanilla.js +8 -0
  84. package/dist/components/chip/chip.vanilla.js.map +1 -0
  85. package/dist/components/chip/index.d.ts +3 -0
  86. package/dist/components/chip/types.d.ts +31 -0
  87. package/dist/components/collection/collection.d.ts +13 -0
  88. package/dist/components/collection/collection.js +15 -0
  89. package/dist/components/collection/collection.js.map +1 -0
  90. package/dist/components/collection/index.d.ts +1 -0
  91. package/dist/components/combo-box/combo-box.css.d.ts +22 -0
  92. package/dist/components/combo-box/combo-box.d.ts +8 -0
  93. package/dist/components/combo-box/combo-box.js +87 -0
  94. package/dist/components/combo-box/combo-box.js.map +1 -0
  95. package/dist/components/combo-box/combo-box.vanilla.js +8 -0
  96. package/dist/components/combo-box/combo-box.vanilla.js.map +1 -0
  97. package/dist/components/combo-box/index.d.ts +3 -0
  98. package/dist/components/combo-box/types.d.ts +32 -0
  99. package/dist/components/dialog/dialog.css.d.ts +34 -0
  100. package/dist/components/dialog/dialog.d.ts +18 -0
  101. package/dist/components/dialog/dialog.js +146 -0
  102. package/dist/components/dialog/dialog.js.map +1 -0
  103. package/dist/components/dialog/dialog.vanilla.js +8 -0
  104. package/dist/components/dialog/dialog.vanilla.js.map +1 -0
  105. package/dist/components/dialog/index.d.ts +3 -0
  106. package/dist/components/dialog/types.d.ts +48 -0
  107. package/dist/components/drawer/drawer.css.d.ts +33 -0
  108. package/dist/components/drawer/drawer.d.ts +13 -0
  109. package/dist/components/drawer/drawer.js +199 -0
  110. package/dist/components/drawer/drawer.js.map +1 -0
  111. package/dist/components/drawer/drawer.vanilla.js +10 -0
  112. package/dist/components/drawer/drawer.vanilla.js.map +1 -0
  113. package/dist/components/drawer/index.d.ts +3 -0
  114. package/dist/components/drawer/types.d.ts +71 -0
  115. package/dist/components/element/element.d.ts +11 -0
  116. package/dist/components/element/element.js +21 -0
  117. package/dist/components/element/element.js.map +1 -0
  118. package/dist/components/element/index.d.ts +2 -0
  119. package/dist/components/element/types.d.ts +21 -0
  120. package/dist/components/group/group.css.d.ts +14 -0
  121. package/dist/components/group/group.d.ts +10 -0
  122. package/dist/components/group/group.js +44 -0
  123. package/dist/components/group/group.js.map +1 -0
  124. package/dist/components/group/group.vanilla.js +7 -0
  125. package/dist/components/group/group.vanilla.js.map +1 -0
  126. package/dist/components/group/index.d.ts +3 -0
  127. package/dist/components/group/types.d.ts +35 -0
  128. package/dist/components/icon/icon.css.d.ts +18 -0
  129. package/dist/components/icon/icon.d.ts +12 -0
  130. package/dist/components/icon/icon.js +26 -0
  131. package/dist/components/icon/icon.js.map +1 -0
  132. package/dist/components/icon/icon.vanilla.js +8 -0
  133. package/dist/components/icon/icon.vanilla.js.map +1 -0
  134. package/dist/components/icon/index.d.ts +3 -0
  135. package/dist/components/icon/types.d.ts +13 -0
  136. package/dist/components/index.d.ts +26 -0
  137. package/dist/components/input/index.d.ts +3 -0
  138. package/dist/components/input/input.css.d.ts +29 -0
  139. package/dist/components/input/input.d.ts +8 -0
  140. package/dist/components/input/input.js +93 -0
  141. package/dist/components/input/input.js.map +1 -0
  142. package/dist/components/input/input.vanilla.js +8 -0
  143. package/dist/components/input/input.vanilla.js.map +1 -0
  144. package/dist/components/input/types.d.ts +44 -0
  145. package/dist/components/menu/index.d.ts +3 -0
  146. package/dist/components/menu/menu.css.d.ts +71 -0
  147. package/dist/components/menu/menu.d.ts +24 -0
  148. package/dist/components/menu/menu.js +155 -0
  149. package/dist/components/menu/menu.js.map +1 -0
  150. package/dist/components/menu/menu.vanilla.js +8 -0
  151. package/dist/components/menu/menu.vanilla.js.map +1 -0
  152. package/dist/components/menu/types.d.ts +48 -0
  153. package/dist/components/merge-provider/index.d.ts +2 -0
  154. package/dist/components/merge-provider/merge-provider.d.ts +14 -0
  155. package/dist/components/merge-provider/merge-provider.js +40 -0
  156. package/dist/components/merge-provider/merge-provider.js.map +1 -0
  157. package/dist/components/merge-provider/types.d.ts +5 -0
  158. package/dist/components/options/index.d.ts +3 -0
  159. package/dist/components/options/options.css.d.ts +75 -0
  160. package/dist/components/options/options.d.ts +20 -0
  161. package/dist/components/options/options.js +152 -0
  162. package/dist/components/options/options.js.map +1 -0
  163. package/dist/components/options/options.vanilla.js +10 -0
  164. package/dist/components/options/options.vanilla.js.map +1 -0
  165. package/dist/components/options/types.d.ts +49 -0
  166. package/dist/components/picker/index.d.ts +3 -0
  167. package/dist/components/picker/picker.css.d.ts +32 -0
  168. package/dist/components/picker/picker.d.ts +18 -0
  169. package/dist/components/picker/picker.js +46 -0
  170. package/dist/components/picker/picker.js.map +1 -0
  171. package/dist/components/picker/picker.stories.css.d.ts +3 -0
  172. package/dist/components/picker/picker.vanilla.js +9 -0
  173. package/dist/components/picker/picker.vanilla.js.map +1 -0
  174. package/dist/components/picker/types.d.ts +28 -0
  175. package/dist/components/popover/index.d.ts +3 -0
  176. package/dist/components/popover/popover.css.d.ts +31 -0
  177. package/dist/components/popover/popover.d.ts +8 -0
  178. package/dist/components/popover/popover.js +110 -0
  179. package/dist/components/popover/popover.js.map +1 -0
  180. package/dist/components/popover/popover.vanilla.js +7 -0
  181. package/dist/components/popover/popover.vanilla.js.map +1 -0
  182. package/dist/components/popover/types.d.ts +32 -0
  183. package/dist/components/query-builder/action-element.d.ts +2 -0
  184. package/dist/components/query-builder/action-element.js +12 -0
  185. package/dist/components/query-builder/action-element.js.map +1 -0
  186. package/dist/components/query-builder/constants.d.ts +4 -0
  187. package/dist/components/query-builder/constants.js +20 -0
  188. package/dist/components/query-builder/constants.js.map +1 -0
  189. package/dist/components/query-builder/dataset-sample.d.ts +91 -0
  190. package/dist/components/query-builder/group.d.ts +5 -0
  191. package/dist/components/query-builder/group.js +87 -0
  192. package/dist/components/query-builder/group.js.map +1 -0
  193. package/dist/components/query-builder/index.d.ts +5 -0
  194. package/dist/components/query-builder/query-builder.css.d.ts +91 -0
  195. package/dist/components/query-builder/query-builder.d.ts +2 -0
  196. package/dist/components/query-builder/query-builder.js +129 -0
  197. package/dist/components/query-builder/query-builder.js.map +1 -0
  198. package/dist/components/query-builder/query-builder.vanilla.js +10 -0
  199. package/dist/components/query-builder/query-builder.vanilla.js.map +1 -0
  200. package/dist/components/query-builder/rule.d.ts +3 -0
  201. package/dist/components/query-builder/rule.js +112 -0
  202. package/dist/components/query-builder/rule.js.map +1 -0
  203. package/dist/components/query-builder/types.d.ts +128 -0
  204. package/dist/components/query-builder/utils.d.ts +29 -0
  205. package/dist/components/query-builder/utils.js +22 -0
  206. package/dist/components/query-builder/utils.js.map +1 -0
  207. package/dist/components/query-builder/value-editor.d.ts +4 -0
  208. package/dist/components/query-builder/value-editor.js +74 -0
  209. package/dist/components/query-builder/value-editor.js.map +1 -0
  210. package/dist/components/query-builder/value-selector.d.ts +2 -0
  211. package/dist/components/query-builder/value-selector.js +28 -0
  212. package/dist/components/query-builder/value-selector.js.map +1 -0
  213. package/dist/components/radio/index.d.ts +3 -0
  214. package/dist/components/radio/radio.css.d.ts +34 -0
  215. package/dist/components/radio/radio.d.ts +16 -0
  216. package/dist/components/radio/radio.js +63 -0
  217. package/dist/components/radio/radio.js.map +1 -0
  218. package/dist/components/radio/radio.vanilla.js +8 -0
  219. package/dist/components/radio/radio.vanilla.js.map +1 -0
  220. package/dist/components/radio/types.d.ts +29 -0
  221. package/dist/components/search-field/index.d.ts +3 -0
  222. package/dist/components/search-field/search-field.css.d.ts +16 -0
  223. package/dist/components/search-field/search-field.d.ts +9 -0
  224. package/dist/components/search-field/search-field.js +60 -0
  225. package/dist/components/search-field/search-field.js.map +1 -0
  226. package/dist/components/search-field/search-field.vanilla.js +7 -0
  227. package/dist/components/search-field/search-field.vanilla.js.map +1 -0
  228. package/dist/components/search-field/types.d.ts +29 -0
  229. package/dist/components/select/index.d.ts +3 -0
  230. package/dist/components/select/select.css.d.ts +25 -0
  231. package/dist/components/select/select.d.ts +8 -0
  232. package/dist/components/select/select.js +80 -0
  233. package/dist/components/select/select.js.map +1 -0
  234. package/dist/components/select/select.vanilla.js +8 -0
  235. package/dist/components/select/select.vanilla.js.map +1 -0
  236. package/dist/components/select/types.d.ts +30 -0
  237. package/dist/components/switch/index.d.ts +3 -0
  238. package/dist/components/switch/switch.css.d.ts +25 -0
  239. package/dist/components/switch/switch.d.ts +4 -0
  240. package/dist/components/switch/switch.js +34 -0
  241. package/dist/components/switch/switch.js.map +1 -0
  242. package/dist/components/switch/switch.vanilla.js +8 -0
  243. package/dist/components/switch/switch.vanilla.js.map +1 -0
  244. package/dist/components/switch/types.d.ts +17 -0
  245. package/dist/components/tabs/index.d.ts +3 -0
  246. package/dist/components/tabs/tabs.css.d.ts +49 -0
  247. package/dist/components/tabs/tabs.d.ts +68 -0
  248. package/dist/components/tabs/tabs.js +108 -0
  249. package/dist/components/tabs/tabs.js.map +1 -0
  250. package/dist/components/tabs/tabs.vanilla.js +11 -0
  251. package/dist/components/tabs/tabs.vanilla.js.map +1 -0
  252. package/dist/components/tabs/types.d.ts +82 -0
  253. package/dist/components/textarea/index.d.ts +3 -0
  254. package/dist/components/textarea/textarea.css.d.ts +31 -0
  255. package/dist/components/textarea/textarea.d.ts +14 -0
  256. package/dist/components/textarea/textarea.js +86 -0
  257. package/dist/components/textarea/textarea.js.map +1 -0
  258. package/dist/components/textarea/textarea.vanilla.js +8 -0
  259. package/dist/components/textarea/textarea.vanilla.js.map +1 -0
  260. package/dist/components/textarea/types.d.ts +39 -0
  261. package/dist/components/tooltip/index.d.ts +3 -0
  262. package/dist/components/tooltip/tooltip.css.d.ts +23 -0
  263. package/dist/components/tooltip/tooltip.d.ts +23 -0
  264. package/dist/components/tooltip/tooltip.js +69 -0
  265. package/dist/components/tooltip/tooltip.js.map +1 -0
  266. package/dist/components/tooltip/tooltip.vanilla.js +8 -0
  267. package/dist/components/tooltip/tooltip.vanilla.js.map +1 -0
  268. package/dist/components/tooltip/types.d.ts +39 -0
  269. package/dist/components/tree/index.d.ts +3 -0
  270. package/dist/components/tree/tree.css.d.ts +73 -0
  271. package/dist/components/tree/tree.d.ts +5 -0
  272. package/dist/components/tree/tree.js +337 -0
  273. package/dist/components/tree/tree.js.map +1 -0
  274. package/dist/components/tree/tree.vanilla.js +11 -0
  275. package/dist/components/tree/tree.vanilla.js.map +1 -0
  276. package/dist/components/tree/types.d.ts +114 -0
  277. package/dist/components/tree/utils.d.ts +8 -0
  278. package/dist/components/tree/utils.js +75 -0
  279. package/dist/components/tree/utils.js.map +1 -0
  280. package/dist/hooks/index.d.ts +8 -0
  281. package/dist/hooks/use-collection-render/index.d.ts +1 -0
  282. package/dist/hooks/use-collection-render/use-collection-render.d.ts +9 -0
  283. package/dist/hooks/use-collection-render/use-collection-render.js +20 -0
  284. package/dist/hooks/use-collection-render/use-collection-render.js.map +1 -0
  285. package/dist/hooks/use-context-props/index.d.ts +1 -0
  286. package/dist/hooks/use-context-props/use-context-props.d.ts +7 -0
  287. package/dist/hooks/use-context-props/use-context-props.js +15 -0
  288. package/dist/hooks/use-context-props/use-context-props.js.map +1 -0
  289. package/dist/hooks/use-defaults/index.d.ts +2 -0
  290. package/dist/hooks/use-defaults/types.d.ts +67 -0
  291. package/dist/hooks/use-defaults/use-defaults.d.ts +56 -0
  292. package/dist/hooks/use-defaults/use-defaults.js +21 -0
  293. package/dist/hooks/use-defaults/use-defaults.js.map +1 -0
  294. package/dist/hooks/use-propagating-press/index.d.ts +1 -0
  295. package/dist/hooks/use-propagating-press/use-propagating-press.d.ts +9 -0
  296. package/dist/hooks/use-propagating-press/use-propagating-press.js +14 -0
  297. package/dist/hooks/use-propagating-press/use-propagating-press.js.map +1 -0
  298. package/dist/hooks/use-slot/index.d.ts +1 -0
  299. package/dist/hooks/use-slot/use-slot.d.ts +13 -0
  300. package/dist/hooks/use-slot/use-slot.js +18 -0
  301. package/dist/hooks/use-slot/use-slot.js.map +1 -0
  302. package/dist/hooks/use-theme/index.d.ts +2 -0
  303. package/dist/hooks/use-theme/types.d.ts +86 -0
  304. package/dist/hooks/use-theme/use-theme.css.d.ts +1 -0
  305. package/dist/hooks/use-theme/use-theme.d.ts +13 -0
  306. package/dist/hooks/use-theme/use-theme.js +64 -0
  307. package/dist/hooks/use-theme/use-theme.js.map +1 -0
  308. package/dist/hooks/use-theme/use-theme.vanilla.js +4 -0
  309. package/dist/hooks/use-theme/use-theme.vanilla.js.map +1 -0
  310. package/dist/hooks/use-tree/index.d.ts +1 -0
  311. package/dist/hooks/use-tree/use-tree.d.ts +2 -0
  312. package/dist/hooks/use-tree/use-tree.js +217 -0
  313. package/dist/hooks/use-tree/use-tree.js.map +1 -0
  314. package/dist/hooks/use-tree/utils.d.ts +6 -0
  315. package/dist/hooks/use-tree/utils.js +77 -0
  316. package/dist/hooks/use-tree/utils.js.map +1 -0
  317. package/dist/hooks/use-update-effect/index.d.ts +1 -0
  318. package/dist/hooks/use-update-effect/use-update-effect.d.ts +1 -0
  319. package/dist/hooks/use-update-effect/use-update-effect.js +20 -0
  320. package/dist/hooks/use-update-effect/use-update-effect.js.map +1 -0
  321. package/dist/index.d.ts +10 -0
  322. package/dist/index.js +66 -0
  323. package/dist/index.js.map +1 -0
  324. package/dist/ladle/actions.d.ts +1 -0
  325. package/dist/ladle/index.d.ts +1 -0
  326. package/dist/styles/index.d.ts +6 -0
  327. package/dist/styles/layers.css.d.ts +16 -0
  328. package/dist/styles/layers.vanilla.js +4 -0
  329. package/dist/styles/layers.vanilla.js.map +1 -0
  330. package/dist/styles/reset.css.d.ts +1 -0
  331. package/dist/styles/space.css.d.ts +1 -0
  332. package/dist/styles/surfaces.css.d.ts +4 -0
  333. package/dist/styles/surfaces.vanilla.js +4 -0
  334. package/dist/styles/surfaces.vanilla.js.map +1 -0
  335. package/dist/styles/theme.css.d.ts +334 -0
  336. package/dist/styles/theme.vanilla.js +31 -0
  337. package/dist/styles/theme.vanilla.js.map +1 -0
  338. package/dist/styles/typography.css.d.ts +17 -0
  339. package/dist/styles/typography.vanilla.js +8 -0
  340. package/dist/styles/typography.vanilla.js.map +1 -0
  341. package/dist/styles.css +2014 -0
  342. package/dist/test/setup.d.ts +1 -0
  343. package/dist/types/deckgl.d.ts +1 -0
  344. package/dist/types/generic.d.ts +3 -0
  345. package/dist/types/index.d.ts +6 -0
  346. package/dist/types/props.d.ts +4 -0
  347. package/dist/types/react-aria.d.ts +91 -0
  348. package/dist/types/use-tree.d.ts +52 -0
  349. package/dist/types/vanilla-extract.d.ts +15 -0
  350. package/dist/utils/css.d.ts +139 -0
  351. package/dist/utils/css.js +145 -0
  352. package/dist/utils/css.js.map +1 -0
  353. package/dist/utils/events.d.ts +10 -0
  354. package/dist/utils/events.js +5 -0
  355. package/dist/utils/events.js.map +1 -0
  356. package/dist/utils/index.d.ts +4 -0
  357. package/dist/utils/props.d.ts +29 -0
  358. package/dist/utils/props.js +108 -0
  359. package/dist/utils/props.js.map +1 -0
  360. package/dist/utils/validators.d.ts +49 -0
  361. package/dist/utils/validators.js +37 -0
  362. package/dist/utils/validators.js.map +1 -0
  363. package/dist/vanilla.d.ts +27 -0
  364. package/dist/vanilla.js +27 -0
  365. package/package.json +5 -5
@@ -0,0 +1,146 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useIsSSR } from '@react-aria/ssr';
3
+ import { createContext, forwardRef, useState, useMemo, useCallback, useEffect } from 'react';
4
+ import { DEFAULT_SLOT, Provider, Modal, Dialog as Dialog$1, ModalOverlay } from 'react-aria-components';
5
+ import { useContextProps } from '../../hooks/use-context-props/use-context-props.js';
6
+ import { useDefaultProps } from '../../hooks/use-defaults/use-defaults.js';
7
+ import { inlineVars } from '../../utils/css.js';
8
+ import { mergeClassNames, callRenderProps } from '../../utils/props.js';
9
+ import { useSlot } from '../../hooks/use-slot/use-slot.js';
10
+ import { useTheme } from '../../hooks/use-theme/use-theme.js';
11
+ import { headings } from '../../styles/typography.vanilla.js';
12
+ import { AriaHeadingContext } from '../aria/aria.js';
13
+ import { ButtonContext } from '../button/button.js';
14
+ import { ElementContext } from '../element/element.js';
15
+ import { GroupContext } from '../group/group.js';
16
+ import { dialogClassNames, dialogStateVars } from './dialog.vanilla.js';
17
+
18
+ const dialogSizes = ["sm", "lg"];
19
+ const defaultMapping = {
20
+ heading: {
21
+ sm: { className: headings.v4 },
22
+ lg: { className: headings.v2 }
23
+ },
24
+ actions: {
25
+ context: ButtonContext,
26
+ orientation: "horizontal",
27
+ reverse: true
28
+ },
29
+ primary: dialogSizes.reduce((acc, size) => {
30
+ acc[size] = { size };
31
+ return acc;
32
+ }, {}),
33
+ secondary: dialogSizes.reduce((acc, size) => {
34
+ acc[size] = { size, variant: "bare" };
35
+ return acc;
36
+ }, {})
37
+ };
38
+ const DialogContext = createContext(null);
39
+ const Dialog = forwardRef(function Dialog2(props, ref) {
40
+ [props, ref] = useContextProps(props, ref, DialogContext);
41
+ props = useDefaultProps(props, "Dialog");
42
+ const { children: childrenProp, classNames: classNamesProp, mapping: mappingProp, parentRef, role, size = "lg", ...rest } = props;
43
+ const theme = useTheme();
44
+ const isSSR = useIsSSR();
45
+ const [portal, setPortal] = useState(isSSR ? null : document.body);
46
+ const isGlobal = useMemo(() => !isSSR && portal === document.body, [isSSR, portal]);
47
+ const mapping = useMemo(() => ({ ...defaultMapping, ...mappingProp }), [mappingProp]);
48
+ const classNames = useMemo(() => mergeClassNames(dialogClassNames, theme.Dialog, classNamesProp, {
49
+ container: isGlobal ? theme.className : void 0
50
+ }), [theme.Dialog, classNamesProp, isGlobal, theme.className]);
51
+ const [headerRef, hasHeader] = useSlot();
52
+ const style = useCallback(({ state, ...renderProps }) => ({
53
+ ...isGlobal ? theme.style : {},
54
+ ...inlineVars(dialogStateVars, {
55
+ hasHeader,
56
+ size,
57
+ ...renderProps,
58
+ isGlobal
59
+ })
60
+ }), [size, theme.style, isGlobal, hasHeader]);
61
+ const values = useMemo(() => [
62
+ [
63
+ ElementContext,
64
+ {
65
+ slots: {
66
+ [DEFAULT_SLOT]: {},
67
+ header: {
68
+ as: "header",
69
+ className: classNames?.header,
70
+ ref: headerRef,
71
+ values: [
72
+ [
73
+ AriaHeadingContext,
74
+ {
75
+ ...mapping.heading[size],
76
+ slot: "title"
77
+ }
78
+ ],
79
+ [GroupContext, null]
80
+ ]
81
+ },
82
+ content: { className: classNames?.content },
83
+ footer: {
84
+ as: "footer",
85
+ className: classNames?.footer,
86
+ values: [
87
+ [AriaHeadingContext, null],
88
+ [
89
+ GroupContext,
90
+ {
91
+ values: {
92
+ slots: {
93
+ [DEFAULT_SLOT]: mapping.primary[size] ?? {},
94
+ secondary: mapping.secondary[size] ?? {}
95
+ }
96
+ },
97
+ ...mapping.actions
98
+ }
99
+ ]
100
+ ]
101
+ }
102
+ }
103
+ }
104
+ ]
105
+ ], [
106
+ classNames?.header,
107
+ classNames?.content,
108
+ classNames?.footer,
109
+ headerRef,
110
+ mapping.actions,
111
+ mapping.heading,
112
+ mapping.primary,
113
+ mapping.secondary,
114
+ size
115
+ ]);
116
+ const children = useCallback((renderProps) => jsx(Provider, { values, children: jsx(Modal, { className: classNames?.modal, children: jsx(Dialog$1, { className: classNames?.dialog, role, children: callRenderProps(childrenProp, {
117
+ ...renderProps,
118
+ isGlobal,
119
+ isOpen: renderProps.state.isOpen
120
+ }) }) }) }), [
121
+ values,
122
+ classNames?.modal,
123
+ classNames?.dialog,
124
+ role,
125
+ childrenProp,
126
+ isGlobal
127
+ ]);
128
+ useEffect(() => {
129
+ const node = parentRef?.current;
130
+ const port = isSSR ? null : document.createElement("div");
131
+ if (node && port) {
132
+ port.classList.add(classNames?.portal ?? "");
133
+ node.appendChild(port);
134
+ setPortal(port);
135
+ }
136
+ return () => {
137
+ port?.remove();
138
+ setPortal(isSSR ? null : document.body);
139
+ };
140
+ }, [isSSR, parentRef, classNames?.portal]);
141
+ if (!portal)
142
+ return null;
143
+ return jsx(ModalOverlay, { ...rest, ref, className: classNames?.container, style, UNSTABLE_portalContainer: portal, children });
144
+ });
145
+
146
+ export { Dialog, DialogContext };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["import { useIsSSR } from '@react-aria/ssr';\nimport {\n createContext,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useState,\n type ForwardedRef,\n type HTMLAttributes,\n} from 'react';\nimport {\n DEFAULT_SLOT,\n Modal,\n ModalOverlay,\n Provider,\n Dialog as RACDialog,\n type ContextValue,\n type ModalRenderProps,\n} from 'react-aria-components';\nimport {\n useContextProps,\n useDefaultProps,\n useSlot,\n useTheme,\n} from '../../hooks';\nimport { headings } from '../../styles';\nimport type { OmitProtectedProps } from '../../types';\nimport { callRenderProps, inlineVars, mergeClassNames } from '../../utils';\nimport { AriaHeadingContext } from '../aria';\nimport { ButtonContext, type ButtonProps } from '../button';\nimport { ElementContext, type ElementProps } from '../element';\nimport { GroupContext, type GroupProps } from '../group';\nimport { dialogClassNames, dialogStateVars } from './dialog.css';\nimport type { DialogMapping, DialogProps, DialogSizes } from './types';\n\nconst dialogSizes: DialogSizes[] = ['sm', 'lg'];\n\nconst defaultMapping: DialogMapping = {\n heading: {\n sm: { className: headings.v4 },\n lg: { className: headings.v2 },\n },\n actions: {\n context: ButtonContext,\n orientation: 'horizontal',\n reverse: true,\n },\n primary: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n secondary: dialogSizes.reduce(\n (acc, size) => {\n acc[size] = { size, variant: 'bare' };\n\n return acc;\n },\n {} as Record<DialogSizes, OmitProtectedProps<ButtonProps>>,\n ),\n};\n\nexport const DialogContext =\n createContext<ContextValue<DialogProps, HTMLDivElement>>(null);\n\nexport const Dialog = forwardRef(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, DialogContext);\n props = useDefaultProps(props, 'Dialog');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n parentRef,\n role,\n size = 'lg',\n ...rest\n } = props;\n\n const theme = useTheme();\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n\n const isGlobal = useMemo(\n () => !isSSR && portal === document.body,\n [isSSR, portal],\n );\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(dialogClassNames, theme.Dialog, classNamesProp, {\n container: isGlobal ? theme.className : undefined,\n }),\n [theme.Dialog, classNamesProp, isGlobal, theme.className],\n );\n\n const [headerRef, hasHeader] = useSlot();\n\n const style = useCallback(\n ({ state, ...renderProps }: ModalRenderProps) => ({\n ...(isGlobal ? theme.style : {}),\n ...inlineVars(dialogStateVars, {\n hasHeader,\n size,\n ...renderProps,\n isGlobal,\n }),\n }),\n [size, theme.style, isGlobal, hasHeader],\n );\n\n const values = useMemo<\n [\n [\n typeof ElementContext,\n ContextValue<\n ElementProps<\n ContextValue<HTMLAttributes<HTMLElement>, HTMLHeadingElement>,\n ContextValue<\n GroupProps<ButtonProps, HTMLButtonElement>,\n HTMLDivElement\n >\n >,\n HTMLElement\n >,\n ],\n ]\n >(\n () => [\n [\n ElementContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n header: {\n as: 'header',\n className: classNames?.header,\n ref: headerRef,\n values: [\n [\n AriaHeadingContext,\n {\n ...mapping.heading[size],\n slot: 'title',\n },\n ],\n [GroupContext, null],\n ],\n },\n content: { className: classNames?.content },\n footer: {\n as: 'footer',\n className: classNames?.footer,\n values: [\n [AriaHeadingContext, null],\n [\n GroupContext,\n {\n values: {\n slots: {\n [DEFAULT_SLOT]: mapping.primary[size] ?? {},\n secondary: mapping.secondary[size] ?? {},\n },\n },\n ...mapping.actions,\n },\n ],\n ],\n },\n },\n },\n ],\n ],\n [\n classNames?.header,\n classNames?.content,\n classNames?.footer,\n headerRef,\n mapping.actions,\n mapping.heading,\n mapping.primary,\n mapping.secondary,\n size,\n ],\n );\n\n const children = useCallback(\n (renderProps: ModalRenderProps) => (\n <Provider values={values}>\n <Modal className={classNames?.modal}>\n <RACDialog className={classNames?.dialog} role={role}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n isGlobal,\n isOpen: renderProps.state.isOpen,\n })}\n </RACDialog>\n </Modal>\n </Provider>\n ),\n [\n values,\n classNames?.modal,\n classNames?.dialog,\n role,\n childrenProp,\n isGlobal,\n ],\n );\n\n useEffect(() => {\n const node = parentRef?.current;\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\n port.classList.add(classNames?.portal ?? '');\n\n node.appendChild(port);\n\n setPortal(port);\n }\n\n return () => {\n port?.remove();\n\n setPortal(isSSR ? null : document.body);\n };\n }, [isSSR, parentRef, classNames?.portal]);\n\n if (!portal) return null;\n\n return (\n <ModalOverlay\n {...rest}\n ref={ref}\n className={classNames?.container}\n style={style}\n UNSTABLE_portalContainer={portal}\n >\n {children}\n </ModalOverlay>\n );\n});\n"],"names":["Dialog","RACDialog"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,WAAA,GAA6B,CAAC,IAAA,EAAM,IAAI,CAAA,CAAA;AAE9C,MAAM,cAAgC,GAAA;AAAA,EACpC,OAAS,EAAA;AAAA,IACP,EAAI,EAAA,EAAE,SAAW,EAAA,QAAA,CAAS,EAAG,EAAA;AAAA,IAC7B,EAAI,EAAA,EAAE,SAAW,EAAA,QAAA,CAAS,EAAG,EAAA;AAAA,GAC/B;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,aAAA;AAAA,IACT,WAAa,EAAA,YAAA;AAAA,IACb,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EACA,SAAS,WAAY,CAAA,MAAA;AAAA,IACnB,CAAC,KAAK,IAAS,KAAA;AACb,MAAI,GAAA,CAAA,IAAI,CAAI,GAAA,EAAE,IAAK,EAAA,CAAA;AAEnB,MAAO,OAAA,GAAA,CAAA;AAAA,KACT;AAAA,IACA,EAAC;AAAA,GACH;AAAA,EACA,WAAW,WAAY,CAAA,MAAA;AAAA,IACrB,CAAC,KAAK,IAAS,KAAA;AACb,MAAA,GAAA,CAAI,IAAI,CAAA,GAAI,EAAE,IAAA,EAAM,SAAS,MAAO,EAAA,CAAA;AAEpC,MAAO,OAAA,GAAA,CAAA;AAAA,KACT;AAAA,IACA,EAAC;AAAA,GACH;AACF,CAAA,CAAA;AAEa,MAAA,aAAA,GACX,cAAyD,IAAI,EAAA;AAExD,MAAM,MAAS,GAAA,UAAA,CAAW,SAASA,OAAAA,CACxC,OACA,G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CAAA;AACxB,IAAA,MAAM,IAAO,GAAA,KAAA,GAAQ,IAAO,GAAA,QAAA,CAAS,cAAc,KAAK,CAAA,CAAA;AAExD,IAAA,IAAI,QAAQ,IAAM,EAAA;AAChB,MAAA,IAAA,CAAK,SAAU,CAAA,GAAA,CAAI,UAAY,EAAA,MAAA,IAAU,EAAE,CAAA,CAAA;AAE3C,MAAA,IAAA,CAAK,YAAY,IAAI,CAAA,CAAA;AAErB,MAAA,SAAA,CAAU,IAAI,CAAA,CAAA;AAAA,KAChB;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,EAAM,MAAO,EAAA,CAAA;AAEb,MAAU,SAAA,CAAA,KAAA,GAAQ,IAAO,GAAA,QAAA,CAAS,IAAI,CAAA,CAAA;AAAA,KACxC,CAAA;AAAA,KACC,CAAC,KAAA,EAAO,SAAW,EAAA,UAAA,EAAY,MAAM,CAAC,CAAA,CAAA;AAEzC,EAAI,IAAA,CAAC,QAAe,OAAA,IAAA,CAAA;AAEpB,EACE,uBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,WAAW,UAAY,EAAA,SAAA;AAAA,MACvB,KAAA;AAAA,MACA,wBAA0B,EAAA,MAAA;AAAA,MAEzB,QAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ,CAAC;;;;"}
@@ -0,0 +1,8 @@
1
+
2
+ var dialogClassNames = { portal: "dialog_dialogClassNames_portal__8ms59zi", container: "dialog_dialogClassNames_container__8ms59zj", modal: "dialog_dialogClassNames_modal__8ms59zk", dialog: "dialog_dialogClassNames_dialog__8ms59zl surfaces_proud__15mw6jf3 surfaces_flush__15mw6jf2", header: "dialog_header__8ms59zg", content: "dialog_content__8ms59zh", footer: "dialog_dialogClassNames_footer__8ms59zm" };
3
+ var dialogColorVars = { overlay: "var(--overlay__8ms59z1)", content: { color: "var(--content-color__8ms59z2)" } };
4
+ var dialogContainer = "dialog_dialogContainer__8ms59z0";
5
+ var dialogSpaceVars = { width: "var(--width__8ms59z3)", x: "var(--x__8ms59z4)", y: "var(--y__8ms59z5)", gap: { "default": "var(--gap-default__8ms59z6)", header: { after: "var(--gap-header-after__8ms59z7)" }, content: { before: "var(--gap-content-before__8ms59z8)" }, footer: { before: "var(--gap-footer-before__8ms59z9)" } } };
6
+ var dialogStateVars = { hasHeader: "var(--hasHeader__8ms59za)", size: "var(--size__8ms59zb)", isEntering: "var(--isEntering__8ms59zc)", isExiting: "var(--isExiting__8ms59zd)", isGlobal: "var(--isGlobal__8ms59ze)", isOpen: "var(--isOpen__8ms59zf)" };
7
+
8
+ export { dialogClassNames, dialogColorVars, dialogContainer, dialogSpaceVars, dialogStateVars };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ export { Dialog, DialogContext } from './dialog';
2
+ export { dialogClassNames, dialogColorVars, dialogContainer, dialogSpaceVars, dialogStateVars, } from './dialog.css';
3
+ export { type DialogClassNames, type DialogMapping, type DialogProps, type DialogRenderProps, type DialogSizes, type DialogState, } from './types';
@@ -0,0 +1,48 @@
1
+ import type { RefObject } from 'react';
2
+ import type { HeadingProps, ModalOverlayProps, ModalRenderProps, DialogProps as RACDialogProps } from 'react-aria-components';
3
+ import type { OmitProtectedProps, RenderPropsChildren } from '../../types';
4
+ import type { ButtonProps } from '../button/types';
5
+ import type { GroupProps } from '../group/types';
6
+ export type DialogClassNames = Partial<{
7
+ portal: string;
8
+ container: string;
9
+ modal: string;
10
+ dialog: string;
11
+ header: string;
12
+ content: string;
13
+ footer: string;
14
+ }>;
15
+ export type DialogSizes = 'sm' | 'lg';
16
+ export type DialogMapping = {
17
+ heading: Partial<Record<DialogSizes, HeadingProps>>;
18
+ actions: GroupProps<ButtonProps, HTMLButtonElement>;
19
+ primary: Partial<Record<DialogSizes, OmitProtectedProps<ButtonProps>>>;
20
+ secondary: Partial<Record<DialogSizes, OmitProtectedProps<ButtonProps>>>;
21
+ };
22
+ export type DialogRenderProps = ModalRenderProps & {
23
+ /**
24
+ * If the dialog is relative to the viewport (vs a specified parent element)
25
+ */
26
+ isGlobal: boolean;
27
+ /**
28
+ * If the dialog is visible
29
+ */
30
+ isOpen: boolean;
31
+ };
32
+ type BaseDialogProps = Pick<RACDialogProps, 'role'> & {
33
+ children?: RenderPropsChildren<DialogRenderProps>;
34
+ classNames?: DialogClassNames;
35
+ mapping?: Partial<DialogMapping>;
36
+ /**
37
+ * Optionally provide a ref to a parent container that the dialog will be portaled into
38
+ * This will make it so the Dialog is not global in the DOM and will visually center it
39
+ * to the parent's area instead of the whole viewport
40
+ */
41
+ parentRef?: RefObject<HTMLElement>;
42
+ size?: DialogSizes;
43
+ };
44
+ export type DialogState = Omit<DialogRenderProps, 'state'> & Required<Pick<BaseDialogProps, 'size'>> & {
45
+ hasHeader: boolean;
46
+ };
47
+ export type DialogProps = Omit<ModalOverlayProps, 'children' | 'className' | 'style'> & BaseDialogProps;
48
+ export {};
@@ -0,0 +1,33 @@
1
+ import type { DrawerClassNames } from './types';
2
+ export declare const drawerContainer: string;
3
+ export declare const drawerAnimationVars: {
4
+ delay: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
5
+ duration: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
6
+ easing: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
7
+ };
8
+ export declare const drawerColorVars: {
9
+ background: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
10
+ color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
11
+ };
12
+ export declare const drawerSpaceVars: {
13
+ drawer: {
14
+ width: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
15
+ gap: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
16
+ x: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
17
+ y: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
18
+ };
19
+ list: {
20
+ top: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
21
+ translateY: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
22
+ };
23
+ };
24
+ export declare const drawerStateVars: {
25
+ anchor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
26
+ layoutShift: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
27
+ isChild: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
28
+ isOpen: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
29
+ };
30
+ export declare const drawerDialogStateVars: {
31
+ isChild: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
32
+ };
33
+ export declare const drawerClassNames: DrawerClassNames;
@@ -0,0 +1,13 @@
1
+ import { type ContextValue } from 'react-aria-components';
2
+ import type { DrawerDialogProps, DrawerMapping, DrawerProps, DrawerTabListProps, DrawerTabProps } from './types';
3
+ export declare function Drawer(props: DrawerProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function DrawerTabList<T extends object>(props: DrawerTabListProps<T>): import("react/jsx-runtime").JSX.Element;
5
+ export declare function DrawerTab(props: DrawerTabProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare const DrawerDialogContext: import("react").Context<ContextValue<DrawerDialogProps, HTMLDivElement>>;
7
+ export declare const DrawerDialog: (props: import("@react-types/shared").AriaLabelingProps & {
8
+ classNames?: import("./types").DrawerClassNames;
9
+ } & {
10
+ mapping?: DrawerMapping;
11
+ } & {
12
+ children?: import("react").ReactNode | undefined;
13
+ } & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement | null;
@@ -0,0 +1,199 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { toBoolean } from '@accelint/converters';
3
+ import { useIsSSR } from '@react-aria/ssr';
4
+ import { noop } from 'lodash';
5
+ import { createContext, forwardRef, useContext, useMemo, useCallback, useRef } from 'react';
6
+ import { useOverlay, useFocusWithin } from 'react-aria';
7
+ import { DEFAULT_SLOT, Provider } from 'react-aria-components';
8
+ import { useOverlayTriggerState } from 'react-stately';
9
+ import { useContextProps } from '../../hooks/use-context-props/use-context-props.js';
10
+ import { useDefaultProps } from '../../hooks/use-defaults/use-defaults.js';
11
+ import { inlineVars } from '../../utils/css.js';
12
+ import { mergeClassNames, callRenderProps, mergeProps } from '../../utils/props.js';
13
+ import { useSlot } from '../../hooks/use-slot/use-slot.js';
14
+ import { useTheme } from '../../hooks/use-theme/use-theme.js';
15
+ import { headings } from '../../styles/typography.vanilla.js';
16
+ import { AriaHeadingContext } from '../aria/aria.js';
17
+ import { ButtonContext } from '../button/button.js';
18
+ import { ElementContext } from '../element/element.js';
19
+ import { Tabs, TabList, Tab } from '../tabs/tabs.js';
20
+ import { TooltipContext, TooltipTargetContext } from '../tooltip/tooltip.js';
21
+ import { drawerClassNames, drawerStateVars, drawerDialogStateVars } from './drawer.vanilla.js';
22
+
23
+ const DrawerContext = createContext({
24
+ anchor: "right",
25
+ layoutShift: false,
26
+ isOpen: false,
27
+ close: noop,
28
+ open: noop,
29
+ setOpen: noop,
30
+ toggle: noop
31
+ });
32
+ function Drawer(props) {
33
+ props = useDefaultProps(props, "Drawer");
34
+ const { children: childrenProp, classNames: classNamesProp, anchor = "right", defaultOpen = false, layoutShift = false, shouldCloseOnBlur = false, isDismissable = true, isKeyboardDismissDisabled = false, isOpen: isOpenProp, onOpenChange } = props;
35
+ const theme = useTheme();
36
+ const isSSR = useIsSSR();
37
+ const classNames = useMemo(() => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp), [theme.Drawer, classNamesProp]);
38
+ const handleOpenChange = useCallback((isOpen2) => {
39
+ if (!isOpen2) {
40
+ const focused = isSSR ? null : document.activeElement;
41
+ if (focused && "blur" in focused && typeof focused.blur === "function") {
42
+ focused.blur();
43
+ }
44
+ }
45
+ onOpenChange?.(isOpen2);
46
+ }, [isSSR, onOpenChange]);
47
+ const state = useOverlayTriggerState({
48
+ defaultOpen,
49
+ isOpen: isOpenProp,
50
+ onOpenChange: handleOpenChange
51
+ });
52
+ const { isOpen, close, open } = state;
53
+ const ref = useRef(null);
54
+ const { overlayProps } = useOverlay({
55
+ isOpen,
56
+ shouldCloseOnBlur,
57
+ isDismissable,
58
+ isKeyboardDismissDisabled,
59
+ onClose: close
60
+ }, ref);
61
+ const { focusWithinProps } = useFocusWithin({
62
+ onFocusWithin: open
63
+ });
64
+ const context = useMemo(() => ({ ...state, anchor, layoutShift }), [state, anchor, layoutShift]);
65
+ const values = useMemo(() => [
66
+ [DrawerContext, context],
67
+ [DrawerDialogContext, { classNames }]
68
+ ], [context, classNames]);
69
+ const style = useMemo(() => inlineVars(drawerStateVars, {
70
+ anchor,
71
+ layoutShift,
72
+ isOpen
73
+ }), [anchor, layoutShift, isOpen]);
74
+ const children = useMemo(() => callRenderProps(childrenProp, state), [childrenProp, state]);
75
+ return jsx(Provider, { values, children: jsx("div", { ...mergeProps(overlayProps, focusWithinProps), ref, className: classNames?.container, style, children: jsx(Tabs, { classNames: classNames?.tabs, children }) }) });
76
+ }
77
+ function DrawerTabList(props) {
78
+ props = useDefaultProps(props, "DrawerTabList");
79
+ const { children, classNames: classNamesProp, variant = "fill" } = props;
80
+ const { anchor } = useContext(DrawerContext);
81
+ const theme = useTheme();
82
+ const classNames = useMemo(() => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp), [theme.Drawer, classNamesProp]);
83
+ const values = useMemo(() => [
84
+ [TooltipContext, { placement: anchor === "left" ? "right" : "left" }],
85
+ [TooltipTargetContext, { focusable: false, relative: "parent" }]
86
+ ], [anchor]);
87
+ return jsx(Provider, { values, children: jsx(TabList, { classNames: classNames?.tabs, align: "center", anchor: anchor === "left" ? "start" : "end", orientation: "vertical", variant, children }) });
88
+ }
89
+ function DrawerTab(props) {
90
+ props = useDefaultProps(props, "DrawerTab");
91
+ const { children: childrenProp, classNames: classNamesProp, ...rest } = props;
92
+ const { isOpen, open, toggle } = useContext(DrawerContext);
93
+ const theme = useTheme();
94
+ const classNames = useMemo(() => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp), [theme.Drawer, classNamesProp]);
95
+ const handlePressStart = useCallback((event) => {
96
+ const { selected } = event.target.parentElement?.dataset ?? {};
97
+ if (toBoolean(selected)) {
98
+ toggle();
99
+ } else {
100
+ open();
101
+ }
102
+ }, [open, toggle]);
103
+ const children = useCallback((renderProps) => callRenderProps(childrenProp, { ...renderProps, isOpen }), [childrenProp, isOpen]);
104
+ return jsx(Tab, { ...rest, classNames: classNames?.tabs, onPressStart: handlePressStart, children });
105
+ }
106
+ const defaultMapping = {
107
+ heading: {
108
+ child: headings.v4,
109
+ parent: headings.v3
110
+ },
111
+ back: {
112
+ variant: "icon"
113
+ },
114
+ close: {
115
+ variant: "icon"
116
+ }
117
+ };
118
+ const DrawerDialogContext = createContext(null);
119
+ const DrawerDialog = forwardRef(function DrawerDialog2(props, ref) {
120
+ [props, ref] = useContextProps(props, ref, DrawerDialogContext);
121
+ const { children, classNames: classNamesProp, mapping: mappingProp, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...rest } = props;
122
+ const { close } = useContext(DrawerContext);
123
+ const [backRef, hasBack] = useSlot();
124
+ const [titleRef, hasTitle] = useSlot();
125
+ const theme = useTheme();
126
+ const mapping = useMemo(() => ({ ...defaultMapping, ...mappingProp }), [mappingProp]);
127
+ const classNames = useMemo(() => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp, {
128
+ header: {
129
+ title: hasBack ? mapping.heading.child : mapping.heading.parent
130
+ }
131
+ }), [theme.Drawer, classNamesProp, hasBack, mapping]);
132
+ const style = useMemo(() => inlineVars(drawerDialogStateVars, {
133
+ isChild: !!hasBack
134
+ }), [hasBack]);
135
+ const values = useMemo(() => [
136
+ [
137
+ ElementContext,
138
+ {
139
+ slots: {
140
+ [DEFAULT_SLOT]: {},
141
+ header: {
142
+ as: "header",
143
+ className: classNames?.header?.header,
144
+ values: [
145
+ [
146
+ ButtonContext,
147
+ {
148
+ slots: {
149
+ [DEFAULT_SLOT]: {},
150
+ back: {
151
+ ...mapping.back,
152
+ ref: backRef,
153
+ classNames: classNames?.header?.back
154
+ },
155
+ close: {
156
+ ...mapping.close,
157
+ classNames: classNames?.header?.close,
158
+ onPress: close
159
+ }
160
+ }
161
+ }
162
+ ],
163
+ [
164
+ AriaHeadingContext,
165
+ {
166
+ slots: {
167
+ title: {
168
+ ref: titleRef,
169
+ className: classNames?.header?.title
170
+ }
171
+ }
172
+ }
173
+ ]
174
+ ]
175
+ },
176
+ content: { className: classNames?.content },
177
+ footer: { as: "footer", className: classNames?.footer }
178
+ }
179
+ }
180
+ ]
181
+ ], [
182
+ classNames?.header?.header,
183
+ classNames?.header?.back,
184
+ classNames?.header?.close,
185
+ classNames?.header?.title,
186
+ classNames?.content,
187
+ classNames?.footer,
188
+ backRef,
189
+ close,
190
+ mapping,
191
+ titleRef
192
+ ]);
193
+ if (!ariaLabel && !ariaLabelledBy && !hasTitle) {
194
+ console.warn('If a Drawer does not contain a <Heading slot="title">, it must have an aria-label or aria-labelledby attribute for accessibility.');
195
+ }
196
+ return jsx(Provider, { values, children: jsx("div", { ...rest, className: classNames?.dialog?.container, style, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children: jsx("div", { className: classNames?.dialog?.dialog, children }) }) });
197
+ });
198
+
199
+ export { Drawer, DrawerDialog, DrawerDialogContext, DrawerTab, DrawerTabList };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.js","sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["import { toBoolean } from '@accelint/converters';\nimport { useIsSSR } from '@react-aria/ssr';\nimport { noop } from 'lodash';\nimport {\n type ForwardedRef,\n type HTMLAttributes,\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n useRef,\n} from 'react';\nimport { useFocusWithin, useOverlay, type PressEvent } from 'react-aria';\nimport {\n DEFAULT_SLOT,\n Provider,\n type ContextValue,\n} from 'react-aria-components';\nimport { useOverlayTriggerState } from 'react-stately';\nimport {\n useContextProps,\n useDefaultProps,\n useSlot,\n useTheme,\n} from '../../hooks';\nimport { headings } from '../../styles';\nimport {\n callRenderProps,\n inlineVars,\n mergeClassNames,\n mergeProps,\n} from '../../utils';\nimport { AriaHeadingContext } from '../aria';\nimport { ButtonContext, type ButtonProps } from '../button';\nimport { ElementContext, type ElementProps } from '../element';\nimport { Tab, TabList, Tabs, type TabRenderProps } from '../tabs';\nimport {\n TooltipContext,\n TooltipTargetContext,\n type TooltipProps,\n type TooltipTargetProps,\n} from '../tooltip';\nimport {\n drawerClassNames,\n drawerDialogStateVars,\n drawerStateVars,\n} from './drawer.css';\nimport type {\n DrawerContextValue,\n DrawerDialogProps,\n DrawerMapping,\n DrawerProps,\n DrawerTabListProps,\n DrawerTabProps,\n} from './types';\n\nconst DrawerContext = createContext<DrawerContextValue>({\n anchor: 'right',\n layoutShift: false,\n isOpen: false,\n close: noop,\n open: noop,\n setOpen: noop,\n toggle: noop,\n});\n\nexport function Drawer(props: DrawerProps) {\n props = useDefaultProps(props, 'Drawer');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n anchor = 'right',\n defaultOpen = false,\n layoutShift = false,\n shouldCloseOnBlur = false,\n isDismissable = true,\n isKeyboardDismissDisabled = false,\n isOpen: isOpenProp,\n onOpenChange,\n } = props;\n\n const theme = useTheme();\n const isSSR = useIsSSR();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n // Remove focus when Drawer closes\n const handleOpenChange = useCallback(\n (isOpen: boolean) => {\n if (!isOpen) {\n const focused = isSSR ? null : document.activeElement;\n\n if (\n focused &&\n 'blur' in focused &&\n typeof focused.blur === 'function'\n ) {\n focused.blur();\n }\n }\n\n onOpenChange?.(isOpen);\n },\n [isSSR, onOpenChange],\n );\n\n const state = useOverlayTriggerState({\n defaultOpen,\n isOpen: isOpenProp,\n onOpenChange: handleOpenChange,\n });\n\n const { isOpen, close, open } = state;\n const ref = useRef<HTMLDivElement>(null);\n\n const { overlayProps } = useOverlay(\n {\n isOpen,\n shouldCloseOnBlur,\n isDismissable,\n isKeyboardDismissDisabled,\n onClose: close,\n },\n ref,\n );\n\n // TODO: it may be desirable to disallow focus within the closed Drawer instead\n // If focus forces the Drawer open\n const { focusWithinProps } = useFocusWithin({\n onFocusWithin: open,\n });\n\n const context = useMemo(\n () => ({ ...state, anchor, layoutShift }),\n [state, anchor, layoutShift],\n );\n\n const values = useMemo<\n [\n [typeof DrawerContext, DrawerContextValue],\n [\n typeof DrawerDialogContext,\n ContextValue<DrawerDialogProps, HTMLDivElement>,\n ],\n ]\n >(\n () => [\n [DrawerContext, context],\n [DrawerDialogContext, { classNames }],\n ],\n [context, classNames],\n );\n\n const style = useMemo(\n () =>\n inlineVars(drawerStateVars, {\n anchor,\n layoutShift,\n isOpen,\n }),\n [anchor, layoutShift, isOpen],\n );\n\n const children = useMemo(\n () => callRenderProps(childrenProp, state),\n [childrenProp, state],\n );\n\n return (\n <Provider values={values}>\n <div\n {...mergeProps(overlayProps, focusWithinProps)}\n ref={ref}\n className={classNames?.container}\n style={style}\n >\n <Tabs classNames={classNames?.tabs}>{children}</Tabs>\n </div>\n </Provider>\n );\n}\n\nexport function DrawerTabList<T extends object>(props: DrawerTabListProps<T>) {\n props = useDefaultProps(props, 'DrawerTabList');\n\n const { children, classNames: classNamesProp, variant = 'fill' } = props;\n const { anchor } = useContext(DrawerContext);\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n const values = useMemo<\n [\n [typeof TooltipContext, ContextValue<TooltipProps, HTMLDivElement>],\n [\n typeof TooltipTargetContext,\n ContextValue<TooltipTargetProps, HTMLDivElement>,\n ],\n ]\n >(\n () => [\n [TooltipContext, { placement: anchor === 'left' ? 'right' : 'left' }],\n [TooltipTargetContext, { focusable: false, relative: 'parent' }],\n ],\n [anchor],\n );\n\n return (\n <Provider values={values}>\n <TabList<T>\n classNames={classNames?.tabs}\n align='center'\n anchor={anchor === 'left' ? 'start' : 'end'}\n orientation='vertical'\n variant={variant}\n >\n {children}\n </TabList>\n </Provider>\n );\n}\n\nexport function DrawerTab(props: DrawerTabProps) {\n props = useDefaultProps(props, 'DrawerTab');\n\n const { children: childrenProp, classNames: classNamesProp, ...rest } = props;\n const { isOpen, open, toggle } = useContext(DrawerContext);\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp),\n [theme.Drawer, classNamesProp],\n );\n\n // Must bind to press start (instead of later press events) due to Tab changing selected state on start\n const handlePressStart = useCallback(\n (event: PressEvent) => {\n const { selected } = event.target.parentElement?.dataset ?? {};\n\n if (toBoolean(selected)) {\n toggle();\n } else {\n open();\n }\n },\n [open, toggle],\n );\n\n const children = useCallback(\n (renderProps: TabRenderProps) =>\n callRenderProps(childrenProp, { ...renderProps, isOpen }),\n [childrenProp, isOpen],\n );\n\n return (\n <Tab\n {...rest}\n classNames={classNames?.tabs}\n onPressStart={handlePressStart}\n >\n {children}\n </Tab>\n );\n}\n\nconst defaultMapping: DrawerMapping = {\n heading: {\n child: headings.v4,\n parent: headings.v3,\n },\n back: {\n variant: 'icon',\n },\n close: {\n variant: 'icon',\n },\n};\n\nexport const DrawerDialogContext =\n createContext<ContextValue<DrawerDialogProps, HTMLDivElement>>(null);\n\nexport const DrawerDialog = forwardRef(function DrawerDialog(\n props: DrawerDialogProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, DrawerDialogContext);\n\n const {\n children,\n classNames: classNamesProp,\n mapping: mappingProp,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n } = props;\n\n const { close } = useContext(DrawerContext);\n const [backRef, hasBack] = useSlot();\n const [titleRef, hasTitle] = useSlot();\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({ ...defaultMapping, ...mappingProp }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(drawerClassNames, theme.Drawer, classNamesProp, {\n header: {\n title: hasBack ? mapping.heading.child : mapping.heading.parent,\n },\n }),\n [theme.Drawer, classNamesProp, hasBack, mapping],\n );\n\n const style = useMemo(\n () =>\n inlineVars(drawerDialogStateVars, {\n isChild: !!hasBack,\n }),\n [hasBack],\n );\n\n const values = useMemo<\n [\n [\n typeof ElementContext,\n ContextValue<\n ElementProps<\n ContextValue<ButtonProps, HTMLButtonElement>,\n ContextValue<HTMLAttributes<HTMLElement>, HTMLHeadingElement>\n >,\n HTMLElement\n >,\n ],\n ]\n >(\n () => [\n [\n ElementContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n header: {\n as: 'header',\n className: classNames?.header?.header,\n values: [\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n back: {\n ...mapping.back,\n ref: backRef,\n classNames: classNames?.header?.back,\n },\n close: {\n ...mapping.close,\n classNames: classNames?.header?.close,\n onPress: close,\n },\n },\n },\n ],\n [\n AriaHeadingContext,\n {\n slots: {\n title: {\n ref: titleRef,\n className: classNames?.header?.title,\n },\n },\n },\n ],\n ],\n },\n content: { className: classNames?.content },\n footer: { as: 'footer', className: classNames?.footer },\n },\n },\n ],\n ],\n [\n classNames?.header?.header,\n classNames?.header?.back,\n classNames?.header?.close,\n classNames?.header?.title,\n classNames?.content,\n classNames?.footer,\n backRef,\n close,\n mapping,\n titleRef,\n ],\n );\n\n // biome-ignore lint/complexity/useSimplifiedLogicExpression: intentional\n if (!ariaLabel && !ariaLabelledBy && !hasTitle) {\n console.warn(\n 'If a Drawer does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.',\n );\n }\n\n return (\n <Provider values={values}>\n <div\n {...rest}\n className={classNames?.dialog?.container}\n style={style}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n <div className={classNames?.dialog?.dialog}>{children}</div>\n </div>\n </Provider>\n );\n});\n"],"names":["isOpen","DrawerDialog"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAM,gBAAgB,aAAkC,CAAA;AAAA,EACtD,MAAQ,EAAA,OAAA;AAAA,EACR,WAAa,EAAA,KAAA;AAAA,EACb,MAAQ,EAAA,KAAA;AAAA,EACR,KAAO,EAAA,IAAA;AAAA,EACP,IAAM,EAAA,IAAA;AAAA,EACN,OAAS,EAAA,IAAA;AAAA,EACT,MAAQ,EAAA,IAAA;AACV,CAAC,CAAA,CAAA;AAEM,SAAS,OAAO,KAAoB,EAAA;AACzC,EAAQ,KAAA,GAAA,eAAA,CAAgB,OAAO,QAAQ,CAAA,CAAA;AAEvC,EAAM,MAAA;AAAA,IACJ,QAAU,EAAA,YAAA;AAAA,IACV,UAAY,EAAA,cAAA;AAAA,IACZ,MAAS,GAAA,OAAA;AAAA,IACT,WAAc,GAAA,KAAA;AAAA,IACd,WAAc,GAAA,KAAA;AAAA,IACd,iBAAoB,GAAA,KAAA;AAAA,IACpB,aAAgB,GAAA,IAAA;AAAA,IAChB,yBAA4B,GAAA,KAAA;AAAA,IAC5B,MAAQ,EAAA,UAAA;AAAA,IACR,YAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AACvB,EAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,EAAA,MAAM,UAAa,GAAA,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,gBAAkB,EAAA,KAAA,CAAM,QAAQ,cAAc,CAAA;AAAA,IACpE,CAAC,KAAM,CAAA,MAAA,EAAQ,cAAc,CAAA;AAAA,GAC/B,CAAA;AAGA,EAAA,MAAM,gBAAm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AY,MAAQ,EAAA,IAAA;AAAA,MACpB,YAAY,MAAQ,EAAA,KAAA;AAAA,MACpB,YAAY,MAAQ,EAAA,KAAA;AAAA,MACpB,UAAY,EAAA,OAAA;AAAA,MACZ,UAAY,EAAA,MAAA;AAAA,MACZ,OAAA;AAAA,MACA,KAAA;AAAA,MACA,OAAA;AAAA,MACA,QAAA;AAAA,KACF;AAAA,GACF,CAAA;AAGA,EAAA,IAAI,CAAC,SAAA,IAAa,CAAC,cAAA,IAAkB,CAAC,QAAU,EAAA;AAC9C,IAAQ,OAAA,CAAA,IAAA;AAAA,MACN,mIAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EACE,uBAAA,GAAA,CAAC,YAAS,MACR,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,SAAA,EAAW,YAAY,MAAQ,EAAA,SAAA;AAAA,MAC/B,KAAA;AAAA,MACA,YAAY,EAAA,SAAA;AAAA,MACZ,iBAAiB,EAAA,cAAA;AAAA,MAEjB,8BAAC,KAAI,EAAA,EAAA,SAAA,EAAW,UAAY,EAAA,MAAA,EAAQ,QAAS,QAAS,EAAA,CAAA;AAAA,KAAA;AAAA,GAE1D,EAAA,CAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -0,0 +1,10 @@
1
+
2
+ var drawerAnimationVars = { delay: "var(--delay__3hvldb1)", duration: "var(--duration__3hvldb2)", easing: "var(--easing__3hvldb3)" };
3
+ var drawerClassNames = { container: "drawer_drawerClassNames_container__3hvldbh", tabs: { tabs: "drawer_drawerClassNames_tabs_tabs__3hvldbi", list: { list: "drawer_drawerClassNames_tabs_list_list__3hvldbj surfaces_proud__15mw6jf1 surfaces_flush__15mw6jf0" } }, dialog: { container: "drawer_drawerClassNames_dialog_container__3hvldbk", dialog: "drawer_drawerClassNames_dialog_dialog__3hvldbl surfaces_proud__15mw6jf1 surfaces_flush__15mw6jf0" }, header: { header: "drawer_drawerClassNames_header_header__3hvldbm", back: { container: "drawer_drawerClassNames_header_back_container__3hvldbn" }, title: "drawer_drawerClassNames_header_title__3hvldbo", close: { container: "drawer_drawerClassNames_header_close_container__3hvldbp" } }, content: "drawer_drawerClassNames_content__3hvldbq", footer: "drawer_drawerClassNames_footer__3hvldbr" };
4
+ var drawerColorVars = { background: "var(--background__3hvldb4)", color: "var(--color__3hvldb5)" };
5
+ var drawerContainer = "drawer_drawerContainer__3hvldb0";
6
+ var drawerDialogStateVars = { isChild: "var(--isChild__3hvldbg)" };
7
+ var drawerSpaceVars = { drawer: { width: "var(--drawer-width__3hvldb6)", gap: "var(--drawer-gap__3hvldb7)", x: "var(--drawer-x__3hvldb8)", y: "var(--drawer-y__3hvldb9)" }, list: { top: "var(--list-top__3hvldba)", translateY: "var(--list-translateY__3hvldbb)" } };
8
+ var drawerStateVars = { anchor: "var(--anchor__3hvldbc)", layoutShift: "var(--layoutShift__3hvldbd)", isChild: "var(--isChild__3hvldbe)", isOpen: "var(--isOpen__3hvldbf)" };
9
+
10
+ export { drawerAnimationVars, drawerClassNames, drawerColorVars, drawerContainer, drawerDialogStateVars, drawerSpaceVars, drawerStateVars };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ export { Drawer, DrawerDialog, DrawerTab, DrawerTabList } from './drawer';
2
+ export { drawerAnimationVars, drawerClassNames, drawerColorVars, drawerContainer, drawerDialogStateVars, drawerSpaceVars, drawerStateVars, } from './drawer.css';
3
+ export { type DrawerAnchor, type DrawerClassNames, type DrawerDialogProps, type DrawerDialogState, type DrawerMapping, type DrawerProps, type DrawerRenderProps, type DrawerState, type DrawerTabListProps, type DrawerTabProps, type DrawerTabRenderProps, } from './types';
@@ -0,0 +1,71 @@
1
+ import type { AriaLabelingProps as RACLabelingProps } from '@react-types/shared';
2
+ import type { PropsWithChildren } from 'react';
3
+ import type { AriaOverlayProps as RACOverlayProps } from 'react-aria';
4
+ import type { OverlayTriggerProps, OverlayTriggerState } from 'react-stately';
5
+ import type { PartialDeep } from 'type-fest';
6
+ import type { OmitProtectedProps, RenderPropsChildren } from '../../types';
7
+ import type { ButtonClassNames, ButtonProps } from '../button/types';
8
+ import type { TabListProps, TabProps, TabRenderProps, TabsClassNames, TabsProps } from '../tabs/types';
9
+ export type DrawerClassNames = PartialDeep<{
10
+ container: string;
11
+ tabs: TabsClassNames;
12
+ dialog: {
13
+ container: string;
14
+ dialog: string;
15
+ };
16
+ header: {
17
+ header: string;
18
+ back: ButtonClassNames;
19
+ title: string;
20
+ close: ButtonClassNames;
21
+ };
22
+ content: string;
23
+ footer: string;
24
+ }>;
25
+ export type DrawerAnchor = 'left' | 'right';
26
+ export type DrawerMapping = {
27
+ heading: {
28
+ child: string;
29
+ parent: string;
30
+ };
31
+ back: Partial<OmitProtectedProps<ButtonProps>>;
32
+ close: Partial<OmitProtectedProps<ButtonProps>>;
33
+ };
34
+ export type DrawerRenderProps = OverlayTriggerState;
35
+ export type DrawerTabRenderProps = TabRenderProps & {
36
+ isOpen: boolean;
37
+ };
38
+ type BaseProps = {
39
+ classNames?: DrawerClassNames;
40
+ };
41
+ export type BaseDrawerProps = Pick<RACOverlayProps, 'shouldCloseOnBlur' | 'isDismissable' | 'isKeyboardDismissDisabled'> & {
42
+ children?: RenderPropsChildren<DrawerRenderProps>;
43
+ /**
44
+ * Which side of the viewport to originate from
45
+ */
46
+ anchor?: DrawerAnchor;
47
+ /**
48
+ * If true will push sibling DOM around, else act as an independent overlay
49
+ *
50
+ * NOTE: Layout shift animations are less performant
51
+ */
52
+ layoutShift?: boolean;
53
+ };
54
+ export type BaseDrawerTabProps = {
55
+ children?: RenderPropsChildren<DrawerTabRenderProps>;
56
+ };
57
+ export type DrawerState = Pick<DrawerRenderProps, 'isOpen'> & Required<Pick<BaseDrawerProps, 'anchor' | 'layoutShift'>>;
58
+ export type DrawerDialogState = {
59
+ /**
60
+ * If back button is present
61
+ */
62
+ isChild: boolean;
63
+ };
64
+ export type DrawerContextValue = DrawerRenderProps & Required<Pick<BaseDrawerProps, 'anchor' | 'layoutShift'>>;
65
+ export type DrawerProps = OverlayTriggerProps & Omit<TabsProps, 'children' | 'classNames' | 'orientation'> & BaseProps & BaseDrawerProps;
66
+ export type DrawerTabListProps<T> = Omit<TabListProps<T>, 'classNames' | 'align' | 'anchor' | 'orientation'> & BaseProps;
67
+ export type DrawerTabProps = Omit<TabProps, 'children'> & BaseDrawerTabProps & BaseProps;
68
+ export type DrawerDialogProps = PropsWithChildren<RACLabelingProps & BaseProps & {
69
+ mapping?: DrawerMapping;
70
+ }>;
71
+ export {};
@@ -0,0 +1,11 @@
1
+ import { type ContextValue } from 'react-aria-components';
2
+ import type { ElementProps } from './types';
3
+ export declare const ElementContext: import("react").Context<ContextValue<ElementProps<any, any, any, any, any, any, any, any, any, any, any>, HTMLElement>>;
4
+ /**
5
+ * This generic component serves as any easy way for more complex components
6
+ * to establish stylable content areas within their layout with optional
7
+ * targetted contexts for any subcomponents
8
+ *
9
+ * See Dialog & Drawer as examples
10
+ */
11
+ export declare const Element: <A, B, C, D, E, F, G, H, I, J, K>(props: ElementProps<A, B, C, D, E, F, G, H, I, J, K> & import("react").RefAttributes<HTMLElement>) => import("react").ReactElement | null;