@next-degree/pickle-shared-js 0.3.27 → 0.3.30

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 (73) hide show
  1. package/dist/app/layout.css +30 -2
  2. package/dist/app/layout.css.map +1 -1
  3. package/dist/app/page.cjs +324 -114
  4. package/dist/app/page.cjs.map +1 -1
  5. package/dist/app/page.js +302 -92
  6. package/dist/app/page.js.map +1 -1
  7. package/dist/components/demos/ComboboxDemo.cjs +91 -52
  8. package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
  9. package/dist/components/demos/ComboboxDemo.js +84 -45
  10. package/dist/components/demos/ComboboxDemo.js.map +1 -1
  11. package/dist/components/demos/CounterDemo.cjs +270 -0
  12. package/dist/components/demos/CounterDemo.cjs.map +1 -0
  13. package/dist/components/demos/CounterDemo.d.cts +5 -0
  14. package/dist/components/demos/CounterDemo.d.ts +5 -0
  15. package/dist/components/demos/CounterDemo.js +238 -0
  16. package/dist/components/demos/CounterDemo.js.map +1 -0
  17. package/dist/components/demos/InputDemo.cjs +74 -35
  18. package/dist/components/demos/InputDemo.cjs.map +1 -1
  19. package/dist/components/demos/InputDemo.js +59 -30
  20. package/dist/components/demos/InputDemo.js.map +1 -1
  21. package/dist/components/demos/SelectDemo.cjs +83 -53
  22. package/dist/components/demos/SelectDemo.cjs.map +1 -1
  23. package/dist/components/demos/SelectDemo.js +73 -43
  24. package/dist/components/demos/SelectDemo.js.map +1 -1
  25. package/dist/components/demos/index.cjs +322 -112
  26. package/dist/components/demos/index.cjs.map +1 -1
  27. package/dist/components/demos/index.js +300 -90
  28. package/dist/components/demos/index.js.map +1 -1
  29. package/dist/components/primitives/tooltip.cjs +75 -0
  30. package/dist/components/primitives/tooltip.cjs.map +1 -0
  31. package/dist/components/primitives/tooltip.d.cts +9 -0
  32. package/dist/components/primitives/tooltip.d.ts +9 -0
  33. package/dist/components/primitives/tooltip.js +38 -0
  34. package/dist/components/primitives/tooltip.js.map +1 -0
  35. package/dist/components/ui/Combobox.cjs +78 -40
  36. package/dist/components/ui/Combobox.cjs.map +1 -1
  37. package/dist/components/ui/Combobox.d.cts +5 -2
  38. package/dist/components/ui/Combobox.d.ts +5 -2
  39. package/dist/components/ui/Combobox.js +71 -33
  40. package/dist/components/ui/Combobox.js.map +1 -1
  41. package/dist/components/ui/Counter.cjs +248 -0
  42. package/dist/components/ui/Counter.cjs.map +1 -0
  43. package/dist/components/ui/Counter.d.cts +28 -0
  44. package/dist/components/ui/Counter.d.ts +28 -0
  45. package/dist/components/ui/Counter.js +214 -0
  46. package/dist/components/ui/Counter.js.map +1 -0
  47. package/dist/components/ui/Input.cjs +67 -28
  48. package/dist/components/ui/Input.cjs.map +1 -1
  49. package/dist/components/ui/Input.d.cts +2 -1
  50. package/dist/components/ui/Input.d.ts +2 -1
  51. package/dist/components/ui/Input.js +54 -25
  52. package/dist/components/ui/Input.js.map +1 -1
  53. package/dist/components/ui/Label.cjs +54 -16
  54. package/dist/components/ui/Label.cjs.map +1 -1
  55. package/dist/components/ui/Label.d.cts +2 -1
  56. package/dist/components/ui/Label.d.ts +2 -1
  57. package/dist/components/ui/Label.js +44 -16
  58. package/dist/components/ui/Label.js.map +1 -1
  59. package/dist/components/ui/Select.cjs +75 -46
  60. package/dist/components/ui/Select.cjs.map +1 -1
  61. package/dist/components/ui/Select.d.cts +3 -2
  62. package/dist/components/ui/Select.d.ts +3 -2
  63. package/dist/components/ui/Select.js +67 -38
  64. package/dist/components/ui/Select.js.map +1 -1
  65. package/dist/index.cjs +323 -138
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.d.cts +1 -0
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.js +295 -111
  70. package/dist/index.js.map +1 -1
  71. package/dist/styles/globals.css +30 -2
  72. package/dist/styles/globals.css.map +1 -1
  73. package/package.json +1 -1
