@next-degree/pickle-shared-js 0.3.25 → 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.
- package/dist/app/layout.css +30 -13
- package/dist/app/layout.css.map +1 -1
- package/dist/app/page.cjs +347 -116
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +328 -97
- package/dist/app/page.js.map +1 -1
- package/dist/components/demos/ComboboxDemo.cjs +97 -54
- package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
- package/dist/components/demos/ComboboxDemo.js +91 -48
- package/dist/components/demos/ComboboxDemo.js.map +1 -1
- package/dist/components/demos/CounterDemo.cjs +270 -0
- package/dist/components/demos/CounterDemo.cjs.map +1 -0
- package/dist/components/demos/CounterDemo.d.cts +5 -0
- package/dist/components/demos/CounterDemo.d.ts +5 -0
- package/dist/components/demos/CounterDemo.js +238 -0
- package/dist/components/demos/CounterDemo.js.map +1 -0
- package/dist/components/demos/InputDemo.cjs +82 -35
- package/dist/components/demos/InputDemo.cjs.map +1 -1
- package/dist/components/demos/InputDemo.js +68 -31
- package/dist/components/demos/InputDemo.js.map +1 -1
- package/dist/components/demos/SelectDemo.cjs +92 -53
- package/dist/components/demos/SelectDemo.cjs.map +1 -1
- package/dist/components/demos/SelectDemo.js +83 -44
- package/dist/components/demos/SelectDemo.js.map +1 -1
- package/dist/components/demos/index.cjs +345 -114
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +326 -95
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/primitives/tooltip.cjs +75 -0
- package/dist/components/primitives/tooltip.cjs.map +1 -0
- package/dist/components/primitives/tooltip.d.cts +9 -0
- package/dist/components/primitives/tooltip.d.ts +9 -0
- package/dist/components/primitives/tooltip.js +38 -0
- package/dist/components/primitives/tooltip.js.map +1 -0
- package/dist/components/ui/Combobox.cjs +83 -42
- package/dist/components/ui/Combobox.cjs.map +1 -1
- package/dist/components/ui/Combobox.d.cts +5 -2
- package/dist/components/ui/Combobox.d.ts +5 -2
- package/dist/components/ui/Combobox.js +77 -36
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/components/ui/Counter.cjs +248 -0
- package/dist/components/ui/Counter.cjs.map +1 -0
- package/dist/components/ui/Counter.d.cts +28 -0
- package/dist/components/ui/Counter.d.ts +28 -0
- package/dist/components/ui/Counter.js +214 -0
- package/dist/components/ui/Counter.js.map +1 -0
- package/dist/components/ui/Input.cjs +75 -28
- package/dist/components/ui/Input.cjs.map +1 -1
- package/dist/components/ui/Input.d.cts +2 -1
- package/dist/components/ui/Input.d.ts +2 -1
- package/dist/components/ui/Input.js +63 -26
- package/dist/components/ui/Input.js.map +1 -1
- package/dist/components/ui/Label.cjs +54 -16
- package/dist/components/ui/Label.cjs.map +1 -1
- package/dist/components/ui/Label.d.cts +2 -1
- package/dist/components/ui/Label.d.ts +2 -1
- package/dist/components/ui/Label.js +44 -16
- package/dist/components/ui/Label.js.map +1 -1
- package/dist/components/ui/Select.cjs +83 -46
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.d.cts +3 -2
- package/dist/components/ui/Select.d.ts +3 -2
- package/dist/components/ui/Select.js +75 -38
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/index.cjs +344 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +318 -115
- package/dist/index.js.map +1 -1
- package/dist/styles/globals.css +30 -13
- package/dist/styles/globals.css.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3
3
|
import { CheckIcon, ChevronDownIcon, X } from "lucide-react";
|
|
4
4
|
import {
|
|
5
|
-
forwardRef as
|
|
5
|
+
forwardRef as forwardRef3,
|
|
6
6
|
useEffect,
|
|
7
7
|
useRef,
|
|
8
8
|
useState
|
|
@@ -23,32 +23,60 @@ function ErrorMessage({ message, className, ...props }) {
|
|
|
23
23
|
}
|
|
24
24
|
var ErrorMessage_default = ErrorMessage;
|
|
25
25
|
|
|
26
|
+
// src/components/primitives/tooltip.tsx
|
|
27
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
28
|
+
import * as React from "react";
|
|
29
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
30
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
31
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
32
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
33
|
+
var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx2(
|
|
34
|
+
TooltipPrimitive.Content,
|
|
35
|
+
{
|
|
36
|
+
ref,
|
|
37
|
+
sideOffset,
|
|
38
|
+
className: cn(
|
|
39
|
+
"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",
|
|
40
|
+
className
|
|
41
|
+
),
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
));
|
|
45
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
46
|
+
|
|
26
47
|
// src/components/ui/Label.tsx
|
|
27
|
-
import {
|
|
28
|
-
|
|
48
|
+
import { InfoIcon } from "lucide-react";
|
|
49
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
50
|
+
function Label({ text, required, description, className, ...props }) {
|
|
29
51
|
if (!text) return null;
|
|
30
|
-
return /* @__PURE__ */ jsxs(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-row gap-1", children: [
|
|
53
|
+
/* @__PURE__ */ jsxs(
|
|
54
|
+
"label",
|
|
55
|
+
{
|
|
56
|
+
className: cn(
|
|
57
|
+
"text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
...props,
|
|
61
|
+
children: [
|
|
62
|
+
text,
|
|
63
|
+
required && /* @__PURE__ */ jsx3("span", { className: "text-red-600", children: "\xA0*" })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
!!description && /* @__PURE__ */ jsx3(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
68
|
+
/* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx3(InfoIcon, { className: "h-4 w-4" }) }),
|
|
69
|
+
/* @__PURE__ */ jsx3(TooltipContent, { className: "max-w-48", children: description })
|
|
70
|
+
] }) })
|
|
71
|
+
] });
|
|
44
72
|
}
|
|
45
73
|
var Label_default = Label;
|
|
46
74
|
|
|
47
75
|
// src/components/ui/Chip.tsx
|
|
48
76
|
import { cva } from "cva";
|
|
49
77
|
import { twMerge as twMerge2 } from "tailwind-merge";
|
|
50
|
-
import { jsx as
|
|
51
|
-
var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */
|
|
78
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
79
|
+
var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ jsx4("div", { className: twMerge2(chipVariants({ variant, size, className })), ...props });
|
|
52
80
|
var chipVariants = cva(["flex", "items-center", "rounded-3xl", "border", "w-fit"], {
|
|
53
81
|
variants: {
|
|
54
82
|
variant: {
|
|
@@ -72,9 +100,9 @@ var Chip_default = Chip;
|
|
|
72
100
|
|
|
73
101
|
// src/components/primitives/separator.tsx
|
|
74
102
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
75
|
-
import * as
|
|
76
|
-
import { jsx as
|
|
77
|
-
var Separator =
|
|
103
|
+
import * as React2 from "react";
|
|
104
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
105
|
+
var Separator = React2.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx5(
|
|
78
106
|
SeparatorPrimitive.Root,
|
|
79
107
|
{
|
|
80
108
|
ref,
|
|
@@ -91,9 +119,9 @@ var Separator = React.forwardRef(({ className, orientation = "horizontal", decor
|
|
|
91
119
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
92
120
|
|
|
93
121
|
// src/components/ui/Select.tsx
|
|
94
|
-
import { jsx as
|
|
95
|
-
var Select =
|
|
96
|
-
({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {
|
|
122
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
123
|
+
var Select = forwardRef3(
|
|
124
|
+
({ label, options, placeholder, multiselect, description, classNames, error, id, ...props }, ref) => {
|
|
97
125
|
const { value, defaultValue, dir, className, onChange, ...rest } = props;
|
|
98
126
|
const [selected, setSelected] = useState([]);
|
|
99
127
|
const [open, setOpen] = useState(false);
|
|
@@ -126,11 +154,20 @@ var Select = forwardRef2(
|
|
|
126
154
|
return /* @__PURE__ */ jsxs2(
|
|
127
155
|
"div",
|
|
128
156
|
{
|
|
129
|
-
className: cn("flex flex-col
|
|
157
|
+
className: cn("flex w-full flex-col gap-1", className),
|
|
130
158
|
ref: containerRef,
|
|
131
159
|
"data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
|
|
132
160
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ jsx6(
|
|
162
|
+
Label_default,
|
|
163
|
+
{
|
|
164
|
+
text: label,
|
|
165
|
+
htmlFor: props.name,
|
|
166
|
+
required: props.required,
|
|
167
|
+
description,
|
|
168
|
+
className: classNames?.label
|
|
169
|
+
}
|
|
170
|
+
),
|
|
134
171
|
/* @__PURE__ */ jsxs2(
|
|
135
172
|
SelectPrimitive.Root,
|
|
136
173
|
{
|
|
@@ -147,11 +184,11 @@ var Select = forwardRef2(
|
|
|
147
184
|
{
|
|
148
185
|
ref,
|
|
149
186
|
className: cn(
|
|
150
|
-
"group flex h-11
|
|
187
|
+
"group flex h-11 w-full flex-row items-center justify-between gap-3 rounded-lg border px-4 py-3 text-sm font-normal focus:outline-purple-100 disabled:bg-grey-5 data-[placeholder]:text-grey-50 data-[placeholder]:disabled:text-grey-40",
|
|
151
188
|
classNames?.trigger
|
|
152
189
|
),
|
|
153
190
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", children: /* @__PURE__ */ jsx6(
|
|
155
192
|
SelectPrimitive.Value,
|
|
156
193
|
{
|
|
157
194
|
placeholder: placeholder ?? "Select an option",
|
|
@@ -159,7 +196,7 @@ var Select = forwardRef2(
|
|
|
159
196
|
children: handleLabels()
|
|
160
197
|
}
|
|
161
198
|
) }),
|
|
162
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ jsx6(
|
|
163
200
|
ChevronDownIcon,
|
|
164
201
|
{
|
|
165
202
|
className: "transform text-black group-data-[state=open]:rotate-180",
|
|
@@ -169,7 +206,7 @@ var Select = forwardRef2(
|
|
|
169
206
|
]
|
|
170
207
|
}
|
|
171
208
|
),
|
|
172
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ jsx6(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ jsx6(
|
|
173
210
|
SelectPrimitive.Content,
|
|
174
211
|
{
|
|
175
212
|
hideWhenDetached: true,
|
|
@@ -179,15 +216,15 @@ var Select = forwardRef2(
|
|
|
179
216
|
onPointerDownOutside: toggleOpen,
|
|
180
217
|
onKeyDown: closeOnEscape,
|
|
181
218
|
children: /* @__PURE__ */ jsxs2(SelectPrimitive.Viewport, { children: [
|
|
182
|
-
multiselect && !!chipLabels?.length && /* @__PURE__ */
|
|
219
|
+
multiselect && !!chipLabels?.length && /* @__PURE__ */ jsx6(
|
|
183
220
|
SelectPrimitive.Group,
|
|
184
221
|
{
|
|
185
222
|
className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
|
|
186
223
|
"data-testid": "selected-labels",
|
|
187
224
|
children: chipLabels?.map(
|
|
188
225
|
(chip) => chip && /* @__PURE__ */ jsxs2(Chip_default, { size: "small", variant: "primary", children: [
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ jsx6("span", { children: chip.title }),
|
|
227
|
+
/* @__PURE__ */ jsx6(
|
|
191
228
|
X,
|
|
192
229
|
{
|
|
193
230
|
size: 18,
|
|
@@ -200,7 +237,7 @@ var Select = forwardRef2(
|
|
|
200
237
|
)
|
|
201
238
|
}
|
|
202
239
|
),
|
|
203
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ jsx6(Separator, {}),
|
|
204
241
|
options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs2(
|
|
205
242
|
SelectPrimitive.Item,
|
|
206
243
|
{
|
|
@@ -210,8 +247,8 @@ var Select = forwardRef2(
|
|
|
210
247
|
onKeyDown: (e) => setValueOnEnter(e, value2),
|
|
211
248
|
onClick: () => handleChange(value2),
|
|
212
249
|
children: [
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ jsx6(SelectPrimitive.ItemText, { children: title }),
|
|
251
|
+
/* @__PURE__ */ jsx6(
|
|
215
252
|
CheckIcon,
|
|
216
253
|
{
|
|
217
254
|
className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
|
|
@@ -228,7 +265,7 @@ var Select = forwardRef2(
|
|
|
228
265
|
]
|
|
229
266
|
}
|
|
230
267
|
),
|
|
231
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ jsx6(ErrorMessage_default, { message: error })
|
|
232
269
|
]
|
|
233
270
|
}
|
|
234
271
|
);
|
|
@@ -241,10 +278,10 @@ var Select_default = Select;
|
|
|
241
278
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
242
279
|
import { Check, Minus } from "lucide-react";
|
|
243
280
|
import {
|
|
244
|
-
forwardRef as
|
|
281
|
+
forwardRef as forwardRef4
|
|
245
282
|
} from "react";
|
|
246
|
-
import { jsx as
|
|
247
|
-
var CheckboxToggle =
|
|
283
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
284
|
+
var CheckboxToggle = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
248
285
|
CheckboxPrimitive.Root,
|
|
249
286
|
{
|
|
250
287
|
ref,
|
|
@@ -275,20 +312,20 @@ var CheckboxToggle = forwardRef3(({ className, ...props }, ref) => /* @__PURE__
|
|
|
275
312
|
),
|
|
276
313
|
...props,
|
|
277
314
|
children: /* @__PURE__ */ jsxs3(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: [
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ jsx7(Check, { className: "hidden h-4 w-4 group-data-[state=checked]:block" }),
|
|
316
|
+
/* @__PURE__ */ jsx7(Minus, { className: "hidden h-4 w-4 group-data-[state=indeterminate]:block" })
|
|
280
317
|
] })
|
|
281
318
|
}
|
|
282
319
|
));
|
|
283
320
|
CheckboxToggle.displayName = CheckboxPrimitive.Root.displayName;
|
|
284
|
-
var Checkbox =
|
|
321
|
+
var Checkbox = forwardRef4(
|
|
285
322
|
({ classNames, children, ...props }, ref) => {
|
|
286
323
|
const { disabled } = props;
|
|
287
324
|
const id = props.id ?? `${props.name ?? props.value?.toString()}-checkbox`;
|
|
288
325
|
const labelClassName = disabled ? "text-grey-40 pointer-events-none" : "";
|
|
289
326
|
return /* @__PURE__ */ jsxs3("div", { className: cn("flex space-x-2", classNames?.wrapper), children: [
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
327
|
+
/* @__PURE__ */ jsx7(CheckboxToggle, { id, disabled, ref, ...props }),
|
|
328
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: id, className: cn(labelClassName, classNames?.label), children })
|
|
292
329
|
] });
|
|
293
330
|
}
|
|
294
331
|
);
|
|
@@ -298,7 +335,7 @@ var Checkbox_default = Checkbox;
|
|
|
298
335
|
// src/components/ui/ListItem.tsx
|
|
299
336
|
import { CheckIcon as CheckIcon2 } from "lucide-react";
|
|
300
337
|
import { icons } from "lucide-react";
|
|
301
|
-
import { jsx as
|
|
338
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
302
339
|
function ListItem({
|
|
303
340
|
icon,
|
|
304
341
|
hasCheckbox,
|
|
@@ -312,7 +349,7 @@ function ListItem({
|
|
|
312
349
|
const getIconIfValid = (icon2) => {
|
|
313
350
|
if (icon2 in icons) {
|
|
314
351
|
const IconComponent = icons[icon2];
|
|
315
|
-
return /* @__PURE__ */
|
|
352
|
+
return /* @__PURE__ */ jsx8(IconComponent, { size: 14 });
|
|
316
353
|
}
|
|
317
354
|
return null;
|
|
318
355
|
};
|
|
@@ -327,13 +364,13 @@ function ListItem({
|
|
|
327
364
|
...props,
|
|
328
365
|
"data-state": isSelected ? "checked" : "unchecked",
|
|
329
366
|
children: [
|
|
330
|
-
optionIcon && /* @__PURE__ */
|
|
331
|
-
hasCheckbox && /* @__PURE__ */
|
|
367
|
+
optionIcon && /* @__PURE__ */ jsx8("span", { className: "mr-2", children: optionIcon }),
|
|
368
|
+
hasCheckbox && /* @__PURE__ */ jsx8(Checkbox_default, { id: value, checked: isSelected, onClick: (e) => e.preventDefault() }),
|
|
332
369
|
/* @__PURE__ */ jsxs4("div", { children: [
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ jsx8("p", { children: title }),
|
|
371
|
+
/* @__PURE__ */ jsx8("p", { className: "text-xs text-grey-80", children: description })
|
|
335
372
|
] }),
|
|
336
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ jsx8(
|
|
337
374
|
CheckIcon2,
|
|
338
375
|
{
|
|
339
376
|
className: "absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",
|
|
@@ -349,10 +386,10 @@ var ListItem_default = ListItem;
|
|
|
349
386
|
// src/components/ui/Input.tsx
|
|
350
387
|
import { cva as cva2 } from "cva";
|
|
351
388
|
import { icons as icons2, X as X2 } from "lucide-react";
|
|
352
|
-
import { forwardRef as
|
|
353
|
-
import { jsx as
|
|
354
|
-
var Input =
|
|
355
|
-
({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
|
|
389
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
390
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
391
|
+
var Input = forwardRef5(
|
|
392
|
+
({ label, error, description, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
|
|
356
393
|
const handleClear = () => {
|
|
357
394
|
onChange?.({ target: { value: "" } });
|
|
358
395
|
onClear?.();
|
|
@@ -361,16 +398,25 @@ var Input = forwardRef4(
|
|
|
361
398
|
const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
|
|
362
399
|
const hasIcon = !!icon;
|
|
363
400
|
const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
|
|
364
|
-
return /* @__PURE__ */ jsxs5("div", { className: "group flex w-full flex-col", "data-testid": `input-wrapper-${props.id}`, children: [
|
|
365
|
-
label && /* @__PURE__ */
|
|
401
|
+
return /* @__PURE__ */ jsxs5("div", { className: "group flex w-full flex-col gap-1", "data-testid": `input-wrapper-${props.id}`, children: [
|
|
402
|
+
label && /* @__PURE__ */ jsx9(
|
|
403
|
+
Label_default,
|
|
404
|
+
{
|
|
405
|
+
text: label,
|
|
406
|
+
htmlFor: props.name,
|
|
407
|
+
required: props.required,
|
|
408
|
+
description,
|
|
409
|
+
className: classNames?.label
|
|
410
|
+
}
|
|
411
|
+
),
|
|
366
412
|
/* @__PURE__ */ jsxs5("div", { className: "relative flex flex-row items-center", children: [
|
|
367
|
-
IconComponent && /* @__PURE__ */
|
|
413
|
+
IconComponent && /* @__PURE__ */ jsx9(
|
|
368
414
|
IconComponent,
|
|
369
415
|
{
|
|
370
416
|
className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
|
|
371
417
|
}
|
|
372
418
|
),
|
|
373
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ jsx9(
|
|
374
420
|
"input",
|
|
375
421
|
{
|
|
376
422
|
className: cn(inputVariants({ theme, hasIcon })),
|
|
@@ -382,7 +428,7 @@ var Input = forwardRef4(
|
|
|
382
428
|
...props
|
|
383
429
|
}
|
|
384
430
|
),
|
|
385
|
-
hasIcon && value && /* @__PURE__ */
|
|
431
|
+
hasIcon && value && /* @__PURE__ */ jsx9(
|
|
386
432
|
X2,
|
|
387
433
|
{
|
|
388
434
|
className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
|
|
@@ -391,7 +437,7 @@ var Input = forwardRef4(
|
|
|
391
437
|
}
|
|
392
438
|
)
|
|
393
439
|
] }),
|
|
394
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ jsx9(ErrorMessage_default, { message: error })
|
|
395
441
|
] });
|
|
396
442
|
}
|
|
397
443
|
);
|
|
@@ -449,12 +495,12 @@ var Input_default = Input;
|
|
|
449
495
|
// src/components/ui/Button.tsx
|
|
450
496
|
import { Slot } from "@radix-ui/react-slot";
|
|
451
497
|
import { cva as cva3 } from "cva";
|
|
452
|
-
import { forwardRef as
|
|
453
|
-
import { jsx as
|
|
454
|
-
var Button =
|
|
498
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
499
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
500
|
+
var Button = forwardRef6(
|
|
455
501
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
456
502
|
const Component = asChild ? Slot : "button";
|
|
457
|
-
return /* @__PURE__ */
|
|
503
|
+
return /* @__PURE__ */ jsx10(
|
|
458
504
|
Component,
|
|
459
505
|
{
|
|
460
506
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -556,22 +602,22 @@ var buttonVariants = cva3(
|
|
|
556
602
|
);
|
|
557
603
|
|
|
558
604
|
// src/components/ui/Combobox.tsx
|
|
559
|
-
import { forwardRef as
|
|
605
|
+
import { forwardRef as forwardRef10, useEffect as useEffect2, useState as useState2 } from "react";
|
|
560
606
|
import { ChevronDownIcon as ChevronDownIcon2, CircleX, icons as icons3 } from "lucide-react";
|
|
561
607
|
import { cva as cva5 } from "cva";
|
|
562
608
|
|
|
563
609
|
// src/components/primitives/command.tsx
|
|
564
610
|
import { Command as CommandPrimitive } from "cmdk";
|
|
565
611
|
import { Search } from "lucide-react";
|
|
566
|
-
import * as
|
|
612
|
+
import * as React5 from "react";
|
|
567
613
|
|
|
568
614
|
// src/components/primitives/dialog.tsx
|
|
569
615
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
570
616
|
import { X as X3 } from "lucide-react";
|
|
571
|
-
import * as
|
|
572
|
-
import { jsx as
|
|
617
|
+
import * as React4 from "react";
|
|
618
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
573
619
|
var DialogPortal = DialogPrimitive.Portal;
|
|
574
|
-
var DialogOverlay =
|
|
620
|
+
var DialogOverlay = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
575
621
|
DialogPrimitive.Overlay,
|
|
576
622
|
{
|
|
577
623
|
ref,
|
|
@@ -583,8 +629,8 @@ var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
583
629
|
}
|
|
584
630
|
));
|
|
585
631
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
586
|
-
var DialogContent =
|
|
587
|
-
/* @__PURE__ */
|
|
632
|
+
var DialogContent = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs6(DialogPortal, { children: [
|
|
633
|
+
/* @__PURE__ */ jsx11(DialogOverlay, {}),
|
|
588
634
|
/* @__PURE__ */ jsxs6(
|
|
589
635
|
DialogPrimitive.Content,
|
|
590
636
|
{
|
|
@@ -597,17 +643,17 @@ var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) =
|
|
|
597
643
|
children: [
|
|
598
644
|
children,
|
|
599
645
|
/* @__PURE__ */ jsxs6(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-500 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-400", children: [
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ jsx11(X3, { className: "h-4 w-4" }),
|
|
647
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Close" })
|
|
602
648
|
] })
|
|
603
649
|
]
|
|
604
650
|
}
|
|
605
651
|
)
|
|
606
652
|
] }));
|
|
607
653
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
608
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
654
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx11("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
609
655
|
DialogHeader.displayName = "DialogHeader";
|
|
610
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
656
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx11(
|
|
611
657
|
"div",
|
|
612
658
|
{
|
|
613
659
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -615,7 +661,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx10(
|
|
|
615
661
|
}
|
|
616
662
|
);
|
|
617
663
|
DialogFooter.displayName = "DialogFooter";
|
|
618
|
-
var DialogTitle =
|
|
664
|
+
var DialogTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
619
665
|
DialogPrimitive.Title,
|
|
620
666
|
{
|
|
621
667
|
ref,
|
|
@@ -624,7 +670,7 @@ var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
624
670
|
}
|
|
625
671
|
));
|
|
626
672
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
627
|
-
var DialogDescription =
|
|
673
|
+
var DialogDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
628
674
|
DialogPrimitive.Description,
|
|
629
675
|
{
|
|
630
676
|
ref,
|
|
@@ -635,8 +681,8 @@ var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
635
681
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
636
682
|
|
|
637
683
|
// src/components/primitives/command.tsx
|
|
638
|
-
import { jsx as
|
|
639
|
-
var Command =
|
|
684
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
685
|
+
var Command = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
640
686
|
CommandPrimitive,
|
|
641
687
|
{
|
|
642
688
|
ref,
|
|
@@ -648,9 +694,9 @@ var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
648
694
|
}
|
|
649
695
|
));
|
|
650
696
|
Command.displayName = CommandPrimitive.displayName;
|
|
651
|
-
var CommandInput =
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
697
|
+
var CommandInput = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs7("div", { className: "m-1 flex items-center rounded-xl border px-3", "cmdk-input-wrapper": "", children: [
|
|
698
|
+
/* @__PURE__ */ jsx12(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
699
|
+
/* @__PURE__ */ jsx12(
|
|
654
700
|
CommandPrimitive.Input,
|
|
655
701
|
{
|
|
656
702
|
ref,
|
|
@@ -663,7 +709,7 @@ var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
663
709
|
)
|
|
664
710
|
] }));
|
|
665
711
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
666
|
-
var CommandList =
|
|
712
|
+
var CommandList = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
667
713
|
CommandPrimitive.List,
|
|
668
714
|
{
|
|
669
715
|
ref,
|
|
@@ -672,9 +718,9 @@ var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
672
718
|
}
|
|
673
719
|
));
|
|
674
720
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
675
|
-
var CommandEmpty =
|
|
721
|
+
var CommandEmpty = React5.forwardRef((props, ref) => /* @__PURE__ */ jsx12(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
676
722
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
677
|
-
var CommandGroup =
|
|
723
|
+
var CommandGroup = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
678
724
|
CommandPrimitive.Group,
|
|
679
725
|
{
|
|
680
726
|
ref,
|
|
@@ -686,7 +732,7 @@ var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
686
732
|
}
|
|
687
733
|
));
|
|
688
734
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
689
|
-
var CommandSeparator =
|
|
735
|
+
var CommandSeparator = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
690
736
|
CommandPrimitive.Separator,
|
|
691
737
|
{
|
|
692
738
|
ref,
|
|
@@ -695,7 +741,7 @@ var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
695
741
|
}
|
|
696
742
|
));
|
|
697
743
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
698
|
-
var CommandItem =
|
|
744
|
+
var CommandItem = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
699
745
|
CommandPrimitive.Item,
|
|
700
746
|
{
|
|
701
747
|
ref,
|
|
@@ -708,7 +754,7 @@ var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
708
754
|
));
|
|
709
755
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
710
756
|
var CommandShortcut = ({ className, ...props }) => {
|
|
711
|
-
return /* @__PURE__ */
|
|
757
|
+
return /* @__PURE__ */ jsx12(
|
|
712
758
|
"span",
|
|
713
759
|
{
|
|
714
760
|
className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
|
|
@@ -719,12 +765,12 @@ var CommandShortcut = ({ className, ...props }) => {
|
|
|
719
765
|
CommandShortcut.displayName = "CommandShortcut";
|
|
720
766
|
|
|
721
767
|
// src/components/primitives/popover.tsx
|
|
722
|
-
import * as
|
|
768
|
+
import * as React6 from "react";
|
|
723
769
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
724
|
-
import { jsx as
|
|
770
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
725
771
|
var Popover = PopoverPrimitive.Root;
|
|
726
772
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
727
|
-
var PopoverContent =
|
|
773
|
+
var PopoverContent = React6.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx13(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx13(
|
|
728
774
|
PopoverPrimitive.Content,
|
|
729
775
|
{
|
|
730
776
|
ref,
|
|
@@ -741,7 +787,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
741
787
|
|
|
742
788
|
// src/components/ui/Badge.tsx
|
|
743
789
|
import { cva as cva4 } from "cva";
|
|
744
|
-
import { jsx as
|
|
790
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
745
791
|
var badgeVariants = cva4("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
746
792
|
variants: {
|
|
747
793
|
variant: {
|
|
@@ -755,16 +801,20 @@ var badgeVariants = cva4("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
|
755
801
|
}
|
|
756
802
|
});
|
|
757
803
|
function Badge({ className, variant, ...props }) {
|
|
758
|
-
return /* @__PURE__ */
|
|
804
|
+
return /* @__PURE__ */ jsx14("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
759
805
|
}
|
|
760
806
|
|
|
761
807
|
// src/components/ui/Combobox.tsx
|
|
762
|
-
import { jsx as
|
|
763
|
-
var Combobox =
|
|
808
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
809
|
+
var Combobox = forwardRef10((props, ref) => {
|
|
764
810
|
const {
|
|
811
|
+
id,
|
|
812
|
+
name,
|
|
765
813
|
value,
|
|
766
814
|
label,
|
|
767
815
|
options,
|
|
816
|
+
required,
|
|
817
|
+
description,
|
|
768
818
|
classNames,
|
|
769
819
|
multiselect,
|
|
770
820
|
placeholder,
|
|
@@ -812,16 +862,25 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
812
862
|
const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
|
|
813
863
|
return isDefault ? defaultLabel : label;
|
|
814
864
|
};
|
|
815
|
-
return /* @__PURE__ */ jsxs8("div", { className: cn("flex flex-col gap-
|
|
816
|
-
isDefault &&
|
|
865
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
866
|
+
isDefault && /* @__PURE__ */ jsx15(
|
|
867
|
+
Label_default,
|
|
868
|
+
{
|
|
869
|
+
text: label,
|
|
870
|
+
htmlFor: name,
|
|
871
|
+
required,
|
|
872
|
+
description,
|
|
873
|
+
className: classNames?.label
|
|
874
|
+
}
|
|
875
|
+
),
|
|
817
876
|
/* @__PURE__ */ jsxs8("div", { className: "relative flex", children: [
|
|
818
877
|
/* @__PURE__ */ jsxs8(Popover, { open, onOpenChange: setOpen, children: [
|
|
819
|
-
/* @__PURE__ */
|
|
878
|
+
/* @__PURE__ */ jsx15(
|
|
820
879
|
PopoverTrigger,
|
|
821
880
|
{
|
|
822
881
|
asChild: true,
|
|
823
882
|
disabled: options.length === 0,
|
|
824
|
-
"data-testid": `${
|
|
883
|
+
"data-testid": `${id ?? name}-combobox-trigger`,
|
|
825
884
|
children: /* @__PURE__ */ jsxs8(
|
|
826
885
|
"div",
|
|
827
886
|
{
|
|
@@ -833,9 +892,9 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
833
892
|
),
|
|
834
893
|
"aria-expanded": open,
|
|
835
894
|
children: [
|
|
836
|
-
isDefault && IconComponent && /* @__PURE__ */
|
|
837
|
-
isChip && !isEmpty && /* @__PURE__ */
|
|
838
|
-
/* @__PURE__ */
|
|
895
|
+
isDefault && IconComponent && /* @__PURE__ */ jsx15(IconComponent, { className: "h-4 w-4 shrink-0" }),
|
|
896
|
+
isChip && !isEmpty && /* @__PURE__ */ jsx15(Badge, { variant: "purple", children: selected.length }),
|
|
897
|
+
/* @__PURE__ */ jsx15(
|
|
839
898
|
"span",
|
|
840
899
|
{
|
|
841
900
|
className: cn(
|
|
@@ -845,7 +904,7 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
845
904
|
children: handleDisplayValue()
|
|
846
905
|
}
|
|
847
906
|
),
|
|
848
|
-
showChevron && /* @__PURE__ */
|
|
907
|
+
showChevron && /* @__PURE__ */ jsx15(
|
|
849
908
|
ChevronDownIcon2,
|
|
850
909
|
{
|
|
851
910
|
className: "shrink-0 transform group-data-[state=open]:rotate-180",
|
|
@@ -857,7 +916,7 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
857
916
|
)
|
|
858
917
|
}
|
|
859
918
|
),
|
|
860
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ jsx15(
|
|
861
920
|
PopoverContent,
|
|
862
921
|
{
|
|
863
922
|
className: cn(
|
|
@@ -869,15 +928,15 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
869
928
|
sideOffset: 4,
|
|
870
929
|
align: "start",
|
|
871
930
|
children: /* @__PURE__ */ jsxs8(Command, { children: [
|
|
872
|
-
!hideSearchBox && /* @__PURE__ */
|
|
931
|
+
!hideSearchBox && /* @__PURE__ */ jsx15(CommandInput, { placeholder: "Search..." }),
|
|
873
932
|
/* @__PURE__ */ jsxs8(CommandList, { children: [
|
|
874
|
-
/* @__PURE__ */
|
|
875
|
-
/* @__PURE__ */
|
|
933
|
+
/* @__PURE__ */ jsx15(CommandEmpty, { children: "No results" }),
|
|
934
|
+
/* @__PURE__ */ jsx15(CommandGroup, { children: options.map(({ id: id2, ...option }) => /* @__PURE__ */ jsx15(
|
|
876
935
|
CommandItem,
|
|
877
936
|
{
|
|
878
937
|
value: option.title,
|
|
879
938
|
onSelect: () => handleSelect(option.value),
|
|
880
|
-
children: /* @__PURE__ */
|
|
939
|
+
children: /* @__PURE__ */ jsx15(
|
|
881
940
|
ListItem_default,
|
|
882
941
|
{
|
|
883
942
|
className: cn(classNames?.items, "truncate py-1"),
|
|
@@ -887,22 +946,22 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
887
946
|
}
|
|
888
947
|
)
|
|
889
948
|
},
|
|
890
|
-
|
|
949
|
+
id2
|
|
891
950
|
)) })
|
|
892
951
|
] }),
|
|
893
|
-
!!footer && /* @__PURE__ */
|
|
952
|
+
!!footer && /* @__PURE__ */ jsx15(Separator, {}),
|
|
894
953
|
footer && footer({ close })
|
|
895
954
|
] })
|
|
896
955
|
}
|
|
897
956
|
)
|
|
898
957
|
] }),
|
|
899
|
-
isDefault && !isEmpty && /* @__PURE__ */
|
|
958
|
+
isDefault && !isEmpty && /* @__PURE__ */ jsx15(
|
|
900
959
|
"button",
|
|
901
960
|
{
|
|
902
961
|
type: "button",
|
|
903
962
|
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",
|
|
904
963
|
onClick: handleClear,
|
|
905
|
-
children: /* @__PURE__ */
|
|
964
|
+
children: /* @__PURE__ */ jsx15(CircleX, { className: "h-4 w-4 text-green-100" })
|
|
906
965
|
}
|
|
907
966
|
)
|
|
908
967
|
] })
|
|
@@ -934,12 +993,156 @@ var triggerVariants = cva5(
|
|
|
934
993
|
}
|
|
935
994
|
}
|
|
936
995
|
);
|
|
996
|
+
|
|
997
|
+
// src/components/ui/Counter.tsx
|
|
998
|
+
import { cva as cva6 } from "cva";
|
|
999
|
+
import { Minus as Minus2, Plus } from "lucide-react";
|
|
1000
|
+
import { forwardRef as forwardRef11, useEffect as useEffect3, useState as useState3 } from "react";
|
|
1001
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1002
|
+
var Counter = forwardRef11(
|
|
1003
|
+
({ label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props }, ref) => {
|
|
1004
|
+
const [count, setCount] = useState3(0);
|
|
1005
|
+
useEffect3(() => {
|
|
1006
|
+
setCount(value ?? 0);
|
|
1007
|
+
}, [value]);
|
|
1008
|
+
const handleChange = (e) => {
|
|
1009
|
+
const newValue = parseInt(e.target.value.replace(/\D/g, ""), 10);
|
|
1010
|
+
if (isNaN(newValue)) return;
|
|
1011
|
+
if (min && newValue < min) {
|
|
1012
|
+
onChange?.(min);
|
|
1013
|
+
setCount(min);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
if (max && newValue > max) {
|
|
1017
|
+
onChange?.(max);
|
|
1018
|
+
setCount(max);
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
onChange?.(newValue);
|
|
1022
|
+
setCount(newValue);
|
|
1023
|
+
};
|
|
1024
|
+
const decrement = () => {
|
|
1025
|
+
const proposedValue = count - step;
|
|
1026
|
+
const newValue = Math.max(min ?? -Infinity, proposedValue);
|
|
1027
|
+
onChange?.(newValue);
|
|
1028
|
+
setCount(newValue);
|
|
1029
|
+
};
|
|
1030
|
+
const increment = () => {
|
|
1031
|
+
const proposedValue = count + step;
|
|
1032
|
+
const newValue = Math.min(max ?? Infinity, proposedValue);
|
|
1033
|
+
onChange?.(newValue);
|
|
1034
|
+
setCount(newValue);
|
|
1035
|
+
};
|
|
1036
|
+
return /* @__PURE__ */ jsxs9(
|
|
1037
|
+
"div",
|
|
1038
|
+
{
|
|
1039
|
+
className: cn("flex w-auto flex-col gap-1", classNames?.root),
|
|
1040
|
+
"data-testid": `counter-wrapper-${props.id}`,
|
|
1041
|
+
children: [
|
|
1042
|
+
label && /* @__PURE__ */ jsx16(
|
|
1043
|
+
Label_default,
|
|
1044
|
+
{
|
|
1045
|
+
text: label,
|
|
1046
|
+
htmlFor: props.name,
|
|
1047
|
+
required: props.required,
|
|
1048
|
+
description,
|
|
1049
|
+
className: classNames?.label
|
|
1050
|
+
}
|
|
1051
|
+
),
|
|
1052
|
+
/* @__PURE__ */ jsxs9("div", { className: "relative flex w-[122px] flex-row items-center", children: [
|
|
1053
|
+
/* @__PURE__ */ jsx16(
|
|
1054
|
+
"button",
|
|
1055
|
+
{
|
|
1056
|
+
type: "button",
|
|
1057
|
+
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",
|
|
1058
|
+
onClick: decrement,
|
|
1059
|
+
children: /* @__PURE__ */ jsx16(Minus2, { className: "h-4 w-4 text-green-100" })
|
|
1060
|
+
}
|
|
1061
|
+
),
|
|
1062
|
+
/* @__PURE__ */ jsx16(
|
|
1063
|
+
"input",
|
|
1064
|
+
{
|
|
1065
|
+
className: cn(counterVariants({ theme }), classNames?.input),
|
|
1066
|
+
ref,
|
|
1067
|
+
value: count,
|
|
1068
|
+
onChange: handleChange,
|
|
1069
|
+
"data-testid": `counter-element-${props.id}`,
|
|
1070
|
+
...props
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
/* @__PURE__ */ jsx16(
|
|
1074
|
+
"button",
|
|
1075
|
+
{
|
|
1076
|
+
type: "button",
|
|
1077
|
+
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",
|
|
1078
|
+
onClick: increment,
|
|
1079
|
+
children: /* @__PURE__ */ jsx16(Plus, { className: "h-4 w-4 text-green-100" })
|
|
1080
|
+
}
|
|
1081
|
+
)
|
|
1082
|
+
] }),
|
|
1083
|
+
/* @__PURE__ */ jsx16(ErrorMessage_default, { message: error })
|
|
1084
|
+
]
|
|
1085
|
+
}
|
|
1086
|
+
);
|
|
1087
|
+
}
|
|
1088
|
+
);
|
|
1089
|
+
Counter.displayName = "Counter";
|
|
1090
|
+
var counterVariants = cva6(
|
|
1091
|
+
[
|
|
1092
|
+
"border-input",
|
|
1093
|
+
"placeholder:text-muted-foreground",
|
|
1094
|
+
"focus-visible:ring-ring",
|
|
1095
|
+
"inline-flex",
|
|
1096
|
+
"w-[122px]",
|
|
1097
|
+
"h-11",
|
|
1098
|
+
"items-center",
|
|
1099
|
+
"justify-start",
|
|
1100
|
+
"gap-3",
|
|
1101
|
+
"rounded-lg",
|
|
1102
|
+
"bg-transparent",
|
|
1103
|
+
"px-3",
|
|
1104
|
+
"pt-0.5",
|
|
1105
|
+
"text-sm",
|
|
1106
|
+
"text-center",
|
|
1107
|
+
"shadow-sm",
|
|
1108
|
+
"ring-grey-50",
|
|
1109
|
+
"transition-colors",
|
|
1110
|
+
"focus-visible:outline-none",
|
|
1111
|
+
"focus-visible:ring-1",
|
|
1112
|
+
"disabled:cursor-not-allowed",
|
|
1113
|
+
"disabled:opacity-50",
|
|
1114
|
+
"appearance-none",
|
|
1115
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
1116
|
+
"[&::-webkit-search-decoration]:appearance-none",
|
|
1117
|
+
"[&::-webkit-search-results-button]:appearance-none",
|
|
1118
|
+
"[&::-webkit-search-results-decoration]:appearance-none",
|
|
1119
|
+
"[&::-ms-clear]:display-none",
|
|
1120
|
+
"[&::-ms-reveal]:display-none"
|
|
1121
|
+
],
|
|
1122
|
+
{
|
|
1123
|
+
variants: {
|
|
1124
|
+
theme: {
|
|
1125
|
+
light: "text-grey-80 border",
|
|
1126
|
+
dark: "text-white"
|
|
1127
|
+
},
|
|
1128
|
+
hasIcon: {
|
|
1129
|
+
false: "pl-3",
|
|
1130
|
+
true: "pl-8"
|
|
1131
|
+
}
|
|
1132
|
+
},
|
|
1133
|
+
defaultVariants: {
|
|
1134
|
+
theme: "light",
|
|
1135
|
+
hasIcon: false
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
);
|
|
937
1139
|
export {
|
|
938
1140
|
Badge,
|
|
939
1141
|
Button,
|
|
940
1142
|
Checkbox_default as Checkbox,
|
|
941
1143
|
Chip_default as Chip,
|
|
942
1144
|
Combobox,
|
|
1145
|
+
Counter,
|
|
943
1146
|
Input_default as Input,
|
|
944
1147
|
Label_default as Label,
|
|
945
1148
|
ListItem_default as ListItem,
|