@nikala-ui/core 0.9.9 → 0.9.10-nightly.f842585
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/package.json +2 -2
- package/registry/accordion.json +1 -1
- package/registry/avatar.json +1 -1
- package/registry/badge.json +1 -1
- package/registry/button.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/combobox.json +18 -0
- package/registry/command.json +1 -1
- package/registry/dialog.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/hover-card.json +18 -0
- package/registry/index.json +53 -0
- package/registry/input-group.json +1 -1
- package/registry/input.json +1 -1
- package/registry/list.json +1 -1
- package/registry/logo.json +17 -0
- package/registry/pin-input.json +17 -0
- package/registry/popover.json +1 -1
- package/registry/progress.json +1 -1
- package/registry/select.json +1 -1
- package/registry/skeleton.json +1 -1
- package/registry/slider.json +18 -0
- package/registry/switch.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/textarea.json +1 -1
- package/registry/theme-manager.json +1 -1
- package/registry/toast.json +1 -1
- package/src/registry/components/ui/accordion.tsx +0 -4
- package/src/registry/components/ui/avatar.tsx +1 -1
- package/src/registry/components/ui/badge.tsx +6 -0
- package/src/registry/components/ui/button.tsx +6 -2
- package/src/registry/components/ui/checkbox.tsx +1 -1
- package/src/registry/components/ui/combobox.tsx +295 -0
- package/src/registry/components/ui/command.tsx +15 -15
- package/src/registry/components/ui/dialog.tsx +3 -3
- package/src/registry/components/ui/dropdown-menu.tsx +5 -5
- package/src/registry/components/ui/hover-card.tsx +105 -0
- package/src/registry/components/ui/input-group.tsx +2 -2
- package/src/registry/components/ui/input.tsx +1 -1
- package/src/registry/components/ui/list.tsx +5 -5
- package/src/registry/components/ui/logo.tsx +68 -0
- package/src/registry/components/ui/pin-input.tsx +198 -0
- package/src/registry/components/ui/popover.tsx +1 -1
- package/src/registry/components/ui/progress.tsx +2 -2
- package/src/registry/components/ui/select.tsx +2 -2
- package/src/registry/components/ui/skeleton.tsx +1 -1
- package/src/registry/components/ui/slider.tsx +153 -0
- package/src/registry/components/ui/switch.tsx +2 -2
- package/src/registry/components/ui/tabs.tsx +1 -1
- package/src/registry/components/ui/textarea.tsx +1 -1
- package/src/registry/components/ui/theme-toggle.tsx +1 -1
- package/src/registry/components/ui/toast.tsx +1 -1
- package/src/registry/metadata.ts +20 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { splitProps, type JSX, type ValidComponent } from "solid-js";
|
|
2
|
+
import * as ComboboxPrimitive from "@kobalte/core/combobox";
|
|
3
|
+
import { cn } from "@/lib/cn";
|
|
4
|
+
|
|
5
|
+
export type ComboboxRootProps<Option = any, OptGroup = any, T extends ValidComponent = "div"> =
|
|
6
|
+
ComboboxPrimitive.ComboboxRootProps<Option, OptGroup, T> & {
|
|
7
|
+
class?: string;
|
|
8
|
+
children?: JSX.Element;
|
|
9
|
+
triggerMode?: "input" | "focus" | "both" | "manual";
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Root Combobox component providing search, single/multi-selection, and group support.
|
|
14
|
+
* `triggerMode="focus"` or `triggerMode="both"` enables opening dropdown on input click/focus.
|
|
15
|
+
*/
|
|
16
|
+
export const Combobox = <Option = any, OptGroup = any, T extends ValidComponent = "div">(
|
|
17
|
+
props: ComboboxRootProps<Option, OptGroup, T>
|
|
18
|
+
) => {
|
|
19
|
+
const [local, rest] = splitProps(props as ComboboxRootProps, ["class", "children", "triggerMode"]);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<ComboboxPrimitive.Root
|
|
23
|
+
triggerMode={local.triggerMode ?? "input"}
|
|
24
|
+
class={cn("relative w-full", local.class)}
|
|
25
|
+
{...(rest as any)}
|
|
26
|
+
>
|
|
27
|
+
{local.children}
|
|
28
|
+
</ComboboxPrimitive.Root>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type ComboboxControlProps<Option = any, T extends ValidComponent = "div"> =
|
|
33
|
+
ComboboxPrimitive.ComboboxControlProps<Option, T> & {
|
|
34
|
+
class?: string;
|
|
35
|
+
children?: JSX.Element;
|
|
36
|
+
clearable?: boolean;
|
|
37
|
+
onClear?: () => void;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Input container for Combobox supporting search input, selected tags, and clear button.
|
|
42
|
+
*/
|
|
43
|
+
export const ComboboxControl = <Option = any, T extends ValidComponent = "div">(
|
|
44
|
+
props: ComboboxControlProps<Option, T>
|
|
45
|
+
) => {
|
|
46
|
+
const [local, rest] = splitProps(props as ComboboxControlProps, [
|
|
47
|
+
"class",
|
|
48
|
+
"children",
|
|
49
|
+
"clearable",
|
|
50
|
+
"onClear",
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<ComboboxPrimitive.Control
|
|
55
|
+
class={cn(
|
|
56
|
+
"flex min-h-9 w-full flex-wrap items-center justify-between rounded-md border border-input bg-muted px-3 py-1 text-sm shadow-sm transition-colors focus-within:ring-1 focus-within:ring-primary focus-within:border-primary disabled:cursor-not-allowed disabled:opacity-50 gap-1.5 text-foreground",
|
|
57
|
+
local.class
|
|
58
|
+
)}
|
|
59
|
+
{...(rest as any)}
|
|
60
|
+
>
|
|
61
|
+
<div class="flex flex-wrap items-center gap-1.5 flex-1 min-w-0">
|
|
62
|
+
{local.children}
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="flex items-center gap-1 shrink-0 self-center">
|
|
66
|
+
{local.clearable && (
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
tabIndex={-1}
|
|
70
|
+
onClick={(e) => {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
if (local.onClear) local.onClear();
|
|
73
|
+
}}
|
|
74
|
+
class="rounded-sm p-0.5 opacity-60 hover:opacity-100 hover:bg-accent text-foreground transition-opacity focus:outline-none cursor-pointer"
|
|
75
|
+
aria-label="Clear selection"
|
|
76
|
+
>
|
|
77
|
+
<svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
78
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
79
|
+
</svg>
|
|
80
|
+
</button>
|
|
81
|
+
)}
|
|
82
|
+
<ComboboxTrigger />
|
|
83
|
+
</div>
|
|
84
|
+
</ComboboxPrimitive.Control>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export type ComboboxInputProps<T extends ValidComponent = "input"> =
|
|
89
|
+
ComboboxPrimitive.ComboboxInputProps<T> & {
|
|
90
|
+
class?: string;
|
|
91
|
+
openOnFocus?: boolean;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Search input field embedded within ComboboxControl.
|
|
96
|
+
* Supports `openOnFocus` to automatically trigger the dropdown when focused or clicked.
|
|
97
|
+
*/
|
|
98
|
+
export const ComboboxInput = <T extends ValidComponent = "input">(
|
|
99
|
+
props: ComboboxInputProps<T>
|
|
100
|
+
) => {
|
|
101
|
+
const [local, rest] = splitProps(props as ComboboxInputProps, ["class", "openOnFocus", "onFocus", "onClick"]);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<ComboboxPrimitive.Input
|
|
105
|
+
class={cn(
|
|
106
|
+
"flex-1 bg-transparent py-1 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed text-foreground min-w-16",
|
|
107
|
+
local.class
|
|
108
|
+
)}
|
|
109
|
+
onFocus={(e: FocusEvent) => {
|
|
110
|
+
if (typeof local.onFocus === "function") local.onFocus(e as any);
|
|
111
|
+
}}
|
|
112
|
+
onClick={(e: MouseEvent) => {
|
|
113
|
+
if (typeof local.onClick === "function") local.onClick(e as any);
|
|
114
|
+
}}
|
|
115
|
+
{...(rest as any)}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export type ComboboxTriggerProps<T extends ValidComponent = "button"> =
|
|
121
|
+
ComboboxPrimitive.ComboboxTriggerProps<T> & {
|
|
122
|
+
class?: string;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Dropdown chevron trigger icon.
|
|
127
|
+
*/
|
|
128
|
+
export const ComboboxTrigger = <T extends ValidComponent = "button">(
|
|
129
|
+
props: ComboboxTriggerProps<T>
|
|
130
|
+
) => {
|
|
131
|
+
const [local, rest] = splitProps(props as ComboboxTriggerProps, ["class"]);
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<ComboboxPrimitive.Trigger
|
|
135
|
+
class={cn(
|
|
136
|
+
"flex h-4 w-4 items-center justify-center opacity-50 hover:opacity-100 transition-opacity focus:outline-none cursor-pointer",
|
|
137
|
+
local.class
|
|
138
|
+
)}
|
|
139
|
+
{...(rest as any)}
|
|
140
|
+
>
|
|
141
|
+
<ComboboxPrimitive.Icon
|
|
142
|
+
as="svg"
|
|
143
|
+
class="h-4 w-4 stroke-current stroke-2 fill-none"
|
|
144
|
+
viewBox="0 0 24 24"
|
|
145
|
+
>
|
|
146
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />
|
|
147
|
+
</ComboboxPrimitive.Icon>
|
|
148
|
+
</ComboboxPrimitive.Trigger>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export type ComboboxTokenProps<Option = any> = {
|
|
153
|
+
class?: string;
|
|
154
|
+
children?: JSX.Element;
|
|
155
|
+
item?: Option;
|
|
156
|
+
onRemove?: () => void;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Selected item tag token pill rendered in multi-select mode.
|
|
161
|
+
*/
|
|
162
|
+
export const ComboboxToken = <Option = any>(props: ComboboxTokenProps<Option>) => {
|
|
163
|
+
const [local, rest] = splitProps(props, ["class", "children", "onRemove"]);
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<span
|
|
167
|
+
class={cn(
|
|
168
|
+
"inline-flex items-center gap-1.5 rounded-md bg-accent px-2 py-0.5 text-xs font-medium text-accent-foreground border border-border shadow-2xs animate-in fade-in-50",
|
|
169
|
+
local.class
|
|
170
|
+
)}
|
|
171
|
+
{...rest}
|
|
172
|
+
>
|
|
173
|
+
<span class="truncate">{local.children}</span>
|
|
174
|
+
<button
|
|
175
|
+
type="button"
|
|
176
|
+
tabIndex={-1}
|
|
177
|
+
onClick={(e) => {
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
if (local.onRemove) local.onRemove();
|
|
180
|
+
}}
|
|
181
|
+
class="rounded-xs p-0.5 hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground transition-colors focus:outline-none cursor-pointer"
|
|
182
|
+
aria-label="Remove tag"
|
|
183
|
+
>
|
|
184
|
+
<svg class="h-3 w-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
185
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
186
|
+
</svg>
|
|
187
|
+
</button>
|
|
188
|
+
</span>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export type ComboboxContentProps<T extends ValidComponent = "div"> =
|
|
193
|
+
ComboboxPrimitive.ComboboxContentProps<T> & {
|
|
194
|
+
class?: string;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Portaled popover content listbox container.
|
|
199
|
+
*/
|
|
200
|
+
export const ComboboxContent = <T extends ValidComponent = "div">(
|
|
201
|
+
props: ComboboxContentProps<T>
|
|
202
|
+
) => {
|
|
203
|
+
const [local, rest] = splitProps(props as ComboboxContentProps, ["class"]);
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<ComboboxPrimitive.Portal>
|
|
207
|
+
<ComboboxPrimitive.Content
|
|
208
|
+
class={cn(
|
|
209
|
+
"relative z-50 min-w-8rem overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md animate-in fade-in-80 data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95",
|
|
210
|
+
local.class
|
|
211
|
+
)}
|
|
212
|
+
{...(rest as any)}
|
|
213
|
+
>
|
|
214
|
+
<ComboboxPrimitive.Listbox class="max-h-60 overflow-y-auto p-1 outline-none" />
|
|
215
|
+
</ComboboxPrimitive.Content>
|
|
216
|
+
</ComboboxPrimitive.Portal>
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export type ComboboxItemProps<T extends ValidComponent = "li"> =
|
|
221
|
+
ComboboxPrimitive.ComboboxItemProps<T> & {
|
|
222
|
+
class?: string;
|
|
223
|
+
children?: JSX.Element;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Individual option item inside listbox supporting custom avatars, icons, and titles.
|
|
228
|
+
*/
|
|
229
|
+
export const ComboboxItem = <T extends ValidComponent = "li">(
|
|
230
|
+
props: ComboboxItemProps<T>
|
|
231
|
+
) => {
|
|
232
|
+
const [local, rest] = splitProps(props as ComboboxItemProps, ["class", "children"]);
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<ComboboxPrimitive.Item
|
|
236
|
+
class={cn(
|
|
237
|
+
"relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-accent data-highlighted:text-accent-foreground text-popover-foreground transition-colors",
|
|
238
|
+
local.class
|
|
239
|
+
)}
|
|
240
|
+
{...rest}
|
|
241
|
+
>
|
|
242
|
+
<ComboboxPrimitive.ItemIndicator class="absolute left-2 flex h-4 w-4 items-center justify-center text-primary">
|
|
243
|
+
<svg class="h-4 w-4 fill-none stroke-current stroke-2" viewBox="0 0 24 24">
|
|
244
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
|
|
245
|
+
</svg>
|
|
246
|
+
</ComboboxPrimitive.ItemIndicator>
|
|
247
|
+
<ComboboxPrimitive.ItemLabel class="flex items-center gap-2 w-full truncate">
|
|
248
|
+
{local.children}
|
|
249
|
+
</ComboboxPrimitive.ItemLabel>
|
|
250
|
+
</ComboboxPrimitive.Item>
|
|
251
|
+
);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export type ComboboxGroupProps<T extends ValidComponent = "li"> =
|
|
255
|
+
ComboboxPrimitive.ComboboxSectionProps<T> & {
|
|
256
|
+
class?: string;
|
|
257
|
+
children?: JSX.Element;
|
|
258
|
+
label?: JSX.Element;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Group container for organizing related options.
|
|
263
|
+
*/
|
|
264
|
+
export const ComboboxGroup = <T extends ValidComponent = "li">(
|
|
265
|
+
props: ComboboxGroupProps<T>
|
|
266
|
+
) => {
|
|
267
|
+
const [local, rest] = splitProps(props as ComboboxGroupProps, ["class", "children", "label"]);
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<ComboboxPrimitive.Section class={cn("px-1 py-1", local.class)} {...(rest as any)}>
|
|
271
|
+
{local.label && (
|
|
272
|
+
<span class="px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider block">
|
|
273
|
+
{local.label}
|
|
274
|
+
</span>
|
|
275
|
+
)}
|
|
276
|
+
{local.children}
|
|
277
|
+
</ComboboxPrimitive.Section>
|
|
278
|
+
);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Empty state notice when no matching search items exist.
|
|
283
|
+
*/
|
|
284
|
+
export const ComboboxEmpty = (props: { class?: string; children?: JSX.Element }) => {
|
|
285
|
+
return (
|
|
286
|
+
<div class={cn("py-6 text-center text-sm text-muted-foreground", props.class)}>
|
|
287
|
+
{props.children || "No matching items found."}
|
|
288
|
+
</div>
|
|
289
|
+
);
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Hidden native select element for form integrations.
|
|
294
|
+
*/
|
|
295
|
+
export const ComboboxHiddenSelect = ComboboxPrimitive.HiddenSelect;
|
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
createContext,
|
|
3
3
|
useContext,
|
|
4
4
|
createSignal,
|
|
5
|
-
onMount,
|
|
6
5
|
onCleanup,
|
|
7
6
|
Show,
|
|
8
7
|
splitProps,
|
|
@@ -10,6 +9,7 @@ import {
|
|
|
10
9
|
type JSX,
|
|
11
10
|
type Accessor,
|
|
12
11
|
} from "solid-js";
|
|
12
|
+
import { createKeybindings } from "@nikala-ui/hooks";
|
|
13
13
|
import { Dialog } from "@kobalte/core/dialog";
|
|
14
14
|
import { Search, ArrowUp, ArrowDown, CornerDownLeft } from "lucide-solid";
|
|
15
15
|
import { cn } from "@/lib/cn";
|
|
@@ -76,25 +76,25 @@ export const CommandDialog: Component<CommandDialogProps> = (props) => {
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
/* Listen for global Ctrl+K / Cmd+K hotkeys */
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
createKeybindings(
|
|
80
|
+
[
|
|
81
|
+
{
|
|
82
|
+
key: ["meta+k", "ctrl+k"],
|
|
83
|
+
handler: () => setOpen(!isOpen()),
|
|
84
|
+
preventDefault: true,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
{
|
|
88
|
+
enabled: () => props.enableHotkey !== false,
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
);
|
|
91
91
|
|
|
92
92
|
return (
|
|
93
93
|
<Dialog open={isOpen()} onOpenChange={setOpen}>
|
|
94
94
|
<Dialog.Portal>
|
|
95
|
-
<Dialog.Overlay class="fixed inset-0 z-50 bg-black/60 backdrop-blur-xs data-
|
|
95
|
+
<Dialog.Overlay class="fixed inset-0 z-50 bg-black/60 backdrop-blur-xs data-expanded:animate-in data-closed:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0" />
|
|
96
96
|
<div class="fixed inset-0 z-50 flex items-start justify-center pt-16 sm:pt-24 px-4">
|
|
97
|
-
<Dialog.Content class="w-full max-w-xl rounded-lg border border-border bg-popover text-popover-foreground shadow-2xl outline-none data-
|
|
97
|
+
<Dialog.Content class="w-full max-w-xl rounded-lg border border-border bg-popover text-popover-foreground shadow-2xl outline-none data-expanded:animate-in data-closed:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-closed:zoom-out-95 data-expanded:zoom-in-95">
|
|
98
98
|
<Command class={props.class}>{props.children}</Command>
|
|
99
99
|
</Dialog.Content>
|
|
100
100
|
</div>
|
|
@@ -145,7 +145,7 @@ export const CommandList: Component<CommandListProps> = (props) => {
|
|
|
145
145
|
|
|
146
146
|
return (
|
|
147
147
|
<div
|
|
148
|
-
class={cn("max-h-
|
|
148
|
+
class={cn("max-h-82.5 overflow-y-auto p-1.5 scrollbar-thin", local.class)}
|
|
149
149
|
{...rest}
|
|
150
150
|
>
|
|
151
151
|
<List>{local.children}</List>
|
|
@@ -32,7 +32,7 @@ export const DialogOverlay = <T extends ValidComponent = "div">(
|
|
|
32
32
|
return (
|
|
33
33
|
<DialogPrimitive.Overlay
|
|
34
34
|
class={cn(
|
|
35
|
-
"fixed inset-0 z-50 bg-black/80 data-
|
|
35
|
+
"fixed inset-0 z-50 bg-black/80 data-expanded:animate-in data-closed:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0",
|
|
36
36
|
local.blur !== false && "backdrop-blur-sm",
|
|
37
37
|
local.class
|
|
38
38
|
)}
|
|
@@ -95,14 +95,14 @@ export const DialogContent = <T extends ValidComponent = "div">(
|
|
|
95
95
|
onPointerDownOutside={handlePointerDownOutside}
|
|
96
96
|
onInteractOutside={handleInteractOutside}
|
|
97
97
|
class={cn(
|
|
98
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-
|
|
98
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-popover p-6 shadow-lg duration-200 data-expanded:animate-in data-closed:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-closed:zoom-out-95 data-expanded:zoom-in-95 data-[closed]:slide-out-to-left-1/2 data-[closed]:slide-out-to-top-[48%] data-[expanded]:slide-in-from-left-1/2 data-[expanded]:slide-in-from-top-[48%] sm:rounded-lg text-card-foreground",
|
|
99
99
|
local.class
|
|
100
100
|
)}
|
|
101
101
|
{...(rest as any)}
|
|
102
102
|
>
|
|
103
103
|
{local.children}
|
|
104
104
|
<Show when={local.showCloseButton !== false}>
|
|
105
|
-
<DialogPrimitive.CloseButton class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-
|
|
105
|
+
<DialogPrimitive.CloseButton class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-expanded:bg-accent data-expanded:text-muted-foreground cursor-pointer">
|
|
106
106
|
<svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
107
107
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
108
108
|
</svg>
|
|
@@ -75,7 +75,7 @@ export const DropdownMenuSubContent = <T extends ValidComponent = "div">(
|
|
|
75
75
|
<DropdownMenuPrimitive.Portal>
|
|
76
76
|
<DropdownMenuPrimitive.SubContent
|
|
77
77
|
class={cn(
|
|
78
|
-
"z-50 min-w-
|
|
78
|
+
"z-50 min-w-32 overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-lg data-expanded:animate-in data-closed:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0",
|
|
79
79
|
local.class
|
|
80
80
|
)}
|
|
81
81
|
{...(rest as any)}
|
|
@@ -112,7 +112,7 @@ export const DropdownMenuContent = <T extends ValidComponent = "div">(
|
|
|
112
112
|
if (typeof (props as any).ref === "function") (props as any).ref(el);
|
|
113
113
|
}}
|
|
114
114
|
class={cn(
|
|
115
|
-
"z-50 min-w-
|
|
115
|
+
"z-50 min-w-32 mt-1 overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md data-expanded:animate-in data-closed:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0",
|
|
116
116
|
local.class
|
|
117
117
|
)}
|
|
118
118
|
{...(rest as any)}
|
|
@@ -140,7 +140,7 @@ export const DropdownMenuItem = <T extends ValidComponent = "div">(
|
|
|
140
140
|
return (
|
|
141
141
|
<DropdownMenuPrimitive.Item
|
|
142
142
|
class={cn(
|
|
143
|
-
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-
|
|
143
|
+
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
144
144
|
local.inset && "pl-8",
|
|
145
145
|
local.variant === "destructive" &&
|
|
146
146
|
"text-destructive focus:bg-destructive/15 focus:text-destructive",
|
|
@@ -165,7 +165,7 @@ export const DropdownMenuCheckboxItem = <T extends ValidComponent = "div">(
|
|
|
165
165
|
return (
|
|
166
166
|
<DropdownMenuPrimitive.CheckboxItem
|
|
167
167
|
class={cn(
|
|
168
|
-
"relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-
|
|
168
|
+
"relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
169
169
|
local.class
|
|
170
170
|
)}
|
|
171
171
|
{...(rest as any)}
|
|
@@ -196,7 +196,7 @@ export const DropdownMenuRadioItem = <T extends ValidComponent = "div">(
|
|
|
196
196
|
return (
|
|
197
197
|
<DropdownMenuPrimitive.RadioItem
|
|
198
198
|
class={cn(
|
|
199
|
-
"relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-
|
|
199
|
+
"relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
200
200
|
local.class
|
|
201
201
|
)}
|
|
202
202
|
{...(rest as any)}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { splitProps, type JSX, type ValidComponent } from "solid-js";
|
|
2
|
+
import * as HoverCardPrimitive from "@kobalte/core/hover-card";
|
|
3
|
+
import { cn } from "@/lib/cn";
|
|
4
|
+
|
|
5
|
+
export type HoverCardProps = HoverCardPrimitive.HoverCardRootProps;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Root HoverCard component built on Kobalte primitives.
|
|
9
|
+
* Controls hover open/close delays (default: 200ms / 150ms).
|
|
10
|
+
*/
|
|
11
|
+
export const HoverCard = (props: HoverCardProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<HoverCardPrimitive.Root
|
|
14
|
+
openDelay={200}
|
|
15
|
+
closeDelay={150}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type HoverCardTriggerProps<T extends ValidComponent = "a"> =
|
|
22
|
+
HoverCardPrimitive.HoverCardTriggerProps<T> &
|
|
23
|
+
JSX.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
24
|
+
class?: string;
|
|
25
|
+
children?: JSX.Element;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* HoverCard trigger handle (link, avatar, or text).
|
|
30
|
+
*/
|
|
31
|
+
export const HoverCardTrigger = <T extends ValidComponent = "a">(
|
|
32
|
+
props: HoverCardTriggerProps<T>
|
|
33
|
+
) => {
|
|
34
|
+
const [local, rest] = splitProps(props as HoverCardTriggerProps, [
|
|
35
|
+
"class",
|
|
36
|
+
"children",
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<HoverCardPrimitive.Trigger
|
|
41
|
+
class={cn(
|
|
42
|
+
"inline-flex items-center text-sm font-medium text-foreground underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",
|
|
43
|
+
local.class
|
|
44
|
+
)}
|
|
45
|
+
{...(rest as any)}
|
|
46
|
+
>
|
|
47
|
+
{local.children}
|
|
48
|
+
</HoverCardPrimitive.Trigger>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type HoverCardContentProps<T extends ValidComponent = "div"> =
|
|
53
|
+
HoverCardPrimitive.HoverCardContentProps<T> & {
|
|
54
|
+
class?: string;
|
|
55
|
+
children?: JSX.Element;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Floating card preview container rendered in a portal layer.
|
|
60
|
+
* Includes offset spacing from trigger and support for optional HoverCardArrow.
|
|
61
|
+
*/
|
|
62
|
+
export const HoverCardContent = <T extends ValidComponent = "div">(
|
|
63
|
+
props: HoverCardContentProps<T>
|
|
64
|
+
) => {
|
|
65
|
+
const [local, rest] = splitProps(props as HoverCardContentProps, [
|
|
66
|
+
"class",
|
|
67
|
+
"children",
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<HoverCardPrimitive.Portal>
|
|
72
|
+
<HoverCardPrimitive.Content
|
|
73
|
+
sideOffset={8}
|
|
74
|
+
class={cn(
|
|
75
|
+
"z-50 w-80 rounded-lg border border-border bg-popover p-4 text-popover-foreground shadow-xl outline-none transition-all data-expanded:animate-in data-closed:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-closed:zoom-out-95 data-expanded: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",
|
|
76
|
+
local.class
|
|
77
|
+
)}
|
|
78
|
+
{...(rest as any)}
|
|
79
|
+
>
|
|
80
|
+
{local.children}
|
|
81
|
+
</HoverCardPrimitive.Content>
|
|
82
|
+
</HoverCardPrimitive.Portal>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type HoverCardArrowProps<T extends ValidComponent = "div"> =
|
|
87
|
+
HoverCardPrimitive.HoverCardArrowProps<T> & {
|
|
88
|
+
class?: string;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Optional arrow pointer pointing to the trigger.
|
|
93
|
+
*/
|
|
94
|
+
export const HoverCardArrow = <T extends ValidComponent = "div">(
|
|
95
|
+
props: HoverCardArrowProps<T>
|
|
96
|
+
) => {
|
|
97
|
+
const [local, rest] = splitProps(props as HoverCardArrowProps, ["class"]);
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<HoverCardPrimitive.Arrow
|
|
101
|
+
class={cn("fill-popover stroke-border stroke-1", local.class)}
|
|
102
|
+
{...(rest as any)}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
@@ -14,7 +14,7 @@ export const InputGroup: Component<InputGroupProps> = (props) => {
|
|
|
14
14
|
return (
|
|
15
15
|
<div
|
|
16
16
|
class={cn(
|
|
17
|
-
"relative flex w-full items-center rounded-md border border-input bg-
|
|
17
|
+
"relative flex w-full items-center rounded-md border border-input bg-muted text-sm shadow-2xs transition-colors focus-within:border-primary focus-within:ring-1 focus-within:ring-primary",
|
|
18
18
|
local.class
|
|
19
19
|
)}
|
|
20
20
|
{...rest}
|
|
@@ -71,7 +71,7 @@ export const InputGroupInput: Component<InputGroupInputProps> = (props) => {
|
|
|
71
71
|
return (
|
|
72
72
|
<input
|
|
73
73
|
class={cn(
|
|
74
|
-
"flex h-9 w-full flex-1 border-0
|
|
74
|
+
"flex h-9 w-full flex-1 border-0 px-2.5 py-1 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
75
75
|
local.class
|
|
76
76
|
)}
|
|
77
77
|
{...rest}
|
|
@@ -19,7 +19,7 @@ export const Input: Component<InputProps> = (props) => {
|
|
|
19
19
|
<input
|
|
20
20
|
type={local.type || "text"}
|
|
21
21
|
class={cn(
|
|
22
|
-
"flex h-9 w-full rounded-md border border-input bg-
|
|
22
|
+
"flex h-9 w-full rounded-md border border-input bg-muted px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
23
23
|
local.class
|
|
24
24
|
)}
|
|
25
25
|
{...rest}
|
|
@@ -32,7 +32,7 @@ export interface ListGroupProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
|
32
32
|
export const ListGroup: Component<ListGroupProps> = (props) => {
|
|
33
33
|
const [local, rest] = splitProps(props, ["class", "children"]);
|
|
34
34
|
return (
|
|
35
|
-
<div class={cn("flex flex-col gap-1 w-full
|
|
35
|
+
<div class={cn("flex flex-col gap-1 w-full", local.class)} {...rest}>
|
|
36
36
|
{local.children}
|
|
37
37
|
</div>
|
|
38
38
|
);
|
|
@@ -137,12 +137,12 @@ export const ListItem: Component<ListItemProps> = (props) => {
|
|
|
137
137
|
<img
|
|
138
138
|
src={local.avatar}
|
|
139
139
|
alt={local.title || "Avatar"}
|
|
140
|
-
class="w-
|
|
140
|
+
class="w-10 h-10 rounded-lg object-cover shrink-0 border border-border"
|
|
141
141
|
/>
|
|
142
142
|
</Show>
|
|
143
143
|
|
|
144
144
|
<Show when={!local.avatar && local.avatarFallback}>
|
|
145
|
-
<span class="w-
|
|
145
|
+
<span class="w-10 h-10 rounded-lg bg-primary/10 text-primary text-[10px] font-bold flex items-center justify-center shrink-0 uppercase">
|
|
146
146
|
{local.avatarFallback}
|
|
147
147
|
</span>
|
|
148
148
|
</Show>
|
|
@@ -161,7 +161,7 @@ export const ListItem: Component<ListItemProps> = (props) => {
|
|
|
161
161
|
</span>
|
|
162
162
|
</Show>
|
|
163
163
|
<Show when={local.subtitle}>
|
|
164
|
-
<span class="truncate text-xs
|
|
164
|
+
<span class="truncate text-xs opacity-50 font-normal mt-1">
|
|
165
165
|
{local.subtitle}
|
|
166
166
|
</span>
|
|
167
167
|
</Show>
|
|
@@ -178,7 +178,7 @@ export const ListItem: Component<ListItemProps> = (props) => {
|
|
|
178
178
|
</Show>
|
|
179
179
|
|
|
180
180
|
<Show when={local.showChevron}>
|
|
181
|
-
<ChevronRight class="w-4 h-4 text-muted-foreground
|
|
181
|
+
<ChevronRight class="w-4 h-4 text-muted-foreground transition-colors" />
|
|
182
182
|
</Show>
|
|
183
183
|
</div>
|
|
184
184
|
</>
|