@devalok/shilp-sutra 0.57.0 → 0.60.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 (288) hide show
  1. package/MIGRATION.md +163 -0
  2. package/dist/_chunks/badge-group.js +75 -188
  3. package/dist/_chunks/badge-group.js.map +1 -1
  4. package/dist/_chunks/chat.js +244 -243
  5. package/dist/_chunks/chat.js.map +1 -1
  6. package/dist/_chunks/image-preview.js +71 -70
  7. package/dist/_chunks/image-preview.js.map +1 -1
  8. package/dist/_chunks/motion-preference.js +15 -0
  9. package/dist/_chunks/motion-preference.js.map +1 -0
  10. package/dist/_chunks/motion-provider.js +1 -1
  11. package/dist/_chunks/motion-provider.js.map +1 -1
  12. package/dist/_chunks/popover.js +50 -49
  13. package/dist/_chunks/popover.js.map +1 -1
  14. package/dist/_chunks/primitives-internal.js +29 -29
  15. package/dist/_chunks/primitives-internal.js.map +1 -1
  16. package/dist/_chunks/shared.js +48 -47
  17. package/dist/_chunks/shared.js.map +1 -1
  18. package/dist/_chunks/success.js +34 -34
  19. package/dist/_chunks/tree-view.js +1 -1
  20. package/dist/_chunks/tree-view.js.map +1 -1
  21. package/dist/ai/block-renderer.js +8 -8
  22. package/dist/ai/command-bar.js +65 -65
  23. package/dist/ai/command-bar.js.map +1 -1
  24. package/dist/ai/conversation.js +35 -35
  25. package/dist/ai/conversation.js.map +1 -1
  26. package/dist/ai/index.js +4 -4
  27. package/dist/composed/activity-feed.d.ts.map +1 -1
  28. package/dist/composed/activity-feed.js +108 -107
  29. package/dist/composed/activity-feed.js.map +1 -1
  30. package/dist/composed/avatar-group.js +3 -3
  31. package/dist/composed/avatar-group.js.map +1 -1
  32. package/dist/composed/bulk-action-bar.d.ts +9 -35
  33. package/dist/composed/bulk-action-bar.d.ts.map +1 -1
  34. package/dist/composed/bulk-action-bar.js +2 -139
  35. package/dist/composed/command-palette.js +137 -137
  36. package/dist/composed/command-palette.js.map +1 -1
  37. package/dist/composed/content-card.js +1 -1
  38. package/dist/composed/content-card.js.map +1 -1
  39. package/dist/composed/date-picker/index.js +5 -5
  40. package/dist/composed/date-picker/index.js.map +1 -1
  41. package/dist/composed/empty-state.js +4 -4
  42. package/dist/composed/file-preview/image-preview.d.ts.map +1 -1
  43. package/dist/composed/file-preview/shared.d.ts.map +1 -1
  44. package/dist/composed/file-preview/video-preview.d.ts.map +1 -1
  45. package/dist/composed/file-preview.js +151 -150
  46. package/dist/composed/file-preview.js.map +1 -1
  47. package/dist/composed/filter-bar.d.ts.map +1 -1
  48. package/dist/composed/filter-bar.js +53 -52
  49. package/dist/composed/filter-bar.js.map +1 -1
  50. package/dist/composed/form-section.d.ts.map +1 -1
  51. package/dist/composed/form-section.js +38 -37
  52. package/dist/composed/form-section.js.map +1 -1
  53. package/dist/composed/index.js +6 -5
  54. package/dist/composed/master-detail.d.ts.map +1 -1
  55. package/dist/composed/master-detail.js +1 -1
  56. package/dist/composed/master-detail.js.map +1 -1
  57. package/dist/composed/multi-select-popover.d.ts.map +1 -1
  58. package/dist/composed/multi-select-popover.js +109 -108
  59. package/dist/composed/multi-select-popover.js.map +1 -1
  60. package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
  61. package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -1
  62. package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
  63. package/dist/composed/rich-chat-input.d.ts.map +1 -1
  64. package/dist/composed/rich-chat-input.js +467 -466
  65. package/dist/composed/rich-chat-input.js.map +1 -1
  66. package/dist/composed/rich-text-editor.js +3 -3
  67. package/dist/composed/rich-text-editor.js.map +1 -1
  68. package/dist/composed/schedule-view.js +2 -2
  69. package/dist/composed/schedule-view.js.map +1 -1
  70. package/dist/composed/status-badge.d.ts.map +1 -1
  71. package/dist/composed/status-badge.js +29 -28
  72. package/dist/composed/status-badge.js.map +1 -1
  73. package/dist/motion/index.d.ts +1 -0
  74. package/dist/motion/index.d.ts.map +1 -1
  75. package/dist/motion/index.js +2 -15
  76. package/dist/motion/motion-preference.d.ts +36 -0
  77. package/dist/motion/motion-preference.d.ts.map +1 -0
  78. package/dist/motion/motion-provider.d.ts +2 -1
  79. package/dist/motion/motion-provider.d.ts.map +1 -1
  80. package/dist/motion/primitives-index.js +103 -102
  81. package/dist/motion/primitives-index.js.map +1 -1
  82. package/dist/motion/primitives.d.ts.map +1 -1
  83. package/dist/shell/bottom-navbar.js +19 -19
  84. package/dist/shell/bottom-navbar.js.map +1 -1
  85. package/dist/shell/index.d.ts +1 -1
  86. package/dist/shell/index.d.ts.map +1 -1
  87. package/dist/shell/notification-center.d.ts +17 -0
  88. package/dist/shell/notification-center.d.ts.map +1 -1
  89. package/dist/shell/notification-center.js +109 -104
  90. package/dist/shell/notification-center.js.map +1 -1
  91. package/dist/shell/notification-preferences.js +1 -1
  92. package/dist/shell/notification-preferences.js.map +1 -1
  93. package/dist/shell/top-bar.js +1 -1
  94. package/dist/shell/top-bar.js.map +1 -1
  95. package/dist/tokens/index.css +1 -0
  96. package/dist/tokens/palettes.css +292 -0
  97. package/dist/tokens/semantic.css +157 -11
  98. package/dist/tokens/shilp-sutra.css +1 -0
  99. package/dist/tokens/utilities.css +10 -7
  100. package/dist/ui/accordion.d.ts.map +1 -1
  101. package/dist/ui/accordion.js +27 -26
  102. package/dist/ui/accordion.js.map +1 -1
  103. package/dist/ui/alert-dialog.d.ts.map +1 -1
  104. package/dist/ui/alert-dialog.js +60 -59
  105. package/dist/ui/alert-dialog.js.map +1 -1
  106. package/dist/ui/alert.d.ts.map +1 -1
  107. package/dist/ui/alert.js +55 -113
  108. package/dist/ui/alert.js.map +1 -1
  109. package/dist/ui/autocomplete.js +80 -80
  110. package/dist/ui/autocomplete.js.map +1 -1
  111. package/dist/ui/avatar.d.ts.map +1 -1
  112. package/dist/ui/avatar.js +71 -70
  113. package/dist/ui/avatar.js.map +1 -1
  114. package/dist/ui/badge-indicator.d.ts +4 -8
  115. package/dist/ui/badge-indicator.d.ts.map +1 -1
  116. package/dist/ui/badge-indicator.js +3 -8
  117. package/dist/ui/badge-indicator.js.map +1 -1
  118. package/dist/ui/badge.d.ts +8 -1
  119. package/dist/ui/badge.d.ts.map +1 -1
  120. package/dist/ui/banner.d.ts.map +1 -1
  121. package/dist/ui/banner.js +42 -40
  122. package/dist/ui/banner.js.map +1 -1
  123. package/dist/ui/bulk-action-bar.d.ts +59 -0
  124. package/dist/ui/bulk-action-bar.d.ts.map +1 -0
  125. package/dist/ui/bulk-action-bar.js +145 -0
  126. package/dist/ui/bulk-action-bar.js.map +1 -0
  127. package/dist/ui/button-group.d.ts.map +1 -1
  128. package/dist/ui/button-group.js +3 -23
  129. package/dist/ui/button-group.js.map +1 -1
  130. package/dist/ui/button.d.ts +10 -1
  131. package/dist/ui/button.d.ts.map +1 -1
  132. package/dist/ui/button.js +79 -212
  133. package/dist/ui/button.js.map +1 -1
  134. package/dist/ui/card.d.ts.map +1 -1
  135. package/dist/ui/card.js +75 -72
  136. package/dist/ui/card.js.map +1 -1
  137. package/dist/ui/charts/radar-chart.d.ts.map +1 -1
  138. package/dist/ui/charts/radar-chart.js +1 -1
  139. package/dist/ui/charts/radar-chart.js.map +1 -1
  140. package/dist/ui/chat/message-list.d.ts.map +1 -1
  141. package/dist/ui/chat/message.d.ts.map +1 -1
  142. package/dist/ui/chat/typing-indicator.d.ts.map +1 -1
  143. package/dist/ui/checkbox.d.ts.map +1 -1
  144. package/dist/ui/checkbox.js +1 -1
  145. package/dist/ui/checkbox.js.map +1 -1
  146. package/dist/ui/code.js +1 -1
  147. package/dist/ui/code.js.map +1 -1
  148. package/dist/ui/color-input.d.ts.map +1 -1
  149. package/dist/ui/color-input.js +151 -150
  150. package/dist/ui/color-input.js.map +1 -1
  151. package/dist/ui/combobox.d.ts +14 -0
  152. package/dist/ui/combobox.d.ts.map +1 -1
  153. package/dist/ui/combobox.js +162 -158
  154. package/dist/ui/combobox.js.map +1 -1
  155. package/dist/ui/context-menu.d.ts.map +1 -1
  156. package/dist/ui/context-menu.js +70 -69
  157. package/dist/ui/context-menu.js.map +1 -1
  158. package/dist/ui/data-table-body.d.ts.map +1 -1
  159. package/dist/ui/data-table-body.js +4 -3
  160. package/dist/ui/data-table-body.js.map +1 -1
  161. package/dist/ui/data-table-bulk-actions.d.ts +26 -1
  162. package/dist/ui/data-table-bulk-actions.d.ts.map +1 -1
  163. package/dist/ui/data-table-bulk-actions.js +21 -46
  164. package/dist/ui/data-table-bulk-actions.js.map +1 -1
  165. package/dist/ui/data-table-context.d.ts +36 -2
  166. package/dist/ui/data-table-context.d.ts.map +1 -1
  167. package/dist/ui/data-table-context.js +25 -21
  168. package/dist/ui/data-table-context.js.map +1 -1
  169. package/dist/ui/data-table-header.d.ts.map +1 -1
  170. package/dist/ui/data-table-header.js +42 -40
  171. package/dist/ui/data-table-header.js.map +1 -1
  172. package/dist/ui/data-table-pagination.js +2 -2
  173. package/dist/ui/data-table-pagination.js.map +1 -1
  174. package/dist/ui/dialog.d.ts.map +1 -1
  175. package/dist/ui/dialog.js +61 -60
  176. package/dist/ui/dialog.js.map +1 -1
  177. package/dist/ui/dot.d.ts.map +1 -1
  178. package/dist/ui/dot.js +10 -41
  179. package/dist/ui/dot.js.map +1 -1
  180. package/dist/ui/dropdown-menu.d.ts.map +1 -1
  181. package/dist/ui/dropdown-menu.js +79 -78
  182. package/dist/ui/dropdown-menu.js.map +1 -1
  183. package/dist/ui/file-upload.d.ts.map +1 -1
  184. package/dist/ui/file-upload.js +116 -115
  185. package/dist/ui/file-upload.js.map +1 -1
  186. package/dist/ui/form.d.ts.map +1 -1
  187. package/dist/ui/form.js +27 -26
  188. package/dist/ui/form.js.map +1 -1
  189. package/dist/ui/hover-card.d.ts.map +1 -1
  190. package/dist/ui/hover-card.js +26 -25
  191. package/dist/ui/hover-card.js.map +1 -1
  192. package/dist/ui/icon.js +7 -7
  193. package/dist/ui/index.d.ts +3 -2
  194. package/dist/ui/index.d.ts.map +1 -1
  195. package/dist/ui/index.js +60 -59
  196. package/dist/ui/index.js.map +1 -1
  197. package/dist/ui/input.d.ts.map +1 -1
  198. package/dist/ui/input.js +7 -7
  199. package/dist/ui/input.js.map +1 -1
  200. package/dist/ui/menubar.d.ts.map +1 -1
  201. package/dist/ui/menubar.js +73 -72
  202. package/dist/ui/menubar.js.map +1 -1
  203. package/dist/ui/navigation-menu.d.ts.map +1 -1
  204. package/dist/ui/navigation-menu.js +80 -79
  205. package/dist/ui/navigation-menu.js.map +1 -1
  206. package/dist/ui/popover.d.ts.map +1 -1
  207. package/dist/ui/progress.d.ts.map +1 -1
  208. package/dist/ui/progress.js +72 -68
  209. package/dist/ui/progress.js.map +1 -1
  210. package/dist/ui/radio.d.ts.map +1 -1
  211. package/dist/ui/radio.js +35 -34
  212. package/dist/ui/radio.js.map +1 -1
  213. package/dist/ui/search-input.d.ts.map +1 -1
  214. package/dist/ui/search-input.js +28 -27
  215. package/dist/ui/search-input.js.map +1 -1
  216. package/dist/ui/select.d.ts.map +1 -1
  217. package/dist/ui/select.js +70 -69
  218. package/dist/ui/select.js.map +1 -1
  219. package/dist/ui/sidebar.d.ts.map +1 -1
  220. package/dist/ui/sidebar.js +4 -4
  221. package/dist/ui/sidebar.js.map +1 -1
  222. package/dist/ui/slider.d.ts +63 -9
  223. package/dist/ui/slider.d.ts.map +1 -1
  224. package/dist/ui/slider.js +74 -32
  225. package/dist/ui/slider.js.map +1 -1
  226. package/dist/ui/split-button.d.ts +8 -2
  227. package/dist/ui/split-button.d.ts.map +1 -1
  228. package/dist/ui/split-button.js +49 -95
  229. package/dist/ui/split-button.js.map +1 -1
  230. package/dist/ui/stat-card.d.ts.map +1 -1
  231. package/dist/ui/stat-card.js +89 -88
  232. package/dist/ui/stat-card.js.map +1 -1
  233. package/dist/ui/stat-flash.js +16 -16
  234. package/dist/ui/stepper.d.ts.map +1 -1
  235. package/dist/ui/stepper.js +63 -62
  236. package/dist/ui/stepper.js.map +1 -1
  237. package/dist/ui/switch.d.ts.map +1 -1
  238. package/dist/ui/switch.js +2 -2
  239. package/dist/ui/switch.js.map +1 -1
  240. package/dist/ui/table.d.ts.map +1 -1
  241. package/dist/ui/table.js +3 -3
  242. package/dist/ui/table.js.map +1 -1
  243. package/dist/ui/tabs.d.ts.map +1 -1
  244. package/dist/ui/tabs.js +67 -66
  245. package/dist/ui/tabs.js.map +1 -1
  246. package/dist/ui/textarea.d.ts.map +1 -1
  247. package/dist/ui/textarea.js +7 -7
  248. package/dist/ui/textarea.js.map +1 -1
  249. package/dist/ui/toast.d.ts.map +1 -1
  250. package/dist/ui/toast.js +196 -195
  251. package/dist/ui/toast.js.map +1 -1
  252. package/dist/ui/toggle.d.ts.map +1 -1
  253. package/dist/ui/toggle.js +24 -22
  254. package/dist/ui/toggle.js.map +1 -1
  255. package/dist/ui/tooltip.d.ts.map +1 -1
  256. package/dist/ui/tooltip.js +37 -36
  257. package/dist/ui/tooltip.js.map +1 -1
  258. package/dist/ui/tree-view/tree-item.d.ts.map +1 -1
  259. package/docs/components/composed/bulk-action-bar.md +14 -7
  260. package/docs/components/ui/bulk-action-bar.md +72 -0
  261. package/docs/recipes/customize-brand.md +58 -0
  262. package/docs/recipes/install-astro.md +1 -1
  263. package/docs/recipes/install-next-app-router.md +1 -1
  264. package/docs/recipes/install-next-pages.md +22 -1
  265. package/docs/recipes/install-remix.md +1 -1
  266. package/docs/recipes/install-tanstack-start.md +1 -1
  267. package/docs/recipes/install-vite.md +2 -1
  268. package/docs/recipes/server-components.md +7 -4
  269. package/docs/recipes/troubleshoot.md +1 -0
  270. package/llms.txt +2 -2
  271. package/make-kit/foundations/color.md +3 -1
  272. package/mcp-manifest.json +184 -151
  273. package/package.json +8 -2
  274. package/skill/SKILL.md +1 -1
  275. package/skill/references/components.md +2 -2
  276. package/skill/references/customize-brand.md +58 -0
  277. package/skill/references/server-components.md +7 -4
  278. package/skill/references/setup-astro.md +1 -1
  279. package/skill/references/setup-next-app-router.md +1 -1
  280. package/skill/references/setup-next-pages.md +22 -1
  281. package/skill/references/setup-remix.md +1 -1
  282. package/skill/references/setup-tanstack-start.md +1 -1
  283. package/skill/references/setup-vite.md +2 -1
  284. package/skill/references/troubleshoot.md +1 -0
  285. package/dist/composed/bulk-action-bar.js.map +0 -1
  286. package/dist/motion/check-motion-provider.d.ts +0 -2
  287. package/dist/motion/check-motion-provider.d.ts.map +0 -1
  288. package/dist/motion/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"alert-dialog.js","names":[],"sources":["../../src/ui/alert-dialog.tsx"],"sourcesContent":["'use client'\n\nimport * as AlertDialogPrimitive from '@primitives/react-alert-dialog'\nimport { AnimatePresence,motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { useIsMobile } from '../hooks/use-mobile'\nimport { springs, tweens } from './lib/motion'\nimport { cn } from './lib/utils'\n\n// ── Internal context to thread `open` state to animated children ──\n\ntype AlertDialogContextValue = { open: boolean }\nconst AlertDialogContext = React.createContext<AlertDialogContextValue>({ open: false })\nconst useAlertDialogOpen = () => React.useContext(AlertDialogContext)\n\nconst AlertDialog: React.FC<React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Root>> = ({\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...props\n}) => {\n const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? false)\n const isControlled = openProp !== undefined\n const open = isControlled ? openProp : internalOpen\n\n const handleOpenChange = React.useCallback(\n (nextOpen: boolean) => {\n if (!isControlled) setInternalOpen(nextOpen)\n onOpenChange?.(nextOpen)\n },\n [isControlled, onOpenChange],\n )\n\n const contextValue = React.useMemo(() => ({ open }), [open])\n\n return (\n <AlertDialogContext.Provider value={contextValue}>\n <AlertDialogPrimitive.Root open={open} onOpenChange={handleOpenChange} {...props} />\n </AlertDialogContext.Provider>\n )\n}\nAlertDialog.displayName = 'AlertDialog'\n\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger\n\nconst AlertDialogPortal = AlertDialogPrimitive.Portal\n\nconst AlertDialogOverlay = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n forceMount\n className={cn(\n 'fixed inset-0 z-modal bg-overlay',\n className,\n )}\n {...props}\n />\n))\nAlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName\n\ninterface AlertDialogContentProps extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> {\n /** When true (default), AlertDialog fills the screen on mobile (<768px). Set false to always use centered modal. */\n responsive?: boolean\n}\n\nconst AlertDialogContent = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Content>,\n AlertDialogContentProps\n>(({ className, children, responsive, ...props }, ref) => {\n const { open } = useAlertDialogOpen()\n const isMobileRaw = useIsMobile()\n const isMobile = responsive !== false && isMobileRaw\n\n return (\n <AnimatePresence>\n {open && (\n <AlertDialogPortal forceMount>\n <AlertDialogOverlay asChild>\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={tweens.fade}\n />\n </AlertDialogOverlay>\n <AlertDialogPrimitive.Content\n ref={ref}\n forceMount\n asChild\n {...props}\n >\n <motion.div\n initial={isMobile ? { y: '100%' } : { opacity: 0, scale: 0.95, x: '-50%', y: '-50%' }}\n animate={isMobile ? { y: 0 } : { opacity: 1, scale: 1, x: '-50%', y: '-50%' }}\n exit={isMobile ? { y: '100%' } : { opacity: 0, scale: 0.95, x: '-50%', y: '-50%' }}\n transition={isMobile\n ? springs.smooth\n : { ...springs.smooth, opacity: tweens.fade }\n }\n className={cn(\n 'fixed z-modal grid w-full gap-ds-05 bg-surface-overlay p-ds-06',\n responsive !== false\n ? 'inset-0 md:inset-auto md:left-[50%] md:top-[50%] md:max-w-lg md:rounded-overlay-lg md:shadow-overlay'\n : 'left-[50%] top-[50%] max-w-lg rounded-overlay-lg shadow-overlay',\n className,\n )}\n >\n {children}\n </motion.div>\n </AlertDialogPrimitive.Content>\n </AlertDialogPortal>\n )}\n </AnimatePresence>\n )\n})\nAlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName\n\nconst AlertDialogHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col space-y-ds-02b text-center sm:text-left',\n className,\n )}\n {...props}\n />\n ),\n)\nAlertDialogHeader.displayName = 'AlertDialogHeader'\n\nconst AlertDialogFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-ds-03',\n className,\n )}\n {...props}\n />\n ),\n)\nAlertDialogFooter.displayName = 'AlertDialogFooter'\n\nconst AlertDialogTitle = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Title\n ref={ref}\n className={cn(\n 'text-heading-xs font-semibold',\n className,\n )}\n {...props}\n />\n))\nAlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName\n\nconst AlertDialogDescription = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Description\n ref={ref}\n className={cn('text-body-md text-surface-fg-muted', className)}\n {...props}\n />\n))\nAlertDialogDescription.displayName =\n AlertDialogPrimitive.Description.displayName\n\nconst AlertDialogAction = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Action>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Action\n ref={ref}\n className={cn(\n 'inline-flex h-ds-md items-center justify-center rounded-control px-ds-05 text-body-md font-semibold transition-colors bg-accent-9 text-accent-fg hover:bg-accent-10 active:bg-accent-10 shadow-raised focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-action-disabled',\n className,\n )}\n {...props}\n />\n))\nAlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName\n\nconst AlertDialogCancel = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Cancel>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Cancel\n ref={ref}\n className={cn(\n 'inline-flex h-ds-md items-center justify-center rounded-control px-ds-05 text-body-md font-semibold transition-colors bg-transparent text-surface-fg-muted border border-surface-border-strong hover:bg-surface-panel-hover hover:text-surface-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-action-disabled',\n className,\n )}\n {...props}\n />\n))\nAlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName\n\nexport type { AlertDialogContentProps }\nexport type AlertDialogActionProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>\nexport type AlertDialogCancelProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n}\n"],"mappings":";;;;;;;;;AAaA,IAAM,IAAqB,EAAM,cAAuC,EAAE,MAAM,GAAM,CAAC,GACjF,UAA2B,EAAM,WAAW,CAAkB,GAE9D,KAA2F,EAC/F,MAAM,GACN,gBACA,iBACA,GAAG,QACC;CACJ,IAAM,CAAC,GAAc,KAAmB,EAAM,SAAS,KAAe,EAAK,GACrE,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,EACT,6ZACA,CACF;CACA,GAAI;AACL,CAAA,CACF;AACD,EAAkB,cAAA,EAA0C"}
