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

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 (210) hide show
  1. package/README.md +44 -3
  2. package/dist/alert.d.ts +2 -0
  3. package/dist/alert.js.map +1 -1
  4. package/dist/avatar.d.ts +5 -0
  5. package/dist/avatar.js.map +1 -1
  6. package/dist/badge.d.ts +12 -0
  7. package/dist/badge.js.map +1 -1
  8. package/dist/button-8La7l0V4.d.ts +83 -0
  9. package/dist/button.d.ts +19 -0
  10. package/dist/button.js.map +1 -1
  11. package/dist/card.d.ts +24 -1
  12. package/dist/card.js +1 -1
  13. package/dist/card.js.map +1 -1
  14. package/dist/checkbox.d.ts +52 -0
  15. package/dist/checkbox.js +42 -0
  16. package/dist/checkbox.js.map +1 -0
  17. package/dist/chip.d.ts +120 -0
  18. package/dist/chip.js +93 -0
  19. package/dist/chip.js.map +1 -0
  20. package/dist/chunk-3X5MVH54.js +121 -0
  21. package/dist/chunk-3X5MVH54.js.map +1 -0
  22. package/dist/{chunk-RLOXWF2G.js → chunk-5AXLA4LK.js} +1 -1
  23. package/dist/chunk-5AXLA4LK.js.map +1 -0
  24. package/dist/{chunk-CPMZS4XA.js → chunk-FJDSLNXK.js} +1 -1
  25. package/dist/chunk-FJDSLNXK.js.map +1 -0
  26. package/dist/{chunk-QRG5RYEI.js → chunk-ZUD4U22H.js} +1 -1
  27. package/dist/chunk-ZUD4U22H.js.map +1 -0
  28. package/dist/cn.d.ts +3 -0
  29. package/dist/cn.js +1 -1
  30. package/dist/command.d.ts +159 -0
  31. package/dist/command.js +111 -0
  32. package/dist/command.js.map +1 -0
  33. package/dist/confirm-button.d.ts +23 -0
  34. package/dist/confirm-button.js +85 -0
  35. package/dist/confirm-button.js.map +1 -0
  36. package/dist/countdown.d.ts +3 -0
  37. package/dist/countdown.js.map +1 -1
  38. package/dist/dialog-GQ4Nvuyf.d.ts +157 -0
  39. package/dist/dialog.d.ts +12 -131
  40. package/dist/dialog.js +27 -91
  41. package/dist/dialog.js.map +1 -1
  42. package/dist/dropdown-menu.d.ts +1 -0
  43. package/dist/dropdown-menu.js +1 -1
  44. package/dist/dropdown-menu.js.map +1 -1
  45. package/dist/empty-state.d.ts +2 -0
  46. package/dist/empty-state.js.map +1 -1
  47. package/dist/field.js +1 -1
  48. package/dist/kbd.d.ts +7 -1
  49. package/dist/kbd.js.map +1 -1
  50. package/dist/motion.css +7 -1
  51. package/dist/page-header.d.ts +2 -0
  52. package/dist/page-header.js.map +1 -1
  53. package/dist/popover.js +1 -1
  54. package/dist/progress.d.ts +92 -0
  55. package/dist/progress.js +85 -0
  56. package/dist/progress.js.map +1 -0
  57. package/dist/radio-group.d.ts +77 -0
  58. package/dist/radio-group.js +48 -0
  59. package/dist/radio-group.js.map +1 -0
  60. package/dist/skeleton.d.ts +7 -1
  61. package/dist/skeleton.js.map +1 -1
  62. package/dist/slider.d.ts +90 -0
  63. package/dist/slider.js +82 -0
  64. package/dist/slider.js.map +1 -0
  65. package/dist/spinner.d.ts +5 -0
  66. package/dist/spinner.js.map +1 -1
  67. package/dist/stat.d.ts +2 -0
  68. package/dist/stat.js.map +1 -1
  69. package/dist/switch.d.ts +76 -0
  70. package/dist/switch.js +38 -0
  71. package/dist/switch.js.map +1 -0
  72. package/dist/tabs.d.ts +86 -0
  73. package/dist/tabs.js +60 -0
  74. package/dist/tabs.js.map +1 -0
  75. package/dist/theme.d.ts +11 -60
  76. package/dist/theme.js +4 -2
  77. package/dist/theme.js.map +1 -1
  78. package/dist/toast.js +1 -1
  79. package/dist/tooltip.d.ts +3 -0
  80. package/dist/tooltip.js +1 -1
  81. package/dist/tooltip.js.map +1 -1
  82. package/package.json +146 -6
  83. package/registry/alert.json +59 -0
  84. package/registry/avatar.json +114 -0
  85. package/registry/badge.json +59 -0
  86. package/registry/button.json +115 -0
  87. package/registry/card.json +154 -0
  88. package/registry/checkbox.json +46 -0
  89. package/registry/chip.json +164 -0
  90. package/registry/cn.json +21 -0
  91. package/registry/command.json +162 -0
  92. package/registry/confirm-button.json +104 -0
  93. package/registry/countdown.json +84 -0
  94. package/registry/demos/alert.d.ts +5 -0
  95. package/registry/demos/alert.js +12 -0
  96. package/registry/demos/alert.tsx +15 -0
  97. package/registry/demos/avatar.d.ts +5 -0
  98. package/registry/demos/avatar.js +14 -0
  99. package/registry/demos/avatar.tsx +13 -0
  100. package/registry/demos/badge.d.ts +5 -0
  101. package/registry/demos/badge.js +11 -0
  102. package/registry/demos/badge.tsx +5 -0
  103. package/registry/demos/button.d.ts +5 -0
  104. package/registry/demos/button.js +11 -0
  105. package/registry/demos/button.tsx +5 -0
  106. package/registry/demos/card.d.ts +5 -0
  107. package/registry/demos/card.js +30 -0
  108. package/registry/demos/card.tsx +37 -0
  109. package/registry/demos/checkbox.d.ts +5 -0
  110. package/registry/demos/checkbox.js +11 -0
  111. package/registry/demos/checkbox.tsx +5 -0
  112. package/registry/demos/chip.d.ts +5 -0
  113. package/registry/demos/chip.js +15 -0
  114. package/registry/demos/chip.tsx +11 -0
  115. package/registry/demos/cn.d.ts +7 -0
  116. package/registry/demos/cn.js +17 -0
  117. package/registry/demos/cn.tsx +9 -0
  118. package/registry/demos/command.d.ts +5 -0
  119. package/registry/demos/command.js +32 -0
  120. package/registry/demos/command.tsx +28 -0
  121. package/registry/demos/confirm-button.d.ts +5 -0
  122. package/registry/demos/confirm-button.js +12 -0
  123. package/registry/demos/confirm-button.tsx +13 -0
  124. package/registry/demos/countdown.d.ts +5 -0
  125. package/registry/demos/countdown.js +13 -0
  126. package/registry/demos/countdown.tsx +10 -0
  127. package/registry/demos/dialog.d.ts +7 -0
  128. package/registry/demos/dialog.js +29 -0
  129. package/registry/demos/dialog.tsx +31 -0
  130. package/registry/demos/dropdown-menu.d.ts +7 -0
  131. package/registry/demos/dropdown-menu.js +36 -0
  132. package/registry/demos/dropdown-menu.tsx +27 -0
  133. package/registry/demos/empty-state.d.ts +5 -0
  134. package/registry/demos/empty-state.js +15 -0
  135. package/registry/demos/empty-state.tsx +12 -0
  136. package/registry/demos/field.d.ts +5 -0
  137. package/registry/demos/field.js +15 -0
  138. package/registry/demos/field.tsx +11 -0
  139. package/registry/demos/kbd.d.ts +5 -0
  140. package/registry/demos/kbd.js +11 -0
  141. package/registry/demos/kbd.tsx +5 -0
  142. package/registry/demos/page-header.d.ts +5 -0
  143. package/registry/demos/page-header.js +11 -0
  144. package/registry/demos/page-header.tsx +5 -0
  145. package/registry/demos/popover.d.ts +7 -0
  146. package/registry/demos/popover.js +25 -0
  147. package/registry/demos/popover.tsx +31 -0
  148. package/registry/demos/progress.d.ts +5 -0
  149. package/registry/demos/progress.js +11 -0
  150. package/registry/demos/progress.tsx +5 -0
  151. package/registry/demos/radio-group.d.ts +5 -0
  152. package/registry/demos/radio-group.js +16 -0
  153. package/registry/demos/radio-group.tsx +14 -0
  154. package/registry/demos/separator.d.ts +5 -0
  155. package/registry/demos/separator.js +15 -0
  156. package/registry/demos/separator.tsx +11 -0
  157. package/registry/demos/skeleton.d.ts +5 -0
  158. package/registry/demos/skeleton.js +20 -0
  159. package/registry/demos/skeleton.tsx +16 -0
  160. package/registry/demos/slider.d.ts +5 -0
  161. package/registry/demos/slider.js +11 -0
  162. package/registry/demos/slider.tsx +5 -0
  163. package/registry/demos/slot.d.ts +5 -0
  164. package/registry/demos/slot.js +14 -0
  165. package/registry/demos/slot.tsx +13 -0
  166. package/registry/demos/spinner.d.ts +5 -0
  167. package/registry/demos/spinner.js +11 -0
  168. package/registry/demos/spinner.tsx +5 -0
  169. package/registry/demos/stat.d.ts +5 -0
  170. package/registry/demos/stat.js +11 -0
  171. package/registry/demos/stat.tsx +5 -0
  172. package/registry/demos/switch.d.ts +5 -0
  173. package/registry/demos/switch.js +11 -0
  174. package/registry/demos/switch.tsx +5 -0
  175. package/registry/demos/tabs.d.ts +5 -0
  176. package/registry/demos/tabs.js +22 -0
  177. package/registry/demos/tabs.tsx +28 -0
  178. package/registry/demos/theme.d.ts +5 -0
  179. package/registry/demos/theme.js +11 -0
  180. package/registry/demos/theme.tsx +9 -0
  181. package/registry/demos/toast.d.ts +8 -0
  182. package/registry/demos/toast.js +29 -0
  183. package/registry/demos/toast.tsx +31 -0
  184. package/registry/demos/tooltip.d.ts +7 -0
  185. package/registry/demos/tooltip.js +15 -0
  186. package/registry/demos/tooltip.tsx +15 -0
  187. package/registry/dialog.json +218 -0
  188. package/registry/dropdown-menu.json +63 -0
  189. package/registry/empty-state.json +59 -0
  190. package/registry/field.json +66 -0
  191. package/registry/index.json +320 -0
  192. package/registry/kbd.json +38 -0
  193. package/registry/page-header.json +66 -0
  194. package/registry/popover.json +44 -0
  195. package/registry/progress.json +80 -0
  196. package/registry/radio-group.json +64 -0
  197. package/registry/separator.json +25 -0
  198. package/registry/skeleton.json +38 -0
  199. package/registry/slider.json +95 -0
  200. package/registry/slot.json +31 -0
  201. package/registry/spinner.json +45 -0
  202. package/registry/stat.json +66 -0
  203. package/registry/switch.json +53 -0
  204. package/registry/tabs.json +44 -0
  205. package/registry/theme.json +78 -0
  206. package/registry/toast.json +54 -0
  207. package/registry/tooltip.json +91 -0
  208. package/dist/chunk-CPMZS4XA.js.map +0 -1
  209. package/dist/chunk-QRG5RYEI.js.map +0 -1
  210. package/dist/chunk-RLOXWF2G.js.map +0 -1
