@carlonicora/nextjs-jsonapi 1.17.0 → 1.19.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 (113) hide show
  1. package/README.md +1 -1
  2. package/dist/{BlockNoteEditor-4Z6TZBJE.mjs → BlockNoteEditor-BQ5WWVUF.mjs} +2 -2
  3. package/dist/{BlockNoteEditor-34T5CY27.js → BlockNoteEditor-IZR6TESC.js} +6 -6
  4. package/dist/{BlockNoteEditor-34T5CY27.js.map → BlockNoteEditor-IZR6TESC.js.map} +1 -1
  5. package/dist/{chunk-D7H7SRWB.js → chunk-FB535VUS.js} +3977 -2496
  6. package/dist/chunk-FB535VUS.js.map +1 -0
  7. package/dist/{chunk-SXPXC2TY.mjs → chunk-MVNVXOC6.mjs} +5809 -4328
  8. package/dist/chunk-MVNVXOC6.mjs.map +1 -0
  9. package/dist/client/index.js +2 -2
  10. package/dist/client/index.mjs +1 -1
  11. package/dist/components/index.d.mts +298 -385
  12. package/dist/components/index.d.ts +298 -385
  13. package/dist/components/index.js +26 -2
  14. package/dist/components/index.js.map +1 -1
  15. package/dist/components/index.mjs +35 -11
  16. package/dist/contexts/index.js +2 -2
  17. package/dist/contexts/index.mjs +1 -1
  18. package/dist/scripts/generate-web-module/templates/components/editor.template.d.ts.map +1 -1
  19. package/dist/scripts/generate-web-module/templates/components/editor.template.js +20 -6
  20. package/dist/scripts/generate-web-module/templates/components/editor.template.js.map +1 -1
  21. package/dist/scripts/generate-web-module/templates/components/selector.template.d.ts.map +1 -1
  22. package/dist/scripts/generate-web-module/templates/components/selector.template.js +46 -48
  23. package/dist/scripts/generate-web-module/templates/components/selector.template.js.map +1 -1
  24. package/dist/testing/index.js.map +1 -1
  25. package/dist/testing/index.mjs.map +1 -1
  26. package/package.json +6 -25
  27. package/scripts/generate-web-module/templates/components/editor.template.ts +20 -6
  28. package/scripts/generate-web-module/templates/components/selector.template.ts +46 -48
  29. package/src/components/forms/CommonDeleter.tsx +2 -2
  30. package/src/components/forms/CommonEditorTrigger.tsx +3 -3
  31. package/src/components/forms/DatePickerPopover.tsx +3 -1
  32. package/src/components/forms/DateRangeSelector.tsx +1 -1
  33. package/src/components/forms/FormCheckbox.tsx +1 -1
  34. package/src/components/forms/FormDate.tsx +3 -1
  35. package/src/components/forms/FormDateTime.tsx +5 -3
  36. package/src/components/forms/FormSelect.tsx +1 -1
  37. package/src/components/forms/FormSlider.tsx +4 -1
  38. package/src/components/forms/__tests__/FormCheckbox.test.tsx +5 -1
  39. package/src/components/forms/__tests__/FormDate.test.tsx +5 -1
  40. package/src/components/forms/__tests__/FormSelect.test.tsx +5 -1
  41. package/src/components/navigations/RecentPagesNavigator.tsx +2 -2
  42. package/src/components/tables/ContentListTable.tsx +3 -3
  43. package/src/features/billing/stripe-customer/components/details/PaymentMethodCard.tsx +2 -2
  44. package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +2 -2
  45. package/src/features/company/components/forms/CompanyDeleter.tsx +1 -1
  46. package/src/features/content/components/lists/ContentsList.tsx +1 -1
  47. package/src/features/notification/components/lists/NotificationsList.tsx +1 -1
  48. package/src/features/notification/components/modals/NotificationModal.tsx +2 -2
  49. package/src/features/role/components/forms/FormRoles.tsx +1 -1
  50. package/src/features/role/components/forms/UserRoleAdd.tsx +1 -1
  51. package/src/features/user/components/forms/UserEditor.tsx +2 -2
  52. package/src/features/user/components/forms/UserReactivator.tsx +1 -1
  53. package/src/features/user/components/forms/UserResentInvitationEmail.tsx +2 -2
  54. package/src/features/user/components/forms/UserSelector.tsx +5 -1
  55. package/src/features/user/components/lists/UserListInAdd.tsx +1 -1
  56. package/src/features/user/components/widgets/UserAvatar.tsx +37 -31
  57. package/src/features/user/components/widgets/UserSearchPopover.tsx +6 -2
  58. package/src/hooks/use-mobile.ts +1 -0
  59. package/src/hooks/useDataListRetriever.ts +1 -0
  60. package/src/lib/utils.ts +2 -0
  61. package/src/shadcnui/custom/multi-select.tsx +68 -76
  62. package/src/shadcnui/ui/accordion.tsx +64 -42
  63. package/src/shadcnui/ui/alert-dialog.tsx +142 -108
  64. package/src/shadcnui/ui/alert.tsx +64 -35
  65. package/src/shadcnui/ui/avatar.tsx +106 -50
  66. package/src/shadcnui/ui/badge.tsx +34 -26
  67. package/src/shadcnui/ui/breadcrumb.tsx +103 -92
  68. package/src/shadcnui/ui/button.tsx +30 -30
  69. package/src/shadcnui/ui/calendar.tsx +192 -50
  70. package/src/shadcnui/ui/card.tsx +94 -43
  71. package/src/shadcnui/ui/carousel.tsx +220 -201
  72. package/src/shadcnui/ui/chart.tsx +244 -190
  73. package/src/shadcnui/ui/checkbox.tsx +25 -25
  74. package/src/shadcnui/ui/collapsible.tsx +10 -4
  75. package/src/shadcnui/ui/combobox.tsx +292 -0
  76. package/src/shadcnui/ui/command.tsx +158 -126
  77. package/src/shadcnui/ui/context-menu.tsx +242 -164
  78. package/src/shadcnui/ui/dialog.tsx +125 -70
  79. package/src/shadcnui/ui/drawer.tsx +106 -70
  80. package/src/shadcnui/ui/dropdown-menu.tsx +231 -182
  81. package/src/shadcnui/ui/field.tsx +227 -0
  82. package/src/shadcnui/ui/hover-card.tsx +45 -23
  83. package/src/shadcnui/ui/input-group.tsx +149 -0
  84. package/src/shadcnui/ui/input-otp.tsx +19 -9
  85. package/src/shadcnui/ui/input.tsx +4 -5
  86. package/src/shadcnui/ui/label.tsx +16 -22
  87. package/src/shadcnui/ui/navigation-menu.tsx +44 -49
  88. package/src/shadcnui/ui/popover.tsx +81 -24
  89. package/src/shadcnui/ui/progress.tsx +77 -22
  90. package/src/shadcnui/ui/radio-group.tsx +30 -28
  91. package/src/shadcnui/ui/resizable.tsx +23 -17
  92. package/src/shadcnui/ui/scroll-area.tsx +50 -35
  93. package/src/shadcnui/ui/select.tsx +163 -135
  94. package/src/shadcnui/ui/separator.tsx +5 -8
  95. package/src/shadcnui/ui/sheet.tsx +40 -50
  96. package/src/shadcnui/ui/sidebar.tsx +317 -271
  97. package/src/shadcnui/ui/skeleton.tsx +2 -2
  98. package/src/shadcnui/ui/slider.tsx +60 -21
  99. package/src/shadcnui/ui/sonner.tsx +25 -1
  100. package/src/shadcnui/ui/switch.tsx +31 -24
  101. package/src/shadcnui/ui/table.tsx +84 -103
  102. package/src/shadcnui/ui/tabs.tsx +82 -55
  103. package/src/shadcnui/ui/textarea.tsx +15 -21
  104. package/src/shadcnui/ui/toggle.tsx +26 -21
  105. package/src/shadcnui/ui/tooltip.tsx +33 -24
  106. package/src/testing/factories/createMockApiData.ts +2 -2
  107. package/src/testing/factories/createMockResponse.ts +3 -8
  108. package/src/testing/factories/createMockService.ts +1 -4
  109. package/src/testing/index.ts +4 -18
  110. package/src/testing/matchers/jsonApiMatchers.ts +14 -16
  111. package/dist/chunk-D7H7SRWB.js.map +0 -1
  112. package/dist/chunk-SXPXC2TY.mjs.map +0 -1
  113. /package/dist/{BlockNoteEditor-4Z6TZBJE.mjs.map → BlockNoteEditor-BQ5WWVUF.mjs.map} +0 -0