1
+ {"version":3,"file":"alert-dialog.js","names":[],"sources":["../../src/ui/alert-dialog.tsx"],"sourcesContent":["'use client'\n\nimport * as AlertDialogPrimitive from '@primitives/react-alert-dialog'\nimport { AnimatePresence,motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { useIsMobile } from '../hooks/use-mobile'\nimport { MotionPreference } from '../motion/motion-preference'\nimport { springs, tweens } from './lib/motion'\nimport { cn } from './lib/utils'\n\n// ── Internal context to thread `open` state to animated children ──\n\ntype AlertDialogContextValue = { open: boolean }\nconst AlertDialogContext = React.createContext<AlertDialogContextValue>({ open: false })\nconst useAlertDialogOpen = () => React.useContext(AlertDialogContext)\n\nconst AlertDialog: React.FC<React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Root>> = ({\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...props\n}) => {\n const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? false)\n const isControlled = openProp !== undefined\n const open = isControlled ? openProp : internalOpen\n\n const handleOpenChange = React.useCallback(\n (nextOpen: boolean) => {\n if (!isControlled) setInternalOpen(nextOpen)\n onOpenChange?.(nextOpen)\n },\n [isControlled, onOpenChange],\n )\n\n const contextValue = React.useMemo(() => ({ open }), [open])\n\n return (\n <AlertDialogContext.Provider value={contextValue}>\n <AlertDialogPrimitive.Root open={open} onOpenChange={handleOpenChange} {...props} />\n </AlertDialogContext.Provider>\n )\n}\nAlertDialog.displayName = 'AlertDialog'\n\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger\n\nconst AlertDialogPortal = AlertDialogPrimitive.Portal\n\nconst AlertDialogOverlay = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n forceMount\n className={cn(\n 'fixed inset-0 z-modal bg-overlay',\n className,\n )}\n {...props}\n />\n))\nAlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName\n\ninterface AlertDialogContentProps extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> {\n /** When true (default), AlertDialog fills the screen on mobile (<768px). Set false to always use centered modal. */\n responsive?: boolean\n}\n\nconst AlertDialogContent = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Content>,\n AlertDialogContentProps\n>(({ className, children, responsive, ...props }, ref) => {\n const { open } = useAlertDialogOpen()\n const isMobileRaw = useIsMobile()\n const isMobile = responsive !== false && isMobileRaw\n\n return (\n <MotionPreference>\n <AnimatePresence>\n {open && (\n <AlertDialogPortal forceMount>\n <AlertDialogOverlay asChild>\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={tweens.fade}\n />\n </AlertDialogOverlay>\n <AlertDialogPrimitive.Content\n ref={ref}\n forceMount\n asChild\n {...props}\n >\n <motion.div\n initial={isMobile ? { y: '100%' } : { opacity: 0, scale: 0.95, x: '-50%', y: '-50%' }}\n animate={isMobile ? { y: 0 } : { opacity: 1, scale: 1, x: '-50%', y: '-50%' }}\n exit={isMobile ? { y: '100%' } : { opacity: 0, scale: 0.95, x: '-50%', y: '-50%' }}\n transition={isMobile\n ? springs.smooth\n : { ...springs.smooth, opacity: tweens.fade }\n }\n className={cn(\n 'fixed z-modal grid w-full gap-ds-05 bg-surface-overlay p-ds-06',\n responsive !== false\n ? 'inset-0 md:inset-auto md:left-[50%] md:top-[50%] md:max-w-lg md:rounded-overlay-lg md:shadow-overlay'\n : 'left-[50%] top-[50%] max-w-lg rounded-overlay-lg shadow-overlay',\n className,\n )}\n >\n {children}\n </motion.div>\n </AlertDialogPrimitive.Content>\n </AlertDialogPortal>\n )}\n </AnimatePresence>\n </MotionPreference>\n )\n})\nAlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName\n\nconst AlertDialogHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col space-y-ds-02b text-center sm:text-left',\n className,\n )}\n {...props}\n />\n ),\n)\nAlertDialogHeader.displayName = 'AlertDialogHeader'\n\nconst AlertDialogFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-ds-03',\n className,\n )}\n {...props}\n />\n ),\n)\nAlertDialogFooter.displayName = 'AlertDialogFooter'\n\nconst AlertDialogTitle = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Title\n ref={ref}\n className={cn(\n 'text-heading-xs font-semibold',\n className,\n )}\n {...props}\n />\n))\nAlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName\n\nconst AlertDialogDescription = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Description\n ref={ref}\n className={cn('text-body-md text-surface-fg-muted', className)}\n {...props}\n />\n))\nAlertDialogDescription.displayName =\n AlertDialogPrimitive.Description.displayName\n\nconst AlertDialogAction = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Action>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Action\n ref={ref}\n className={cn(\n 'inline-flex h-ds-md items-center justify-center rounded-control px-ds-05 text-body-md font-semibold transition-colors bg-accent-9 text-accent-fg hover:bg-accent-10 active:bg-accent-10 shadow-raised focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-action-disabled',\n className,\n )}\n {...props}\n />\n))\nAlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName\n\nconst AlertDialogCancel = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Cancel>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Cancel\n ref={ref}\n className={cn(\n 'inline-flex h-ds-md items-center justify-center rounded-control px-ds-05 text-body-md font-semibold transition-colors bg-transparent text-surface-fg-muted border border-surface-border-interactive hover:bg-surface-panel-hover hover:text-surface-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-action-disabled',\n className,\n )}\n {...props}\n />\n))\nAlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName\n\nexport type { AlertDialogContentProps }\nexport type AlertDialogActionProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>\nexport type AlertDialogCancelProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n}\n"],"mappings":";;;;;;;;;;AAcA,IAAM,IAAqB,EAAM,cAAuC,EAAE,MAAM,GAAM,CAAC,GACjF,UAA2B,EAAM,WAAW,CAAkB,GAE9D,KAA2F,EAC/F,MAAM,GACN,gBACA,iBACA,GAAG,QACC;CACJ,IAAM,CAAC,GAAc,KAAmB,EAAM,SAAS,KAAe,EAAK,GACrE,IAAe,MAAa,KAAA,GAC5B,IAAO,IAAe,IAAW,GAEjC,IAAmB,EAAM,aAC5B,MAAsB;EAErB,AADK,KAAc,EAAgB,CAAQ,GAC3C,IAAe,CAAQ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version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/ui/alert.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,QAAA,MAAM,aAAa;;;;8EA4ClB,CAAA;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EACzD,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,QAAA,MAAM,KAAK,mFAkEV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
1
+ {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/ui/alert.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,QAAA,MAAM,aAAa;;;;8EAiDlB,CAAA;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EACzD,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,QAAA,MAAM,KAAK,mFAqEV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
package/dist/ui/alert.js CHANGED
@@ -1,19 +1,20 @@
1
1
  "use client";
2
2
  import { motionProps as e, springs as t } from "./lib/motion.js";
3
- import { cn as n } from "./lib/utils.js";
4
- import { Icon as r } from "./icon.js";
5
- import * as i from "react";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
- import { IconAlertCircle as s, IconAlertTriangle as c, IconCircleCheck as l, IconInfoCircle as u, IconX as d } from "@tabler/icons-react";
8
- import { AnimatePresence as f, motion as p } from "framer-motion";
9
- import { cva as m } from "class-variance-authority";
3
+ import { MotionPreference as n } from "../_chunks/motion-preference.js";
4
+ import { cn as r } from "./lib/utils.js";
5
+ import { Icon as i } from "./icon.js";
6
+ import * as a from "react";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ import { IconAlertCircle as c, IconAlertTriangle as l, IconCircleCheck as u, IconInfoCircle as d, IconX as f } from "@tabler/icons-react";
9
+ import { AnimatePresence as p, motion as m } from "framer-motion";
10
+ import { cva as h } from "class-variance-authority";
10
11
  //#region src/ui/alert.tsx
11
- var h = m("relative flex rounded-surface border", {
12
+ var g = h("relative flex rounded-surface border", {
12
13
  variants: {
13
14
  variant: {
14
- subtle: "",
15
- solid: "",
16
- outline: ""
15
+ subtle: "bg-palette-subtle border-palette-border text-palette-text",
16
+ solid: "bg-palette-solid text-palette-fg border-transparent [&>svg]:text-palette-fg",
17
+ outline: "bg-transparent border-palette-border text-palette-text"
17
18
  },
18
19
  color: {
19
20
  info: "",
@@ -29,80 +30,20 @@ var h = m("relative flex rounded-surface border", {
29
30
  }
30
31
  },
31
32
  compoundVariants: [
32
- {
33
- variant: "subtle",
34
- color: "info",
35
- className: "bg-info-2 border-info-4 text-info-11"
36
- },
37
- {
38
- variant: "subtle",
39
- color: "success",
40
- className: "bg-success-2 border-success-4 text-success-11"
41
- },
42
- {
43
- variant: "subtle",
44
- color: "warning",
45
- className: "bg-warning-2 border-warning-4 text-warning-11"
46
- },
47
- {
48
- variant: "subtle",
49
- color: "error",
50
- className: "bg-error-2 border-error-4 text-error-11"
51
- },
52
33
  {
53
34
  variant: "subtle",
54
35
  color: "neutral",
55
- className: "bg-surface-panel border-surface-border-strong text-surface-fg [&>svg]:text-surface-fg-muted"
56
- },
57
- {
58
- variant: "solid",
59
- color: "info",
60
- className: "bg-info-9 text-info-fg border-transparent [&>svg]:text-info-fg"
61
- },
62
- {
63
- variant: "solid",
64
- color: "success",
65
- className: "bg-success-9 text-success-fg border-transparent [&>svg]:text-success-fg"
66
- },
67
- {
68
- variant: "solid",
69
- color: "warning",
70
- className: "bg-warning-9 text-warning-fg border-transparent [&>svg]:text-warning-fg"
71
- },
72
- {
73
- variant: "solid",
74
- color: "error",
75
- className: "bg-error-9 text-error-fg border-transparent [&>svg]:text-error-fg"
36
+ className: "bg-surface-panel text-surface-fg [&>svg]:text-surface-fg-muted"
76
37
  },
77
38
  {
78
39
  variant: "solid",
79
40
  color: "neutral",
80
- className: "bg-surface-panel-hover text-surface-fg border-transparent [&>svg]:text-surface-fg-muted"
81
- },
82
- {
83
- variant: "outline",
84
- color: "info",
85
- className: "bg-transparent border-info-7 text-info-11"
86
- },
87
- {
88
- variant: "outline",
89
- color: "success",
90
- className: "bg-transparent border-success-7 text-success-11"
91
- },
92
- {
93
- variant: "outline",
94
- color: "warning",
95
- className: "bg-transparent border-warning-7 text-warning-11"
96
- },
97
- {
98
- variant: "outline",
99
- color: "error",
100
- className: "bg-transparent border-error-7 text-error-11"
41
+ className: "bg-surface-panel-hover text-surface-fg [&>svg]:text-surface-fg-muted"
101
42
  },
102
43
  {
103
44
  variant: "outline",
104
45
  color: "neutral",
105
- className: "bg-transparent border-surface-border-strong text-surface-fg [&>svg]:text-surface-fg-muted"
46
+ className: "text-surface-fg [&>svg]:text-surface-fg-muted"
106
47
  }
107
48
  ],
108
49
  defaultVariants: {
@@ -110,20 +51,20 @@ var h = m("relative flex rounded-surface border", {
110
51
  color: "info",
111
52
  size: "md"
112
53
  }
113
- }), g = {
114
- info: u,
115
- success: l,
116
- warning: c,
117
- error: s,
118
- neutral: u
119
- }, _ = i.forwardRef(({ className: s, variant: c = "subtle", color: l = "info", size: u = "md", title: m, onDismiss: _, children: v, ...y }, b) => {
120
- let x = g[l ?? "info"], [S, C] = i.useState(!0), w = i.useCallback(() => {
121
- C(!1);
122
- }, []), T = u === "sm" ? "sm" : u === "lg" ? "lg" : "md", E = u === "sm" ? "xs" : "sm", D = u === "sm" ? "text-body-xs" : "text-body-md", O = u === "sm" ? "text-body-sm" : u === "lg" ? "text-heading-xs" : "text-body-md";
123
- return /* @__PURE__ */ a(f, {
124
- onExitComplete: _,
125
- children: S && /* @__PURE__ */ o(p.div, {
126
- ref: b,
54
+ }), _ = {
55
+ info: d,
56
+ success: u,
57
+ warning: l,
58
+ error: c,
59
+ neutral: d
60
+ }, v = a.forwardRef(({ className: c, variant: l = "subtle", color: u = "info", size: d = "md", title: h, onDismiss: v, children: y, ...b }, x) => {
61
+ let S = _[u ?? "info"], [C, w] = a.useState(!0), T = a.useCallback(() => {
62
+ w(!1);
63
+ }, []), E = d === "sm" ? "sm" : d === "lg" ? "lg" : "md", D = d === "sm" ? "xs" : "sm", O = d === "sm" ? "text-body-xs" : "text-body-md", k = d === "sm" ? "text-body-sm" : d === "lg" ? "text-heading-xs" : "text-body-md";
64
+ return /* @__PURE__ */ o(n, { children: /* @__PURE__ */ o(p, {
65
+ onExitComplete: v,
66
+ children: C && /* @__PURE__ */ s(m.div, {
67
+ ref: x,
127
68
  initial: {
128
69
  opacity: 1,
129
70
  y: 0
@@ -137,43 +78,44 @@ var h = m("relative flex rounded-surface border", {
137
78
  y: -8
138
79
  },
139
80
  transition: t.snappy,
140
- className: n(h({
141
- variant: c,
142
- color: l,
143
- size: u
144
- }), s),
81
+ "data-palette": u,
82
+ className: r(g({
83
+ variant: l,
84
+ color: u,
85
+ size: d
86
+ }), c),
145
87
  role: "alert",
146
- ...e(y),
88
+ ...e(b),
147
89
  children: [
148
- /* @__PURE__ */ a(r, {
149
- icon: x,
150
- size: T,
90
+ /* @__PURE__ */ o(i, {
91
+ icon: S,
92
+ size: E,
151
93
  className: "mt-ds-01 shrink-0"
152
94
  }),
153
- /* @__PURE__ */ o("div", {
95
+ /* @__PURE__ */ s("div", {
154
96
  className: "flex-1 min-w-0",
155
- children: [m && /* @__PURE__ */ a("p", {
156
- className: n(O, "font-semibold mb-ds-01"),
157
- children: m
158
- }), /* @__PURE__ */ a("div", {
159
- className: n(D, c !== "solid" && "text-surface-fg-muted"),
160
- children: v
97
+ children: [h && /* @__PURE__ */ o("p", {
98
+ className: r(k, "font-semibold mb-ds-01"),
99
+ children: h
100
+ }), /* @__PURE__ */ o("div", {
101
+ className: r(O, l !== "solid" && "text-surface-fg-muted"),
102
+ children: y
161
103
  })]
162
104
  }),
163
- _ && /* @__PURE__ */ a("button", {
105
+ v && /* @__PURE__ */ o("button", {
164
106
  type: "button",
165
- onClick: w,
166
- className: n("shrink-0 min-h-ds-xs min-w-ds-xs flex items-center justify-center rounded-control-inner transition-colors duration-fast-01 ease-productive-standard active:scale-95 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9", c === "solid" ? "text-current opacity-80 hover:opacity-100" : "text-surface-fg-subtle hover:text-surface-fg-muted hover:bg-surface-panel-hover"),
107
+ onClick: T,
108
+ className: r("shrink-0 min-h-ds-xs min-w-ds-xs flex items-center justify-center rounded-control-inner transition-colors duration-fast-01 ease-productive-standard active:scale-95 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9", l === "solid" ? "text-current opacity-80 hover:opacity-100" : "text-surface-fg-subtle hover:text-surface-fg-muted hover:bg-surface-panel-hover"),
167
109
  "aria-label": "Dismiss",
168
- children: /* @__PURE__ */ a(r, {
169
- icon: d,
170
- size: E
110
+ children: /* @__PURE__ */ o(i, {
111
+ icon: f,
112
+ size: D
171
113
  })
172
114
  })
173
115
  ]
174
116
  })
175
- });
117
+ }) });
176
118
  });
177
- _.displayName = "Alert";
119
+ v.displayName = "Alert";
178
120
  //#endregion
179
- export { _ as Alert, h as alertVariants };
121
+ export { v as Alert, g as alertVariants };
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","names":[],"sources":["../../src/ui/alert.tsx"],"sourcesContent":["'use client'\n\nimport { IconAlertCircle, IconAlertTriangle,IconCircleCheck, IconInfoCircle, IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { AnimatePresence,motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { Icon } from './icon'\nimport { motionProps,springs } from './lib/motion'\nimport { cn } from './lib/utils'\n\nconst alertVariants = cva(\n 'relative flex rounded-surface border',\n {\n variants: {\n variant: {\n subtle: '',\n solid: '',\n outline: '',\n },\n color: {\n info: '',\n success: '',\n warning: '',\n error: '',\n neutral: '',\n },\n size: {\n sm: 'gap-ds-03 p-ds-03',\n md: 'gap-ds-04 p-ds-05',\n lg: 'gap-ds-05 p-ds-07',\n },\n },\n compoundVariants: [\n // subtle (surface bg) — default, matches previous behavior\n { variant: 'subtle', color: 'info', className: 'bg-info-2 border-info-4 text-info-11' },\n { variant: 'subtle', color: 'success', className: 'bg-success-2 border-success-4 text-success-11' },\n { variant: 'subtle', color: 'warning', className: 'bg-warning-2 border-warning-4 text-warning-11' },\n { variant: 'subtle', color: 'error', className: 'bg-error-2 border-error-4 text-error-11' },\n { variant: 'subtle', color: 'neutral', className: 'bg-surface-panel border-surface-border-strong text-surface-fg [&>svg]:text-surface-fg-muted' },\n // solid (solid bg, contrasting text) — canonical name\n { variant: 'solid', color: 'info', className: 'bg-info-9 text-info-fg border-transparent [&>svg]:text-info-fg' },\n { variant: 'solid', color: 'success', className: 'bg-success-9 text-success-fg border-transparent [&>svg]:text-success-fg' },\n { variant: 'solid', color: 'warning', className: 'bg-warning-9 text-warning-fg border-transparent [&>svg]:text-warning-fg' },\n { variant: 'solid', color: 'error', className: 'bg-error-9 text-error-fg border-transparent [&>svg]:text-error-fg' },\n { variant: 'solid', color: 'neutral', className: 'bg-surface-panel-hover text-surface-fg border-transparent [&>svg]:text-surface-fg-muted' },\n // outline (transparent bg, colored border)\n { variant: 'outline', color: 'info', className: 'bg-transparent border-info-7 text-info-11' },\n { variant: 'outline', color: 'success', className: 'bg-transparent border-success-7 text-success-11' },\n { variant: 'outline', color: 'warning', className: 'bg-transparent border-warning-7 text-warning-11' },\n { variant: 'outline', color: 'error', className: 'bg-transparent border-error-7 text-error-11' },\n { variant: 'outline', color: 'neutral', className: 'bg-transparent border-surface-border-strong text-surface-fg [&>svg]:text-surface-fg-muted' },\n ],\n defaultVariants: { variant: 'subtle', color: 'info', size: 'md' },\n },\n)\n\nconst ALERT_ICONS: Record<string, React.ForwardRefExoticComponent<any>> = {\n info: IconInfoCircle,\n success: IconCircleCheck,\n warning: IconAlertTriangle,\n error: IconAlertCircle,\n neutral: IconInfoCircle,\n}\n\n/**\n * Props for Alert — an inline message block with a colored icon, optional title, optional body,\n * and an optional dismiss button. Renders with `role=\"alert\"` for screen reader announcements.\n *\n * **Variants:** `subtle` (default, tinted surface) | `solid` (solid colored bg) | `outline` (transparent bg, colored border)\n *\n * **Colors:** `info` (default, blue tones) | `success` | `warning` | `error` | `neutral`\n * The matching icon (info circle, checkmark, triangle, alert circle) is auto-selected by color.\n *\n * **Alert vs Banner:** Alert is inline (inside page content). Banner is a full-width notification\n * strip rendered at the top of a page/section (see `<Banner>`).\n *\n * **Dismissible:** Provide `onDismiss` to show an × button. Absence of the prop = non-dismissible.\n *\n * @example\n * // Informational tip inside a settings form:\n * <Alert title=\"Tip\" color=\"info\">\n * Changes take effect after you save and reload the page.\n * </Alert>\n *\n * @example\n * // Error feedback after a failed API call (dismissible):\n * <Alert color=\"error\" title=\"Save failed\" onDismiss={() => setError(null)}>\n * Your changes could not be saved. Please try again.\n * </Alert>\n *\n * @example\n * // Success confirmation after publishing:\n * <Alert color=\"success\" title=\"Published!\">\n * Your post is now live and visible to all subscribers.\n * </Alert>\n *\n * @example\n * // Neutral inline note (no colored intent):\n * <Alert color=\"neutral\">This field is auto-populated from your profile.</Alert>\n * // These are just a few ways — feel free to combine props creatively!\n */\nexport interface AlertProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n VariantProps<typeof alertVariants> {\n title?: string\n /**\n * Called after the exit animation completes, not immediately on click.\n * The dismiss button sets internal visibility to false, triggering the exit\n * animation; `onDismiss` fires via `AnimatePresence.onExitComplete`.\n */\n onDismiss?: () => void\n}\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant = 'subtle', color = 'info', size = 'md', title, onDismiss, children, ...props }, ref) => {\n const AlertIcon = ALERT_ICONS[color ?? 'info']\n const [isVisible, setIsVisible] = React.useState(true)\n\n const handleDismiss = React.useCallback(() => {\n setIsVisible(false)\n }, [])\n\n const iconSize = size === 'sm' ? 'sm' : size === 'lg' ? 'lg' : 'md'\n const dismissIconSize = size === 'sm' ? 'xs' : 'sm'\n const textClass = size === 'sm' ? 'text-body-xs' : size === 'lg' ? 'text-body-md' : 'text-body-md'\n const titleClass = size === 'sm' ? 'text-body-sm' : size === 'lg' ? 'text-heading-xs' : 'text-body-md'\n\n return (\n <AnimatePresence onExitComplete={onDismiss}>\n {isVisible && (\n <motion.div\n ref={ref}\n initial={{ opacity: 1, y: 0 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -8 }}\n transition={springs.snappy}\n className={cn(alertVariants({ variant, color, size }), className)}\n role=\"alert\"\n {...motionProps(props)}\n >\n <Icon icon={AlertIcon} size={iconSize} className=\"mt-ds-01 shrink-0\" />\n <div className=\"flex-1 min-w-0\">\n {title && <p className={cn(titleClass, 'font-semibold mb-ds-01')}>{title}</p>}\n {/* Body: on solid variants the CVA sets text-accent-fg (white) on\n saturated step-9 backgrounds. Muting the body to surface-fg (grey)\n there drops contrast below WCAG AA. Only mute on subtle/outline\n variants where the root color is a readable step-11. */}\n <div\n className={cn(\n textClass,\n variant !== 'solid' && 'text-surface-fg-muted',\n )}\n >\n {children}\n </div>\n </div>\n {onDismiss && (\n <button\n type=\"button\"\n onClick={handleDismiss}\n className={cn(\n 'shrink-0 min-h-ds-xs min-w-ds-xs flex items-center justify-center rounded-control-inner transition-colors duration-fast-01 ease-productive-standard active:scale-95 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9',\n // On solid the fill is a saturated step 9, where a mid grey\n // measures as low as 1.01:1. Inherit the alert's own foreground,\n // exactly as the title and body already do.\n variant === 'solid'\n ? 'text-current opacity-80 hover:opacity-100'\n : 'text-surface-fg-subtle hover:text-surface-fg-muted hover:bg-surface-panel-hover',\n )}\n aria-label=\"Dismiss\"\n >\n <Icon icon={IconX} size={dismissIconSize} />\n </button>\n )}\n </motion.div>\n )}\n </AnimatePresence>\n )\n },\n)\nAlert.displayName = 'Alert'\n\nexport { Alert, alertVariants }\n"],"mappings":";;;;;;;;;;AAWA,IAAM,IAAgB,EACpB,wCACA;CACE,UAAU;EACR,SAAS;GACP,QAAQ;GACR,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,SAAS;GACT,SAAS;GACT,OAAO;GACP,SAAS;EACX;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;CACA,kBAAkB;EAEhB;GAAE,SAAS;GAAU,OAAO;GAAQ,WAAW;EAAuC;EACtF;GAAE,SAAS;GAAU,OAAO;GAAW,WAAW;EAAgD;EAClG;GAAE,SAAS;GAAU,OAAO;GAAW,WAAW;EAAgD;EAClG;GAAE,SAAS;GAAU,OAAO;GAAS,WAAW;EAA0C;EAC1F;GAAE,SAAS;GAAU,OAAO;GAAW,WAAW;EAA8F;EAEhJ;GAAE,SAAS;GAAS,OAAO;GAAQ,WAAW;EAAiE;EAC/G;GAAE,SAAS;GAAS,OAAO;GAAW,WAAW;EAA0E;EAC3H;GAAE,SAAS;GAAS,OAAO;GAAW,WAAW;EAA0E;EAC3H;GAAE,SAAS;GAAS,OAAO;GAAS,WAAW;EAAoE;EACnH;GAAE,SAAS;GAAS,OAAO;GAAW,WAAW;EAA0F;EAE3I;GAAE,SAAS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K,WAAU;eAAf,CACG,KAAS,kBAAC,KAAD;MAAG,WAAW,EAAG,GAAY,wBAAwB;gBAAI;KAAS,CAAA,GAK5E,kBAAC,OAAD;MACE,WAAW,EACT,GACA,MAAY,WAAW,uBACzB;MAEC;KACE,CAAA,CACF;;IACJ,KACC,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAW,EACT,qPAIA,MAAY,UACR,8CACA,iFACN;KACA,cAAW;eAEX,kBAAC,GAAD;MAAM,MAAM;MAAO,MAAM;KAAkB,CAAA;IACrC,CAAA;GAEA;;CAEC,CAAA;AAErB,CACF;AACA,EAAM,cAAc"}
1
+ {"version":3,"file":"alert.js","names":[],"sources":["../../src/ui/alert.tsx"],"sourcesContent":["'use client'\n\nimport { IconAlertCircle, IconAlertTriangle,IconCircleCheck, IconInfoCircle, IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { AnimatePresence,motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { MotionPreference } from '../motion/motion-preference'\nimport { Icon } from './icon'\nimport { motionProps,springs } from './lib/motion'\nimport { cn } from './lib/utils'\n\nconst alertVariants = cva(\n 'relative flex rounded-surface border',\n {\n variants: {\n // Colour is a role; the hue arrives via `data-palette` on the element.\n // Alert's subtle edge was already step 4, which is what the `border` role\n // now resolves to, so it is an exact match rather than a compromise.\n variant: {\n subtle: 'bg-palette-subtle border-palette-border text-palette-text',\n solid:\n 'bg-palette-solid text-palette-fg border-transparent [&>svg]:text-palette-fg',\n outline: 'bg-transparent border-palette-border text-palette-text',\n },\n color: {\n info: '',\n success: '',\n warning: '',\n error: '',\n neutral: '',\n },\n size: {\n sm: 'gap-ds-03 p-ds-03',\n md: 'gap-ds-04 p-ds-05',\n lg: 'gap-ds-05 p-ds-07',\n },\n },\n // Fifteen compounds become three, all of them `neutral`. A neutral alert is\n // not a grey version of a coloured one — it is a plain panel, so its ground\n // and its text come from the surface family rather than a ramp, and its icon\n // steps back to muted instead of matching the label.\n compoundVariants: [\n {\n variant: 'subtle',\n color: 'neutral',\n className: 'bg-surface-panel text-surface-fg [&>svg]:text-surface-fg-muted',\n },\n {\n variant: 'solid',\n color: 'neutral',\n className: 'bg-surface-panel-hover text-surface-fg [&>svg]:text-surface-fg-muted',\n },\n {\n variant: 'outline',\n color: 'neutral',\n className: 'text-surface-fg [&>svg]:text-surface-fg-muted',\n },\n ],\n defaultVariants: { variant: 'subtle', color: 'info', size: 'md' },\n },\n)\n\nconst ALERT_ICONS: Record<string, React.ForwardRefExoticComponent<any>> = {\n info: IconInfoCircle,\n success: IconCircleCheck,\n warning: IconAlertTriangle,\n error: IconAlertCircle,\n neutral: IconInfoCircle,\n}\n\n/**\n * Props for Alert — an inline message block with a colored icon, optional title, optional body,\n * and an optional dismiss button. Renders with `role=\"alert\"` for screen reader announcements.\n *\n * **Variants:** `subtle` (default, tinted surface) | `solid` (solid colored bg) | `outline` (transparent bg, colored border)\n *\n * **Colors:** `info` (default, blue tones) | `success` | `warning` | `error` | `neutral`\n * The matching icon (info circle, checkmark, triangle, alert circle) is auto-selected by color.\n *\n * **Alert vs Banner:** Alert is inline (inside page content). Banner is a full-width notification\n * strip rendered at the top of a page/section (see `<Banner>`).\n *\n * **Dismissible:** Provide `onDismiss` to show an × button. Absence of the prop = non-dismissible.\n *\n * @example\n * // Informational tip inside a settings form:\n * <Alert title=\"Tip\" color=\"info\">\n * Changes take effect after you save and reload the page.\n * </Alert>\n *\n * @example\n * // Error feedback after a failed API call (dismissible):\n * <Alert color=\"error\" title=\"Save failed\" onDismiss={() => setError(null)}>\n * Your changes could not be saved. Please try again.\n * </Alert>\n *\n * @example\n * // Success confirmation after publishing:\n * <Alert color=\"success\" title=\"Published!\">\n * Your post is now live and visible to all subscribers.\n * </Alert>\n *\n * @example\n * // Neutral inline note (no colored intent):\n * <Alert color=\"neutral\">This field is auto-populated from your profile.</Alert>\n * // These are just a few ways — feel free to combine props creatively!\n */\nexport interface AlertProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n VariantProps<typeof alertVariants> {\n title?: string\n /**\n * Called after the exit animation completes, not immediately on click.\n * The dismiss button sets internal visibility to false, triggering the exit\n * animation; `onDismiss` fires via `AnimatePresence.onExitComplete`.\n */\n onDismiss?: () => void\n}\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant = 'subtle', color = 'info', size = 'md', title, onDismiss, children, ...props }, ref) => {\n const AlertIcon = ALERT_ICONS[color ?? 'info']\n const [isVisible, setIsVisible] = React.useState(true)\n\n const handleDismiss = React.useCallback(() => {\n setIsVisible(false)\n }, [])\n\n const iconSize = size === 'sm' ? 'sm' : size === 'lg' ? 'lg' : 'md'\n const dismissIconSize = size === 'sm' ? 'xs' : 'sm'\n const textClass = size === 'sm' ? 'text-body-xs' : size === 'lg' ? 'text-body-md' : 'text-body-md'\n const titleClass = size === 'sm' ? 'text-body-sm' : size === 'lg' ? 'text-heading-xs' : 'text-body-md'\n\n return (\n <MotionPreference>\n <AnimatePresence onExitComplete={onDismiss}>\n {isVisible && (\n <motion.div\n ref={ref}\n initial={{ opacity: 1, y: 0 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -8 }}\n transition={springs.snappy}\n data-palette={color}\n className={cn(alertVariants({ variant, color, size }), className)}\n role=\"alert\"\n {...motionProps(props)}\n >\n <Icon icon={AlertIcon} size={iconSize} className=\"mt-ds-01 shrink-0\" />\n <div className=\"flex-1 min-w-0\">\n {title && <p className={cn(titleClass, 'font-semibold mb-ds-01')}>{title}</p>}\n {/* Body: on solid variants the CVA sets text-accent-fg (white) on\n saturated step-9 backgrounds. Muting the body to surface-fg (grey)\n there drops contrast below WCAG AA. Only mute on subtle/outline\n variants where the root color is a readable step-11. */}\n <div\n className={cn(\n textClass,\n variant !== 'solid' && 'text-surface-fg-muted',\n )}\n >\n {children}\n </div>\n </div>\n {onDismiss && (\n <button\n type=\"button\"\n onClick={handleDismiss}\n className={cn(\n 'shrink-0 min-h-ds-xs min-w-ds-xs flex items-center justify-center rounded-control-inner transition-colors duration-fast-01 ease-productive-standard active:scale-95 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9',\n // On solid the fill is a saturated step 9, where a mid grey\n // measures as low as 1.01:1. Inherit the alert's own foreground,\n // exactly as the title and body already do.\n variant === 'solid'\n ? 'text-current opacity-80 hover:opacity-100'\n : 'text-surface-fg-subtle hover:text-surface-fg-muted hover:bg-surface-panel-hover',\n )}\n aria-label=\"Dismiss\"\n >\n <Icon icon={IconX} size={dismissIconSize} />\n </button>\n )}\n </motion.div>\n )}\n </AnimatePresence>\n </MotionPreference>\n )\n },\n)\nAlert.displayName = 'Alert'\n\nexport { Alert, alertVariants }\n"],"mappings":";;;;;;;;;;;AAYA,IAAM,IAAgB,EACpB,wCACA;CACE,UAAU;EAIR,SAAS;GACP,QAAQ;GACR,OACE;GACF,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,SAAS;GACT,SAAS;GACT,OAAO;GACP,SAAS;EACX;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;CAKA,kBAAkB;EAChB;GACE,SAAS;GACT,OAAO;GACP,WAAW;EACb;EACA;GACE,SAAS;GACT,OAAO;GACP,WAAW;EACb;EACA;GACE,SAAS;GACT,OAAO;GACP,WAAW;EACb;CACF;CACA,iBAAiB;EAAE,SAAS;EAAU,OAAO;EAAQ,MAAM;CAAK;AAClE,CACF,GAEM,IAAoE;CACxE,MAAS;CACT,SAAS;CACT,SAAS;CACT,OAAS;CACT,SAAS;AACX,GAmDM,IAAQ,EAAM,YACjB,EAAE,cAAW,aAAU,UAAU,WAAQ,QAAQ,UAAO,MAAM,UAAO,cAAW,aAAU,GAAG,KAAS,MAAQ;CAC7G,IAAM,IAAY,EAAY,KAAS,SACjC,CAAC,GAAW,KAAgB,EAAM,SAAS,EAAI,GAE/C,IAAgB,EAAM,kBAAkB;EAC5C,EAAa,EAAK;CACpB,GAAG,CAAC,CAAC,GAEC,IAAW,MAAS,OAAO,OAAO,MAAS,OAAO,OAAO,MACzD,IAAkB,MAAS,OAAO,OAAO,MACzC,IAAY,MAAS,OAAO,iBAAiC,gBAC7D,IAAa,MAAS,OAAO,iBAAiB,MAAS,OAAO,oBAAoB;CAExF,OACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAiB,gBAAgB;YAC9B,KACC,kBAAC,EAAO,KAAR;GACO;GACL,SAAS;IAAE,SAAS;IAAG,GAAG;GAAE;GAC5B,SAAS;IAAE,SAAS;IAAG,GAAG;GAAE;GAC5B,MAAM;IAAE,SAAS;IAAG,GAAG;GAAG;GAC1B,YAAY,EAAQ;GACpB,gBAAc;GACd,WAAW,EAAG,EAAc;IAAE;IAAS;IAAO;GAAK,CAAC,GAAG,CAAS;GAChE,MAAK;GACL,GAAI,EAAY,CAAK;aATvB;IAWE,kBAAC,GAAD;KAAM,MAAM;KAAW,MAAM;KAAU,WAAU;IAAqB,CAAA;IACtE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACG,KAAS,kBAAC,KAAD;MAAG,WAAW,EAAG,GAAY,wBAAwB;gBAAI;KAAS,CAAA,GAK5E,kBAAC,OAAD;MACE,WAAW,EACT,GACA,MAAY,WAAW,uBACzB;MAEC;KACE,CAAA,CACF;;IACJ,KACC,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAW,EACT,qPAIA,MAAY,UACR,8CACA,iFACN;KACA,cAAW;eAEX,kBAAC,GAAD;MAAM,MAAM;MAAO,MAAM;KAAkB,CAAA;IACrC,CAAA;GAEA;;CAEC,CAAA,EACD,CAAA;AAEtB,CACF;AACA,EAAM,cAAc"}
@@ -1,17 +1,17 @@
1
1
  "use client";
2
- import { autoUpdate as e, flip as t, offset as n, shift as r, size as i, useFloating as a } from "../_chunks/primitives-internal.js";
3
- import { tweens as o } from "./lib/motion.js";
2
+ import { autoUpdate as e, flip as t, offset as n, shift as ee, size as r, useFloating as i } from "../_chunks/primitives-internal.js";
3
+ import { tweens as a } from "./lib/motion.js";
4
+ import { useMotion as o } from "../_chunks/motion-provider.js";
4
5
  import { cn as s } from "./lib/utils.js";
5
6
  import { Spinner as c } from "./spinner.js";
6
- import { useMotion as l } from "../_chunks/motion-provider.js";
7
- import { useFormField as u } from "./form.js";
8
- import { Input as ee } from "./input.js";
7
+ import { useFormField as l } from "./form.js";
8
+ import { Input as u } from "./input.js";
9
9
  import * as d from "react";
10
10
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
11
- import { createPortal as h } from "react-dom";
12
- import { AnimatePresence as g, motion as _ } from "framer-motion";
11
+ import { createPortal as te } from "react-dom";
12
+ import { AnimatePresence as h, motion as g } from "framer-motion";
13
13
  //#region src/ui/autocomplete.tsx
14
- function v({ label: e, query: t }) {
14
+ function _({ label: e, query: t }) {
15
15
  let n = t ? e.toLowerCase().indexOf(t.toLowerCase()) : -1;
16
16
  return n === -1 ? /* @__PURE__ */ p(f, { children: e }) : /* @__PURE__ */ m(f, { children: [
17
17
  e.slice(0, n),
@@ -22,130 +22,130 @@ function v({ label: e, query: t }) {
22
22
  e.slice(n + t.length)
23
23
  ] });
24
24
  }
25
- var y = d.forwardRef(({ options: f, value: y, defaultValue: b = null, onValueChange: x, placeholder: S, emptyText: C = "No options", disabled: w, size: T, state: E, isLoading: D = !1, loadingText: O = "Loading…", renderOption: k, className: A, id: j, ...M }, N) => {
26
- let te = d.useId(), P = j || te, F = `${P}-listbox`, I = `${P}-option`, L = y !== void 0, [R, z] = d.useState(b), B = L ? y : R, [V, H] = d.useState(B?.label ?? ""), [U, W] = d.useState(!1), [G, K] = d.useState(-1), q = d.useRef(null), J = d.useRef(null), Y = d.useRef(null), { reducedMotion: X } = l(), { refs: Z, floatingStyles: ne } = a({
27
- open: U,
25
+ var v = d.forwardRef(({ options: f, value: v, defaultValue: y = null, onValueChange: b, placeholder: x, emptyText: S = "No options", disabled: C, size: w, state: T, isLoading: E = !1, loadingText: D = "Loading…", renderOption: O, className: k, id: A, ...ne }, j) => {
26
+ let M = d.useId(), N = A || M, P = `${N}-listbox`, F = `${N}-option`, I = v !== void 0, [L, R] = d.useState(y), z = I ? v : L, [B, V] = d.useState(z?.label ?? ""), [H, U] = d.useState(!1), [W, G] = d.useState(-1), K = d.useRef(null), q = d.useRef(null), J = d.useRef(null), { reducedMotion: Y } = o(), { refs: X, floatingStyles: re } = i({
27
+ open: H,
28
28
  placement: "bottom-start",
29
29
  whileElementsMounted: e,
30
30
  middleware: [
31
31
  n(4),
32
32
  t(),
33
- r(),
34
- i({ apply({ availableHeight: e, rects: t, elements: n }) {
33
+ ee(),
34
+ r({ apply({ availableHeight: e, rects: t, elements: n }) {
35
35
  Object.assign(n.floating.style, {
36
36
  maxHeight: `${Math.min(e, 240)}px`,
37
37
  width: `${t.reference.width}px`
38
38
  });
39
39
  } })
40
40
  ]
41
- }), re = d.useCallback((e) => {
42
- J.current = e, Z.setReference(e);
43
- }, [Z]), ie = d.useCallback((e) => {
44
- q.current = e, typeof N == "function" ? N(e) : N && (N.current = e);
45
- }, [N]), ae = d.useCallback((e) => {
46
- Y.current = e, Z.setFloating(e);
47
- }, [Z]);
41
+ }), ie = d.useCallback((e) => {
42
+ q.current = e, X.setReference(e);
43
+ }, [X]), ae = d.useCallback((e) => {
44
+ K.current = e, typeof j == "function" ? j(e) : j && (j.current = e);
45
+ }, [j]), oe = d.useCallback((e) => {
46
+ J.current = e, X.setFloating(e);
47
+ }, [X]);
48
48
  d.useEffect(() => {
49
- H(B?.label ?? "");
50
- }, [B]);
51
- let Q = d.useMemo(() => V ? f.filter((e) => e.label.toLowerCase().includes(V.toLowerCase())) : f, [f, V]), $ = d.useCallback((e) => {
52
- H(e.label), W(!1), K(-1), L || z(e), x?.(e);
53
- }, [L, x]), oe = d.useCallback((e) => {
54
- if (!w) {
55
- if (!U) {
56
- (e.key === "ArrowDown" || e.key === "Enter") && W(!0);
49
+ V(z?.label ?? "");
50
+ }, [z]);
51
+ let Z = d.useMemo(() => B ? f.filter((e) => e.label.toLowerCase().includes(B.toLowerCase())) : f, [f, B]), Q = d.useCallback((e) => {
52
+ V(e.label), U(!1), G(-1), I || R(e), b?.(e);
53
+ }, [I, b]), $ = d.useCallback((e) => {
54
+ if (!C) {
55
+ if (!H) {
56
+ (e.key === "ArrowDown" || e.key === "Enter") && U(!0);
57
57
  return;
58
58
  }
59
59
  switch (e.key) {
60
60
  case "ArrowDown":
61
- e.preventDefault(), K((e) => Math.min(e + 1, Q.length - 1));
61
+ e.preventDefault(), G((e) => Math.min(e + 1, Z.length - 1));
62
62
  break;
63
63
  case "ArrowUp":
64
- e.preventDefault(), K((e) => Math.max(e - 1, 0));
64
+ e.preventDefault(), G((e) => Math.max(e - 1, 0));
65
65
  break;
66
66
  case "Home":
67
- e.preventDefault(), K(0);
67
+ e.preventDefault(), G(0);
68
68
  break;
69
69
  case "End":
70
- e.preventDefault(), K(Q.length - 1);
70
+ e.preventDefault(), G(Z.length - 1);
71
71
  break;
72
72
  case "Enter":
73
- e.preventDefault(), G >= 0 && Q[G] && $(Q[G]);
73
+ e.preventDefault(), W >= 0 && Z[W] && Q(Z[W]);
74
74
  break;
75
75
  case "Escape":
76
- W(!1), K(-1);
76
+ U(!1), G(-1);
77
77
  break;
78
78
  }
79
79
  }
80
80
  }, [
81
- w,
82
- U,
83
- Q,
84
- G,
85
- $
86
- ]), se = u(), ce = !!(j || se.inputId), le = G >= 0 ? `${I}-${G}` : void 0;
81
+ C,
82
+ H,
83
+ Z,
84
+ W,
85
+ Q
86
+ ]), se = l(), ce = !!(A || se.inputId), le = W >= 0 ? `${F}-${W}` : void 0;
87
87
  return /* @__PURE__ */ m("div", {
88
- ref: re,
89
- className: s("relative", A),
90
- ...M,
91
- children: [/* @__PURE__ */ p(ee, {
92
- ref: ie,
88
+ ref: ie,
89
+ className: s("relative", k),
90
+ ...ne,
91
+ children: [/* @__PURE__ */ p(u, {
92
+ ref: ae,
93
93
  type: "text",
94
94
  role: "combobox",
95
- size: T,
96
- state: E,
97
- id: j,
98
- value: V,
99
- placeholder: S,
100
- disabled: w,
101
- "aria-expanded": U,
95
+ size: w,
96
+ state: T,
97
+ id: A,
98
+ value: B,
99
+ placeholder: x,
100
+ disabled: C,
101
+ "aria-expanded": H,
102
102
  "aria-autocomplete": "list",
103
- "aria-controls": U ? F : void 0,
103
+ "aria-controls": H ? P : void 0,
104
104
  "aria-activedescendant": le,
105
- "aria-label": ce ? void 0 : S,
106
- endSection: D ? /* @__PURE__ */ p(c, { size: "sm" }) : void 0,
105
+ "aria-label": ce ? void 0 : x,
106
+ endSection: E ? /* @__PURE__ */ p(c, { size: "sm" }) : void 0,
107
107
  onChange: (e) => {
108
- H(e.target.value), W(!0), K(-1);
108
+ V(e.target.value), U(!0), G(-1);
109
109
  },
110
- onFocus: () => W(!0),
110
+ onFocus: () => U(!0),
111
111
  onBlur: (e) => {
112
112
  let t = e.relatedTarget;
113
- !J.current?.contains(t) && !Y.current?.contains(t) && W(!1);
113
+ !q.current?.contains(t) && !J.current?.contains(t) && U(!1);
114
114
  },
115
- onKeyDown: oe
116
- }), typeof document < "u" && h(/* @__PURE__ */ p(g, { children: U && /* @__PURE__ */ p(_.ul, {
117
- id: F,
118
- ref: ae,
115
+ onKeyDown: $
116
+ }), typeof document < "u" && te(/* @__PURE__ */ p(h, { children: H && /* @__PURE__ */ p(g.ul, {
117
+ id: P,
118
+ ref: oe,
119
119
  role: "listbox",
120
- initial: !X && { opacity: 0 },
120
+ initial: !Y && { opacity: 0 },
121
121
  animate: { opacity: 1 },
122
- exit: X ? { opacity: 1 } : { opacity: 0 },
123
- transition: X ? { duration: 0 } : o.fade,
124
- style: ne,
122
+ exit: Y ? { opacity: 1 } : { opacity: 0 },
123
+ transition: Y ? { duration: 0 } : a.fade,
124
+ style: re,
125
125
  className: "z-popover overflow-auto rounded-overlay bg-surface-overlay shadow-raised-hover",
126
- children: D ? /* @__PURE__ */ m("li", {
126
+ children: E ? /* @__PURE__ */ m("li", {
127
127
  className: "flex items-center gap-ds-03 px-ds-04 py-ds-03 text-body-md text-surface-fg-muted",
128
- children: [/* @__PURE__ */ p(c, { size: "sm" }), O]
129
- }) : Q.length === 0 ? /* @__PURE__ */ p("li", {
128
+ children: [/* @__PURE__ */ p(c, { size: "sm" }), D]
129
+ }) : Z.length === 0 ? /* @__PURE__ */ p("li", {
130
130
  className: "px-ds-04 py-ds-03 text-body-md text-surface-fg-muted",
131
- children: C
132
- }) : Q.map((e, t) => /* @__PURE__ */ p("li", {
133
- id: `${I}-${t}`,
131
+ children: S
132
+ }) : Z.map((e, t) => /* @__PURE__ */ p("li", {
133
+ id: `${F}-${t}`,
134
134
  role: "option",
135
- "aria-selected": G === t,
135
+ "aria-selected": W === t,
136
136
  title: e.label,
137
- className: s("cursor-pointer truncate px-ds-04 py-ds-03 text-body-md text-surface-fg transition-colors duration-fast-01", G === t && "bg-accent-3", B?.value === e.value && "font-semibold"),
137
+ className: s("cursor-pointer truncate px-ds-04 py-ds-03 text-body-md text-surface-fg transition-colors duration-fast-01", W === t && "bg-accent-4", z?.value === e.value && "font-semibold"),
138
138
  onMouseDown: (e) => e.preventDefault(),
139
- onClick: () => $(e),
140
- onMouseEnter: () => K(t),
141
- children: k ? k(e, V) : /* @__PURE__ */ p(v, {
139
+ onClick: () => Q(e),
140
+ onMouseEnter: () => G(t),
141
+ children: O ? O(e, B) : /* @__PURE__ */ p(_, {
142
142
  label: e.label,
143
- query: V
143
+ query: B
144
144
  })
145
145
  }, e.value))
146
146
  }) }), document.body)]
147
147
  });
148
148
  });
149
- y.displayName = "Autocomplete";
149
+ v.displayName = "Autocomplete";
150
150
  //#endregion
151
- export { y as Autocomplete };
151
+ export { v as Autocomplete };