@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.
- package/dist/app/layout.css +30 -2
- package/dist/app/layout.css.map +1 -1
- package/dist/app/page.cjs +324 -114
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +302 -92
- package/dist/app/page.js.map +1 -1
- package/dist/components/demos/ComboboxDemo.cjs +91 -52
- package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
- package/dist/components/demos/ComboboxDemo.js +84 -45
- 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 +74 -35
- package/dist/components/demos/InputDemo.cjs.map +1 -1
- package/dist/components/demos/InputDemo.js +59 -30
- package/dist/components/demos/InputDemo.js.map +1 -1
- package/dist/components/demos/SelectDemo.cjs +83 -53
- package/dist/components/demos/SelectDemo.cjs.map +1 -1
- package/dist/components/demos/SelectDemo.js +73 -43
- package/dist/components/demos/SelectDemo.js.map +1 -1
- package/dist/components/demos/index.cjs +322 -112
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +300 -90
- 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 +78 -40
- 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 +71 -33
- 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 +67 -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 +54 -25
- 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 +75 -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 +67 -38
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/index.cjs +323 -138
- 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 +295 -111
- package/dist/index.js.map +1 -1
- package/dist/styles/globals.css +30 -2
- 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,16 +154,17 @@ var Select = forwardRef2(
|
|
|
126
154
|
return /* @__PURE__ */ jsxs2(
|
|
127
155
|
"div",
|
|
128
156
|
{
|
|
129
|
-
className: cn("flex flex-col gap-1", className),
|
|
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(
|
|
134
162
|
Label_default,
|
|
135
163
|
{
|
|
136
164
|
text: label,
|
|
137
165
|
htmlFor: props.name,
|
|
138
166
|
required: props.required,
|
|
167
|
+
description,
|
|
139
168
|
className: classNames?.label
|
|
140
169
|
}
|
|
141
170
|
),
|
|
@@ -155,11 +184,11 @@ var Select = forwardRef2(
|
|
|
155
184
|
{
|
|
156
185
|
ref,
|
|
157
186
|
className: cn(
|
|
158
|
-
"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",
|
|
159
188
|
classNames?.trigger
|
|
160
189
|
),
|
|
161
190
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", children: /* @__PURE__ */ jsx6(
|
|
163
192
|
SelectPrimitive.Value,
|
|
164
193
|
{
|
|
165
194
|
placeholder: placeholder ?? "Select an option",
|
|
@@ -167,7 +196,7 @@ var Select = forwardRef2(
|
|
|
167
196
|
children: handleLabels()
|
|
168
197
|
}
|
|
169
198
|
) }),
|
|
170
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ jsx6(
|
|
171
200
|
ChevronDownIcon,
|
|
172
201
|
{
|
|
173
202
|
className: "transform text-black group-data-[state=open]:rotate-180",
|
|
@@ -177,7 +206,7 @@ var Select = forwardRef2(
|
|
|
177
206
|
]
|
|
178
207
|
}
|
|
179
208
|
),
|
|
180
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ jsx6(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ jsx6(
|
|
181
210
|
SelectPrimitive.Content,
|
|
182
211
|
{
|
|
183
212
|
hideWhenDetached: true,
|
|
@@ -187,15 +216,15 @@ var Select = forwardRef2(
|
|
|
187
216
|
onPointerDownOutside: toggleOpen,
|
|
188
217
|
onKeyDown: closeOnEscape,
|
|
189
218
|
children: /* @__PURE__ */ jsxs2(SelectPrimitive.Viewport, { children: [
|
|
190
|
-
multiselect && !!chipLabels?.length && /* @__PURE__ */
|
|
219
|
+
multiselect && !!chipLabels?.length && /* @__PURE__ */ jsx6(
|
|
191
220
|
SelectPrimitive.Group,
|
|
192
221
|
{
|
|
193
222
|
className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
|
|
194
223
|
"data-testid": "selected-labels",
|
|
195
224
|
children: chipLabels?.map(
|
|
196
225
|
(chip) => chip && /* @__PURE__ */ jsxs2(Chip_default, { size: "small", variant: "primary", children: [
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ jsx6("span", { children: chip.title }),
|
|
227
|
+
/* @__PURE__ */ jsx6(
|
|
199
228
|
X,
|
|
200
229
|
{
|
|
201
230
|
size: 18,
|
|
@@ -208,7 +237,7 @@ var Select = forwardRef2(
|
|
|
208
237
|
)
|
|
209
238
|
}
|
|
210
239
|
),
|
|
211
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ jsx6(Separator, {}),
|
|
212
241
|
options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs2(
|
|
213
242
|
SelectPrimitive.Item,
|
|
214
243
|
{
|
|
@@ -218,8 +247,8 @@ var Select = forwardRef2(
|
|
|
218
247
|
onKeyDown: (e) => setValueOnEnter(e, value2),
|
|
219
248
|
onClick: () => handleChange(value2),
|
|
220
249
|
children: [
|
|
221
|
-
/* @__PURE__ */
|
|
222
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ jsx6(SelectPrimitive.ItemText, { children: title }),
|
|
251
|
+
/* @__PURE__ */ jsx6(
|
|
223
252
|
CheckIcon,
|
|
224
253
|
{
|
|
225
254
|
className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
|
|
@@ -236,7 +265,7 @@ var Select = forwardRef2(
|
|
|
236
265
|
]
|
|
237
266
|
}
|
|
238
267
|
),
|
|
239
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ jsx6(ErrorMessage_default, { message: error })
|
|
240
269
|
]
|
|
241
270
|
}
|
|
242
271
|
);
|
|
@@ -249,10 +278,10 @@ var Select_default = Select;
|
|
|
249
278
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
250
279
|
import { Check, Minus } from "lucide-react";
|
|
251
280
|
import {
|
|
252
|
-
forwardRef as
|
|
281
|
+
forwardRef as forwardRef4
|
|
253
282
|
} from "react";
|
|
254
|
-
import { jsx as
|
|
255
|
-
var CheckboxToggle =
|
|
283
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
284
|
+
var CheckboxToggle = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
256
285
|
CheckboxPrimitive.Root,
|
|
257
286
|
{
|
|
258
287
|
ref,
|
|
@@ -283,20 +312,20 @@ var CheckboxToggle = forwardRef3(({ className, ...props }, ref) => /* @__PURE__
|
|
|
283
312
|
),
|
|
284
313
|
...props,
|
|
285
314
|
children: /* @__PURE__ */ jsxs3(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: [
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
/* @__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" })
|
|
288
317
|
] })
|
|
289
318
|
}
|
|
290
319
|
));
|
|
291
320
|
CheckboxToggle.displayName = CheckboxPrimitive.Root.displayName;
|
|
292
|
-
var Checkbox =
|
|
321
|
+
var Checkbox = forwardRef4(
|
|
293
322
|
({ classNames, children, ...props }, ref) => {
|
|
294
323
|
const { disabled } = props;
|
|
295
324
|
const id = props.id ?? `${props.name ?? props.value?.toString()}-checkbox`;
|
|
296
325
|
const labelClassName = disabled ? "text-grey-40 pointer-events-none" : "";
|
|
297
326
|
return /* @__PURE__ */ jsxs3("div", { className: cn("flex space-x-2", classNames?.wrapper), children: [
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
-
/* @__PURE__ */
|
|
327
|
+
/* @__PURE__ */ jsx7(CheckboxToggle, { id, disabled, ref, ...props }),
|
|
328
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: id, className: cn(labelClassName, classNames?.label), children })
|
|
300
329
|
] });
|
|
301
330
|
}
|
|
302
331
|
);
|
|
@@ -306,7 +335,7 @@ var Checkbox_default = Checkbox;
|
|
|
306
335
|
// src/components/ui/ListItem.tsx
|
|
307
336
|
import { CheckIcon as CheckIcon2 } from "lucide-react";
|
|
308
337
|
import { icons } from "lucide-react";
|
|
309
|
-
import { jsx as
|
|
338
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
310
339
|
function ListItem({
|
|
311
340
|
icon,
|
|
312
341
|
hasCheckbox,
|
|
@@ -320,7 +349,7 @@ function ListItem({
|
|
|
320
349
|
const getIconIfValid = (icon2) => {
|
|
321
350
|
if (icon2 in icons) {
|
|
322
351
|
const IconComponent = icons[icon2];
|
|
323
|
-
return /* @__PURE__ */
|
|
352
|
+
return /* @__PURE__ */ jsx8(IconComponent, { size: 14 });
|
|
324
353
|
}
|
|
325
354
|
return null;
|
|
326
355
|
};
|
|
@@ -335,13 +364,13 @@ function ListItem({
|
|
|
335
364
|
...props,
|
|
336
365
|
"data-state": isSelected ? "checked" : "unchecked",
|
|
337
366
|
children: [
|
|
338
|
-
optionIcon && /* @__PURE__ */
|
|
339
|
-
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() }),
|
|
340
369
|
/* @__PURE__ */ jsxs4("div", { children: [
|
|
341
|
-
/* @__PURE__ */
|
|
342
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ jsx8("p", { children: title }),
|
|
371
|
+
/* @__PURE__ */ jsx8("p", { className: "text-xs text-grey-80", children: description })
|
|
343
372
|
] }),
|
|
344
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ jsx8(
|
|
345
374
|
CheckIcon2,
|
|
346
375
|
{
|
|
347
376
|
className: "absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",
|
|
@@ -357,10 +386,10 @@ var ListItem_default = ListItem;
|
|
|
357
386
|
// src/components/ui/Input.tsx
|
|
358
387
|
import { cva as cva2 } from "cva";
|
|
359
388
|
import { icons as icons2, X as X2 } from "lucide-react";
|
|
360
|
-
import { forwardRef as
|
|
361
|
-
import { jsx as
|
|
362
|
-
var Input =
|
|
363
|
-
({ 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) => {
|
|
364
393
|
const handleClear = () => {
|
|
365
394
|
onChange?.({ target: { value: "" } });
|
|
366
395
|
onClear?.();
|
|
@@ -370,23 +399,24 @@ var Input = forwardRef4(
|
|
|
370
399
|
const hasIcon = !!icon;
|
|
371
400
|
const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
|
|
372
401
|
return /* @__PURE__ */ jsxs5("div", { className: "group flex w-full flex-col gap-1", "data-testid": `input-wrapper-${props.id}`, children: [
|
|
373
|
-
label && /* @__PURE__ */
|
|
402
|
+
label && /* @__PURE__ */ jsx9(
|
|
374
403
|
Label_default,
|
|
375
404
|
{
|
|
376
405
|
text: label,
|
|
377
406
|
htmlFor: props.name,
|
|
378
407
|
required: props.required,
|
|
408
|
+
description,
|
|
379
409
|
className: classNames?.label
|
|
380
410
|
}
|
|
381
411
|
),
|
|
382
412
|
/* @__PURE__ */ jsxs5("div", { className: "relative flex flex-row items-center", children: [
|
|
383
|
-
IconComponent && /* @__PURE__ */
|
|
413
|
+
IconComponent && /* @__PURE__ */ jsx9(
|
|
384
414
|
IconComponent,
|
|
385
415
|
{
|
|
386
416
|
className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
|
|
387
417
|
}
|
|
388
418
|
),
|
|
389
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ jsx9(
|
|
390
420
|
"input",
|
|
391
421
|
{
|
|
392
422
|
className: cn(inputVariants({ theme, hasIcon })),
|
|
@@ -398,7 +428,7 @@ var Input = forwardRef4(
|
|
|
398
428
|
...props
|
|
399
429
|
}
|
|
400
430
|
),
|
|
401
|
-
hasIcon && value && /* @__PURE__ */
|
|
431
|
+
hasIcon && value && /* @__PURE__ */ jsx9(
|
|
402
432
|
X2,
|
|
403
433
|
{
|
|
404
434
|
className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
|
|
@@ -407,7 +437,7 @@ var Input = forwardRef4(
|
|
|
407
437
|
}
|
|
408
438
|
)
|
|
409
439
|
] }),
|
|
410
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ jsx9(ErrorMessage_default, { message: error })
|
|
411
441
|
] });
|
|
412
442
|
}
|
|
413
443
|
);
|
|
@@ -465,12 +495,12 @@ var Input_default = Input;
|
|
|
465
495
|
// src/components/ui/Button.tsx
|
|
466
496
|
import { Slot } from "@radix-ui/react-slot";
|
|
467
497
|
import { cva as cva3 } from "cva";
|
|
468
|
-
import { forwardRef as
|
|
469
|
-
import { jsx as
|
|
470
|
-
var Button =
|
|
498
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
499
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
500
|
+
var Button = forwardRef6(
|
|
471
501
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
472
502
|
const Component = asChild ? Slot : "button";
|
|
473
|
-
return /* @__PURE__ */
|
|
503
|
+
return /* @__PURE__ */ jsx10(
|
|
474
504
|
Component,
|
|
475
505
|
{
|
|
476
506
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -572,22 +602,22 @@ var buttonVariants = cva3(
|
|
|
572
602
|
);
|
|
573
603
|
|
|
574
604
|
// src/components/ui/Combobox.tsx
|
|
575
|
-
import { forwardRef as
|
|
605
|
+
import { forwardRef as forwardRef10, useEffect as useEffect2, useState as useState2 } from "react";
|
|
576
606
|
import { ChevronDownIcon as ChevronDownIcon2, CircleX, icons as icons3 } from "lucide-react";
|
|
577
607
|
import { cva as cva5 } from "cva";
|
|
578
608
|
|
|
579
609
|
// src/components/primitives/command.tsx
|
|
580
610
|
import { Command as CommandPrimitive } from "cmdk";
|
|
581
611
|
import { Search } from "lucide-react";
|
|
582
|
-
import * as
|
|
612
|
+
import * as React5 from "react";
|
|
583
613
|
|
|
584
614
|
// src/components/primitives/dialog.tsx
|
|
585
615
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
586
616
|
import { X as X3 } from "lucide-react";
|
|
587
|
-
import * as
|
|
588
|
-
import { jsx as
|
|
617
|
+
import * as React4 from "react";
|
|
618
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
589
619
|
var DialogPortal = DialogPrimitive.Portal;
|
|
590
|
-
var DialogOverlay =
|
|
620
|
+
var DialogOverlay = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
591
621
|
DialogPrimitive.Overlay,
|
|
592
622
|
{
|
|
593
623
|
ref,
|
|
@@ -599,8 +629,8 @@ var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
599
629
|
}
|
|
600
630
|
));
|
|
601
631
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
602
|
-
var DialogContent =
|
|
603
|
-
/* @__PURE__ */
|
|
632
|
+
var DialogContent = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs6(DialogPortal, { children: [
|
|
633
|
+
/* @__PURE__ */ jsx11(DialogOverlay, {}),
|
|
604
634
|
/* @__PURE__ */ jsxs6(
|
|
605
635
|
DialogPrimitive.Content,
|
|
606
636
|
{
|
|
@@ -613,17 +643,17 @@ var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) =
|
|
|
613
643
|
children: [
|
|
614
644
|
children,
|
|
615
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: [
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ jsx11(X3, { className: "h-4 w-4" }),
|
|
647
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Close" })
|
|
618
648
|
] })
|
|
619
649
|
]
|
|
620
650
|
}
|
|
621
651
|
)
|
|
622
652
|
] }));
|
|
623
653
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
624
|
-
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 });
|
|
625
655
|
DialogHeader.displayName = "DialogHeader";
|
|
626
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
656
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx11(
|
|
627
657
|
"div",
|
|
628
658
|
{
|
|
629
659
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -631,7 +661,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx10(
|
|
|
631
661
|
}
|
|
632
662
|
);
|
|
633
663
|
DialogFooter.displayName = "DialogFooter";
|
|
634
|
-
var DialogTitle =
|
|
664
|
+
var DialogTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
635
665
|
DialogPrimitive.Title,
|
|
636
666
|
{
|
|
637
667
|
ref,
|
|
@@ -640,7 +670,7 @@ var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
640
670
|
}
|
|
641
671
|
));
|
|
642
672
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
643
|
-
var DialogDescription =
|
|
673
|
+
var DialogDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
644
674
|
DialogPrimitive.Description,
|
|
645
675
|
{
|
|
646
676
|
ref,
|
|
@@ -651,8 +681,8 @@ var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
651
681
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
652
682
|
|
|
653
683
|
// src/components/primitives/command.tsx
|
|
654
|
-
import { jsx as
|
|
655
|
-
var Command =
|
|
684
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
685
|
+
var Command = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
656
686
|
CommandPrimitive,
|
|
657
687
|
{
|
|
658
688
|
ref,
|
|
@@ -664,9 +694,9 @@ var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
664
694
|
}
|
|
665
695
|
));
|
|
666
696
|
Command.displayName = CommandPrimitive.displayName;
|
|
667
|
-
var CommandInput =
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
/* @__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(
|
|
670
700
|
CommandPrimitive.Input,
|
|
671
701
|
{
|
|
672
702
|
ref,
|
|
@@ -679,7 +709,7 @@ var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
679
709
|
)
|
|
680
710
|
] }));
|
|
681
711
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
682
|
-
var CommandList =
|
|
712
|
+
var CommandList = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
683
713
|
CommandPrimitive.List,
|
|
684
714
|
{
|
|
685
715
|
ref,
|
|
@@ -688,9 +718,9 @@ var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
688
718
|
}
|
|
689
719
|
));
|
|
690
720
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
691
|
-
var CommandEmpty =
|
|
721
|
+
var CommandEmpty = React5.forwardRef((props, ref) => /* @__PURE__ */ jsx12(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
692
722
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
693
|
-
var CommandGroup =
|
|
723
|
+
var CommandGroup = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
694
724
|
CommandPrimitive.Group,
|
|
695
725
|
{
|
|
696
726
|
ref,
|
|
@@ -702,7 +732,7 @@ var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
702
732
|
}
|
|
703
733
|
));
|
|
704
734
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
705
|
-
var CommandSeparator =
|
|
735
|
+
var CommandSeparator = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
706
736
|
CommandPrimitive.Separator,
|
|
707
737
|
{
|
|
708
738
|
ref,
|
|
@@ -711,7 +741,7 @@ var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
711
741
|
}
|
|
712
742
|
));
|
|
713
743
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
714
|
-
var CommandItem =
|
|
744
|
+
var CommandItem = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
|
|
715
745
|
CommandPrimitive.Item,
|
|
716
746
|
{
|
|
717
747
|
ref,
|
|
@@ -724,7 +754,7 @@ var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
724
754
|
));
|
|
725
755
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
726
756
|
var CommandShortcut = ({ className, ...props }) => {
|
|
727
|
-
return /* @__PURE__ */
|
|
757
|
+
return /* @__PURE__ */ jsx12(
|
|
728
758
|
"span",
|
|
729
759
|
{
|
|
730
760
|
className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
|
|
@@ -735,12 +765,12 @@ var CommandShortcut = ({ className, ...props }) => {
|
|
|
735
765
|
CommandShortcut.displayName = "CommandShortcut";
|
|
736
766
|
|
|
737
767
|
// src/components/primitives/popover.tsx
|
|
738
|
-
import * as
|
|
768
|
+
import * as React6 from "react";
|
|
739
769
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
740
|
-
import { jsx as
|
|
770
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
741
771
|
var Popover = PopoverPrimitive.Root;
|
|
742
772
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
743
|
-
var PopoverContent =
|
|
773
|
+
var PopoverContent = React6.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx13(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx13(
|
|
744
774
|
PopoverPrimitive.Content,
|
|
745
775
|
{
|
|
746
776
|
ref,
|
|
@@ -757,7 +787,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
757
787
|
|
|
758
788
|
// src/components/ui/Badge.tsx
|
|
759
789
|
import { cva as cva4 } from "cva";
|
|
760
|
-
import { jsx as
|
|
790
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
761
791
|
var badgeVariants = cva4("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
762
792
|
variants: {
|
|
763
793
|
variant: {
|
|
@@ -771,12 +801,12 @@ var badgeVariants = cva4("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
|
771
801
|
}
|
|
772
802
|
});
|
|
773
803
|
function Badge({ className, variant, ...props }) {
|
|
774
|
-
return /* @__PURE__ */
|
|
804
|
+
return /* @__PURE__ */ jsx14("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
775
805
|
}
|
|
776
806
|
|
|
777
807
|
// src/components/ui/Combobox.tsx
|
|
778
|
-
import { jsx as
|
|
779
|
-
var Combobox =
|
|
808
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
809
|
+
var Combobox = forwardRef10((props, ref) => {
|
|
780
810
|
const {
|
|
781
811
|
id,
|
|
782
812
|
name,
|
|
@@ -784,6 +814,7 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
784
814
|
label,
|
|
785
815
|
options,
|
|
786
816
|
required,
|
|
817
|
+
description,
|
|
787
818
|
classNames,
|
|
788
819
|
multiselect,
|
|
789
820
|
placeholder,
|
|
@@ -832,10 +863,19 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
832
863
|
return isDefault ? defaultLabel : label;
|
|
833
864
|
};
|
|
834
865
|
return /* @__PURE__ */ jsxs8("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
835
|
-
isDefault && /* @__PURE__ */
|
|
866
|
+
isDefault && /* @__PURE__ */ jsx15(
|
|
867
|
+
Label_default,
|
|
868
|
+
{
|
|
869
|
+
text: label,
|
|
870
|
+
htmlFor: name,
|
|
871
|
+
required,
|
|
872
|
+
description,
|
|
873
|
+
className: classNames?.label
|
|
874
|
+
}
|
|
875
|
+
),
|
|
836
876
|
/* @__PURE__ */ jsxs8("div", { className: "relative flex", children: [
|
|
837
877
|
/* @__PURE__ */ jsxs8(Popover, { open, onOpenChange: setOpen, children: [
|
|
838
|
-
/* @__PURE__ */
|
|
878
|
+
/* @__PURE__ */ jsx15(
|
|
839
879
|
PopoverTrigger,
|
|
840
880
|
{
|
|
841
881
|
asChild: true,
|
|
@@ -852,9 +892,9 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
852
892
|
),
|
|
853
893
|
"aria-expanded": open,
|
|
854
894
|
children: [
|
|
855
|
-
isDefault && IconComponent && /* @__PURE__ */
|
|
856
|
-
isChip && !isEmpty && /* @__PURE__ */
|
|
857
|
-
/* @__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(
|
|
858
898
|
"span",
|
|
859
899
|
{
|
|
860
900
|
className: cn(
|
|
@@ -864,7 +904,7 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
864
904
|
children: handleDisplayValue()
|
|
865
905
|
}
|
|
866
906
|
),
|
|
867
|
-
showChevron && /* @__PURE__ */
|
|
907
|
+
showChevron && /* @__PURE__ */ jsx15(
|
|
868
908
|
ChevronDownIcon2,
|
|
869
909
|
{
|
|
870
910
|
className: "shrink-0 transform group-data-[state=open]:rotate-180",
|
|
@@ -876,7 +916,7 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
876
916
|
)
|
|
877
917
|
}
|
|
878
918
|
),
|
|
879
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ jsx15(
|
|
880
920
|
PopoverContent,
|
|
881
921
|
{
|
|
882
922
|
className: cn(
|
|
@@ -888,15 +928,15 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
888
928
|
sideOffset: 4,
|
|
889
929
|
align: "start",
|
|
890
930
|
children: /* @__PURE__ */ jsxs8(Command, { children: [
|
|
891
|
-
!hideSearchBox && /* @__PURE__ */
|
|
931
|
+
!hideSearchBox && /* @__PURE__ */ jsx15(CommandInput, { placeholder: "Search..." }),
|
|
892
932
|
/* @__PURE__ */ jsxs8(CommandList, { children: [
|
|
893
|
-
/* @__PURE__ */
|
|
894
|
-
/* @__PURE__ */
|
|
933
|
+
/* @__PURE__ */ jsx15(CommandEmpty, { children: "No results" }),
|
|
934
|
+
/* @__PURE__ */ jsx15(CommandGroup, { children: options.map(({ id: id2, ...option }) => /* @__PURE__ */ jsx15(
|
|
895
935
|
CommandItem,
|
|
896
936
|
{
|
|
897
937
|
value: option.title,
|
|
898
938
|
onSelect: () => handleSelect(option.value),
|
|
899
|
-
children: /* @__PURE__ */
|
|
939
|
+
children: /* @__PURE__ */ jsx15(
|
|
900
940
|
ListItem_default,
|
|
901
941
|
{
|
|
902
942
|
className: cn(classNames?.items, "truncate py-1"),
|
|
@@ -909,19 +949,19 @@ var Combobox = forwardRef9((props, ref) => {
|
|
|
909
949
|
id2
|
|
910
950
|
)) })
|
|
911
951
|
] }),
|
|
912
|
-
!!footer && /* @__PURE__ */
|
|
952
|
+
!!footer && /* @__PURE__ */ jsx15(Separator, {}),
|
|
913
953
|
footer && footer({ close })
|
|
914
954
|
] })
|
|
915
955
|
}
|
|
916
956
|
)
|
|
917
957
|
] }),
|
|
918
|
-
isDefault && !isEmpty && /* @__PURE__ */
|
|
958
|
+
isDefault && !isEmpty && /* @__PURE__ */ jsx15(
|
|
919
959
|
"button",
|
|
920
960
|
{
|
|
921
961
|
type: "button",
|
|
922
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",
|
|
923
963
|
onClick: handleClear,
|
|
924
|
-
children: /* @__PURE__ */
|
|
964
|
+
children: /* @__PURE__ */ jsx15(CircleX, { className: "h-4 w-4 text-green-100" })
|
|
925
965
|
}
|
|
926
966
|
)
|
|
927
967
|
] })
|
|
@@ -953,12 +993,156 @@ var triggerVariants = cva5(
|
|
|
953
993
|
}
|
|
954
994
|
}
|
|
955
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
|
+
);
|
|
956
1139
|
export {
|
|
957
1140
|
Badge,
|
|
958
1141
|
Button,
|
|
959
1142
|
Checkbox_default as Checkbox,
|
|
960
1143
|
Chip_default as Chip,
|
|
961
1144
|
Combobox,
|
|
1145
|
+
Counter,
|
|
962
1146
|
Input_default as Input,
|
|
963
1147
|
Label_default as Label,
|
|
964
1148
|
ListItem_default as ListItem,
|