package/dist/chip.d.ts ADDED
@@ -0,0 +1,120 @@
1
+ import * as tailwind_variants from 'tailwind-variants';
2
+ import { VariantProps } from 'tailwind-variants';
3
+ import * as React from 'react';
4
+
5
+ declare const chip: tailwind_variants.TVReturnType<{
6
+ size: {
7
+ sm: {
8
+ base: string;
9
+ };
10
+ md: {
11
+ base: string;
12
+ };
13
+ };
14
+ }, {
15
+ group: string;
16
+ base: string;
17
+ remove: string;
18
+ }, undefined, {
19
+ size: {
20
+ sm: {
21
+ base: string;
22
+ };
23
+ md: {
24
+ base: string;
25
+ };
26
+ };
27
+ }, {
28
+ group: string;
29
+ base: string;
30
+ remove: string;
31
+ }, tailwind_variants.TVReturnTypeLike<{
32
+ size: {
33
+ sm: {
34
+ base: string;
35
+ };
36
+ md: {
37
+ base: string;
38
+ };
39
+ };
40
+ }, {
41
+ group: string;
42
+ base: string;
43
+ remove: string;
44
+ }>>;
45
+ type ChipVariants = VariantProps<typeof chip>;
46
+ type ToggleChipProps = Omit<React.ComponentProps<"button">, "value" | "defaultValue"> & ChipVariants & {
47
+ /**
48
+ * sm · md (inside `Chip.Group`, the group's size by default).
49
+ * @default "md"
50
+ */
51
+ size?: ChipVariants["size"];
52
+ /** Inside `Chip.Group`: the value this chip stands for (required there, ignored alone). */
53
+ value?: string;
54
+ /** Alone: pressed or not (`defaultSelected` uncontrolled), `onSelectedChange` on every press. */
55
+ selected?: boolean;
56
+ /** Alone: pressed at first, uncontrolled. */
57
+ defaultSelected?: boolean;
58
+ /** Alone: called with the new state on every press. */
59
+ onSelectedChange?: (selected: boolean) => void;
60
+ /** A pressable chip (the default); `true` makes it a static chip with a remove button. */
61
+ removable?: false;
62
+ };
63
+ type RemovableChipProps = Omit<React.ComponentProps<"span">, "onSelect"> & ChipVariants & {
64
+ /** A static chip (a chosen tag, an applied filter) with a remove button. */
65
+ removable: true;
66
+ /** The accessible name of the remove button — passed translated, e.g. "Remove #night". */
67
+ removeLabel: string;
68
+ /** Runs when the remove button is pressed. */
69
+ onRemove: () => void;
70
+ /** Disables the remove button. */
71
+ disabled?: boolean;
72
+ };
73
+ type ChipProps = ToggleChipProps | RemovableChipProps;
74
+ /** A selectable pill (`selected` / `onSelectedChange`), an item of `Chip.Group` (`value`), or `removable`. */
75
+ declare function ChipBase(props: ChipProps): React.JSX.Element;
76
+ type GroupBase = Omit<React.ComponentProps<"div">, "defaultValue" | "dir"> & ChipVariants & {
77
+ /**
78
+ * sm · md: the size of every chip of the group.
79
+ * @default "md"
80
+ */
81
+ size?: ChipVariants["size"];
82
+ /** The group's accessible name — passed translated ("Filter by format"). */
83
+ label?: string;
84
+ /** The arrow keys that move: left / right (horizontal, a row) or up / down (vertical, a column). */
85
+ orientation?: "horizontal" | "vertical";
86
+ /** Arrow keys wrap from the last chip to the first (default `true`). */
87
+ loop?: boolean;
88
+ /** Disables every chip of the group. */
89
+ disabled?: boolean;
90
+ };
91
+ type ChipGroupProps = (GroupBase & {
92
+ /** One choice: the chips behave as radios. */
93
+ type: "single";
94
+ /** The chosen value (controlled), `""` when none. */
95
+ value?: string;
96
+ /** The value chosen at first, uncontrolled. */
97
+ defaultValue?: string;
98
+ /** Called with the new value on every choice. */
99
+ onValueChange?: (value: string) => void;
100
+ /** Keeps one chip selected: pressing the selected chip does not clear it (default `false`). */
101
+ required?: boolean;
102
+ }) | (GroupBase & {
103
+ /** Any number of choices: the chips are pressed buttons. */
104
+ type: "multiple";
105
+ /** The chosen values (controlled). */
106
+ value?: string[];
107
+ /** The values chosen at first, uncontrolled. */
108
+ defaultValue?: string[];
109
+ /** Called with the new values on every press. */
110
+ onValueChange?: (value: string[]) => void;
111
+ required?: never;
112
+ });
113
+ /** Chips that choose together: `type` single · multiple, `value`/`defaultValue` + `onValueChange`. */
114
+ declare function ChipGroup({ label, size, className, children, ...props }: ChipGroupProps): React.JSX.Element;
115
+ /** `Chip` (selectable, removable) and `Chip.Group` (single · multiple). */
116
+ declare const Chip: typeof ChipBase & {
117
+ Group: typeof ChipGroup;
118
+ };
119
+
120
+ export { Chip, ChipGroup, type ChipGroupProps, type ChipProps, type ChipVariants, chip };
package/dist/chip.js ADDED
@@ -0,0 +1,93 @@
1
+ "use client";
2
+
3
+ // src/chip/chip.tsx
4
+ import { Toggle as TogglePrimitive, ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
5
+ import * as React from "react";
6
+ import { tv } from "tailwind-variants";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var chip = tv({
9
+ slots: {
10
+ group: "flex flex-wrap items-center gap-2 data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",
11
+ base: "inline-flex shrink-0 select-none items-center justify-center gap-1.5 whitespace-nowrap rounded-full border font-semibold transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40 border-border-default bg-surface-1 text-fg-secondary hover:border-border-strong hover:text-fg data-[state=on]:border-accent data-[state=on]:bg-accent-soft data-[state=on]:text-fg",
12
+ remove: "-mr-1.5 inline-flex h-6 w-6 items-center justify-center rounded-full text-fg-secondary transition-colors hover:bg-surface-3 hover:text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
13
+ },
14
+ variants: {
15
+ size: { sm: { base: "h-7 px-3 text-xs" }, md: { base: "h-9 px-3.5 text-xs" } }
16
+ },
17
+ defaultVariants: { size: "md" }
18
+ });
19
+ var ChipGroupContext = React.createContext(null);
20
+ function RemoveIcon() {
21
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) });
22
+ }
23
+ function ChipBase(props) {
24
+ const group = React.useContext(ChipGroupContext);
25
+ if (props.removable) {
26
+ const { removable: _removable2, removeLabel, onRemove, disabled, size: size2, className: className2, children, ...rest2 } = props;
27
+ const s2 = chip({ size: size2 ?? group?.size });
28
+ return /* @__PURE__ */ jsxs("span", { "data-removable": "", className: s2.base({ className: className2 }), ...rest2, children: [
29
+ children,
30
+ /* @__PURE__ */ jsx("button", { type: "button", "aria-label": removeLabel, title: removeLabel, disabled, onClick: onRemove, className: s2.remove(), children: /* @__PURE__ */ jsx(RemoveIcon, {}) })
31
+ ] });
32
+ }
33
+ const { removable: _removable, value, selected, defaultSelected, onSelectedChange, size, className, ...rest } = props;
34
+ const s = chip({ size: size ?? group?.size });
35
+ if (group) {
36
+ if (value === void 0) throw new Error("Chip: a chip inside Chip.Group needs a `value`.");
37
+ return /* @__PURE__ */ jsx(ToggleGroupPrimitive.Item, { value, className: s.base({ className }), ...rest });
38
+ }
39
+ return /* @__PURE__ */ jsx(
40
+ TogglePrimitive.Root,
41
+ {
42
+ pressed: selected,
43
+ defaultPressed: defaultSelected,
44
+ onPressedChange: onSelectedChange,
45
+ className: s.base({ className }),
46
+ ...rest
47
+ }
48
+ );
49
+ }
50
+ function ChipGroup({ label, size, className, children, ...props }) {
51
+ const s = chip({ size });
52
+ const context = React.useMemo(() => ({ size }), [size]);
53
+ const common = { "aria-label": label, className: s.group({ className }) };
54
+ let group;
55
+ if (props.type === "single") {
56
+ const { type: _type, value, defaultValue, onValueChange, required, ...rest } = props;
57
+ group = /* @__PURE__ */ jsx(SingleGroup, { ...rest, ...common, value, defaultValue, onValueChange, required, children });
58
+ } else {
59
+ const { type: _type, required: _required, ...rest } = props;
60
+ group = /* @__PURE__ */ jsx(ToggleGroupPrimitive.Root, { type: "multiple", ...rest, ...common, children });
61
+ }
62
+ return /* @__PURE__ */ jsx(ChipGroupContext.Provider, { value: context, children: group });
63
+ }
64
+ function SingleGroup({
65
+ value,
66
+ defaultValue,
67
+ onValueChange,
68
+ required,
69
+ ...props
70
+ }) {
71
+ const [inner, setInner] = React.useState(defaultValue ?? "");
72
+ const current = value ?? inner;
73
+ return /* @__PURE__ */ jsx(
74
+ ToggleGroupPrimitive.Root,
75
+ {
76
+ type: "single",
77
+ value: current,
78
+ onValueChange: (next) => {
79
+ if (required && !next) return;
80
+ if (value === void 0) setInner(next);
81
+ onValueChange?.(next);
82
+ },
83
+ ...props
84
+ }
85
+ );
86
+ }
87
+ var Chip = Object.assign(ChipBase, { Group: ChipGroup });
88
+ export {
89
+ Chip,
90
+ ChipGroup,
91
+ chip
92
+ };
93
+ //# sourceMappingURL=chip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/chip/chip.tsx"],"sourcesContent":["// Client (a context). A chip is a pressable pill: alone it is a Radix Toggle (aria-pressed), inside `Chip.Group` an\n// item of a Radix Toggle Group (roving focus with the arrows; `single` = radio semantics, `multiple` = pressed\n// buttons). A `removable` chip is a static label with its own remove button (two buttons cannot nest).\nimport { Toggle as TogglePrimitive, ToggleGroup as ToggleGroupPrimitive } from \"radix-ui\";\nimport * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nexport const chip = tv({\n slots: {\n group: \"flex flex-wrap items-center gap-2 data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch\",\n base:\n \"inline-flex shrink-0 select-none items-center justify-center gap-1.5 whitespace-nowrap rounded-full border font-semibold transition-colors \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40 \" +\n \"border-border-default bg-surface-1 text-fg-secondary hover:border-border-strong hover:text-fg \" +\n \"data-[state=on]:border-accent data-[state=on]:bg-accent-soft data-[state=on]:text-fg\",\n remove:\n \"-mr-1.5 inline-flex h-6 w-6 items-center justify-center rounded-full text-fg-secondary transition-colors hover:bg-surface-3 hover:text-fg \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\",\n },\n variants: {\n size: { sm: { base: \"h-7 px-3 text-xs\" }, md: { base: \"h-9 px-3.5 text-xs\" } },\n },\n defaultVariants: { size: \"md\" },\n});\n\nexport type ChipVariants = VariantProps<typeof chip>;\n\ntype GroupContext = { size: ChipVariants[\"size\"] };\nconst ChipGroupContext = React.createContext<GroupContext | null>(null);\n\nfunction RemoveIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" className=\"h-3.5 w-3.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" aria-hidden>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n );\n}\n\ntype ToggleChipProps = Omit<React.ComponentProps<\"button\">, \"value\" | \"defaultValue\"> &\n ChipVariants & {\n /**\n * sm · md (inside `Chip.Group`, the group's size by default).\n * @default \"md\"\n */\n size?: ChipVariants[\"size\"];\n /** Inside `Chip.Group`: the value this chip stands for (required there, ignored alone). */\n value?: string;\n /** Alone: pressed or not (`defaultSelected` uncontrolled), `onSelectedChange` on every press. */\n selected?: boolean;\n /** Alone: pressed at first, uncontrolled. */\n defaultSelected?: boolean;\n /** Alone: called with the new state on every press. */\n onSelectedChange?: (selected: boolean) => void;\n /** A pressable chip (the default); `true` makes it a static chip with a remove button. */\n removable?: false;\n };\n\ntype RemovableChipProps = Omit<React.ComponentProps<\"span\">, \"onSelect\"> &\n ChipVariants & {\n /** A static chip (a chosen tag, an applied filter) with a remove button. */\n removable: true;\n /** The accessible name of the remove button — passed translated, e.g. \"Remove #night\". */\n removeLabel: string;\n /** Runs when the remove button is pressed. */\n onRemove: () => void;\n /** Disables the remove button. */\n disabled?: boolean;\n };\n\nexport type ChipProps = ToggleChipProps | RemovableChipProps;\n\n/** A selectable pill (`selected` / `onSelectedChange`), an item of `Chip.Group` (`value`), or `removable`. */\nfunction ChipBase(props: ChipProps) {\n const group = React.useContext(ChipGroupContext);\n if (props.removable) {\n const { removable: _removable, removeLabel, onRemove, disabled, size, className, children, ...rest } = props;\n const s = chip({ size: size ?? group?.size });\n return (\n <span data-removable=\"\" className={s.base({ className })} {...rest}>\n {children}\n <button type=\"button\" aria-label={removeLabel} title={removeLabel} disabled={disabled} onClick={onRemove} className={s.remove()}>\n <RemoveIcon />\n </button>\n </span>\n );\n }\n const { removable: _removable, value, selected, defaultSelected, onSelectedChange, size, className, ...rest } = props;\n const s = chip({ size: size ?? group?.size });\n if (group) {\n if (value === undefined) throw new Error(\"Chip: a chip inside Chip.Group needs a `value`.\");\n return <ToggleGroupPrimitive.Item value={value} className={s.base({ className })} {...rest} />;\n }\n return (\n <TogglePrimitive.Root\n pressed={selected}\n defaultPressed={defaultSelected}\n onPressedChange={onSelectedChange}\n className={s.base({ className })}\n {...rest}\n />\n );\n}\n\ntype GroupBase = Omit<React.ComponentProps<\"div\">, \"defaultValue\" | \"dir\"> &\n ChipVariants & {\n /**\n * sm · md: the size of every chip of the group.\n * @default \"md\"\n */\n size?: ChipVariants[\"size\"];\n /** The group's accessible name — passed translated (\"Filter by format\"). */\n label?: string;\n /** The arrow keys that move: left / right (horizontal, a row) or up / down (vertical, a column). */\n orientation?: \"horizontal\" | \"vertical\";\n /** Arrow keys wrap from the last chip to the first (default `true`). */\n loop?: boolean;\n /** Disables every chip of the group. */\n disabled?: boolean;\n };\n\nexport type ChipGroupProps =\n | (GroupBase & {\n /** One choice: the chips behave as radios. */\n type: \"single\";\n /** The chosen value (controlled), `\"\"` when none. */\n value?: string;\n /** The value chosen at first, uncontrolled. */\n defaultValue?: string;\n /** Called with the new value on every choice. */\n onValueChange?: (value: string) => void;\n /** Keeps one chip selected: pressing the selected chip does not clear it (default `false`). */\n required?: boolean;\n })\n | (GroupBase & {\n /** Any number of choices: the chips are pressed buttons. */\n type: \"multiple\";\n /** The chosen values (controlled). */\n value?: string[];\n /** The values chosen at first, uncontrolled. */\n defaultValue?: string[];\n /** Called with the new values on every press. */\n onValueChange?: (value: string[]) => void;\n required?: never;\n });\n\n/** Chips that choose together: `type` single · multiple, `value`/`defaultValue` + `onValueChange`. */\nexport function ChipGroup({ label, size, className, children, ...props }: ChipGroupProps) {\n const s = chip({ size });\n const context = React.useMemo(() => ({ size }), [size]);\n const common = { \"aria-label\": label, className: s.group({ className }) };\n let group: React.ReactNode;\n if (props.type === \"single\") {\n const { type: _type, value, defaultValue, onValueChange, required, ...rest } = props;\n group = <SingleGroup {...rest} {...common} value={value} defaultValue={defaultValue} onValueChange={onValueChange} required={required}>{children}</SingleGroup>;\n } else {\n const { type: _type, required: _required, ...rest } = props;\n group = (\n <ToggleGroupPrimitive.Root type=\"multiple\" {...rest} {...common}>\n {children}\n </ToggleGroupPrimitive.Root>\n );\n }\n return <ChipGroupContext.Provider value={context}>{group}</ChipGroupContext.Provider>;\n}\n\n/** Radix's single group, plus `required`: the value is held here so that an empty change can be refused. */\nfunction SingleGroup({\n value,\n defaultValue,\n onValueChange,\n required,\n ...props\n}: Omit<GroupBase, \"size\" | \"label\"> & {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n required?: boolean;\n}) {\n const [inner, setInner] = React.useState(defaultValue ?? \"\");\n const current = value ?? inner;\n return (\n <ToggleGroupPrimitive.Root\n type=\"single\"\n value={current}\n onValueChange={(next) => {\n if (required && !next) return;\n if (value === undefined) setInner(next);\n onValueChange?.(next);\n }}\n {...props}\n />\n );\n}\n\n/** `Chip` (selectable, removable) and `Chip.Group` (single · multiple). */\nexport const Chip = Object.assign(ChipBase, { Group: ChipGroup });\n"],"mappings":"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","names":["_removable","size","className","rest","s"]}
@@ -0,0 +1,121 @@
1
+ "use client";
2
+ import {
3
+ IconButton
4
+ } from "./chunk-ZUD4U22H.js";
5
+
6
+ // src/dialog/dialog.tsx
7
+ import { Dialog as DialogPrimitive } from "radix-ui";
8
+ import { tv } from "tailwind-variants";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ var dialog = tv({
11
+ slots: {
12
+ overlay: "kz-overlay fixed inset-0 z-50 bg-overlay backdrop-blur-xs",
13
+ content: "kz-dialog fixed z-50 flex flex-col overflow-hidden border border-border-default bg-surface-1 text-fg shadow-lg focus:outline-hidden",
14
+ close: "absolute right-3 top-3 h-9 w-9",
15
+ header: "flex flex-col gap-1 px-5 pb-2 pr-14 pt-5",
16
+ title: "text-base font-bold text-fg",
17
+ description: "text-sm text-fg-secondary",
18
+ body: "min-h-0 flex-1 overflow-y-auto px-5 pb-5",
19
+ footer: "flex flex-wrap items-center justify-end gap-2 border-t border-border-subtle px-5 py-4 pb-[max(1rem,env(safe-area-inset-bottom))]"
20
+ },
21
+ variants: {
22
+ placement: {
23
+ center: { content: "left-1/2 top-1/2 max-h-[85dvh] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl" },
24
+ /* A sheet: anchored at the bottom on a phone, centred from `sm` up. */
25
+ bottom: {
26
+ content: "inset-x-0 bottom-0 max-h-[92dvh] rounded-t-[1.75rem] sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-[1.75rem]"
27
+ },
28
+ right: { content: "inset-y-0 right-0 h-full w-full max-w-md rounded-none border-y-0 border-r-0" }
29
+ },
30
+ size: { sm: { content: "sm:max-w-sm" }, md: { content: "sm:max-w-md" }, lg: { content: "sm:max-w-2xl" } }
31
+ },
32
+ defaultVariants: { placement: "center", size: "md" }
33
+ });
34
+ var s = dialog();
35
+ function CloseIcon() {
36
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) });
37
+ }
38
+ var prevent = (event) => event.preventDefault();
39
+ function DialogContent({
40
+ placement,
41
+ size,
42
+ closeLabel,
43
+ hideClose,
44
+ dismissible = true,
45
+ container,
46
+ className,
47
+ children,
48
+ onEscapeKeyDown,
49
+ onPointerDownOutside,
50
+ onInteractOutside,
51
+ ...props
52
+ }) {
53
+ const v = dialog({ placement, size });
54
+ return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { container, children: [
55
+ /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: v.overlay() }),
56
+ /* @__PURE__ */ jsxs(
57
+ DialogPrimitive.Content,
58
+ {
59
+ "data-placement": placement ?? "center",
60
+ "data-dismissible": dismissible ? void 0 : "false",
61
+ className: v.content({ className }),
62
+ onEscapeKeyDown: dismissible ? onEscapeKeyDown : chain(onEscapeKeyDown, prevent),
63
+ onPointerDownOutside: dismissible ? onPointerDownOutside : chain(onPointerDownOutside, prevent),
64
+ onInteractOutside: dismissible ? onInteractOutside : chain(onInteractOutside, prevent),
65
+ ...props,
66
+ children: [
67
+ children,
68
+ !hideClose && /* @__PURE__ */ jsx(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { label: closeLabel, variant: "ghost", shape: "pill", className: v.close(), children: /* @__PURE__ */ jsx(CloseIcon, {}) }) })
69
+ ]
70
+ }
71
+ )
72
+ ] });
73
+ }
74
+ function chain(handler, then) {
75
+ return (event) => {
76
+ handler?.(event);
77
+ then(event);
78
+ };
79
+ }
80
+ function DialogHeader({ className, ...props }) {
81
+ return /* @__PURE__ */ jsx("div", { className: s.header({ className }), ...props });
82
+ }
83
+ function DialogTitle({ className, ...props }) {
84
+ return /* @__PURE__ */ jsx(DialogPrimitive.Title, { className: s.title({ className }), ...props });
85
+ }
86
+ function DialogDescription({ className, ...props }) {
87
+ return /* @__PURE__ */ jsx(DialogPrimitive.Description, { className: s.description({ className }), ...props });
88
+ }
89
+ function DialogBody({ className, ...props }) {
90
+ return /* @__PURE__ */ jsx("div", { className: s.body({ className }), ...props });
91
+ }
92
+ function DialogFooter({ className, ...props }) {
93
+ return /* @__PURE__ */ jsx("div", { className: s.footer({ className }), ...props });
94
+ }
95
+ var Dialog = {
96
+ Root: DialogPrimitive.Root,
97
+ Trigger: DialogPrimitive.Trigger,
98
+ Close: DialogPrimitive.Close,
99
+ Content: DialogContent,
100
+ Header: DialogHeader,
101
+ Title: DialogTitle,
102
+ Description: DialogDescription,
103
+ Body: DialogBody,
104
+ Footer: DialogFooter
105
+ };
106
+ function Sheet(props) {
107
+ return /* @__PURE__ */ jsx(DialogContent, { placement: "bottom", ...props });
108
+ }
109
+
110
+ export {
111
+ dialog,
112
+ DialogContent,
113
+ DialogHeader,
114
+ DialogTitle,
115
+ DialogDescription,
116
+ DialogBody,
117
+ DialogFooter,
118
+ Dialog,
119
+ Sheet
120
+ };
121
+ //# sourceMappingURL=chunk-3X5MVH54.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/dialog/dialog.tsx"],"sourcesContent":["// Client (a portal). Radix does the focus trap, the scroll lock, Escape, the outside click, aria-modal, the\n// aria-labelledby / aria-describedby wiring and the focus return: this file only holds the shape.\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\n\nexport const dialog = tv({\n slots: {\n overlay: \"kz-overlay fixed inset-0 z-50 bg-overlay backdrop-blur-xs\",\n content:\n \"kz-dialog fixed z-50 flex flex-col overflow-hidden border border-border-default bg-surface-1 text-fg shadow-lg focus:outline-hidden\",\n close: \"absolute right-3 top-3 h-9 w-9\",\n header: \"flex flex-col gap-1 px-5 pb-2 pr-14 pt-5\",\n title: \"text-base font-bold text-fg\",\n description: \"text-sm text-fg-secondary\",\n body: \"min-h-0 flex-1 overflow-y-auto px-5 pb-5\",\n footer:\n \"flex flex-wrap items-center justify-end gap-2 border-t border-border-subtle px-5 py-4 pb-[max(1rem,env(safe-area-inset-bottom))]\",\n },\n variants: {\n placement: {\n center: { content: \"left-1/2 top-1/2 max-h-[85dvh] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl\" },\n /* A sheet: anchored at the bottom on a phone, centred from `sm` up. */\n bottom: {\n content:\n \"inset-x-0 bottom-0 max-h-[92dvh] rounded-t-[1.75rem] sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-full \" +\n \"sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-[1.75rem]\",\n },\n right: { content: \"inset-y-0 right-0 h-full w-full max-w-md rounded-none border-y-0 border-r-0\" },\n },\n size: { sm: { content: \"sm:max-w-sm\" }, md: { content: \"sm:max-w-md\" }, lg: { content: \"sm:max-w-2xl\" } },\n },\n defaultVariants: { placement: \"center\", size: \"md\" },\n});\nconst s = dialog();\n\nexport type DialogVariants = VariantProps<typeof dialog>;\n\nfunction CloseIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" className=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n );\n}\n\ntype CloseButtonProps =\n | {\n /** The accessible name of the close button — passed translated. */\n closeLabel: string;\n /** Leaves the close button out (the content brings its own way out, or none: see `dismissible`). */\n hideClose?: false;\n }\n | { closeLabel?: string; hideClose: true };\n\nexport type DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Content> &\n DialogVariants &\n CloseButtonProps & {\n /**\n * center · bottom (a sheet on a phone, centred from `sm` up) · right (a side panel, full height).\n * @default \"center\"\n */\n placement?: DialogVariants[\"placement\"];\n /**\n * sm · md · lg: the width of the dialog.\n * @default \"md\"\n */\n size?: DialogVariants[\"size\"];\n /**\n * `false`: Escape and a click outside do not close it (a gate the user must answer: age, terms). It still closes\n * through `open` / `onOpenChange` and any `Dialog.Close` inside. Default `true`.\n */\n dismissible?: boolean;\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n };\n\nconst prevent = (event: Event) => event.preventDefault();\n\n/** The dialog itself, portalled over a dimmed overlay, with a close button. Give it a `Dialog.Title`. */\nexport function DialogContent({\n placement,\n size,\n closeLabel,\n hideClose,\n dismissible = true,\n container,\n className,\n children,\n onEscapeKeyDown,\n onPointerDownOutside,\n onInteractOutside,\n ...props\n}: DialogContentProps) {\n const v = dialog({ placement, size });\n return (\n <DialogPrimitive.Portal container={container}>\n <DialogPrimitive.Overlay className={v.overlay()} />\n <DialogPrimitive.Content\n data-placement={placement ?? \"center\"}\n data-dismissible={dismissible ? undefined : \"false\"}\n className={v.content({ className })}\n onEscapeKeyDown={dismissible ? onEscapeKeyDown : chain(onEscapeKeyDown, prevent)}\n onPointerDownOutside={dismissible ? onPointerDownOutside : chain(onPointerDownOutside, prevent)}\n onInteractOutside={dismissible ? onInteractOutside : chain(onInteractOutside, prevent)}\n {...props}\n >\n {children}\n {!hideClose && (\n <DialogPrimitive.Close asChild>\n <IconButton label={closeLabel as string} variant=\"ghost\" shape=\"pill\" className={v.close()}>\n <CloseIcon />\n </IconButton>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n );\n}\n\nfunction chain<E extends Event>(handler: ((event: E) => void) | undefined, then: (event: E) => void) {\n return (event: E) => {\n handler?.(event);\n then(event);\n };\n}\n\nexport function DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.header({ className })} {...props} />;\n}\n\nexport function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return <DialogPrimitive.Title className={s.title({ className })} {...props} />;\n}\n\nexport function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return <DialogPrimitive.Description className={s.description({ className })} {...props} />;\n}\n\nexport function DialogBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.body({ className })} {...props} />;\n}\n\nexport function DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.footer({ className })} {...props} />;\n}\n\n/** `Dialog.Root/Trigger/Content/Header/Title/Description/Body/Footer/Close`. `open`/`defaultOpen` + `onOpenChange`. */\nexport const Dialog = {\n Root: DialogPrimitive.Root,\n Trigger: DialogPrimitive.Trigger,\n Close: DialogPrimitive.Close,\n Content: DialogContent,\n Header: DialogHeader,\n Title: DialogTitle,\n Description: DialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n};\n\n/** `Omit` that keeps the close-button union (`closeLabel` required unless `hideClose`). */\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;\n\nexport type SheetProps = DistributiveOmit<DialogContentProps, \"placement\">;\n\n/** A sheet is a dialog anchored at the bottom (centred from `sm` up): `Dialog.Content placement=\"bottom\"`. */\nexport function Sheet(props: SheetProps) {\n return <DialogContent placement=\"bottom\" {...props} />;\n}\n"],"mappings":"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","names":[]}
@@ -10,4 +10,4 @@ function cn(...inputs) {
10
10
  export {
11
11
  cn
12
12
  };
13
- //# sourceMappingURL=chunk-RLOXWF2G.js.map
13
+ //# sourceMappingURL=chunk-5AXLA4LK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cn.ts"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { cn as merge } from \"tailwind-variants\";\n\nexport type { ClassValue };\n\n/**\n * Merges Tailwind classes: the last one wins — a product's `className` overrides the primitive's. The merge engine is\n * tailwind-merge as tailwind-variants ships it (the one `tv` uses), so the platform carries a single copy of it.\n * tailwind-variants bundles that engine since 3.3 (it never imports the `tailwind-merge` package, an optional peer):\n * hence `tailwind-variants ^3.3.1` and no `tailwind-merge` dependency — `scripts/consumer.mjs` checks it on a clean\n * install of the packed package.\n */\nexport function cn(...inputs: ClassValue[]): string {\n return merge(clsx(inputs)) ?? \"\";\n}\n"],"mappings":";;;AAAA,SAA0B,YAAY;AACtC,SAAS,MAAM,aAAa;AAWrB,SAAS,MAAM,QAA8B;AAClD,SAAO,MAAM,KAAK,MAAM,CAAC,KAAK;AAChC;","names":[]}
@@ -8,4 +8,4 @@ function cn(...inputs) {
8
8
  export {
9
9
  cn
10
10
  };
11
- //# sourceMappingURL=chunk-CPMZS4XA.js.map
11
+ //# sourceMappingURL=chunk-FJDSLNXK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cn.ts"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { cn as merge } from \"tailwind-variants\";\n\nexport type { ClassValue };\n\n/**\n * Merges Tailwind classes: the last one wins — a product's `className` overrides the primitive's. The merge engine is\n * tailwind-merge as tailwind-variants ships it (the one `tv` uses), so the platform carries a single copy of it.\n * tailwind-variants bundles that engine since 3.3 (it never imports the `tailwind-merge` package, an optional peer):\n * hence `tailwind-variants ^3.3.1` and no `tailwind-merge` dependency — `scripts/consumer.mjs` checks it on a clean\n * install of the packed package.\n */\nexport function cn(...inputs: ClassValue[]): string {\n return merge(clsx(inputs)) ?? \"\";\n}\n"],"mappings":";AAAA,SAA0B,YAAY;AACtC,SAAS,MAAM,aAAa;AAWrB,SAAS,MAAM,QAA8B;AAClD,SAAO,MAAM,KAAK,MAAM,CAAC,KAAK;AAChC;","names":[]}
@@ -46,4 +46,4 @@ export {
46
46
  Button,
47
47
  IconButton
48
48
  };
49
- //# sourceMappingURL=chunk-QRG5RYEI.js.map
49
+ //# sourceMappingURL=chunk-ZUD4U22H.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/button/button.tsx"],"sourcesContent":["// Server-safe: no hook, no context. `buttonVariants` styles a <Link> or a Server Component without the component.\nimport { Slot } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nexport const buttonVariants = tv({\n base:\n \"inline-flex shrink-0 select-none items-center justify-center gap-2 whitespace-nowrap font-semibold transition-all \" +\n \"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-0 \" +\n \"disabled:pointer-events-none disabled:opacity-40 data-loading:cursor-progress active:scale-[0.98]\",\n variants: {\n variant: {\n primary: \"bg-accent text-on-accent shadow-sm hover:bg-accent-hover\",\n secondary: \"border border-border-default bg-surface-2 text-fg hover:border-border-strong hover:bg-surface-3\",\n outline: \"border border-border-default bg-transparent text-fg hover:border-accent hover:text-accent\",\n ghost: \"text-fg-secondary hover:bg-surface-2 hover:text-fg\",\n // The danger token is invariant and too light for small text on a light surface (3.6:1): the label stays a\n // text role, the border and the tint carry the danger.\n danger: \"border border-danger/50 bg-danger/10 text-fg hover:border-danger hover:bg-danger/20\",\n },\n size: { sm: \"h-8 px-3 text-xs\", md: \"h-10 px-4 text-sm\", lg: \"h-12 px-6 text-sm\", icon: \"h-10 w-10\" },\n shape: { rounded: \"rounded-lg\", pill: \"rounded-full\" },\n },\n defaultVariants: { variant: \"secondary\", size: \"md\", shape: \"rounded\" },\n});\n\nexport type ButtonVariants = VariantProps<typeof buttonVariants>;\n\nexport type ButtonProps = React.ComponentProps<\"button\"> &\n ButtonVariants & {\n /**\n * The look: `primary` (the accent), `secondary` (a raised surface), `outline`, `ghost`, `danger`.\n * @default \"secondary\"\n */\n variant?: ButtonVariants[\"variant\"];\n /**\n * sm · md · lg, or `icon` (a square).\n * @default \"md\"\n */\n size?: ButtonVariants[\"size\"];\n /**\n * rounded · pill.\n * @default \"rounded\"\n */\n shape?: ButtonVariants[\"shape\"];\n /** Renders the child (e.g. a <Link>) instead of the <button>, with props, classes and ref merged. */\n asChild?: boolean;\n /** Disables and signals the wait (aria-busy, data-loading) — the product adds a spinner if it wants one. */\n loading?: boolean;\n };\n\nexport function Button({ asChild, loading, variant, size, shape, className, disabled, ...props }: ButtonProps) {\n const Comp = asChild ? Slot.Root : \"button\";\n return (\n <Comp\n type={asChild ? undefined : \"button\"}\n aria-busy={loading || undefined}\n data-loading={loading ? \"\" : undefined}\n data-variant={variant ?? \"secondary\"}\n disabled={asChild ? undefined : disabled || loading}\n aria-disabled={asChild && (disabled || loading) ? true : undefined}\n className={buttonVariants({ variant, size, shape, className })}\n {...props}\n />\n );\n}\n\nexport type IconButtonProps = Omit<ButtonProps, \"size\"> & {\n /** The accessible name (and tooltip) of the button — required, passed translated. */\n label: string;\n /**\n * sm · md · lg, or `icon` (a square).\n * @default \"icon\"\n */\n size?: ButtonProps[\"size\"];\n};\n\n/** An icon-only button: `label` is required, it is its accessible name. */\nexport function IconButton({ label, size = \"icon\", ...props }: IconButtonProps) {\n return <Button aria-label={label} title={label} size={size} {...props} />;\n}\n"],"mappings":";;;AACA,SAAS,YAAY;AAErB,SAAS,UAA6B;AAmDlC;AAjDG,IAAM,iBAAiB,GAAG;AAAA,EAC/B,MACE;AAAA,EAGF,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,MACT,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA;AAAA;AAAA,MAGP,QAAQ;AAAA,IACV;AAAA,IACA,MAAM,EAAE,IAAI,oBAAoB,IAAI,qBAAqB,IAAI,qBAAqB,MAAM,YAAY;AAAA,IACpG,OAAO,EAAE,SAAS,cAAc,MAAM,eAAe;AAAA,EACvD;AAAA,EACA,iBAAiB,EAAE,SAAS,aAAa,MAAM,MAAM,OAAO,UAAU;AACxE,CAAC;AA2BM,SAAS,OAAO,EAAE,SAAS,SAAS,SAAS,MAAM,OAAO,WAAW,UAAU,GAAG,MAAM,GAAgB;AAC7G,QAAM,OAAO,UAAU,KAAK,OAAO;AACnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,UAAU,SAAY;AAAA,MAC5B,aAAW,WAAW;AAAA,MACtB,gBAAc,UAAU,KAAK;AAAA,MAC7B,gBAAc,WAAW;AAAA,MACzB,UAAU,UAAU,SAAY,YAAY;AAAA,MAC5C,iBAAe,YAAY,YAAY,WAAW,OAAO;AAAA,MACzD,WAAW,eAAe,EAAE,SAAS,MAAM,OAAO,UAAU,CAAC;AAAA,MAC5D,GAAG;AAAA;AAAA,EACN;AAEJ;AAaO,SAAS,WAAW,EAAE,OAAO,OAAO,QAAQ,GAAG,MAAM,GAAoB;AAC9E,SAAO,oBAAC,UAAO,cAAY,OAAO,OAAO,OAAO,MAAa,GAAG,OAAO;AACzE;","names":[]}
package/dist/cn.d.ts CHANGED
@@ -4,6 +4,9 @@ export { ClassValue } from 'clsx';
4
4
  /**
5
5
  * Merges Tailwind classes: the last one wins — a product's `className` overrides the primitive's. The merge engine is
6
6
  * tailwind-merge as tailwind-variants ships it (the one `tv` uses), so the platform carries a single copy of it.
7
+ * tailwind-variants bundles that engine since 3.3 (it never imports the `tailwind-merge` package, an optional peer):
8
+ * hence `tailwind-variants ^3.3.1` and no `tailwind-merge` dependency — `scripts/consumer.mjs` checks it on a clean
9
+ * install of the packed package.
7
10
  */
8
11
  declare function cn(...inputs: ClassValue[]): string;
9
12
 
package/dist/cn.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cn
3
- } from "./chunk-CPMZS4XA.js";
3
+ } from "./chunk-FJDSLNXK.js";
4
4
  export {
5
5
  cn
6
6
  };
