@carlonicora/nextjs-jsonapi 1.17.0 → 1.18.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 (109) hide show
  1. package/README.md +1 -1
  2. package/dist/{BlockNoteEditor-4Z6TZBJE.mjs → BlockNoteEditor-6TWTNHNZ.mjs} +2 -2
  3. package/dist/{BlockNoteEditor-34T5CY27.js → BlockNoteEditor-C3WWGGT6.js} +6 -6
  4. package/dist/{BlockNoteEditor-34T5CY27.js.map → BlockNoteEditor-C3WWGGT6.js.map} +1 -1
  5. package/dist/{chunk-D7H7SRWB.js → chunk-6U6QCSJK.js} +4054 -2590
  6. package/dist/chunk-6U6QCSJK.js.map +1 -0
  7. package/dist/{chunk-SXPXC2TY.mjs → chunk-UZDAPWJG.mjs} +5629 -4165
  8. package/dist/chunk-UZDAPWJG.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 +45 -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 +45 -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/user/components/forms/UserEditor.tsx +2 -2
  51. package/src/features/user/components/forms/UserReactivator.tsx +1 -1
  52. package/src/features/user/components/forms/UserResentInvitationEmail.tsx +2 -2
  53. package/src/features/user/components/widgets/UserAvatar.tsx +37 -31
  54. package/src/features/user/components/widgets/UserSearchPopover.tsx +1 -1
  55. package/src/hooks/use-mobile.ts +1 -0
  56. package/src/lib/utils.ts +2 -0
  57. package/src/shadcnui/custom/multi-select.tsx +10 -21
  58. package/src/shadcnui/ui/accordion.tsx +64 -42
  59. package/src/shadcnui/ui/alert-dialog.tsx +142 -108
  60. package/src/shadcnui/ui/alert.tsx +64 -35
  61. package/src/shadcnui/ui/avatar.tsx +106 -50
  62. package/src/shadcnui/ui/badge.tsx +34 -26
  63. package/src/shadcnui/ui/breadcrumb.tsx +103 -92
  64. package/src/shadcnui/ui/button.tsx +30 -30
  65. package/src/shadcnui/ui/calendar.tsx +192 -50
  66. package/src/shadcnui/ui/card.tsx +94 -43
  67. package/src/shadcnui/ui/carousel.tsx +220 -201
  68. package/src/shadcnui/ui/chart.tsx +244 -190
  69. package/src/shadcnui/ui/checkbox.tsx +25 -25
  70. package/src/shadcnui/ui/collapsible.tsx +10 -4
  71. package/src/shadcnui/ui/combobox.tsx +292 -0
  72. package/src/shadcnui/ui/command.tsx +158 -126
  73. package/src/shadcnui/ui/context-menu.tsx +242 -164
  74. package/src/shadcnui/ui/dialog.tsx +125 -70
  75. package/src/shadcnui/ui/drawer.tsx +106 -70
  76. package/src/shadcnui/ui/dropdown-menu.tsx +231 -182
  77. package/src/shadcnui/ui/field.tsx +227 -0
  78. package/src/shadcnui/ui/hover-card.tsx +45 -23
  79. package/src/shadcnui/ui/input-group.tsx +149 -0
  80. package/src/shadcnui/ui/input-otp.tsx +19 -9
  81. package/src/shadcnui/ui/input.tsx +4 -5
  82. package/src/shadcnui/ui/label.tsx +16 -22
  83. package/src/shadcnui/ui/navigation-menu.tsx +44 -49
  84. package/src/shadcnui/ui/popover.tsx +81 -24
  85. package/src/shadcnui/ui/progress.tsx +77 -22
  86. package/src/shadcnui/ui/radio-group.tsx +30 -28
  87. package/src/shadcnui/ui/resizable.tsx +23 -17
  88. package/src/shadcnui/ui/scroll-area.tsx +50 -35
  89. package/src/shadcnui/ui/select.tsx +163 -135
  90. package/src/shadcnui/ui/separator.tsx +5 -8
  91. package/src/shadcnui/ui/sheet.tsx +40 -50
  92. package/src/shadcnui/ui/sidebar.tsx +317 -271
  93. package/src/shadcnui/ui/skeleton.tsx +2 -2
  94. package/src/shadcnui/ui/slider.tsx +60 -21
  95. package/src/shadcnui/ui/sonner.tsx +25 -1
  96. package/src/shadcnui/ui/switch.tsx +31 -24
  97. package/src/shadcnui/ui/table.tsx +84 -103
  98. package/src/shadcnui/ui/tabs.tsx +82 -55
  99. package/src/shadcnui/ui/textarea.tsx +15 -21
  100. package/src/shadcnui/ui/toggle.tsx +26 -21
  101. package/src/shadcnui/ui/tooltip.tsx +33 -24
  102. package/src/testing/factories/createMockApiData.ts +2 -2
  103. package/src/testing/factories/createMockResponse.ts +3 -8
  104. package/src/testing/factories/createMockService.ts +1 -4
  105. package/src/testing/index.ts +4 -18
  106. package/src/testing/matchers/jsonApiMatchers.ts +14 -16
  107. package/dist/chunk-D7H7SRWB.js.map +0 -1
  108. package/dist/chunk-SXPXC2TY.mjs.map +0 -1
  109. /package/dist/{BlockNoteEditor-4Z6TZBJE.mjs.map → BlockNoteEditor-6TWTNHNZ.mjs.map} +0 -0
