@krak-stack/registry 0.4.0 → 0.6.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/components/ui/animated-list.d.ts +22 -0
  3. package/dist/components/ui/animated-list.js +219 -0
  4. package/dist/components/ui/animated-number.d.ts +9 -0
  5. package/dist/components/ui/animated-number.js +52 -0
  6. package/dist/components/ui/app-switcher.d.ts +25 -0
  7. package/dist/components/ui/app-switcher.js +233 -0
  8. package/dist/components/ui/async-action-button.d.ts +16 -0
  9. package/dist/components/ui/async-action-button.js +147 -0
  10. package/dist/components/ui/auto-height.d.ts +9 -0
  11. package/dist/components/ui/auto-height.js +45 -0
  12. package/dist/components/ui/bulk-list-input.d.ts +24 -0
  13. package/dist/components/ui/bulk-list-input.js +152 -0
  14. package/dist/components/ui/choice-cards.d.ts +32 -0
  15. package/dist/components/ui/choice-cards.js +88 -0
  16. package/dist/components/ui/color-picker.js +3 -2
  17. package/dist/components/ui/danger-confirmation.d.ts +20 -0
  18. package/dist/components/ui/danger-confirmation.js +394 -0
  19. package/dist/components/ui/editable-text.d.ts +19 -0
  20. package/dist/components/ui/editable-text.js +334 -0
  21. package/dist/components/ui/effect-form.js +2 -2
  22. package/dist/components/ui/form.js +2 -2
  23. package/dist/components/ui/icon-input.js +2 -2
  24. package/dist/components/ui/presence-transition.d.ts +9 -0
  25. package/dist/components/ui/presence-transition.js +41 -0
  26. package/dist/components/ui/secret-value.d.ts +19 -0
  27. package/dist/components/ui/secret-value.js +216 -0
  28. package/dist/components/ui/unsaved-changes-guard.d.ts +15 -0
  29. package/dist/components/ui/unsaved-changes-guard.js +235 -0
  30. package/dist/components/ui/upload-attachment.d.ts +39 -0
  31. package/dist/components/ui/upload-attachment.js +286 -0
  32. package/dist/components/ui/virtualized-combobox.js +2 -2
  33. package/package.json +54 -1
