@inspirare/design-system 0.0.22 → 0.0.24

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 (297) hide show
  1. package/README.md +82 -61
  2. package/dist/book-logo-filled.svg +55 -0
  3. package/dist/components/ui/accessibility-improvements.js +26 -23
  4. package/dist/components/ui/accordion.js +34 -24
  5. package/dist/components/ui/alert-dialog.js +91 -57
  6. package/dist/components/ui/alert.js +38 -26
  7. package/dist/components/ui/aspect-ratio.js +11 -3
  8. package/dist/components/ui/avatar.js +30 -8
  9. package/dist/components/ui/badge.js +20 -14
  10. package/dist/components/ui/breadcrumb.js +69 -56
  11. package/dist/components/ui/button-group.js +17 -13
  12. package/dist/components/ui/button.js +19 -15
  13. package/dist/components/ui/calendar.js +63 -59
  14. package/dist/components/ui/card.js +11 -9
  15. package/dist/components/ui/carousel.js +70 -75
  16. package/dist/components/ui/chart.js +75 -72
  17. package/dist/components/ui/checkbox.js +4 -5
  18. package/dist/components/ui/collapsible.js +12 -14
  19. package/dist/components/ui/color-picker.js +60 -80
  20. package/dist/components/ui/combobox.js +153 -33
  21. package/dist/components/ui/command.js +50 -48
  22. package/dist/components/ui/context-menu.js +129 -68
  23. package/dist/components/ui/dialog.js +65 -60
  24. package/dist/components/ui/drawer.js +81 -40
  25. package/dist/components/ui/dropdown-menu.js +100 -87
  26. package/dist/components/ui/empty.js +7 -6
  27. package/dist/components/ui/field.js +44 -47
  28. package/dist/components/ui/form.js +22 -23
  29. package/dist/components/ui/hover-card.js +14 -11
  30. package/dist/components/ui/input-group.js +16 -13
  31. package/dist/components/ui/input-otp.js +37 -32
  32. package/dist/components/ui/input.js +9 -7
  33. package/dist/components/ui/item.js +42 -36
  34. package/dist/components/ui/kbd.js +2 -1
  35. package/dist/components/ui/label.js +6 -7
  36. package/dist/components/ui/menubar.js +124 -93
  37. package/dist/components/ui/navigation-menu.js +79 -54
  38. package/dist/components/ui/pagination.js +78 -58
  39. package/dist/components/ui/popover.js +35 -16
  40. package/dist/components/ui/progress.js +37 -13
  41. package/dist/components/ui/radio-group.js +14 -14
  42. package/dist/components/ui/resizable.js +24 -15
  43. package/dist/components/ui/scroll-area.js +29 -11
  44. package/dist/components/ui/select.js +98 -56
  45. package/dist/components/ui/separator.js +5 -7
  46. package/dist/components/ui/sheet.js +47 -42
  47. package/dist/components/ui/sidebar.js +279 -248
  48. package/dist/components/ui/skeleton.js +4 -40
  49. package/dist/components/ui/slider.js +27 -29
  50. package/dist/components/ui/sonner.js +27 -10
  51. package/dist/components/ui/spinner.js +2 -0
  52. package/dist/components/ui/switch.js +3 -4
  53. package/dist/components/ui/table.js +6 -6
  54. package/dist/components/ui/tabs.js +45 -22
  55. package/dist/components/ui/textarea.js +3 -2
  56. package/dist/components/ui/theme-toggle.js +38 -41
  57. package/dist/components/ui/toggle-group.js +30 -21
  58. package/dist/components/ui/toggle.js +8 -9
  59. package/dist/components/ui/tooltip.js +28 -23
  60. package/dist/index.css +1 -1
  61. package/dist/index.d.ts +446 -468
  62. package/dist/index.js +58 -58
  63. package/package.json +42 -41
  64. package/src/App.tsx +28 -34
  65. package/src/components/branding/assets/book-logo-filled.svg +55 -0
  66. package/src/components/branding/logo/logo.tsx +56 -0
  67. package/src/components/ui/accessibility-improvements.stories.tsx +18 -0
  68. package/src/components/ui/accessibility-improvements.test.tsx +13 -0
  69. package/src/components/ui/accessibility-improvements.tsx +16 -6
  70. package/src/components/ui/accordion.stories.tsx +19 -0
  71. package/src/components/ui/accordion.test.tsx +14 -0
  72. package/src/components/ui/accordion.tsx +28 -20
  73. package/src/components/ui/alert-dialog.stories.tsx +19 -0
  74. package/src/components/ui/alert-dialog.test.tsx +14 -0
  75. package/src/components/ui/alert-dialog.tsx +159 -123
  76. package/src/components/ui/alert.stories.tsx +19 -0
  77. package/src/components/ui/alert.test.tsx +14 -0
  78. package/src/components/ui/alert.tsx +60 -41
  79. package/src/components/ui/aspect-ratio.stories.tsx +19 -0
  80. package/src/components/ui/aspect-ratio.test.tsx +14 -0
  81. package/src/components/ui/aspect-ratio.tsx +19 -2
  82. package/src/components/ui/attachment.stories.tsx +19 -0
  83. package/src/components/ui/attachment.test.tsx +14 -0
  84. package/src/components/ui/attachment.tsx +209 -0
  85. package/src/components/ui/avatar.stories.tsx +19 -0
  86. package/src/components/ui/avatar.test.tsx +14 -0
  87. package/src/components/ui/avatar.tsx +73 -17
  88. package/src/components/ui/badge.stories.tsx +19 -0
  89. package/src/components/ui/badge.test.tsx +14 -0
  90. package/src/components/ui/badge.tsx +33 -25
  91. package/src/components/ui/breadcrumb.stories.tsx +19 -0
  92. package/src/components/ui/breadcrumb.test.tsx +14 -0
  93. package/src/components/ui/breadcrumb.tsx +98 -86
  94. package/src/components/ui/bubble.stories.tsx +19 -0
  95. package/src/components/ui/bubble.test.tsx +14 -0
  96. package/src/components/ui/bubble.tsx +130 -0
  97. package/src/components/ui/button-group.stories.tsx +19 -0
  98. package/src/components/ui/button-group.test.tsx +14 -0
  99. package/src/components/ui/button-group.tsx +26 -20
  100. package/src/components/ui/button.stories.tsx +19 -0
  101. package/src/components/ui/button.test.tsx +14 -0
  102. package/src/components/ui/button.tsx +30 -31
  103. package/src/components/ui/calendar.stories.tsx +19 -0
  104. package/src/components/ui/calendar.test.tsx +14 -0
  105. package/src/components/ui/calendar.tsx +28 -26
  106. package/src/components/ui/card.stories.tsx +19 -0
  107. package/src/components/ui/card.test.tsx +14 -0
  108. package/src/components/ui/card.tsx +30 -17
  109. package/src/components/ui/carousel.stories.tsx +19 -0
  110. package/src/components/ui/carousel.test.tsx +14 -0
  111. package/src/components/ui/carousel.tsx +115 -135
  112. package/src/components/ui/chart.stories.tsx +18 -0
  113. package/src/components/ui/chart.test.tsx +13 -0
  114. package/src/components/ui/chart.tsx +220 -216
  115. package/src/components/ui/checkbox.stories.tsx +19 -0
  116. package/src/components/ui/checkbox.test.tsx +14 -0
  117. package/src/components/ui/checkbox.tsx +7 -10
  118. package/src/components/ui/collapsible.stories.tsx +19 -0
  119. package/src/components/ui/collapsible.test.tsx +14 -0
  120. package/src/components/ui/collapsible.tsx +11 -26
  121. package/src/components/ui/color-picker.stories.tsx +19 -0
  122. package/src/components/ui/color-picker.test.tsx +14 -0
  123. package/src/components/ui/color-picker.tsx +36 -26
  124. package/src/components/ui/combobox.stories.tsx +19 -0
  125. package/src/components/ui/combobox.test.tsx +14 -0
  126. package/src/components/ui/combobox.tsx +281 -96
  127. package/src/components/ui/command.stories.tsx +19 -0
  128. package/src/components/ui/command.test.tsx +14 -0
  129. package/src/components/ui/command.tsx +59 -47
  130. package/src/components/ui/context-menu.stories.tsx +19 -0
  131. package/src/components/ui/context-menu.test.tsx +14 -0
  132. package/src/components/ui/context-menu.tsx +231 -160
  133. package/src/components/ui/dialog.stories.tsx +19 -0
  134. package/src/components/ui/dialog.test.tsx +14 -0
  135. package/src/components/ui/dialog.tsx +81 -72
  136. package/src/components/ui/direction.stories.tsx +19 -0
  137. package/src/components/ui/direction.test.tsx +14 -0
  138. package/src/components/ui/direction.tsx +6 -0
  139. package/src/components/ui/drawer.stories.tsx +19 -0
  140. package/src/components/ui/drawer.test.tsx +14 -0
  141. package/src/components/ui/drawer.tsx +143 -64
  142. package/src/components/ui/dropdown-menu.stories.tsx +19 -0
  143. package/src/components/ui/dropdown-menu.test.tsx +14 -0
  144. package/src/components/ui/dropdown-menu.tsx +199 -153
  145. package/src/components/ui/empty.stories.tsx +18 -0
  146. package/src/components/ui/empty.test.tsx +13 -0
  147. package/src/components/ui/empty.tsx +11 -9
  148. package/src/components/ui/field.stories.tsx +18 -0
  149. package/src/components/ui/field.test.tsx +13 -0
  150. package/src/components/ui/field.tsx +26 -32
  151. package/src/components/ui/form.stories.tsx +22 -0
  152. package/src/components/ui/form.test.tsx +15 -0
  153. package/src/components/ui/form.tsx +1 -2
  154. package/src/components/ui/hover-card.stories.tsx +19 -0
  155. package/src/components/ui/hover-card.test.tsx +14 -0
  156. package/src/components/ui/hover-card.tsx +34 -32
  157. package/src/components/ui/input-group.stories.tsx +18 -0
  158. package/src/components/ui/input-group.test.tsx +13 -0
  159. package/src/components/ui/input-group.tsx +21 -28
  160. package/src/components/ui/input-otp.stories.tsx +19 -0
  161. package/src/components/ui/input-otp.test.tsx +14 -0
  162. package/src/components/ui/input-otp.tsx +58 -42
  163. package/src/components/ui/input.stories.tsx +19 -0
  164. package/src/components/ui/input.test.tsx +14 -0
  165. package/src/components/ui/input.tsx +9 -8
  166. package/src/components/ui/item.stories.tsx +18 -0
  167. package/src/components/ui/item.test.tsx +13 -0
  168. package/src/components/ui/item.tsx +38 -28
  169. package/src/components/ui/kbd.stories.tsx +18 -0
  170. package/src/components/ui/kbd.test.tsx +13 -0
  171. package/src/components/ui/kbd.tsx +3 -3
  172. package/src/components/ui/label.stories.tsx +18 -0
  173. package/src/components/ui/label.test.tsx +13 -0
  174. package/src/components/ui/label.tsx +7 -11
  175. package/src/components/ui/marker.stories.tsx +19 -0
  176. package/src/components/ui/marker.test.tsx +14 -0
  177. package/src/components/ui/marker.tsx +73 -0
  178. package/src/components/ui/menubar.stories.tsx +19 -0
  179. package/src/components/ui/menubar.test.tsx +14 -0
  180. package/src/components/ui/menubar.tsx +226 -202
  181. package/src/components/ui/message-scroller.stories.tsx +19 -0
  182. package/src/components/ui/message-scroller.test.tsx +14 -0
  183. package/src/components/ui/message-scroller.tsx +131 -0
  184. package/src/components/ui/message.stories.tsx +19 -0
  185. package/src/components/ui/message.test.tsx +14 -0
  186. package/src/components/ui/message.tsx +94 -0
  187. package/src/components/ui/native-select.stories.tsx +18 -0
  188. package/src/components/ui/native-select.test.tsx +13 -0
  189. package/src/components/ui/native-select.tsx +63 -0
  190. package/src/components/ui/navigation-menu.stories.tsx +19 -0
  191. package/src/components/ui/navigation-menu.test.tsx +14 -0
  192. package/src/components/ui/navigation-menu.tsx +145 -103
  193. package/src/components/ui/pagination.stories.tsx +19 -0
  194. package/src/components/ui/pagination.test.tsx +14 -0
  195. package/src/components/ui/pagination.tsx +114 -83
  196. package/src/components/ui/popover.stories.tsx +19 -0
  197. package/src/components/ui/popover.test.tsx +14 -0
  198. package/src/components/ui/popover.tsx +68 -33
  199. package/src/components/ui/progress.stories.tsx +19 -0
  200. package/src/components/ui/progress.test.tsx +14 -0
  201. package/src/components/ui/progress.tsx +67 -15
  202. package/src/components/ui/questionnaire.stories.tsx +19 -0
  203. package/src/components/ui/questionnaire.test.tsx +14 -0
  204. package/src/components/ui/questionnaire.tsx +324 -0
  205. package/src/components/ui/radio-group.stories.tsx +19 -0
  206. package/src/components/ui/radio-group.test.tsx +14 -0
  207. package/src/components/ui/radio-group.tsx +15 -20
  208. package/src/components/ui/resizable.stories.tsx +19 -0
  209. package/src/components/ui/resizable.test.tsx +14 -0
  210. package/src/components/ui/resizable.tsx +37 -30
  211. package/src/components/ui/scroll-area.stories.tsx +19 -0
  212. package/src/components/ui/scroll-area.test.tsx +14 -0
  213. package/src/components/ui/scroll-area.tsx +41 -19
  214. package/src/components/ui/select.stories.tsx +19 -0
  215. package/src/components/ui/select.test.tsx +14 -0
  216. package/src/components/ui/select.tsx +145 -78
  217. package/src/components/ui/separator.stories.tsx +19 -0
  218. package/src/components/ui/separator.test.tsx +14 -0
  219. package/src/components/ui/separator.tsx +8 -11
  220. package/src/components/ui/sheet.stories.tsx +19 -0
  221. package/src/components/ui/sheet.test.tsx +14 -0
  222. package/src/components/ui/sheet.tsx +56 -71
  223. package/src/components/ui/sidebar.stories.tsx +18 -0
  224. package/src/components/ui/sidebar.test.tsx +13 -0
  225. package/src/components/ui/sidebar.tsx +469 -513
  226. package/src/components/ui/skeleton.stories.tsx +19 -0
  227. package/src/components/ui/skeleton.test.tsx +14 -0
  228. package/src/components/ui/skeleton.tsx +8 -114
  229. package/src/components/ui/slider.stories.tsx +19 -0
  230. package/src/components/ui/slider.test.tsx +14 -0
  231. package/src/components/ui/slider.tsx +31 -40
  232. package/src/components/ui/sonner.stories.tsx +19 -0
  233. package/src/components/ui/sonner.test.tsx +14 -0
  234. package/src/components/ui/sonner.tsx +39 -7
  235. package/src/components/ui/spinner.stories.tsx +18 -0
  236. package/src/components/ui/spinner.test.tsx +13 -0
  237. package/src/components/ui/spinner.tsx +3 -7
  238. package/src/components/ui/switch.stories.tsx +19 -0
  239. package/src/components/ui/switch.test.tsx +14 -0
  240. package/src/components/ui/switch.tsx +4 -7
  241. package/src/components/ui/table.stories.tsx +19 -0
  242. package/src/components/ui/table.test.tsx +14 -0
  243. package/src/components/ui/table.tsx +17 -17
  244. package/src/components/ui/tabs.stories.tsx +19 -0
  245. package/src/components/ui/tabs.test.tsx +14 -0
  246. package/src/components/ui/tabs.tsx +71 -31
  247. package/src/components/ui/textarea.stories.tsx +19 -0
  248. package/src/components/ui/textarea.test.tsx +14 -0
  249. package/src/components/ui/textarea.tsx +7 -5
  250. package/src/components/ui/theme-toggle.stories.tsx +18 -0
  251. package/src/components/ui/theme-toggle.test.tsx +13 -0
  252. package/src/components/ui/theme-toggle.tsx +35 -37
  253. package/src/components/ui/toggle-group.stories.tsx +19 -0
  254. package/src/components/ui/toggle-group.test.tsx +14 -0
  255. package/src/components/ui/toggle-group.tsx +41 -25
  256. package/src/components/ui/toggle.stories.tsx +19 -0
  257. package/src/components/ui/toggle.test.tsx +14 -0
  258. package/src/components/ui/toggle.tsx +17 -19
  259. package/src/components/ui/tooltip.stories.tsx +19 -0
  260. package/src/components/ui/tooltip.test.tsx +14 -0
  261. package/src/components/ui/tooltip.tsx +53 -44
  262. package/src/demo/AIDemo.tsx +50 -0
  263. package/src/demo/ButtonsDemo.tsx +41 -18
  264. package/src/demo/CalendarDemo.tsx +1 -1
  265. package/src/demo/FeedbackDemo.tsx +4 -6
  266. package/src/demo/FormsDemo.tsx +34 -11
  267. package/src/demo/NavigationDemo.tsx +38 -13
  268. package/src/demo/OverlaysDemo.tsx +22 -36
  269. package/src/demo/update-demos.js +82 -0
  270. package/src/index.css +66 -46
  271. package/src/lib/utils.ts +3 -3
  272. package/src/stories/Button.stories.ts +54 -0
  273. package/src/stories/Button.tsx +36 -0
  274. package/src/stories/Configure.mdx +388 -0
  275. package/src/stories/Header.stories.ts +34 -0
  276. package/src/stories/Header.tsx +55 -0
  277. package/src/stories/Page.stories.ts +33 -0
  278. package/src/stories/Page.tsx +73 -0
  279. package/src/stories/assets/accessibility.png +0 -0
  280. package/src/stories/assets/accessibility.svg +1 -0
  281. package/src/stories/assets/addon-library.png +0 -0
  282. package/src/stories/assets/assets.png +0 -0
  283. package/src/stories/assets/avif-test-image.avif +0 -0
  284. package/src/stories/assets/context.png +0 -0
  285. package/src/stories/assets/discord.svg +1 -0
  286. package/src/stories/assets/docs.png +0 -0
  287. package/src/stories/assets/figma-plugin.png +0 -0
  288. package/src/stories/assets/github.svg +1 -0
  289. package/src/stories/assets/share.png +0 -0
  290. package/src/stories/assets/styling.png +0 -0
  291. package/src/stories/assets/testing.png +0 -0
  292. package/src/stories/assets/theming.png +0 -0
  293. package/src/stories/assets/tutorials.svg +1 -0
  294. package/src/stories/assets/youtube.svg +1 -0
  295. package/src/stories/button.css +30 -0
  296. package/src/stories/header.css +32 -0
  297. package/src/stories/page.css +68 -0