@@ -1,154 +1,182 @@
1
- "use client";
1
+ "use client"
2
2
 
3
- import {
4
- CaretSortIcon,
5
- CheckIcon,
6
- ChevronDownIcon,
7
- ChevronUpIcon,
8
- } from "@radix-ui/react-icons";
9
- import * as SelectPrimitive from "@radix-ui/react-select";
10
- import * as React from "react";
3
+ import * as React from "react"
4
+ import { Select as SelectPrimitive } from "@base-ui/react/select"
11
5
 
12
- import { cn } from "../../utils/cn";
6
+ import { cn } from "@/lib/utils"
7
+ import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react"
13
8
 
14
- const Select = SelectPrimitive.Root;
9
+ const Select = SelectPrimitive.Root
15
10
 
16
- const SelectGroup = SelectPrimitive.Group;
11
+ function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
12
+ return (
13
+ <SelectPrimitive.Group
14
+ data-slot="select-group"
15
+ className={cn("scroll-my-1 p-1", className)}
16
+ {...props}
17
+ />
18
+ )
19
+ }
17
20
 
18
- const SelectValue = SelectPrimitive.Value;
21
+ function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
22
+ return (
23
+ <SelectPrimitive.Value
24
+ data-slot="select-value"
25
+ className={cn("flex flex-1 text-left", className)}
26
+ {...props}
27
+ />
28
+ )
29
+ }
19
30
 
20
- const SelectTrigger = React.forwardRef<
21
- React.ElementRef<typeof SelectPrimitive.Trigger>,
22
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
23
- >(({ className, children, ...props }, ref) => (
24
- <SelectPrimitive.Trigger
25
- ref={ref}
26
- className={cn(
27
- "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
28
- className,
29
- )}
30
- {...props}
31
- >
32
- {children}
33
- <SelectPrimitive.Icon asChild>
34
- <CaretSortIcon className="h-4 w-4 opacity-50" />
35
- </SelectPrimitive.Icon>
36
- </SelectPrimitive.Trigger>
37
- ));
38
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
31
+ function SelectTrigger({
32
+ className,
33
+ size = "default",
34
+ children,
35
+ ...props
36
+ }: SelectPrimitive.Trigger.Props & {
37
+ size?: "sm" | "default"
38
+ }) {
39
+ return (
40
+ <SelectPrimitive.Trigger
41
+ data-slot="select-trigger"
42
+ data-size={size}
43
+ className={cn(
44
+ "border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
45
+ className
46
+ )}
47
+ {...props}
48
+ >
49
+ {children}
50
+ <SelectPrimitive.Icon
51
+ render={
52
+ <ChevronDownIcon className="text-muted-foreground size-3.5 pointer-events-none" />
53
+ }
54
+ />
55
+ </SelectPrimitive.Trigger>
56
+ )
57
+ }
39
58
 
