@krizaka/ui 2.0.0-beta.1 → 2.0.0-beta.2

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 (52) hide show
  1. package/README.md +14 -3
  2. package/dist/button-G5qY4qSY.d.ts +68 -0
  3. package/dist/card.js +1 -1
  4. package/dist/checkbox.d.ts +52 -0
  5. package/dist/checkbox.js +42 -0
  6. package/dist/checkbox.js.map +1 -0
  7. package/dist/chip.d.ts +97 -0
  8. package/dist/chip.js +93 -0
  9. package/dist/chip.js.map +1 -0
  10. package/dist/{chunk-RLOXWF2G.js → chunk-5AXLA4LK.js} +1 -1
  11. package/dist/chunk-5AXLA4LK.js.map +1 -0
  12. package/dist/chunk-5FRYKFTO.js +121 -0
  13. package/dist/chunk-5FRYKFTO.js.map +1 -0
  14. package/dist/{chunk-CPMZS4XA.js → chunk-FJDSLNXK.js} +1 -1
  15. package/dist/chunk-FJDSLNXK.js.map +1 -0
  16. package/dist/cn.d.ts +3 -0
  17. package/dist/cn.js +1 -1
  18. package/dist/command.d.ts +156 -0
  19. package/dist/command.js +111 -0
  20. package/dist/command.js.map +1 -0
  21. package/dist/confirm-button.d.ts +23 -0
  22. package/dist/confirm-button.js +85 -0
  23. package/dist/confirm-button.js.map +1 -0
  24. package/dist/dialog-DGBY2grk.d.ts +147 -0
  25. package/dist/dialog.d.ts +4 -131
  26. package/dist/dialog.js +26 -90
  27. package/dist/dialog.js.map +1 -1
  28. package/dist/dropdown-menu.js +1 -1
  29. package/dist/field.js +1 -1
  30. package/dist/motion.css +7 -1
  31. package/dist/popover.js +1 -1
  32. package/dist/progress.d.ts +87 -0
  33. package/dist/progress.js +85 -0
  34. package/dist/progress.js.map +1 -0
  35. package/dist/radio-group.d.ts +77 -0
  36. package/dist/radio-group.js +48 -0
  37. package/dist/radio-group.js.map +1 -0
  38. package/dist/slider.d.ts +88 -0
  39. package/dist/slider.js +82 -0
  40. package/dist/slider.js.map +1 -0
  41. package/dist/switch.d.ts +72 -0
  42. package/dist/switch.js +38 -0
  43. package/dist/switch.js.map +1 -0
  44. package/dist/tabs.d.ts +83 -0
  45. package/dist/tabs.js +60 -0
  46. package/dist/tabs.js.map +1 -0
  47. package/dist/theme.d.ts +2 -59
  48. package/dist/toast.js +1 -1
  49. package/dist/tooltip.js +1 -1
  50. package/package.json +134 -5
  51. package/dist/chunk-CPMZS4XA.js.map +0 -1
  52. package/dist/chunk-RLOXWF2G.js.map +0 -1
