@cascivo/react 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (646) hide show
  1. package/README.md +5 -4
  2. package/dist/accordion/accordion.js +1 -114
  3. package/dist/accordion/accordion.module.js +1 -10
  4. package/dist/action-sheet/action-sheet.css +1 -1
  5. package/dist/action-sheet/action-sheet.js +1 -91
  6. package/dist/action-sheet/action-sheet.module.js +1 -12
  7. package/dist/alert/alert.js +1 -55
  8. package/dist/alert/alert.module.js +1 -11
  9. package/dist/alert-dialog/alert-dialog.css +1 -1
  10. package/dist/alert-dialog/alert-dialog.js +1 -66
  11. package/dist/alert-dialog/alert-dialog.module.js +1 -11
  12. package/dist/app-shell/app-shell.css +1 -1
  13. package/dist/app-shell/app-shell.js +1 -85
  14. package/dist/app-shell/app-shell.module.js +1 -12
  15. package/dist/aspect-ratio/aspect-ratio.js +1 -20
  16. package/dist/aspect-ratio/aspect-ratio.module.js +1 -6
  17. package/dist/avatar/avatar.js +1 -57
  18. package/dist/avatar/avatar.module.js +1 -8
  19. package/dist/avatar-group/avatar-group.js +1 -24
  20. package/dist/avatar-group/avatar-group.module.js +1 -6
  21. package/dist/badge/badge.js +1 -22
  22. package/dist/badge/badge.module.js +1 -3
  23. package/dist/blockquote/blockquote.js +1 -16
  24. package/dist/blockquote/blockquote.module.js +1 -6
  25. package/dist/bottom-sheet/bottom-sheet.js +1 -111
  26. package/dist/bottom-sheet/bottom-sheet.module.js +1 -14
  27. package/dist/brand/logo/logo.css +1 -0
  28. package/dist/brand/logo/logo.js +1 -0
  29. package/dist/brand/logo/logo.module.js +2 -0
  30. package/dist/breadcrumb/breadcrumb.js +1 -28
  31. package/dist/breadcrumb/breadcrumb.module.js +1 -3
  32. package/dist/button/button.css +1 -1
  33. package/dist/button/button.js +1 -35
  34. package/dist/button/button.module.js +1 -6
  35. package/dist/button-group/button-group.js +1 -39
  36. package/dist/button-group/button-group.module.js +1 -3
  37. package/dist/calendar/calendar-date.js +1 -0
  38. package/dist/calendar/calendar.css +1 -1
  39. package/dist/calendar/calendar.js +1 -199
  40. package/dist/calendar/calendar.module.js +1 -14
  41. package/dist/card/card.js +1 -53
  42. package/dist/card/card.module.js +1 -12
  43. package/dist/carousel/carousel.css +1 -1
  44. package/dist/carousel/carousel.js +1 -138
  45. package/dist/carousel/carousel.module.js +1 -13
  46. package/dist/chat-bubble/chat-bubble.js +1 -31
  47. package/dist/chat-bubble/chat-bubble.module.js +1 -11
  48. package/dist/checkbox/checkbox.js +1 -39
  49. package/dist/checkbox/checkbox.module.js +1 -8
  50. package/dist/checkbox-card/checkbox-card.css +1 -1
  51. package/dist/checkbox-card/checkbox-card.js +1 -50
  52. package/dist/checkbox-card/checkbox-card.module.js +1 -11
  53. package/dist/code/code.js +1 -14
  54. package/dist/code/code.module.js +1 -3
  55. package/dist/code-snippet/code-snippet.js +2 -121
  56. package/dist/code-snippet/code-snippet.module.js +1 -17
  57. package/dist/code-snippet/highlight.js +1 -67
  58. package/dist/collapsible/collapsible.js +1 -47
  59. package/dist/collapsible/collapsible.module.js +1 -7
  60. package/dist/color-picker/color-picker.css +1 -1
  61. package/dist/color-picker/color-picker.js +1 -272
  62. package/dist/color-picker/color-picker.module.js +1 -18
  63. package/dist/color-picker/color.js +1 -0
  64. package/dist/combobox/combobox.css +1 -1
  65. package/dist/combobox/combobox.js +1 -170
  66. package/dist/combobox/combobox.module.js +1 -19
  67. package/dist/combobox/list-nav.js +1 -0
  68. package/dist/combobox/option-list.js +1 -0
  69. package/dist/command-menu/command-menu.js +1 -421
  70. package/dist/command-menu/command-menu.module.js +1 -34
  71. package/dist/comparison/comparison.js +1 -69
  72. package/dist/comparison/comparison.module.js +1 -9
  73. package/dist/contained-list/contained-list.js +1 -41
  74. package/dist/contained-list/contained-list.module.js +1 -11
  75. package/dist/context-menu/context-menu.js +1 -93
  76. package/dist/context-menu/context-menu.module.js +1 -7
  77. package/dist/copy-button/copy-button.js +1 -60
  78. package/dist/copy-button/copy-button.module.js +1 -6
  79. package/dist/data-list/data-list.js +1 -25
  80. package/dist/data-list/data-list.module.js +1 -8
  81. package/dist/data-table/column-filter.js +1 -0
  82. package/dist/data-table/column-layout.js +1 -0
  83. package/dist/data-table/data-table.css +1 -1
  84. package/dist/data-table/data-table.js +1 -398
  85. package/dist/data-table/data-table.module.js +1 -33
  86. package/dist/data-table/grid-keys.js +1 -0
  87. package/dist/data-table/row-group.js +1 -0
  88. package/dist/data-table/row-search.js +1 -0
  89. package/dist/data-table/row-sort.js +1 -0
  90. package/dist/data-table/to-csv.js +3 -0
  91. package/dist/data-table/virtual-window.js +1 -0
  92. package/dist/date-picker/date-picker.css +1 -1
  93. package/dist/date-picker/date-picker.js +1 -224
  94. package/dist/date-picker/date-picker.module.js +1 -23
  95. package/dist/date-picker/parse-date.js +1 -0
  96. package/dist/date-range-picker/date-range-picker.js +1 -196
  97. package/dist/date-range-picker/date-range-picker.module.js +1 -18
  98. package/dist/dock/dock.css +1 -1
  99. package/dist/dock/dock.js +1 -34
  100. package/dist/dock/dock.module.js +1 -8
  101. package/dist/drawer/drawer.js +1 -96
  102. package/dist/drawer/drawer.module.js +1 -13
  103. package/dist/dropdown/dropdown.css +1 -1
  104. package/dist/dropdown/dropdown.js +1 -110
  105. package/dist/dropdown/dropdown.module.js +1 -9
  106. package/dist/editable/editable.js +1 -76
  107. package/dist/editable/editable.module.js +1 -11
  108. package/dist/empty-state/empty-state.js +1 -32
  109. package/dist/empty-state/empty-state.module.js +1 -9
  110. package/dist/fab/fab.css +1 -1
  111. package/dist/fab/fab.js +1 -93
  112. package/dist/fab/fab.module.js +1 -12
  113. package/dist/field/field.css +1 -1
  114. package/dist/field/field.js +1 -53
  115. package/dist/field/field.module.js +1 -7
  116. package/dist/file-uploader/file-uploader.css +1 -1
  117. package/dist/file-uploader/file-uploader.js +1 -123
  118. package/dist/file-uploader/file-uploader.module.js +1 -18
  119. package/dist/filter/filter.css +1 -1
  120. package/dist/filter/filter.js +1 -35
  121. package/dist/filter/filter.module.js +1 -6
  122. package/dist/form/form.js +1 -95
  123. package/dist/form/form.module.js +1 -3
  124. package/dist/header/header.js +1 -44
  125. package/dist/header/header.module.js +1 -11
  126. package/dist/header-panel/header-panel.js +1 -72
  127. package/dist/header-panel/header-panel.module.js +1 -9
  128. package/dist/heading/heading.css +1 -1
  129. package/dist/heading/heading.js +1 -22
  130. package/dist/heading/heading.module.js +1 -3
  131. package/dist/hover-card/hover-card.css +1 -1
  132. package/dist/hover-card/hover-card.js +1 -84
  133. package/dist/hover-card/hover-card.module.js +1 -6
  134. package/dist/icon-button/icon-button.js +1 -19
  135. package/dist/icon-button/icon-button.module.js +1 -3
  136. package/dist/image/image.css +1 -1
  137. package/dist/image/image.js +1 -64
  138. package/dist/image/image.module.js +1 -9
  139. package/dist/index.d.ts +1521 -38
  140. package/dist/indicator/indicator.js +1 -16
  141. package/dist/indicator/indicator.module.js +1 -6
  142. package/dist/infinite-scroll/infinite-scroll.js +1 -49
  143. package/dist/infinite-scroll/infinite-scroll.module.js +1 -7
  144. package/dist/inline-loading/inline-loading.js +1 -74
  145. package/dist/inline-loading/inline-loading.module.js +1 -9
  146. package/dist/input/input.css +1 -1
  147. package/dist/input/input.js +1 -56
  148. package/dist/input/input.module.js +1 -9
  149. package/dist/input-group/input-group.css +1 -1
  150. package/dist/input-group/input-group.js +1 -39
  151. package/dist/input-group/input-group.module.js +1 -9
  152. package/dist/item/item.js +1 -50
  153. package/dist/item/item.module.js +1 -10
  154. package/dist/join/join.js +1 -12
  155. package/dist/join/join.module.js +1 -3
  156. package/dist/kbd/kbd.js +1 -14
  157. package/dist/kbd/kbd.module.js +1 -3
  158. package/dist/label/label.js +1 -23
  159. package/dist/label/label.module.js +1 -7
  160. package/dist/large-title-header/large-title-header.js +1 -38
  161. package/dist/large-title-header/large-title-header.module.js +1 -12
  162. package/dist/layouts/src/auto-grid/auto-grid.js +1 -17
  163. package/dist/layouts/src/auto-grid/auto-grid.module.js +1 -4
  164. package/dist/layouts/src/center/center.js +1 -16
  165. package/dist/layouts/src/center/center.module.js +1 -3
  166. package/dist/layouts/src/columns/columns.js +1 -21
  167. package/dist/layouts/src/columns/columns.module.js +1 -6
  168. package/dist/layouts/src/flex/flex.css +1 -1
  169. package/dist/layouts/src/flex/flex.js +1 -20
  170. package/dist/layouts/src/flex/flex.module.js +1 -3
  171. package/dist/layouts/src/grid/grid.css +1 -1
  172. package/dist/layouts/src/grid/grid.js +1 -55
  173. package/dist/layouts/src/grid/grid.module.js +1 -7
  174. package/dist/layouts/src/page-header/page-header.js +1 -31
  175. package/dist/layouts/src/page-header/page-header.module.js +1 -10
  176. package/dist/layouts/src/spacer/spacer.js +1 -17
  177. package/dist/layouts/src/spacer/spacer.module.js +1 -3
  178. package/dist/link/link.css +1 -1
  179. package/dist/link/link.js +1 -22
  180. package/dist/link/link.module.js +1 -3
  181. package/dist/list/list.js +1 -21
  182. package/dist/list/list.module.js +1 -6
  183. package/dist/log-viewer/log-viewer.css +1 -1
  184. package/dist/log-viewer/log-viewer.js +2 -184
  185. package/dist/log-viewer/log-viewer.module.js +1 -16
  186. package/dist/menu/menu.js +1 -126
  187. package/dist/menu/menu.module.js +1 -8
  188. package/dist/menu-button/menu-button.js +1 -92
  189. package/dist/menu-button/menu-button.module.js +1 -8
  190. package/dist/menubar/menubar.js +1 -103
  191. package/dist/menubar/menubar.module.js +1 -8
  192. package/dist/modal/modal.css +1 -1
  193. package/dist/modal/modal.js +1 -76
  194. package/dist/modal/modal.module.js +1 -12
  195. package/dist/multi-select/list-nav.js +1 -0
  196. package/dist/multi-select/multi-select.css +1 -1
  197. package/dist/multi-select/multi-select.js +1 -106
  198. package/dist/multi-select/multi-select.module.js +1 -15
  199. package/dist/multi-select/option-list.js +1 -0
  200. package/dist/native-select/native-select.css +1 -1
  201. package/dist/native-select/native-select.js +1 -37
  202. package/dist/native-select/native-select.module.js +1 -7
  203. package/dist/navigation-menu/navigation-menu.js +1 -99
  204. package/dist/navigation-menu/navigation-menu.module.js +1 -10
  205. package/dist/node/accordion/accordion.js +1 -114
  206. package/dist/node/accordion/accordion.module.js +1 -10
  207. package/dist/node/action-sheet/action-sheet.js +1 -91
  208. package/dist/node/action-sheet/action-sheet.module.js +1 -12
  209. package/dist/node/alert/alert.js +1 -55
  210. package/dist/node/alert/alert.module.js +1 -11
  211. package/dist/node/alert-dialog/alert-dialog.js +1 -66
  212. package/dist/node/alert-dialog/alert-dialog.module.js +1 -11
  213. package/dist/node/app-shell/app-shell.js +1 -85
  214. package/dist/node/app-shell/app-shell.module.js +1 -12
  215. package/dist/node/aspect-ratio/aspect-ratio.js +1 -20
  216. package/dist/node/aspect-ratio/aspect-ratio.module.js +1 -6
  217. package/dist/node/avatar/avatar.js +1 -57
  218. package/dist/node/avatar/avatar.module.js +1 -8
  219. package/dist/node/avatar-group/avatar-group.js +1 -24
  220. package/dist/node/avatar-group/avatar-group.module.js +1 -6
  221. package/dist/node/badge/badge.js +1 -22
  222. package/dist/node/badge/badge.module.js +1 -3
  223. package/dist/node/blockquote/blockquote.js +1 -16
  224. package/dist/node/blockquote/blockquote.module.js +1 -6
  225. package/dist/node/bottom-sheet/bottom-sheet.js +1 -111
  226. package/dist/node/bottom-sheet/bottom-sheet.module.js +1 -14
  227. package/dist/node/brand/logo/logo.js +1 -0
  228. package/dist/node/brand/logo/logo.module.js +1 -0
  229. package/dist/node/breadcrumb/breadcrumb.js +1 -28
  230. package/dist/node/breadcrumb/breadcrumb.module.js +1 -3
  231. package/dist/node/button/button.js +1 -35
  232. package/dist/node/button/button.module.js +1 -6
  233. package/dist/node/button-group/button-group.js +1 -39
  234. package/dist/node/button-group/button-group.module.js +1 -3
  235. package/dist/node/calendar/calendar-date.js +1 -0
  236. package/dist/node/calendar/calendar.js +1 -199
  237. package/dist/node/calendar/calendar.module.js +1 -14
  238. package/dist/node/card/card.js +1 -53
  239. package/dist/node/card/card.module.js +1 -12
  240. package/dist/node/carousel/carousel.js +1 -138
  241. package/dist/node/carousel/carousel.module.js +1 -13
  242. package/dist/node/chat-bubble/chat-bubble.js +1 -31
  243. package/dist/node/chat-bubble/chat-bubble.module.js +1 -11
  244. package/dist/node/checkbox/checkbox.js +1 -39
  245. package/dist/node/checkbox/checkbox.module.js +1 -8
  246. package/dist/node/checkbox-card/checkbox-card.js +1 -50
  247. package/dist/node/checkbox-card/checkbox-card.module.js +1 -11
  248. package/dist/node/code/code.js +1 -14
  249. package/dist/node/code/code.module.js +1 -3
  250. package/dist/node/code-snippet/code-snippet.js +2 -121
  251. package/dist/node/code-snippet/code-snippet.module.js +1 -17
  252. package/dist/node/code-snippet/highlight.js +1 -67
  253. package/dist/node/collapsible/collapsible.js +1 -47
  254. package/dist/node/collapsible/collapsible.module.js +1 -7
  255. package/dist/node/color-picker/color-picker.js +1 -272
  256. package/dist/node/color-picker/color-picker.module.js +1 -18
  257. package/dist/node/color-picker/color.js +1 -0
  258. package/dist/node/combobox/combobox.js +1 -170
  259. package/dist/node/combobox/combobox.module.js +1 -19
  260. package/dist/node/combobox/list-nav.js +1 -0
  261. package/dist/node/combobox/option-list.js +1 -0
  262. package/dist/node/command-menu/command-menu.js +1 -421
  263. package/dist/node/command-menu/command-menu.module.js +1 -34
  264. package/dist/node/comparison/comparison.js +1 -69
  265. package/dist/node/comparison/comparison.module.js +1 -9
  266. package/dist/node/contained-list/contained-list.js +1 -41
  267. package/dist/node/contained-list/contained-list.module.js +1 -11
  268. package/dist/node/context-menu/context-menu.js +1 -93
  269. package/dist/node/context-menu/context-menu.module.js +1 -7
  270. package/dist/node/copy-button/copy-button.js +1 -60
  271. package/dist/node/copy-button/copy-button.module.js +1 -6
  272. package/dist/node/data-list/data-list.js +1 -25
  273. package/dist/node/data-list/data-list.module.js +1 -8
  274. package/dist/node/data-table/column-filter.js +1 -0
  275. package/dist/node/data-table/column-layout.js +1 -0
  276. package/dist/node/data-table/data-table.js +1 -398
  277. package/dist/node/data-table/data-table.module.js +1 -33
  278. package/dist/node/data-table/grid-keys.js +1 -0
  279. package/dist/node/data-table/row-group.js +1 -0
  280. package/dist/node/data-table/row-search.js +1 -0
  281. package/dist/node/data-table/row-sort.js +1 -0
  282. package/dist/node/data-table/to-csv.js +3 -0
  283. package/dist/node/data-table/virtual-window.js +1 -0
  284. package/dist/node/date-picker/date-picker.js +1 -224
  285. package/dist/node/date-picker/date-picker.module.js +1 -23
  286. package/dist/node/date-picker/parse-date.js +1 -0
  287. package/dist/node/date-range-picker/date-range-picker.js +1 -196
  288. package/dist/node/date-range-picker/date-range-picker.module.js +1 -18
  289. package/dist/node/dock/dock.js +1 -34
  290. package/dist/node/dock/dock.module.js +1 -8
  291. package/dist/node/drawer/drawer.js +1 -96
  292. package/dist/node/drawer/drawer.module.js +1 -13
  293. package/dist/node/dropdown/dropdown.js +1 -110
  294. package/dist/node/dropdown/dropdown.module.js +1 -9
  295. package/dist/node/editable/editable.js +1 -76
  296. package/dist/node/editable/editable.module.js +1 -11
  297. package/dist/node/empty-state/empty-state.js +1 -32
  298. package/dist/node/empty-state/empty-state.module.js +1 -9
  299. package/dist/node/fab/fab.js +1 -93
  300. package/dist/node/fab/fab.module.js +1 -12
  301. package/dist/node/field/field.js +1 -53
  302. package/dist/node/field/field.module.js +1 -7
  303. package/dist/node/file-uploader/file-uploader.js +1 -123
  304. package/dist/node/file-uploader/file-uploader.module.js +1 -18
  305. package/dist/node/filter/filter.js +1 -35
  306. package/dist/node/filter/filter.module.js +1 -6
  307. package/dist/node/form/form.js +1 -95
  308. package/dist/node/form/form.module.js +1 -3
  309. package/dist/node/header/header.js +1 -44
  310. package/dist/node/header/header.module.js +1 -11
  311. package/dist/node/header-panel/header-panel.js +1 -72
  312. package/dist/node/header-panel/header-panel.module.js +1 -9
  313. package/dist/node/heading/heading.js +1 -22
  314. package/dist/node/heading/heading.module.js +1 -3
  315. package/dist/node/hover-card/hover-card.js +1 -84
  316. package/dist/node/hover-card/hover-card.module.js +1 -6
  317. package/dist/node/icon-button/icon-button.js +1 -19
  318. package/dist/node/icon-button/icon-button.module.js +1 -3
  319. package/dist/node/image/image.js +1 -64
  320. package/dist/node/image/image.module.js +1 -9
  321. package/dist/node/indicator/indicator.js +1 -16
  322. package/dist/node/indicator/indicator.module.js +1 -6
  323. package/dist/node/infinite-scroll/infinite-scroll.js +1 -49
  324. package/dist/node/infinite-scroll/infinite-scroll.module.js +1 -7
  325. package/dist/node/inline-loading/inline-loading.js +1 -74
  326. package/dist/node/inline-loading/inline-loading.module.js +1 -9
  327. package/dist/node/input/input.js +1 -56
  328. package/dist/node/input/input.module.js +1 -9
  329. package/dist/node/input-group/input-group.js +1 -39
  330. package/dist/node/input-group/input-group.module.js +1 -9
  331. package/dist/node/item/item.js +1 -50
  332. package/dist/node/item/item.module.js +1 -10
  333. package/dist/node/join/join.js +1 -12
  334. package/dist/node/join/join.module.js +1 -3
  335. package/dist/node/kbd/kbd.js +1 -14
  336. package/dist/node/kbd/kbd.module.js +1 -3
  337. package/dist/node/label/label.js +1 -23
  338. package/dist/node/label/label.module.js +1 -7
  339. package/dist/node/large-title-header/large-title-header.js +1 -38
  340. package/dist/node/large-title-header/large-title-header.module.js +1 -12
  341. package/dist/node/layouts/src/auto-grid/auto-grid.js +1 -17
  342. package/dist/node/layouts/src/auto-grid/auto-grid.module.js +1 -4
  343. package/dist/node/layouts/src/center/center.js +1 -16
  344. package/dist/node/layouts/src/center/center.module.js +1 -3
  345. package/dist/node/layouts/src/columns/columns.js +1 -21
  346. package/dist/node/layouts/src/columns/columns.module.js +1 -6
  347. package/dist/node/layouts/src/flex/flex.js +1 -20
  348. package/dist/node/layouts/src/flex/flex.module.js +1 -3
  349. package/dist/node/layouts/src/grid/grid.js +1 -55
  350. package/dist/node/layouts/src/grid/grid.module.js +1 -7
  351. package/dist/node/layouts/src/page-header/page-header.js +1 -31
  352. package/dist/node/layouts/src/page-header/page-header.module.js +1 -10
  353. package/dist/node/layouts/src/spacer/spacer.js +1 -17
  354. package/dist/node/layouts/src/spacer/spacer.module.js +1 -3
  355. package/dist/node/link/link.js +1 -22
  356. package/dist/node/link/link.module.js +1 -3
  357. package/dist/node/list/list.js +1 -21
  358. package/dist/node/list/list.module.js +1 -6
  359. package/dist/node/log-viewer/log-viewer.js +2 -184
  360. package/dist/node/log-viewer/log-viewer.module.js +1 -16
  361. package/dist/node/menu/menu.js +1 -126
  362. package/dist/node/menu/menu.module.js +1 -8
  363. package/dist/node/menu-button/menu-button.js +1 -92
  364. package/dist/node/menu-button/menu-button.module.js +1 -8
  365. package/dist/node/menubar/menubar.js +1 -103
  366. package/dist/node/menubar/menubar.module.js +1 -8
  367. package/dist/node/modal/modal.js +1 -76
  368. package/dist/node/modal/modal.module.js +1 -12
  369. package/dist/node/multi-select/list-nav.js +1 -0
  370. package/dist/node/multi-select/multi-select.js +1 -106
  371. package/dist/node/multi-select/multi-select.module.js +1 -15
  372. package/dist/node/multi-select/option-list.js +1 -0
  373. package/dist/node/native-select/native-select.js +1 -37
  374. package/dist/node/native-select/native-select.module.js +1 -7
  375. package/dist/node/navigation-menu/navigation-menu.js +1 -99
  376. package/dist/node/navigation-menu/navigation-menu.module.js +1 -10
  377. package/dist/node/notification/notification.js +1 -140
  378. package/dist/node/notification/notification.module.js +1 -11
  379. package/dist/node/number-input/number-input.js +1 -148
  380. package/dist/node/number-input/number-input.module.js +1 -12
  381. package/dist/node/otp-input/otp-input.js +1 -70
  382. package/dist/node/otp-input/otp-input.module.js +1 -6
  383. package/dist/node/overflow-menu/overflow-menu.js +1 -70
  384. package/dist/node/overflow-menu/overflow-menu.module.js +1 -7
  385. package/dist/node/pagination/pagination.js +1 -92
  386. package/dist/node/pagination/pagination.module.js +1 -11
  387. package/dist/node/password-input/password-input.js +1 -81
  388. package/dist/node/password-input/password-input.module.js +1 -11
  389. package/dist/node/popover/popover.js +1 -51
  390. package/dist/node/popover/popover.module.js +1 -6
  391. package/dist/node/popover/use-popover.js +1 -55
  392. package/dist/node/progress/progress.js +1 -16
  393. package/dist/node/progress/progress.module.js +1 -6
  394. package/dist/node/progress-bar/progress-bar.js +1 -42
  395. package/dist/node/progress-bar/progress-bar.module.js +1 -11
  396. package/dist/node/progress-circle/progress-circle.js +1 -46
  397. package/dist/node/progress-circle/progress-circle.module.js +1 -9
  398. package/dist/node/progress-indicator/progress-indicator.js +1 -34
  399. package/dist/node/progress-indicator/progress-indicator.module.js +1 -10
  400. package/dist/node/prose/prose.js +1 -13
  401. package/dist/node/prose/prose.module.js +1 -3
  402. package/dist/node/pull-to-refresh/pull-to-refresh.js +1 -82
  403. package/dist/node/pull-to-refresh/pull-to-refresh.module.js +1 -9
  404. package/dist/node/qr-code/encode.js +1 -583
  405. package/dist/node/qr-code/qr-code.js +1 -41
  406. package/dist/node/qr-code/qr-code.module.js +1 -6
  407. package/dist/node/radial-progress/radial-progress.js +1 -27
  408. package/dist/node/radial-progress/radial-progress.module.js +1 -6
  409. package/dist/node/radio/radio.js +1 -49
  410. package/dist/node/radio/radio.module.js +1 -9
  411. package/dist/node/radio-card/radio-card.js +1 -64
  412. package/dist/node/radio-card/radio-card.module.js +1 -11
  413. package/dist/node/rating-group/rating-group.js +1 -37
  414. package/dist/node/rating-group/rating-group.module.js +1 -6
  415. package/dist/node/react/src/index.js +1 -141
  416. package/dist/node/relative-time/relative-time.js +1 -66
  417. package/dist/node/relative-time/relative-time.module.js +1 -3
  418. package/dist/node/reorder-list/reorder-list.js +1 -143
  419. package/dist/node/reorder-list/reorder-list.module.js +1 -11
  420. package/dist/node/resizable/resizable.js +1 -80
  421. package/dist/node/resizable/resizable.module.js +1 -8
  422. package/dist/node/scroll-area/scroll-area.js +1 -38
  423. package/dist/node/scroll-area/scroll-area.module.js +1 -3
  424. package/dist/node/search/search.js +1 -96
  425. package/dist/node/search/search.module.js +1 -9
  426. package/dist/node/segmented-control/segmented-control.js +1 -43
  427. package/dist/node/segmented-control/segmented-control.module.js +1 -6
  428. package/dist/node/select/select.js +1 -73
  429. package/dist/node/select/select.module.js +1 -11
  430. package/dist/node/separator/separator.js +1 -19
  431. package/dist/node/separator/separator.module.js +1 -3
  432. package/dist/node/sheet/sheet.js +1 -49
  433. package/dist/node/sheet/sheet.module.js +1 -9
  434. package/dist/node/shell-header/shell-header.js +1 -169
  435. package/dist/node/shell-header/shell-header.module.js +1 -24
  436. package/dist/node/side-nav/side-nav.js +1 -334
  437. package/dist/node/side-nav/side-nav.module.js +1 -31
  438. package/dist/node/skeleton/skeleton.js +1 -23
  439. package/dist/node/skeleton/skeleton.module.js +1 -7
  440. package/dist/node/skip-nav/skip-nav.js +1 -28
  441. package/dist/node/skip-nav/skip-nav.module.js +1 -3
  442. package/dist/node/slider/slider.js +1 -30
  443. package/dist/node/slider/slider.module.js +1 -7
  444. package/dist/node/spinner/spinner.js +1 -18
  445. package/dist/node/spinner/spinner.module.js +1 -6
  446. package/dist/node/stack/stack.js +1 -17
  447. package/dist/node/stack/stack.module.js +1 -6
  448. package/dist/node/stat/stat.js +1 -41
  449. package/dist/node/stat/stat.module.js +1 -11
  450. package/dist/node/status/status.js +1 -25
  451. package/dist/node/status/status.module.js +1 -7
  452. package/dist/node/steps/steps.js +1 -35
  453. package/dist/node/steps/steps.module.js +1 -8
  454. package/dist/node/structured-list/structured-list.js +1 -102
  455. package/dist/node/structured-list/structured-list.module.js +1 -12
  456. package/dist/node/swap/swap.js +1 -36
  457. package/dist/node/swap/swap.module.js +1 -7
  458. package/dist/node/swipe-item/swipe-item.js +1 -62
  459. package/dist/node/swipe-item/swipe-item.module.js +1 -12
  460. package/dist/node/switcher/switcher.js +1 -32
  461. package/dist/node/switcher/switcher.module.js +1 -8
  462. package/dist/node/tabs/tabs.js +1 -98
  463. package/dist/node/tabs/tabs.module.js +1 -8
  464. package/dist/node/tag/tag.js +1 -33
  465. package/dist/node/tag/tag.module.js +1 -6
  466. package/dist/node/tags-input/tags-input.js +1 -68
  467. package/dist/node/tags-input/tags-input.module.js +1 -8
  468. package/dist/node/text/text.js +1 -16
  469. package/dist/node/text/text.module.js +1 -3
  470. package/dist/node/textarea/textarea.js +1 -58
  471. package/dist/node/textarea/textarea.module.js +1 -9
  472. package/dist/node/tile/tile.js +1 -39
  473. package/dist/node/tile/tile.module.js +1 -7
  474. package/dist/node/time-picker/time-picker.js +1 -64
  475. package/dist/node/time-picker/time-picker.module.js +1 -9
  476. package/dist/node/timeline/timeline.js +1 -55
  477. package/dist/node/timeline/timeline.module.js +1 -11
  478. package/dist/node/toast/toast.js +1 -85
  479. package/dist/node/toast/toast.module.js +1 -11
  480. package/dist/node/toc/toc.js +1 -43
  481. package/dist/node/toc/toc.module.js +1 -3
  482. package/dist/node/toc/use-toc-from-region.js +1 -18
  483. package/dist/node/toggle/toggle.js +1 -42
  484. package/dist/node/toggle/toggle.module.js +1 -8
  485. package/dist/node/toggle-group/toggle-group.js +1 -55
  486. package/dist/node/toggle-group/toggle-group.module.js +1 -6
  487. package/dist/node/toggletip/toggletip.js +1 -49
  488. package/dist/node/toggletip/toggletip.module.js +1 -7
  489. package/dist/node/tooltip/tooltip.js +1 -58
  490. package/dist/node/tooltip/tooltip.module.js +1 -6
  491. package/dist/node/tree-view/tree-view.js +1 -201
  492. package/dist/node/tree-view/tree-view.module.js +1 -13
  493. package/dist/node/user/user.js +1 -35
  494. package/dist/node/user/user.module.js +1 -9
  495. package/dist/node/virtual-list/virtual-list.js +1 -40
  496. package/dist/node/virtual-list/virtual-list.module.js +1 -7
  497. package/dist/node/visually-hidden/visually-hidden.js +1 -2
  498. package/dist/node/wheel-picker/wheel-picker.js +1 -84
  499. package/dist/node/wheel-picker/wheel-picker.module.js +1 -8
  500. package/dist/notification/notification.js +1 -140
  501. package/dist/notification/notification.module.js +1 -11
  502. package/dist/number-input/number-input.js +1 -148
  503. package/dist/number-input/number-input.module.js +1 -12
  504. package/dist/otp-input/otp-input.js +1 -70
  505. package/dist/otp-input/otp-input.module.js +1 -6
  506. package/dist/overflow-menu/overflow-menu.js +1 -70
  507. package/dist/overflow-menu/overflow-menu.module.js +1 -7
  508. package/dist/pagination/pagination.js +1 -92
  509. package/dist/pagination/pagination.module.js +1 -11
  510. package/dist/password-input/password-input.js +1 -81
  511. package/dist/password-input/password-input.module.js +1 -11
  512. package/dist/popover/popover.js +1 -51
  513. package/dist/popover/popover.module.js +1 -6
  514. package/dist/popover/use-popover.js +1 -55
  515. package/dist/progress/progress.css +1 -1
  516. package/dist/progress/progress.js +1 -16
  517. package/dist/progress/progress.module.js +1 -6
  518. package/dist/progress-bar/progress-bar.css +1 -1
  519. package/dist/progress-bar/progress-bar.js +1 -42
  520. package/dist/progress-bar/progress-bar.module.js +1 -11
  521. package/dist/progress-circle/progress-circle.js +1 -46
  522. package/dist/progress-circle/progress-circle.module.js +1 -9
  523. package/dist/progress-indicator/progress-indicator.css +1 -1
  524. package/dist/progress-indicator/progress-indicator.js +1 -34
  525. package/dist/progress-indicator/progress-indicator.module.js +1 -10
  526. package/dist/prose/prose.css +1 -1
  527. package/dist/prose/prose.js +1 -13
  528. package/dist/prose/prose.module.js +1 -3
  529. package/dist/pull-to-refresh/pull-to-refresh.js +1 -82
  530. package/dist/pull-to-refresh/pull-to-refresh.module.js +1 -9
  531. package/dist/qr-code/encode.js +1 -583
  532. package/dist/qr-code/qr-code.js +1 -41
  533. package/dist/qr-code/qr-code.module.js +1 -6
  534. package/dist/radial-progress/radial-progress.js +1 -27
  535. package/dist/radial-progress/radial-progress.module.js +1 -6
  536. package/dist/radio/radio.js +1 -49
  537. package/dist/radio/radio.module.js +1 -9
  538. package/dist/radio-card/radio-card.css +1 -1
  539. package/dist/radio-card/radio-card.js +1 -64
  540. package/dist/radio-card/radio-card.module.js +1 -11
  541. package/dist/rating-group/rating-group.js +1 -37
  542. package/dist/rating-group/rating-group.module.js +1 -6
  543. package/dist/react/src/index.js +1 -141
  544. package/dist/relative-time/relative-time.js +1 -66
  545. package/dist/relative-time/relative-time.module.js +1 -3
  546. package/dist/reorder-list/reorder-list.css +1 -1
  547. package/dist/reorder-list/reorder-list.js +1 -143
  548. package/dist/reorder-list/reorder-list.module.js +1 -11
  549. package/dist/resizable/resizable.js +1 -80
  550. package/dist/resizable/resizable.module.js +1 -8
  551. package/dist/scroll-area/scroll-area.css +1 -1
  552. package/dist/scroll-area/scroll-area.js +1 -38
  553. package/dist/scroll-area/scroll-area.module.js +1 -3
  554. package/dist/search/search.js +1 -96
  555. package/dist/search/search.module.js +1 -9
  556. package/dist/segmented-control/segmented-control.js +1 -43
  557. package/dist/segmented-control/segmented-control.module.js +1 -6
  558. package/dist/select/select.js +1 -73
  559. package/dist/select/select.module.js +1 -11
  560. package/dist/separator/separator.js +1 -19
  561. package/dist/separator/separator.module.js +1 -3
  562. package/dist/sheet/sheet.js +1 -49
  563. package/dist/sheet/sheet.module.js +1 -9
  564. package/dist/shell-header/shell-header.css +1 -1
  565. package/dist/shell-header/shell-header.js +1 -169
  566. package/dist/shell-header/shell-header.module.js +1 -24
  567. package/dist/side-nav/side-nav.css +1 -1
  568. package/dist/side-nav/side-nav.js +1 -334
  569. package/dist/side-nav/side-nav.module.js +1 -31
  570. package/dist/skeleton/skeleton.css +1 -1
  571. package/dist/skeleton/skeleton.js +1 -23
  572. package/dist/skeleton/skeleton.module.js +1 -7
  573. package/dist/skip-nav/skip-nav.js +1 -28
  574. package/dist/skip-nav/skip-nav.module.js +1 -3
  575. package/dist/slider/slider.js +1 -30
  576. package/dist/slider/slider.module.js +1 -7
  577. package/dist/spinner/spinner.css +1 -1
  578. package/dist/spinner/spinner.js +1 -18
  579. package/dist/spinner/spinner.module.js +1 -6
  580. package/dist/stack/stack.js +1 -17
  581. package/dist/stack/stack.module.js +1 -6
  582. package/dist/stat/stat.js +1 -41
  583. package/dist/stat/stat.module.js +1 -11
  584. package/dist/status/status.css +1 -1
  585. package/dist/status/status.js +1 -25
  586. package/dist/status/status.module.js +1 -7
  587. package/dist/steps/steps.css +1 -1
  588. package/dist/steps/steps.js +1 -35
  589. package/dist/steps/steps.module.js +1 -8
  590. package/dist/structured-list/structured-list.js +1 -102
  591. package/dist/structured-list/structured-list.module.js +1 -12
  592. package/dist/styles.css +401 -55
  593. package/dist/swap/swap.css +1 -1
  594. package/dist/swap/swap.js +1 -36
  595. package/dist/swap/swap.module.js +1 -7
  596. package/dist/swipe-item/swipe-item.js +1 -62
  597. package/dist/swipe-item/swipe-item.module.js +1 -12
  598. package/dist/switcher/switcher.js +1 -32
  599. package/dist/switcher/switcher.module.js +1 -8
  600. package/dist/tabs/tabs.js +1 -98
  601. package/dist/tabs/tabs.module.js +1 -8
  602. package/dist/tag/tag.js +1 -33
  603. package/dist/tag/tag.module.js +1 -6
  604. package/dist/tags-input/tags-input.js +1 -68
  605. package/dist/tags-input/tags-input.module.js +1 -8
  606. package/dist/text/text.css +1 -1
  607. package/dist/text/text.js +1 -16
  608. package/dist/text/text.module.js +1 -3
  609. package/dist/textarea/textarea.css +1 -1
  610. package/dist/textarea/textarea.js +1 -58
  611. package/dist/textarea/textarea.module.js +1 -9
  612. package/dist/tile/tile.css +1 -1
  613. package/dist/tile/tile.js +1 -39
  614. package/dist/tile/tile.module.js +1 -7
  615. package/dist/time-picker/time-picker.js +1 -64
  616. package/dist/time-picker/time-picker.module.js +1 -9
  617. package/dist/timeline/timeline.js +1 -55
  618. package/dist/timeline/timeline.module.js +1 -11
  619. package/dist/toast/toast.css +1 -1
  620. package/dist/toast/toast.js +1 -85
  621. package/dist/toast/toast.module.js +1 -11
  622. package/dist/toc/toc.css +1 -1
  623. package/dist/toc/toc.js +1 -43
  624. package/dist/toc/toc.module.js +1 -3
  625. package/dist/toc/use-toc-from-region.js +1 -18
  626. package/dist/toggle/toggle.js +1 -42
  627. package/dist/toggle/toggle.module.js +1 -8
  628. package/dist/toggle-group/toggle-group.js +1 -55
  629. package/dist/toggle-group/toggle-group.module.js +1 -6
  630. package/dist/toggletip/toggletip.js +1 -49
  631. package/dist/toggletip/toggletip.module.js +1 -7
  632. package/dist/tooltip/tooltip.css +1 -1
  633. package/dist/tooltip/tooltip.js +1 -58
  634. package/dist/tooltip/tooltip.module.js +1 -6
  635. package/dist/tree-view/tree-view.css +1 -1
  636. package/dist/tree-view/tree-view.js +1 -201
  637. package/dist/tree-view/tree-view.module.js +1 -13
  638. package/dist/user/user.js +1 -35
  639. package/dist/user/user.module.js +1 -9
  640. package/dist/virtual-list/virtual-list.js +1 -40
  641. package/dist/virtual-list/virtual-list.module.js +1 -7
  642. package/dist/visually-hidden/visually-hidden.js +1 -2
  643. package/dist/wheel-picker/wheel-picker.js +1 -84
  644. package/dist/wheel-picker/wheel-picker.module.js +1 -8
  645. package/package.json +4 -4
  646. package/readme.body.md +3 -2
