@surreal-ui/react 0.8.1 → 0.9.1
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/LICENSE +21 -0
- package/dist/index.js +955 -7227
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +14 -0
- package/package.json +21 -4
- package/CHANGELOG.md +0 -149
- package/src/components/GlassmorphismAlert.tsx +0 -43
- package/src/components/GlassmorphismButton.tsx +0 -20
- package/src/components/GlassmorphismCard.tsx +0 -43
- package/src/components/GlassmorphismEmptyState.tsx +0 -20
- package/src/components/GlassmorphismInputGroup.tsx +0 -148
- package/src/components/GlassmorphismMenubar.tsx +0 -96
- package/src/components/GlassmorphismScrollArea.tsx +0 -67
- package/src/components/GlassmorphismTable.tsx +0 -61
- package/src/components/GlassmorphismTypography.tsx +0 -31
- package/src/components/MinimalistAccordion.tsx +0 -215
- package/src/components/MinimalistAlert.tsx +0 -43
- package/src/components/MinimalistAlertDialog.tsx +0 -318
- package/src/components/MinimalistAspectRatio.tsx +0 -30
- package/src/components/MinimalistAvatar.tsx +0 -149
- package/src/components/MinimalistBadge.tsx +0 -49
- package/src/components/MinimalistBreadcrumb.tsx +0 -109
- package/src/components/MinimalistButton.tsx +0 -86
- package/src/components/MinimalistButtonGroup.tsx +0 -86
- package/src/components/MinimalistCalendar.tsx +0 -355
- package/src/components/MinimalistCard.tsx +0 -89
- package/src/components/MinimalistCarousel.tsx +0 -266
- package/src/components/MinimalistChart.tsx +0 -296
- package/src/components/MinimalistCheckbox.tsx +0 -117
- package/src/components/MinimalistCodeBlock.tsx +0 -203
- package/src/components/MinimalistCollapsible.tsx +0 -134
- package/src/components/MinimalistCommand.tsx +0 -344
- package/src/components/MinimalistContextMenu.tsx +0 -408
- package/src/components/MinimalistDialog.tsx +0 -273
- package/src/components/MinimalistDrawer.tsx +0 -220
- package/src/components/MinimalistDropdownMenu.tsx +0 -431
- package/src/components/MinimalistEmpty.tsx +0 -105
- package/src/components/MinimalistEmptyState.tsx +0 -34
- package/src/components/MinimalistField.tsx +0 -275
- package/src/components/MinimalistForm.tsx +0 -205
- package/src/components/MinimalistHoverCard.tsx +0 -48
- package/src/components/MinimalistInput.tsx +0 -24
- package/src/components/MinimalistInputGroup.tsx +0 -180
- package/src/components/MinimalistInputOtp.tsx +0 -189
- package/src/components/MinimalistItem.tsx +0 -182
- package/src/components/MinimalistKbd.tsx +0 -46
- package/src/components/MinimalistLabel.tsx +0 -19
- package/src/components/MinimalistMenubar.tsx +0 -491
- package/src/components/MinimalistNativeSelect.tsx +0 -77
- package/src/components/MinimalistNavigationMenu.tsx +0 -198
- package/src/components/MinimalistPagination.tsx +0 -152
- package/src/components/MinimalistPopover.tsx +0 -229
- package/src/components/MinimalistProgress.tsx +0 -39
- package/src/components/MinimalistRadioGroup.tsx +0 -115
- package/src/components/MinimalistRangeCalendar.tsx +0 -396
- package/src/components/MinimalistResizable.tsx +0 -54
- package/src/components/MinimalistScrollArea.tsx +0 -41
- package/src/components/MinimalistSelect.tsx +0 -262
- package/src/components/MinimalistSeparator.tsx +0 -45
- package/src/components/MinimalistSheet.tsx +0 -247
- package/src/components/MinimalistSidebar.tsx +0 -638
- package/src/components/MinimalistSkeleton.tsx +0 -16
- package/src/components/MinimalistSlider.tsx +0 -213
- package/src/components/MinimalistSonner.tsx +0 -41
- package/src/components/MinimalistSpinner.tsx +0 -39
- package/src/components/MinimalistSwitch.tsx +0 -92
- package/src/components/MinimalistTable.tsx +0 -65
- package/src/components/MinimalistTabs.tsx +0 -171
- package/src/components/MinimalistTextarea.tsx +0 -24
- package/src/components/MinimalistToggle.tsx +0 -74
- package/src/components/MinimalistToggleGroup.tsx +0 -197
- package/src/components/MinimalistTooltip.tsx +0 -172
- package/src/components/MinimalistTypography.tsx +0 -33
- package/src/components/NeubrutalismCard.tsx +0 -84
- package/src/components/NeubrutalismItem.tsx +0 -48
- package/src/components/ShadcnAccordion.tsx +0 -215
- package/src/components/ShadcnAlertDialog.tsx +0 -318
- package/src/components/ShadcnAspectRatio.tsx +0 -30
- package/src/components/ShadcnAvatar.tsx +0 -149
- package/src/components/ShadcnBadge.tsx +0 -49
- package/src/components/ShadcnBreadcrumb.tsx +0 -109
- package/src/components/ShadcnButton.tsx +0 -86
- package/src/components/ShadcnButtonGroup.tsx +0 -86
- package/src/components/ShadcnCalendar.tsx +0 -355
- package/src/components/ShadcnCarousel.tsx +0 -266
- package/src/components/ShadcnChart.tsx +0 -296
- package/src/components/ShadcnCheckbox.tsx +0 -117
- package/src/components/ShadcnCodeBlock.tsx +0 -203
- package/src/components/ShadcnCollapsible.tsx +0 -134
- package/src/components/ShadcnCommand.tsx +0 -344
- package/src/components/ShadcnContextMenu.tsx +0 -408
- package/src/components/ShadcnDialog.tsx +0 -273
- package/src/components/ShadcnDrawer.tsx +0 -220
- package/src/components/ShadcnDropdownMenu.tsx +0 -431
- package/src/components/ShadcnEmpty.tsx +0 -105
- package/src/components/ShadcnField.tsx +0 -275
- package/src/components/ShadcnForm.tsx +0 -205
- package/src/components/ShadcnHoverCard.tsx +0 -48
- package/src/components/ShadcnInput.tsx +0 -24
- package/src/components/ShadcnInputGroup.tsx +0 -180
- package/src/components/ShadcnInputOtp.tsx +0 -189
- package/src/components/ShadcnItem.tsx +0 -182
- package/src/components/ShadcnKbd.tsx +0 -46
- package/src/components/ShadcnLabel.tsx +0 -19
- package/src/components/ShadcnMenubar.tsx +0 -491
- package/src/components/ShadcnNativeSelect.tsx +0 -77
- package/src/components/ShadcnNavigationMenu.tsx +0 -198
- package/src/components/ShadcnPagination.tsx +0 -152
- package/src/components/ShadcnPopover.tsx +0 -229
- package/src/components/ShadcnProgress.tsx +0 -39
- package/src/components/ShadcnRadioGroup.tsx +0 -115
- package/src/components/ShadcnRangeCalendar.tsx +0 -396
- package/src/components/ShadcnSelect.tsx +0 -262
- package/src/components/ShadcnSeparator.tsx +0 -45
- package/src/components/ShadcnSheet.tsx +0 -247
- package/src/components/ShadcnSidebar.tsx +0 -638
- package/src/components/ShadcnSkeleton.tsx +0 -16
- package/src/components/ShadcnSlider.tsx +0 -213
- package/src/components/ShadcnSonner.tsx +0 -41
- package/src/components/ShadcnSpinner.tsx +0 -39
- package/src/components/ShadcnSwitch.tsx +0 -92
- package/src/components/ShadcnTabs.tsx +0 -171
- package/src/components/ShadcnTextarea.tsx +0 -24
- package/src/components/ShadcnToggle.tsx +0 -74
- package/src/components/ShadcnToggleGroup.tsx +0 -197
- package/src/components/ShadcnTooltip.tsx +0 -172
- package/src/index.ts +0 -124
- package/tsconfig.json +0 -10
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cn, cva, type VariantProps } from '@surreal-ui/core';
|
|
3
|
-
|
|
4
|
-
export const toggleVariants = cva(
|
|
5
|
-
'inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
6
|
-
{
|
|
7
|
-
variants: {
|
|
8
|
-
variant: {
|
|
9
|
-
default:
|
|
10
|
-
'bg-transparent hover:bg-muted hover:text-muted-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-foreground',
|
|
11
|
-
outline:
|
|
12
|
-
'border border-input bg-transparent hover:bg-accent hover:text-accent-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-foreground'
|
|
13
|
-
},
|
|
14
|
-
size: {
|
|
15
|
-
default: 'h-9 px-3 min-w-9',
|
|
16
|
-
sm: 'h-8 px-2 min-w-8 text-xs',
|
|
17
|
-
lg: 'h-10 px-3 min-w-10'
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
defaultVariants: {
|
|
21
|
-
variant: 'default',
|
|
22
|
-
size: 'default'
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
export type ToggleVariantProps = VariantProps<typeof toggleVariants>;
|
|
28
|
-
|
|
29
|
-
interface ToggleGroupContextValue extends ToggleVariantProps {
|
|
30
|
-
type?: 'single' | 'multiple';
|
|
31
|
-
value?: string | string[];
|
|
32
|
-
onItemClick?: (val: string) => void;
|
|
33
|
-
spacing?: number;
|
|
34
|
-
orientation?: 'horizontal' | 'vertical';
|
|
35
|
-
disabled?: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const ToggleGroupContext = React.createContext<ToggleGroupContextValue>({
|
|
39
|
-
type: 'single',
|
|
40
|
-
size: 'default',
|
|
41
|
-
variant: 'default',
|
|
42
|
-
spacing: 0,
|
|
43
|
-
orientation: 'horizontal'
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export interface ShadcnToggleGroupProps
|
|
47
|
-
extends React.HTMLAttributes<HTMLDivElement>, ToggleVariantProps {
|
|
48
|
-
type?: 'single' | 'multiple';
|
|
49
|
-
value?: string | string[];
|
|
50
|
-
defaultValue?: string | string[];
|
|
51
|
-
onValueChange?: (value: any) => void;
|
|
52
|
-
spacing?: number;
|
|
53
|
-
orientation?: 'horizontal' | 'vertical';
|
|
54
|
-
disabled?: boolean;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const ShadcnToggleGroup = React.forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
58
|
-
(
|
|
59
|
-
{
|
|
60
|
-
className,
|
|
61
|
-
variant = 'default',
|
|
62
|
-
size = 'default',
|
|
63
|
-
spacing = 0,
|
|
64
|
-
orientation = 'horizontal',
|
|
65
|
-
type = 'single',
|
|
66
|
-
value: controlledValue,
|
|
67
|
-
defaultValue,
|
|
68
|
-
onValueChange,
|
|
69
|
-
disabled = false,
|
|
70
|
-
children,
|
|
71
|
-
style,
|
|
72
|
-
...props
|
|
73
|
-
},
|
|
74
|
-
ref
|
|
75
|
-
) => {
|
|
76
|
-
const [uncontrolledValue, setUncontrolledValue] = React.useState<string | string[]>(
|
|
77
|
-
defaultValue ?? (type === 'multiple' ? [] : '')
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
const isControlled = controlledValue !== undefined;
|
|
81
|
-
const currentValue = isControlled ? controlledValue : uncontrolledValue;
|
|
82
|
-
|
|
83
|
-
const handleItemClick = React.useCallback(
|
|
84
|
-
(itemValue: string) => {
|
|
85
|
-
if (disabled) return;
|
|
86
|
-
if (type === 'single') {
|
|
87
|
-
const next = currentValue === itemValue ? '' : itemValue;
|
|
88
|
-
if (!isControlled) {
|
|
89
|
-
setUncontrolledValue(next);
|
|
90
|
-
}
|
|
91
|
-
onValueChange?.(next);
|
|
92
|
-
} else {
|
|
93
|
-
const arr = Array.isArray(currentValue)
|
|
94
|
-
? [...currentValue]
|
|
95
|
-
: currentValue
|
|
96
|
-
? [currentValue]
|
|
97
|
-
: [];
|
|
98
|
-
const idx = arr.indexOf(itemValue);
|
|
99
|
-
if (idx > -1) {
|
|
100
|
-
arr.splice(idx, 1);
|
|
101
|
-
} else {
|
|
102
|
-
arr.push(itemValue);
|
|
103
|
-
}
|
|
104
|
-
if (!isControlled) {
|
|
105
|
-
setUncontrolledValue(arr);
|
|
106
|
-
}
|
|
107
|
-
onValueChange?.(arr);
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
[currentValue, disabled, isControlled, onValueChange, type]
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
return (
|
|
114
|
-
<ToggleGroupContext.Provider
|
|
115
|
-
value={{
|
|
116
|
-
type,
|
|
117
|
-
value: currentValue,
|
|
118
|
-
onItemClick: handleItemClick,
|
|
119
|
-
variant,
|
|
120
|
-
size,
|
|
121
|
-
spacing,
|
|
122
|
-
orientation,
|
|
123
|
-
disabled
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
<div
|
|
127
|
-
ref={ref}
|
|
128
|
-
role="group"
|
|
129
|
-
data-slot="toggle-group"
|
|
130
|
-
data-variant={variant}
|
|
131
|
-
data-size={size}
|
|
132
|
-
data-spacing={spacing}
|
|
133
|
-
data-orientation={orientation}
|
|
134
|
-
style={{ ...style, gap: `${spacing}px` }}
|
|
135
|
-
className={cn(
|
|
136
|
-
'rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] group/toggle-group flex w-fit flex-row items-center data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',
|
|
137
|
-
className
|
|
138
|
-
)}
|
|
139
|
-
{...props}
|
|
140
|
-
>
|
|
141
|
-
{children}
|
|
142
|
-
</div>
|
|
143
|
-
</ToggleGroupContext.Provider>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
ToggleGroup.displayName = 'ToggleGroup';
|
|
148
|
-
|
|
149
|
-
export interface ShadcnToggleGroupItemProps
|
|
150
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>, ToggleVariantProps {
|
|
151
|
-
value: string;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export const ShadcnToggleGroupItem = React.forwardRef<HTMLButtonElement, ToggleGroupItemProps>(
|
|
155
|
-
({ className, children, variant, size, value, disabled, ...props }, ref) => {
|
|
156
|
-
const context = React.useContext(ToggleGroupContext);
|
|
157
|
-
const activeVariant = variant || context.variant || 'default';
|
|
158
|
-
const activeSize = size || context.size || 'default';
|
|
159
|
-
const isSelected =
|
|
160
|
-
context.type === 'single'
|
|
161
|
-
? context.value === value
|
|
162
|
-
: Array.isArray(context.value) && context.value.includes(value);
|
|
163
|
-
const isDisabled = disabled || context.disabled;
|
|
164
|
-
|
|
165
|
-
return (
|
|
166
|
-
<button
|
|
167
|
-
ref={ref}
|
|
168
|
-
type="button"
|
|
169
|
-
role="radio"
|
|
170
|
-
aria-checked={isSelected}
|
|
171
|
-
data-state={isSelected ? 'on' : 'off'}
|
|
172
|
-
data-slot="toggle-group-item"
|
|
173
|
-
data-variant={activeVariant}
|
|
174
|
-
data-size={activeSize}
|
|
175
|
-
data-spacing={context.spacing ?? 0}
|
|
176
|
-
disabled={isDisabled}
|
|
177
|
-
onClick={() => context.onItemClick?.(value)}
|
|
178
|
-
className={cn(
|
|
179
|
-
'group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg shrink-0 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t',
|
|
180
|
-
toggleVariants({
|
|
181
|
-
variant: activeVariant,
|
|
182
|
-
size: activeSize
|
|
183
|
-
}),
|
|
184
|
-
className
|
|
185
|
-
)}
|
|
186
|
-
{...props}
|
|
187
|
-
>
|
|
188
|
-
{children}
|
|
189
|
-
</button>
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
);
|
|
193
|
-
ToggleGroupItem.displayName = 'ToggleGroupItem';
|
|
194
|
-
|
|
195
|
-
export { ShadcnToggleGroup as Root, ToggleGroupItem as Item };
|
|
196
|
-
|
|
197
|
-
export default ShadcnToggleGroup;
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cn } from '@surreal-ui/core';
|
|
3
|
-
|
|
4
|
-
interface TooltipContextType {
|
|
5
|
-
open: boolean;
|
|
6
|
-
setOpen: (open: boolean) => void;
|
|
7
|
-
delayDuration: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const TooltipContext = React.createContext<TooltipContextType | undefined>(undefined);
|
|
11
|
-
|
|
12
|
-
interface TooltipProviderProps {
|
|
13
|
-
delayDuration?: number;
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function TooltipProvider({ delayDuration = 0, children }: TooltipProviderProps) {
|
|
18
|
-
return <>{children}</>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface ShadcnTooltipProps {
|
|
22
|
-
open?: boolean;
|
|
23
|
-
defaultOpen?: boolean;
|
|
24
|
-
onOpenChange?: (open: boolean) => void;
|
|
25
|
-
delayDuration?: number;
|
|
26
|
-
children: React.ReactNode;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function ShadcnTooltip({
|
|
30
|
-
open: controlledOpen,
|
|
31
|
-
defaultOpen = false,
|
|
32
|
-
onOpenChange,
|
|
33
|
-
delayDuration = 0,
|
|
34
|
-
children
|
|
35
|
-
}: TooltipProps) {
|
|
36
|
-
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
37
|
-
const isControlled = controlledOpen !== undefined;
|
|
38
|
-
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
39
|
-
|
|
40
|
-
const setOpen = React.useCallback(
|
|
41
|
-
(nextOpen: boolean) => {
|
|
42
|
-
if (!isControlled) {
|
|
43
|
-
setUncontrolledOpen(nextOpen);
|
|
44
|
-
}
|
|
45
|
-
onOpenChange?.(nextOpen);
|
|
46
|
-
},
|
|
47
|
-
[isControlled, onOpenChange]
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<TooltipContext.Provider value={{ open, setOpen, delayDuration }}>
|
|
52
|
-
<div className="relative inline-flex flex-col items-center">{children}</div>
|
|
53
|
-
</TooltipContext.Provider>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface ShadcnTooltipTriggerProps extends React.ComponentProps<'div'> {
|
|
58
|
-
asChild?: boolean;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const ShadcnTooltipTrigger = React.forwardRef<HTMLDivElement, TooltipTriggerProps>(
|
|
62
|
-
({ className, children, onMouseEnter, onMouseLeave, onFocus, onBlur, ...props }, ref) => {
|
|
63
|
-
const context = React.useContext(TooltipContext);
|
|
64
|
-
const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
65
|
-
|
|
66
|
-
const handleMouseEnter = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
67
|
-
onMouseEnter?.(e);
|
|
68
|
-
if (context?.delayDuration) {
|
|
69
|
-
timeoutRef.current = setTimeout(() => {
|
|
70
|
-
context.setOpen(true);
|
|
71
|
-
}, context.delayDuration);
|
|
72
|
-
} else {
|
|
73
|
-
context?.setOpen(true);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const handleMouseLeave = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
78
|
-
onMouseLeave?.(e);
|
|
79
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
80
|
-
context?.setOpen(false);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const handleFocus = (e: React.FocusEvent<HTMLDivElement>) => {
|
|
84
|
-
onFocus?.(e);
|
|
85
|
-
context?.setOpen(true);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const handleBlur = (e: React.FocusEvent<HTMLDivElement>) => {
|
|
89
|
-
onBlur?.(e);
|
|
90
|
-
context?.setOpen(false);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<div
|
|
95
|
-
ref={ref}
|
|
96
|
-
data-slot="tooltip-trigger"
|
|
97
|
-
className={cn('inline-flex', className)}
|
|
98
|
-
onMouseEnter={handleMouseEnter}
|
|
99
|
-
onMouseLeave={handleMouseLeave}
|
|
100
|
-
onFocus={handleFocus}
|
|
101
|
-
onBlur={handleBlur}
|
|
102
|
-
{...props}
|
|
103
|
-
>
|
|
104
|
-
{children}
|
|
105
|
-
</div>
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
TooltipTrigger.displayName = 'TooltipTrigger';
|
|
110
|
-
|
|
111
|
-
export interface ShadcnTooltipPortalProps {
|
|
112
|
-
children: React.ReactNode;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function ShadcnTooltipPortal({ children }: TooltipPortalProps) {
|
|
116
|
-
return <>{children}</>;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface ShadcnTooltipContentProps extends React.ComponentProps<'div'> {
|
|
120
|
-
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
121
|
-
sideOffset?: number;
|
|
122
|
-
arrowClasses?: string;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export const ShadcnTooltipContent = React.forwardRef<HTMLDivElement, TooltipContentProps>(
|
|
126
|
-
({ className, side = 'top', sideOffset = 0, arrowClasses, children, ...props }, ref) => {
|
|
127
|
-
const context = React.useContext(TooltipContext);
|
|
128
|
-
if (!context?.open) return null;
|
|
129
|
-
|
|
130
|
-
return (
|
|
131
|
-
<div
|
|
132
|
-
ref={ref}
|
|
133
|
-
data-slot="tooltip-content"
|
|
134
|
-
data-side={side}
|
|
135
|
-
data-state={context.open ? 'open' : 'closed'}
|
|
136
|
-
className={cn(
|
|
137
|
-
'inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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 z-50 w-fit max-w-xs origin-(--bits-tooltip-content-transform-origin) bg-foreground text-background shadow-md absolute',
|
|
138
|
-
side === 'top' && 'bottom-full mb-1 left-1/2 -translate-x-1/2',
|
|
139
|
-
side === 'bottom' && 'top-full mt-1 left-1/2 -translate-x-1/2',
|
|
140
|
-
side === 'left' && 'right-full mr-1 top-1/2 -translate-y-1/2',
|
|
141
|
-
side === 'right' && 'left-full ml-1 top-1/2 -translate-y-1/2',
|
|
142
|
-
className
|
|
143
|
-
)}
|
|
144
|
-
{...props}
|
|
145
|
-
>
|
|
146
|
-
{children}
|
|
147
|
-
<div
|
|
148
|
-
data-slot="tooltip-arrow"
|
|
149
|
-
className={cn(
|
|
150
|
-
'size-2.5 rotate-45 rounded-[2px] z-50 bg-foreground fill-foreground absolute',
|
|
151
|
-
side === 'top' && '-bottom-1 left-1/2 -translate-x-1/2',
|
|
152
|
-
side === 'bottom' && '-top-1 left-1/2 -translate-x-1/2',
|
|
153
|
-
side === 'left' && '-right-1 top-1/2 -translate-y-1/2',
|
|
154
|
-
side === 'right' && '-left-1 top-1/2 -translate-y-1/2',
|
|
155
|
-
arrowClasses
|
|
156
|
-
)}
|
|
157
|
-
/>
|
|
158
|
-
</div>
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
TooltipContent.displayName = 'TooltipContent';
|
|
163
|
-
|
|
164
|
-
export {
|
|
165
|
-
ShadcnTooltip as Root,
|
|
166
|
-
TooltipTrigger as Trigger,
|
|
167
|
-
TooltipContent as Content,
|
|
168
|
-
TooltipProvider as Provider,
|
|
169
|
-
TooltipPortal as Portal
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export default ShadcnTooltip;
|
package/src/index.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// Surreal UI React Exports
|
|
2
|
-
// Auto-generated by Surreal UI PackageExporter
|
|
3
|
-
// Do not edit manually
|
|
4
|
-
|
|
5
|
-
export { default as GlassmorphismAlert } from './components/GlassmorphismAlert.js';
|
|
6
|
-
export { default as GlassmorphismButton } from './components/GlassmorphismButton.js';
|
|
7
|
-
export { default as GlassmorphismCard } from './components/GlassmorphismCard.js';
|
|
8
|
-
export { default as GlassmorphismEmptyState } from './components/GlassmorphismEmptyState.js';
|
|
9
|
-
export { default as GlassmorphismInputGroup } from './components/GlassmorphismInputGroup.js';
|
|
10
|
-
export { default as GlassmorphismMenubar } from './components/GlassmorphismMenubar.js';
|
|
11
|
-
export { default as GlassmorphismScrollArea } from './components/GlassmorphismScrollArea.js';
|
|
12
|
-
export { default as GlassmorphismTable } from './components/GlassmorphismTable.js';
|
|
13
|
-
export { default as GlassmorphismTypography } from './components/GlassmorphismTypography.js';
|
|
14
|
-
export { default as MinimalistAccordion } from './components/MinimalistAccordion.js';
|
|
15
|
-
export { default as MinimalistAlert } from './components/MinimalistAlert.js';
|
|
16
|
-
export { default as MinimalistAlertDialog } from './components/MinimalistAlertDialog.js';
|
|
17
|
-
export { default as MinimalistAspectRatio } from './components/MinimalistAspectRatio.js';
|
|
18
|
-
export { default as MinimalistAvatar } from './components/MinimalistAvatar.js';
|
|
19
|
-
export { default as MinimalistBadge } from './components/MinimalistBadge.js';
|
|
20
|
-
export { default as MinimalistBreadcrumb } from './components/MinimalistBreadcrumb.js';
|
|
21
|
-
export { default as MinimalistButton } from './components/MinimalistButton.js';
|
|
22
|
-
export { default as MinimalistButtonGroup } from './components/MinimalistButtonGroup.js';
|
|
23
|
-
export { default as MinimalistCalendar } from './components/MinimalistCalendar.js';
|
|
24
|
-
export { default as MinimalistCard } from './components/MinimalistCard.js';
|
|
25
|
-
export { default as MinimalistCarousel } from './components/MinimalistCarousel.js';
|
|
26
|
-
export { default as MinimalistChart } from './components/MinimalistChart.js';
|
|
27
|
-
export { default as MinimalistCheckbox } from './components/MinimalistCheckbox.js';
|
|
28
|
-
export { default as MinimalistCodeBlock } from './components/MinimalistCodeBlock.js';
|
|
29
|
-
export { default as MinimalistCollapsible } from './components/MinimalistCollapsible.js';
|
|
30
|
-
export { default as MinimalistCommand } from './components/MinimalistCommand.js';
|
|
31
|
-
export { default as MinimalistContextMenu } from './components/MinimalistContextMenu.js';
|
|
32
|
-
export { default as MinimalistDialog } from './components/MinimalistDialog.js';
|
|
33
|
-
export { default as MinimalistDrawer } from './components/MinimalistDrawer.js';
|
|
34
|
-
export { default as MinimalistDropdownMenu } from './components/MinimalistDropdownMenu.js';
|
|
35
|
-
export { default as MinimalistEmpty } from './components/MinimalistEmpty.js';
|
|
36
|
-
export { default as MinimalistEmptyState } from './components/MinimalistEmptyState.js';
|
|
37
|
-
export { default as MinimalistField } from './components/MinimalistField.js';
|
|
38
|
-
export { default as MinimalistForm } from './components/MinimalistForm.js';
|
|
39
|
-
export { default as MinimalistHoverCard } from './components/MinimalistHoverCard.js';
|
|
40
|
-
export { default as MinimalistInput } from './components/MinimalistInput.js';
|
|
41
|
-
export { default as MinimalistInputGroup } from './components/MinimalistInputGroup.js';
|
|
42
|
-
export { default as MinimalistInputOtp } from './components/MinimalistInputOtp.js';
|
|
43
|
-
export { default as MinimalistItem } from './components/MinimalistItem.js';
|
|
44
|
-
export { default as MinimalistKbd } from './components/MinimalistKbd.js';
|
|
45
|
-
export { default as MinimalistLabel } from './components/MinimalistLabel.js';
|
|
46
|
-
export { default as MinimalistMenubar } from './components/MinimalistMenubar.js';
|
|
47
|
-
export { default as MinimalistNativeSelect } from './components/MinimalistNativeSelect.js';
|
|
48
|
-
export { default as MinimalistNavigationMenu } from './components/MinimalistNavigationMenu.js';
|
|
49
|
-
export { default as MinimalistPagination } from './components/MinimalistPagination.js';
|
|
50
|
-
export { default as MinimalistPopover } from './components/MinimalistPopover.js';
|
|
51
|
-
export { default as MinimalistProgress } from './components/MinimalistProgress.js';
|
|
52
|
-
export { default as MinimalistRadioGroup } from './components/MinimalistRadioGroup.js';
|
|
53
|
-
export { default as MinimalistRangeCalendar } from './components/MinimalistRangeCalendar.js';
|
|
54
|
-
export { default as MinimalistResizable } from './components/MinimalistResizable.js';
|
|
55
|
-
export { default as MinimalistScrollArea } from './components/MinimalistScrollArea.js';
|
|
56
|
-
export { default as MinimalistSelect } from './components/MinimalistSelect.js';
|
|
57
|
-
export { default as MinimalistSeparator } from './components/MinimalistSeparator.js';
|
|
58
|
-
export { default as MinimalistSheet } from './components/MinimalistSheet.js';
|
|
59
|
-
export { default as MinimalistSidebar } from './components/MinimalistSidebar.js';
|
|
60
|
-
export { default as MinimalistSkeleton } from './components/MinimalistSkeleton.js';
|
|
61
|
-
export { default as MinimalistSlider } from './components/MinimalistSlider.js';
|
|
62
|
-
export { default as MinimalistSonner } from './components/MinimalistSonner.js';
|
|
63
|
-
export { default as MinimalistSpinner } from './components/MinimalistSpinner.js';
|
|
64
|
-
export { default as MinimalistSwitch } from './components/MinimalistSwitch.js';
|
|
65
|
-
export { default as MinimalistTable } from './components/MinimalistTable.js';
|
|
66
|
-
export { default as MinimalistTabs } from './components/MinimalistTabs.js';
|
|
67
|
-
export { default as MinimalistTextarea } from './components/MinimalistTextarea.js';
|
|
68
|
-
export { default as MinimalistToggle } from './components/MinimalistToggle.js';
|
|
69
|
-
export { default as MinimalistToggleGroup } from './components/MinimalistToggleGroup.js';
|
|
70
|
-
export { default as MinimalistTooltip } from './components/MinimalistTooltip.js';
|
|
71
|
-
export { default as MinimalistTypography } from './components/MinimalistTypography.js';
|
|
72
|
-
export { default as NeubrutalismCard } from './components/NeubrutalismCard.js';
|
|
73
|
-
export { default as NeubrutalismItem } from './components/NeubrutalismItem.js';
|
|
74
|
-
export { default as ShadcnAccordion } from './components/ShadcnAccordion.js';
|
|
75
|
-
export { default as ShadcnAlertDialog } from './components/ShadcnAlertDialog.js';
|
|
76
|
-
export { default as ShadcnAspectRatio } from './components/ShadcnAspectRatio.js';
|
|
77
|
-
export { default as ShadcnAvatar } from './components/ShadcnAvatar.js';
|
|
78
|
-
export { default as ShadcnBadge } from './components/ShadcnBadge.js';
|
|
79
|
-
export { default as ShadcnBreadcrumb } from './components/ShadcnBreadcrumb.js';
|
|
80
|
-
export { default as ShadcnButton } from './components/ShadcnButton.js';
|
|
81
|
-
export { default as ShadcnButtonGroup } from './components/ShadcnButtonGroup.js';
|
|
82
|
-
export { default as ShadcnCalendar } from './components/ShadcnCalendar.js';
|
|
83
|
-
export { default as ShadcnCarousel } from './components/ShadcnCarousel.js';
|
|
84
|
-
export { default as ShadcnChart } from './components/ShadcnChart.js';
|
|
85
|
-
export { default as ShadcnCheckbox } from './components/ShadcnCheckbox.js';
|
|
86
|
-
export { default as ShadcnCodeBlock } from './components/ShadcnCodeBlock.js';
|
|
87
|
-
export { default as ShadcnCollapsible } from './components/ShadcnCollapsible.js';
|
|
88
|
-
export { default as ShadcnCommand } from './components/ShadcnCommand.js';
|
|
89
|
-
export { default as ShadcnContextMenu } from './components/ShadcnContextMenu.js';
|
|
90
|
-
export { default as ShadcnDialog } from './components/ShadcnDialog.js';
|
|
91
|
-
export { default as ShadcnDrawer } from './components/ShadcnDrawer.js';
|
|
92
|
-
export { default as ShadcnDropdownMenu } from './components/ShadcnDropdownMenu.js';
|
|
93
|
-
export { default as ShadcnEmpty } from './components/ShadcnEmpty.js';
|
|
94
|
-
export { default as ShadcnField } from './components/ShadcnField.js';
|
|
95
|
-
export { default as ShadcnForm } from './components/ShadcnForm.js';
|
|
96
|
-
export { default as ShadcnHoverCard } from './components/ShadcnHoverCard.js';
|
|
97
|
-
export { default as ShadcnInput } from './components/ShadcnInput.js';
|
|
98
|
-
export { default as ShadcnInputGroup } from './components/ShadcnInputGroup.js';
|
|
99
|
-
export { default as ShadcnInputOtp } from './components/ShadcnInputOtp.js';
|
|
100
|
-
export { default as ShadcnItem } from './components/ShadcnItem.js';
|
|
101
|
-
export { default as ShadcnKbd } from './components/ShadcnKbd.js';
|
|
102
|
-
export { default as ShadcnLabel } from './components/ShadcnLabel.js';
|
|
103
|
-
export { default as ShadcnMenubar } from './components/ShadcnMenubar.js';
|
|
104
|
-
export { default as ShadcnNativeSelect } from './components/ShadcnNativeSelect.js';
|
|
105
|
-
export { default as ShadcnNavigationMenu } from './components/ShadcnNavigationMenu.js';
|
|
106
|
-
export { default as ShadcnPagination } from './components/ShadcnPagination.js';
|
|
107
|
-
export { default as ShadcnPopover } from './components/ShadcnPopover.js';
|
|
108
|
-
export { default as ShadcnProgress } from './components/ShadcnProgress.js';
|
|
109
|
-
export { default as ShadcnRadioGroup } from './components/ShadcnRadioGroup.js';
|
|
110
|
-
export { default as ShadcnRangeCalendar } from './components/ShadcnRangeCalendar.js';
|
|
111
|
-
export { default as ShadcnSelect } from './components/ShadcnSelect.js';
|
|
112
|
-
export { default as ShadcnSeparator } from './components/ShadcnSeparator.js';
|
|
113
|
-
export { default as ShadcnSheet } from './components/ShadcnSheet.js';
|
|
114
|
-
export { default as ShadcnSidebar } from './components/ShadcnSidebar.js';
|
|
115
|
-
export { default as ShadcnSkeleton } from './components/ShadcnSkeleton.js';
|
|
116
|
-
export { default as ShadcnSlider } from './components/ShadcnSlider.js';
|
|
117
|
-
export { default as ShadcnSonner } from './components/ShadcnSonner.js';
|
|
118
|
-
export { default as ShadcnSpinner } from './components/ShadcnSpinner.js';
|
|
119
|
-
export { default as ShadcnSwitch } from './components/ShadcnSwitch.js';
|
|
120
|
-
export { default as ShadcnTabs } from './components/ShadcnTabs.js';
|
|
121
|
-
export { default as ShadcnTextarea } from './components/ShadcnTextarea.js';
|
|
122
|
-
export { default as ShadcnToggle } from './components/ShadcnToggle.js';
|
|
123
|
-
export { default as ShadcnToggleGroup } from './components/ShadcnToggleGroup.js';
|
|
124
|
-
export { default as ShadcnTooltip } from './components/ShadcnTooltip.js';
|