@krak-stack/registry 0.3.0 → 0.5.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/CHANGELOG.md +26 -0
- package/dist/components/ui/app-switcher.d.ts +25 -0
- package/dist/components/ui/app-switcher.js +233 -0
- package/dist/components/ui/bulk-list-input.d.ts +24 -0
- package/dist/components/ui/bulk-list-input.js +152 -0
- package/dist/components/ui/choice-cards.d.ts +32 -0
- package/dist/components/ui/choice-cards.js +88 -0
- package/dist/components/ui/color-picker.js +3 -2
- package/dist/components/ui/effect-form.js +2 -2
- package/dist/components/ui/form.js +2 -2
- package/dist/components/ui/icon-input.js +2 -2
- package/dist/components/ui/map-menu.d.ts +14 -2
- package/dist/components/ui/map-menu.js +332 -306
- package/dist/components/ui/secret-value.d.ts +19 -0
- package/dist/components/ui/secret-value.js +216 -0
- package/dist/components/ui/upload-attachment.d.ts +39 -0
- package/dist/components/ui/upload-attachment.js +286 -0
- package/dist/components/ui/virtualized-combobox.js +2 -2
- package/package.json +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @krak-stack/registry
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b3cb799: Add App Switcher, Secret Value, Bulk List Input, Choice Cards, and Upload Attachment as standalone components with package exports and English/French documentation.
|
|
8
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 60ae40c: Add `MapMenuPresentation.Inline` alongside the default dialog presentation. Inline point and radius selection reuse the same search, red map and suggestion pins, stacked muted address details, current-location action, explicit confirmation, and retry feedback. Inline callers provide `onCancel` to restore host-owned drafts; dialog callers keep `open` and `onOpenChange` unchanged.
|
|
14
|
+
|
|
15
|
+
Prevent Enter in location search from submitting a surrounding form and block confirmation while location acquisition is pending.
|
|
16
|
+
|
|
3
17
|
## 0.3.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -14,6 +28,18 @@
|
|
|
14
28
|
|
|
15
29
|
- 86fc54f: Add a domain-neutral Stepper and optional StepperContent with controlled navigation, underline/labelled/segmented presentations, explicit completion/error states, bilingual defaults, and reduced-motion-aware directional slide transitions inside a stationary frame.
|
|
16
30
|
|
|
31
|
+
## 0.2.2
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Prevent virtualized combobox group headings from collapsing into options after asynchronous search results refresh.
|
|
36
|
+
|
|
37
|
+
## 0.2.1
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Keep the color picker panel full-width inside its popup, with even padding and a HEX value centered beneath it. Prevent react-colorful's injected styles from overriding panel, hue slider, and pointer dimensions.
|
|
42
|
+
|
|
17
43
|
## 0.2.0
|
|
18
44
|
|
|
19
45
|
### Minor Changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type AppSwitcherItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
href: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
badge?: ReactNode;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type AppSwitcherMessages = {
|
|
12
|
+
label: string;
|
|
13
|
+
current: string;
|
|
14
|
+
empty: string;
|
|
15
|
+
};
|
|
16
|
+
export type AppSwitcherProps = {
|
|
17
|
+
items: readonly AppSwitcherItem[];
|
|
18
|
+
currentApp?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
locale?: string;
|
|
22
|
+
messages?: Partial<Record<string, Partial<AppSwitcherMessages>>>;
|
|
23
|
+
};
|
|
24
|
+
/** Navigation only: the host supplies trusted destinations and available apps. */
|
|
25
|
+
export declare const AppSwitcher: ({ items, currentApp, disabled, className, locale: override, messages, }: AppSwitcherProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// ../../src/components/ui/app-switcher.tsx
|
|
2
|
+
import { Check, Grid2X2 } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
// ../../src/components/ui/button.tsx
|
|
5
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
|
|
8
|
+
// ../../src/lib/utils.ts
|
|
9
|
+
import { cn } from "cn";
|
|
10
|
+
|
|
11
|
+
// ../../src/components/ui/button.tsx
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
17
|
+
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
18
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
19
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
20
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
21
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
25
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
26
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
27
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
28
|
+
icon: "size-9",
|
|
29
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
30
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
31
|
+
"icon-lg": "size-10"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
variant: "default",
|
|
36
|
+
size: "default"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
function Button({
|
|
40
|
+
className,
|
|
41
|
+
variant = "default",
|
|
42
|
+
size = "default",
|
|
43
|
+
...props
|
|
44
|
+
}) {
|
|
45
|
+
return /* @__PURE__ */ jsx(ButtonPrimitive, {
|
|
46
|
+
"data-slot": "button",
|
|
47
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ../../src/components/ui/dropdown-menu.tsx
|
|
53
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
54
|
+
import { ChevronRightIcon, CheckIcon } from "lucide-react";
|
|
55
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
56
|
+
function DropdownMenu({ ...props }) {
|
|
57
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive.Root, {
|
|
58
|
+
"data-slot": "dropdown-menu",
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive.Trigger, {
|
|
64
|
+
"data-slot": "dropdown-menu-trigger",
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function DropdownMenuContent({
|
|
69
|
+
align = "start",
|
|
70
|
+
alignOffset = 0,
|
|
71
|
+
side = "bottom",
|
|
72
|
+
sideOffset = 4,
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}) {
|
|
76
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive.Portal, {
|
|
77
|
+
children: /* @__PURE__ */ jsx2(MenuPrimitive.Positioner, {
|
|
78
|
+
className: "isolate z-50 outline-none",
|
|
79
|
+
align,
|
|
80
|
+
alignOffset,
|
|
81
|
+
side,
|
|
82
|
+
sideOffset,
|
|
83
|
+
children: /* @__PURE__ */ jsx2(MenuPrimitive.Popup, {
|
|
84
|
+
"data-slot": "dropdown-menu-content",
|
|
85
|
+
className: cn("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none 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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
86
|
+
...props
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function DropdownMenuGroup({ ...props }) {
|
|
92
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive.Group, {
|
|
93
|
+
"data-slot": "dropdown-menu-group",
|
|
94
|
+
...props
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function DropdownMenuLabel({
|
|
98
|
+
className,
|
|
99
|
+
inset,
|
|
100
|
+
...props
|
|
101
|
+
}) {
|
|
102
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive.GroupLabel, {
|
|
103
|
+
"data-slot": "dropdown-menu-label",
|
|
104
|
+
"data-inset": inset,
|
|
105
|
+
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8", className),
|
|
106
|
+
...props
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function DropdownMenuItem({
|
|
110
|
+
className,
|
|
111
|
+
inset,
|
|
112
|
+
variant = "default",
|
|
113
|
+
...props
|
|
114
|
+
}) {
|
|
115
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive.Item, {
|
|
116
|
+
"data-slot": "dropdown-menu-item",
|
|
117
|
+
"data-inset": inset,
|
|
118
|
+
"data-variant": variant,
|
|
119
|
+
className: cn("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ../../src/components/ui/app-switcher.tsx
|
|
125
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
126
|
+
import { jsx as jsx3, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
|
|
127
|
+
var labels = {
|
|
128
|
+
en: {
|
|
129
|
+
label: "Switch application",
|
|
130
|
+
current: "Current application",
|
|
131
|
+
empty: "No applications available"
|
|
132
|
+
},
|
|
133
|
+
fr: {
|
|
134
|
+
label: "Changer d’application",
|
|
135
|
+
current: "Application actuelle",
|
|
136
|
+
empty: "Aucune application disponible"
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var AppSwitcher = ({
|
|
140
|
+
items,
|
|
141
|
+
currentApp,
|
|
142
|
+
disabled,
|
|
143
|
+
className,
|
|
144
|
+
locale: override,
|
|
145
|
+
messages
|
|
146
|
+
}) => {
|
|
147
|
+
const locale = useKrakstackLocale(override);
|
|
148
|
+
const copy = {
|
|
149
|
+
...locale.startsWith("fr") ? labels.fr : labels.en,
|
|
150
|
+
...messages?.[locale.split("-")[0] ?? locale],
|
|
151
|
+
...messages?.[locale]
|
|
152
|
+
};
|
|
153
|
+
return /* @__PURE__ */ jsxs2(DropdownMenu, {
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ jsx3(DropdownMenuTrigger, {
|
|
156
|
+
render: /* @__PURE__ */ jsx3(Button, {
|
|
157
|
+
type: "button",
|
|
158
|
+
variant: "outline",
|
|
159
|
+
size: "icon",
|
|
160
|
+
className,
|
|
161
|
+
disabled,
|
|
162
|
+
"aria-label": copy.label
|
|
163
|
+
}),
|
|
164
|
+
children: /* @__PURE__ */ jsx3(Grid2X2, {
|
|
165
|
+
"aria-hidden": "true"
|
|
166
|
+
})
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ jsx3(DropdownMenuContent, {
|
|
169
|
+
align: "end",
|
|
170
|
+
className: "w-80 max-w-[calc(100vw-2rem)]",
|
|
171
|
+
children: /* @__PURE__ */ jsxs2(DropdownMenuGroup, {
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ jsx3(DropdownMenuLabel, {
|
|
174
|
+
children: copy.label
|
|
175
|
+
}),
|
|
176
|
+
items.length === 0 ? /* @__PURE__ */ jsx3("p", {
|
|
177
|
+
className: "text-muted-foreground px-2 py-3 text-sm",
|
|
178
|
+
children: copy.empty
|
|
179
|
+
}) : null,
|
|
180
|
+
items.map((item) => /* @__PURE__ */ jsxs2(DropdownMenuItem, {
|
|
181
|
+
disabled: item.disabled,
|
|
182
|
+
render: /* @__PURE__ */ jsx3("a", {
|
|
183
|
+
href: item.disabled ? undefined : item.href,
|
|
184
|
+
"aria-current": item.id === currentApp ? "page" : undefined
|
|
185
|
+
}),
|
|
186
|
+
className: "gap-3 py-3",
|
|
187
|
+
children: [
|
|
188
|
+
item.icon ? /* @__PURE__ */ jsx3("span", {
|
|
189
|
+
"aria-hidden": "true",
|
|
190
|
+
className: "flex size-9 shrink-0 items-center justify-center rounded-md border",
|
|
191
|
+
children: item.icon
|
|
192
|
+
}) : null,
|
|
193
|
+
/* @__PURE__ */ jsxs2("span", {
|
|
194
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ jsxs2("span", {
|
|
197
|
+
className: "flex items-center gap-2",
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ jsx3("span", {
|
|
200
|
+
className: "truncate font-medium",
|
|
201
|
+
children: item.label
|
|
202
|
+
}),
|
|
203
|
+
item.badge
|
|
204
|
+
]
|
|
205
|
+
}),
|
|
206
|
+
item.description ? /* @__PURE__ */ jsx3("span", {
|
|
207
|
+
className: "text-muted-foreground text-xs",
|
|
208
|
+
children: item.description
|
|
209
|
+
}) : null
|
|
210
|
+
]
|
|
211
|
+
}),
|
|
212
|
+
item.id === currentApp ? /* @__PURE__ */ jsxs2(Fragment, {
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ jsx3(Check, {
|
|
215
|
+
"aria-hidden": "true"
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ jsx3("span", {
|
|
218
|
+
className: "sr-only",
|
|
219
|
+
children: copy.current
|
|
220
|
+
})
|
|
221
|
+
]
|
|
222
|
+
}) : null
|
|
223
|
+
]
|
|
224
|
+
}, item.id))
|
|
225
|
+
]
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
export {
|
|
232
|
+
AppSwitcher
|
|
233
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { Textarea } from "./textarea.js";
|
|
3
|
+
export type BulkListResult = {
|
|
4
|
+
items: string[];
|
|
5
|
+
duplicates: number;
|
|
6
|
+
};
|
|
7
|
+
/** Text tokenization, not CSV parsing or domain validation. */
|
|
8
|
+
export declare const parseBulkList: (text: string, options?: {
|
|
9
|
+
separator?: RegExp;
|
|
10
|
+
normalize?: (value: string) => string;
|
|
11
|
+
}) => BulkListResult;
|
|
12
|
+
export type BulkListInputProps = Omit<ComponentProps<typeof Textarea>, "value" | "defaultValue" | "onChange" | "children"> & {
|
|
13
|
+
value: string;
|
|
14
|
+
onValueChange: (value: string) => void;
|
|
15
|
+
label?: ReactNode;
|
|
16
|
+
files?: {
|
|
17
|
+
accept: string;
|
|
18
|
+
label: string;
|
|
19
|
+
multiple?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
onSelect: (files: readonly File[]) => void;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const BulkListInput: ({ value, onValueChange, label, files, disabled, readOnly, ...props }: BulkListInputProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// ../../src/components/ui/bulk-list-input.tsx
|
|
2
|
+
import { Upload } from "lucide-react";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
|
|
5
|
+
// ../../src/components/ui/button.tsx
|
|
6
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
|
+
|
|
9
|
+
// ../../src/lib/utils.ts
|
|
10
|
+
import { cn } from "cn";
|
|
11
|
+
|
|
12
|
+
// ../../src/components/ui/button.tsx
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
18
|
+
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
19
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
20
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
21
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
22
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
26
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
27
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
28
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
29
|
+
icon: "size-9",
|
|
30
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
31
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
32
|
+
"icon-lg": "size-10"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: "default",
|
|
37
|
+
size: "default"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
function Button({
|
|
41
|
+
className,
|
|
42
|
+
variant = "default",
|
|
43
|
+
size = "default",
|
|
44
|
+
...props
|
|
45
|
+
}) {
|
|
46
|
+
return /* @__PURE__ */ jsx(ButtonPrimitive, {
|
|
47
|
+
"data-slot": "button",
|
|
48
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ../../src/components/ui/textarea.tsx
|
|
54
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
55
|
+
function Textarea({ className, ...props }) {
|
|
56
|
+
return /* @__PURE__ */ jsx2("textarea", {
|
|
57
|
+
"data-slot": "textarea",
|
|
58
|
+
className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ../../src/components/ui/bulk-list-input.tsx
|
|
64
|
+
import { jsx as jsx3, jsxs, Fragment } from "react/jsx-runtime";
|
|
65
|
+
var parseBulkList = (text, options = {}) => {
|
|
66
|
+
const values = text.split(options.separator ?? /[,\r\n]+/).map((value) => value.trim()).filter(Boolean);
|
|
67
|
+
const seen = new Set;
|
|
68
|
+
const items = values.filter((value) => {
|
|
69
|
+
const key = options.normalize?.(value) ?? value;
|
|
70
|
+
if (seen.has(key))
|
|
71
|
+
return false;
|
|
72
|
+
seen.add(key);
|
|
73
|
+
return true;
|
|
74
|
+
});
|
|
75
|
+
return { items, duplicates: values.length - items.length };
|
|
76
|
+
};
|
|
77
|
+
var BulkListInput = ({
|
|
78
|
+
value,
|
|
79
|
+
onValueChange,
|
|
80
|
+
label,
|
|
81
|
+
files,
|
|
82
|
+
disabled,
|
|
83
|
+
readOnly,
|
|
84
|
+
...props
|
|
85
|
+
}) => {
|
|
86
|
+
const input = useRef(null);
|
|
87
|
+
const filesDisabled = disabled || readOnly || files?.disabled;
|
|
88
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
89
|
+
className: "flex min-w-0 flex-col gap-3",
|
|
90
|
+
onDragOver: (event) => {
|
|
91
|
+
if (files && event.dataTransfer.types.includes("Files"))
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
},
|
|
94
|
+
onDrop: (event) => {
|
|
95
|
+
if (!files || !event.dataTransfer.files.length)
|
|
96
|
+
return;
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
if (!filesDisabled)
|
|
99
|
+
files.onSelect(Array.from(event.dataTransfer.files));
|
|
100
|
+
},
|
|
101
|
+
children: [
|
|
102
|
+
label || files ? /* @__PURE__ */ jsxs("div", {
|
|
103
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
104
|
+
children: [
|
|
105
|
+
label,
|
|
106
|
+
files ? /* @__PURE__ */ jsxs(Fragment, {
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsx3("input", {
|
|
109
|
+
ref: input,
|
|
110
|
+
type: "file",
|
|
111
|
+
className: "hidden",
|
|
112
|
+
accept: files.accept,
|
|
113
|
+
multiple: files.multiple,
|
|
114
|
+
disabled: filesDisabled,
|
|
115
|
+
onChange: (event) => {
|
|
116
|
+
const selected = Array.from(event.target.files ?? []);
|
|
117
|
+
event.target.value = "";
|
|
118
|
+
if (selected.length && !filesDisabled)
|
|
119
|
+
files.onSelect(selected);
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
123
|
+
type: "button",
|
|
124
|
+
variant: "outline",
|
|
125
|
+
size: "sm",
|
|
126
|
+
disabled: filesDisabled,
|
|
127
|
+
onClick: () => input.current?.click(),
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ jsx3(Upload, {
|
|
130
|
+
"aria-hidden": "true"
|
|
131
|
+
}),
|
|
132
|
+
files.label
|
|
133
|
+
]
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
}) : null
|
|
137
|
+
]
|
|
138
|
+
}) : null,
|
|
139
|
+
/* @__PURE__ */ jsx3(Textarea, {
|
|
140
|
+
...props,
|
|
141
|
+
value,
|
|
142
|
+
disabled,
|
|
143
|
+
readOnly,
|
|
144
|
+
onChange: (event) => onValueChange(event.target.value)
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
export {
|
|
150
|
+
BulkListInput,
|
|
151
|
+
parseBulkList
|
|
152
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type ChoiceCardOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type ChoiceCardsBaseProps = {
|
|
10
|
+
name: string;
|
|
11
|
+
label: ReactNode;
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
error?: ReactNode;
|
|
14
|
+
options: readonly ChoiceCardOption[];
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
onBlur?: () => void;
|
|
18
|
+
};
|
|
19
|
+
export type ChoiceCardsProps = ChoiceCardsBaseProps & ({
|
|
20
|
+
mode: "single";
|
|
21
|
+
value: string | null;
|
|
22
|
+
onValueChange: (value: string) => void;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
} | {
|
|
25
|
+
mode: "multiple";
|
|
26
|
+
value: readonly string[];
|
|
27
|
+
onValueChange: (value: string[]) => void;
|
|
28
|
+
required?: never;
|
|
29
|
+
});
|
|
30
|
+
/** Native inputs retain browser keyboard navigation and form submission. */
|
|
31
|
+
export declare const ChoiceCards: (props: ChoiceCardsProps) => import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// ../../src/components/ui/choice-cards.tsx
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
|
|
4
|
+
// ../../src/lib/utils.ts
|
|
5
|
+
import { cn } from "cn";
|
|
6
|
+
|
|
7
|
+
// ../../src/components/ui/choice-cards.tsx
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var ChoiceCards = (props) => {
|
|
10
|
+
const id = useId();
|
|
11
|
+
const describedBy = [
|
|
12
|
+
props.description ? `${id}-description` : undefined,
|
|
13
|
+
props.error ? `${id}-error` : undefined
|
|
14
|
+
].filter(Boolean).join(" ") || undefined;
|
|
15
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
16
|
+
disabled: props.disabled,
|
|
17
|
+
"aria-describedby": describedBy,
|
|
18
|
+
"aria-invalid": props.error ? true : undefined,
|
|
19
|
+
className: "min-w-0 space-y-3",
|
|
20
|
+
onBlur: (event) => {
|
|
21
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
22
|
+
props.onBlur?.();
|
|
23
|
+
},
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx("legend", {
|
|
26
|
+
className: "text-sm font-medium",
|
|
27
|
+
children: props.label
|
|
28
|
+
}),
|
|
29
|
+
props.description ? /* @__PURE__ */ jsx("p", {
|
|
30
|
+
id: `${id}-description`,
|
|
31
|
+
className: "text-muted-foreground text-sm",
|
|
32
|
+
children: props.description
|
|
33
|
+
}) : null,
|
|
34
|
+
/* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: cn("grid gap-3 sm:grid-cols-2", props.className),
|
|
36
|
+
children: props.options.map((option) => /* @__PURE__ */ jsxs("label", {
|
|
37
|
+
className: "bg-card has-checked:border-primary has-checked:bg-primary/5 has-focus-visible:ring-ring flex cursor-pointer items-start gap-3 rounded-lg border p-4 text-sm transition-colors has-focus-visible:ring-2 has-disabled:cursor-not-allowed has-disabled:opacity-50",
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx("input", {
|
|
40
|
+
type: props.mode === "single" ? "radio" : "checkbox",
|
|
41
|
+
name: props.name,
|
|
42
|
+
value: option.value,
|
|
43
|
+
disabled: option.disabled,
|
|
44
|
+
required: props.mode === "single" ? props.required : undefined,
|
|
45
|
+
checked: props.mode === "single" ? props.value === option.value : props.value.includes(option.value),
|
|
46
|
+
"aria-invalid": props.error ? true : undefined,
|
|
47
|
+
"aria-describedby": describedBy,
|
|
48
|
+
className: "accent-primary mt-0.5 size-4 shrink-0",
|
|
49
|
+
onChange: (event) => {
|
|
50
|
+
if (props.mode === "single")
|
|
51
|
+
props.onValueChange(option.value);
|
|
52
|
+
else
|
|
53
|
+
props.onValueChange(event.target.checked ? [...props.value, option.value] : props.value.filter((value) => value !== option.value));
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
option.icon ? /* @__PURE__ */ jsx("span", {
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
className: "shrink-0 [&_svg]:size-5",
|
|
59
|
+
children: option.icon
|
|
60
|
+
}) : null,
|
|
61
|
+
/* @__PURE__ */ jsxs("span", {
|
|
62
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx("span", {
|
|
65
|
+
className: "font-medium",
|
|
66
|
+
children: option.label
|
|
67
|
+
}),
|
|
68
|
+
option.description ? /* @__PURE__ */ jsx("span", {
|
|
69
|
+
className: "text-muted-foreground",
|
|
70
|
+
children: option.description
|
|
71
|
+
}) : null
|
|
72
|
+
]
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
}, option.value))
|
|
76
|
+
}),
|
|
77
|
+
props.error ? /* @__PURE__ */ jsx("p", {
|
|
78
|
+
id: `${id}-error`,
|
|
79
|
+
role: "alert",
|
|
80
|
+
className: "text-destructive text-sm",
|
|
81
|
+
children: props.error
|
|
82
|
+
}) : null
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
ChoiceCards
|
|
88
|
+
};
|
|
@@ -256,10 +256,11 @@ var ColorPanel = ({
|
|
|
256
256
|
}, [copy.saturation, copy.hue, copy.saturationValue, copy.brightnessValue]);
|
|
257
257
|
return /* @__PURE__ */ jsx5("div", {
|
|
258
258
|
ref,
|
|
259
|
-
className: "[&_.react-
|
|
259
|
+
className: "[&_.react-colorful__hue]:h-4! [&_.react-colorful__pointer]:size-5!",
|
|
260
260
|
children: /* @__PURE__ */ jsx5(HexColorPicker, {
|
|
261
261
|
color,
|
|
262
|
-
onChange
|
|
262
|
+
onChange,
|
|
263
|
+
style: { width: "100%", height: "12rem" }
|
|
263
264
|
})
|
|
264
265
|
});
|
|
265
266
|
};
|
|
@@ -995,7 +995,7 @@ var VirtualizedComboboxList = ({
|
|
|
995
995
|
}));
|
|
996
996
|
const selectedEntries = itemEntries.filter(({ item }) => selectedValues.has(item.value));
|
|
997
997
|
const availableEntries = itemEntries.filter(({ item }) => !selectedValues.has(item.value));
|
|
998
|
-
const entries = groupSelections ? [
|
|
998
|
+
const entries = filteredItems.length === 0 ? [] : groupSelections ? [
|
|
999
999
|
...selectedEntries.length > 0 ? [
|
|
1000
1000
|
{
|
|
1001
1001
|
kind: "group",
|
|
@@ -1114,7 +1114,7 @@ var VirtualizedComboboxContent = ({
|
|
|
1114
1114
|
side: "bottom",
|
|
1115
1115
|
sideOffset: 6,
|
|
1116
1116
|
children: /* @__PURE__ */ jsxs5(ComboboxPrimitive.Popup, {
|
|
1117
|
-
className: cn("
|
|
1117
|
+
className: cn("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 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-in-95 relative flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-0 origin-(--transform-origin) flex-col overflow-hidden rounded-md shadow-md ring-1 duration-100", contentClassName),
|
|
1118
1118
|
children: [
|
|
1119
1119
|
/* @__PURE__ */ jsx12("div", {
|
|
1120
1120
|
className: "min-w-0 shrink-0 p-1 pb-0",
|
|
@@ -999,7 +999,7 @@ var VirtualizedComboboxList = ({
|
|
|
999
999
|
}));
|
|
1000
1000
|
const selectedEntries = itemEntries.filter(({ item }) => selectedValues.has(item.value));
|
|
1001
1001
|
const availableEntries = itemEntries.filter(({ item }) => !selectedValues.has(item.value));
|
|
1002
|
-
const entries = groupSelections ? [
|
|
1002
|
+
const entries = filteredItems.length === 0 ? [] : groupSelections ? [
|
|
1003
1003
|
...selectedEntries.length > 0 ? [
|
|
1004
1004
|
{
|
|
1005
1005
|
kind: "group",
|
|
@@ -1118,7 +1118,7 @@ var VirtualizedComboboxContent = ({
|
|
|
1118
1118
|
side: "bottom",
|
|
1119
1119
|
sideOffset: 6,
|
|
1120
1120
|
children: /* @__PURE__ */ jsxs5(ComboboxPrimitive.Popup, {
|
|
1121
|
-
className: cn("
|
|
1121
|
+
className: cn("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 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-in-95 relative flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-0 origin-(--transform-origin) flex-col overflow-hidden rounded-md shadow-md ring-1 duration-100", contentClassName),
|
|
1122
1122
|
children: [
|
|
1123
1123
|
/* @__PURE__ */ jsx12("div", {
|
|
1124
1124
|
className: "min-w-0 shrink-0 p-1 pb-0",
|
|
@@ -172,7 +172,7 @@ var VirtualizedComboboxList = ({
|
|
|
172
172
|
}));
|
|
173
173
|
const selectedEntries = itemEntries.filter(({ item }) => selectedValues.has(item.value));
|
|
174
174
|
const availableEntries = itemEntries.filter(({ item }) => !selectedValues.has(item.value));
|
|
175
|
-
const entries = groupSelections ? [
|
|
175
|
+
const entries = filteredItems.length === 0 ? [] : groupSelections ? [
|
|
176
176
|
...selectedEntries.length > 0 ? [
|
|
177
177
|
{
|
|
178
178
|
kind: "group",
|
|
@@ -291,7 +291,7 @@ var VirtualizedComboboxContent = ({
|
|
|
291
291
|
side: "bottom",
|
|
292
292
|
sideOffset: 6,
|
|
293
293
|
children: /* @__PURE__ */ jsxs(ComboboxPrimitive.Popup, {
|
|
294
|
-
className: cn("
|
|
294
|
+
className: cn("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 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-in-95 relative flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-0 origin-(--transform-origin) flex-col overflow-hidden rounded-md shadow-md ring-1 duration-100", contentClassName),
|
|
295
295
|
children: [
|
|
296
296
|
/* @__PURE__ */ jsx4("div", {
|
|
297
297
|
className: "min-w-0 shrink-0 p-1 pb-0",
|