rockin 0.0.34 → 0.0.36

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 (91) hide show
  1. package/dist/chunk-3CZ2LLUN.js +198 -0
  2. package/dist/{chunk-7ZCRGTLA.js → chunk-54ZJAEO5.js} +5 -5
  3. package/dist/chunk-5GM3YR42.js +228 -0
  4. package/dist/chunk-6XUTSMTJ.js +183 -0
  5. package/dist/chunk-7JJBATB2.js +35 -0
  6. package/dist/chunk-BITCJZQZ.js +31 -0
  7. package/dist/chunk-COPQJFDI.js +158 -0
  8. package/dist/chunk-D6TULSM6.js +785 -0
  9. package/dist/chunk-DVNTJNDP.js +55 -0
  10. package/dist/chunk-EKDBYSMI.js +87 -0
  11. package/dist/chunk-FGWWRPMR.js +71 -0
  12. package/dist/chunk-G233W3IR.js +17 -0
  13. package/dist/chunk-G4NDAZTB.js +13 -0
  14. package/dist/chunk-GY2BX5SK.js +26 -0
  15. package/dist/chunk-MZBLIA6C.js +20 -0
  16. package/dist/chunk-OSVLAX37.js +101 -0
  17. package/dist/chunk-PRGKTXJU.js +20 -0
  18. package/dist/chunk-RUKQ532H.js +253 -0
  19. package/dist/chunk-S4H2HENE.js +113 -0
  20. package/dist/chunk-UHZTEDHK.js +61 -0
  21. package/dist/chunk-VFDNWPOI.js +293 -0
  22. package/dist/chunk-W4EIJWHF.js +150 -0
  23. package/dist/hooks/index.js +18 -9
  24. package/dist/index.js +4 -4
  25. package/dist/provider.js +3 -3
  26. package/dist/styles.css +2 -2
  27. package/dist/ui/accordion.js +95 -0
  28. package/dist/ui/alert-dialog.js +178 -0
  29. package/dist/ui/apple/english.js +7 -0
  30. package/dist/ui/apple/hindi.js +7 -0
  31. package/dist/ui/apple/index.js +52 -0
  32. package/dist/ui/apple/spanish.js +7 -0
  33. package/dist/ui/ariakit.js +7 -0
  34. package/dist/ui/autocomplete.js +296 -0
  35. package/dist/ui/avatar.js +106 -0
  36. package/dist/ui/badge.js +50 -0
  37. package/dist/ui/bridge.js +109 -0
  38. package/dist/ui/bubble.js +118 -0
  39. package/dist/ui/button-group.js +14 -0
  40. package/dist/ui/button.js +9 -0
  41. package/dist/ui/card.js +102 -0
  42. package/dist/ui/carousel.js +205 -0
  43. package/dist/ui/chart.js +253 -0
  44. package/dist/ui/checkbox.js +34 -0
  45. package/dist/ui/code-block.js +128 -0
  46. package/dist/ui/combobox.js +41 -0
  47. package/dist/ui/command.js +199 -0
  48. package/dist/ui/dashed.js +57 -0
  49. package/dist/ui/data-table/index.js +233 -0
  50. package/dist/ui/dialog.js +26 -0
  51. package/dist/ui/dock.js +86 -0
  52. package/dist/ui/drawer.js +216 -0
  53. package/dist/ui/dropdown-menu.js +35 -0
  54. package/dist/ui/empty.js +17 -0
  55. package/dist/ui/farmer/div.js +38 -0
  56. package/dist/ui/farmer/variants.js +314 -0
  57. package/dist/ui/field.js +224 -0
  58. package/dist/ui/filters.js +1524 -0
  59. package/dist/ui/image.js +88 -0
  60. package/dist/ui/index.d.ts +1 -1
  61. package/dist/ui/index.js +57 -8502
  62. package/dist/ui/input-group.js +20 -0
  63. package/dist/ui/input-otp.js +83 -0
  64. package/dist/ui/input.js +7 -0
  65. package/dist/ui/item.js +200 -0
  66. package/dist/ui/jelly.js +30 -0
  67. package/dist/ui/kbd.js +9 -0
  68. package/dist/ui/label.js +7 -0
  69. package/dist/ui/message-scroller.js +122 -0
  70. package/dist/ui/message.js +93 -0
  71. package/dist/ui/numberstepper.js +416 -0
  72. package/dist/ui/otp.js +403 -0
  73. package/dist/ui/popover.js +83 -0
  74. package/dist/ui/qr-code.js +124 -0
  75. package/dist/ui/quantity.js +48 -0
  76. package/dist/ui/radio-group.js +42 -0
  77. package/dist/ui/resizable.js +52 -0
  78. package/dist/ui/scroll-area.js +9 -0
  79. package/dist/ui/select.js +194 -0
  80. package/dist/ui/separator.js +7 -0
  81. package/dist/ui/skeleton.js +25 -0
  82. package/dist/ui/sonner.js +22 -0
  83. package/dist/ui/sortable.js +503 -0
  84. package/dist/ui/swipe-actions.js +45 -0
  85. package/dist/ui/switch.js +34 -0
  86. package/dist/ui/textarea.js +7 -0
  87. package/dist/ui/theme-toggle.js +141 -0
  88. package/dist/ui/tooltip.js +13 -0
  89. package/package.json +1 -1
  90. package/dist/chunk-4KFB6AJH.js +0 -1330
  91. /package/dist/{chunk-FYFBWCMJ.js → chunk-GBVAFFZR.js} +0 -0