@@ -0,0 +1,15 @@
1
+ export type UnsavedChangesGuardMessages = {
2
+ title: string;
3
+ description: string;
4
+ stay: string;
5
+ leave: string;
6
+ };
7
+ export type UnsavedChangesGuardProps = {
8
+ dirty: boolean;
9
+ enabled?: boolean;
10
+ protectBeforeUnload?: boolean;
11
+ locale?: string;
12
+ messages?: Partial<Record<string, Partial<UnsavedChangesGuardMessages>>>;
13
+ };
14
+ /** Mount once per editing route, inside a TanStack Router provider. */
15
+ export declare const UnsavedChangesGuard: ({ dirty, enabled, protectBeforeUnload, locale: override, messages, }: UnsavedChangesGuardProps) => import("react").JSX.Element;
@@ -0,0 +1,235 @@
1
+ // ../../src/components/ui/unsaved-changes-guard.tsx
2
+ import { useBlocker } from "@tanstack/react-router";
3
+
4
+ // ../../src/components/ui/alert-dialog.tsx
5
+ import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
6
+
7
+ // ../../src/lib/utils.ts
8
+ import { cn } from "cn";
9
+
10
+ // ../../src/components/ui/button.tsx
11
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
12
+ import { cva } from "class-variance-authority";
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/alert-dialog.tsx
54
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
55
+ "use client";
56
+ function AlertDialog({ ...props }) {
57
+ return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Root, {
58
+ "data-slot": "alert-dialog",
59
+ ...props
60
+ });
61
+ }
62
+ function AlertDialogPortal({ ...props }) {
63
+ return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Portal, {
64
+ "data-slot": "alert-dialog-portal",
65
+ ...props
66
+ });
67
+ }
68
+ function AlertDialogOverlay({
69
+ className,
70
+ ...props
71
+ }) {
72
+ return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Backdrop, {
73
+ "data-slot": "alert-dialog-overlay",
74
+ className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className),
75
+ ...props
76
+ });
77
+ }
78
+ function AlertDialogContent({
79
+ className,
80
+ size = "default",
81
+ ...props
82
+ }) {
83
+ return /* @__PURE__ */ jsxs(AlertDialogPortal, {
84
+ children: [
85
+ /* @__PURE__ */ jsx2(AlertDialogOverlay, {}),
86
+ /* @__PURE__ */ jsx2(AlertDialogPrimitive.Popup, {
87
+ "data-slot": "alert-dialog-content",
88
+ "data-size": size,
89
+ className: cn("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg 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", className),
90
+ ...props
91
+ })
92
+ ]
93
+ });
94
+ }
95
+ function AlertDialogHeader({
96
+ className,
97
+ ...props
98
+ }) {
99
+ return /* @__PURE__ */ jsx2("div", {
100
+ "data-slot": "alert-dialog-header",
101
+ className: cn("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", className),
102
+ ...props
103
+ });
104
+ }
105
+ function AlertDialogFooter({
106
+ className,
107
+ ...props
108
+ }) {
109
+ return /* @__PURE__ */ jsx2("div", {
110
+ "data-slot": "alert-dialog-footer",
111
+ className: cn("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", className),
112
+ ...props
113
+ });
114
+ }
115
+ function AlertDialogTitle({
116
+ className,
117
+ ...props
118
+ }) {
119
+ return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Title, {
120
+ "data-slot": "alert-dialog-title",
121
+ className: cn("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", className),
122
+ ...props
123
+ });
124
+ }
125
+ function AlertDialogDescription({
126
+ className,
127
+ ...props
128
+ }) {
129
+ return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Description, {
130
+ "data-slot": "alert-dialog-description",
131
+ className: cn("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className),
132
+ ...props
133
+ });
134
+ }
135
+ function AlertDialogAction({
136
+ className,
137
+ ...props
138
+ }) {
139
+ return /* @__PURE__ */ jsx2(Button, {
140
+ "data-slot": "alert-dialog-action",
141
+ className: cn(className),
142
+ ...props
143
+ });
144
+ }
145
+ function AlertDialogCancel({
146
+ className,
147
+ variant = "outline",
148
+ size = "default",
149
+ ...props
150
+ }) {
151
+ return /* @__PURE__ */ jsx2(AlertDialogPrimitive.Close, {
152
+ "data-slot": "alert-dialog-cancel",
153
+ className: cn(className),
154
+ render: /* @__PURE__ */ jsx2(Button, {
155
+ variant,
156
+ size
157
+ }),
158
+ ...props
159
+ });
160
+ }
161
+
162
+ // ../../src/components/ui/unsaved-changes-guard.tsx
163
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
164
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
165
+ var labels = {
166
+ en: {
167
+ title: "Leave without saving?",
168
+ description: "You have unsaved changes. Leaving this page will discard them.",
169
+ stay: "Keep editing",
170
+ leave: "Leave page"
171
+ },
172
+ fr: {
173
+ title: "Quitter sans enregistrer ?",
174
+ description: "Des modifications n’ont pas été enregistrées. Elles seront perdues si vous quittez cette page.",
175
+ stay: "Continuer la modification",
176
+ leave: "Quitter la page"
177
+ }
178
+ };
179
+ var UnsavedChangesGuard = ({
180
+ dirty,
181
+ enabled = true,
182
+ protectBeforeUnload = true,
183
+ locale: override,
184
+ messages
185
+ }) => {
186
+ const locale = useKrakstackLocale(override);
187
+ const copy = {
188
+ ...locale.startsWith("fr") ? labels.fr : labels.en,
189
+ ...messages?.[locale.split("-")[0] ?? locale],
190
+ ...messages?.[locale]
191
+ };
192
+ const blocker = useBlocker({
193
+ shouldBlockFn: () => dirty && enabled,
194
+ enableBeforeUnload: dirty && enabled && protectBeforeUnload,
195
+ withResolver: true
196
+ });
197
+ return /* @__PURE__ */ jsx3(AlertDialog, {
198
+ open: blocker.status === "blocked",
199
+ onOpenChange: (open) => {
200
+ if (!open)
201
+ blocker.reset?.();
202
+ },
203
+ children: /* @__PURE__ */ jsxs2(AlertDialogContent, {
204
+ children: [
205
+ /* @__PURE__ */ jsxs2(AlertDialogHeader, {
206
+ children: [
207
+ /* @__PURE__ */ jsx3(AlertDialogTitle, {
208
+ children: copy.title
209
+ }),
210
+ /* @__PURE__ */ jsx3(AlertDialogDescription, {
211
+ children: copy.description
212
+ })
213
+ ]
214
+ }),
215
+ /* @__PURE__ */ jsxs2(AlertDialogFooter, {
216
+ children: [
217
+ /* @__PURE__ */ jsx3(AlertDialogCancel, {
218
+ type: "button",
219
+ children: copy.stay
220
+ }),
221
+ /* @__PURE__ */ jsx3(AlertDialogAction, {
222
+ type: "button",
223
+ variant: "destructive",
224
+ onClick: () => blocker.proceed?.(),
225
+ children: copy.leave
226
+ })
227
+ ]
228
+ })
229
+ ]
230
+ })
231
+ });
232
+ };
233
+ export {
234
+ UnsavedChangesGuard
235
+ };
@@ -0,0 +1,39 @@
1
+ export type UploadAttachmentState = {
2
+ status: "idle";
3
+ } | {
4
+ status: "uploading";
5
+ progress?: number;
6
+ } | {
7
+ status: "processing";
8
+ } | {
9
+ status: "done";
10
+ } | {
11
+ status: "cancelled";
12
+ } | {
13
+ status: "error";
14
+ message: string;
15
+ };
16
+ export type UploadAttachmentMessages = {
17
+ idle: string;
18
+ uploading: string;
19
+ processing: string;
20
+ done: string;
21
+ cancelled: string;
22
+ cancel: string;
23
+ retry: string;
24
+ remove: string;
25
+ };
26
+ export type UploadAttachmentProps = {
27
+ name: string;
28
+ description?: string;
29
+ state: UploadAttachmentState;
30
+ disabled?: boolean;
31
+ onCancel?: () => void;
32
+ onRetry?: () => void;
33
+ onRemove?: () => void;
34
+ className?: string;
35
+ locale?: string;
36
+ messages?: Partial<Record<string, Partial<UploadAttachmentMessages>>>;
37
+ };
38
+ /** Controlled presentation. The host owns transport, cancellation and retry policy. */
39
+ export declare const UploadAttachment: ({ name, description, state, disabled, onCancel, onRetry, onRemove, className, locale: override, messages, }: UploadAttachmentProps) => import("react").JSX.Element;
@@ -0,0 +1,286 @@
1
+ // ../../src/components/ui/upload-attachment.tsx
2
+ import {
3
+ Check,
4
+ File,
5
+ LoaderCircle,
6
+ RotateCcw,
7
+ TriangleAlert,
8
+ X
9
+ } from "lucide-react";
10
+ import { useId } from "react";
11
+
12
+ // ../../src/components/ui/attachment.tsx
13
+ import { mergeProps } from "@base-ui/react/merge-props";
14
+ import { useRender } from "@base-ui/react/use-render";
15
+ import { cva as cva2 } from "class-variance-authority";
16
+
17
+ // ../../src/lib/utils.ts
18
+ import { cn } from "cn";
19
+
20
+ // ../../src/components/ui/button.tsx
21
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
22
+ import { cva } from "class-variance-authority";
23
+ import { jsx } from "react/jsx-runtime";
24
+ 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", {
25
+ variants: {
26
+ variant: {
27
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
28
+ 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",
29
+ 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",
30
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
31
+ 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",
32
+ link: "text-primary underline-offset-4 hover:underline"
33
+ },
34
+ size: {
35
+ 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",
36
+ 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",
37
+ 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",
38
+ lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
39
+ icon: "size-9",
40
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
41
+ "icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
42
+ "icon-lg": "size-10"
43
+ }
44
+ },
45
+ defaultVariants: {
46
+ variant: "default",
47
+ size: "default"
48
+ }
49
+ });
50
+ function Button({
51
+ className,
52
+ variant = "default",
53
+ size = "default",
54
+ ...props
55
+ }) {
56
+ return /* @__PURE__ */ jsx(ButtonPrimitive, {
57
+ "data-slot": "button",
58
+ className: cn(buttonVariants({ variant, size, className })),
59
+ ...props
60
+ });
61
+ }
62
+
63
+ // ../../src/components/ui/attachment.tsx
64
+ import { jsx as jsx2 } from "react/jsx-runtime";
65
+ var attachmentVariants = cva2("group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed", {
66
+ variants: {
67
+ size: {
68
+ default: "gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2",
69
+ sm: "gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",
70
+ xs: "gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1"
71
+ },
72
+ orientation: {
73
+ horizontal: "min-w-40 items-center",
74
+ vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30"
75
+ }
76
+ }
77
+ });
78
+ function Attachment({
79
+ className,
80
+ state = "done",
81
+ size = "default",
82
+ orientation = "horizontal",
83
+ ...props
84
+ }) {
85
+ return /* @__PURE__ */ jsx2("div", {
86
+ "data-slot": "attachment",
87
+ "data-state": state,
88
+ "data-size": size,
89
+ "data-orientation": orientation,
90
+ className: cn(attachmentVariants({ size, orientation }), className),
91
+ ...props
92
+ });
93
+ }
94
+ var attachmentMediaVariants = cva2("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
95
+ variants: {
96
+ variant: {
97
+ icon: "",
98
+ image: "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover"
99
+ }
100
+ },
101
+ defaultVariants: {
102
+ variant: "icon"
103
+ }
104
+ });
105
+ function AttachmentMedia({
106
+ className,
107
+ variant = "icon",
108
+ ...props
109
+ }) {
110
+ return /* @__PURE__ */ jsx2("div", {
111
+ "data-slot": "attachment-media",
112
+ "data-variant": variant,
113
+ className: cn(attachmentMediaVariants({ variant }), className),
114
+ ...props
115
+ });
116
+ }
117
+ function AttachmentContent({
118
+ className,
119
+ ...props
120
+ }) {
121
+ return /* @__PURE__ */ jsx2("div", {
122
+ "data-slot": "attachment-content",
123
+ className: cn("max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1", className),
124
+ ...props
125
+ });
126
+ }
127
+ function AttachmentTitle({
128
+ className,
129
+ ...props
130
+ }) {
131
+ return /* @__PURE__ */ jsx2("span", {
132
+ "data-slot": "attachment-title",
133
+ className: cn("block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer", className),
134
+ ...props
135
+ });
136
+ }
137
+ function AttachmentDescription({
138
+ className,
139
+ ...props
140
+ }) {
141
+ return /* @__PURE__ */ jsx2("span", {
142
+ "data-slot": "attachment-description",
143
+ className: cn("mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80", "max-w-full", className),
144
+ ...props
145
+ });
146
+ }
147
+ function AttachmentActions({
148
+ className,
149
+ ...props
150
+ }) {
151
+ return /* @__PURE__ */ jsx2("div", {
152
+ "data-slot": "attachment-actions",
153
+ className: cn("relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1", className),
154
+ ...props
155
+ });
156
+ }
157
+
158
+ // ../../src/components/ui/upload-attachment.tsx
159
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
160
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
161
+ var labels = {
162
+ en: {
163
+ idle: "Ready to upload",
164
+ uploading: "Uploading",
165
+ processing: "Processing",
166
+ done: "Upload complete",
167
+ cancelled: "Upload cancelled",
168
+ cancel: "Cancel upload",
169
+ retry: "Retry upload",
170
+ remove: "Remove attachment"
171
+ },
172
+ fr: {
173
+ idle: "Prêt à téléverser",
174
+ uploading: "Téléversement",
175
+ processing: "Traitement",
176
+ done: "Téléversement terminé",
177
+ cancelled: "Téléversement annulé",
178
+ cancel: "Annuler le téléversement",
179
+ retry: "Réessayer le téléversement",
180
+ remove: "Retirer la pièce jointe"
181
+ }
182
+ };
183
+ var UploadAttachment = ({
184
+ name,
185
+ description,
186
+ state,
187
+ disabled,
188
+ onCancel,
189
+ onRetry,
190
+ onRemove,
191
+ className,
192
+ locale: override,
193
+ messages
194
+ }) => {
195
+ const locale = useKrakstackLocale(override);
196
+ const id = useId();
197
+ const copy = {
198
+ ...locale.startsWith("fr") ? labels.fr : labels.en,
199
+ ...messages?.[locale.split("-")[0] ?? locale],
200
+ ...messages?.[locale]
201
+ };
202
+ const busy = state.status === "uploading" || state.status === "processing";
203
+ const progress = state.status === "uploading" && state.progress !== undefined && Number.isFinite(state.progress) ? Math.min(100, Math.max(0, state.progress)) : undefined;
204
+ const status = state.status === "error" ? state.message : copy[state.status];
205
+ return /* @__PURE__ */ jsxs(Attachment, {
206
+ state: state.status === "cancelled" ? "idle" : state.status,
207
+ className,
208
+ "aria-labelledby": `${id}-name`,
209
+ children: [
210
+ /* @__PURE__ */ jsx3(AttachmentMedia, {
211
+ children: state.status === "done" ? /* @__PURE__ */ jsx3(Check, {
212
+ "aria-hidden": "true"
213
+ }) : state.status === "error" ? /* @__PURE__ */ jsx3(TriangleAlert, {
214
+ "aria-hidden": "true"
215
+ }) : busy ? /* @__PURE__ */ jsx3(LoaderCircle, {
216
+ "aria-hidden": "true",
217
+ className: "motion-safe:animate-spin"
218
+ }) : /* @__PURE__ */ jsx3(File, {
219
+ "aria-hidden": "true"
220
+ })
221
+ }),
222
+ /* @__PURE__ */ jsxs(AttachmentContent, {
223
+ children: [
224
+ /* @__PURE__ */ jsx3(AttachmentTitle, {
225
+ id: `${id}-name`,
226
+ children: name
227
+ }),
228
+ description ? /* @__PURE__ */ jsx3(AttachmentDescription, {
229
+ children: description
230
+ }) : null,
231
+ /* @__PURE__ */ jsx3("p", {
232
+ role: state.status === "error" ? "alert" : "status",
233
+ className: "text-muted-foreground mt-1 text-xs",
234
+ children: status
235
+ }),
236
+ state.status === "uploading" ? /* @__PURE__ */ jsx3("progress", {
237
+ className: "accent-primary mt-2 h-1.5 w-full",
238
+ "aria-label": `${copy.uploading}: ${name}`,
239
+ max: 100,
240
+ value: progress
241
+ }) : null
242
+ ]
243
+ }),
244
+ /* @__PURE__ */ jsxs(AttachmentActions, {
245
+ children: [
246
+ busy && onCancel ? /* @__PURE__ */ jsx3(Button, {
247
+ type: "button",
248
+ variant: "ghost",
249
+ size: "icon-sm",
250
+ disabled,
251
+ "aria-label": `${copy.cancel}: ${name}`,
252
+ onClick: onCancel,
253
+ children: /* @__PURE__ */ jsx3(X, {
254
+ "aria-hidden": "true"
255
+ })
256
+ }) : null,
257
+ (state.status === "error" || state.status === "cancelled") && onRetry ? /* @__PURE__ */ jsx3(Button, {
258
+ type: "button",
259
+ variant: "ghost",
260
+ size: "icon-sm",
261
+ disabled,
262
+ "aria-label": `${copy.retry}: ${name}`,
263
+ onClick: onRetry,
264
+ children: /* @__PURE__ */ jsx3(RotateCcw, {
265
+ "aria-hidden": "true"
266
+ })
267
+ }) : null,
268
+ !busy && onRemove ? /* @__PURE__ */ jsx3(Button, {
269
+ type: "button",
270
+ variant: "ghost",
271
+ size: "icon-sm",
272
+ disabled,
273
+ "aria-label": `${copy.remove}: ${name}`,
274
+ onClick: onRemove,
275
+ children: /* @__PURE__ */ jsx3(X, {
276
+ "aria-hidden": "true"
277
+ })
278
+ }) : null
279
+ ]
280
+ })
281
+ ]
282
+ });
283
+ };
284
+ export {
285
+ UploadAttachment
286
+ };
@@ -158,7 +158,7 @@ var VirtualizedComboboxList = ({
158
158
  }));
