@surreal-ui/react 0.5.2 → 0.5.4
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.
- package/CHANGELOG.md +12 -0
- package/dist/index.js +346 -365
- package/package.json +2 -2
- package/src/components/GlassmorphismAlert.tsx +4 -1
- package/src/components/GlassmorphismButton.tsx +1 -1
- package/src/components/GlassmorphismEmptyState.tsx +1 -1
- package/src/components/GlassmorphismInputGroup.tsx +1 -1
- package/src/components/GlassmorphismMenubar.tsx +2 -2
- package/src/components/GlassmorphismScrollArea.tsx +1 -1
- package/src/components/GlassmorphismTypography.tsx +1 -1
- package/src/components/MinimalistAccordion.tsx +9 -9
- package/src/components/MinimalistAlert.tsx +4 -1
- package/src/components/MinimalistAlertDialog.tsx +44 -43
- package/src/components/MinimalistAspectRatio.tsx +2 -2
- package/src/components/MinimalistAvatar.tsx +13 -13
- package/src/components/MinimalistBadge.tsx +7 -7
- package/src/components/MinimalistBreadcrumb.tsx +6 -2
- package/src/components/MinimalistButton.tsx +7 -7
- package/src/components/MinimalistButtonGroup.tsx +28 -27
- package/src/components/MinimalistCalendar.tsx +16 -13
- package/src/components/MinimalistCard.tsx +1 -1
- package/src/components/MinimalistCarousel.tsx +12 -12
- package/src/components/MinimalistChart.tsx +15 -15
- package/src/components/MinimalistCheckbox.tsx +4 -4
- package/src/components/MinimalistCodeBlock.tsx +16 -16
- package/src/components/MinimalistCollapsible.tsx +2 -2
- package/src/components/MinimalistCommand.tsx +21 -21
- package/src/components/MinimalistContextMenu.tsx +50 -42
- package/src/components/MinimalistDialog.tsx +12 -8
- package/src/components/MinimalistDrawer.tsx +10 -6
- package/src/components/MinimalistDropdownMenu.tsx +67 -67
- package/src/components/MinimalistEmpty.tsx +8 -8
- package/src/components/MinimalistEmptyState.tsx +1 -1
- package/src/components/MinimalistField.tsx +26 -26
- package/src/components/MinimalistForm.tsx +17 -15
- package/src/components/MinimalistHoverCard.tsx +2 -2
- package/src/components/MinimalistInput.tsx +3 -3
- package/src/components/MinimalistInputGroup.tsx +21 -21
- package/src/components/MinimalistInputOtp.tsx +9 -9
- package/src/components/MinimalistItem.tsx +18 -17
- package/src/components/MinimalistKbd.tsx +3 -3
- package/src/components/MinimalistLabel.tsx +2 -2
- package/src/components/MinimalistMenubar.tsx +14 -14
- package/src/components/MinimalistNativeSelect.tsx +3 -3
- package/src/components/MinimalistNavigationMenu.tsx +8 -8
- package/src/components/MinimalistPagination.tsx +9 -9
- package/src/components/MinimalistPopover.tsx +20 -19
- package/src/components/MinimalistProgress.tsx +2 -2
- package/src/components/MinimalistRadioGroup.tsx +3 -3
- package/src/components/MinimalistRangeCalendar.tsx +15 -15
- package/src/components/MinimalistResizable.tsx +2 -2
- package/src/components/MinimalistScrollArea.tsx +1 -1
- package/src/components/MinimalistSelect.tsx +28 -31
- package/src/components/MinimalistSeparator.tsx +5 -5
- package/src/components/MinimalistSheet.tsx +13 -13
- package/src/components/MinimalistSidebar.tsx +73 -72
- package/src/components/MinimalistSkeleton.tsx +1 -1
- package/src/components/MinimalistSlider.tsx +8 -8
- package/src/components/MinimalistSonner.tsx +4 -4
- package/src/components/MinimalistSpinner.tsx +3 -3
- package/src/components/MinimalistSwitch.tsx +5 -5
- package/src/components/MinimalistTabs.tsx +13 -8
- package/src/components/MinimalistTextarea.tsx +3 -3
- package/src/components/MinimalistToggle.tsx +8 -8
- package/src/components/MinimalistToggleGroup.tsx +18 -17
- package/src/components/MinimalistTooltip.tsx +7 -7
- package/src/components/MinimalistTypography.tsx +1 -1
- package/src/components/NeubrutalismCard.tsx +82 -1
- package/src/components/ShadcnAccordion.tsx +9 -9
- package/src/components/ShadcnAlertDialog.tsx +44 -43
- package/src/components/ShadcnAspectRatio.tsx +2 -2
- package/src/components/ShadcnAvatar.tsx +13 -13
- package/src/components/ShadcnBadge.tsx +7 -7
- package/src/components/ShadcnBreadcrumb.tsx +6 -2
- package/src/components/ShadcnButton.tsx +7 -7
- package/src/components/ShadcnButtonGroup.tsx +28 -27
- package/src/components/ShadcnCalendar.tsx +16 -13
- package/src/components/ShadcnCarousel.tsx +12 -12
- package/src/components/ShadcnChart.tsx +15 -15
- package/src/components/ShadcnCheckbox.tsx +4 -4
- package/src/components/ShadcnCodeBlock.tsx +16 -16
- package/src/components/ShadcnCollapsible.tsx +2 -2
- package/src/components/ShadcnCommand.tsx +21 -21
- package/src/components/ShadcnContextMenu.tsx +50 -42
- package/src/components/ShadcnDialog.tsx +12 -8
- package/src/components/ShadcnDrawer.tsx +10 -6
- package/src/components/ShadcnDropdownMenu.tsx +67 -67
- package/src/components/ShadcnEmpty.tsx +8 -8
- package/src/components/ShadcnField.tsx +26 -26
- package/src/components/ShadcnForm.tsx +17 -15
- package/src/components/ShadcnHoverCard.tsx +2 -2
- package/src/components/ShadcnInput.tsx +3 -3
- package/src/components/ShadcnInputGroup.tsx +21 -21
- package/src/components/ShadcnInputOtp.tsx +9 -9
- package/src/components/ShadcnItem.tsx +18 -17
- package/src/components/ShadcnKbd.tsx +3 -3
- package/src/components/ShadcnLabel.tsx +2 -2
- package/src/components/ShadcnMenubar.tsx +14 -14
- package/src/components/ShadcnNativeSelect.tsx +3 -3
- package/src/components/ShadcnNavigationMenu.tsx +8 -8
- package/src/components/ShadcnPagination.tsx +9 -9
- package/src/components/ShadcnPopover.tsx +20 -19
- package/src/components/ShadcnProgress.tsx +2 -2
- package/src/components/ShadcnRadioGroup.tsx +3 -3
- package/src/components/ShadcnRangeCalendar.tsx +15 -15
- package/src/components/ShadcnSelect.tsx +28 -31
- package/src/components/ShadcnSeparator.tsx +5 -5
- package/src/components/ShadcnSheet.tsx +13 -13
- package/src/components/ShadcnSidebar.tsx +73 -72
- package/src/components/ShadcnSkeleton.tsx +1 -1
- package/src/components/ShadcnSlider.tsx +8 -8
- package/src/components/ShadcnSonner.tsx +4 -4
- package/src/components/ShadcnSpinner.tsx +3 -3
- package/src/components/ShadcnSwitch.tsx +5 -5
- package/src/components/ShadcnTabs.tsx +13 -8
- package/src/components/ShadcnTextarea.tsx +3 -3
- package/src/components/ShadcnToggle.tsx +8 -8
- package/src/components/ShadcnToggleGroup.tsx +18 -17
- package/src/components/ShadcnTooltip.tsx +7 -7
|
@@ -28,7 +28,7 @@ export function ShadcnPopover({
|
|
|
28
28
|
open: controlledOpen,
|
|
29
29
|
defaultOpen = false,
|
|
30
30
|
onOpenChange,
|
|
31
|
-
children
|
|
31
|
+
children
|
|
32
32
|
}: PopoverProps) {
|
|
33
33
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
34
34
|
const isControlled = controlledOpen !== undefined;
|
|
@@ -43,7 +43,7 @@ export function ShadcnPopover({
|
|
|
43
43
|
}
|
|
44
44
|
onOpenChange?.(nextValue);
|
|
45
45
|
},
|
|
46
|
-
[isControlled, open, onOpenChange]
|
|
46
|
+
[isControlled, open, onOpenChange]
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
return (
|
|
@@ -67,7 +67,7 @@ export const ShadcnPopoverTrigger = React.forwardRef<HTMLButtonElement, PopoverT
|
|
|
67
67
|
if (typeof ref === 'function') ref(node);
|
|
68
68
|
else if (ref) (ref as React.MutableRefObject<HTMLButtonElement | null>).current = node;
|
|
69
69
|
},
|
|
70
|
-
[ref, triggerRef]
|
|
70
|
+
[ref, triggerRef]
|
|
71
71
|
);
|
|
72
72
|
|
|
73
73
|
return (
|
|
@@ -85,7 +85,7 @@ export const ShadcnPopoverTrigger = React.forwardRef<HTMLButtonElement, PopoverT
|
|
|
85
85
|
{...props}
|
|
86
86
|
/>
|
|
87
87
|
);
|
|
88
|
-
}
|
|
88
|
+
}
|
|
89
89
|
);
|
|
90
90
|
PopoverTrigger.displayName = 'PopoverTrigger';
|
|
91
91
|
|
|
@@ -135,12 +135,12 @@ export const ShadcnPopoverContent = React.forwardRef<HTMLDivElement, PopoverCont
|
|
|
135
135
|
data-open=""
|
|
136
136
|
className={cn(
|
|
137
137
|
'z-50 w-72 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 flex flex-col gap-2.5 outline-hidden 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 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 absolute mt-1',
|
|
138
|
-
className
|
|
138
|
+
className
|
|
139
139
|
)}
|
|
140
140
|
{...props}
|
|
141
141
|
/>
|
|
142
142
|
);
|
|
143
|
-
}
|
|
143
|
+
}
|
|
144
144
|
);
|
|
145
145
|
PopoverContent.displayName = 'PopoverContent';
|
|
146
146
|
|
|
@@ -154,7 +154,7 @@ export const ShadcnPopoverHeader = React.forwardRef<HTMLDivElement, PopoverHeade
|
|
|
154
154
|
className={cn('flex flex-col gap-0.5 text-sm', className)}
|
|
155
155
|
{...props}
|
|
156
156
|
/>
|
|
157
|
-
)
|
|
157
|
+
)
|
|
158
158
|
);
|
|
159
159
|
PopoverHeader.displayName = 'PopoverHeader';
|
|
160
160
|
|
|
@@ -168,22 +168,23 @@ export const ShadcnPopoverTitle = React.forwardRef<HTMLHeadingElement, PopoverTi
|
|
|
168
168
|
className={cn('font-medium leading-none tracking-tight', className)}
|
|
169
169
|
{...props}
|
|
170
170
|
/>
|
|
171
|
-
)
|
|
171
|
+
)
|
|
172
172
|
);
|
|
173
173
|
PopoverTitle.displayName = 'PopoverTitle';
|
|
174
174
|
|
|
175
175
|
export interface ShadcnPopoverDescriptionProps extends React.ComponentProps<'p'> {}
|
|
176
176
|
|
|
177
|
-
export const ShadcnPopoverDescription = React.forwardRef<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
177
|
+
export const ShadcnPopoverDescription = React.forwardRef<
|
|
178
|
+
HTMLParagraphElement,
|
|
179
|
+
PopoverDescriptionProps
|
|
180
|
+
>(({ className, ...props }, ref) => (
|
|
181
|
+
<p
|
|
182
|
+
ref={ref}
|
|
183
|
+
data-slot="popover-description"
|
|
184
|
+
className={cn('text-muted-foreground text-xs', className)}
|
|
185
|
+
{...props}
|
|
186
|
+
/>
|
|
187
|
+
));
|
|
187
188
|
PopoverDescription.displayName = 'PopoverDescription';
|
|
188
189
|
|
|
189
190
|
export interface ShadcnPopoverCloseProps extends React.ComponentProps<'button'> {}
|
|
@@ -204,7 +205,7 @@ export const ShadcnPopoverClose = React.forwardRef<HTMLButtonElement, PopoverClo
|
|
|
204
205
|
{...props}
|
|
205
206
|
/>
|
|
206
207
|
);
|
|
207
|
-
}
|
|
208
|
+
}
|
|
208
209
|
);
|
|
209
210
|
PopoverClose.displayName = 'PopoverClose';
|
|
210
211
|
|
|
@@ -20,7 +20,7 @@ export const ShadcnProgress = React.forwardRef<HTMLDivElement, ProgressProps>(
|
|
|
20
20
|
data-slot="progress"
|
|
21
21
|
className={cn(
|
|
22
22
|
'h-1 rounded-full bg-muted relative flex w-full items-center overflow-x-hidden',
|
|
23
|
-
className
|
|
23
|
+
className
|
|
24
24
|
)}
|
|
25
25
|
{...props}
|
|
26
26
|
>
|
|
@@ -31,7 +31,7 @@ export const ShadcnProgress = React.forwardRef<HTMLDivElement, ProgressProps>(
|
|
|
31
31
|
/>
|
|
32
32
|
</div>
|
|
33
33
|
);
|
|
34
|
-
}
|
|
34
|
+
}
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
Progress.displayName = 'Progress';
|
|
@@ -41,7 +41,7 @@ export function ShadcnRadioGroup({
|
|
|
41
41
|
}
|
|
42
42
|
onValueChange?.(nextVal);
|
|
43
43
|
},
|
|
44
|
-
[isControlled, onValueChange]
|
|
44
|
+
[isControlled, onValueChange]
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
return (
|
|
@@ -50,7 +50,7 @@ export function ShadcnRadioGroup({
|
|
|
50
50
|
value,
|
|
51
51
|
onValueChange: handleValueChange,
|
|
52
52
|
disabled,
|
|
53
|
-
name
|
|
53
|
+
name
|
|
54
54
|
}}
|
|
55
55
|
>
|
|
56
56
|
<div
|
|
@@ -98,7 +98,7 @@ export function ShadcnRadioGroupItem({
|
|
|
98
98
|
className={cn(
|
|
99
99
|
'flex size-4 rounded-full border-input focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50',
|
|
100
100
|
isChecked && 'border-primary bg-primary text-primary-foreground',
|
|
101
|
-
className
|
|
101
|
+
className
|
|
102
102
|
)}
|
|
103
103
|
{...props}
|
|
104
104
|
>
|
|
@@ -62,7 +62,7 @@ export function ShadcnRangeCalendar({
|
|
|
62
62
|
}: RangeCalendarProps) {
|
|
63
63
|
const [uncontrolledValue, setUncontrolledValue] = React.useState<DateRange>(defaultValue);
|
|
64
64
|
const [currentPlaceholder, setCurrentPlaceholder] = React.useState<Date>(
|
|
65
|
-
controlledPlaceholder || new Date()
|
|
65
|
+
controlledPlaceholder || new Date()
|
|
66
66
|
);
|
|
67
67
|
const [hoveredDate, setHoveredDate] = React.useState<Date | null>(null);
|
|
68
68
|
|
|
@@ -76,7 +76,7 @@ export function ShadcnRangeCalendar({
|
|
|
76
76
|
setCurrentPlaceholder(date);
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
-
[controlledPlaceholder]
|
|
79
|
+
[controlledPlaceholder]
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
const handleSelectDate = (date: Date) => {
|
|
@@ -132,7 +132,7 @@ export function ShadcnRangeCalendar({
|
|
|
132
132
|
for (let i = firstDayOfWeek - 1; i >= 0; i--) {
|
|
133
133
|
currentWeek.push({
|
|
134
134
|
date: new Date(year, month - 1, daysInPrevMonth - i),
|
|
135
|
-
outside: true
|
|
135
|
+
outside: true
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -143,7 +143,7 @@ export function ShadcnRangeCalendar({
|
|
|
143
143
|
}
|
|
144
144
|
currentWeek.push({
|
|
145
145
|
date: new Date(year, month, day),
|
|
146
|
-
outside: false
|
|
146
|
+
outside: false
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -151,7 +151,7 @@ export function ShadcnRangeCalendar({
|
|
|
151
151
|
while (currentWeek.length > 0 && currentWeek.length < 7) {
|
|
152
152
|
currentWeek.push({
|
|
153
153
|
date: new Date(year, month + 1, nextMonthDay++),
|
|
154
|
-
outside: true
|
|
154
|
+
outside: true
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
if (currentWeek.length > 0) {
|
|
@@ -166,7 +166,7 @@ export function ShadcnRangeCalendar({
|
|
|
166
166
|
data-slot="range-calendar"
|
|
167
167
|
className={cn(
|
|
168
168
|
'p-3 bg-background border border-border rounded-lg shadow-sm w-fit select-none',
|
|
169
|
-
className
|
|
169
|
+
className
|
|
170
170
|
)}
|
|
171
171
|
{...props}
|
|
172
172
|
>
|
|
@@ -200,7 +200,7 @@ export function ShadcnRangeCalendar({
|
|
|
200
200
|
<div className="flex h-7 items-center justify-center">
|
|
201
201
|
<span className="text-sm font-medium text-foreground">
|
|
202
202
|
{new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' }).format(
|
|
203
|
-
monthData.target
|
|
203
|
+
monthData.target
|
|
204
204
|
)}
|
|
205
205
|
</span>
|
|
206
206
|
</div>
|
|
@@ -240,7 +240,7 @@ export function ShadcnRangeCalendar({
|
|
|
240
240
|
isStart && !isEnd && value.end && 'rounded-s-md bg-accent',
|
|
241
241
|
isEnd && !isStart && 'rounded-e-md bg-accent',
|
|
242
242
|
isMiddle && 'bg-accent rounded-none',
|
|
243
|
-
isStart && isEnd && 'rounded-md'
|
|
243
|
+
isStart && isEnd && 'rounded-md'
|
|
244
244
|
)}
|
|
245
245
|
>
|
|
246
246
|
{disableDaysOutsideMonth && cell.outside ? (
|
|
@@ -263,7 +263,7 @@ export function ShadcnRangeCalendar({
|
|
|
263
263
|
!isStart &&
|
|
264
264
|
!isEnd &&
|
|
265
265
|
!isMiddle &&
|
|
266
|
-
'hover:bg-accent hover:text-accent-foreground'
|
|
266
|
+
'hover:bg-accent hover:text-accent-foreground'
|
|
267
267
|
)}
|
|
268
268
|
>
|
|
269
269
|
{cell.date.getDate()}
|
|
@@ -293,7 +293,7 @@ export const RangeCalendarNav = ({ className, ...props }: React.ComponentProps<'
|
|
|
293
293
|
<nav
|
|
294
294
|
className={cn(
|
|
295
295
|
'absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1',
|
|
296
|
-
className
|
|
296
|
+
className
|
|
297
297
|
)}
|
|
298
298
|
{...props}
|
|
299
299
|
/>
|
|
@@ -307,7 +307,7 @@ export const RangeCalendarPrevButton = ({
|
|
|
307
307
|
type="button"
|
|
308
308
|
className={cn(
|
|
309
309
|
'inline-flex size-7 items-center justify-center rounded-md border border-input bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground select-none disabled:opacity-50 rtl:rotate-180',
|
|
310
|
-
className
|
|
310
|
+
className
|
|
311
311
|
)}
|
|
312
312
|
{...props}
|
|
313
313
|
>
|
|
@@ -323,7 +323,7 @@ export const RangeCalendarNextButton = ({
|
|
|
323
323
|
type="button"
|
|
324
324
|
className={cn(
|
|
325
325
|
'inline-flex size-7 items-center justify-center rounded-md border border-input bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground select-none disabled:opacity-50 rtl:rotate-180',
|
|
326
|
-
className
|
|
326
|
+
className
|
|
327
327
|
)}
|
|
328
328
|
{...props}
|
|
329
329
|
>
|
|
@@ -339,7 +339,7 @@ export const ShadcnRangeCalendarHeader = ({ className, ...props }: React.Compone
|
|
|
339
339
|
<div
|
|
340
340
|
className={cn(
|
|
341
341
|
'flex h-7 w-full items-center justify-center gap-1.5 text-sm font-medium',
|
|
342
|
-
className
|
|
342
|
+
className
|
|
343
343
|
)}
|
|
344
344
|
{...props}
|
|
345
345
|
/>
|
|
@@ -365,7 +365,7 @@ export const RangeCalendarHeadCell = ({ className, ...props }: React.ComponentPr
|
|
|
365
365
|
<th
|
|
366
366
|
className={cn(
|
|
367
367
|
'w-9 rounded-md text-[0.8rem] font-normal text-muted-foreground text-center',
|
|
368
|
-
className
|
|
368
|
+
className
|
|
369
369
|
)}
|
|
370
370
|
{...props}
|
|
371
371
|
/>
|
|
@@ -387,7 +387,7 @@ export const RangeCalendarDay = ({ className, ...props }: React.ComponentProps<'
|
|
|
387
387
|
type="button"
|
|
388
388
|
className={cn(
|
|
389
389
|
'flex size-9 flex-col items-center justify-center rounded-md p-0 leading-none font-normal select-none transition-colors hover:bg-accent hover:text-accent-foreground',
|
|
390
|
-
className
|
|
390
|
+
className
|
|
391
391
|
)}
|
|
392
392
|
{...props}
|
|
393
393
|
/>
|
|
@@ -9,7 +9,7 @@ export const MinimalistResizable: React.FC<MinimalistResizableProps> = ({
|
|
|
9
9
|
initialWidth = 400,
|
|
10
10
|
minWidth = 200,
|
|
11
11
|
maxWidth = 800,
|
|
12
|
-
children
|
|
12
|
+
children
|
|
13
13
|
}) => {
|
|
14
14
|
const [width, setWidth] = useState(initialWidth);
|
|
15
15
|
const [isResizing, setIsResizing] = useState(false);
|
|
@@ -21,7 +21,7 @@ export const MinimalistResizable: React.FC<MinimalistResizableProps> = ({
|
|
|
21
21
|
setWidth(e.clientX);
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
[isResizing, minWidth, maxWidth]
|
|
24
|
+
[isResizing, minWidth, maxWidth]
|
|
25
25
|
);
|
|
26
26
|
const handleMouseUp = useCallback(() => setIsResizing(false), []);
|
|
27
27
|
React.useEffect(() => {
|
|
@@ -10,7 +10,7 @@ export const ModernScrollArea: React.FC<ModernScrollAreaProps> = ({
|
|
|
10
10
|
activePlatform = 'react',
|
|
11
11
|
code = '',
|
|
12
12
|
copied = false,
|
|
13
|
-
onCopy = () => {}
|
|
13
|
+
onCopy = () => {}
|
|
14
14
|
}) => {
|
|
15
15
|
const formattedCode = React.useMemo(() => (code || '').trim(), [code]);
|
|
16
16
|
return (
|
|
@@ -36,7 +36,7 @@ export function ShadcnSelect({
|
|
|
36
36
|
value: controlledValue,
|
|
37
37
|
defaultValue = '',
|
|
38
38
|
onValueChange,
|
|
39
|
-
children
|
|
39
|
+
children
|
|
40
40
|
}: SelectProps) {
|
|
41
41
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
42
42
|
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
@@ -55,7 +55,7 @@ export function ShadcnSelect({
|
|
|
55
55
|
}
|
|
56
56
|
onOpenChange?.(resolved);
|
|
57
57
|
},
|
|
58
|
-
[isControlledOpen, onOpenChange, open]
|
|
58
|
+
[isControlledOpen, onOpenChange, open]
|
|
59
59
|
);
|
|
60
60
|
|
|
61
61
|
const handleValueChange = React.useCallback(
|
|
@@ -66,7 +66,7 @@ export function ShadcnSelect({
|
|
|
66
66
|
onValueChange?.(nextVal);
|
|
67
67
|
setOpen(false);
|
|
68
68
|
},
|
|
69
|
-
[isControlledValue, onValueChange, setOpen]
|
|
69
|
+
[isControlledValue, onValueChange, setOpen]
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
return (
|
|
@@ -95,7 +95,7 @@ export const ShadcnSelectTrigger = React.forwardRef<HTMLButtonElement, SelectTri
|
|
|
95
95
|
onClick={() => setOpen((prev) => !prev)}
|
|
96
96
|
className={cn(
|
|
97
97
|
"gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 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",
|
|
98
|
-
className
|
|
98
|
+
className
|
|
99
99
|
)}
|
|
100
100
|
{...props}
|
|
101
101
|
>
|
|
@@ -103,7 +103,7 @@ export const ShadcnSelectTrigger = React.forwardRef<HTMLButtonElement, SelectTri
|
|
|
103
103
|
<ChevronDown className="size-4 text-muted-foreground pointer-events-none" />
|
|
104
104
|
</button>
|
|
105
105
|
);
|
|
106
|
-
}
|
|
106
|
+
}
|
|
107
107
|
);
|
|
108
108
|
SelectTrigger.displayName = 'SelectTrigger';
|
|
109
109
|
|
|
@@ -124,27 +124,23 @@ export const ShadcnSelectContent = React.forwardRef<HTMLDivElement, SelectConten
|
|
|
124
124
|
data-slot="select-content"
|
|
125
125
|
className={cn(
|
|
126
126
|
'min-w-36 rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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 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 absolute z-50 overflow-x-hidden overflow-y-auto mt-1 p-1',
|
|
127
|
-
className
|
|
127
|
+
className
|
|
128
128
|
)}
|
|
129
129
|
{...props}
|
|
130
130
|
>
|
|
131
131
|
<div className="h-full w-full scroll-my-1">{children}</div>
|
|
132
132
|
</div>
|
|
133
133
|
);
|
|
134
|
-
}
|
|
134
|
+
}
|
|
135
135
|
);
|
|
136
136
|
SelectContent.displayName = 'SelectContent';
|
|
137
137
|
|
|
138
|
-
export const ShadcnSelectGroup = React.forwardRef<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{...props}
|
|
145
|
-
/>
|
|
146
|
-
),
|
|
147
|
-
);
|
|
138
|
+
export const ShadcnSelectGroup = React.forwardRef<
|
|
139
|
+
HTMLDivElement,
|
|
140
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
141
|
+
>(({ className, ...props }, ref) => (
|
|
142
|
+
<div ref={ref} data-slot="select-group" className={cn('scroll-my-1 p-1', className)} {...props} />
|
|
143
|
+
));
|
|
148
144
|
SelectGroup.displayName = 'SelectGroup';
|
|
149
145
|
|
|
150
146
|
export const SelectGroupHeading = React.forwardRef<
|
|
@@ -160,16 +156,17 @@ export const SelectGroupHeading = React.forwardRef<
|
|
|
160
156
|
));
|
|
161
157
|
SelectGroupHeading.displayName = 'SelectGroupHeading';
|
|
162
158
|
|
|
163
|
-
export const ShadcnSelectLabel = React.forwardRef<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
159
|
+
export const ShadcnSelectLabel = React.forwardRef<
|
|
160
|
+
HTMLDivElement,
|
|
161
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
162
|
+
>(({ className, ...props }, ref) => (
|
|
163
|
+
<div
|
|
164
|
+
ref={ref}
|
|
165
|
+
data-slot="select-label"
|
|
166
|
+
className={cn('px-1.5 py-1 text-xs text-muted-foreground', className)}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
));
|
|
173
170
|
SelectLabel.displayName = 'SelectLabel';
|
|
174
171
|
|
|
175
172
|
export interface ShadcnSelectItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -194,7 +191,7 @@ export const ShadcnSelectItem = React.forwardRef<HTMLDivElement, SelectItemProps
|
|
|
194
191
|
onClick={() => !disabled && onValueChange(value)}
|
|
195
192
|
className={cn(
|
|
196
193
|
"gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none hover:bg-accent hover:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
197
|
-
className
|
|
194
|
+
className
|
|
198
195
|
)}
|
|
199
196
|
{...props}
|
|
200
197
|
>
|
|
@@ -206,7 +203,7 @@ export const ShadcnSelectItem = React.forwardRef<HTMLDivElement, SelectItemProps
|
|
|
206
203
|
</span>
|
|
207
204
|
</div>
|
|
208
205
|
);
|
|
209
|
-
}
|
|
206
|
+
}
|
|
210
207
|
);
|
|
211
208
|
SelectItem.displayName = 'SelectItem';
|
|
212
209
|
|
|
@@ -232,7 +229,7 @@ export const SelectScrollUpButton = React.forwardRef<
|
|
|
232
229
|
data-slot="select-scroll-up-button"
|
|
233
230
|
className={cn(
|
|
234
231
|
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4 top-0 w-full",
|
|
235
|
-
className
|
|
232
|
+
className
|
|
236
233
|
)}
|
|
237
234
|
{...props}
|
|
238
235
|
>
|
|
@@ -250,7 +247,7 @@ export const SelectScrollDownButton = React.forwardRef<
|
|
|
250
247
|
data-slot="select-scroll-down-button"
|
|
251
248
|
className={cn(
|
|
252
249
|
"z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4 bottom-0 w-full",
|
|
253
|
-
className
|
|
250
|
+
className
|
|
254
251
|
)}
|
|
255
252
|
{...props}
|
|
256
253
|
>
|
|
@@ -16,13 +16,13 @@ export const ShadcnSeparator = React.forwardRef<HTMLDivElement, SeparatorProps>(
|
|
|
16
16
|
'data-slot': dataSlot = 'separator',
|
|
17
17
|
...props
|
|
18
18
|
},
|
|
19
|
-
ref
|
|
19
|
+
ref
|
|
20
20
|
) => {
|
|
21
21
|
const semanticProps = decorative
|
|
22
22
|
? { role: 'none' }
|
|
23
23
|
: {
|
|
24
24
|
role: 'separator',
|
|
25
|
-
'aria-orientation': orientation === 'vertical' ? 'vertical' : undefined
|
|
25
|
+
'aria-orientation': orientation === 'vertical' ? 'vertical' : undefined
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
return (
|
|
@@ -33,13 +33,13 @@ export const ShadcnSeparator = React.forwardRef<HTMLDivElement, SeparatorProps>(
|
|
|
33
33
|
{...semanticProps}
|
|
34
34
|
className={cn(
|
|
35
35
|
'shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:h-full',
|
|
36
|
-
className
|
|
36
|
+
className
|
|
37
37
|
)}
|
|
38
38
|
{...props}
|
|
39
39
|
/>
|
|
40
40
|
);
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
);
|
|
43
43
|
|
|
44
44
|
Separator.displayName = 'Separator';
|
|
45
|
-
export default MinimalistSeparator;
|
|
45
|
+
export default MinimalistSeparator;
|
|
@@ -28,7 +28,7 @@ export function ShadcnSheet({
|
|
|
28
28
|
open: controlledOpen,
|
|
29
29
|
defaultOpen = false,
|
|
30
30
|
onOpenChange,
|
|
31
|
-
children
|
|
31
|
+
children
|
|
32
32
|
}: SheetProps) {
|
|
33
33
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
34
34
|
const isControlled = controlledOpen !== undefined;
|
|
@@ -42,7 +42,7 @@ export function ShadcnSheet({
|
|
|
42
42
|
}
|
|
43
43
|
onOpenChange?.(nextOpen);
|
|
44
44
|
},
|
|
45
|
-
[isControlled, open, onOpenChange]
|
|
45
|
+
[isControlled, open, onOpenChange]
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
return <SheetContext.Provider value={{ open, setOpen }}>{children}</SheetContext.Provider>;
|
|
@@ -66,7 +66,7 @@ export const ShadcnSheetTrigger = React.forwardRef<HTMLButtonElement, SheetTrigg
|
|
|
66
66
|
{...props}
|
|
67
67
|
/>
|
|
68
68
|
);
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
70
|
);
|
|
71
71
|
SheetTrigger.displayName = 'SheetTrigger';
|
|
72
72
|
|
|
@@ -88,7 +88,7 @@ export const ShadcnSheetClose = React.forwardRef<HTMLButtonElement, SheetClosePr
|
|
|
88
88
|
{...props}
|
|
89
89
|
/>
|
|
90
90
|
);
|
|
91
|
-
}
|
|
91
|
+
}
|
|
92
92
|
);
|
|
93
93
|
SheetClose.displayName = 'SheetClose';
|
|
94
94
|
|
|
@@ -111,7 +111,7 @@ export const ShadcnSheetOverlay = React.forwardRef<HTMLDivElement, SheetOverlayP
|
|
|
111
111
|
data-slot="sheet-overlay"
|
|
112
112
|
className={cn(
|
|
113
113
|
'fixed inset-0 z-50 bg-black/80 transition-opacity animate-in fade-in-0',
|
|
114
|
-
className
|
|
114
|
+
className
|
|
115
115
|
)}
|
|
116
116
|
onClick={(e) => {
|
|
117
117
|
setOpen(false);
|
|
@@ -120,7 +120,7 @@ export const ShadcnSheetOverlay = React.forwardRef<HTMLDivElement, SheetOverlayP
|
|
|
120
120
|
{...props}
|
|
121
121
|
/>
|
|
122
122
|
);
|
|
123
|
-
}
|
|
123
|
+
}
|
|
124
124
|
);
|
|
125
125
|
SheetOverlay.displayName = 'SheetOverlay';
|
|
126
126
|
|
|
@@ -152,7 +152,7 @@ export const ShadcnSheetContent = React.forwardRef<HTMLDivElement, SheetContentP
|
|
|
152
152
|
'inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm slide-in-from-left',
|
|
153
153
|
side === 'right' &&
|
|
154
154
|
'inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm slide-in-from-right',
|
|
155
|
-
className
|
|
155
|
+
className
|
|
156
156
|
)}
|
|
157
157
|
{...props}
|
|
158
158
|
>
|
|
@@ -171,7 +171,7 @@ export const ShadcnSheetContent = React.forwardRef<HTMLDivElement, SheetContentP
|
|
|
171
171
|
</div>
|
|
172
172
|
</SheetPortal>
|
|
173
173
|
);
|
|
174
|
-
}
|
|
174
|
+
}
|
|
175
175
|
);
|
|
176
176
|
SheetContent.displayName = 'SheetContent';
|
|
177
177
|
|
|
@@ -185,7 +185,7 @@ export const ShadcnSheetHeader = React.forwardRef<HTMLDivElement, SheetHeaderPro
|
|
|
185
185
|
className={cn('flex flex-col gap-1.5 text-center sm:text-left', className)}
|
|
186
186
|
{...props}
|
|
187
187
|
/>
|
|
188
|
-
)
|
|
188
|
+
)
|
|
189
189
|
);
|
|
190
190
|
SheetHeader.displayName = 'SheetHeader';
|
|
191
191
|
|
|
@@ -199,7 +199,7 @@ export const ShadcnSheetFooter = React.forwardRef<HTMLDivElement, SheetFooterPro
|
|
|
199
199
|
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-auto', className)}
|
|
200
200
|
{...props}
|
|
201
201
|
/>
|
|
202
|
-
)
|
|
202
|
+
)
|
|
203
203
|
);
|
|
204
204
|
SheetFooter.displayName = 'SheetFooter';
|
|
205
205
|
|
|
@@ -213,7 +213,7 @@ export const ShadcnSheetTitle = React.forwardRef<HTMLHeadingElement, SheetTitleP
|
|
|
213
213
|
className={cn('text-lg font-semibold text-foreground', className)}
|
|
214
214
|
{...props}
|
|
215
215
|
/>
|
|
216
|
-
)
|
|
216
|
+
)
|
|
217
217
|
);
|
|
218
218
|
SheetTitle.displayName = 'SheetTitle';
|
|
219
219
|
|
|
@@ -227,7 +227,7 @@ export const ShadcnSheetDescription = React.forwardRef<HTMLParagraphElement, She
|
|
|
227
227
|
className={cn('text-sm text-muted-foreground', className)}
|
|
228
228
|
{...props}
|
|
229
229
|
/>
|
|
230
|
-
)
|
|
230
|
+
)
|
|
231
231
|
);
|
|
232
232
|
SheetDescription.displayName = 'SheetDescription';
|
|
233
233
|
|
|
@@ -241,7 +241,7 @@ export {
|
|
|
241
241
|
SheetHeader as Header,
|
|
242
242
|
SheetFooter as Footer,
|
|
243
243
|
SheetTitle as Title,
|
|
244
|
-
SheetDescription as Description
|
|
244
|
+
SheetDescription as Description
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
export default MinimalistSheet;
|