@surreal-ui/react 0.8.1 → 0.9.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.
- 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,74 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cn, cva, type VariantProps } from '@surreal-ui/core';
|
|
3
|
-
|
|
4
|
-
export const shadcnToggleVariants = cva(
|
|
5
|
-
"gap-1 rounded-lg text-sm font-medium transition-all hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 group/toggle inline-flex items-center justify-center whitespace-nowrap outline-none hover:bg-muted focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
6
|
-
{
|
|
7
|
-
variants: {
|
|
8
|
-
variant: {
|
|
9
|
-
default: 'bg-transparent',
|
|
10
|
-
outline: 'border border-input bg-transparent hover:bg-muted'
|
|
11
|
-
},
|
|
12
|
-
size: {
|
|
13
|
-
default:
|
|
14
|
-
'h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
15
|
-
sm: "h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
16
|
-
lg: 'h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2'
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
defaultVariants: {
|
|
20
|
-
variant: 'default',
|
|
21
|
-
size: 'default'
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export interface ShadcnToggleProps
|
|
27
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof toggleVariants> {
|
|
28
|
-
pressed?: boolean;
|
|
29
|
-
defaultPressed?: boolean;
|
|
30
|
-
onPressedChange?: (pressed: boolean) => void;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const ShadcnToggle = React.forwardRef<HTMLButtonElement, ToggleProps>(
|
|
34
|
-
(
|
|
35
|
-
{
|
|
36
|
-
className,
|
|
37
|
-
variant,
|
|
38
|
-
size,
|
|
39
|
-
pressed: controlledPressed,
|
|
40
|
-
defaultPressed = false,
|
|
41
|
-
onPressedChange,
|
|
42
|
-
onClick,
|
|
43
|
-
...props
|
|
44
|
-
},
|
|
45
|
-
ref
|
|
46
|
-
) => {
|
|
47
|
-
const [uncontrolledPressed, setUncontrolledPressed] = React.useState(defaultPressed);
|
|
48
|
-
const isPressed = controlledPressed !== undefined ? controlledPressed : uncontrolledPressed;
|
|
49
|
-
|
|
50
|
-
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
51
|
-
if (controlledPressed === undefined) {
|
|
52
|
-
setUncontrolledPressed(!uncontrolledPressed);
|
|
53
|
-
}
|
|
54
|
-
onPressedChange?.(!isPressed);
|
|
55
|
-
onClick?.(e);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<button
|
|
60
|
-
ref={ref}
|
|
61
|
-
type="button"
|
|
62
|
-
aria-pressed={isPressed}
|
|
63
|
-
data-state={isPressed ? 'on' : 'off'}
|
|
64
|
-
data-slot="toggle"
|
|
65
|
-
className={cn(shadcnToggleVariants({ variant, size, className }))}
|
|
66
|
-
onClick={handleClick}
|
|
67
|
-
{...props}
|
|
68
|
-
/>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
Toggle.displayName = 'Toggle';
|
|
73
|
-
|
|
74
|
-
export default MinimalistToggle;
|
|
@@ -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 MinimalistToggleGroup;
|
|
@@ -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 MinimalistTooltip;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sparkles } from 'lucide-react';
|
|
3
|
-
|
|
4
|
-
interface ModernTypographyProps {
|
|
5
|
-
badgeText?: string;
|
|
6
|
-
title?: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
highlightText?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const ModernTypography: React.FC<ModernTypographyProps> = ({
|
|
12
|
-
badgeText = 'AI Multi-Platform Synthesizer Studio',
|
|
13
|
-
title = 'Ingest & Generate Component',
|
|
14
|
-
description = "Paste your raw component code in any framework. Surreal UI's engine will synthesize React, Svelte, and WebComponent variants, extract prop docs, and tag aesthetics automatically.",
|
|
15
|
-
highlightText = '@pixerate/ai-core'
|
|
16
|
-
}) => {
|
|
17
|
-
return (
|
|
18
|
-
<div className="space-y-2">
|
|
19
|
-
<div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-pink-500/10 border border-pink-500/30 text-pink-300 text-xs font-semibold">
|
|
20
|
-
<Sparkles className="w-3.5 h-3.5" />
|
|
21
|
-
<span>{badgeText}</span>
|
|
22
|
-
</div>
|
|
23
|
-
<h1 className="text-3xl font-extrabold text-white tracking-tight">{title}</h1>
|
|
24
|
-
<p className="text-slate-400 text-sm">
|
|
25
|
-
{description.split(highlightText)[0]}
|
|
26
|
-
<strong className="text-slate-200">{highlightText}</strong>
|
|
27
|
-
{description.split(highlightText)[1]}
|
|
28
|
-
</p>
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default MinimalistTypography;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sparkles, AlertTriangle, ShieldCheck, ArrowRight } from 'lucide-react';
|
|
3
|
-
interface NeubrutalismCardProps {
|
|
4
|
-
loading?: boolean;
|
|
5
|
-
errorMsg?: string;
|
|
6
|
-
onLogin?: () => void;
|
|
7
|
-
}
|
|
8
|
-
export const NeubrutalismCard: React.FC<NeubrutalismCardProps> = ({
|
|
9
|
-
loading = false,
|
|
10
|
-
errorMsg = '',
|
|
11
|
-
onLogin = () => {}
|
|
12
|
-
}) => {
|
|
13
|
-
return (
|
|
14
|
-
<div className="min-h-screen bg-slate-950 text-slate-100 flex items-center justify-center p-4 relative overflow-hidden">
|
|
15
|
-
<div className="absolute -top-40 -left-40 w-96 h-96 bg-indigo-600/20 rounded-full blur-3xl pointer-events-none" />
|
|
16
|
-
<div className="absolute -bottom-40 -right-40 w-96 h-96 bg-purple-600/20 rounded-full blur-3xl pointer-events-none" />
|
|
17
|
-
<div className="w-full max-w-md bg-slate-900 border-4 border-black shadow-[8px_8px_0px_0px_rgba(0,0,0,1)] p-8 rounded-none space-y-6 relative z-10">
|
|
18
|
-
<div className="text-center space-y-3">
|
|
19
|
-
<div className="inline-flex p-3 rounded-none border-2 border-black bg-indigo-400 text-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)]">
|
|
20
|
-
<Sparkles className="w-8 h-8" />
|
|
21
|
-
</div>
|
|
22
|
-
<div>
|
|
23
|
-
<h1 className="text-3xl font-extrabold text-black tracking-tight bg-yellow-300 px-2 py-1 inline-block border-2 border-black">
|
|
24
|
-
Surreal UI
|
|
25
|
-
</h1>
|
|
26
|
-
<p className="text-xs uppercase font-mono tracking-widest text-slate-300 mt-2">
|
|
27
|
-
Component Repository Portal
|
|
28
|
-
</p>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
{errorMsg && (
|
|
32
|
-
<div className="flex items-start gap-3 p-4 bg-red-400 border-2 border-black text-black text-xs font-bold shadow-[4px_4px_0px_0px_rgba(0,0,0,1)]">
|
|
33
|
-
<AlertTriangle className="w-5 h-5 text-black shrink-0 mt-0.5" />
|
|
34
|
-
<div>
|
|
35
|
-
<strong className="font-black block">Authentication Failed</strong>
|
|
36
|
-
<span>{errorMsg}</span>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
)}
|
|
40
|
-
<div className="flex items-center gap-2.5 p-3 rounded-none bg-yellow-400 border-2 border-black text-black text-xs font-bold shadow-[4px_4px_0px_0px_rgba(0,0,0,1)]">
|
|
41
|
-
<ShieldCheck className="w-4 h-4 text-black shrink-0" />
|
|
42
|
-
<span>Access is restricted to authorized accounts only.</span>
|
|
43
|
-
</div>
|
|
44
|
-
<button
|
|
45
|
-
onClick={onLogin}
|
|
46
|
-
disabled={loading}
|
|
47
|
-
className="w-full py-3.5 px-4 bg-green-400 hover:bg-green-500 text-black font-black border-2 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] active:translate-x-1 active:translate-y-1 active:shadow-none flex items-center justify-center gap-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed group"
|
|
48
|
-
>
|
|
49
|
-
{loading ? (
|
|
50
|
-
<>
|
|
51
|
-
<span className="w-5 h-5 border-2 border-black border-t-transparent rounded-full animate-spin" />
|
|
52
|
-
<span>Authenticating...</span>
|
|
53
|
-
</>
|
|
54
|
-
) : (
|
|
55
|
-
<>
|
|
56
|
-
<svg className="w-5 h-5 fill-current" viewBox="0 0 24 24">
|
|
57
|
-
<path
|
|
58
|
-
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
59
|
-
fill="#000"
|
|
60
|
-
/>
|
|
61
|
-
<path
|
|
62
|
-
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
63
|
-
fill="#000"
|
|
64
|
-
/>
|
|
65
|
-
<path
|
|
66
|
-
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.06H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.94l2.85-2.22.81-.63z"
|
|
67
|
-
fill="#000"
|
|
68
|
-
/>
|
|
69
|
-
<path
|
|
70
|
-
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84c.87-2.6 3.3-4.52 6.16-4.52z"
|
|
71
|
-
fill="#000"
|
|
72
|
-
/>
|
|
73
|
-
</svg>
|
|
74
|
-
<span>Sign In with Google</span>
|
|
75
|
-
<ArrowRight className="w-4 h-4 group-hover:translate-x-1 transition-transform" />
|
|
76
|
-
</>
|
|
77
|
-
)}
|
|
78
|
-
</button>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default NeubrutalismCard;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sparkles, Boxes, Cpu, Zap } from 'lucide-react';
|
|
3
|
-
interface NeubrutalismItemProps {
|
|
4
|
-
componentCount?: number;
|
|
5
|
-
}
|
|
6
|
-
export const NeubrutalismItem: React.FC<NeubrutalismItemProps> = ({ componentCount = 0 }) => {
|
|
7
|
-
return (
|
|
8
|
-
<section className="relative overflow-hidden rounded-3xl bg-gradient-to-br from-indigo-950/60 via-slate-900/90 to-purple-950/60 border-4 border-black p-8 sm:p-12 shadow-[8px_8px_0px_0px_rgba(0,0,0,1)]">
|
|
9
|
-
<div className="absolute -right-20 -top-20 w-80 h-80 bg-indigo-500/10 rounded-full blur-3xl pointer-events-none"></div>
|
|
10
|
-
<div className="max-w-3xl space-y-4 relative z-10">
|
|
11
|
-
<div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-indigo-500/10 border-2 border-black text-indigo-300 text-xs font-extrabold shadow-[2px_2px_0px_0px_rgba(0,0,0,1)]">
|
|
12
|
-
<Sparkles className="w-3.5 h-3.5" />
|
|
13
|
-
<span>Single Source of Truth for Cross-Platform UI</span>
|
|
14
|
-
</div>
|
|
15
|
-
<h1 className="text-4xl sm:text-5xl font-black tracking-tight text-white leading-tight">
|
|
16
|
-
Discover, Convert & Reuse <br />
|
|
17
|
-
<span className="text-indigo-400">Surreal UI Components</span>
|
|
18
|
-
</h1>
|
|
19
|
-
<p className="text-slate-300 text-base sm:text-lg font-medium leading-relaxed">
|
|
20
|
-
Ingest UI components once and automatically synthesize production-ready implementations
|
|
21
|
-
for
|
|
22
|
-
<strong className="text-white font-bold">React</strong>,
|
|
23
|
-
<strong className="text-white font-bold">Svelte</strong>, and
|
|
24
|
-
<strong className="text-white font-bold">WebComponents</strong> with built-in version
|
|
25
|
-
control and AI transformation.
|
|
26
|
-
</p>
|
|
27
|
-
<div className="pt-4 flex flex-wrap items-center gap-6 text-sm text-slate-200 font-semibold">
|
|
28
|
-
<div className="flex items-center gap-2 bg-black/40 px-3 py-1.5 rounded-lg border-2 border-black">
|
|
29
|
-
<Boxes className="w-4 h-4 text-indigo-400" />
|
|
30
|
-
<span>
|
|
31
|
-
<strong className="text-white font-black">{componentCount}</strong> Components
|
|
32
|
-
</span>
|
|
33
|
-
</div>
|
|
34
|
-
<div className="flex items-center gap-2 bg-black/40 px-3 py-1.5 rounded-lg border-2 border-black">
|
|
35
|
-
<Cpu className="w-4 h-4 text-purple-400" />
|
|
36
|
-
<span>AI Multi-Platform Engine</span>
|
|
37
|
-
</div>
|
|
38
|
-
<div className="flex items-center gap-2 bg-black/40 px-3 py-1.5 rounded-lg border-2 border-black">
|
|
39
|
-
<Zap className="w-4 h-4 text-emerald-400" />
|
|
40
|
-
<span>MCP Server Connected</span>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</section>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default NeubrutalismItem;
|