package/dist/ui/otp.js ADDED
@@ -0,0 +1,403 @@
1
+ "use client";
2
+
3
+ // src/ui/otp.tsx
4
+ import { cn } from "cn";
5
+ import {
6
+ AnimatePresence,
7
+ animate,
8
+ motion,
9
+ useReducedMotion
10
+ } from "motion/react";
11
+ import { Fragment, useEffect, useId, useRef, useState } from "react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ var EASE_OUT = [0.16, 1, 0.3, 1];
14
+ var EASE_IN_OUT = [0.77, 0, 0.175, 1];
15
+ var EASE_DRAWER = [0.32, 0.72, 0, 1];
16
+ var EASE_OUT_CSS = "cubic-bezier(0.16, 1, 0.3, 1)";
17
+ var SPRING_PRESS = {
18
+ type: "spring",
19
+ stiffness: 500,
20
+ damping: 30,
21
+ mass: 0.6
22
+ };
23
+ var SPRING_SWAP = {
24
+ type: "spring",
25
+ stiffness: 460,
26
+ damping: 30,
27
+ mass: 0.55
28
+ };
29
+ var SPRING_PANEL = {
30
+ type: "spring",
31
+ stiffness: 420,
32
+ damping: 40,
33
+ mass: 0.5
34
+ };
35
+ var SPRING_LAYOUT = {
36
+ type: "spring",
37
+ stiffness: 360,
38
+ damping: 32,
39
+ mass: 0.6
40
+ };
41
+ var SPRING_MOUSE = {
42
+ stiffness: 200,
43
+ damping: 15,
44
+ mass: 0.3
45
+ };
46
+ function OTPInput({
47
+ length = 6,
48
+ value: controlledValue,
49
+ defaultValue = "",
50
+ onChange,
51
+ onComplete,
52
+ label,
53
+ hint,
54
+ successMessage,
55
+ errorMessage,
56
+ status = "idle",
57
+ mask = false,
58
+ disabled = false,
59
+ autoFocus = false,
60
+ onFocusChange,
61
+ "aria-label": ariaLabel = "One-time passcode",
62
+ className
63
+ }) {
64
+ const uid = useId();
65
+ const reduce = useReducedMotion();
66
+ const inputRef = useRef(null);
67
+ const slotsRef = useRef(null);
68
+ const controlled = controlledValue !== void 0;
69
+ const [slots, setSlots] = useState(
70
+ () => toSlots(controlled ? controlledValue : defaultValue, length)
71
+ );
72
+ const [focused, setFocused] = useState(false);
73
+ const [active, setActive] = useState(0);
74
+ const joined = slots.join("");
75
+ const joinedRef = useRef(joined);
76
+ joinedRef.current = joined;
77
+ useEffect(() => {
78
+ if (!controlled) return;
79
+ const incoming = sanitize(controlledValue, length);
80
+ if (incoming !== joinedRef.current) {
81
+ setSlots(toSlots(incoming, length));
82
+ }
83
+ }, [controlled, controlledValue, length]);
84
+ const commit = (next) => {
85
+ const wasComplete = slots.every((c) => c !== "");
86
+ setSlots(next);
87
+ const str = next.join("");
88
+ onChange?.(str);
89
+ if (!wasComplete && next.every((c) => c !== "")) {
90
+ onComplete?.(str);
91
+ }
92
+ };
93
+ const clearSlot = (idx) => {
94
+ const next = [...slots];
95
+ next[idx] = "";
96
+ commit(next);
97
+ };
98
+ const slotFromClientX = (clientX) => {
99
+ const els = slotsRef.current?.querySelectorAll("[data-otp-slot]");
100
+ if (!els) return 0;
101
+ for (let i = 0; i < els.length; i++) {
102
+ if (clientX < els[i].getBoundingClientRect().right) return i;
103
+ }
104
+ return length - 1;
105
+ };
106
+ const insert = (raw, from = active) => {
107
+ const digits = raw.replace(/\D/g, "");
108
+ if (!digits) return;
109
+ const next = [...slots];
110
+ let i = from;
111
+ for (const ch of digits) {
112
+ if (i >= length) break;
113
+ next[i] = ch;
114
+ i++;
115
+ }
116
+ commit(next);
117
+ setActive(Math.min(i, length - 1));
118
+ };
119
+ const onKeyDown = (e) => {
120
+ if (disabled || e.metaKey || e.ctrlKey || e.altKey) return;
121
+ const k = e.key;
122
+ if (/^[0-9]$/.test(k)) {
123
+ e.preventDefault();
124
+ insert(k);
125
+ } else if (k === "Backspace") {
126
+ e.preventDefault();
127
+ if (slots[active]) {
128
+ clearSlot(active);
129
+ } else if (active > 0) {
130
+ clearSlot(active - 1);
131
+ setActive(active - 1);
132
+ }
133
+ } else if (k === "Delete") {
134
+ e.preventDefault();
135
+ clearSlot(active);
136
+ } else if (k === "ArrowLeft") {
137
+ e.preventDefault();
138
+ setActive((a) => Math.max(a - 1, 0));
139
+ } else if (k === "ArrowRight") {
140
+ e.preventDefault();
141
+ setActive((a) => Math.min(a + 1, length - 1));
142
+ } else if (k === "Home") {
143
+ e.preventDefault();
144
+ setActive(0);
145
+ } else if (k === "End") {
146
+ e.preventDefault();
147
+ setActive(length - 1);
148
+ }
149
+ };
150
+ const onPaste = (e) => {
151
+ if (disabled) return;
152
+ e.preventDefault();
153
+ insert(e.clipboardData.getData("text"), active);
154
+ };
155
+ const onChangeNative = (e) => {
156
+ const digits = sanitize(e.target.value, length);
157
+ if (!digits) return;
158
+ commit(toSlots(digits, length));
159
+ setActive(Math.min(digits.length, length - 1));
160
+ };
161
+ useEffect(() => {
162
+ if (status !== "error" || reduce || !slotsRef.current) return;
163
+ animate(
164
+ slotsRef.current,
165
+ {
166
+ x: [0, -5, 5, -3, 3, -1, 0]
167
+ },
168
+ {
169
+ duration: 0.45,
170
+ ease: EASE_OUT
171
+ }
172
+ );
173
+ }, [status, reduce]);
174
+ const showSuccess = status === "success";
175
+ const activeIndex = focused ? active : -1;
176
+ const message = showSuccess ? successMessage : status === "error" ? errorMessage : hint;
177
+ return /* @__PURE__ */ jsxs("div", { className: cn("inline-flex flex-col gap-2", className), children: [
178
+ label ? /* @__PURE__ */ jsx(
179
+ "label",
180
+ {
181
+ htmlFor: `${uid}-input`,
182
+ className: "text-sm font-medium text-foreground",
183
+ children: label
184
+ }
185
+ ) : null,
186
+ /* @__PURE__ */ jsxs(
187
+ "div",
188
+ {
189
+ className: "relative inline-flex w-max",
190
+ onMouseDown: (e) => {
191
+ if (disabled) return;
192
+ e.preventDefault();
193
+ const firstEmpty = slots.indexOf("");
194
+ const cap = firstEmpty === -1 ? length - 1 : firstEmpty;
195
+ setActive(Math.min(slotFromClientX(e.clientX), cap));
196
+ inputRef.current?.focus();
197
+ },
198
+ children: [
199
+ /* @__PURE__ */ jsx(
200
+ "input",
201
+ {
202
+ ref: inputRef,
203
+ id: `${uid}-input`,
204
+ inputMode: "numeric",
205
+ autoComplete: "one-time-code",
206
+ autoFocus,
207
+ disabled,
208
+ "aria-label": ariaLabel,
209
+ "aria-invalid": status === "error",
210
+ value: "",
211
+ maxLength: length,
212
+ onKeyDown,
213
+ onChange: onChangeNative,
214
+ onPaste,
215
+ onFocus: () => {
216
+ setFocused(true);
217
+ onFocusChange?.(true);
218
+ },
219
+ onBlur: () => {
220
+ setFocused(false);
221
+ onFocusChange?.(false);
222
+ },
223
+ className: "absolute inset-0 z-20 h-full w-full cursor-text bg-transparent text-transparent caret-transparent opacity-0 outline-none disabled:cursor-not-allowed"
224
+ }
225
+ ),
226
+ /* @__PURE__ */ jsx("div", { ref: slotsRef, className: "flex items-center gap-3", children: Array.from({ length }, (_, i) => {
227
+ const char = slots[i] ?? "";
228
+ const isActive = i === activeIndex;
229
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
230
+ /* @__PURE__ */ jsxs(
231
+ "div",
232
+ {
233
+ "data-otp-slot": true,
234
+ "data-active": isActive,
235
+ "data-filled": char !== "",
236
+ className: cn(
237
+ "relative grid size-11 place-items-center overflow-hidden rounded-xl border bg-card text-xl font-semibold tabular-nums transition-colors duration-200",
238
+ showSuccess ? "border-emerald-500/60 text-foreground" : status === "error" ? "border-destructive/60 text-foreground" : char ? "border-border-strong text-foreground" : "border-border text-muted-foreground",
239
+ isActive && !showSuccess && status !== "error" && "border-2 border-brand ring-0",
240
+ disabled && "opacity-50"
241
+ ),
242
+ children: [
243
+ isActive && !showSuccess ? /* @__PURE__ */ jsx(
244
+ motion.span,
245
+ {
246
+ "aria-hidden": true,
247
+ animate: reduce ? void 0 : { opacity: [1, 1, 0, 0] },
248
+ transition: reduce ? void 0 : {
249
+ duration: 1,
250
+ repeat: Number.POSITIVE_INFINITY,
251
+ ease: "linear"
252
+ },
253
+ className: cn(
254
+ "pointer-events-none absolute top-1/2 h-6 w-px -translate-y-1/2 bg-brand",
255
+ char ? "right-3" : "left-1/2 -translate-x-1/2"
256
+ )
257
+ }
258
+ ) : null,
259
+ /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: char ? /* @__PURE__ */ jsx(
260
+ motion.span,
261
+ {
262
+ initial: reduce ? {
263
+ opacity: 0
264
+ } : {
265
+ y: 14,
266
+ opacity: 0,
267
+ filter: "blur(4px)"
268
+ },
269
+ animate: reduce ? {
270
+ opacity: 1
271
+ } : {
272
+ y: 0,
273
+ opacity: 1,
274
+ filter: "blur(0px)"
275
+ },
276
+ exit: reduce ? {
277
+ opacity: 0
278
+ } : {
279
+ y: -14,
280
+ opacity: 0,
281
+ filter: "blur(4px)"
282
+ },
283
+ transition: reduce ? {
284
+ duration: 0
285
+ } : {
286
+ duration: 0.22,
287
+ ease: EASE_OUT
288
+ },
289
+ className: "absolute inset-0 grid place-items-center leading-none",
290
+ children: mask ? "X" : char
291
+ },
292
+ char
293
+ ) : null })
294
+ ]
295
+ }
296
+ ),
297
+ i === 2 ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "h-0.5 w-4 bg-primary" }) : null
298
+ ] }, `${uid}-${i}`);
299
+ }) }),
300
+ /* @__PURE__ */ jsx(AnimatePresence, { children: showSuccess ? /* @__PURE__ */ jsx(
301
+ motion.span,
302
+ {
303
+ initial: reduce ? {
304
+ opacity: 0
305
+ } : {
306
+ scale: 0.6,
307
+ opacity: 0
308
+ },
309
+ animate: reduce ? {
310
+ opacity: 1
311
+ } : {
312
+ scale: 1,
313
+ opacity: 1
314
+ },
315
+ exit: reduce ? {
316
+ opacity: 0
317
+ } : {
318
+ scale: 0.6,
319
+ opacity: 0
320
+ },
321
+ transition: reduce ? {
322
+ duration: 0
323
+ } : {
324
+ type: "spring",
325
+ stiffness: 500,
326
+ damping: 28
327
+ },
328
+ className: "pointer-events-none absolute top-1/2 -right-7 -translate-y-1/2 text-emerald-500",
329
+ "aria-hidden": true,
330
+ children: /* @__PURE__ */ jsxs(
331
+ "svg",
332
+ {
333
+ width: "20",
334
+ height: "20",
335
+ viewBox: "0 0 24 24",
336
+ fill: "none",
337
+ stroke: "currentColor",
338
+ strokeWidth: 3,
339
+ strokeLinecap: "round",
340
+ strokeLinejoin: "round",
341
+ children: [
342
+ /* @__PURE__ */ jsx("title", { children: "Verified" }),
343
+ /* @__PURE__ */ jsx(
344
+ motion.path,
345
+ {
346
+ d: "M5 13l4 4L19 7",
347
+ initial: reduce ? {
348
+ pathLength: 1
349
+ } : {
350
+ pathLength: 0
351
+ },
352
+ animate: {
353
+ pathLength: 1
354
+ },
355
+ transition: reduce ? {
356
+ duration: 0
357
+ } : {
358
+ duration: 0.35,
359
+ ease: EASE_OUT,
360
+ delay: 0.1
361
+ }
362
+ }
363
+ )
364
+ ]
365
+ }
366
+ )
367
+ }
368
+ ) : null })
369
+ ]
370
+ }
371
+ ),
372
+ message ? /* @__PURE__ */ jsx(
373
+ "p",
374
+ {
375
+ "aria-live": "polite",
376
+ className: cn(
377
+ "text-sm",
378
+ showSuccess ? "text-emerald-500" : status === "error" ? "text-destructive" : "text-muted-foreground"
379
+ ),
380
+ children: message
381
+ }
382
+ ) : null
383
+ ] });
384
+ }
385
+ function sanitize(raw, length) {
386
+ return (raw ?? "").replace(/\D/g, "").slice(0, length);
387
+ }
388
+ function toSlots(raw, length) {
389
+ const digits = sanitize(raw, length);
390
+ return Array.from({ length }, (_, i) => digits[i] ?? "");
391
+ }
392
+ export {
393
+ EASE_DRAWER,
394
+ EASE_IN_OUT,
395
+ EASE_OUT,
396
+ EASE_OUT_CSS,
397
+ OTPInput,
398
+ SPRING_LAYOUT,
399
+ SPRING_MOUSE,
400
+ SPRING_PANEL,
401
+ SPRING_PRESS,
402
+ SPRING_SWAP
403
+ };
@@ -0,0 +1,83 @@
1
+ "use client";
2
+
3
+ // src/ui/popover.tsx
4
+ import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
5
+ import { cn } from "cn";
6
+ import { jsx } from "react/jsx-runtime";
7
+ function Popover({ ...props }) {
8
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
9
+ }
10
+ function PopoverTrigger({ ...props }) {
11
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
12
+ }
13
+ function PopoverContent({
14
+ className,
15
+ align = "center",
16
+ alignOffset = 0,
17
+ side = "bottom",
18
+ sideOffset = 4,
19
+ ...props
20
+ }) {
21
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
22
+ PopoverPrimitive.Positioner,
23
+ {
24
+ align,
25
+ alignOffset,
26
+ side,
27
+ sideOffset,
28
+ className: "isolate z-50",
29
+ children: /* @__PURE__ */ jsx(
30
+ PopoverPrimitive.Popup,
31
+ {
32
+ "data-slot": "popover-content",
33
+ className: cn(
34
+ "z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-background p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
35
+ className
36
+ ),
37
+ ...props
38
+ }
39
+ )
40
+ }
41
+ ) });
42
+ }
43
+ function PopoverHeader({ className, ...props }) {
44
+ return /* @__PURE__ */ jsx(
45
+ "div",
46
+ {
47
+ "data-slot": "popover-header",
48
+ className: cn("flex flex-col gap-0.5 text-sm", className),
49
+ ...props
50
+ }
51
+ );
52
+ }
53
+ function PopoverTitle({ className, ...props }) {
54
+ return /* @__PURE__ */ jsx(
55
+ PopoverPrimitive.Title,
56
+ {
57
+ "data-slot": "popover-title",
58
+ className: cn("font-medium", className),
59
+ ...props
60
+ }
61
+ );
62
+ }
63
+ function PopoverDescription({
64
+ className,
65
+ ...props
66
+ }) {
67
+ return /* @__PURE__ */ jsx(
68
+ PopoverPrimitive.Description,
69
+ {
70
+ "data-slot": "popover-description",
71
+ className: cn("text-muted-foreground", className),
72
+ ...props
73
+ }
74
+ );
75
+ }
76
+ export {
77
+ Popover,
78
+ PopoverContent,
79
+ PopoverDescription,
80
+ PopoverHeader,
81
+ PopoverTitle,
82
+ PopoverTrigger
83
+ };
@@ -0,0 +1,124 @@
1
+ "use client";
2
+
3
+ // src/ui/qr-code.tsx
4
+ import * as React from "react";
5
+ import QRCodeLib from "qrcode";
6
+ import { cn } from "cn";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ function isInFinderPattern(row, col, size) {
9
+ return row < 7 && col < 7 || row < 7 && col >= size - 7 || row >= size - 7 && col < 7;
10
+ }
11
+ function QRCode({
12
+ value,
13
+ size = 268,
14
+ fgColor = "var(--foreground)",
15
+ bgColor = "var(--background)",
16
+ errorCorrectionLevel = "M",
17
+ className,
18
+ ...props
19
+ }) {
20
+ const qrData = React.useMemo(() => {
21
+ try {
22
+ return QRCodeLib.create(value, { errorCorrectionLevel });
23
+ } catch {
24
+ return null;
25
+ }
26
+ }, [value, errorCorrectionLevel]);
27
+ if (!qrData) {
28
+ return null;
29
+ }
30
+ const moduleCount = qrData.modules.size;
31
+ const moduleSize = size / moduleCount;
32
+ const totalSize = size;
33
+ const circleRadius = moduleSize * (1 / 3);
34
+ const finderPositions = [
35
+ [0, 0],
36
+ [0, moduleCount - 7],
37
+ [moduleCount - 7, 0]
38
+ ];
39
+ const finderSize = 7 * moduleSize;
40
+ const innerPadding = moduleSize;
41
+ const innerWhiteSize = 5 * moduleSize;
42
+ const innerBlackSize = 3 * moduleSize;
43
+ const circles = [];
44
+ for (let row = 0; row < moduleCount; row++) {
45
+ for (let col = 0; col < moduleCount; col++) {
46
+ if (qrData.modules.get(row, col) && !isInFinderPattern(row, col, moduleCount)) {
47
+ circles.push({
48
+ cx: (col + 0.5) * moduleSize,
49
+ cy: (row + 0.5) * moduleSize
50
+ });
51
+ }
52
+ }
53
+ }
54
+ return /* @__PURE__ */ jsxs(
55
+ "svg",
56
+ {
57
+ width: totalSize,
58
+ height: totalSize,
59
+ viewBox: `0 0 ${totalSize} ${totalSize}`,
60
+ xmlns: "http://www.w3.org/2000/svg",
61
+ "aria-label": `QR code for ${value}`,
62
+ className: cn("block", className),
63
+ ...props,
64
+ children: [
65
+ /* @__PURE__ */ jsx(
66
+ "rect",
67
+ {
68
+ width: totalSize,
69
+ height: totalSize,
70
+ fill: bgColor,
71
+ rx: "12",
72
+ ry: "12"
73
+ }
74
+ ),
75
+ finderPositions.map(([r, c]) => {
76
+ const x = c * moduleSize;
77
+ const y = r * moduleSize;
78
+ return /* @__PURE__ */ jsxs("g", { children: [
79
+ /* @__PURE__ */ jsx(
80
+ "rect",
81
+ {
82
+ x,
83
+ y,
84
+ width: finderSize,
85
+ height: finderSize,
86
+ fill: fgColor,
87
+ rx: "12",
88
+ ry: "12"
89
+ }
90
+ ),
91
+ /* @__PURE__ */ jsx(
92
+ "rect",
93
+ {
94
+ x: x + innerPadding,
95
+ y: y + innerPadding,
96
+ width: innerWhiteSize,
97
+ height: innerWhiteSize,
98
+ fill: bgColor,
99
+ rx: "8",
100
+ ry: "8"
101
+ }
102
+ ),
103
+ /* @__PURE__ */ jsx(
104
+ "rect",
105
+ {
106
+ x: x + innerPadding * 2,
107
+ y: y + innerPadding * 2,
108
+ width: innerBlackSize,
109
+ height: innerBlackSize,
110
+ fill: fgColor,
111
+ rx: "3",
112
+ ry: "3"
113
+ }
114
+ )
115
+ ] }, `${r}-${c}`);
116
+ }),
117
+ circles.map(({ cx, cy }, i) => /* @__PURE__ */ jsx("circle", { cx, cy, r: circleRadius, fill: fgColor }, i))
118
+ ]
119
+ }
120
+ );
121
+ }
122
+ export {
123
+ QRCode
124
+ };
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import {
3
+ buttonVariants
4
+ } from "../chunk-DVNTJNDP.js";
5
+
6
+ // src/ui/quantity.tsx
7
+ import { NumberField } from "@base-ui/react/number-field";
8
+ import { Minus, Plus } from "@gravity-ui/icons";
9
+ import * as React from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ var QuantityInput = React.forwardRef(function QuantityInput2({ ...props }, ref) {
12
+ const id = React.useId();
13
+ return /* @__PURE__ */ jsx(NumberField.Root, { id, ...props, className: "flex flex-col items-start", children: /* @__PURE__ */ jsxs(NumberField.Group, { className: "flex h-8 gap-1", children: [
14
+ /* @__PURE__ */ jsx(
15
+ NumberField.Decrement,
16
+ {
17
+ className: buttonVariants({
18
+ variant: "secondary",
19
+ size: "icon-sm",
20
+ className: "rounded-full! border-border!"
21
+ }),
22
+ children: /* @__PURE__ */ jsx(Minus, {})
23
+ }
24
+ ),
25
+ /* @__PURE__ */ jsx(
26
+ NumberField.Input,
27
+ {
28
+ ref,
29
+ className: "h-7 w-16 rounded-md border px-1 text-center",
30
+ "data-no-ring": true
31
+ }
32
+ ),
33
+ /* @__PURE__ */ jsx(
34
+ NumberField.Increment,
35
+ {
36
+ className: buttonVariants({
37
+ variant: "secondary",
38
+ size: "icon-sm",
39
+ className: "rounded-full! border-border!"
40
+ }),
41
+ children: /* @__PURE__ */ jsx(Plus, {})
42
+ }
43
+ )
44
+ ] }) });
45
+ });
46
+ export {
47
+ QuantityInput
48
+ };
@@ -0,0 +1,42 @@
1
+ "use client";
2
+
3
+ // src/ui/radio-group.tsx
4
+ import { Radio as RadioPrimitive } from "@base-ui/react/radio";
5
+ import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
6
+ import { cn } from "cn";
7
+ import { jsx } from "react/jsx-runtime";
8
+ function RadioGroup({ className, ...props }) {
9
+ return /* @__PURE__ */ jsx(
10
+ RadioGroupPrimitive,
11
+ {
12
+ "data-slot": "radio-group",
13
+ className: cn("grid w-full gap-2", className),
14
+ ...props
15
+ }
16
+ );
17
+ }
18
+ function RadioGroupItem({ className, ...props }) {
19
+ return /* @__PURE__ */ jsx(
20
+ RadioPrimitive.Root,
21
+ {
22
+ "data-slot": "radio-group-item",
23
+ className: cn(
24
+ "group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
25
+ className
26
+ ),
27
+ ...props,
28
+ children: /* @__PURE__ */ jsx(
29
+ RadioPrimitive.Indicator,
30
+ {
31
+ "data-slot": "radio-group-indicator",
32
+ className: "flex size-4 items-center justify-center",
33
+ children: /* @__PURE__ */ jsx("span", { className: "absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" })
34
+ }
35
+ )
36
+ }
37
+ );
38
+ }
39
+ export {
40
+ RadioGroup,
41
+ RadioGroupItem
42
+ };