40
- const SelectScrollUpButton = React.forwardRef<
41
- React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
42
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
43
- >(({ className, ...props }, ref) => (
44
- <SelectPrimitive.ScrollUpButton
45
- ref={ref}
46
- className={cn(
47
- "flex cursor-default items-center justify-center py-1",
48
- className,
49
- )}
50
- {...props}
51
- >
52
- <ChevronUpIcon />
53
- </SelectPrimitive.ScrollUpButton>
54
- ));
55
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
59
+ function SelectContent({
60
+ className,
61
+ children,
62
+ side = "bottom",
63
+ sideOffset = 4,
64
+ align = "center",
65
+ alignOffset = 0,
66
+ alignItemWithTrigger = true,
67
+ ...props
68
+ }: SelectPrimitive.Popup.Props &
69
+ Pick<
70
+ SelectPrimitive.Positioner.Props,
71
+ "align" | "alignOffset" | "side" | "sideOffset" | "alignItemWithTrigger"
72
+ >) {
73
+ return (
74
+ <SelectPrimitive.Portal>
75
+ <SelectPrimitive.Positioner
76
+ side={side}
77
+ sideOffset={sideOffset}
78
+ align={align}
79
+ alignOffset={alignOffset}
80
+ alignItemWithTrigger={alignItemWithTrigger}
81
+ className="isolate z-50"
82
+ >
83
+ <SelectPrimitive.Popup
84
+ data-slot="select-content"
85
+ className={cn("bg-popover text-popover-foreground 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 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto", className )}
86
+ {...props}
87
+ >
88
+ <SelectScrollUpButton />
89
+ <SelectPrimitive.List>{children}</SelectPrimitive.List>
90
+ <SelectScrollDownButton />
91
+ </SelectPrimitive.Popup>
92
+ </SelectPrimitive.Positioner>
93
+ </SelectPrimitive.Portal>
94
+ )
95
+ }
56
96
 
57
- const SelectScrollDownButton = React.forwardRef<
58
- React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
59
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
60
- >(({ className, ...props }, ref) => (
61
- <SelectPrimitive.ScrollDownButton
62
- ref={ref}
63
- className={cn(
64
- "flex cursor-default items-center justify-center py-1",
65
- className,
66
- )}
67
- {...props}
68
- >
69
- <ChevronDownIcon />
70
- </SelectPrimitive.ScrollDownButton>
71
- ));
72
- SelectScrollDownButton.displayName =
73
- SelectPrimitive.ScrollDownButton.displayName;
97
+ function SelectLabel({
98
+ className,
99
+ ...props
100
+ }: SelectPrimitive.GroupLabel.Props) {
101
+ return (
102
+ <SelectPrimitive.GroupLabel
103
+ data-slot="select-label"
104
+ className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
105
+ {...props}
106
+ />
107
+ )
108
+ }
74
109
 
75
- const SelectContent = React.forwardRef<
76
- React.ElementRef<typeof SelectPrimitive.Content>,
77
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
78
- >(({ className, children, position = "popper", ...props }, ref) => (
79
- <SelectPrimitive.Portal>
80
- <SelectPrimitive.Content
81
- ref={ref}
110
+ function SelectItem({
111
+ className,
112
+ children,
113
+ ...props
114
+ }: SelectPrimitive.Item.Props) {
115
+ return (
116
+ <SelectPrimitive.Item
117
+ data-slot="select-item"
82
118
  className={cn(
83
- "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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",
84
- position === "popper" &&
85
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
86
- className,
119
+ "focus:bg-accent focus:text-accent-foreground 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 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
120
+ className
87
121
  )}
88
- position={position}
89
122
  {...props}
90
123
  >
91
- <SelectScrollUpButton />
92
- <SelectPrimitive.Viewport
93
- className={cn(
94
- "p-1",
95
- position === "popper" &&
96
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
97
- )}
98
- >
124
+ <SelectPrimitive.ItemText className="flex flex-1 gap-2 shrink-0 whitespace-nowrap">
99
125
  {children}
100
- </SelectPrimitive.Viewport>
101
- <SelectScrollDownButton />
102
- </SelectPrimitive.Content>
103
- </SelectPrimitive.Portal>
104
- ));
105
- SelectContent.displayName = SelectPrimitive.Content.displayName;
126
+ </SelectPrimitive.ItemText>
127
+ <SelectPrimitive.ItemIndicator
128
+ render={<span className="pointer-events-none absolute right-2 flex items-center justify-center" />}
129
+ >
130
+ <CheckIcon className="pointer-events-none" />
131
+ </SelectPrimitive.ItemIndicator>
132
+ </SelectPrimitive.Item>
133
+ )
134
+ }
106
135
 
