@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.
@@ -0,0 +1,19 @@
1
+ import { type CopyButtonMessageTranslations } from "./copy-button.js";
2
+ export type SecretValueMessages = {
3
+ show: string;
4
+ hide: string;
5
+ hidden: string;
6
+ };
7
+ export type SecretValueProps = {
8
+ value: string;
9
+ label: string;
10
+ disabled?: boolean;
11
+ copyable?: boolean;
12
+ autoHideDelay?: number;
13
+ className?: string;
14
+ locale?: string;
15
+ messages?: Partial<Record<string, Partial<SecretValueMessages>>>;
16
+ copyMessages?: CopyButtonMessageTranslations;
17
+ };
18
+ /** Masking is presentation, not a security boundary. Never logs the value. */
19
+ export declare const SecretValue: ({ value, label, disabled, copyable, autoHideDelay, className, locale: override, messages, copyMessages, }: SecretValueProps) => import("react").JSX.Element;
@@ -0,0 +1,216 @@
1
+ // ../../src/components/ui/secret-value.tsx
2
+ import { Eye, EyeOff } from "lucide-react";
3
+ import { useEffect as useEffect2, useState as useState2 } 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/copy-button.tsx
54
+ import { Check, Copy, TriangleAlert } from "lucide-react";
55
+ import { useEffect, useRef, useState } from "react";
56
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
57
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
58
+ var messages = {
59
+ en: { copy: "Copy", copied: "Copied", copyFailed: "Copy failed" },
60
+ fr: { copy: "Copier", copied: "Copié", copyFailed: "Échec de la copie" }
61
+ };
62
+ var copyButtonMessages = (locale = "en", translations) => ({
63
+ ...locale.startsWith("fr") ? messages.fr : messages.en,
64
+ ...translations?.[locale.split("-")[0] ?? locale],
65
+ ...translations?.[locale]
66
+ });
67
+ function CopyButton({
68
+ value,
69
+ valueDescription,
70
+ copyVariant = "default",
71
+ locale: localeOverride,
72
+ messages,
73
+ onCopied,
74
+ onCopyError,
75
+ resetDelay = 1500,
76
+ disabled,
77
+ size,
78
+ "aria-label": ariaLabel,
79
+ ...props
80
+ }) {
81
+ const locale = useKrakstackLocale(localeOverride);
82
+ const [copyState, setCopyState] = useState("idle");
83
+ const copyTimeout = useRef(undefined);
84
+ const labels = copyButtonMessages(locale, messages);
85
+ const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
86
+ const isLarge = copyVariant === "large";
87
+ const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
88
+ useEffect(() => {
89
+ return () => {
90
+ if (copyTimeout.current)
91
+ clearTimeout(copyTimeout.current);
92
+ };
93
+ }, []);
94
+ const resetCopyState = () => {
95
+ if (copyTimeout.current)
96
+ clearTimeout(copyTimeout.current);
97
+ copyTimeout.current = setTimeout(() => setCopyState("idle"), resetDelay);
98
+ };
99
+ const copy = async () => {
100
+ try {
101
+ await navigator.clipboard.writeText(value);
102
+ setCopyState("copied");
103
+ onCopied?.();
104
+ } catch (error) {
105
+ setCopyState("failed");
106
+ onCopyError?.(error instanceof Error ? error : new Error(labels.copyFailed, { cause: error }));
107
+ }
108
+ resetCopyState();
109
+ };
110
+ const status = copyState === "copied" ? valueDescription ? `${labels.copied}: ${valueDescription}` : labels.copied : copyState === "failed" ? valueDescription ? `${labels.copyFailed}: ${valueDescription}` : labels.copyFailed : "";
111
+ return /* @__PURE__ */ jsxs(Button, {
112
+ "aria-label": accessibleLabel,
113
+ disabled,
114
+ onClick: copy,
115
+ size: size ?? defaultSize,
116
+ ...props,
117
+ children: [
118
+ /* @__PURE__ */ jsx2("span", {
119
+ "aria-live": "polite",
120
+ className: "sr-only",
121
+ role: "status",
122
+ children: status
123
+ }),
124
+ copyState === "copied" ? /* @__PURE__ */ jsx2(Check, {
125
+ "aria-hidden": "true"
126
+ }) : null,
127
+ copyState === "failed" ? /* @__PURE__ */ jsx2(TriangleAlert, {
128
+ "aria-hidden": "true"
129
+ }) : null,
130
+ copyState === "idle" ? /* @__PURE__ */ jsx2(Copy, {
131
+ "aria-hidden": "true"
132
+ }) : null,
133
+ isLarge ? /* @__PURE__ */ jsx2("span", {
134
+ children: labels.copy
135
+ }) : null
136
+ ]
137
+ });
138
+ }
139
+
140
+ // ../../src/components/ui/secret-value.tsx
141
+ import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
142
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
143
+ var labels = {
144
+ en: { show: "Show", hide: "Hide", hidden: "Hidden value" },
145
+ fr: { show: "Afficher", hide: "Masquer", hidden: "Valeur masquée" }
146
+ };
147
+ var SecretValue = ({
148
+ value,
149
+ label,
150
+ disabled,
151
+ copyable = true,
152
+ autoHideDelay = 0,
153
+ className,
154
+ locale: override,
155
+ messages,
156
+ copyMessages
157
+ }) => {
158
+ const locale = useKrakstackLocale2(override);
159
+ const copy = {
160
+ ...locale.startsWith("fr") ? labels.fr : labels.en,
161
+ ...messages?.[locale.split("-")[0] ?? locale],
162
+ ...messages?.[locale]
163
+ };
164
+ const [revealedValue, setRevealedValue] = useState2(null);
165
+ const [previous, setPrevious] = useState2({ value, disabled });
166
+ if (previous.value !== value || previous.disabled !== disabled) {
167
+ setPrevious({ value, disabled });
168
+ setRevealedValue(null);
169
+ }
170
+ const revealed = !disabled && revealedValue === value;
171
+ useEffect2(() => {
172
+ if (!revealed || autoHideDelay <= 0)
173
+ return;
174
+ const timer = setTimeout(() => setRevealedValue(null), autoHideDelay);
175
+ return () => clearTimeout(timer);
176
+ }, [revealed, autoHideDelay, value]);
177
+ return /* @__PURE__ */ jsxs2("div", {
178
+ className: cn("flex min-w-0 items-center gap-2", className),
179
+ children: [
180
+ /* @__PURE__ */ jsx3("code", {
181
+ className: "min-w-0 flex-1 text-sm break-all",
182
+ "aria-label": revealed ? undefined : `${label}: ${copy.hidden}`,
183
+ children: revealed ? value : /* @__PURE__ */ jsx3("span", {
184
+ "aria-hidden": "true",
185
+ children: "••••••••"
186
+ })
187
+ }),
188
+ /* @__PURE__ */ jsx3(Button, {
189
+ type: "button",
190
+ size: "icon-sm",
191
+ variant: "ghost",
192
+ disabled,
193
+ "aria-label": `${revealed ? copy.hide : copy.show} ${label}`,
194
+ "aria-pressed": revealed,
195
+ onClick: () => setRevealedValue(revealed ? null : value),
196
+ children: revealed ? /* @__PURE__ */ jsx3(EyeOff, {
197
+ "aria-hidden": "true"
198
+ }) : /* @__PURE__ */ jsx3(Eye, {
199
+ "aria-hidden": "true"
200
+ })
201
+ }),
202
+ copyable ? /* @__PURE__ */ jsx3(CopyButton, {
203
+ type: "button",
204
+ value,
205
+ valueDescription: label,
206
+ disabled,
207
+ variant: "ghost",
208
+ locale,
209
+ messages: copyMessages
210
+ }) : null
211
+ ]
212
+ });
213
+ };
214
+ export {
215
+ SecretValue
216
+ };
@@ -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.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,6 +17,26 @@
17
17
  "type": "module",
18
18
  "sideEffects": false,
19
19
  "exports": {
20
+ "./app-switcher": {
21
+ "types": "./dist/components/ui/app-switcher.d.ts",
22
+ "import": "./dist/components/ui/app-switcher.js"
23
+ },
24
+ "./secret-value": {
25
+ "types": "./dist/components/ui/secret-value.d.ts",
26
+ "import": "./dist/components/ui/secret-value.js"
27
+ },
28
+ "./bulk-list-input": {
29
+ "types": "./dist/components/ui/bulk-list-input.d.ts",
30
+ "import": "./dist/components/ui/bulk-list-input.js"
31
+ },
32
+ "./choice-cards": {
33
+ "types": "./dist/components/ui/choice-cards.d.ts",
34
+ "import": "./dist/components/ui/choice-cards.js"
35
+ },
36
+ "./upload-attachment": {
37
+ "types": "./dist/components/ui/upload-attachment.d.ts",
38
+ "import": "./dist/components/ui/upload-attachment.js"
39
+ },
20
40
  "./webhooks/client": {
21
41
  "types": "./dist/services/webhooks/client/delivery-table.d.ts",
22
42
  "import": "./dist/services/webhooks/client/delivery-table.js"