@ttt-productions/ui-core 0.11.17 → 0.11.19
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/dist/react/components/consequence-dialog.d.ts.map +1 -1
- package/dist/react/components/consequence-dialog.js +7 -2
- package/dist/react/components/consequence-dialog.js.map +1 -1
- package/package.json +2 -4
- package/src/index.ts +0 -3
- package/src/lib/format-numbers.ts +0 -17
- package/src/lib/utils.ts +0 -9
- package/src/react/components/accordion.tsx +0 -53
- package/src/react/components/alert-dialog.tsx +0 -131
- package/src/react/components/alert.tsx +0 -59
- package/src/react/components/avatar.tsx +0 -51
- package/src/react/components/badge.tsx +0 -31
- package/src/react/components/button.tsx +0 -102
- package/src/react/components/card.tsx +0 -54
- package/src/react/components/checkbox.tsx +0 -28
- package/src/react/components/chunk-error-recovery.tsx +0 -57
- package/src/react/components/collapsible.tsx +0 -11
- package/src/react/components/consequence-dialog.tsx +0 -274
- package/src/react/components/date-picker.tsx +0 -567
- package/src/react/components/dialog.tsx +0 -114
- package/src/react/components/dropdown-menu.tsx +0 -200
- package/src/react/components/end-of-list-indicator.tsx +0 -27
- package/src/react/components/form.tsx +0 -174
- package/src/react/components/input.tsx +0 -23
- package/src/react/components/label.tsx +0 -21
- package/src/react/components/layout/screen-adaptive-view.tsx +0 -106
- package/src/react/components/list-pagination.tsx +0 -101
- package/src/react/components/menubar.tsx +0 -220
- package/src/react/components/popover.tsx +0 -31
- package/src/react/components/progress.tsx +0 -27
- package/src/react/components/radio-group.tsx +0 -36
- package/src/react/components/relative-time.tsx +0 -56
- package/src/react/components/scroll-area.tsx +0 -56
- package/src/react/components/scroll-to-top-button.tsx +0 -85
- package/src/react/components/search-dropdown.tsx +0 -233
- package/src/react/components/select.tsx +0 -165
- package/src/react/components/separator.tsx +0 -26
- package/src/react/components/sheet.tsx +0 -140
- package/src/react/components/skeleton.tsx +0 -16
- package/src/react/components/slider.tsx +0 -25
- package/src/react/components/spinner.tsx +0 -49
- package/src/react/components/switch.tsx +0 -41
- package/src/react/components/table.tsx +0 -121
- package/src/react/components/tabs.tsx +0 -59
- package/src/react/components/textarea.tsx +0 -22
- package/src/react/components/toast.tsx +0 -193
- package/src/react/components/toaster.tsx +0 -43
- package/src/react/components/tooltip.tsx +0 -28
- package/src/react/hooks/use-async-action.ts +0 -63
- package/src/react/hooks/use-cursor-page.ts +0 -139
- package/src/react/hooks/use-media-query.tsx +0 -26
- package/src/react/hooks/use-paged-list.ts +0 -106
- package/src/react/hooks/use-return-scroll.ts +0 -149
- package/src/react/hooks/use-toast.tsx +0 -176
- package/src/react/index.ts +0 -85
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useState, useRef, useEffect } from 'react';
|
|
4
|
-
import { Input } from './input.js';
|
|
5
|
-
import { Label } from './label.js';
|
|
6
|
-
import { X, Search } from 'lucide-react';
|
|
7
|
-
import { Spinner } from './spinner.js';
|
|
8
|
-
import { cn } from "../../lib/utils.js";
|
|
9
|
-
|
|
10
|
-
export interface SearchDropdownProps<T> {
|
|
11
|
-
/** Current search value */
|
|
12
|
-
value: string;
|
|
13
|
-
/** Called when search value changes */
|
|
14
|
-
onValueChange: (value: string) => void;
|
|
15
|
-
/** Search results array */
|
|
16
|
-
results: T[];
|
|
17
|
-
/** Loading state */
|
|
18
|
-
isLoading: boolean;
|
|
19
|
-
/** Error message */
|
|
20
|
-
error: string | null;
|
|
21
|
-
/** Called when a result is selected */
|
|
22
|
-
onSelect: (result: T) => void;
|
|
23
|
-
/** Called when search is cleared (after the value has been reset). Optional notification hook. */
|
|
24
|
-
onClear?: () => void;
|
|
25
|
-
/** Placeholder text */
|
|
26
|
-
placeholder?: string;
|
|
27
|
-
/** Label for the input */
|
|
28
|
-
label?: string;
|
|
29
|
-
/** Custom className */
|
|
30
|
-
className?: string;
|
|
31
|
-
/** Disabled state */
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
/** Icon to show in input (default: Search) */
|
|
34
|
-
icon?: React.ReactNode;
|
|
35
|
-
/** Minimum characters before showing results (default: 3) */
|
|
36
|
-
minChars?: number;
|
|
37
|
-
/** Message to show when no results found */
|
|
38
|
-
emptyMessage?: string;
|
|
39
|
-
/** Custom render function for each result */
|
|
40
|
-
renderResult: (result: T, index: number) => React.ReactNode;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Generic search dropdown component with debounced input and keyboard navigation.
|
|
45
|
-
* Supports any data type and custom rendering.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```tsx
|
|
49
|
-
* <SearchDropdown<User>
|
|
50
|
-
* value={searchValue}
|
|
51
|
-
* onValueChange={setSearchValue}
|
|
52
|
-
* results={users}
|
|
53
|
-
* isLoading={isLoading}
|
|
54
|
-
* error={error}
|
|
55
|
-
* onSelect={(user) => console.log(user)}
|
|
56
|
-
* onClear={() => setSearchValue('')}
|
|
57
|
-
* placeholder="Search users..."
|
|
58
|
-
* renderResult={(user) => (
|
|
59
|
-
* <div>{user.displayName}</div>
|
|
60
|
-
* )}
|
|
61
|
-
* />
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export function SearchDropdown<T>({
|
|
65
|
-
value,
|
|
66
|
-
onValueChange,
|
|
67
|
-
results,
|
|
68
|
-
isLoading,
|
|
69
|
-
error,
|
|
70
|
-
onSelect,
|
|
71
|
-
onClear,
|
|
72
|
-
placeholder = 'Search...',
|
|
73
|
-
label,
|
|
74
|
-
className,
|
|
75
|
-
disabled = false,
|
|
76
|
-
icon = <Search className="h-4 w-4" />,
|
|
77
|
-
minChars = 3,
|
|
78
|
-
emptyMessage = 'No results found',
|
|
79
|
-
renderResult,
|
|
80
|
-
}: SearchDropdownProps<T>) {
|
|
81
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
82
|
-
const [selectedIndex, setSelectedIndex] = useState(-1);
|
|
83
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
84
|
-
const inputRef = useRef<HTMLInputElement>(null);
|
|
85
|
-
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
88
|
-
if (containerRef.current && !containerRef.current.contains(event.target as Node)) {
|
|
89
|
-
setIsOpen(false);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
94
|
-
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
95
|
-
}, []);
|
|
96
|
-
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
if (value.length >= minChars && (results.length > 0 || isLoading || error)) {
|
|
99
|
-
setIsOpen(true);
|
|
100
|
-
} else {
|
|
101
|
-
setIsOpen(false);
|
|
102
|
-
}
|
|
103
|
-
}, [value, results, isLoading, error, minChars]);
|
|
104
|
-
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
setSelectedIndex(-1);
|
|
107
|
-
}, [results]);
|
|
108
|
-
|
|
109
|
-
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
110
|
-
if (!isOpen || results.length === 0) return;
|
|
111
|
-
|
|
112
|
-
switch (e.key) {
|
|
113
|
-
case 'ArrowDown':
|
|
114
|
-
e.preventDefault();
|
|
115
|
-
setSelectedIndex((prev) => (prev < results.length - 1 ? prev + 1 : prev));
|
|
116
|
-
break;
|
|
117
|
-
case 'ArrowUp':
|
|
118
|
-
e.preventDefault();
|
|
119
|
-
setSelectedIndex((prev) => (prev > 0 ? prev - 1 : 0));
|
|
120
|
-
break;
|
|
121
|
-
case 'Enter':
|
|
122
|
-
e.preventDefault();
|
|
123
|
-
if (selectedIndex >= 0 && selectedIndex < results.length) {
|
|
124
|
-
onSelect(results[selectedIndex]);
|
|
125
|
-
setIsOpen(false);
|
|
126
|
-
}
|
|
127
|
-
break;
|
|
128
|
-
case 'Escape':
|
|
129
|
-
e.preventDefault();
|
|
130
|
-
setIsOpen(false);
|
|
131
|
-
inputRef.current?.blur();
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const handleResultClick = (result: T) => {
|
|
137
|
-
onSelect(result);
|
|
138
|
-
setIsOpen(false);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const handleClear = () => {
|
|
142
|
-
onValueChange('');
|
|
143
|
-
onClear?.();
|
|
144
|
-
setIsOpen(false);
|
|
145
|
-
inputRef.current?.focus();
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const showDropdown = isOpen && value.length >= minChars;
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<div ref={containerRef} className={cn('relative', className)}>
|
|
152
|
-
{label && (
|
|
153
|
-
<Label htmlFor="search-input" className="mb-2 block">
|
|
154
|
-
{label}
|
|
155
|
-
</Label>
|
|
156
|
-
)}
|
|
157
|
-
|
|
158
|
-
<div className="relative">
|
|
159
|
-
<div className="absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground">
|
|
160
|
-
{icon}
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<Input
|
|
164
|
-
ref={inputRef}
|
|
165
|
-
id="search-input"
|
|
166
|
-
type="text"
|
|
167
|
-
value={value}
|
|
168
|
-
onChange={(e) => onValueChange(e.target.value)}
|
|
169
|
-
onKeyDown={handleKeyDown}
|
|
170
|
-
placeholder={placeholder}
|
|
171
|
-
disabled={disabled}
|
|
172
|
-
className="pl-10 pr-10"
|
|
173
|
-
/>
|
|
174
|
-
|
|
175
|
-
<div className="absolute right-3 top-1/2 -translate-y-1/2">
|
|
176
|
-
{isLoading ? (
|
|
177
|
-
<Spinner size="xs" className="text-muted-foreground" />
|
|
178
|
-
) : value ? (
|
|
179
|
-
<button
|
|
180
|
-
type="button"
|
|
181
|
-
onClick={handleClear}
|
|
182
|
-
className="text-muted-foreground hover:text-foreground transition-colors"
|
|
183
|
-
aria-label="Clear search"
|
|
184
|
-
>
|
|
185
|
-
<X className="h-4 w-4" />
|
|
186
|
-
</button>
|
|
187
|
-
) : null}
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
190
|
-
|
|
191
|
-
{showDropdown && (
|
|
192
|
-
<div className="absolute z-50 w-full mt-1 bg-popover border rounded-md elevation-raised max-h-60 overflow-auto">
|
|
193
|
-
{error ? (
|
|
194
|
-
<div className="px-3 py-2 text-sm text-destructive">
|
|
195
|
-
{error}
|
|
196
|
-
</div>
|
|
197
|
-
) : isLoading ? (
|
|
198
|
-
<div className="px-3 py-2 text-sm text-muted-foreground flex items-center gap-2">
|
|
199
|
-
<Spinner size="xs" />
|
|
200
|
-
Searching...
|
|
201
|
-
</div>
|
|
202
|
-
) : results.length === 0 ? (
|
|
203
|
-
<div className="px-3 py-2 text-sm text-muted-foreground">
|
|
204
|
-
{emptyMessage}
|
|
205
|
-
</div>
|
|
206
|
-
) : (
|
|
207
|
-
results.map((result, index) => (
|
|
208
|
-
<button
|
|
209
|
-
key={index}
|
|
210
|
-
type="button"
|
|
211
|
-
onClick={() => handleResultClick(result)}
|
|
212
|
-
onMouseEnter={() => setSelectedIndex(index)}
|
|
213
|
-
className={cn(
|
|
214
|
-
'w-full text-left transition-colors cursor-pointer',
|
|
215
|
-
'hover:bg-accent focus:bg-accent focus:outline-hidden',
|
|
216
|
-
selectedIndex === index && 'bg-accent'
|
|
217
|
-
)}
|
|
218
|
-
>
|
|
219
|
-
{renderResult(result, index)}
|
|
220
|
-
</button>
|
|
221
|
-
))
|
|
222
|
-
)}
|
|
223
|
-
</div>
|
|
224
|
-
)}
|
|
225
|
-
|
|
226
|
-
{value.length > 0 && value.length < minChars && (
|
|
227
|
-
<p className="text-xs text-muted-foreground mt-1">
|
|
228
|
-
Type at least {minChars} characters to search
|
|
229
|
-
</p>
|
|
230
|
-
)}
|
|
231
|
-
</div>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as SelectPrimitive from "@radix-ui/react-select"
|
|
5
|
-
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
|
6
|
-
|
|
7
|
-
import { cn } from "../../lib/utils.js"
|
|
8
|
-
import { Spinner } from "./spinner.js"
|
|
9
|
-
|
|
10
|
-
const Select = SelectPrimitive.Root
|
|
11
|
-
const SelectGroup = SelectPrimitive.Group
|
|
12
|
-
const SelectValue = SelectPrimitive.Value
|
|
13
|
-
|
|
14
|
-
const SelectTrigger = React.forwardRef<
|
|
15
|
-
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
16
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {
|
|
17
|
-
/**
|
|
18
|
-
* The change this select started is in flight: the trigger disables itself, sets
|
|
19
|
-
* `aria-busy`, and shows the spinner in place of its chevron. It keeps showing the
|
|
20
|
-
* COMMITTED value — the caller changes `value` only once the write lands.
|
|
21
|
-
*/
|
|
22
|
-
pending?: boolean
|
|
23
|
-
}
|
|
24
|
-
>(({ className, children, pending = false, disabled, ...props }, ref) => (
|
|
25
|
-
<SelectPrimitive.Trigger
|
|
26
|
-
ref={ref}
|
|
27
|
-
className={cn(
|
|
28
|
-
"flex h-10 w-full items-center justify-between rounded-md border-2 border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
29
|
-
className
|
|
30
|
-
)}
|
|
31
|
-
{...props}
|
|
32
|
-
{...(pending ? { "aria-busy": true, "data-pending": "" } : {})}
|
|
33
|
-
disabled={disabled || pending || undefined}
|
|
34
|
-
>
|
|
35
|
-
{children}
|
|
36
|
-
{pending ? (
|
|
37
|
-
<Spinner size="xs" />
|
|
38
|
-
) : (
|
|
39
|
-
<SelectPrimitive.Icon asChild>
|
|
40
|
-
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
41
|
-
</SelectPrimitive.Icon>
|
|
42
|
-
)}
|
|
43
|
-
</SelectPrimitive.Trigger>
|
|
44
|
-
))
|
|
45
|
-
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
|
46
|
-
|
|
47
|
-
const SelectScrollUpButton = React.forwardRef<
|
|
48
|
-
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
49
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
50
|
-
>(({ className, ...props }, ref) => (
|
|
51
|
-
<SelectPrimitive.ScrollUpButton
|
|
52
|
-
ref={ref}
|
|
53
|
-
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
54
|
-
{...props}
|
|
55
|
-
>
|
|
56
|
-
<ChevronUp className="h-4 w-4" />
|
|
57
|
-
</SelectPrimitive.ScrollUpButton>
|
|
58
|
-
))
|
|
59
|
-
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
|
60
|
-
|
|
61
|
-
const SelectScrollDownButton = React.forwardRef<
|
|
62
|
-
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
63
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
64
|
-
>(({ className, ...props }, ref) => (
|
|
65
|
-
<SelectPrimitive.ScrollDownButton
|
|
66
|
-
ref={ref}
|
|
67
|
-
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
68
|
-
{...props}
|
|
69
|
-
>
|
|
70
|
-
<ChevronDown className="h-4 w-4" />
|
|
71
|
-
</SelectPrimitive.ScrollDownButton>
|
|
72
|
-
))
|
|
73
|
-
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName
|
|
74
|
-
|
|
75
|
-
const SelectContent = React.forwardRef<
|
|
76
|
-
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
77
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
78
|
-
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
79
|
-
<SelectPrimitive.Portal>
|
|
80
|
-
<SelectPrimitive.Content
|
|
81
|
-
ref={ref}
|
|
82
|
-
className={cn(
|
|
83
|
-
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground elevation-popover data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
84
|
-
position === "popper" &&
|
|
85
|
-
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
86
|
-
className
|
|
87
|
-
)}
|
|
88
|
-
position={position}
|
|
89
|
-
{...props}
|
|
90
|
-
>
|
|
91
|
-
<SelectScrollUpButton />
|
|
92
|
-
<SelectPrimitive.Viewport
|
|
93
|
-
className={cn(
|
|
94
|
-
"p-1",
|
|
95
|
-
position === "popper" &&
|
|
96
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
97
|
-
)}
|
|
98
|
-
>
|
|
99
|
-
{children}
|
|
100
|
-
</SelectPrimitive.Viewport>
|
|
101
|
-
<SelectScrollDownButton />
|
|
102
|
-
</SelectPrimitive.Content>
|
|
103
|
-
</SelectPrimitive.Portal>
|
|
104
|
-
))
|
|
105
|
-
SelectContent.displayName = SelectPrimitive.Content.displayName
|
|
106
|
-
|
|
107
|
-
const SelectLabel = React.forwardRef<
|
|
108
|
-
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
109
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
110
|
-
>(({ className, ...props }, ref) => (
|
|
111
|
-
<SelectPrimitive.Label
|
|
112
|
-
ref={ref}
|
|
113
|
-
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
|
114
|
-
{...props}
|
|
115
|
-
/>
|
|
116
|
-
))
|
|
117
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
|
118
|
-
|
|
119
|
-
const SelectItem = React.forwardRef<
|
|
120
|
-
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
121
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
122
|
-
>(({ className, children, ...props }, ref) => (
|
|
123
|
-
<SelectPrimitive.Item
|
|
124
|
-
ref={ref}
|
|
125
|
-
className={cn(
|
|
126
|
-
"relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
127
|
-
className
|
|
128
|
-
)}
|
|
129
|
-
{...props}
|
|
130
|
-
>
|
|
131
|
-
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
132
|
-
<SelectPrimitive.ItemIndicator>
|
|
133
|
-
<Check className="h-4 w-4" />
|
|
134
|
-
</SelectPrimitive.ItemIndicator>
|
|
135
|
-
</span>
|
|
136
|
-
|
|
137
|
-
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
138
|
-
</SelectPrimitive.Item>
|
|
139
|
-
))
|
|
140
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName
|
|
141
|
-
|
|
142
|
-
const SelectSeparator = React.forwardRef<
|
|
143
|
-
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
144
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
145
|
-
>(({ className, ...props }, ref) => (
|
|
146
|
-
<SelectPrimitive.Separator
|
|
147
|
-
ref={ref}
|
|
148
|
-
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
149
|
-
{...props}
|
|
150
|
-
/>
|
|
151
|
-
))
|
|
152
|
-
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
|
153
|
-
|
|
154
|
-
export {
|
|
155
|
-
Select,
|
|
156
|
-
SelectGroup,
|
|
157
|
-
SelectValue,
|
|
158
|
-
SelectTrigger,
|
|
159
|
-
SelectContent,
|
|
160
|
-
SelectLabel,
|
|
161
|
-
SelectItem,
|
|
162
|
-
SelectSeparator,
|
|
163
|
-
SelectScrollUpButton,
|
|
164
|
-
SelectScrollDownButton,
|
|
165
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils.js"
|
|
7
|
-
|
|
8
|
-
const Separator = React.forwardRef<
|
|
9
|
-
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
10
|
-
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
11
|
-
>(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
12
|
-
<SeparatorPrimitive.Root
|
|
13
|
-
ref={ref}
|
|
14
|
-
decorative={decorative}
|
|
15
|
-
orientation={orientation}
|
|
16
|
-
className={cn(
|
|
17
|
-
"shrink-0 bg-border",
|
|
18
|
-
orientation === "horizontal" ? "h-[2px] w-full" : "h-full w-[1px]",
|
|
19
|
-
className
|
|
20
|
-
)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
))
|
|
24
|
-
Separator.displayName = SeparatorPrimitive.Root.displayName
|
|
25
|
-
|
|
26
|
-
export { Separator }
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as SheetPrimitive from "@radix-ui/react-dialog"
|
|
5
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
|
-
import { X } from "lucide-react"
|
|
7
|
-
|
|
8
|
-
import { cn } from "../../lib/utils.js"
|
|
9
|
-
|
|
10
|
-
const Sheet = SheetPrimitive.Root
|
|
11
|
-
|
|
12
|
-
const SheetTrigger = SheetPrimitive.Trigger
|
|
13
|
-
|
|
14
|
-
const SheetClose = SheetPrimitive.Close
|
|
15
|
-
|
|
16
|
-
const SheetPortal = SheetPrimitive.Portal
|
|
17
|
-
|
|
18
|
-
const SheetOverlay = React.forwardRef<
|
|
19
|
-
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
20
|
-
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
21
|
-
>(({ className, ...props }, ref) => (
|
|
22
|
-
<SheetPrimitive.Overlay
|
|
23
|
-
className={cn(
|
|
24
|
-
"fixed inset-0 z-50 bg-[color:var(--scrim)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
25
|
-
className
|
|
26
|
-
)}
|
|
27
|
-
{...props}
|
|
28
|
-
ref={ref}
|
|
29
|
-
/>
|
|
30
|
-
))
|
|
31
|
-
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
|
|
32
|
-
|
|
33
|
-
const sheetVariants = cva(
|
|
34
|
-
"fixed z-50 gap-4 bg-background p-6 elevation-raised transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
35
|
-
{
|
|
36
|
-
variants: {
|
|
37
|
-
side: {
|
|
38
|
-
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
39
|
-
bottom:
|
|
40
|
-
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
41
|
-
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
42
|
-
right:
|
|
43
|
-
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
defaultVariants: {
|
|
47
|
-
side: "right",
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
interface SheetContentProps
|
|
53
|
-
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
54
|
-
VariantProps<typeof sheetVariants> {}
|
|
55
|
-
|
|
56
|
-
const SheetContent = React.forwardRef<
|
|
57
|
-
React.ElementRef<typeof SheetPrimitive.Content>,
|
|
58
|
-
SheetContentProps
|
|
59
|
-
>(({ side = "right", className, children, ...props }, ref) => (
|
|
60
|
-
<SheetPortal>
|
|
61
|
-
<SheetOverlay />
|
|
62
|
-
<SheetPrimitive.Content
|
|
63
|
-
ref={ref}
|
|
64
|
-
className={cn(sheetVariants({ side }), className)}
|
|
65
|
-
{...props}
|
|
66
|
-
>
|
|
67
|
-
{children}
|
|
68
|
-
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
|
|
69
|
-
<X className="h-4 w-4" />
|
|
70
|
-
<span className="sr-only">Close</span>
|
|
71
|
-
</SheetPrimitive.Close>
|
|
72
|
-
</SheetPrimitive.Content>
|
|
73
|
-
</SheetPortal>
|
|
74
|
-
))
|
|
75
|
-
SheetContent.displayName = SheetPrimitive.Content.displayName
|
|
76
|
-
|
|
77
|
-
const SheetHeader = ({
|
|
78
|
-
className,
|
|
79
|
-
...props
|
|
80
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
81
|
-
<div
|
|
82
|
-
className={cn(
|
|
83
|
-
"flex flex-col space-y-2 text-center sm:text-left",
|
|
84
|
-
className
|
|
85
|
-
)}
|
|
86
|
-
{...props}
|
|
87
|
-
/>
|
|
88
|
-
)
|
|
89
|
-
SheetHeader.displayName = "SheetHeader"
|
|
90
|
-
|
|
91
|
-
const SheetFooter = ({
|
|
92
|
-
className,
|
|
93
|
-
...props
|
|
94
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
95
|
-
<div
|
|
96
|
-
className={cn(
|
|
97
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
98
|
-
className
|
|
99
|
-
)}
|
|
100
|
-
{...props}
|
|
101
|
-
/>
|
|
102
|
-
)
|
|
103
|
-
SheetFooter.displayName = "SheetFooter"
|
|
104
|
-
|
|
105
|
-
const SheetTitle = React.forwardRef<
|
|
106
|
-
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
107
|
-
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
108
|
-
>(({ className, ...props }, ref) => (
|
|
109
|
-
<SheetPrimitive.Title
|
|
110
|
-
ref={ref}
|
|
111
|
-
className={cn("text-lg font-semibold text-foreground break-words", className)}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
))
|
|
115
|
-
SheetTitle.displayName = SheetPrimitive.Title.displayName
|
|
116
|
-
|
|
117
|
-
const SheetDescription = React.forwardRef<
|
|
118
|
-
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
119
|
-
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
120
|
-
>(({ className, ...props }, ref) => (
|
|
121
|
-
<SheetPrimitive.Description
|
|
122
|
-
ref={ref}
|
|
123
|
-
className={cn("text-sm text-muted-foreground break-words", className)}
|
|
124
|
-
{...props}
|
|
125
|
-
/>
|
|
126
|
-
))
|
|
127
|
-
SheetDescription.displayName = SheetPrimitive.Description.displayName
|
|
128
|
-
|
|
129
|
-
export {
|
|
130
|
-
Sheet,
|
|
131
|
-
SheetPortal,
|
|
132
|
-
SheetOverlay,
|
|
133
|
-
SheetTrigger,
|
|
134
|
-
SheetClose,
|
|
135
|
-
SheetContent,
|
|
136
|
-
SheetHeader,
|
|
137
|
-
SheetFooter,
|
|
138
|
-
SheetTitle,
|
|
139
|
-
SheetDescription,
|
|
140
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { cn } from "../../lib/utils.js"
|
|
5
|
-
|
|
6
|
-
function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
|
7
|
-
return (
|
|
8
|
-
<div
|
|
9
|
-
className={cn("animate-pulse rounded-md bg-muted", className)}
|
|
10
|
-
data-ai-hint="loading placeholder"
|
|
11
|
-
{...props}
|
|
12
|
-
/>
|
|
13
|
-
)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { Skeleton }
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import * as SliderPrimitive from "@radix-ui/react-slider"
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils.js"
|
|
7
|
-
|
|
8
|
-
const Slider = React.forwardRef<
|
|
9
|
-
React.ElementRef<typeof SliderPrimitive.Root>,
|
|
10
|
-
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
|
|
11
|
-
>(({ className, ...props }, ref) => (
|
|
12
|
-
<SliderPrimitive.Root
|
|
13
|
-
ref={ref}
|
|
14
|
-
className={cn("relative flex w-full touch-none select-none items-center", className)}
|
|
15
|
-
{...props}
|
|
16
|
-
>
|
|
17
|
-
<SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
|
|
18
|
-
<SliderPrimitive.Range className="absolute h-full bg-primary" />
|
|
19
|
-
</SliderPrimitive.Track>
|
|
20
|
-
<SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
|
|
21
|
-
</SliderPrimitive.Root>
|
|
22
|
-
))
|
|
23
|
-
Slider.displayName = SliderPrimitive.Root.displayName
|
|
24
|
-
|
|
25
|
-
export { Slider }
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { Loader2 } from "lucide-react"
|
|
4
|
-
|
|
5
|
-
import { cn } from "../../lib/utils.js"
|
|
6
|
-
|
|
7
|
-
export type SpinnerSize = "xs" | "sm" | "md" | "lg" | "xl"
|
|
8
|
-
|
|
9
|
-
export interface SpinnerProps {
|
|
10
|
-
/** Maps onto the theme-core `spinner-*` classes. Defaults to `xs` (the in-control size). */
|
|
11
|
-
size?: SpinnerSize
|
|
12
|
-
/**
|
|
13
|
-
* Screen-reader text. When set, the spinner becomes a `status` live region that
|
|
14
|
-
* announces it. Omit it for a spinner inside a control that already carries its
|
|
15
|
-
* own busy state (`aria-busy`) — the control speaks for it.
|
|
16
|
-
*/
|
|
17
|
-
label?: string
|
|
18
|
-
className?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const SIZE_CLASS: Record<SpinnerSize, string> = {
|
|
22
|
-
xs: "spinner-xs",
|
|
23
|
-
sm: "spinner-sm",
|
|
24
|
-
md: "spinner-md",
|
|
25
|
-
lg: "spinner-lg",
|
|
26
|
-
xl: "spinner-xl",
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The ONE loading spinner. Every in-progress indicator renders through this
|
|
31
|
-
* component (or through a control's `pending` prop, which renders it), so the
|
|
32
|
-
* spinner's look, size scale, and color rule have one change point. The
|
|
33
|
-
* theme-core `spinner-*` classes own size, animation, and color — including the
|
|
34
|
-
* `button .spinner-*` rule that makes an in-button spinner inherit the button's
|
|
35
|
-
* text color so it is never primary-on-primary.
|
|
36
|
-
*/
|
|
37
|
-
function Spinner({ size = "xs", label, className }: SpinnerProps) {
|
|
38
|
-
if (!label) {
|
|
39
|
-
return <Loader2 className={cn(SIZE_CLASS[size], className)} aria-hidden="true" />
|
|
40
|
-
}
|
|
41
|
-
return (
|
|
42
|
-
<span role="status" className={cn("inline-flex items-center justify-center", className)}>
|
|
43
|
-
<Loader2 className={SIZE_CLASS[size]} aria-hidden="true" />
|
|
44
|
-
<span className="sr-only">{label}</span>
|
|
45
|
-
</span>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { Spinner }
|