@@ -1,179 +1,257 @@
1
- "use client";
2
-
3
- import { cn } from "../../utils/cn";
4
- import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
5
- import { CheckIcon, ChevronRightIcon, DotFilledIcon } from "@radix-ui/react-icons";
6
- import * as React from "react";
7
-
8
- const ContextMenu = ContextMenuPrimitive.Root;
9
-
10
- const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
11
-
12
- const ContextMenuGroup = ContextMenuPrimitive.Group;
13
-
14
- const ContextMenuPortal = ContextMenuPrimitive.Portal;
15
-
16
- const ContextMenuSub = ContextMenuPrimitive.Sub;
17
-
18
- const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
19
-
20
- const ContextMenuSubTrigger = React.forwardRef<
21
- React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
22
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
23
- inset?: boolean;
24
- }
25
- >(({ className, inset, children, ...props }, ref) => (
26
- <ContextMenuPrimitive.SubTrigger
27
- ref={ref}
28
- className={cn(
29
- "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",
30
- inset && "pl-8",
31
- className,
32
- )}
33
- {...props}
34
- >
35
- {children}
36
- <ChevronRightIcon className="ml-auto h-4 w-4" />
37
- </ContextMenuPrimitive.SubTrigger>
38
- ));
39
- ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
40
-
41
- const ContextMenuSubContent = React.forwardRef<
42
- React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
43
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
44
- >(({ className, ...props }, ref) => (
45
- <ContextMenuPrimitive.SubContent
46
- ref={ref}
47
- className={cn(
48
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",
49
- className,
50
- )}
51
- {...props}
52
- />
53
- ));
54
- ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
55
-
56
- const ContextMenuContent = React.forwardRef<
57
- React.ElementRef<typeof ContextMenuPrimitive.Content>,
58
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
59
- >(({ className, ...props }, ref) => (
60
- <ContextMenuPrimitive.Portal>
61
- <ContextMenuPrimitive.Content
62
- ref={ref}
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { ContextMenu as ContextMenuPrimitive } from "@base-ui/react/context-menu"
5
+
6
+ import { cn } from "@/lib/utils"
7
+ import { ChevronRightIcon, CheckIcon } from "lucide-react"
8
+
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("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--available-height) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none", 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("text-muted-foreground px-2 py-1.5 text-xs data-[inset]:pl-8", className)}
81
+ {...props}
82
+ />
83
+ )
84
+ }
85
+
86
+ function ContextMenuItem({
87
+ className,
88
+ inset,
89
+ variant = "default",
90
+ ...props
91
+ }: ContextMenuPrimitive.Item.Props & {
92
+ inset?: boolean
93
+ variant?: "default" | "destructive"
94
+ }) {
95
+ return (
96
+ <ContextMenuPrimitive.Item
97
+ data-slot="context-menu-item"
98
+ data-inset={inset}
99
+ data-variant={variant}
100
+ className={cn(
101
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
102
+ className
103
+ )}
104
+ {...props}
105
+ />
106
+ )
107
+ }
108
+
109
+ function ContextMenuSub({ ...props }: ContextMenuPrimitive.SubmenuRoot.Props) {
110
+ return (
111
+ <ContextMenuPrimitive.SubmenuRoot data-slot="context-menu-sub" {...props} />
112
+ )
113
+ }
114
+
115
+ function ContextMenuSubTrigger({
116
+ className,
117
+ inset,
118
+ children,
119
+ ...props
120
+ }: ContextMenuPrimitive.SubmenuTrigger.Props & {
121
+ inset?: boolean
122
+ }) {
123
+ return (
124
+ <ContextMenuPrimitive.SubmenuTrigger
125
+ data-slot="context-menu-sub-trigger"
126
+ data-inset={inset}
127
+ className={cn(
128
+ "focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs [&_svg:not([class*='size-'])]:size-3.5 flex cursor-default items-center outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
129
+ className
130
+ )}
131
+ {...props}
132
+ >
133
+ {children}
134
+ <ChevronRightIcon className="ml-auto" />
135
+ </ContextMenuPrimitive.SubmenuTrigger>
136
+ )
137
+ }
138
+
139
+ function ContextMenuSubContent({
140
+ ...props
141
+ }: React.ComponentProps<typeof ContextMenuContent>) {
142
+ return (
143
+ <ContextMenuContent
144
+ data-slot="context-menu-sub-content"
145
+ className="shadow-lg"
146
+ side="right"
147
+ {...props}
148
+ />
149
+ )
150
+ }
151
+
152
+ function ContextMenuCheckboxItem({
153
+ className,
154
+ children,
155
+ checked,
156
+ ...props
157
+ }: ContextMenuPrimitive.CheckboxItem.Props) {
158
+ return (
159
+ <ContextMenuPrimitive.CheckboxItem
160
+ data-slot="context-menu-checkbox-item"
63
161
  className={cn(
64
- "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",
65
- className,
162
+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
163
+ className
66
164
  )}
165
+ checked={checked}
166
+ {...props}
167
+ >
168
+ <span className="pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none">
169
+ <ContextMenuPrimitive.CheckboxItemIndicator>
170
+ <CheckIcon
171
+ />
172
+ </ContextMenuPrimitive.CheckboxItemIndicator>
173
+ </span>
174
+ {children}
175
+ </ContextMenuPrimitive.CheckboxItem>
176
+ )
177
+ }
178
+
179
+ function ContextMenuRadioGroup({
180
+ ...props
181
+ }: ContextMenuPrimitive.RadioGroup.Props) {
182
+ return (
183
+ <ContextMenuPrimitive.RadioGroup
184
+ data-slot="context-menu-radio-group"
185
+ {...props}
186
+ />
187
+ )
188
+ }
189
+
190
+ function ContextMenuRadioItem({
191
+ className,
192
+ children,
193
+ ...props
194
+ }: ContextMenuPrimitive.RadioItem.Props) {
195
+ return (
196
+ <ContextMenuPrimitive.RadioItem
197
+ data-slot="context-menu-radio-item"
198
+ className={cn(
199
+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
200
+ className
201
+ )}
202
+ {...props}
203
+ >
204
+ <span className="pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none">
205
+ <ContextMenuPrimitive.RadioItemIndicator>
206
+ <CheckIcon
207
+ />
208
+ </ContextMenuPrimitive.RadioItemIndicator>
209
+ </span>
210
+ {children}
211
+ </ContextMenuPrimitive.RadioItem>
212
+ )
213
+ }
214
+
215
+ function ContextMenuSeparator({
216
+ className,
217
+ ...props
218
+ }: ContextMenuPrimitive.Separator.Props) {
219
+ return (
220
+ <ContextMenuPrimitive.Separator
221
+ data-slot="context-menu-separator"
222
+ className={cn("bg-border/50 -mx-1 my-1 h-px", className)}
223
+ {...props}
224
+ />
225
+ )
226
+ }
227
+
228
+ function ContextMenuShortcut({
229
+ className,
230
+ ...props
231
+ }: React.ComponentProps<"span">) {
232
+ return (
233
+ <span
234
+ data-slot="context-menu-shortcut"
235
+ className={cn("text-muted-foreground group-focus/context-menu-item:text-accent-foreground ml-auto text-[0.625rem] tracking-widest", className)}
67
236
  {...props}
68
237
  />
69
- </ContextMenuPrimitive.Portal>
70
- ));
71
- ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
72
-
73
- const ContextMenuItem = React.forwardRef<
74
- React.ElementRef<typeof ContextMenuPrimitive.Item>,
75
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
76
- inset?: boolean;
77
- }
78
- >(({ className, inset, ...props }, ref) => (
79
- <ContextMenuPrimitive.Item
80
- ref={ref}
81
- className={cn(
82
- "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",
83
- inset && "pl-8",
84
- className,
85
- )}
86
- {...props}
87
- />
88
- ));
89
- ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
90
-
91
- const ContextMenuCheckboxItem = React.forwardRef<
92
- React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
93
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
94
- >(({ className, children, checked, ...props }, ref) => (
95
- <ContextMenuPrimitive.CheckboxItem
96
- ref={ref}
97
- className={cn(
98
- "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",
99
- className,
100
- )}
101
- checked={checked}
102
- {...props}
103
- >
104
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
105
- <ContextMenuPrimitive.ItemIndicator>
106
- <CheckIcon className="h-4 w-4" />
107
- </ContextMenuPrimitive.ItemIndicator>
108
- </span>
109
- {children}
110
- </ContextMenuPrimitive.CheckboxItem>
111
- ));
112
- ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
113
-
114
- const ContextMenuRadioItem = React.forwardRef<
115
- React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
116
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
117
- >(({ className, children, ...props }, ref) => (
118
- <ContextMenuPrimitive.RadioItem
119
- ref={ref}
120
- className={cn(
121
- "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",
122
- className,
123
- )}
124
- {...props}
125
- >
126
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
127
- <ContextMenuPrimitive.ItemIndicator>
128
- <DotFilledIcon className="h-4 w-4 fill-current" />
129
- </ContextMenuPrimitive.ItemIndicator>
130
- </span>
131
- {children}
132
- </ContextMenuPrimitive.RadioItem>
133
- ));
134
- ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
135
-
136
- const ContextMenuLabel = React.forwardRef<
137
- React.ElementRef<typeof ContextMenuPrimitive.Label>,
138
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
139
- inset?: boolean;
140
- }
141
- >(({ className, inset, ...props }, ref) => (
142
- <ContextMenuPrimitive.Label
143
- ref={ref}
144
- className={cn("px-2 py-1.5 text-sm font-semibold text-foreground", inset && "pl-8", className)}
145
- {...props}
146
- />
147
- ));
148
- ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
149
-
150
- const ContextMenuSeparator = React.forwardRef<
151
- React.ElementRef<typeof ContextMenuPrimitive.Separator>,
152
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
153
- >(({ className, ...props }, ref) => (
154
- <ContextMenuPrimitive.Separator ref={ref} className={cn("-mx-1 my-1 h-px bg-border", className)} {...props} />
155
- ));
156
- ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
157
-
158
- const ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
159
- return <span className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)} {...props} />;
160
- };
161
- ContextMenuShortcut.displayName = "ContextMenuShortcut";
238
+ )
239
+ }
162
240
 