@@ -0,0 +1,159 @@
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-GQ4Nvuyf.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 or closed (controlled), with `onOpenChange`. */
141
+ open?: boolean;
142
+ /** Open at first, uncontrolled. */
143
+ defaultOpen?: boolean;
144
+ /** Called when it opens or closes (Escape, a click outside, a shortcut of the product). */
145
+ onOpenChange?: (open: boolean) => void;
146
+ /** Under the palette, inside the dialog: shortcuts, a "see all results" link. */
147
+ footer?: React.ReactNode;
148
+ /** Passed to `Dialog.Content`: `size`, `container`, `className` of the dialog. */
149
+ contentProps?: Omit<Extract<DialogContentProps, {
150
+ hideClose: true;
151
+ }>, "hideClose" | "children" | "placement">;
152
+ };
153
+ /**
154
+ * The palette in a dialog (Radix: focus trap, Escape, focus return). The dialog is named by `label`; it has no close
155
+ * button — Escape and a click outside close it — and the input takes the focus when it opens.
156
+ */
157
+ declare function CommandDialog({ open, defaultOpen, onOpenChange, footer, contentProps, label, className, children, ...props }: CommandDialogProps): React.JSX.Element;
158
+
159
+ export { Command, CommandDialog, type CommandDialogProps, CommandEmpty, type CommandEmptyProps, CommandGroup, CommandInput, type CommandInputProps, CommandItem, CommandList, type CommandListProps, CommandLoading, CommandRoot, type CommandRootProps, CommandSeparator, CommandShortcut, command };