@alepha/ui 0.25.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/README.md +12 -0
- package/components.json +20 -0
- package/package.json +85 -0
- package/src/components/action-error-toaster/action-error-toaster.tsx +70 -0
- package/src/components/admin/admin-audits.tsx +247 -0
- package/src/components/admin/admin-files.tsx +346 -0
- package/src/components/admin/admin-jobs-executions-panel.tsx +235 -0
- package/src/components/admin/admin-jobs-status-badge.tsx +33 -0
- package/src/components/admin/admin-jobs.tsx +294 -0
- package/src/components/admin/admin-keys.tsx +162 -0
- package/src/components/admin/admin-notifications.tsx +130 -0
- package/src/components/admin/admin-page.tsx +24 -0
- package/src/components/admin/admin-parameters.tsx +864 -0
- package/src/components/admin/admin-payments.tsx +93 -0
- package/src/components/admin/admin-sessions.tsx +174 -0
- package/src/components/admin/admin-user-detail-audits-tab.tsx +82 -0
- package/src/components/admin/admin-user-detail-identity-aside.tsx +218 -0
- package/src/components/admin/admin-user-detail-overview-tab.tsx +87 -0
- package/src/components/admin/admin-user-detail-password-dialog.tsx +85 -0
- package/src/components/admin/admin-user-detail-password-schema.ts +11 -0
- package/src/components/admin/admin-user-detail-profile-schema.ts +19 -0
- package/src/components/admin/admin-user-detail-provider-labels.ts +15 -0
- package/src/components/admin/admin-user-detail-security-tab.tsx +146 -0
- package/src/components/admin/admin-user-detail-sessions-tab.tsx +93 -0
- package/src/components/admin/admin-user-detail.tsx +606 -0
- package/src/components/admin/admin-users-roles-picker.tsx +126 -0
- package/src/components/admin/admin-users-status-filter.tsx +51 -0
- package/src/components/admin/admin-users.tsx +518 -0
- package/src/components/admin/diff-lines.spec.ts +58 -0
- package/src/components/admin/diff-lines.ts +58 -0
- package/src/components/admin/parameter-diff-dialog.tsx +119 -0
- package/src/components/admin/parameter-history-item.tsx +252 -0
- package/src/components/admin/parameter-json-dialog.tsx +93 -0
- package/src/components/admin/parameter-save-dialog.tsx +126 -0
- package/src/components/admin/use-confirmed-action.tsx +93 -0
- package/src/components/alepha-table/__tests__/use-table-selection.browser.spec.tsx +92 -0
- package/src/components/alepha-table/alepha-table.tsx +1158 -0
- package/src/components/alepha-table/use-table-selection.ts +95 -0
- package/src/components/app-shell/app-shell.tsx +568 -0
- package/src/components/auth/__tests__/auth-router.spec.ts +52 -0
- package/src/components/auth/auth-login.tsx +382 -0
- package/src/components/auth/auth-register.tsx +786 -0
- package/src/components/auth/auth-reset-password.tsx +349 -0
- package/src/components/auth/auth-router.tsx +126 -0
- package/src/components/auth/auth-verify-email.tsx +179 -0
- package/src/components/auto-form/auto-form.tsx +867 -0
- package/src/components/brand-icon/brand-icon.tsx +104 -0
- package/src/components/button-dark/button-dark.tsx +78 -0
- package/src/components/button-language/button-language.tsx +98 -0
- package/src/components/button-theme/button-theme.tsx +148 -0
- package/src/components/button-user/button-user.tsx +214 -0
- package/src/components/captcha/turnstile-widget.tsx +157 -0
- package/src/components/control/control.tsx +735 -0
- package/src/components/control-array/control-array.tsx +700 -0
- package/src/components/control-base/__tests__/form-field-a11y.browser.spec.tsx +93 -0
- package/src/components/control-base/field-i18n.ts +60 -0
- package/src/components/control-base/form-field.tsx +275 -0
- package/src/components/control-base/grid.tsx +59 -0
- package/src/components/control-base/icon-hint.tsx +64 -0
- package/src/components/control-date/control-date.tsx +190 -0
- package/src/components/control-number/control-number.tsx +136 -0
- package/src/components/control-object/control-object.tsx +200 -0
- package/src/components/control-select/control-select.tsx +774 -0
- package/src/components/control-upload/control-upload.tsx +475 -0
- package/src/components/file-image/file-image.tsx +52 -0
- package/src/components/language-toggle/language-toggle.tsx +66 -0
- package/src/components/markdown-view/markdown-view.css +114 -0
- package/src/components/markdown-view/markdown-view.tsx +92 -0
- package/src/components/nav-shell/nav-page.tsx +56 -0
- package/src/components/nav-shell/nav-shell.tsx +72 -0
- package/src/components/nav-shell/nav-tree-util.ts +62 -0
- package/src/components/nav-shell/spotlight.tsx +163 -0
- package/src/components/nav-shell/use-nav-breadcrumbs.ts +52 -0
- package/src/components/nav-shell/use-nav-entries.ts +101 -0
- package/src/components/nav-shell/use-nav-tree.ts +61 -0
- package/src/components/ui/accordion.tsx +77 -0
- package/src/components/ui/alert-dialog.tsx +186 -0
- package/src/components/ui/alert.tsx +75 -0
- package/src/components/ui/aspect-ratio.tsx +22 -0
- package/src/components/ui/avatar.tsx +106 -0
- package/src/components/ui/badge.tsx +51 -0
- package/src/components/ui/breadcrumb.tsx +121 -0
- package/src/components/ui/button-group.tsx +86 -0
- package/src/components/ui/button.tsx +83 -0
- package/src/components/ui/calendar.tsx +235 -0
- package/src/components/ui/card.tsx +102 -0
- package/src/components/ui/carousel.tsx +241 -0
- package/src/components/ui/chart.tsx +370 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +19 -0
- package/src/components/ui/combobox.tsx +298 -0
- package/src/components/ui/command.tsx +196 -0
- package/src/components/ui/context-menu.tsx +271 -0
- package/src/components/ui/dialog.tsx +153 -0
- package/src/components/ui/direction.tsx +4 -0
- package/src/components/ui/drawer.tsx +130 -0
- package/src/components/ui/dropdown-menu.tsx +269 -0
- package/src/components/ui/empty.tsx +100 -0
- package/src/components/ui/hover-card.tsx +50 -0
- package/src/components/ui/input-group.tsx +157 -0
- package/src/components/ui/input-otp.tsx +83 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/item.tsx +200 -0
- package/src/components/ui/kbd.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/menubar.tsx +283 -0
- package/src/components/ui/navigation-menu.tsx +170 -0
- package/src/components/ui/pagination.tsx +133 -0
- package/src/components/ui/popover.tsx +87 -0
- package/src/components/ui/progress.tsx +82 -0
- package/src/components/ui/radio-group.tsx +35 -0
- package/src/components/ui/resizable.tsx +49 -0
- package/src/components/ui/scroll-area.tsx +51 -0
- package/src/components/ui/segmented.tsx +232 -0
- package/src/components/ui/select.tsx +201 -0
- package/src/components/ui/separator.tsx +22 -0
- package/src/components/ui/sheet.tsx +133 -0
- package/src/components/ui/sidebar.tsx +723 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +51 -0
- package/src/components/ui/sonner.tsx +46 -0
- package/src/components/ui/spinner.tsx +15 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/table.tsx +115 -0
- package/src/components/ui/tabs.tsx +79 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/components/ui/toggle-group.tsx +86 -0
- package/src/components/ui/toggle.tsx +44 -0
- package/src/components/ui/tooltip.tsx +63 -0
- package/src/components/use-dialog/use-dialog.tsx +244 -0
- package/src/components/use-toast/use-toast.tsx +89 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/lib/__tests__/i18n-fr.spec.ts +72 -0
- package/src/lib/i18n-fr.ts +500 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles.css +129 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { Button } from "@alepha/ui/components/ui/button";
|
|
2
|
+
import {
|
|
3
|
+
InputGroup,
|
|
4
|
+
InputGroupAddon,
|
|
5
|
+
InputGroupButton,
|
|
6
|
+
InputGroupInput,
|
|
7
|
+
} from "@alepha/ui/components/ui/input-group";
|
|
8
|
+
|
|
9
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
10
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
11
|
+
import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
|
|
14
|
+
const Combobox = ComboboxPrimitive.Root;
|
|
15
|
+
|
|
16
|
+
function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
|
|
17
|
+
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ComboboxTrigger({
|
|
21
|
+
className,
|
|
22
|
+
children,
|
|
23
|
+
...props
|
|
24
|
+
}: ComboboxPrimitive.Trigger.Props) {
|
|
25
|
+
return (
|
|
26
|
+
<ComboboxPrimitive.Trigger
|
|
27
|
+
data-slot="combobox-trigger"
|
|
28
|
+
className={cn("[&_svg:not([class*='size-'])]:size-4", className)}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
33
|
+
</ComboboxPrimitive.Trigger>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
38
|
+
return (
|
|
39
|
+
<ComboboxPrimitive.Clear
|
|
40
|
+
data-slot="combobox-clear"
|
|
41
|
+
render={<InputGroupButton variant="ghost" size="icon-xs" />}
|
|
42
|
+
className={cn(className)}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
<XIcon className="pointer-events-none" />
|
|
46
|
+
</ComboboxPrimitive.Clear>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function ComboboxInput({
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
disabled = false,
|
|
54
|
+
showTrigger = true,
|
|
55
|
+
showClear = false,
|
|
56
|
+
...props
|
|
57
|
+
}: ComboboxPrimitive.Input.Props & {
|
|
58
|
+
showTrigger?: boolean;
|
|
59
|
+
showClear?: boolean;
|
|
60
|
+
}) {
|
|
61
|
+
return (
|
|
62
|
+
<InputGroup className={cn("w-auto", className)}>
|
|
63
|
+
<ComboboxPrimitive.Input
|
|
64
|
+
render={<InputGroupInput disabled={disabled} />}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
<InputGroupAddon align="inline-end">
|
|
68
|
+
{showTrigger && (
|
|
69
|
+
<InputGroupButton
|
|
70
|
+
size="icon-xs"
|
|
71
|
+
variant="ghost"
|
|
72
|
+
render={<ComboboxTrigger />}
|
|
73
|
+
data-slot="input-group-button"
|
|
74
|
+
className="group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent"
|
|
75
|
+
disabled={disabled}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
78
|
+
{showClear && <ComboboxClear disabled={disabled} />}
|
|
79
|
+
</InputGroupAddon>
|
|
80
|
+
{children}
|
|
81
|
+
</InputGroup>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function ComboboxContent({
|
|
86
|
+
className,
|
|
87
|
+
side = "bottom",
|
|
88
|
+
sideOffset = 6,
|
|
89
|
+
align = "start",
|
|
90
|
+
alignOffset = 0,
|
|
91
|
+
anchor,
|
|
92
|
+
...props
|
|
93
|
+
}: ComboboxPrimitive.Popup.Props &
|
|
94
|
+
Pick<
|
|
95
|
+
ComboboxPrimitive.Positioner.Props,
|
|
96
|
+
"side" | "align" | "sideOffset" | "alignOffset" | "anchor"
|
|
97
|
+
>) {
|
|
98
|
+
return (
|
|
99
|
+
<ComboboxPrimitive.Portal>
|
|
100
|
+
<ComboboxPrimitive.Positioner
|
|
101
|
+
side={side}
|
|
102
|
+
sideOffset={sideOffset}
|
|
103
|
+
align={align}
|
|
104
|
+
alignOffset={alignOffset}
|
|
105
|
+
anchor={anchor}
|
|
106
|
+
className="isolate z-50"
|
|
107
|
+
>
|
|
108
|
+
<ComboboxPrimitive.Popup
|
|
109
|
+
data-slot="combobox-content"
|
|
110
|
+
data-chips={!!anchor}
|
|
111
|
+
className={cn(
|
|
112
|
+
"group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none 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",
|
|
113
|
+
className,
|
|
114
|
+
)}
|
|
115
|
+
{...props}
|
|
116
|
+
/>
|
|
117
|
+
</ComboboxPrimitive.Positioner>
|
|
118
|
+
</ComboboxPrimitive.Portal>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
123
|
+
return (
|
|
124
|
+
<ComboboxPrimitive.List
|
|
125
|
+
data-slot="combobox-list"
|
|
126
|
+
className={cn(
|
|
127
|
+
"no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0",
|
|
128
|
+
className,
|
|
129
|
+
)}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function ComboboxItem({
|
|
136
|
+
className,
|
|
137
|
+
children,
|
|
138
|
+
...props
|
|
139
|
+
}: ComboboxPrimitive.Item.Props) {
|
|
140
|
+
return (
|
|
141
|
+
<ComboboxPrimitive.Item
|
|
142
|
+
data-slot="combobox-item"
|
|
143
|
+
className={cn(
|
|
144
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
145
|
+
className,
|
|
146
|
+
)}
|
|
147
|
+
{...props}
|
|
148
|
+
>
|
|
149
|
+
{children}
|
|
150
|
+
<ComboboxPrimitive.ItemIndicator
|
|
151
|
+
render={
|
|
152
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
<CheckIcon className="pointer-events-none" />
|
|
156
|
+
</ComboboxPrimitive.ItemIndicator>
|
|
157
|
+
</ComboboxPrimitive.Item>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
|
|
162
|
+
return (
|
|
163
|
+
<ComboboxPrimitive.Group
|
|
164
|
+
data-slot="combobox-group"
|
|
165
|
+
className={cn(className)}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function ComboboxLabel({
|
|
172
|
+
className,
|
|
173
|
+
...props
|
|
174
|
+
}: ComboboxPrimitive.GroupLabel.Props) {
|
|
175
|
+
return (
|
|
176
|
+
<ComboboxPrimitive.GroupLabel
|
|
177
|
+
data-slot="combobox-label"
|
|
178
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
179
|
+
{...props}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {
|
|
185
|
+
return (
|
|
186
|
+
<ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
191
|
+
return (
|
|
192
|
+
<ComboboxPrimitive.Empty
|
|
193
|
+
data-slot="combobox-empty"
|
|
194
|
+
className={cn(
|
|
195
|
+
"hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",
|
|
196
|
+
className,
|
|
197
|
+
)}
|
|
198
|
+
{...props}
|
|
199
|
+
/>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function ComboboxSeparator({
|
|
204
|
+
className,
|
|
205
|
+
...props
|
|
206
|
+
}: ComboboxPrimitive.Separator.Props) {
|
|
207
|
+
return (
|
|
208
|
+
<ComboboxPrimitive.Separator
|
|
209
|
+
data-slot="combobox-separator"
|
|
210
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
211
|
+
{...props}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function ComboboxChips({
|
|
217
|
+
className,
|
|
218
|
+
...props
|
|
219
|
+
}: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> &
|
|
220
|
+
ComboboxPrimitive.Chips.Props) {
|
|
221
|
+
return (
|
|
222
|
+
<ComboboxPrimitive.Chips
|
|
223
|
+
data-slot="combobox-chips"
|
|
224
|
+
className={cn(
|
|
225
|
+
"flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40",
|
|
226
|
+
className,
|
|
227
|
+
)}
|
|
228
|
+
{...props}
|
|
229
|
+
/>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function ComboboxChip({
|
|
234
|
+
className,
|
|
235
|
+
children,
|
|
236
|
+
showRemove = true,
|
|
237
|
+
...props
|
|
238
|
+
}: ComboboxPrimitive.Chip.Props & {
|
|
239
|
+
showRemove?: boolean;
|
|
240
|
+
}) {
|
|
241
|
+
return (
|
|
242
|
+
<ComboboxPrimitive.Chip
|
|
243
|
+
data-slot="combobox-chip"
|
|
244
|
+
className={cn(
|
|
245
|
+
"flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0",
|
|
246
|
+
className,
|
|
247
|
+
)}
|
|
248
|
+
{...props}
|
|
249
|
+
>
|
|
250
|
+
{children}
|
|
251
|
+
{showRemove && (
|
|
252
|
+
<ComboboxPrimitive.ChipRemove
|
|
253
|
+
render={<Button variant="ghost" size="icon-xs" />}
|
|
254
|
+
className="-ml-1 opacity-50 hover:opacity-100"
|
|
255
|
+
data-slot="combobox-chip-remove"
|
|
256
|
+
>
|
|
257
|
+
<XIcon className="pointer-events-none" />
|
|
258
|
+
</ComboboxPrimitive.ChipRemove>
|
|
259
|
+
)}
|
|
260
|
+
</ComboboxPrimitive.Chip>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function ComboboxChipsInput({
|
|
265
|
+
className,
|
|
266
|
+
...props
|
|
267
|
+
}: ComboboxPrimitive.Input.Props) {
|
|
268
|
+
return (
|
|
269
|
+
<ComboboxPrimitive.Input
|
|
270
|
+
data-slot="combobox-chip-input"
|
|
271
|
+
className={cn("min-w-16 flex-1 outline-none", className)}
|
|
272
|
+
{...props}
|
|
273
|
+
/>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function useComboboxAnchor() {
|
|
278
|
+
return React.useRef<HTMLDivElement | null>(null);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export {
|
|
282
|
+
Combobox,
|
|
283
|
+
ComboboxChip,
|
|
284
|
+
ComboboxChips,
|
|
285
|
+
ComboboxChipsInput,
|
|
286
|
+
ComboboxCollection,
|
|
287
|
+
ComboboxContent,
|
|
288
|
+
ComboboxEmpty,
|
|
289
|
+
ComboboxGroup,
|
|
290
|
+
ComboboxInput,
|
|
291
|
+
ComboboxItem,
|
|
292
|
+
ComboboxLabel,
|
|
293
|
+
ComboboxList,
|
|
294
|
+
ComboboxSeparator,
|
|
295
|
+
ComboboxTrigger,
|
|
296
|
+
ComboboxValue,
|
|
297
|
+
useComboboxAnchor,
|
|
298
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogDescription,
|
|
7
|
+
DialogHeader,
|
|
8
|
+
DialogTitle,
|
|
9
|
+
} from "@alepha/ui/components/ui/dialog";
|
|
10
|
+
import {
|
|
11
|
+
InputGroup,
|
|
12
|
+
InputGroupAddon,
|
|
13
|
+
} from "@alepha/ui/components/ui/input-group";
|
|
14
|
+
|
|
15
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
16
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
17
|
+
import { CheckIcon, SearchIcon } from "lucide-react";
|
|
18
|
+
import type * as React from "react";
|
|
19
|
+
|
|
20
|
+
function Command({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
24
|
+
return (
|
|
25
|
+
<CommandPrimitive
|
|
26
|
+
data-slot="command"
|
|
27
|
+
className={cn(
|
|
28
|
+
"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function CommandDialog({
|
|
37
|
+
title = "Command Palette",
|
|
38
|
+
description = "Search for a command to run...",
|
|
39
|
+
children,
|
|
40
|
+
className,
|
|
41
|
+
showCloseButton = false,
|
|
42
|
+
...props
|
|
43
|
+
}: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
|
|
44
|
+
title?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
className?: string;
|
|
47
|
+
showCloseButton?: boolean;
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
}) {
|
|
50
|
+
return (
|
|
51
|
+
<Dialog {...props}>
|
|
52
|
+
<DialogHeader className="sr-only">
|
|
53
|
+
<DialogTitle>{title}</DialogTitle>
|
|
54
|
+
<DialogDescription>{description}</DialogDescription>
|
|
55
|
+
</DialogHeader>
|
|
56
|
+
<DialogContent
|
|
57
|
+
className={cn(
|
|
58
|
+
"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
|
|
59
|
+
className,
|
|
60
|
+
)}
|
|
61
|
+
showCloseButton={showCloseButton}
|
|
62
|
+
>
|
|
63
|
+
{children}
|
|
64
|
+
</DialogContent>
|
|
65
|
+
</Dialog>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function CommandInput({
|
|
70
|
+
className,
|
|
71
|
+
...props
|
|
72
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
73
|
+
return (
|
|
74
|
+
<div data-slot="command-input-wrapper" className="p-1 pb-0">
|
|
75
|
+
<InputGroup className="h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!">
|
|
76
|
+
<CommandPrimitive.Input
|
|
77
|
+
data-slot="command-input"
|
|
78
|
+
className={cn(
|
|
79
|
+
"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
80
|
+
className,
|
|
81
|
+
)}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
<InputGroupAddon>
|
|
85
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
86
|
+
</InputGroupAddon>
|
|
87
|
+
</InputGroup>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function CommandList({
|
|
93
|
+
className,
|
|
94
|
+
...props
|
|
95
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
96
|
+
return (
|
|
97
|
+
<CommandPrimitive.List
|
|
98
|
+
data-slot="command-list"
|
|
99
|
+
className={cn(
|
|
100
|
+
"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function CommandEmpty({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
112
|
+
return (
|
|
113
|
+
<CommandPrimitive.Empty
|
|
114
|
+
data-slot="command-empty"
|
|
115
|
+
className={cn("py-6 text-center text-sm", className)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function CommandGroup({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
125
|
+
return (
|
|
126
|
+
<CommandPrimitive.Group
|
|
127
|
+
data-slot="command-group"
|
|
128
|
+
className={cn(
|
|
129
|
+
"overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",
|
|
130
|
+
className,
|
|
131
|
+
)}
|
|
132
|
+
{...props}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function CommandSeparator({
|
|
138
|
+
className,
|
|
139
|
+
...props
|
|
140
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
141
|
+
return (
|
|
142
|
+
<CommandPrimitive.Separator
|
|
143
|
+
data-slot="command-separator"
|
|
144
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
145
|
+
{...props}
|
|
146
|
+
/>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function CommandItem({
|
|
151
|
+
className,
|
|
152
|
+
children,
|
|
153
|
+
...props
|
|
154
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
155
|
+
return (
|
|
156
|
+
<CommandPrimitive.Item
|
|
157
|
+
data-slot="command-item"
|
|
158
|
+
className={cn(
|
|
159
|
+
"group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",
|
|
160
|
+
className,
|
|
161
|
+
)}
|
|
162
|
+
{...props}
|
|
163
|
+
>
|
|
164
|
+
{children}
|
|
165
|
+
<CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
|
|
166
|
+
</CommandPrimitive.Item>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function CommandShortcut({
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}: React.ComponentProps<"span">) {
|
|
174
|
+
return (
|
|
175
|
+
<span
|
|
176
|
+
data-slot="command-shortcut"
|
|
177
|
+
className={cn(
|
|
178
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
|
|
179
|
+
className,
|
|
180
|
+
)}
|
|
181
|
+
{...props}
|
|
182
|
+
/>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export {
|
|
187
|
+
Command,
|
|
188
|
+
CommandDialog,
|
|
189
|
+
CommandEmpty,
|
|
190
|
+
CommandGroup,
|
|
191
|
+
CommandInput,
|
|
192
|
+
CommandItem,
|
|
193
|
+
CommandList,
|
|
194
|
+
CommandSeparator,
|
|
195
|
+
CommandShortcut,
|
|
196
|
+
};
|