@@ -1,185 +1,256 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
- import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
5
- import { Check, ChevronRight, Circle } from "lucide-react"
4
+ import { ContextMenu as ContextMenuPrimitive } from "@base-ui/react/context-menu"
6
5
 
7
6
  import { cn } from "@/lib/utils"
7
+ import { ChevronRightIcon, CheckIcon } from "lucide-react"
8
8
 
9
- const ContextMenu = ContextMenuPrimitive.Root
10
-
11
- const ContextMenuTrigger = ContextMenuPrimitive.Trigger
12
-
13
- const ContextMenuGroup = ContextMenuPrimitive.Group
14
-
15
- const ContextMenuPortal = ContextMenuPrimitive.Portal
16
-
17
- const ContextMenuSub = ContextMenuPrimitive.Sub
18
-
19
- const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
20
-
21
- const ContextMenuSubTrigger = React.forwardRef<
22
- React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
23
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
24
- inset?: boolean
25
- }
26
- >(({ className, inset, children, ...props }, ref) => (
27
- <ContextMenuPrimitive.SubTrigger
28
- ref={ref}
29
- className={cn(
30
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
31
- inset && "pl-8",
32
- className
33
- )}
34
- {...props}
35
- >
36
- {children}
37
- <ChevronRight className="ml-auto h-4 w-4" />
38
- </ContextMenuPrimitive.SubTrigger>
39
- ))
40
- ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
41
-
42
- const ContextMenuSubContent = React.forwardRef<
43
- React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
44
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
45
- >(({ className, ...props }, ref) => (
46
- <ContextMenuPrimitive.SubContent
47
- ref={ref}
48
- className={cn(
49
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
50
- className
51
- )}
52
- {...props}
53
- />
54
- ))
55
- ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
56
-
57
- const ContextMenuContent = React.forwardRef<
58
- React.ElementRef<typeof ContextMenuPrimitive.Content>,
59
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
60
- >(({ className, ...props }, ref) => (
61
- <ContextMenuPrimitive.Portal>
62
- <ContextMenuPrimitive.Content
63
- ref={ref}
9
+ function ContextMenu({ ...props }: ContextMenuPrimitive.Root.Props) {
10
+ return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
11
+ }
12
+
13
+ function ContextMenuPortal({ ...props }: ContextMenuPrimitive.Portal.Props) {
14
+ return (
15
+ <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
16
+ )
17
+ }
18
+
19
+ function ContextMenuTrigger({
20
+ className,
21
+ ...props
22
+ }: ContextMenuPrimitive.Trigger.Props) {
23
+ return (
24
+ <ContextMenuPrimitive.Trigger
25
+ data-slot="context-menu-trigger"
26
+ className={cn("select-none", className)}
27
+ {...props}
28
+ />
29
+ )
30
+ }
31
+
32
+ function ContextMenuContent({
33
+ className,
34
+ align = "start",
35
+ alignOffset = 4,
36
+ side = "right",
37
+ sideOffset = 0,
38
+ ...props
39
+ }: ContextMenuPrimitive.Popup.Props &
40
+ Pick<
41
+ ContextMenuPrimitive.Positioner.Props,
42
+ "align" | "alignOffset" | "side" | "sideOffset"
43
+ >) {
44
+ return (
45
+ <ContextMenuPrimitive.Portal>
46
+ <ContextMenuPrimitive.Positioner
47
+ className="isolate z-50 outline-none"
48
+ align={align}
49
+ alignOffset={alignOffset}
50
+ side={side}
51
+ sideOffset={sideOffset}
52
+ >
53
+ <ContextMenuPrimitive.Popup
54
+ data-slot="context-menu-content"
55
+ className={cn("z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
56
+ {...props}
57
+ />
58
+ </ContextMenuPrimitive.Positioner>
59
+ </ContextMenuPrimitive.Portal>
60
+ )
61
+ }
62
+
63
+ function ContextMenuGroup({ ...props }: ContextMenuPrimitive.Group.Props) {
64
+ return (
65
+ <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
66
+ )
67
+ }
68
+
69
+ function ContextMenuLabel({
70
+ className,
71
+ inset,
72
+ ...props
73
+ }: ContextMenuPrimitive.GroupLabel.Props & {
74
+ inset?: boolean
75
+ }) {
76
+ return (
77
+ <ContextMenuPrimitive.GroupLabel
78
+ data-slot="context-menu-label"
79
+ data-inset={inset}
80
+ className={cn(
81
+ "px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",
82
+ className
83
+ )}
84
+ {...props}
85
+ />
86
+ )
87
+ }
88
+
89
+ function ContextMenuItem({
90
+ className,
91
+ inset,
92
+ variant = "default",
93
+ ...props
94
+ }: ContextMenuPrimitive.Item.Props & {
95
+ inset?: boolean
96
+ variant?: "default" | "destructive"
97
+ }) {
98
+ return (
99
+ <ContextMenuPrimitive.Item
100
+ data-slot="context-menu-item"
101
+ data-inset={inset}
102
+ data-variant={variant}
64
103
  className={cn(
65
- "z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
104
+ "group/context-menu-item relative flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive",
66
105
  className
67
106
  )}
68
107
  {...props}
69
108
  />
70
- </ContextMenuPrimitive.Portal>
71
- ))
72
- ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
73
-
74
- const ContextMenuItem = React.forwardRef<
75
- React.ElementRef<typeof ContextMenuPrimitive.Item>,
76
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
77
- inset?: boolean
78
- }
79
- >(({ className, inset, ...props }, ref) => (
80
- <ContextMenuPrimitive.Item
81
- ref={ref}
82
- className={cn(
83
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
84
- inset && "pl-8",
85
- className
86
- )}
87
- {...props}
88
- />
89
- ))
90
- ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
91
-
92
- const ContextMenuCheckboxItem = React.forwardRef<
93
- React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
94
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
95
- >(({ className, children, checked, ...props }, ref) => (
96
- <ContextMenuPrimitive.CheckboxItem
97
- ref={ref}
98
- className={cn(
99
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
100
- className
101
- )}
102
- checked={checked}
103
- {...props}
104
- >
105
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
106
- <ContextMenuPrimitive.ItemIndicator>
107
- <Check className="h-4 w-4" />
108
- </ContextMenuPrimitive.ItemIndicator>
109
- </span>
110
- {children}
111
- </ContextMenuPrimitive.CheckboxItem>
112
- ))
113
- ContextMenuCheckboxItem.displayName =
114
- ContextMenuPrimitive.CheckboxItem.displayName
115
-
116
- const ContextMenuRadioItem = React.forwardRef<
117
- React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
118
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
119
- >(({ className, children, ...props }, ref) => (
120
- <ContextMenuPrimitive.RadioItem
121
- ref={ref}
122
- className={cn(
123
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
124
- className
125
- )}
126
- {...props}
127
- >
128
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
129
- <ContextMenuPrimitive.ItemIndicator>
130
- <Circle className="h-2 w-2 fill-current" />
131
- </ContextMenuPrimitive.ItemIndicator>
132
- </span>
133
- {children}
134
- </ContextMenuPrimitive.RadioItem>
135
- ))
136
- ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
137
-
138
- const ContextMenuLabel = React.forwardRef<
139
- React.ElementRef<typeof ContextMenuPrimitive.Label>,
140
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
141
- inset?: boolean
142
- }
143
- >(({ className, inset, ...props }, ref) => (
144
- <ContextMenuPrimitive.Label
145
- ref={ref}
146
- className={cn(
147
- "px-2 py-1.5 text-sm font-semibold text-foreground",
148
- inset && "pl-8",
149
- className
150
- )}
151
- {...props}
152
- />
153
- ))
154
- ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
155
-
156
- const ContextMenuSeparator = React.forwardRef<
157
- React.ElementRef<typeof ContextMenuPrimitive.Separator>,
158
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
159
- >(({ className, ...props }, ref) => (
160
- <ContextMenuPrimitive.Separator
161
- ref={ref}
162
- className={cn("-mx-1 my-1 h-px bg-border", className)}
163
- {...props}
164
- />
165
- ))
166
- ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
167
-
168
- const ContextMenuShortcut = ({
109
+ )
110
+ }
111
+
112
+ function ContextMenuSub({ ...props }: ContextMenuPrimitive.SubmenuRoot.Props) {
113
+ return (
114
+ <ContextMenuPrimitive.SubmenuRoot data-slot="context-menu-sub" {...props} />
115
+ )
116
+ }
117
+
118
+ function ContextMenuSubTrigger({
119
+ className,
120
+ inset,
121
+ children,
122
+ ...props
123
+ }: ContextMenuPrimitive.SubmenuTrigger.Props & {
124
+ inset?: boolean
125
+ }) {
126
+ return (
127
+ <ContextMenuPrimitive.SubmenuTrigger
128
+ data-slot="context-menu-sub-trigger"
129
+ data-inset={inset}
130
+ className={cn(
131
+ "flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
132
+ className
133
+ )}
134
+ {...props}
135
+ >
136
+ {children}
137
+ <ChevronRightIcon className="ml-auto" />
138
+ </ContextMenuPrimitive.SubmenuTrigger>
139
+ )
140
+ }
141
+
142
+ function ContextMenuSubContent({
143
+ ...props
144
+ }: React.ComponentProps<typeof ContextMenuContent>) {
145
+ return (
146
+ <ContextMenuContent
147
+ data-slot="context-menu-sub-content"
148
+ className="shadow-lg"
149
+ side="right"
150
+ {...props}
151
+ />
152
+ )
153
+ }
154
+
155
+ function ContextMenuCheckboxItem({
156
+ className,
157
+ children,
158
+ checked,
159
+ inset,
160
+ ...props
161
+ }: ContextMenuPrimitive.CheckboxItem.Props & {
162
+ inset?: boolean
163
+ }) {
164
+ return (
165
+ <ContextMenuPrimitive.CheckboxItem
166
+ data-slot="context-menu-checkbox-item"
167
+ data-inset={inset}
168
+ className={cn(
169
+ "relative flex cursor-pointer items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
170
+ className
171
+ )}
172
+ checked={checked}
173
+ {...props}
174
+ >
175
+ <span className="pointer-events-none absolute right-2">
176
+ <ContextMenuPrimitive.CheckboxItemIndicator>
177
+ <CheckIcon
178
+ />
179
+ </ContextMenuPrimitive.CheckboxItemIndicator>
180
+ </span>
181
+ {children}
182
+ </ContextMenuPrimitive.CheckboxItem>
183
+ )
184
+ }
185
+
186
+ function ContextMenuRadioGroup({
187
+ ...props
188
+ }: ContextMenuPrimitive.RadioGroup.Props) {
189
+ return (
190
+ <ContextMenuPrimitive.RadioGroup
191
+ data-slot="context-menu-radio-group"
192
+ {...props}
193
+ />
194
+ )
195
+ }
196
+
197
+ function ContextMenuRadioItem({
198
+ className,
199
+ children,
200
+ inset,
201
+ ...props
202
+ }: ContextMenuPrimitive.RadioItem.Props & {
203
+ inset?: boolean
204
+ }) {
205
+ return (
206
+ <ContextMenuPrimitive.RadioItem
207
+ data-slot="context-menu-radio-item"
208
+ data-inset={inset}
209
+ className={cn(
210
+ "relative flex cursor-pointer items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
211
+ className
212
+ )}
213
+ {...props}
214
+ >
215
+ <span className="pointer-events-none absolute right-2">
216
+ <ContextMenuPrimitive.RadioItemIndicator>
217
+ <CheckIcon
218
+ />
219
+ </ContextMenuPrimitive.RadioItemIndicator>
220
+ </span>
221
+ {children}
222
+ </ContextMenuPrimitive.RadioItem>
223
+ )
224
+ }
225
+
226
+ function ContextMenuSeparator({
227
+ className,
228
+ ...props
229
+ }: ContextMenuPrimitive.Separator.Props) {
230
+ return (
231
+ <ContextMenuPrimitive.Separator
232
+ data-slot="context-menu-separator"
233
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
234
+ {...props}
235
+ />
236
+ )
237
+ }
238
+
239
+ function ContextMenuShortcut({
169
240
  className,
170
241
  ...props
171
- }: React.HTMLAttributes<HTMLSpanElement>) => {
242
+ }: React.ComponentProps<"span">) {
172
243
  return (
173
244
  <span
245
+ data-slot="context-menu-shortcut"
174
246
  className={cn(
175
- "ml-auto text-xs tracking-widest text-muted-foreground",
247
+ "ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground",
176
248
  className
177
249
  )}
178
250
  {...props}
179
251
  />
180
252
  )
181
253
  }
182
- ContextMenuShortcut.displayName = "ContextMenuShortcut"
183
254
 
184
255
  export {
185
256
  ContextMenu,
@@ -0,0 +1,19 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "./dialog";
3
+
4
+ const meta = {
5
+ title: 'Design System/Dialog',
6
+ parameters: { layout: 'centered' },
7
+ tags: ['autodocs'],
8
+ } satisfies Meta;
9
+
10
+ export default meta;
11
+ type Story = StoryObj<typeof meta>;
12
+
13
+ export const Default: Story = {
14
+ render: () => (
15
+ <div className="p-4 w-full h-full flex items-center justify-center">
16
+ <Dialog><DialogTrigger className="px-4 py-2 border rounded">Edit Profile</DialogTrigger><DialogContent className="sm:max-w-[425px]"><DialogHeader><DialogTitle>Edit profile</DialogTitle><DialogDescription>Make changes to your profile here.</DialogDescription></DialogHeader></DialogContent></Dialog>
17
+ </div>
18
+ )
19
+ };
@@ -0,0 +1,14 @@
1
+ import { render } from '@testing-library/react';
2
+ import { axe } from 'jest-axe';
3
+ import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "./dialog";
4
+
5
+ describe('Dialog Accessibility', () => {
6
+ it('should have no accessibility violations in basic render', async () => {
7
+ const Wrapper = () => (
8
+ <Dialog><DialogTrigger className="px-4 py-2 border rounded">Edit Profile</DialogTrigger><DialogContent className="sm:max-w-[425px]"><DialogHeader><DialogTitle>Edit profile</DialogTitle><DialogDescription>Make changes to your profile here.</DialogDescription></DialogHeader></DialogContent></Dialog>
9
+ );
10
+ const { container } = render(<Wrapper />);
11
+ const results = await axe(container);
12
+ expect(results).toHaveNoViolations();
13
+ });
14
+ });