@@ -0,0 +1,156 @@
1
+ import * as tailwind_variants from 'tailwind-variants';
2
+ import { Command as Command$1 } from 'cmdk';
3
+ import * as React from 'react';
4
+ import { D as DialogContentProps } from './dialog-DGBY2grk.js';
5
+ import 'radix-ui';
6
+
7
+ declare const command: tailwind_variants.TVReturnType<{
8
+ [key: string]: {
9
+ [key: string]: tailwind_variants.ClassValue | {
10
+ icon?: tailwind_variants.ClassValue;
11
+ input?: tailwind_variants.ClassValue;
12
+ loading?: tailwind_variants.ClassValue;
13
+ group?: tailwind_variants.ClassValue;
14
+ list?: tailwind_variants.ClassValue;
15
+ separator?: tailwind_variants.ClassValue;
16
+ root?: tailwind_variants.ClassValue;
17
+ inputWrap?: tailwind_variants.ClassValue;
18
+ empty?: tailwind_variants.ClassValue;
19
+ shortcut?: tailwind_variants.ClassValue;
20
+ item?: tailwind_variants.ClassValue;
21
+ };
22
+ };
23
+ } | {
24
+ [x: string]: {
25
+ [x: string]: tailwind_variants.ClassValue | {
26
+ icon?: tailwind_variants.ClassValue;
27
+ input?: tailwind_variants.ClassValue;
28
+ loading?: tailwind_variants.ClassValue;
29
+ group?: tailwind_variants.ClassValue;
30
+ list?: tailwind_variants.ClassValue;
31
+ separator?: tailwind_variants.ClassValue;
32
+ root?: tailwind_variants.ClassValue;
33
+ inputWrap?: tailwind_variants.ClassValue;
34
+ empty?: tailwind_variants.ClassValue;
35
+ shortcut?: tailwind_variants.ClassValue;
36
+ item?: tailwind_variants.ClassValue;
37
+ };
38
+ };
39
+ } | {}, {
40
+ root: string;
41
+ inputWrap: string;
42
+ icon: string;
43
+ input: string;
44
+ list: string;
45
+ empty: string;
46
+ loading: string;
47
+ group: string;
48
+ item: string;
49
+ separator: string;
50
+ shortcut: string;
51
+ }, undefined, {
52
+ [key: string]: {
53
+ [key: string]: tailwind_variants.ClassValue | {
54
+ icon?: tailwind_variants.ClassValue;
55
+ input?: tailwind_variants.ClassValue;
56
+ loading?: tailwind_variants.ClassValue;
57
+ group?: tailwind_variants.ClassValue;
58
+ list?: tailwind_variants.ClassValue;
59
+ separator?: tailwind_variants.ClassValue;
60
+ root?: tailwind_variants.ClassValue;
61
+ inputWrap?: tailwind_variants.ClassValue;
62
+ empty?: tailwind_variants.ClassValue;
63
+ shortcut?: tailwind_variants.ClassValue;
64
+ item?: tailwind_variants.ClassValue;
65
+ };
66
+ };
67
+ } | {}, {
68
+ root: string;
69
+ inputWrap: string;
70
+ icon: string;
71
+ input: string;
72
+ list: string;
73
+ empty: string;
74
+ loading: string;
75
+ group: string;
76
+ item: string;
77
+ separator: string;
78
+ shortcut: string;
79
+ }, tailwind_variants.TVReturnTypeLike<unknown, {
80
+ root: string;
81
+ inputWrap: string;
82
+ icon: string;
83
+ input: string;
84
+ list: string;
85
+ empty: string;
86
+ loading: string;
87
+ group: string;
88
+ item: string;
89
+ separator: string;
90
+ shortcut: string;
91
+ }>>;
92
+ type CommandRootProps = React.ComponentProps<typeof Command$1> & {
93
+ /** The accessible name of the palette — passed translated ("Search", "Commands"). */
94
+ label: string;
95
+ };
96
+ /** The palette: `value` / `onValueChange` (the active item), `shouldFilter`, `filter`, `loop`. */
97
+ declare function CommandRoot({ className, ...props }: CommandRootProps): React.JSX.Element;
98
+ type CommandInputProps = Omit<React.ComponentProps<typeof Command$1.Input>, "placeholder"> & {
99
+ /** What to type — passed translated. The input is named by the palette's `label`. */
100
+ placeholder: string;
101
+ /** After the input, inside the bar: a spinner, a clear button. */
102
+ trailing?: React.ReactNode;
103
+ };
104
+ /** The search field (`value` / `onValueChange` for the query), with a magnifier. */
105
+ declare function CommandInput({ className, placeholder, trailing, ...props }: CommandInputProps): React.JSX.Element;
106
+ type CommandListProps = React.ComponentProps<typeof Command$1.List> & {
107
+ /** The accessible name of the list of results — passed translated ("Suggestions", "Results"). */
108
+ label: string;
109
+ };
110
+ declare function CommandList({ className, ...props }: CommandListProps): React.JSX.Element;
111
+ type CommandEmptyProps = Omit<React.ComponentProps<typeof Command$1.Empty>, "children"> & {
112
+ /** Shown when nothing matches — passed translated. */
113
+ emptyLabel: React.ReactNode;
114
+ };
115
+ /** Shown by cmdk only when no item matches. */
116
+ declare function CommandEmpty({ className, emptyLabel, ...props }: CommandEmptyProps): React.JSX.Element;
117
+ /** While results load (`label` is announced). */
118
+ declare function CommandLoading({ className, ...props }: React.ComponentProps<typeof Command$1.Loading>): React.JSX.Element;
119
+ /** A group of items under a `heading`. */
120
+ declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof Command$1.Group>): React.JSX.Element;
121
+ /** An option: `onSelect` on Enter or click, `value` and `keywords` for the filter, `disabled`. */
122
+ declare function CommandItem({ className, ...props }: React.ComponentProps<typeof Command$1.Item>): React.JSX.Element;
123
+ /** A line between groups. Decorative (`role="none"`): cmdk's own separator is a role a listbox may not hold (axe). */
124
+ declare function CommandSeparator({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
125
+ /** A keyboard hint at the end of an item. */
126
+ declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
127
+ /** `Command.Root/Input/List/Empty/Loading/Group/Item/Separator/Shortcut`. */
128
+ declare const Command: {
129
+ Root: typeof CommandRoot;
130
+ Input: typeof CommandInput;
131
+ List: typeof CommandList;
132
+ Empty: typeof CommandEmpty;
133
+ Loading: typeof CommandLoading;
134
+ Group: typeof CommandGroup;
135
+ Item: typeof CommandItem;
136
+ Separator: typeof CommandSeparator;
137
+ Shortcut: typeof CommandShortcut;
138
+ };
139
+ type CommandDialogProps = Omit<CommandRootProps, "title"> & {
140
+ open?: boolean;
141
+ defaultOpen?: boolean;
142
+ onOpenChange?: (open: boolean) => void;
143
+ /** Under the palette, inside the dialog: shortcuts, a "see all results" link. */
144
+ footer?: React.ReactNode;
145
+ /** Passed to `Dialog.Content`: `size`, `container`, `className` of the dialog. */
146
+ contentProps?: Omit<Extract<DialogContentProps, {
147
+ hideClose: true;
148
+ }>, "hideClose" | "children" | "placement">;
149
+ };
150
+ /**
151
+ * The palette in a dialog (Radix: focus trap, Escape, focus return). The dialog is named by `label`; it has no close
152
+ * button — Escape and a click outside close it — and the input takes the focus when it opens.
153
+ */
154
+ declare function CommandDialog({ open, defaultOpen, onOpenChange, footer, contentProps, label, className, children, ...props }: CommandDialogProps): React.JSX.Element;
155
+
156
+ export { Command, CommandDialog, type CommandDialogProps, CommandEmpty, type CommandEmptyProps, CommandGroup, CommandInput, type CommandInputProps, CommandItem, CommandList, type CommandListProps, CommandLoading, CommandRoot, type CommandRootProps, CommandSeparator, CommandShortcut, command };
@@ -0,0 +1,111 @@
1
+ "use client";
2
+ import {
3
+ DialogContent
4
+ } from "./chunk-5FRYKFTO.js";
5
+ import "./chunk-QRG5RYEI.js";
6
+ import {
7
+ cn
8
+ } from "./chunk-5AXLA4LK.js";
9
+
10
+ // src/command/command.tsx
11
+ import { Command as CommandPrimitive } from "cmdk";
12
+ import { Dialog as DialogPrimitive } from "radix-ui";
13
+ import { tv } from "tailwind-variants";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ var command = tv({
16
+ slots: {
17
+ root: "flex h-full w-full flex-col overflow-hidden bg-surface-1 text-fg",
18
+ inputWrap: "flex items-center gap-3 border-b border-border-default px-4",
19
+ icon: "h-5 w-5 shrink-0 text-fg-secondary",
20
+ input: "h-13 w-full min-w-0 flex-1 bg-transparent text-sm text-fg outline-hidden placeholder:text-fg-muted disabled:cursor-not-allowed disabled:opacity-50 sm:text-base",
21
+ list: "max-h-[min(60dvh,26rem)] scroll-py-2 overflow-y-auto overscroll-contain p-2",
22
+ empty: "px-3 py-8 text-center text-sm text-fg-secondary",
23
+ loading: "px-3 py-6 text-center text-sm text-fg-secondary",
24
+ group: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pb-1.5 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-wider [&_[cmdk-group-heading]]:text-fg-secondary",
25
+ item: "relative flex cursor-pointer select-none items-center gap-3 rounded-lg px-3 py-2.5 text-sm text-fg outline-hidden transition-colors before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-transparent data-[selected=true]:bg-surface-2 data-[selected=true]:before:bg-accent data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-40",
26
+ separator: "-mx-2 my-1 h-px bg-border-subtle",
27
+ shortcut: "ml-auto text-xs tracking-widest text-fg-secondary"
28
+ }
29
+ });
30
+ var s = command();
31
+ function SearchIcon({ className }) {
32
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", className, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
33
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
34
+ /* @__PURE__ */ jsx("path", { d: "m20 20-3.5-3.5" })
35
+ ] });
36
+ }
37
+ function CommandRoot({ className, ...props }) {
38
+ return /* @__PURE__ */ jsx(CommandPrimitive, { className: s.root({ className }), ...props });
39
+ }
40
+ function CommandInput({ className, placeholder, trailing, ...props }) {
41
+ return /* @__PURE__ */ jsxs("div", { className: s.inputWrap(), "cmdk-input-wrapper": "", children: [
42
+ /* @__PURE__ */ jsx(SearchIcon, { className: s.icon() }),
43
+ /* @__PURE__ */ jsx(CommandPrimitive.Input, { placeholder, className: s.input({ className }), ...props }),
44
+ trailing
45
+ ] });
46
+ }
47
+ function CommandList({ className, ...props }) {
48
+ return /* @__PURE__ */ jsx(CommandPrimitive.List, { className: s.list({ className }), ...props });
49
+ }
50
+ function CommandEmpty({ className, emptyLabel, ...props }) {
51
+ return /* @__PURE__ */ jsx(CommandPrimitive.Empty, { className: s.empty({ className }), ...props, children: emptyLabel });
52
+ }
53
+ function CommandLoading({ className, ...props }) {
54
+ return /* @__PURE__ */ jsx(CommandPrimitive.Loading, { className: s.loading({ className }), ...props });
55
+ }
56
+ function CommandGroup({ className, ...props }) {
57
+ return /* @__PURE__ */ jsx(CommandPrimitive.Group, { className: s.group({ className }), ...props });
58
+ }
59
+ function CommandItem({ className, ...props }) {
60
+ return /* @__PURE__ */ jsx(CommandPrimitive.Item, { className: s.item({ className }), ...props });
61
+ }
62
+ function CommandSeparator({ className, ...props }) {
63
+ return /* @__PURE__ */ jsx("div", { role: "none", className: s.separator({ className }), ...props });
64
+ }
65
+ function CommandShortcut({ className, ...props }) {
66
+ return /* @__PURE__ */ jsx("span", { className: s.shortcut({ className }), ...props });
67
+ }
68
+ var Command = {
69
+ Root: CommandRoot,
70
+ Input: CommandInput,
71
+ List: CommandList,
72
+ Empty: CommandEmpty,
73
+ Loading: CommandLoading,
74
+ Group: CommandGroup,
75
+ Item: CommandItem,
76
+ Separator: CommandSeparator,
77
+ Shortcut: CommandShortcut
78
+ };
79
+ function CommandDialog({ open, defaultOpen, onOpenChange, footer, contentProps, label, className, children, ...props }) {
80
+ const { className: contentClassName, ...content } = contentProps ?? {};
81
+ return /* @__PURE__ */ jsx(DialogPrimitive.Root, { open, defaultOpen, onOpenChange, children: /* @__PURE__ */ jsxs(
82
+ DialogContent,
83
+ {
84
+ hideClose: true,
85
+ size: "lg",
86
+ "aria-describedby": void 0,
87
+ className: cn("top-[12dvh] translate-y-0 sm:top-[14dvh]", contentClassName),
88
+ ...content,
89
+ children: [
90
+ /* @__PURE__ */ jsx(DialogPrimitive.Title, { className: "sr-only", children: label }),
91
+ /* @__PURE__ */ jsx(CommandRoot, { label, className, ...props, children }),
92
+ footer
93
+ ]
94
+ }
95
+ ) });
96
+ }
97
+ export {
98
+ Command,
99
+ CommandDialog,
100
+ CommandEmpty,
101
+ CommandGroup,
102
+ CommandInput,
103
+ CommandItem,
104
+ CommandList,
105
+ CommandLoading,
106
+ CommandRoot,
107
+ CommandSeparator,
108
+ CommandShortcut,
109
+ command
110
+ };
111
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/command/command.tsx"],"sourcesContent":["// Client. A command palette on cmdk: the combobox / listbox roles, the active option (aria-activedescendant), the\n// arrows, Home / End, Enter, and the filtering (turn it off with `shouldFilter={false}` when the server searches).\n// `CommandDialog` puts it in the platform's Dialog. Words arrive as props.\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { cn } from \"../cn\";\nimport { DialogContent, type DialogContentProps } from \"../dialog/dialog\";\n\nexport const command = tv({\n slots: {\n root: \"flex h-full w-full flex-col overflow-hidden bg-surface-1 text-fg\",\n inputWrap: \"flex items-center gap-3 border-b border-border-default px-4\",\n icon: \"h-5 w-5 shrink-0 text-fg-secondary\",\n input:\n \"h-13 w-full min-w-0 flex-1 bg-transparent text-sm text-fg outline-hidden placeholder:text-fg-muted disabled:cursor-not-allowed disabled:opacity-50 sm:text-base\",\n list: \"max-h-[min(60dvh,26rem)] scroll-py-2 overflow-y-auto overscroll-contain p-2\",\n empty: \"px-3 py-8 text-center text-sm text-fg-secondary\",\n loading: \"px-3 py-6 text-center text-sm text-fg-secondary\",\n group:\n \"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pb-1.5 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-group-heading]]:text-xs \" +\n \"[&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-wider [&_[cmdk-group-heading]]:text-fg-secondary\",\n item:\n \"relative flex cursor-pointer select-none items-center gap-3 rounded-lg px-3 py-2.5 text-sm text-fg outline-hidden transition-colors \" +\n \"before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-transparent \" +\n \"data-[selected=true]:bg-surface-2 data-[selected=true]:before:bg-accent data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-40\",\n separator: \"-mx-2 my-1 h-px bg-border-subtle\",\n shortcut: \"ml-auto text-xs tracking-widest text-fg-secondary\",\n },\n});\nconst s = command();\n\nfunction SearchIcon({ className }: { className?: string }) {\n return (\n <svg viewBox=\"0 0 24 24\" className={className} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </svg>\n );\n}\n\nexport type CommandRootProps = React.ComponentProps<typeof CommandPrimitive> & {\n /** The accessible name of the palette — passed translated (\"Search\", \"Commands\"). */\n label: string;\n};\n\n/** The palette: `value` / `onValueChange` (the active item), `shouldFilter`, `filter`, `loop`. */\nexport function CommandRoot({ className, ...props }: CommandRootProps) {\n return <CommandPrimitive className={s.root({ className })} {...props} />;\n}\n\nexport type CommandInputProps = Omit<React.ComponentProps<typeof CommandPrimitive.Input>, \"placeholder\"> & {\n /** What to type — passed translated. The input is named by the palette's `label`. */\n placeholder: string;\n /** After the input, inside the bar: a spinner, a clear button. */\n trailing?: React.ReactNode;\n};\n\n/** The search field (`value` / `onValueChange` for the query), with a magnifier. */\nexport function CommandInput({ className, placeholder, trailing, ...props }: CommandInputProps) {\n return (\n <div className={s.inputWrap()} cmdk-input-wrapper=\"\">\n <SearchIcon className={s.icon()} />\n <CommandPrimitive.Input placeholder={placeholder} className={s.input({ className })} {...props} />\n {trailing}\n </div>\n );\n}\n\nexport type CommandListProps = React.ComponentProps<typeof CommandPrimitive.List> & {\n /** The accessible name of the list of results — passed translated (\"Suggestions\", \"Results\"). */\n label: string;\n};\n\nexport function CommandList({ className, ...props }: CommandListProps) {\n return <CommandPrimitive.List className={s.list({ className })} {...props} />;\n}\n\nexport type CommandEmptyProps = Omit<React.ComponentProps<typeof CommandPrimitive.Empty>, \"children\"> & {\n /** Shown when nothing matches — passed translated. */\n emptyLabel: React.ReactNode;\n};\n\n/** Shown by cmdk only when no item matches. */\nexport function CommandEmpty({ className, emptyLabel, ...props }: CommandEmptyProps) {\n return (\n <CommandPrimitive.Empty className={s.empty({ className })} {...props}>\n {emptyLabel}\n </CommandPrimitive.Empty>\n );\n}\n\n/** While results load (`label` is announced). */\nexport function CommandLoading({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Loading>) {\n return <CommandPrimitive.Loading className={s.loading({ className })} {...props} />;\n}\n\n/** A group of items under a `heading`. */\nexport function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return <CommandPrimitive.Group className={s.group({ className })} {...props} />;\n}\n\n/** An option: `onSelect` on Enter or click, `value` and `keywords` for the filter, `disabled`. */\nexport function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return <CommandPrimitive.Item className={s.item({ className })} {...props} />;\n}\n\n/** A line between groups. Decorative (`role=\"none\"`): cmdk's own separator is a role a listbox may not hold (axe). */\nexport function CommandSeparator({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div role=\"none\" className={s.separator({ className })} {...props} />;\n}\n\n/** A keyboard hint at the end of an item. */\nexport function CommandShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return <span className={s.shortcut({ className })} {...props} />;\n}\n\n/** `Command.Root/Input/List/Empty/Loading/Group/Item/Separator/Shortcut`. */\nexport const Command = {\n Root: CommandRoot,\n Input: CommandInput,\n List: CommandList,\n Empty: CommandEmpty,\n Loading: CommandLoading,\n Group: CommandGroup,\n Item: CommandItem,\n Separator: CommandSeparator,\n Shortcut: CommandShortcut,\n};\n\nexport type CommandDialogProps = Omit<CommandRootProps, \"title\"> & {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Under the palette, inside the dialog: shortcuts, a \"see all results\" link. */\n footer?: React.ReactNode;\n /** Passed to `Dialog.Content`: `size`, `container`, `className` of the dialog. */\n contentProps?: Omit<Extract<DialogContentProps, { hideClose: true }>, \"hideClose\" | \"children\" | \"placement\">;\n};\n\n/**\n * The palette in a dialog (Radix: focus trap, Escape, focus return). The dialog is named by `label`; it has no close\n * button — Escape and a click outside close it — and the input takes the focus when it opens.\n */\nexport function CommandDialog({ open, defaultOpen, onOpenChange, footer, contentProps, label, className, children, ...props }: CommandDialogProps) {\n const { className: contentClassName, ...content } = contentProps ?? {};\n return (\n <DialogPrimitive.Root open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n <DialogContent\n hideClose\n size=\"lg\"\n aria-describedby={undefined}\n className={cn(\"top-[12dvh] translate-y-0 sm:top-[14dvh]\", contentClassName)}\n {...content}\n >\n <DialogPrimitive.Title className=\"sr-only\">{label}</DialogPrimitive.Title>\n <CommandRoot label={label} className={className} {...props}>\n {children}\n </CommandRoot>\n {footer}\n </DialogContent>\n </DialogPrimitive.Root>\n );\n}\n"],"mappings":";;;;;;;;;;AAGA,SAAS,WAAW,wBAAwB;AAC5C,SAAS,UAAU,uBAAuB;AAE1C,SAAS,UAAU;AA8Bf,SACE,KADF;AAzBG,IAAM,UAAU,GAAG;AAAA,EACxB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,WAAW;AAAA,IACX,MAAM;AAAA,IACN,OACE;AAAA,IACF,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OACE;AAAA,IAEF,MACE;AAAA,IAGF,WAAW;AAAA,IACX,UAAU;AAAA,EACZ;AACF,CAAC;AACD,IAAM,IAAI,QAAQ;AAElB,SAAS,WAAW,EAAE,UAAU,GAA2B;AACzD,SACE,qBAAC,SAAI,SAAQ,aAAY,WAAsB,MAAK,QAAO,QAAO,gBAAe,aAAY,KAAI,eAAc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
+ declare const confirmArmed = "border border-danger bg-danger/20 text-fg hover:border-danger hover:bg-danger/30";
6
+ type ConfirmButtonProps = Omit<ButtonProps, "onClick" | "asChild"> & {
7
+ /** What the second press does, in words — shown and announced once armed ("Delete for good?"). Passed translated. */
8
+ confirmLabel: string;
9
+ /** The accessible name while idle, for an icon-only button (the confirm label names it once armed). */
10
+ label?: string;
11
+ /** Runs on the second press. */
12
+ onConfirm: () => void;
13
+ /** Disarms after this many milliseconds (4000 by default). */
14
+ timeoutMs?: number;
15
+ /** What it shows once armed (default: its children, then `confirmLabel`). */
16
+ armedContent?: React.ReactNode;
17
+ /** Notified when it arms and disarms. */
18
+ onArmedChange?: (armed: boolean) => void;
19
+ };
20
+ /** A two-step button: press to arm, press again within `timeoutMs` to confirm. State: `data-armed`. */
21
+ declare function ConfirmButton({ confirmLabel, label, onConfirm, timeoutMs, onArmedChange, armedContent, variant, className, children, onBlur, onKeyDown, ...props }: ConfirmButtonProps): React.JSX.Element;
22
+
23
+ export { ConfirmButton, type ConfirmButtonProps, confirmArmed };
@@ -0,0 +1,85 @@
1
+ "use client";
2
+ import {
3
+ Button
4
+ } from "./chunk-QRG5RYEI.js";
5
+ import {
6
+ cn
7
+ } from "./chunk-5AXLA4LK.js";
8
+
9
+ // src/confirm-button/confirm-button.tsx
10
+ import { VisuallyHidden } from "radix-ui";
11
+ import * as React from "react";
12
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ var confirmArmed = "border border-danger bg-danger/20 text-fg hover:border-danger hover:bg-danger/30";
14
+ function ConfirmButton({
15
+ confirmLabel,
16
+ label,
17
+ onConfirm,
18
+ timeoutMs = 4e3,
19
+ onArmedChange,
20
+ armedContent,
21
+ variant = "ghost",
22
+ className,
23
+ children,
24
+ onBlur,
25
+ onKeyDown,
26
+ ...props
27
+ }) {
28
+ const [armed, setArmedState] = React.useState(false);
29
+ const armedRef = React.useRef(false);
30
+ const onArmedChangeRef = React.useRef(onArmedChange);
31
+ React.useEffect(() => {
32
+ onArmedChangeRef.current = onArmedChange;
33
+ }, [onArmedChange]);
34
+ const setArmed = React.useCallback((next) => {
35
+ if (armedRef.current === next) return;
36
+ armedRef.current = next;
37
+ setArmedState(next);
38
+ onArmedChangeRef.current?.(next);
39
+ }, []);
40
+ React.useEffect(() => {
41
+ if (!armed) return;
42
+ const timer = window.setTimeout(() => setArmed(false), timeoutMs);
43
+ return () => window.clearTimeout(timer);
44
+ }, [armed, timeoutMs, setArmed]);
45
+ const name = armed ? confirmLabel : label;
46
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ /* @__PURE__ */ jsx(
48
+ Button,
49
+ {
50
+ variant,
51
+ "aria-label": name,
52
+ title: name,
53
+ "data-armed": armed ? "" : void 0,
54
+ className: cn(armed && confirmArmed, className),
55
+ onClick: () => {
56
+ if (!armed) return setArmed(true);
57
+ setArmed(false);
58
+ onConfirm();
59
+ },
60
+ onBlur: (event) => {
61
+ onBlur?.(event);
62
+ setArmed(false);
63
+ },
64
+ onKeyDown: (event) => {
65
+ onKeyDown?.(event);
66
+ if (armed && event.key === "Escape") {
67
+ event.stopPropagation();
68
+ setArmed(false);
69
+ }
70
+ },
71
+ ...props,
72
+ children: armed ? armedContent ?? /* @__PURE__ */ jsxs(Fragment, { children: [
73
+ children,
74
+ /* @__PURE__ */ jsx("span", { children: confirmLabel })
75
+ ] }) : children
76
+ }
77
+ ),
78
+ /* @__PURE__ */ jsx(VisuallyHidden.Root, { "aria-live": "polite", children: armed ? confirmLabel : "" })
79
+ ] });
80
+ }
81
+ export {
82
+ ConfirmButton,
83
+ confirmArmed
84
+ };
85
+ //# sourceMappingURL=confirm-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/confirm-button/confirm-button.tsx"],"sourcesContent":["// Client (a state). A destructive action confirmed by a second press, never `window.confirm`: the first press arms it\n// and says what will happen (`confirmLabel`, announced politely), the second runs `onConfirm`. It disarms by itself\n// after `timeoutMs`, on Escape, and when the focus leaves. The danger is the border and the tint; the words stay a\n// text role (contrast AA in both themes).\nimport { VisuallyHidden } from \"radix-ui\";\nimport * as React from \"react\";\n\nimport { Button, type ButtonProps } from \"../button/button\";\nimport { cn } from \"../cn\";\n\nexport const confirmArmed = \"border border-danger bg-danger/20 text-fg hover:border-danger hover:bg-danger/30\";\n\nexport type ConfirmButtonProps = Omit<ButtonProps, \"onClick\" | \"asChild\"> & {\n /** What the second press does, in words — shown and announced once armed (\"Delete for good?\"). Passed translated. */\n confirmLabel: string;\n /** The accessible name while idle, for an icon-only button (the confirm label names it once armed). */\n label?: string;\n /** Runs on the second press. */\n onConfirm: () => void;\n /** Disarms after this many milliseconds (4000 by default). */\n timeoutMs?: number;\n /** What it shows once armed (default: its children, then `confirmLabel`). */\n armedContent?: React.ReactNode;\n /** Notified when it arms and disarms. */\n onArmedChange?: (armed: boolean) => void;\n};\n\n/** A two-step button: press to arm, press again within `timeoutMs` to confirm. State: `data-armed`. */\nexport function ConfirmButton({\n confirmLabel,\n label,\n onConfirm,\n timeoutMs = 4000,\n onArmedChange,\n armedContent,\n variant = \"ghost\",\n className,\n children,\n onBlur,\n onKeyDown,\n ...props\n}: ConfirmButtonProps) {\n const [armed, setArmedState] = React.useState(false);\n const armedRef = React.useRef(false);\n const onArmedChangeRef = React.useRef(onArmedChange);\n React.useEffect(() => {\n onArmedChangeRef.current = onArmedChange;\n }, [onArmedChange]);\n const setArmed = React.useCallback((next: boolean) => {\n if (armedRef.current === next) return;\n armedRef.current = next;\n setArmedState(next);\n onArmedChangeRef.current?.(next);\n }, []);\n React.useEffect(() => {\n if (!armed) return;\n const timer = window.setTimeout(() => setArmed(false), timeoutMs);\n return () => window.clearTimeout(timer);\n }, [armed, timeoutMs, setArmed]);\n const name = armed ? confirmLabel : label;\n return (\n <>\n <Button\n variant={variant}\n aria-label={name}\n title={name}\n data-armed={armed ? \"\" : undefined}\n className={cn(armed && confirmArmed, className)}\n onClick={() => {\n if (!armed) return setArmed(true);\n setArmed(false);\n onConfirm();\n }}\n onBlur={(event) => {\n onBlur?.(event);\n setArmed(false);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (armed && event.key === \"Escape\") {\n event.stopPropagation();\n setArmed(false);\n }\n }}\n {...props}\n >\n {armed\n ? (armedContent ?? (\n <>\n {children}\n <span>{confirmLabel}</span>\n </>\n ))\n : children}\n </Button>\n <VisuallyHidden.Root aria-live=\"polite\">{armed ? confirmLabel : \"\"}</VisuallyHidden.Root>\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAIA,SAAS,sBAAsB;AAC/B,YAAY,WAAW;AAmFT,mBAEE,KAFF;AA9EP,IAAM,eAAe;AAkBrB,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAuB;AACrB,QAAM,CAAC,OAAO,aAAa,IAAU,eAAS,KAAK;AACnD,QAAM,WAAiB,aAAO,KAAK;AACnC,QAAM,mBAAyB,aAAO,aAAa;AACnD,EAAM,gBAAU,MAAM;AACpB,qBAAiB,UAAU;AAAA,EAC7B,GAAG,CAAC,aAAa,CAAC;AAClB,QAAM,WAAiB,kBAAY,CAAC,SAAkB;AACpD,QAAI,SAAS,YAAY,KAAM;AAC/B,aAAS,UAAU;AACnB,kBAAc,IAAI;AAClB,qBAAiB,UAAU,IAAI;AAAA,EACjC,GAAG,CAAC,CAAC;AACL,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,MAAO;AACZ,UAAM,QAAQ,OAAO,WAAW,MAAM,SAAS,KAAK,GAAG,SAAS;AAChE,WAAO,MAAM,OAAO,aAAa,KAAK;AAAA,EACxC,GAAG,CAAC,OAAO,WAAW,QAAQ,CAAC;AAC/B,QAAM,OAAO,QAAQ,eAAe;AACpC,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAY;AAAA,QACZ,OAAO;AAAA,QACP,cAAY,QAAQ,KAAK;AAAA,QACzB,WAAW,GAAG,SAAS,cAAc,SAAS;AAAA,QAC9C,SAAS,MAAM;AACb,cAAI,CAAC,MAAO,QAAO,SAAS,IAAI;AAChC,mBAAS,KAAK;AACd,oBAAU;AAAA,QACZ;AAAA,QACA,QAAQ,CAAC,UAAU;AACjB,mBAAS,KAAK;AACd,mBAAS,KAAK;AAAA,QAChB;AAAA,QACA,WAAW,CAAC,UAAU;AACpB,sBAAY,KAAK;AACjB,cAAI,SAAS,MAAM,QAAQ,UAAU;AACnC,kBAAM,gBAAgB;AACtB,qBAAS,KAAK;AAAA,UAChB;AAAA,QACF;AAAA,QACC,GAAG;AAAA,QAEH,kBACI,gBACC,iCACG;AAAA;AAAA,UACD,oBAAC,UAAM,wBAAa;AAAA,WACtB,IAEF;AAAA;AAAA,IACN;AAAA,IACA,oBAAC,eAAe,MAAf,EAAoB,aAAU,UAAU,kBAAQ,eAAe,IAAG;AAAA,KACrE;AAEJ;","names":[]}
@@ -0,0 +1,147 @@
1
+ import * as tailwind_variants from 'tailwind-variants';
2
+ import { VariantProps } from 'tailwind-variants';
3
+ import { Dialog as Dialog$1 } from 'radix-ui';
4
+ import * as React from 'react';
5
+
6
+ declare const dialog: tailwind_variants.TVReturnType<{
7
+ placement: {
8
+ center: {
9
+ content: string;
10
+ };
11
+ bottom: {
12
+ content: string;
13
+ };
14
+ right: {
15
+ content: string;
16
+ };
17
+ };
18
+ size: {
19
+ sm: {
20
+ content: string;
21
+ };
22
+ md: {
23
+ content: string;
24
+ };
25
+ lg: {
26
+ content: string;
27
+ };
28
+ };
29
+ }, {
30
+ overlay: string;
31
+ content: string;
32
+ close: string;
33
+ header: string;
34
+ title: string;
35
+ description: string;
36
+ body: string;
37
+ footer: string;
38
+ }, undefined, {
39
+ placement: {
40
+ center: {
41
+ content: string;
42
+ };
43
+ bottom: {
44
+ content: string;
45
+ };
46
+ right: {
47
+ content: string;
48
+ };
49
+ };
50
+ size: {
51
+ sm: {
52
+ content: string;
53
+ };
54
+ md: {
55
+ content: string;
56
+ };
57
+ lg: {
58
+ content: string;
59
+ };
60
+ };
61
+ }, {
62
+ overlay: string;
63
+ content: string;
64
+ close: string;
65
+ header: string;
66
+ title: string;
67
+ description: string;
68
+ body: string;
69
+ footer: string;
70
+ }, tailwind_variants.TVReturnTypeLike<{
71
+ placement: {
72
+ center: {
73
+ content: string;
74
+ };
75
+ bottom: {
76
+ content: string;
77
+ };
78
+ right: {
79
+ content: string;
80
+ };
81
+ };
82
+ size: {
83
+ sm: {
84
+ content: string;
85
+ };
86
+ md: {
87
+ content: string;
88
+ };
89
+ lg: {
90
+ content: string;
91
+ };
92
+ };
93
+ }, {
94
+ overlay: string;
95
+ content: string;
96
+ close: string;
97
+ header: string;
98
+ title: string;
99
+ description: string;
100
+ body: string;
101
+ footer: string;
102
+ }>>;
103
+ type DialogVariants = VariantProps<typeof dialog>;
104
+ type CloseButtonProps = {
105
+ /** The accessible name of the close button — passed translated. */
106
+ closeLabel: string;
107
+ /** Leaves the close button out (the content brings its own way out, or none: see `dismissible`). */
108
+ hideClose?: false;
109
+ } | {
110
+ closeLabel?: string;
111
+ hideClose: true;
112
+ };
113
+ type DialogContentProps = React.ComponentProps<typeof Dialog$1.Content> & DialogVariants & CloseButtonProps & {
114
+ /**
115
+ * `false`: Escape and a click outside do not close it (a gate the user must answer: age, terms). It still closes
116
+ * through `open` / `onOpenChange` and any `Dialog.Close` inside. Default `true`.
117
+ */
118
+ dismissible?: boolean;
119
+ /** The element the portal renders into (default: document.body). */
120
+ container?: HTMLElement | null;
121
+ };
122
+ /** The dialog itself, portalled over a dimmed overlay, with a close button. Give it a `Dialog.Title`. */
123
+ declare function DialogContent({ placement, size, closeLabel, hideClose, dismissible, container, className, children, onEscapeKeyDown, onPointerDownOutside, onInteractOutside, ...props }: DialogContentProps): React.JSX.Element;
124
+ declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
125
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof Dialog$1.Title>): React.JSX.Element;
126
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof Dialog$1.Description>): React.JSX.Element;
127
+ declare function DialogBody({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
128
+ declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
129
+ /** `Dialog.Root/Trigger/Content/Header/Title/Description/Body/Footer/Close`. `open`/`defaultOpen` + `onOpenChange`. */
130
+ declare const Dialog: {
131
+ Root: React.FC<Dialog$1.DialogProps>;
132
+ Trigger: React.ForwardRefExoticComponent<Dialog$1.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
133
+ Close: React.ForwardRefExoticComponent<Dialog$1.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
134
+ Content: typeof DialogContent;
135
+ Header: typeof DialogHeader;
136
+ Title: typeof DialogTitle;
137
+ Description: typeof DialogDescription;
138
+ Body: typeof DialogBody;
139
+ Footer: typeof DialogFooter;
140
+ };
141
+ /** `Omit` that keeps the close-button union (`closeLabel` required unless `hideClose`). */
142
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
143
+ type SheetProps = DistributiveOmit<DialogContentProps, "placement">;
144
+ /** A sheet is a dialog anchored at the bottom (centred from `sm` up): `Dialog.Content placement="bottom"`. */
145
+ declare function Sheet(props: SheetProps): React.JSX.Element;
146
+
147
+ export { type DialogContentProps as D, Sheet as S, Dialog as a, DialogBody as b, DialogContent as c, DialogDescription as d, DialogFooter as e, DialogHeader as f, DialogTitle as g, type DialogVariants as h, type SheetProps as i, dialog as j };