163
241
  export {
164
242
  ContextMenu,
165
- ContextMenuCheckboxItem,
243
+ ContextMenuTrigger,
166
244
  ContextMenuContent,
167
- ContextMenuGroup,
168
245
  ContextMenuItem,
169
- ContextMenuLabel,
170
- ContextMenuPortal,
171
- ContextMenuRadioGroup,
246
+ ContextMenuCheckboxItem,
172
247
  ContextMenuRadioItem,
248
+ ContextMenuLabel,
173
249
  ContextMenuSeparator,
174
250
  ContextMenuShortcut,
251
+ ContextMenuGroup,
252
+ ContextMenuPortal,
175
253
  ContextMenuSub,
176
254
  ContextMenuSubContent,
177
255
  ContextMenuSubTrigger,
178
- ContextMenuTrigger,
179
- };
256
+ ContextMenuRadioGroup,
257
+ }
@@ -1,86 +1,141 @@
1
- "use client";
1
+ "use client"
2
2
 
3
- import { cn } from "../../utils/cn";
4
- import * as DialogPrimitive from "@radix-ui/react-dialog";
5
- import { Cross2Icon } from "@radix-ui/react-icons";
6
- import * as React from "react";
3
+ import * as React from "react"
4
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
7
5
 
8
- const Dialog = DialogPrimitive.Root;
6
+ import { cn } from "@/lib/utils"
7
+ import { Button } from "@/components/ui/button"
8
+ import { XIcon } from "lucide-react"
9
9
 