159
159
  const selectedEntries = itemEntries.filter(({ item }) => selectedValues.has(item.value));
160
160
  const availableEntries = itemEntries.filter(({ item }) => !selectedValues.has(item.value));
161
- const entries = groupSelections ? [
161
+ const entries = filteredItems.length === 0 ? [] : groupSelections ? [
162
162
  ...selectedEntries.length > 0 ? [
163
163
  {
164
164
  kind: "group",
@@ -277,7 +277,7 @@ var VirtualizedComboboxContent = ({
277
277
  side: "bottom",
278
278
  sideOffset: 6,
279
279
  children: /* @__PURE__ */ jsxs(ComboboxPrimitive.Popup, {
280
- className: cn("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 bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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", contentClassName),
280
+ 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),
281
281
  children: [
282
282
  /* @__PURE__ */ jsx4("div", {
283
283
  className: "min-w-0 shrink-0 p-1 pb-0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,6 +17,58 @@
17
17
  "type": "module",
18
18
  "sideEffects": false,
19
19
  "exports": {
20
+ "./async-action-button": {
21
+ "types": "./dist/components/ui/async-action-button.d.ts",
22
+ "import": "./dist/components/ui/async-action-button.js"
23
+ },
24
+ "./unsaved-changes-guard": {
25
+ "types": "./dist/components/ui/unsaved-changes-guard.d.ts",
26
+ "import": "./dist/components/ui/unsaved-changes-guard.js"
27
+ },
28
+ "./danger-confirmation": {
29
+ "types": "./dist/components/ui/danger-confirmation.d.ts",
30
+ "import": "./dist/components/ui/danger-confirmation.js"
31
+ },
32
+ "./editable-text": {
33
+ "types": "./dist/components/ui/editable-text.d.ts",
34
+ "import": "./dist/components/ui/editable-text.js"
35
+ },
36
+ "./presence-transition": {
37
+ "types": "./dist/components/ui/presence-transition.d.ts",
38
+ "import": "./dist/components/ui/presence-transition.js"
39
+ },
40
+ "./auto-height": {
41
+ "types": "./dist/components/ui/auto-height.d.ts",
42
+ "import": "./dist/components/ui/auto-height.js"
43
+ },
44
+ "./animated-list": {
45
+ "types": "./dist/components/ui/animated-list.d.ts",
46
+ "import": "./dist/components/ui/animated-list.js"
47
+ },
48
+ "./animated-number": {
49
+ "types": "./dist/components/ui/animated-number.d.ts",
50
+ "import": "./dist/components/ui/animated-number.js"
51
+ },
52
+ "./app-switcher": {
53
+ "types": "./dist/components/ui/app-switcher.d.ts",
54
+ "import": "./dist/components/ui/app-switcher.js"
55
+ },
56
+ "./secret-value": {
57
+ "types": "./dist/components/ui/secret-value.d.ts",
58
+ "import": "./dist/components/ui/secret-value.js"
59
+ },
60
+ "./bulk-list-input": {
61
+ "types": "./dist/components/ui/bulk-list-input.d.ts",
62
+ "import": "./dist/components/ui/bulk-list-input.js"
63
+ },
64
+ "./choice-cards": {
65
+ "types": "./dist/components/ui/choice-cards.d.ts",
66
+ "import": "./dist/components/ui/choice-cards.js"
67
+ },
68
+ "./upload-attachment": {
69
+ "types": "./dist/components/ui/upload-attachment.d.ts",
70
+ "import": "./dist/components/ui/upload-attachment.js"
71
+ },
20
72
  "./webhooks/client": {
21
73
  "types": "./dist/services/webhooks/client/delivery-table.d.ts",
22
74
  "import": "./dist/services/webhooks/client/delivery-table.js"
@@ -310,6 +362,7 @@
310
362
  "dependencies": {
311
363
  "@oxlint/plugins": "1.78.0",
312
364
  "bowser": "^2.14.1",
365
+ "motion": "^14.12.0",
313
366
  "react-colorful": "^5.8.1",
314
367
  "web-vitals": "^5.1.0"
315
368
  },