@@ -0,0 +1 @@
1
+ function enabledIndexes(e){let t=[];return e.forEach((e,n)=>{e.disabled||t.push(n)}),t}function moveActive(e,t,n){let r=enabledIndexes(n);if(r.length===0)return-1;let i=r.indexOf(e);return i===-1?t>0?r[0]:r[r.length-1]:r[(i+t+r.length)%r.length]}function firstActive(e){return enabledIndexes(e)[0]??-1}function lastActive(e){let t=enabledIndexes(e);return t[t.length-1]??-1}function pageActive(e,t,n){let r=enabledIndexes(n);if(r.length===0)return-1;let i=r.indexOf(e),a=i===-1?t>0?-1:r.length:i;return r[Math.min(Math.max(a+t*10,0),r.length-1)]}function clampActive(e,t){return e>=0&&e<t.length&&!t[e]?.disabled?e:firstActive(t)}export{clampActive,firstActive,lastActive,moveActive,pageActive};
@@ -1,106 +1 @@
1
- "use client";
2
-
3
- import { usePopover as e } from "../popover/use-popover.js";
4
- import t from "./multi-select.module.js";
5
- import { useRef as n } from "react";
6
- import { cn as r, focusElement as i, useComputed as a, useSignal as o, useSignalEffect as s, useSignals as c } from "@cascivo/core";
7
- import { builtin as l, t as u } from "@cascivo/i18n";
8
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
- //#region ../components/src/multi-select/multi-select.tsx
10
- function p({ options: p, value: m, onValueChange: h, placeholder: g, disabled: _ = !1, labels: v, className: y, ...b }) {
11
- c();
12
- let x = e({ placement: "bottom" }), S = o(""), C = o(-1), w = n(null), T = n(null), E = a(() => {
13
- let e = S.value.toLowerCase();
14
- return e ? p.filter((t) => t.label.toLowerCase().includes(e)) : p;
15
- });
16
- s(() => {
17
- x.isOpen.value ? (C.value = -1, setTimeout(() => i(T.current), 0)) : S.value = "";
18
- }), s(() => {
19
- let e = w.current;
20
- if (!e || !x.isOpen.value) return;
21
- let t = (e) => {
22
- let t = E.value;
23
- if (e.key === "ArrowDown") e.preventDefault(), C.value = Math.min(C.value + 1, t.length - 1);
24
- else if (e.key === "ArrowUp") e.preventDefault(), C.value = Math.max(C.value - 1, -1);
25
- else if (e.key === " " || e.key === "Enter") {
26
- let n = t[C.value];
27
- n && !n.disabled && (e.preventDefault(), D(n.value));
28
- } else e.key === "Escape" && x.close();
29
- };
30
- return e.addEventListener("keydown", t), () => e.removeEventListener("keydown", t);
31
- });
32
- function D(e) {
33
- m.includes(e) ? h(m.filter((t) => t !== e)) : h([...m, e]);
34
- }
35
- let O = m.length === 0 ? g ?? v?.placeholder ?? u(l.multiSelect.placeholder) : v?.selected ? v.selected(m.length) : u(l.multiSelect.selected, { count: String(m.length) }), k = v?.search ?? u(l.multiSelect.search), A = v?.noResults ?? u(l.multiSelect.noResults);
36
- return /* @__PURE__ */ f("div", {
37
- className: r(t.wrapper, y),
38
- ...b,
39
- children: [/* @__PURE__ */ f("button", {
40
- ref: x.triggerRef,
41
- type: "button",
42
- className: t.trigger,
43
- "aria-haspopup": "listbox",
44
- "aria-expanded": x.isOpen.value,
45
- disabled: _,
46
- style: { anchorName: x.anchorName },
47
- onClick: () => x.toggle(),
48
- children: [/* @__PURE__ */ d("span", {
49
- className: t["trigger-label"],
50
- children: O
51
- }), /* @__PURE__ */ d("span", {
52
- className: t.chevron,
53
- "aria-hidden": "true"
54
- })]
55
- }), /* @__PURE__ */ f("div", {
56
- ref: x.popoverRef,
57
- popover: "auto",
58
- className: t.panel,
59
- style: { positionAnchor: x.anchorName },
60
- tabIndex: -1,
61
- children: [/* @__PURE__ */ d("div", {
62
- className: t["search-row"],
63
- children: /* @__PURE__ */ d("input", {
64
- ref: T,
65
- type: "search",
66
- className: t.search,
67
- placeholder: k,
68
- value: S.value,
69
- onChange: (e) => {
70
- S.value = e.currentTarget.value, C.value = -1;
71
- }
72
- })
73
- }), /* @__PURE__ */ d("div", {
74
- ref: w,
75
- role: "listbox",
76
- "aria-multiselectable": "true",
77
- "aria-label": v?.label ?? u(l.multiSelect.label),
78
- className: t.options,
79
- children: E.value.length === 0 ? /* @__PURE__ */ d("div", {
80
- className: t["no-results"],
81
- children: A
82
- }) : E.value.map((e, n) => /* @__PURE__ */ f("div", {
83
- role: "option",
84
- "aria-selected": m.includes(e.value),
85
- "aria-disabled": e.disabled,
86
- "data-active": n === C.value ? "" : void 0,
87
- "data-selected": m.includes(e.value) ? "" : void 0,
88
- "data-disabled": e.disabled ? "" : void 0,
89
- className: t.option,
90
- onMouseDown: (t) => {
91
- t.preventDefault(), e.disabled || D(e.value);
92
- },
93
- onMouseEnter: () => {
94
- C.value = n;
95
- },
96
- children: [/* @__PURE__ */ d("span", {
97
- className: t.checkbox,
98
- "aria-hidden": "true"
99
- }), e.label]
100
- }, e.value))
101
- })]
102
- })]
103
- });
104
- }
105
- //#endregion
106
- export { p as MultiSelect };
1
+ "use client";import{usePopover as e}from"../popover/use-popover.js";import{clampActive as t,firstActive as n,lastActive as r,moveActive as i,pageActive as a}from"./list-nav.js";import{filterOptions as o,groupOptions as ee,highlightSegments as te,isNewLabel as ne,orderByGroup as re}from"./option-list.js";import s from"./multi-select.module.js";import{useId as ie,useRef as c}from"react";import{cn as l,focusElement as u,useControllableSignal as ae,useSignal as d,useSignalEffect as f,useSignals as oe}from"@cascivo/core";import{builtin as p,t as m}from"@cascivo/i18n";import{jsx as h,jsxs as g}from"react/jsx-runtime";function mergeDescribedBy(...e){return e.filter(Boolean).join(` `)||void 0}function MultiSelect({options:_,value:se,defaultValue:ce,onValueChange:le,placeholder:ue,label:v,ariaLabel:y,hint:b,error:x,display:S=`count`,disabled:C=!1,clearable:de=!1,selectAll:fe=!1,max:w,creatable:pe=!1,onCreate:me,loading:T=!1,onSearchChange:E,filter:D,searchable:O=!0,size:he=`md`,name:k,labels:A,className:ge,id:_e,"aria-labelledby":ve,"aria-describedby":ye,"aria-invalid":be,...xe}){oe();let j=e({placement:`bottom`}),M=ie(),N=_e??`${M}-trigger`,P=`${M}-listbox`,F=`${M}-panel`,Se=`${M}-search`,optionId=e=>`${M}-option-${e}`,I=d(``),L=d(-1),R=c(null),z=c(null),B=c(null),[V,Ce]=ae({value:se,defaultValue:ce??[],onChange:le}),H=j.isOpen.value,U=V.value,W=w!==void 0&&U.length>=w,G=I.value,K=re(o(_,O?G:``,D)),q=pe&&G.trim()!==``&&ne(_,G.trim()),J=q?K.length:-1,we=ee(K),Te=ue??A?.placeholder??m(p.multiSelect.placeholder),Y=A?.search??m(p.multiSelect.search),Ee=A?.noResults??m(p.multiSelect.noResults),De=A?.loading??m(p.multiSelect.loading),Oe=A?.label??v??y??m(p.multiSelect.label),ke=A?.clear??m(p.multiSelect.clear),Ae=A?.selectAll??m(p.multiSelect.selectAll),je=A?.clearAll??m(p.multiSelect.clearAll),removeLabel=e=>A?.remove?A.remove.replaceAll(`{label}`,e):m(p.multiSelect.remove,{label:e}),createLabel=e=>A?.create?A.create.replaceAll(`{label}`,e):m(p.multiSelect.create,{label:e}),Me=U.flatMap(e=>{let t=_.find(t=>t.value===e);return t?[t]:[{value:e,label:e}]}),X=U.length===0?Te:A?.selected?A.selected(U.length):m(p.multiSelect.selected,{count:String(U.length)}),Z=c(!1);f(()=>{if(j.isOpen.value){L.value=-1;let e=setTimeout(()=>u(O?z.current:R.current),0);return Z.current=!0,()=>clearTimeout(e)}I.value=``,Z.current&&(Z.current=!1,u(B.current))}),f(()=>{let e=L.value;if(!j.isOpen.value||e<0)return;let t=R.current?.querySelector(`#${CSS.escape(optionId(e))}`);t&&typeof t.scrollIntoView==`function`&&t.scrollIntoView({block:`nearest`})});function commit(e){Ce(e)}function toggleOption(e){let t=V.value;if(t.includes(e)){commit(t.filter(t=>t!==e));return}w!==void 0&&t.length>=w||commit([...t,e])}function activate(e){if(e===J&&q){me?.(G.trim()),I.value=``,E?.(``);return}let t=K[e];t&&!t.disabled&&toggleOption(t.value)}function setActive(e){L.value=e}function handleKeyDown(e){let t=[...K.map(e=>({...e,disabled:e.disabled||W&&!U.includes(e.value)})),...q?[{value:``,label:G}]:[]];switch(e.key){case`ArrowDown`:e.preventDefault(),setActive(i(L.value,1,t));break;case`ArrowUp`:e.preventDefault(),setActive(i(L.value,-1,t));break;case`Home`:e.preventDefault(),setActive(n(t));break;case`End`:e.preventDefault(),setActive(r(t));break;case`PageDown`:e.preventDefault(),setActive(a(L.value,1,t));break;case`PageUp`:e.preventDefault(),setActive(a(L.value,-1,t));break;case`Enter`:L.value>=0&&(e.preventDefault(),activate(L.value));break;case` `:!O&&L.value>=0&&(e.preventDefault(),activate(L.value));break;case`Escape`:e.preventDefault(),e.stopPropagation(),j.close();break;case`Backspace`:S===`chips`&&G===``&&V.value.length>0&&(e.preventDefault(),commit(V.value.slice(0,-1)));break}}function handleTriggerKeyDown(e){C||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j.open())}let Q=_.filter(e=>!e.disabled).map(e=>e.value),$=Q.length>0&&Q.every(e=>U.includes(e)),Ne=mergeDescribedBy(x?`${M}-error`:b?`${M}-hint`:void 0,ye);function renderOption(e,t){let n=U.includes(e.value),r=e.disabled||W&&!n;return g(`div`,{id:optionId(t),role:`option`,"aria-selected":n,"aria-disabled":r||void 0,"data-active":t===L.value?``:void 0,"data-selected":n?``:void 0,"data-disabled":r?``:void 0,className:s.option,onMouseDown:e=>e.preventDefault(),onClick:()=>{r||toggleOption(e.value)},onMouseEnter:()=>{r||setActive(t)},children:[h(`span`,{className:s.checkbox,"aria-hidden":`true`}),h(`span`,{className:s[`option-label`],children:te(e.label,O?G:``).map((e,t)=>e.match?h(`mark`,{className:s.match,children:e.text},t):h(`span`,{children:e.text},t))})]},e.value)}return g(`div`,{className:l(s.wrapper,ge),"data-state":x?`error`:H?`open`:`closed`,"data-size":he,...xe,children:[v&&h(`label`,{className:s.label,htmlFor:N,children:v}),g(`div`,{className:s.field,"data-display":S,children:[S===`chips`&&Me.map(e=>g(`span`,{className:s.chip,children:[h(`span`,{className:s[`chip-label`],children:e.label}),h(`button`,{type:`button`,className:s[`chip-remove`],"aria-label":removeLabel(e.label),disabled:C,onClick:()=>commit(V.value.filter(t=>t!==e.value))})]},e.value)),g(`button`,{ref:e=>{B.current=e,j.triggerRef.current=e},id:N,type:`button`,className:s.trigger,"aria-haspopup":`listbox`,"aria-expanded":H,"aria-controls":F,"aria-labelledby":ve,"aria-label":y,"aria-invalid":x?!0:be,"aria-describedby":Ne,disabled:C,style:{anchorName:j.anchorName},onClick:()=>{C||j.toggle()},onKeyDown:handleTriggerKeyDown,children:[h(`span`,{className:s[`trigger-label`],"data-empty":U.length===0?``:void 0,children:S===`chips`&&U.length>0?h(`span`,{className:s[`sr-only`],children:X}):X}),h(`span`,{className:s.chevron,"aria-hidden":`true`})]}),de&&U.length>0&&!C&&h(`button`,{type:`button`,className:s.clear,"aria-label":ke,onClick:()=>commit([]),children:h(`span`,{className:s[`clear-glyph`],"aria-hidden":`true`})})]}),k!==void 0&&U.map(e=>h(`input`,{type:`hidden`,name:k,value:e},e)),g(`div`,{ref:j.popoverRef,id:F,popover:`auto`,className:s.panel,style:{positionAnchor:j.anchorName},tabIndex:-1,children:[O&&h(`div`,{className:s[`search-row`],children:h(`input`,{ref:z,id:Se,type:`text`,role:`combobox`,className:s.search,placeholder:Y,"aria-label":Y,"aria-expanded":H,"aria-controls":P,"aria-autocomplete":`list`,"aria-activedescendant":H&&L.value>=0?optionId(L.value):void 0,autoComplete:`off`,value:G,onChange:e=>{I.value=e.currentTarget.value,E?.(e.currentTarget.value),L.value=t(-1,o(_,e.currentTarget.value,D))},onKeyDown:handleKeyDown})}),fe&&Q.length>0&&h(`button`,{type:`button`,className:s[`select-all`],onMouseDown:e=>e.preventDefault(),onClick:()=>commit($?[]:w===void 0?Q:Q.slice(0,w)),children:$?je:Ae}),g(`div`,{ref:R,role:`listbox`,id:P,"aria-multiselectable":`true`,"aria-label":Oe,"aria-busy":T||void 0,"aria-activedescendant":!O&&H&&L.value>=0?optionId(L.value):void 0,tabIndex:O?-1:0,className:s.options,onKeyDown:O?void 0:handleKeyDown,children:[we.map(e=>e.label===void 0?e.entries.map(({option:e,index:t})=>renderOption(e,t)):g(`div`,{role:`group`,"aria-label":e.label,className:s.group,children:[h(`span`,{className:s[`group-label`],"aria-hidden":`true`,children:e.label}),e.entries.map(({option:e,index:t})=>renderOption(e,t))]},e.label)),q&&h(`div`,{id:optionId(J),role:`option`,"aria-selected":!1,"data-active":J===L.value?``:void 0,className:l(s.option,s.create),onMouseDown:e=>e.preventDefault(),onClick:()=>activate(J),onMouseEnter:()=>setActive(J),children:createLabel(G.trim())})]}),T?h(`div`,{className:s.status,role:`status`,children:De}):K.length===0&&!q?h(`div`,{className:s.status,role:`status`,children:Ee}):null]}),h(`span`,{className:s[`sr-only`],role:`status`,"aria-live":`polite`,children:H?m(p.multiSelect.selectionChanged,{count:String(U.length),total:String(_.length)}):``}),x&&h(`span`,{id:`${M}-error`,className:s.error,role:`alert`,children:x}),!x&&b&&h(`span`,{id:`${M}-hint`,className:s.hint,children:b})]})}export{MultiSelect};
@@ -1,15 +1 @@
1
- var e = {
2
- wrapper: "_wrapper_o9vhb_2",
3
- trigger: "_trigger_o9vhb_12",
4
- "trigger-label": "_trigger-label_o9vhb_51",
5
- chevron: "_chevron_o9vhb_63",
6
- panel: "_panel_o9vhb_83",
7
- "search-row": "_search-row_o9vhb_128",
8
- search: "_search_o9vhb_128",
9
- options: "_options_o9vhb_149",
10
- option: "_option_o9vhb_149",
11
- checkbox: "_checkbox_o9vhb_177",
12
- "no-results": "_no-results_o9vhb_192"
13
- };
14
- //#endregion
15
- export { e as default };
1
+ var e={wrapper:`_wrapper_1vodk_2`,label:`_label_1vodk_14`,field:`_field_1vodk_21`,trigger:`_trigger_1vodk_37`,"trigger-label":`_trigger-label_1vodk_103`,chip:`_chip_1vodk_116`,"chip-label":`_chip-label_1vodk_130`,"chip-remove":`_chip-remove_1vodk_136`,clear:`_clear_1vodk_161`,"clear-glyph":`_clear-glyph_1vodk_181`,chevron:`_chevron_1vodk_193`,panel:`_panel_1vodk_213`,"search-row":`_search-row_1vodk_266`,search:`_search_1vodk_266`,"select-all":`_select-all_1vodk_287`,options:`_options_1vodk_308`,group:`_group_1vodk_318`,"group-label":`_group-label_1vodk_322`,option:`_option_1vodk_308`,"option-label":`_option-label_1vodk_360`,match:`_match_1vodk_367`,create:`_create_1vodk_374`,checkbox:`_checkbox_1vodk_379`,status:`_status_1vodk_402`,error:`_error_1vodk_411`,hint:`_hint_1vodk_412`,"sr-only":`_sr-only_1vodk_425`};export{e as default};
@@ -0,0 +1 @@
1
+ function foldChar(e){return(e.normalize(`NFD`)[0]??e).toLowerCase()}function fold(e){return Array.from(e,foldChar)}function defaultMatch(e,t){let n=fold(t).join(``);return n===``?!0:fold(e.label).join(``).includes(n)||fold(e.value).join(``).includes(n)}function filterOptions(e,t,n){let r=n??defaultMatch;return t===``&&!n?e:e.filter(e=>r(e,t))}function highlightSegments(e,t){let n=fold(t).join(``);if(n===``)return[{text:e,match:!1}];let r=Array.from(e),i=fold(e).join(``).indexOf(n);if(i===-1)return[{text:e,match:!1}];let a=Array.from(t).length,o=[],s=r.slice(0,i).join(``),c=r.slice(i,i+a).join(``),l=r.slice(i+a).join(``);return s!==``&&o.push({text:s,match:!1}),o.push({text:c,match:!0}),l!==``&&o.push({text:l,match:!1}),o}function groupOptions(e){let t=[],n=new Map;return e.forEach((e,r)=>{let i=e.group,a=n.get(i);a||(a={label:i,entries:[]},n.set(i,a),t.push(a)),a.entries.push({option:e,index:r})}),t.sort((e,t)=>Number(e.label!==void 0)-Number(t.label!==void 0))}function orderByGroup(e){return groupOptions(e).flatMap(e=>e.entries.map(e=>e.option))}function isNewLabel(e,t){let n=fold(t).join(``);return n===``?!1:!e.some(e=>fold(e.label).join(``)===n)}export{filterOptions,groupOptions,highlightSegments,isNewLabel,orderByGroup};
@@ -1,37 +1 @@
1
- import e from "./native-select.module.js";
2
- import { cn as t } from "@cascivo/core/pure";
3
- import { forwardRef as n } from "react";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- //#region ../components/src/native-select/native-select.tsx
6
- var a = n(function({ options: n, children: a, size: o = "md", invalid: s, disabled: c, placeholder: l, value: u, defaultValue: d, className: f, ...p }, m) {
7
- let h = u !== void 0, g = l !== void 0;
8
- return /* @__PURE__ */ i("div", {
9
- className: t(e.root, f),
10
- "data-size": o,
11
- "data-invalid": s || void 0,
12
- children: [/* @__PURE__ */ i("select", {
13
- ref: m,
14
- className: e.select,
15
- disabled: c,
16
- "aria-invalid": s || void 0,
17
- value: u,
18
- defaultValue: !h && g ? d ?? "" : d,
19
- ...p,
20
- children: [g && /* @__PURE__ */ r("option", {
21
- value: "",
22
- disabled: !0,
23
- hidden: !0,
24
- children: l
25
- }), n ? n.map((e) => /* @__PURE__ */ r("option", {
26
- value: e.value,
27
- disabled: e.disabled,
28
- children: e.label
29
- }, e.value)) : a]
30
- }), /* @__PURE__ */ r("span", {
31
- className: e.chevron,
32
- "aria-hidden": "true"
33
- })]
34
- });
35
- });
36
- //#endregion
37
- export { a as NativeSelect };
1
+ import e from"./native-select.module.js";import{cn as t}from"@cascivo/core/pure";import{forwardRef as n}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=n(function({options:n,children:a,size:o=`md`,invalid:s,disabled:c,placeholder:l,value:u,defaultValue:d,className:f,...p},m){let h=u!==void 0,g=l!==void 0;return i(`div`,{className:t(e.root,f),"data-size":o,"data-invalid":s||void 0,children:[i(`select`,{ref:m,className:e.select,disabled:c,"aria-invalid":s||void 0,value:u,defaultValue:!h&&g?d??``:d,...p,children:[g&&r(`option`,{value:``,disabled:!0,hidden:!0,children:l}),n?n.map(e=>r(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value)):a]}),r(`span`,{className:e.chevron,"aria-hidden":`true`})]})});export{a as NativeSelect};
@@ -1,7 +1 @@
1
- var e = {
2
- root: "_root_1s4kv_2",
3
- select: "_select_1s4kv_24",
4
- chevron: "_chevron_1s4kv_66"
5
- };
6
- //#endregion
7
- export { e as default };
1
+ var e={root:`_root_1g3i3_2`,select:`_select_1g3i3_24`,chevron:`_chevron_1g3i3_66`};export{e as default};
@@ -1,99 +1 @@
1
- "use client";
2
-
3
- import e from "./navigation-menu.module.js";
4
- import { useId as t, useRef as n } from "react";
5
- import { DismissableLayer as r, Presence as i, cn as a, focusElement as o, getLinkComponent as s, useAnchorPosition as c, useRovingFocus as l, useSignal as u, useSignals as d } from "@cascivo/core";
6
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
7
- //#region ../components/src/navigation-menu/navigation-menu.tsx
8
- function m({ items: n, "aria-label": r, ariaLabel: i, label: o, orientation: s = "horizontal", className: c }) {
9
- d();
10
- let p = t(), m = u(null), g = l({
11
- orientation: s,
12
- loop: !0
13
- });
14
- return /* @__PURE__ */ f("nav", {
15
- "aria-label": i ?? r ?? o,
16
- className: a(e.nav, c),
17
- "data-orientation": s,
18
- children: /* @__PURE__ */ f("ul", {
19
- role: "list",
20
- className: e.list,
21
- children: n.map((e, t) => /* @__PURE__ */ f(h, {
22
- item: e,
23
- baseId: p,
24
- openId: m,
25
- itemProps: g.getItemProps(t)
26
- }, e.id))
27
- })
28
- });
29
- }
30
- function h({ item: t, baseId: r, openId: a, itemProps: l }) {
31
- d();
32
- let u = n(null), m = n(null), h = t.content != null, _ = a.value === t.id, v = `${r}-panel-${t.id}`, { anchorStyle: y, floatingStyle: b } = c({
33
- anchorRef: u,
34
- floatingRef: m,
35
- placement: "bottom-start",
36
- enabled: _
37
- }), { ref: x, onKeyDown: S, ...C } = l;
38
- if (!h) {
39
- let n = s();
40
- return /* @__PURE__ */ f("li", {
41
- className: e.item,
42
- children: /* @__PURE__ */ f(n, {
43
- ref: (e) => x(e),
44
- href: t.href,
45
- className: e.link,
46
- onKeyDown: S,
47
- ...C,
48
- children: t.label
49
- })
50
- });
51
- }
52
- return /* @__PURE__ */ p("li", {
53
- className: e.item,
54
- children: [/* @__PURE__ */ f("button", {
55
- ref: (e) => {
56
- u.current = e, x(e);
57
- },
58
- type: "button",
59
- "aria-expanded": _,
60
- "aria-controls": v,
61
- "data-state": _ ? "open" : "closed",
62
- className: e.trigger,
63
- style: y,
64
- onClick: () => {
65
- a.value = _ ? null : t.id;
66
- },
67
- onKeyDown: (e) => {
68
- S(e), !e.defaultPrevented && e.key === "Escape" && (a.value = null);
69
- },
70
- ...C,
71
- children: t.label
72
- }), /* @__PURE__ */ f(i, {
73
- present: _,
74
- children: /* @__PURE__ */ f(g, {
75
- panelId: v,
76
- floatingRef: m,
77
- floatingStyle: b,
78
- onClose: () => {
79
- a.value = null, o(u.current);
80
- },
81
- children: t.content
82
- })
83
- })]
84
- });
85
- }
86
- function g({ panelId: t, floatingRef: n, floatingStyle: i, onClose: a, children: o }) {
87
- return /* @__PURE__ */ f(r, {
88
- onDismiss: a,
89
- children: /* @__PURE__ */ f("div", {
90
- ref: n,
91
- id: t,
92
- className: e.panel,
93
- style: i,
94
- children: o
95
- })
96
- });
97
- }
98
- //#endregion
99
- export { m as NavigationMenu };
1
+ "use client";import e from"./navigation-menu.module.js";import{useId as t,useRef as n}from"react";import{DismissableLayer as r,Presence as i,cn as a,focusElement as o,getLinkComponent as s,useAnchorPosition as c,useRovingFocus as l,useSignal as u,useSignals as d}from"@cascivo/core";import{jsx as f,jsxs as p}from"react/jsx-runtime";function NavigationMenu({items:n,"aria-label":r,ariaLabel:i,label:o,orientation:s=`horizontal`,className:c}){d();let p=t(),m=u(null),h=l({orientation:s,loop:!0});return f(`nav`,{"aria-label":i??r??o,className:a(e.nav,c),"data-orientation":s,children:f(`ul`,{role:`list`,className:e.list,children:n.map((e,t)=>f(NavigationMenuEntry,{item:e,baseId:p,openId:m,itemProps:h.getItemProps(t)},e.id))})})}function NavigationMenuEntry({item:t,baseId:r,openId:a,itemProps:l}){d();let u=n(null),m=n(null),h=t.content!=null,g=a.value===t.id,_=`${r}-panel-${t.id}`,{anchorStyle:v,floatingStyle:y}=c({anchorRef:u,floatingRef:m,placement:`bottom-start`,enabled:g}),{ref:b,onKeyDown:x,...S}=l;if(!h){let n=s();return f(`li`,{className:e.item,children:f(n,{ref:e=>b(e),href:t.href,className:e.link,onKeyDown:x,...S,children:t.label})})}return p(`li`,{className:e.item,children:[f(`button`,{ref:e=>{u.current=e,b(e)},type:`button`,"aria-expanded":g,"aria-controls":_,"data-state":g?`open`:`closed`,className:e.trigger,style:v,onClick:()=>{a.value=g?null:t.id},onKeyDown:e=>{x(e),!e.defaultPrevented&&e.key===`Escape`&&(a.value=null)},...S,children:t.label}),f(i,{present:g,children:f(NavigationMenuPanel,{panelId:_,floatingRef:m,floatingStyle:y,onClose:()=>{a.value=null,o(u.current)},children:t.content})})]})}function NavigationMenuPanel({panelId:t,floatingRef:n,floatingStyle:i,onClose:a,children:o}){return f(r,{onDismiss:a,children:f(`div`,{ref:n,id:t,className:e.panel,style:i,children:o})})}export{NavigationMenu};
@@ -1,10 +1 @@
1
- var e = {
2
- nav: "_nav_1k4lc_2",
3
- list: "_list_1k4lc_6",
4
- item: "_item_1k4lc_20",
5
- link: "_link_1k4lc_24",
6
- trigger: "_trigger_1k4lc_25",
7
- panel: "_panel_1k4lc_50"
8
- };
9
- //#endregion
10
- export { e as default };
1
+ var e={nav:`_nav_1k4lc_2`,list:`_list_1k4lc_6`,item:`_item_1k4lc_20`,link:`_link_1k4lc_24`,trigger:`_trigger_1k4lc_25`,panel:`_panel_1k4lc_50`};export{e as default};
@@ -1,140 +1 @@
1
- "use client";
2
-
3
- import e from "./notification.module.js";
4
- import { useRef as t } from "react";
5
- import { Presence as n, cn as r, normalizeTone as i, useSignal as a, useSignals as o } from "@cascivo/core";
6
- import { builtin as s, t as c } from "@cascivo/i18n";
7
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
- //#region ../components/src/notification/notification.tsx
9
- var d = {
10
- neutral: "neutral",
11
- info: "info",
12
- success: "success",
13
- warning: "warning",
14
- danger: "error"
15
- }, f = new Set(["warning", "error"]), p = 160;
16
- function m({ variant: e }) {
17
- return e === "success" ? /* @__PURE__ */ u("svg", {
18
- viewBox: "0 0 20 20",
19
- width: "20",
20
- height: "20",
21
- fill: "none",
22
- "aria-hidden": "true",
23
- children: [/* @__PURE__ */ l("circle", {
24
- cx: "10",
25
- cy: "10",
26
- r: "8",
27
- stroke: "currentColor",
28
- strokeWidth: "1.5"
29
- }), /* @__PURE__ */ l("path", {
30
- d: "M6.5 10.5l2.5 2.5 4.5-5",
31
- stroke: "currentColor",
32
- strokeWidth: "1.5",
33
- strokeLinecap: "round",
34
- strokeLinejoin: "round"
35
- })]
36
- }) : e === "warning" ? /* @__PURE__ */ u("svg", {
37
- viewBox: "0 0 20 20",
38
- width: "20",
39
- height: "20",
40
- fill: "none",
41
- "aria-hidden": "true",
42
- children: [/* @__PURE__ */ l("path", {
43
- d: "M10 2.5L18.5 17H1.5L10 2.5z",
44
- stroke: "currentColor",
45
- strokeWidth: "1.5",
46
- strokeLinejoin: "round"
47
- }), /* @__PURE__ */ l("path", {
48
- d: "M10 8v3.5M10 14h.01",
49
- stroke: "currentColor",
50
- strokeWidth: "1.5",
51
- strokeLinecap: "round"
52
- })]
53
- }) : e === "error" ? /* @__PURE__ */ u("svg", {
54
- viewBox: "0 0 20 20",
55
- width: "20",
56
- height: "20",
57
- fill: "none",
58
- "aria-hidden": "true",
59
- children: [/* @__PURE__ */ l("circle", {
60
- cx: "10",
61
- cy: "10",
62
- r: "8",
63
- stroke: "currentColor",
64
- strokeWidth: "1.5"
65
- }), /* @__PURE__ */ l("path", {
66
- d: "M10 6v4.5M10 13.5h.01",
67
- stroke: "currentColor",
68
- strokeWidth: "1.5",
69
- strokeLinecap: "round"
70
- })]
71
- }) : /* @__PURE__ */ u("svg", {
72
- viewBox: "0 0 20 20",
73
- width: "20",
74
- height: "20",
75
- fill: "none",
76
- "aria-hidden": "true",
77
- children: [/* @__PURE__ */ l("circle", {
78
- cx: "10",
79
- cy: "10",
80
- r: "8",
81
- stroke: "currentColor",
82
- strokeWidth: "1.5"
83
- }), /* @__PURE__ */ l("path", {
84
- d: "M10 9v5M10 6.5h.01",
85
- stroke: "currentColor",
86
- strokeWidth: "1.5",
87
- strokeLinecap: "round"
88
- })]
89
- });
90
- }
91
- function h({ title: h, description: g, variant: _ = "info", dismissible: v = !1, onDismiss: y, actions: b, icon: x, labels: S, className: C, ...w }) {
92
- o();
93
- let T = d[i(_)] ?? _, E = a(!0), D = t(y);
94
- D.current = y;
95
- let O = v || y !== void 0, k = () => {
96
- E.value = !1, setTimeout(() => D.current?.(), p);
97
- };
98
- return /* @__PURE__ */ l(n, {
99
- present: E,
100
- children: /* @__PURE__ */ u("div", {
101
- role: f.has(T) ? "alert" : "status",
102
- "data-variant": T,
103
- className: r(e.notification, C),
104
- ...w,
105
- children: [
106
- /* @__PURE__ */ l("span", {
107
- className: e.icon,
108
- "aria-hidden": "true",
109
- children: x ?? /* @__PURE__ */ l(m, { variant: T })
110
- }),
111
- /* @__PURE__ */ u("div", {
112
- className: e.body,
113
- children: [
114
- /* @__PURE__ */ l("div", {
115
- className: e.title,
116
- children: h
117
- }),
118
- g && /* @__PURE__ */ l("div", {
119
- className: e.description,
120
- children: g
121
- }),
122
- b && /* @__PURE__ */ l("div", {
123
- className: e.actions,
124
- children: b
125
- })
126
- ]
127
- }),
128
- O && /* @__PURE__ */ l("button", {
129
- type: "button",
130
- className: e.dismiss,
131
- "aria-label": S?.dismiss ?? c(s.notification.dismiss),
132
- onClick: k,
133
- children: "✕"
134
- })
135
- ]
136
- })
137
- });
138
- }
139
- //#endregion
140
- export { h as Notification };
1
+ "use client";import e from"./notification.module.js";import{useRef as t}from"react";import{Presence as n,cn as r,normalizeTone as i,useSignal as a,useSignals as o}from"@cascivo/core";import{builtin as s,t as c}from"@cascivo/i18n";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d={neutral:`neutral`,info:`info`,success:`success`,warning:`warning`,danger:`error`},f=new Set([`warning`,`error`]),p=160;function VariantIcon({variant:e}){return e===`success`?u(`svg`,{viewBox:`0 0 20 20`,width:`20`,height:`20`,fill:`none`,"aria-hidden":`true`,children:[l(`circle`,{cx:`10`,cy:`10`,r:`8`,stroke:`currentColor`,strokeWidth:`1.5`}),l(`path`,{d:`M6.5 10.5l2.5 2.5 4.5-5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}):e===`warning`?u(`svg`,{viewBox:`0 0 20 20`,width:`20`,height:`20`,fill:`none`,"aria-hidden":`true`,children:[l(`path`,{d:`M10 2.5L18.5 17H1.5L10 2.5z`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinejoin:`round`}),l(`path`,{d:`M10 8v3.5M10 14h.01`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})]}):e===`error`?u(`svg`,{viewBox:`0 0 20 20`,width:`20`,height:`20`,fill:`none`,"aria-hidden":`true`,children:[l(`circle`,{cx:`10`,cy:`10`,r:`8`,stroke:`currentColor`,strokeWidth:`1.5`}),l(`path`,{d:`M10 6v4.5M10 13.5h.01`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})]}):u(`svg`,{viewBox:`0 0 20 20`,width:`20`,height:`20`,fill:`none`,"aria-hidden":`true`,children:[l(`circle`,{cx:`10`,cy:`10`,r:`8`,stroke:`currentColor`,strokeWidth:`1.5`}),l(`path`,{d:`M10 9v5M10 6.5h.01`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})]})}function Notification({title:m,description:h,variant:g=`info`,dismissible:_=!1,onDismiss:v,actions:y,icon:b,labels:x,className:S,...C}){o();let w=d[i(g)]??g,T=a(!0),E=t(v);E.current=v;let D=_||v!==void 0,dismiss=()=>{T.value=!1,setTimeout(()=>E.current?.(),p)};return l(n,{present:T,children:u(`div`,{role:f.has(w)?`alert`:`status`,"data-variant":w,className:r(e.notification,S),...C,children:[l(`span`,{className:e.icon,"aria-hidden":`true`,children:b??l(VariantIcon,{variant:w})}),u(`div`,{className:e.body,children:[l(`div`,{className:e.title,children:m}),h&&l(`div`,{className:e.description,children:h}),y&&l(`div`,{className:e.actions,children:y})]}),D&&l(`button`,{type:`button`,className:e.dismiss,"aria-label":x?.dismiss??c(s.notification.dismiss),onClick:dismiss,children:`✕`})]})})}export{Notification};
@@ -1,11 +1 @@
1
- var e = {
2
- notification: "_notification_imxvx_2",
3
- icon: "_icon_imxvx_65",
4
- body: "_body_imxvx_86",
5
- title: "_title_imxvx_94",
6
- description: "_description_imxvx_100",
7
- actions: "_actions_imxvx_106",
8
- dismiss: "_dismiss_imxvx_113"
9
- };
10
- //#endregion
11
- export { e as default };
1
+ var e={notification:`_notification_imxvx_2`,icon:`_icon_imxvx_65`,body:`_body_imxvx_86`,title:`_title_imxvx_94`,description:`_description_imxvx_100`,actions:`_actions_imxvx_106`,dismiss:`_dismiss_imxvx_113`};export{e as default};
@@ -1,148 +1 @@
1
- "use client";
2
-
3
- import e from "./number-input.module.js";
4
- import { forwardRef as t } from "react";
5
- import { cn as n, createMachine as r, useMachine as i, useSignal as a, useSignals as o } from "@cascivo/core";
6
- import { builtin as s, t as c } from "@cascivo/i18n";
7
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
- //#region ../components/src/number-input/number-input.tsx
9
- var d = r({
10
- initial: "idle",
11
- states: {
12
- idle: { on: { FOCUS: "focused" } },
13
- focused: { on: { BLUR: "idle" } }
14
- }
15
- });
16
- function f(e, t, n) {
17
- let r = e;
18
- return t !== void 0 && (r = Math.max(r, t)), n !== void 0 && (r = Math.min(r, n)), r;
19
- }
20
- function p(e) {
21
- let t = String(e), n = t.indexOf(".");
22
- return n === -1 ? 0 : t.length - n - 1;
23
- }
24
- function m(e, t) {
25
- let n = 10 ** t;
26
- return Math.round(e * n) / n;
27
- }
28
- function h(e) {
29
- let t = e.trim();
30
- if (t === "") return null;
31
- let n = Number(t);
32
- return Number.isFinite(n) ? n : null;
33
- }
34
- var g = t(function({ value: t, defaultValue: r, onValueChange: g, min: _, max: v, step: y = 1, precision: b, formatOptions: x, label: S, hint: C, error: w, size: T = "md", disabled: E, incrementLabel: D, decrementLabel: O, className: k, id: A, onFocus: j, onBlur: M, onKeyDown: N, ariaLabel: P, ...F }, I) {
35
- o();
36
- let L = D ?? c(s.numberInput.increment), R = O ?? c(s.numberInput.decrement), [z, B] = i(d), V = t !== void 0, H = a(r ?? null), U = a(""), W = V ? t : H.value, G = A ?? (S ? `cascade-number-input-${S.toLowerCase().replace(/\s+/g, "-")}` : void 0), K = (e) => {
37
- V || (H.value = e), U.value = e == null ? "" : String(e), e !== W && g?.(e);
38
- }, q = () => {
39
- let e = h(U.value);
40
- e != null && (e = f(e, _, v), b !== void 0 && (e = m(e, b))), K(e);
41
- }, J = (e) => {
42
- let t = (z.value === "focused" ? h(U.value) : W) ?? 0, n = b ?? Math.max(p(y), p(t));
43
- K(f(m(t + e * y, n), _, v));
44
- }, Y = z.value === "focused" ? U.value : ((e) => e == null ? "" : x ? new Intl.NumberFormat(void 0, x).format(e) : String(e))(W), X = W != null && v !== void 0 && W >= v, Z = W != null && _ !== void 0 && W <= _;
45
- return /* @__PURE__ */ u("div", {
46
- className: n(e.wrapper, k),
47
- "data-state": w ? "error" : z.value,
48
- "data-size": T,
49
- children: [
50
- S && /* @__PURE__ */ l("label", {
51
- className: e.label,
52
- htmlFor: G,
53
- children: S
54
- }),
55
- /* @__PURE__ */ u("div", {
56
- className: e.field,
57
- children: [/* @__PURE__ */ l("input", {
58
- id: G,
59
- type: "text",
60
- inputMode: "decimal",
61
- autoComplete: "off",
62
- role: "spinbutton",
63
- className: e.input,
64
- value: Y,
65
- disabled: E,
66
- "aria-valuenow": W ?? void 0,
67
- "aria-valuemin": _,
68
- "aria-valuemax": v,
69
- "aria-invalid": w ? !0 : void 0,
70
- "aria-describedby": w ? `${G}-error` : C ? `${G}-hint` : void 0,
71
- onChange: (e) => {
72
- U.value = e.target.value;
73
- },
74
- onFocus: (e) => {
75
- U.value = W == null ? "" : String(W), B("FOCUS"), j?.(e);
76
- },
77
- onBlur: (e) => {
78
- q(), B("BLUR"), M?.(e);
79
- },
80
- onKeyDown: (e) => {
81
- e.key === "ArrowUp" ? (e.preventDefault(), J(1)) : e.key === "ArrowDown" ? (e.preventDefault(), J(-1)) : e.key === "Enter" && q(), N?.(e);
82
- },
83
- ref: I,
84
- ...F,
85
- "aria-label": F["aria-label"] ?? P
86
- }), /* @__PURE__ */ u("div", {
87
- className: e.steppers,
88
- children: [/* @__PURE__ */ l("button", {
89
- type: "button",
90
- className: e.stepper,
91
- "aria-label": L,
92
- tabIndex: -1,
93
- disabled: E || X,
94
- onMouseDown: (e) => e.preventDefault(),
95
- onClick: () => J(1),
96
- children: /* @__PURE__ */ l("svg", {
97
- viewBox: "0 0 10 10",
98
- "aria-hidden": "true",
99
- focusable: "false",
100
- children: /* @__PURE__ */ l("path", {
101
- d: "M2 6.5 5 3.5 8 6.5",
102
- fill: "none",
103
- stroke: "currentColor",
104
- strokeWidth: "1.5",
105
- strokeLinecap: "round",
106
- strokeLinejoin: "round"
107
- })
108
- })
109
- }), /* @__PURE__ */ l("button", {
110
- type: "button",
111
- className: e.stepper,
112
- "aria-label": R,
113
- tabIndex: -1,
114
- disabled: E || Z,
115
- onMouseDown: (e) => e.preventDefault(),
116
- onClick: () => J(-1),
117
- children: /* @__PURE__ */ l("svg", {
118
- viewBox: "0 0 10 10",
119
- "aria-hidden": "true",
120
- focusable: "false",
121
- children: /* @__PURE__ */ l("path", {
122
- d: "M2 3.5 5 6.5 8 3.5",
123
- fill: "none",
124
- stroke: "currentColor",
125
- strokeWidth: "1.5",
126
- strokeLinecap: "round",
127
- strokeLinejoin: "round"
128
- })
129
- })
130
- })]
131
- })]
132
- }),
133
- w && /* @__PURE__ */ l("span", {
134
- id: `${G}-error`,
135
- className: e.error,
136
- role: "alert",
137
- children: w
138
- }),
139
- !w && C && /* @__PURE__ */ l("span", {
140
- id: `${G}-hint`,
141
- className: e.hint,
142
- children: C
143
- })
144
- ]
145
- });
146
- });
147
- //#endregion
148
- export { g as NumberInput };
1
+ "use client";import e from"./number-input.module.js";import{forwardRef as t}from"react";import{cn as n,createMachine as r,useMachine as i,useSignal as a,useSignals as o}from"@cascivo/core";import{builtin as s,t as c}from"@cascivo/i18n";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d=r({initial:`idle`,states:{idle:{on:{FOCUS:`focused`}},focused:{on:{BLUR:`idle`}}}});function clamp(e,t,n){let r=e;return t!==void 0&&(r=Math.max(r,t)),n!==void 0&&(r=Math.min(r,n)),r}function decimalsOf(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}function roundTo(e,t){let n=10**t;return Math.round(e*n)/n}function parseText(e){let t=e.trim();if(t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}var f=t(function({value:t,defaultValue:r,onValueChange:f,min:p,max:m,step:h=1,precision:g,formatOptions:_,label:v,hint:y,error:b,size:x=`md`,disabled:S,incrementLabel:C,decrementLabel:w,className:T,id:E,onFocus:D,onBlur:O,onKeyDown:k,ariaLabel:A,...j},M){o();let N=C??c(s.numberInput.increment),P=w??c(s.numberInput.decrement),[F,I]=i(d),L=t!==void 0,R=a(r??null),z=a(``),B=L?t:R.value,V=E??(v?`cascade-number-input-${v.toLowerCase().replace(/\s+/g,`-`)}`:void 0),setValue=e=>{L||(R.value=e),z.value=e==null?``:String(e),e!==B&&f?.(e)},commitText=()=>{let e=parseText(z.value);e!=null&&(e=clamp(e,p,m),g!==void 0&&(e=roundTo(e,g))),setValue(e)},stepBy=e=>{let t=(F.value===`focused`?parseText(z.value):B)??0,n=g??Math.max(decimalsOf(h),decimalsOf(t));setValue(clamp(roundTo(t+e*h,n),p,m))},H=F.value===`focused`?z.value:(e=>e==null?``:_?new Intl.NumberFormat(void 0,_).format(e):String(e))(B),U=B!=null&&m!==void 0&&B>=m,W=B!=null&&p!==void 0&&B<=p;return u(`div`,{className:n(e.wrapper,T),"data-state":b?`error`:F.value,"data-size":x,children:[v&&l(`label`,{className:e.label,htmlFor:V,children:v}),u(`div`,{className:e.field,children:[l(`input`,{id:V,type:`text`,inputMode:`decimal`,autoComplete:`off`,role:`spinbutton`,className:e.input,value:H,disabled:S,"aria-valuenow":B??void 0,"aria-valuemin":p,"aria-valuemax":m,"aria-invalid":b?!0:void 0,"aria-describedby":b?`${V}-error`:y?`${V}-hint`:void 0,onChange:e=>{z.value=e.target.value},onFocus:e=>{z.value=B==null?``:String(B),I(`FOCUS`),D?.(e)},onBlur:e=>{commitText(),I(`BLUR`),O?.(e)},onKeyDown:e=>{e.key===`ArrowUp`?(e.preventDefault(),stepBy(1)):e.key===`ArrowDown`?(e.preventDefault(),stepBy(-1)):e.key===`Enter`&&commitText(),k?.(e)},ref:M,...j,"aria-label":j[`aria-label`]??A}),u(`div`,{className:e.steppers,children:[l(`button`,{type:`button`,className:e.stepper,"aria-label":N,tabIndex:-1,disabled:S||U,onMouseDown:e=>e.preventDefault(),onClick:()=>stepBy(1),children:l(`svg`,{viewBox:`0 0 10 10`,"aria-hidden":`true`,focusable:`false`,children:l(`path`,{d:`M2 6.5 5 3.5 8 6.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),l(`button`,{type:`button`,className:e.stepper,"aria-label":P,tabIndex:-1,disabled:S||W,onMouseDown:e=>e.preventDefault(),onClick:()=>stepBy(-1),children:l(`svg`,{viewBox:`0 0 10 10`,"aria-hidden":`true`,focusable:`false`,children:l(`path`,{d:`M2 3.5 5 6.5 8 3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})})]})]}),b&&l(`span`,{id:`${V}-error`,className:e.error,role:`alert`,children:b}),!b&&y&&l(`span`,{id:`${V}-hint`,className:e.hint,children:y})]})});export{f as NumberInput};
@@ -1,12 +1 @@
1
- var e = {
2
- wrapper: "_wrapper_aavdw_2",
3
- label: "_label_aavdw_31",
4
- field: "_field_aavdw_39",
5
- input: "_input_aavdw_43",
6
- steppers: "_steppers_aavdw_88",
7
- stepper: "_stepper_aavdw_88",
8
- error: "_error_aavdw_135",
9
- hint: "_hint_aavdw_142"
10
- };
11
- //#endregion
12
- export { e as default };
1
+ var e={wrapper:`_wrapper_aavdw_2`,label:`_label_aavdw_31`,field:`_field_aavdw_39`,input:`_input_aavdw_43`,steppers:`_steppers_aavdw_88`,stepper:`_stepper_aavdw_88`,error:`_error_aavdw_135`,hint:`_hint_aavdw_142`};export{e as default};