@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,147 @@
1
+ // ../../src/components/ui/async-action-button.tsx
2
+ import { Check, LoaderCircle, RotateCcw } from "lucide-react";
3
+ import { useEffect, useRef, useState } 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/async-action-button.tsx
54
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
55
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
56
+ var labels = {
57
+ en: {
58
+ pending: "Working…",
59
+ success: "Completed",
60
+ retry: "Try again",
61
+ error: "The action failed. Please try again."
62
+ },
63
+ fr: {
64
+ pending: "En cours…",
65
+ success: "Terminé",
66
+ retry: "Réessayer",
67
+ error: "L’action a échoué. Veuillez réessayer."
68
+ }
69
+ };
70
+ var AsyncActionButton = ({
71
+ onAction,
72
+ onPendingChange,
73
+ children,
74
+ disabled,
75
+ locale: override,
76
+ messages,
77
+ ...props
78
+ }) => {
79
+ const locale = useKrakstackLocale(override);
80
+ const copy = {
81
+ ...locale.startsWith("fr") ? labels.fr : labels.en,
82
+ ...messages?.[locale.split("-")[0] ?? locale],
83
+ ...messages?.[locale]
84
+ };
85
+ const [status, setStatus] = useState("idle");
86
+ const locked = useRef(false);
87
+ const mounted = useRef(false);
88
+ useEffect(() => {
89
+ mounted.current = true;
90
+ return () => {
91
+ mounted.current = false;
92
+ };
93
+ }, []);
94
+ const run = async () => {
95
+ if (locked.current || disabled)
96
+ return;
97
+ locked.current = true;
98
+ setStatus("pending");
99
+ onPendingChange?.(true);
100
+ try {
101
+ await onAction();
102
+ if (mounted.current)
103
+ setStatus("success");
104
+ } catch {
105
+ if (mounted.current)
106
+ setStatus("error");
107
+ } finally {
108
+ locked.current = false;
109
+ onPendingChange?.(false);
110
+ }
111
+ };
112
+ return /* @__PURE__ */ jsxs("span", {
113
+ "data-slot": "async-action-button",
114
+ className: "inline-flex min-w-0 flex-col items-start gap-2",
115
+ children: [
116
+ /* @__PURE__ */ jsxs(Button, {
117
+ ...props,
118
+ type: "button",
119
+ disabled: disabled || status === "pending",
120
+ "aria-busy": status === "pending",
121
+ onClick: () => {
122
+ run();
123
+ },
124
+ children: [
125
+ status === "pending" ? /* @__PURE__ */ jsx2(LoaderCircle, {
126
+ "aria-hidden": "true",
127
+ className: "motion-safe:animate-spin"
128
+ }) : status === "success" ? /* @__PURE__ */ jsx2(Check, {
129
+ "aria-hidden": "true"
130
+ }) : status === "error" ? /* @__PURE__ */ jsx2(RotateCcw, {
131
+ "aria-hidden": "true"
132
+ }) : null,
133
+ status === "pending" ? copy.pending : status === "success" ? copy.success : status === "error" ? copy.retry : children
134
+ ]
135
+ }),
136
+ /* @__PURE__ */ jsx2("span", {
137
+ "data-slot": "async-action-feedback",
138
+ role: "status",
139
+ className: status === "error" ? "text-destructive text-sm" : "sr-only",
140
+ children: status === "error" ? copy.error : status === "success" ? copy.success : status === "pending" ? copy.pending : ""
141
+ })
142
+ ]
143
+ });
144
+ };
145
+ export {
146
+ AsyncActionButton
147
+ };
@@ -0,0 +1,9 @@
1
+ import { type ReactNode } from "react";
2
+ export type AutoHeightProps = {
3
+ children: ReactNode;
4
+ duration?: number;
5
+ className?: string;
6
+ contentClassName?: string;
7
+ };
8
+ /** Measures content, not the animated container. SSR and observer-less browsers stay auto-sized. */
9
+ export declare const AutoHeight: ({ children, duration, className, contentClassName, }: AutoHeightProps) => import("react").JSX.Element;
@@ -0,0 +1,45 @@
1
+ // ../../src/components/ui/auto-height.tsx
2
+ import { motion, useReducedMotion } from "motion/react";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ var AutoHeight = ({
6
+ children,
7
+ duration = 200,
8
+ className,
9
+ contentClassName
10
+ }) => {
11
+ const content = useRef(null);
12
+ const [height, setHeight] = useState();
13
+ const reduced = useReducedMotion();
14
+ useEffect(() => {
15
+ const element = content.current;
16
+ if (!element || !globalThis.ResizeObserver)
17
+ return;
18
+ const observer = new ResizeObserver(() => {
19
+ if (element.getClientRects().length === 0)
20
+ return;
21
+ setHeight(element.getBoundingClientRect().height);
22
+ });
23
+ observer.observe(element);
24
+ return () => observer.disconnect();
25
+ }, []);
26
+ return /* @__PURE__ */ jsx(motion.div, {
27
+ "data-slot": "auto-height",
28
+ className,
29
+ initial: false,
30
+ animate: { height: height ?? "auto" },
31
+ transition: {
32
+ duration: reduced !== false ? 0 : Math.max(0, duration) / 1000
33
+ },
34
+ style: { overflow: "clip", boxSizing: "content-box" },
35
+ children: /* @__PURE__ */ jsx("div", {
36
+ ref: content,
37
+ className: contentClassName,
38
+ style: { display: "flow-root" },
39
+ children
40
+ })
41
+ });
42
+ };
43
+ export {
44
+ AutoHeight
45
+ };
@@ -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-colorful]:h-48 [&_.react-colorful]:w-full [&_.react-colorful__hue]:h-4 [&_.react-colorful__pointer]:size-5",
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
  };
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from "react";
2
+ export type DangerConfirmationMessages = {
3
+ confirm: string;
4
+ cancel: string;
5
+ typeToConfirm: string;
6
+ pending: string;
7
+ error: string;
8
+ };
9
+ export type DangerConfirmationProps = {
10
+ open: boolean;
11
+ onOpenChange: (open: boolean) => void;
12
+ title: ReactNode;
13
+ description: ReactNode;
14
+ confirmation?: string;
15
+ onConfirm: () => Promise<void>;
16
+ locale?: string;
17
+ messages?: Partial<Record<string, Partial<DangerConfirmationMessages>>>;
18
+ };
19
+ /** Confirmation is a UI safeguard, never an authorization boundary. */
20
+ export declare const DangerConfirmation: (props: DangerConfirmationProps) => import("react").JSX.Element;