107
- const SelectLabel = React.forwardRef<
108
- React.ElementRef<typeof SelectPrimitive.Label>,
109
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
110
- >(({ className, ...props }, ref) => (
111
- <SelectPrimitive.Label
112
- ref={ref}
113
- className={cn("px-2 py-1.5 text-sm font-semibold", className)}
114
- {...props}
115
- />
116
- ));
117
- SelectLabel.displayName = SelectPrimitive.Label.displayName;
136
+ function SelectSeparator({
137
+ className,
138
+ ...props
139
+ }: SelectPrimitive.Separator.Props) {
140
+ return (
141
+ <SelectPrimitive.Separator
142
+ data-slot="select-separator"
143
+ className={cn("bg-border/50 -mx-1 my-1 h-px pointer-events-none", className)}
144
+ {...props}
145
+ />
146
+ )
147
+ }
118
148
 
119
- const SelectItem = React.forwardRef<
120
- React.ElementRef<typeof SelectPrimitive.Item>,
121
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
122
- >(({ className, children, ...props }, ref) => (
123
- <SelectPrimitive.Item
124
- ref={ref}
125
- className={cn(
126
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
127
- className,
128
- )}
129
- {...props}
130
- >
131
- <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
132
- <SelectPrimitive.ItemIndicator>
133
- <CheckIcon className="h-4 w-4" />
134
- </SelectPrimitive.ItemIndicator>
135
- </span>
136
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
137
- </SelectPrimitive.Item>
138
- ));
139
- SelectItem.displayName = SelectPrimitive.Item.displayName;
149
+ function SelectScrollUpButton({
150
+ className,
151
+ ...props
152
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {
153
+ return (
154
+ <SelectPrimitive.ScrollUpArrow
155
+ data-slot="select-scroll-up-button"
156
+ className={cn("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 top-0 w-full", className)}
157
+ {...props}
158
+ >
159
+ <ChevronUpIcon
160
+ />
161
+ </SelectPrimitive.ScrollUpArrow>
162
+ )
163
+ }
140
164
 
141
- const SelectSeparator = React.forwardRef<
142
- React.ElementRef<typeof SelectPrimitive.Separator>,
143
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
144
- >(({ className, ...props }, ref) => (
145
- <SelectPrimitive.Separator
146
- ref={ref}
147
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
148
- {...props}
149
- />
150
- ));
151
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
165
+ function SelectScrollDownButton({
166
+ className,
167
+ ...props
168
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {
169
+ return (
170
+ <SelectPrimitive.ScrollDownArrow
171
+ data-slot="select-scroll-down-button"
172
+ className={cn("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 bottom-0 w-full", className)}
173
+ {...props}
174
+ >
175
+ <ChevronDownIcon
176
+ />
177
+ </SelectPrimitive.ScrollDownArrow>
178
+ )
179
+ }
152
180
 
153
181
  export {
154
182
  Select,
@@ -161,4 +189,4 @@ export {
161
189
  SelectSeparator,
162
190
  SelectTrigger,
163
191
  SelectValue,
164
- };
192
+ }
@@ -1,23 +1,20 @@
1
1
  "use client"
2
2
 
3
- import * as React from "react"
4
- import * as SeparatorPrimitive from "@radix-ui/react-separator"
3
+ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
5
4
 
6
- import { cn } from "../../utils/cn"
5
+ import { cn } from "@/lib/utils"
7
6
 
8
7
  function Separator({
9
8
  className,
10
9
  orientation = "horizontal",
11
- decorative = true,
12
10
  ...props
13
- }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
11
+ }: SeparatorPrimitive.Props) {
14
12
  return (
15
- <SeparatorPrimitive.Root
13
+ <SeparatorPrimitive
16
14
  data-slot="separator"
17
- decorative={decorative}
18
15
  orientation={orientation}
19
16
  className={cn(
20
- "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
17
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",
21
18
  className
22
19
  )}
23
20
  {...props}
@@ -1,44 +1,33 @@
1
1
  "use client"
2
2
 
3
3
  import * as React from "react"
4
- import * as SheetPrimitive from "@radix-ui/react-dialog"
5
- import { XIcon } from "lucide-react"
4
+ import { Dialog as SheetPrimitive } from "@base-ui/react/dialog"
6
5
 
7
- import { cn } from "../../utils/cn"
6
+ import { cn } from "@/lib/utils"
7
+ import { Button } from "@/components/ui/button"
8
+ import { XIcon } from "lucide-react"
8
9
 
9
- function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
10
+ function Sheet({ ...props }: SheetPrimitive.Root.Props) {
10
11
  return <SheetPrimitive.Root data-slot="sheet" {...props} />
11
12
  }
12
13
 
13
- function SheetTrigger({
14
- ...props
15
- }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
14
+ function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
16
15
  return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
17
16
  }
18
17
 
19
- function SheetClose({
20
- ...props
21
- }: React.ComponentProps<typeof SheetPrimitive.Close>) {
18
+ function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
22
19
  return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
23
20
  }
24
21
 
25
- function SheetPortal({
26
- ...props
27
- }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
22
+ function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
28
23
  return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
29
24
  }
30
25
 
31
- function SheetOverlay({
32
- className,
33
- ...props
34
- }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
26
+ function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
35
27
  return (
36
- <SheetPrimitive.Overlay
28
+ <SheetPrimitive.Backdrop
37
29
  data-slot="sheet-overlay"
38
- className={cn(
39
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
40
- className
41
- )}
30
+ 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 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50", className)}
42
31
  {...props}
43
32
  />
44
33
  )
@@ -48,35 +37,39 @@ function SheetContent({
48
37
  className,
49
38
  children,
50
39
  side = "right",
40
+ showCloseButton = true,
51
41
  ...props
52
- }: React.ComponentProps<typeof SheetPrimitive.Content> & {
42
+ }: SheetPrimitive.Popup.Props & {
53
43
  side?: "top" | "right" | "bottom" | "left"
44
+ showCloseButton?: boolean
54
45
  }) {
55
46
  return (
56
47
  <SheetPortal>
57
48
  <SheetOverlay />
58
- <SheetPrimitive.Content
49
+ <SheetPrimitive.Popup
59
50
  data-slot="sheet-content"
60
- className={cn(
61
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
62
- side === "right" &&
63
- "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
64
- side === "left" &&
65
- "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
66
- side === "top" &&
67
- "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
68
- side === "bottom" &&
69
- "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
70
- className
71
- )}
51
+ data-side={side}
52
+ className={cn("bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col bg-clip-padding text-xs/relaxed shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm", className)}
72
53
  {...props}
73
54
  >
74
55
  {children}
75
- <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
76
- <XIcon className="size-4" />
77
- <span className="sr-only">Close</span>
78
- </SheetPrimitive.Close>
79
- </SheetPrimitive.Content>
56
+ {showCloseButton && (
57
+ <SheetPrimitive.Close
58
+ data-slot="sheet-close"
59
+ render={
60
+ <Button
61
+ variant="ghost"
62
+ className="absolute top-4 right-4"
63
+ size="icon-sm"
64
+ />
65
+ }
66
+ >
67
+ <XIcon
68
+ />
69
+ <span className="sr-only">Close</span>
70
+ </SheetPrimitive.Close>
71
+ )}
72
+ </SheetPrimitive.Popup>
80
73
  </SheetPortal>
81
74
  )
82
75
  }
@@ -85,7 +78,7 @@ function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
85
78
  return (
86
79
  <div
87
80
  data-slot="sheet-header"
88
- className={cn("flex flex-col gap-1.5 p-4", className)}
81
+ className={cn("gap-1.5 p-6 flex flex-col", className)}
89
82
  {...props}
90
83
  />
91
84
  )
@@ -95,20 +88,17 @@ function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
95
88
  return (
96
89
  <div
97
90
  data-slot="sheet-footer"
98
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
91
+ className={cn("gap-2 p-6 mt-auto flex flex-col", className)}
99
92
  {...props}
100
93
  />
101
94
  )
102
95
  }
103
96
 
104
- function SheetTitle({
105
- className,
106
- ...props
107
- }: React.ComponentProps<typeof SheetPrimitive.Title>) {
97
+ function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
108
98
  return (
109
99
  <SheetPrimitive.Title
110
100
  data-slot="sheet-title"
111
- className={cn("text-foreground font-semibold", className)}
101
+ className={cn("text-foreground text-sm font-medium", className)}
112
102
  {...props}
113
103
  />
114
104
  )
@@ -117,11 +107,11 @@ function SheetTitle({
117
107
  function SheetDescription({
118
108
  className,
119
109
  ...props
120
- }: React.ComponentProps<typeof SheetPrimitive.Description>) {
110
+ }: SheetPrimitive.Description.Props) {
121
111
  return (
122
112
  <SheetPrimitive.Description
123
113
  data-slot="sheet-description"
124
- className={cn("text-muted-foreground text-sm", className)}
114
+ className={cn("text-muted-foreground text-xs/relaxed", className)}
125
115
  {...props}
126
116
  />
127
117
  )