@@ -0,0 +1,270 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/components/demos/CounterDemo.tsx
32
+ var CounterDemo_exports = {};
33
+ __export(CounterDemo_exports, {
34
+ default: () => CounterDemo_default
35
+ });
36
+ module.exports = __toCommonJS(CounterDemo_exports);
37
+
38
+ // src/components/ui/Counter.tsx
39
+ var import_cva = require("cva");
40
+ var import_lucide_react2 = require("lucide-react");
41
+ var import_react = require("react");
42
+
43
+ // src/lib/utils.ts
44
+ var import_clsx = require("clsx");
45
+ var import_tailwind_merge = require("tailwind-merge");
46
+ function cn(...inputs) {
47
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
48
+ }
49
+
50
+ // src/components/ui/ErrorMessage.tsx
51
+ var import_jsx_runtime = require("react/jsx-runtime");
52
+ function ErrorMessage({ message, className, ...props }) {
53
+ if (!message) return null;
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: cn("px-1 text-xs text-red-600", className), ...props, children: message });
55
+ }
56
+ var ErrorMessage_default = ErrorMessage;
57
+
58
+ // src/components/primitives/tooltip.tsx
59
+ var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
60
+ var React = __toESM(require("react"), 1);
61
+ var import_jsx_runtime2 = require("react/jsx-runtime");
62
+ var TooltipProvider = TooltipPrimitive.Provider;
63
+ var Tooltip = TooltipPrimitive.Root;
64
+ var TooltipTrigger = TooltipPrimitive.Trigger;
65
+ var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
66
+ TooltipPrimitive.Content,
67
+ {
68
+ ref,
69
+ sideOffset,
70
+ className: cn(
71
+ "z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
72
+ className
73
+ ),
74
+ ...props
75
+ }
76
+ ));
77
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
78
+
79
+ // src/components/ui/Label.tsx
80
+ var import_lucide_react = require("lucide-react");
81
+ var import_jsx_runtime3 = require("react/jsx-runtime");
82
+ function Label({ text, required, description, className, ...props }) {
83
+ if (!text) return null;
84
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex w-full flex-row gap-1", children: [
85
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
86
+ "label",
87
+ {
88
+ className: cn(
89
+ "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
90
+ className
91
+ ),
92
+ ...props,
93
+ children: [
94
+ text,
95
+ required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-red-600", children: "\xA0*" })
96
+ ]
97
+ }
98
+ ),
99
+ !!description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Tooltip, { children: [
100
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.InfoIcon, { className: "h-4 w-4" }) }),
101
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipContent, { className: "max-w-48", children: description })
102
+ ] }) })
103
+ ] });
104
+ }
105
+ var Label_default = Label;
106
+
107
+ // src/components/ui/Counter.tsx
108
+ var import_jsx_runtime4 = require("react/jsx-runtime");
109
+ var Counter = (0, import_react.forwardRef)(
110
+ ({ label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props }, ref) => {
111
+ const [count, setCount] = (0, import_react.useState)(0);
112
+ (0, import_react.useEffect)(() => {
113
+ setCount(value ?? 0);
114
+ }, [value]);
115
+ const handleChange = (e) => {
116
+ const newValue = parseInt(e.target.value.replace(/\D/g, ""), 10);
117
+ if (isNaN(newValue)) return;
118
+ if (min && newValue < min) {
119
+ onChange?.(min);
120
+ setCount(min);
121
+ return;
122
+ }
123
+ if (max && newValue > max) {
124
+ onChange?.(max);
125
+ setCount(max);
126
+ return;
127
+ }
128
+ onChange?.(newValue);
129
+ setCount(newValue);
130
+ };
131
+ const decrement = () => {
132
+ const proposedValue = count - step;
133
+ const newValue = Math.max(min ?? -Infinity, proposedValue);
134
+ onChange?.(newValue);
135
+ setCount(newValue);
136
+ };
137
+ const increment = () => {
138
+ const proposedValue = count + step;
139
+ const newValue = Math.min(max ?? Infinity, proposedValue);
140
+ onChange?.(newValue);
141
+ setCount(newValue);
142
+ };
143
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
144
+ "div",
145
+ {
146
+ className: cn("flex w-auto flex-col gap-1", classNames?.root),
147
+ "data-testid": `counter-wrapper-${props.id}`,
148
+ children: [
149
+ label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
150
+ Label_default,
151
+ {
152
+ text: label,
153
+ htmlFor: props.name,
154
+ required: props.required,
155
+ description,
156
+ className: classNames?.label
157
+ }
158
+ ),
159
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative flex w-[122px] flex-row items-center", children: [
160
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
161
+ "button",
162
+ {
163
+ type: "button",
164
+ className: "absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
165
+ onClick: decrement,
166
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.Minus, { className: "h-4 w-4 text-green-100" })
167
+ }
168
+ ),
169
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
170
+ "input",
171
+ {
172
+ className: cn(counterVariants({ theme }), classNames?.input),
173
+ ref,
174
+ value: count,
175
+ onChange: handleChange,
176
+ "data-testid": `counter-element-${props.id}`,
177
+ ...props
178
+ }
179
+ ),
180
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
181
+ "button",
182
+ {
183
+ type: "button",
184
+ className: "absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
185
+ onClick: increment,
186
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.Plus, { className: "h-4 w-4 text-green-100" })
187
+ }
188
+ )
189
+ ] }),
190
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorMessage_default, { message: error })
191
+ ]
192
+ }
193
+ );
194
+ }
195
+ );
196
+ Counter.displayName = "Counter";
197
+ var counterVariants = (0, import_cva.cva)(
198
+ [
199
+ "border-input",
200
+ "placeholder:text-muted-foreground",
201
+ "focus-visible:ring-ring",
202
+ "inline-flex",
203
+ "w-[122px]",
204
+ "h-11",
205
+ "items-center",
206
+ "justify-start",
207
+ "gap-3",
208
+ "rounded-lg",
209
+ "bg-transparent",
210
+ "px-3",
211
+ "pt-0.5",
212
+ "text-sm",
213
+ "text-center",
214
+ "shadow-sm",
215
+ "ring-grey-50",
216
+ "transition-colors",
217
+ "focus-visible:outline-none",
218
+ "focus-visible:ring-1",
219
+ "disabled:cursor-not-allowed",
220
+ "disabled:opacity-50",
221
+ "appearance-none",
222
+ "[&::-webkit-search-cancel-button]:appearance-none",
223
+ "[&::-webkit-search-decoration]:appearance-none",
224
+ "[&::-webkit-search-results-button]:appearance-none",
225
+ "[&::-webkit-search-results-decoration]:appearance-none",
226
+ "[&::-ms-clear]:display-none",
227
+ "[&::-ms-reveal]:display-none"
228
+ ],
229
+ {
230
+ variants: {
231
+ theme: {
232
+ light: "text-grey-80 border",
233
+ dark: "text-white"
234
+ },
235
+ hasIcon: {
236
+ false: "pl-3",
237
+ true: "pl-8"
238
+ }
239
+ },
240
+ defaultVariants: {
241
+ theme: "light",
242
+ hasIcon: false
243
+ }
244
+ }
245
+ );
246
+
247
+ // src/components/demos/CounterDemo.tsx
248
+ var import_react2 = require("react");
249
+ var import_jsx_runtime5 = require("react/jsx-runtime");
250
+ function CounterDemo() {
251
+ const [count, setCount] = (0, import_react2.useState)(0);
252
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "m-4", children: [
253
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: "Counter" }),
254
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col gap-2 md:flex-row", children: [
255
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
256
+ Counter,
257
+ {
258
+ label: "Required Counter",
259
+ required: true,
260
+ value: count,
261
+ onChange: setCount,
262
+ description: "This is a tooltip"
263
+ }
264
+ ) }),
265
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Counter, { min: 0, max: 10, step: 2 }) })
266
+ ] })
267
+ ] });
268
+ }
269
+ var CounterDemo_default = CounterDemo;
270
+ //# sourceMappingURL=CounterDemo.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/demos/CounterDemo.tsx","../../../src/components/ui/Counter.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/primitives/tooltip.tsx","../../../src/components/ui/Label.tsx"],"sourcesContent":["'use client'\n\nimport { Counter } from '@/components/ui/Counter'\nimport { useState } from 'react'\n\nfunction CounterDemo() {\n const [count, setCount] = useState(0)\n\n return (\n <div className=\"m-4\">\n <h3>Counter</h3>\n <div className=\"flex flex-col gap-2 md:flex-row\">\n <div className=\"p-2\">\n <Counter\n label=\"Required Counter\"\n required\n value={count}\n onChange={setCount}\n description=\"This is a tooltip\"\n />\n </div>\n <div className=\"p-2\">\n <Counter min={0} max={10} step={2} />\n </div>\n </div>\n </div>\n )\n}\n\nexport default CounterDemo\n","'use client'\n\nimport { cva, type VariantProps } from 'cva'\nimport { Minus, Plus } from 'lucide-react'\nimport { ChangeEvent, forwardRef, useEffect, useState, type InputHTMLAttributes } from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ntype InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>\ntype CounterVariants = VariantProps<typeof counterVariants>\ntype Props = InputProps &\n CounterVariants & {\n label?: string\n value?: number\n error?: string\n min?: number\n max?: number\n step?: number\n description?: string\n classNames?: { root?: string; input?: string; label?: string }\n onChange?: (n: number) => void\n }\n\nexport const Counter = forwardRef<HTMLInputElement, Props>(\n (\n { label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props },\n ref\n ) => {\n const [count, setCount] = useState(0)\n\n useEffect(() => {\n setCount(value ?? 0)\n }, [value])\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const newValue = parseInt(e.target.value.replace(/\\D/g, ''), 10)\n if (isNaN(newValue)) return\n if (min && newValue < min) {\n onChange?.(min)\n setCount(min)\n return\n }\n if (max && newValue > max) {\n onChange?.(max)\n setCount(max)\n return\n }\n onChange?.(newValue)\n setCount(newValue)\n }\n\n const decrement = () => {\n const proposedValue = count - step\n const newValue = Math.max(min ?? -Infinity, proposedValue)\n onChange?.(newValue)\n setCount(newValue)\n }\n\n const increment = () => {\n const proposedValue = count + step\n const newValue = Math.min(max ?? Infinity, proposedValue)\n onChange?.(newValue)\n setCount(newValue)\n }\n\n return (\n <div\n className={cn('flex w-auto flex-col gap-1', classNames?.root)}\n data-testid={`counter-wrapper-${props.id}`}\n >\n {label && (\n <Label\n text={label}\n htmlFor={props.name}\n required={props.required}\n description={description}\n className={classNames?.label}\n />\n )}\n\n <div className=\"relative flex w-[122px] flex-row items-center\">\n <button\n type=\"button\"\n className=\"absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20\"\n onClick={decrement}\n >\n <Minus className=\"h-4 w-4 text-green-100\" />\n </button>\n\n <input\n className={cn(counterVariants({ theme }), classNames?.input)}\n ref={ref}\n value={count}\n onChange={handleChange}\n data-testid={`counter-element-${props.id}`}\n {...props}\n />\n\n <button\n type=\"button\"\n className=\"absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20\"\n onClick={increment}\n >\n <Plus className=\"h-4 w-4 text-green-100\" />\n </button>\n </div>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\nCounter.displayName = 'Counter'\n\nconst counterVariants = cva(\n [\n 'border-input',\n 'placeholder:text-muted-foreground',\n 'focus-visible:ring-ring',\n 'inline-flex',\n 'w-[122px]',\n 'h-11',\n 'items-center',\n 'justify-start',\n 'gap-3',\n 'rounded-lg',\n 'bg-transparent',\n 'px-3',\n 'pt-0.5',\n 'text-sm',\n 'text-center',\n 'shadow-sm',\n 'ring-grey-50',\n 'transition-colors',\n 'focus-visible:outline-none',\n 'focus-visible:ring-1',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'appearance-none',\n '[&::-webkit-search-cancel-button]:appearance-none',\n '[&::-webkit-search-decoration]:appearance-none',\n '[&::-webkit-search-results-button]:appearance-none',\n '[&::-webkit-search-results-decoration]:appearance-none',\n '[&::-ms-clear]:display-none',\n '[&::-ms-reveal]:display-none',\n ],\n {\n variants: {\n theme: {\n light: 'text-grey-80 border',\n dark: 'text-white',\n },\n hasIcon: {\n false: 'pl-3',\n true: 'pl-8',\n },\n },\n defaultVariants: {\n theme: 'light',\n hasIcon: false,\n },\n }\n)\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","'use client'\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50',\n className\n )}\n {...props}\n />\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { InfoIcon } from 'lucide-react'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n required?: boolean\n description?: string\n}\n\nfunction Label({ text, required, description, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <div className=\"flex w-full flex-row gap-1\">\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n {required && <span className=\"text-red-600\">&nbsp;*</span>}\n </label>\n\n {!!description && (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <InfoIcon className=\"h-4 w-4\" />\n </TooltipTrigger>\n <TooltipContent className=\"max-w-48\">{description}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n )\n}\n\nexport default Label\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,iBAAuC;AACvC,IAAAA,uBAA4B;AAC5B,mBAAuF;;;ACJvF,kBAAsC;AACt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AAC,gBAAyB;AAOnB,IAAAC,sBAAA;AALN,SAAS,cAAc;AACrB,QAAM,CAAC,OAAO,QAAQ,QAAI,wBAAS,CAAC;AAEpC,SACE,8CAAC,SAAI,WAAU,OACb;AAAA,iDAAC,QAAG,qBAAO;AAAA,IACX,8CAAC,SAAI,WAAU,mCACb;AAAA,mDAAC,SAAI,WAAU,OACb;AAAA,QAAC;AAAA;AAAA,UACC,OAAM;AAAA,UACN,UAAQ;AAAA,UACR,OAAO;AAAA,UACP,UAAU;AAAA,UACV,aAAY;AAAA;AAAA,MACd,GACF;AAAA,MACA,6CAAC,SAAI,WAAU,OACb,uDAAC,WAAQ,KAAK,GAAG,KAAK,IAAI,MAAM,GAAG,GACrC;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,IAAO,sBAAQ;","names":["import_lucide_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime"]}
@@ -0,0 +1,5 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function CounterDemo(): react_jsx_runtime.JSX.Element;
4
+
5
+ export { CounterDemo as default };
@@ -0,0 +1,5 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function CounterDemo(): react_jsx_runtime.JSX.Element;
4
+
5
+ export { CounterDemo as default };
@@ -0,0 +1,238 @@
1
+ "use client";
2
+
3
+ // src/components/ui/Counter.tsx
4
+ import { cva } from "cva";
5
+ import { Minus, Plus } from "lucide-react";
6
+ import { forwardRef as forwardRef2, useEffect, useState } from "react";
7
+
8
+ // src/lib/utils.ts
9
+ import { clsx } from "clsx";
10
+ import { twMerge } from "tailwind-merge";
11
+ function cn(...inputs) {
12
+ return twMerge(clsx(inputs));
13
+ }
14
+
15
+ // src/components/ui/ErrorMessage.tsx
16
+ import { jsx } from "react/jsx-runtime";
17
+ function ErrorMessage({ message, className, ...props }) {
18
+ if (!message) return null;
19
+ return /* @__PURE__ */ jsx("p", { className: cn("px-1 text-xs text-red-600", className), ...props, children: message });
20
+ }
21
+ var ErrorMessage_default = ErrorMessage;
22
+
23
+ // src/components/primitives/tooltip.tsx
24
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
25
+ import * as React from "react";
26
+ import { jsx as jsx2 } from "react/jsx-runtime";
27
+ var TooltipProvider = TooltipPrimitive.Provider;
28
+ var Tooltip = TooltipPrimitive.Root;
29
+ var TooltipTrigger = TooltipPrimitive.Trigger;
30
+ var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx2(
31
+ TooltipPrimitive.Content,
32
+ {
33
+ ref,
34
+ sideOffset,
35
+ className: cn(
36
+ "z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
37
+ className
38
+ ),
39
+ ...props
40
+ }
41
+ ));
42
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
43
+
44
+ // src/components/ui/Label.tsx
45
+ import { InfoIcon } from "lucide-react";
46
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
47
+ function Label({ text, required, description, className, ...props }) {
48
+ if (!text) return null;
49
+ return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-row gap-1", children: [
50
+ /* @__PURE__ */ jsxs(
51
+ "label",
52
+ {
53
+ className: cn(
54
+ "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
55
+ className
56
+ ),
57
+ ...props,
58
+ children: [
59
+ text,
60
+ required && /* @__PURE__ */ jsx3("span", { className: "text-red-600", children: "\xA0*" })
61
+ ]
62
+ }
63
+ ),
64
+ !!description && /* @__PURE__ */ jsx3(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
65
+ /* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx3(InfoIcon, { className: "h-4 w-4" }) }),
66
+ /* @__PURE__ */ jsx3(TooltipContent, { className: "max-w-48", children: description })
67
+ ] }) })
68
+ ] });
69
+ }
70
+ var Label_default = Label;
71
+
72
+ // src/components/ui/Counter.tsx
73
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
74
+ var Counter = forwardRef2(
75
+ ({ label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props }, ref) => {
76
+ const [count, setCount] = useState(0);
77
+ useEffect(() => {
78
+ setCount(value ?? 0);
79
+ }, [value]);
80
+ const handleChange = (e) => {
81
+ const newValue = parseInt(e.target.value.replace(/\D/g, ""), 10);
82
+ if (isNaN(newValue)) return;
83
+ if (min && newValue < min) {
84
+ onChange?.(min);
85
+ setCount(min);
86
+ return;
87
+ }
88
+ if (max && newValue > max) {
89
+ onChange?.(max);
90
+ setCount(max);
91
+ return;
92
+ }
93
+ onChange?.(newValue);
94
+ setCount(newValue);
95
+ };
96
+ const decrement = () => {
97
+ const proposedValue = count - step;
98
+ const newValue = Math.max(min ?? -Infinity, proposedValue);
99
+ onChange?.(newValue);
100
+ setCount(newValue);
101
+ };
102
+ const increment = () => {
103
+ const proposedValue = count + step;
104
+ const newValue = Math.min(max ?? Infinity, proposedValue);
105
+ onChange?.(newValue);
106
+ setCount(newValue);
107
+ };
108
+ return /* @__PURE__ */ jsxs2(
109
+ "div",
110
+ {
111
+ className: cn("flex w-auto flex-col gap-1", classNames?.root),
112
+ "data-testid": `counter-wrapper-${props.id}`,
113
+ children: [
114
+ label && /* @__PURE__ */ jsx4(
115
+ Label_default,
116
+ {
117
+ text: label,
118
+ htmlFor: props.name,
119
+ required: props.required,
120
+ description,
121
+ className: classNames?.label
122
+ }
123
+ ),
124
+ /* @__PURE__ */ jsxs2("div", { className: "relative flex w-[122px] flex-row items-center", children: [
125
+ /* @__PURE__ */ jsx4(
126
+ "button",
127
+ {
128
+ type: "button",
129
+ className: "absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
130
+ onClick: decrement,
131
+ children: /* @__PURE__ */ jsx4(Minus, { className: "h-4 w-4 text-green-100" })
132
+ }
133
+ ),
134
+ /* @__PURE__ */ jsx4(
135
+ "input",
136
+ {
137
+ className: cn(counterVariants({ theme }), classNames?.input),
138
+ ref,
139
+ value: count,
140
+ onChange: handleChange,
141
+ "data-testid": `counter-element-${props.id}`,
142
+ ...props
143
+ }
144
+ ),
145
+ /* @__PURE__ */ jsx4(
146
+ "button",
147
+ {
148
+ type: "button",
149
+ className: "absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
150
+ onClick: increment,
151
+ children: /* @__PURE__ */ jsx4(Plus, { className: "h-4 w-4 text-green-100" })
152
+ }
153
+ )
154
+ ] }),
155
+ /* @__PURE__ */ jsx4(ErrorMessage_default, { message: error })
156
+ ]
157
+ }
158
+ );
159
+ }
160
+ );
161
+ Counter.displayName = "Counter";
162
+ var counterVariants = cva(
163
+ [
164
+ "border-input",
165
+ "placeholder:text-muted-foreground",
166
+ "focus-visible:ring-ring",
167
+ "inline-flex",
168
+ "w-[122px]",
169
+ "h-11",
170
+ "items-center",
171
+ "justify-start",
172
+ "gap-3",
173
+ "rounded-lg",
174
+ "bg-transparent",
175
+ "px-3",
176
+ "pt-0.5",
177
+ "text-sm",
178
+ "text-center",
179
+ "shadow-sm",
180
+ "ring-grey-50",
181
+ "transition-colors",
182
+ "focus-visible:outline-none",
183
+ "focus-visible:ring-1",
184
+ "disabled:cursor-not-allowed",
185
+ "disabled:opacity-50",
186
+ "appearance-none",
187
+ "[&::-webkit-search-cancel-button]:appearance-none",
188
+ "[&::-webkit-search-decoration]:appearance-none",
189
+ "[&::-webkit-search-results-button]:appearance-none",
190
+ "[&::-webkit-search-results-decoration]:appearance-none",
191
+ "[&::-ms-clear]:display-none",
192
+ "[&::-ms-reveal]:display-none"
193
+ ],
194
+ {
195
+ variants: {
196
+ theme: {
197
+ light: "text-grey-80 border",
198
+ dark: "text-white"
199
+ },
200
+ hasIcon: {
201
+ false: "pl-3",
202
+ true: "pl-8"
203
+ }
204
+ },
205
+ defaultVariants: {
206
+ theme: "light",
207
+ hasIcon: false
208
+ }
209
+ }
210
+ );
211
+
212
+ // src/components/demos/CounterDemo.tsx
213
+ import { useState as useState2 } from "react";
214
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
215
+ function CounterDemo() {
216
+ const [count, setCount] = useState2(0);
217
+ return /* @__PURE__ */ jsxs3("div", { className: "m-4", children: [
218
+ /* @__PURE__ */ jsx5("h3", { children: "Counter" }),
219
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2 md:flex-row", children: [
220
+ /* @__PURE__ */ jsx5("div", { className: "p-2", children: /* @__PURE__ */ jsx5(
221
+ Counter,
222
+ {
223
+ label: "Required Counter",
224
+ required: true,
225
+ value: count,
226
+ onChange: setCount,
227
+ description: "This is a tooltip"
228
+ }
229
+ ) }),
230
+ /* @__PURE__ */ jsx5("div", { className: "p-2", children: /* @__PURE__ */ jsx5(Counter, { min: 0, max: 10, step: 2 }) })
231
+ ] })
232
+ ] });
233
+ }
234
+ var CounterDemo_default = CounterDemo;
235
+ export {
236
+ CounterDemo_default as default
237
+ };
238
+ //# sourceMappingURL=CounterDemo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ui/Counter.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/primitives/tooltip.tsx","../../../src/components/ui/Label.tsx","../../../src/components/demos/CounterDemo.tsx"],"sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'cva'\nimport { Minus, Plus } from 'lucide-react'\nimport { ChangeEvent, forwardRef, useEffect, useState, type InputHTMLAttributes } from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ntype InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>\ntype CounterVariants = VariantProps<typeof counterVariants>\ntype Props = InputProps &\n CounterVariants & {\n label?: string\n value?: number\n error?: string\n min?: number\n max?: number\n step?: number\n description?: string\n classNames?: { root?: string; input?: string; label?: string }\n onChange?: (n: number) => void\n }\n\nexport const Counter = forwardRef<HTMLInputElement, Props>(\n (\n { label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props },\n ref\n ) => {\n const [count, setCount] = useState(0)\n\n useEffect(() => {\n setCount(value ?? 0)\n }, [value])\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const newValue = parseInt(e.target.value.replace(/\\D/g, ''), 10)\n if (isNaN(newValue)) return\n if (min && newValue < min) {\n onChange?.(min)\n setCount(min)\n return\n }\n if (max && newValue > max) {\n onChange?.(max)\n setCount(max)\n return\n }\n onChange?.(newValue)\n setCount(newValue)\n }\n\n const decrement = () => {\n const proposedValue = count - step\n const newValue = Math.max(min ?? -Infinity, proposedValue)\n onChange?.(newValue)\n setCount(newValue)\n }\n\n const increment = () => {\n const proposedValue = count + step\n const newValue = Math.min(max ?? Infinity, proposedValue)\n onChange?.(newValue)\n setCount(newValue)\n }\n\n return (\n <div\n className={cn('flex w-auto flex-col gap-1', classNames?.root)}\n data-testid={`counter-wrapper-${props.id}`}\n >\n {label && (\n <Label\n text={label}\n htmlFor={props.name}\n required={props.required}\n description={description}\n className={classNames?.label}\n />\n )}\n\n <div className=\"relative flex w-[122px] flex-row items-center\">\n <button\n type=\"button\"\n className=\"absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20\"\n onClick={decrement}\n >\n <Minus className=\"h-4 w-4 text-green-100\" />\n </button>\n\n <input\n className={cn(counterVariants({ theme }), classNames?.input)}\n ref={ref}\n value={count}\n onChange={handleChange}\n data-testid={`counter-element-${props.id}`}\n {...props}\n />\n\n <button\n type=\"button\"\n className=\"absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20\"\n onClick={increment}\n >\n <Plus className=\"h-4 w-4 text-green-100\" />\n </button>\n </div>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\nCounter.displayName = 'Counter'\n\nconst counterVariants = cva(\n [\n 'border-input',\n 'placeholder:text-muted-foreground',\n 'focus-visible:ring-ring',\n 'inline-flex',\n 'w-[122px]',\n 'h-11',\n 'items-center',\n 'justify-start',\n 'gap-3',\n 'rounded-lg',\n 'bg-transparent',\n 'px-3',\n 'pt-0.5',\n 'text-sm',\n 'text-center',\n 'shadow-sm',\n 'ring-grey-50',\n 'transition-colors',\n 'focus-visible:outline-none',\n 'focus-visible:ring-1',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'appearance-none',\n '[&::-webkit-search-cancel-button]:appearance-none',\n '[&::-webkit-search-decoration]:appearance-none',\n '[&::-webkit-search-results-button]:appearance-none',\n '[&::-webkit-search-results-decoration]:appearance-none',\n '[&::-ms-clear]:display-none',\n '[&::-ms-reveal]:display-none',\n ],\n {\n variants: {\n theme: {\n light: 'text-grey-80 border',\n dark: 'text-white',\n },\n hasIcon: {\n false: 'pl-3',\n true: 'pl-8',\n },\n },\n defaultVariants: {\n theme: 'light',\n hasIcon: false,\n },\n }\n)\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","'use client'\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50',\n className\n )}\n {...props}\n />\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { InfoIcon } from 'lucide-react'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n required?: boolean\n description?: string\n}\n\nfunction Label({ text, required, description, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <div className=\"flex w-full flex-row gap-1\">\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n {required && <span className=\"text-red-600\">&nbsp;*</span>}\n </label>\n\n {!!description && (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <InfoIcon className=\"h-4 w-4\" />\n </TooltipTrigger>\n <TooltipContent className=\"max-w-48\">{description}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n )\n}\n\nexport default Label\n","'use client'\n\nimport { Counter } from '@/components/ui/Counter'\nimport { useState } from 'react'\n\nfunction CounterDemo() {\n const [count, setCount] = useState(0)\n\n return (\n <div className=\"m-4\">\n <h3>Counter</h3>\n <div className=\"flex flex-col gap-2 md:flex-row\">\n <div className=\"p-2\">\n <Counter\n label=\"Required Counter\"\n required\n value={count}\n onChange={setCount}\n description=\"This is a tooltip\"\n />\n </div>\n <div className=\"p-2\">\n <Counter min={0} max={10} step={2} />\n </div>\n </div>\n </div>\n )\n}\n\nexport default CounterDemo\n"],"mappings":";;;AAEA,SAAS,WAA8B;AACvC,SAAS,OAAO,YAAY;AAC5B,SAAsB,cAAAA,aAAY,WAAW,gBAA0C;;;ACJvF,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACOI;AAJJ,SAAS,aAAa,EAAE,SAAS,WAAW,GAAG,MAAM,GAAoB;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,SACE,oBAAC,OAAE,WAAW,GAAG,6BAA6B,SAAS,GAAI,GAAG,OAC3D,mBACH;AAEJ;AAEA,IAAO,uBAAQ;;;AChBf,YAAY,sBAAsB;AAClC,YAAY,WAAW;AAcrB,gBAAAC,YAAA;AAVF,IAAM,kBAAmC;AAEzC,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAExC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,GAAG,MAAM,GAAG,QAC1C,gBAAAA;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;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AA,KAAC,WAAQ,KAAK,GAAG,KAAK,IAAI,MAAM,GAAG,GACrC;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,IAAO,sBAAQ;","names":["forwardRef","jsx","jsx","jsx","jsxs","forwardRef","useState","jsx","jsxs"]}