10
- const DialogTrigger = DialogPrimitive.Trigger;
10
+ function Dialog({ ...props }: DialogPrimitive.Root.Props) {
11
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />
12
+ }
11
13
 
12
- const DialogPortal = DialogPrimitive.Portal;
14
+ function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
15
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
16
+ }
13
17
 
14
- const DialogClose = DialogPrimitive.Close;
18
+ function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
19
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
20
+ }
15
21
 
16
- const DialogOverlay = React.forwardRef<
17
- React.ElementRef<typeof DialogPrimitive.Overlay>,
18
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
19
- >(({ className, ...props }, ref) => (
20
- <DialogPrimitive.Overlay
21
- ref={ref}
22
- className={cn(
23
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
24
- className,
25
- )}
26
- {...props}
27
- />
28
- ));
29
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
22
+ function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
23
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
24
+ }
30
25
 
31
- const DialogContent = React.forwardRef<
32
- React.ElementRef<typeof DialogPrimitive.Content>,
33
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
34
- >(({ className, children, ...props }, ref) => (
35
- <DialogPortal>
36
- <DialogOverlay />
37
- <DialogPrimitive.Content
38
- ref={ref}
26
+ function DialogOverlay({
27
+ className,
28
+ ...props
29
+ }: DialogPrimitive.Backdrop.Props) {
30
+ return (
31
+ <DialogPrimitive.Backdrop
32
+ data-slot="dialog-overlay"
33
+ className={cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50", className)}
34
+ {...props}
35
+ />
36
+ )
37
+ }
38
+
39
+ function DialogContent({
40
+ className,
41
+ children,
42
+ showCloseButton = true,
43
+ ...props
44
+ }: DialogPrimitive.Popup.Props & {
45
+ showCloseButton?: boolean
46
+ }) {
47
+ return (
48
+ <DialogPortal>
49
+ <DialogOverlay />
50
+ <DialogPrimitive.Popup
51
+ data-slot="dialog-content"
52
+ className={cn(
53
+ "bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid gap-4 rounded-xl p-4 text-xs/relaxed ring-1 duration-100 fixed top-1/2 left-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 outline-none",
54
+ className
55
+ )}
56
+ {...props}
57
+ >
58
+ {children}
59
+ {showCloseButton && (
60
+ <DialogPrimitive.Close
61
+ data-slot="dialog-close"
62
+ render={
63
+ <Button
64
+ variant="ghost"
65
+ className="absolute top-2 right-2"
66
+ size="icon-sm"
67
+ />
68
+ }
69
+ >
70
+ <XIcon
71
+ />
72
+ <span className="sr-only">Close</span>
73
+ </DialogPrimitive.Close>
74
+ )}
75
+ </DialogPrimitive.Popup>
76
+ </DialogPortal>
77
+ )
78
+ }
79
+
80
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
81
+ return (
82
+ <div
83
+ data-slot="dialog-header"
84
+ className={cn("gap-1 flex flex-col", className)}
85
+ {...props}
86
+ />
87
+ )
88
+ }
89
+
90
+ function DialogFooter({
91
+ className,
92
+ showCloseButton = false,
93
+ children,
94
+ ...props
95
+ }: React.ComponentProps<"div"> & {
96
+ showCloseButton?: boolean
97
+ }) {
98
+ return (
99
+ <div
100
+ data-slot="dialog-footer"
39
101
  className={cn(
40
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
41
- className,
102
+ "gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
103
+ className
42
104
  )}
43
105
  {...props}
44
106
  >
45
107
  {children}
46
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
47
- <Cross2Icon className="h-4 w-4" />
48
- <span className="sr-only">Close</span>
49
- </DialogPrimitive.Close>
50
- </DialogPrimitive.Content>
51
- </DialogPortal>
52
- ));
53
- DialogContent.displayName = DialogPrimitive.Content.displayName;
54
-
55
- const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
56
- <div className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...props} />
57
- );
58
- DialogHeader.displayName = "DialogHeader";
59
-
60
- const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
61
- <div className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)} {...props} />
62
- );
63
- DialogFooter.displayName = "DialogFooter";
108
+ {showCloseButton && (
109
+ <DialogPrimitive.Close render={<Button variant="outline" />}>
110
+ Close
111
+ </DialogPrimitive.Close>
112
+ )}
113
+ </div>
114
+ )
115
+ }
64
116
 
65
- const DialogTitle = React.forwardRef<
66
- React.ElementRef<typeof DialogPrimitive.Title>,
67
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
68
- >(({ className, ...props }, ref) => (
69
- <DialogPrimitive.Title
70
- ref={ref}
71
- className={cn("text-lg font-semibold leading-none tracking-tight", className)}
72
- {...props}
73
- />
74
- ));
75
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
117
+ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
118
+ return (
119
+ <DialogPrimitive.Title
120
+ data-slot="dialog-title"
121
+ className={cn("text-sm font-medium", className)}
122
+ {...props}
123
+ />
124
+ )
125
+ }
76
126
 
77
- const DialogDescription = React.forwardRef<
78
- React.ElementRef<typeof DialogPrimitive.Description>,
79
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
80
- >(({ className, ...props }, ref) => (
81
- <DialogPrimitive.Description ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
82
- ));
83
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
127
+ function DialogDescription({
128
+ className,
129
+ ...props
130
+ }: DialogPrimitive.Description.Props) {
131
+ return (
132
+ <DialogPrimitive.Description
133
+ data-slot="dialog-description"
134
+ className={cn("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed *:[a]:underline *:[a]:underline-offset-3", className)}
135
+ {...props}
136
+ />
137
+ )
138
+ }
84
139
 
85
140
  export {
86
141
  Dialog,
@@ -93,4 +148,4 @@ export {
93
148
  DialogPortal,
94
149
  DialogTitle,
95
150
  DialogTrigger,
96
- };
151
+ }