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

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 (93) hide show
  1. package/dist/app/layout.css +59 -2
  2. package/dist/app/layout.css.map +1 -1
  3. package/dist/app/page.cjs +464 -114
  4. package/dist/app/page.cjs.map +1 -1
  5. package/dist/app/page.js +442 -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/PlacesQueryInputDemo.cjs +341 -0
  22. package/dist/components/demos/PlacesQueryInputDemo.cjs.map +1 -0
  23. package/dist/components/demos/PlacesQueryInputDemo.d.cts +5 -0
  24. package/dist/components/demos/PlacesQueryInputDemo.d.ts +5 -0
  25. package/dist/components/demos/PlacesQueryInputDemo.js +309 -0
  26. package/dist/components/demos/PlacesQueryInputDemo.js.map +1 -0
  27. package/dist/components/demos/SelectDemo.cjs +83 -53
  28. package/dist/components/demos/SelectDemo.cjs.map +1 -1
  29. package/dist/components/demos/SelectDemo.js +73 -43
  30. package/dist/components/demos/SelectDemo.js.map +1 -1
  31. package/dist/components/demos/index.cjs +462 -112
  32. package/dist/components/demos/index.cjs.map +1 -1
  33. package/dist/components/demos/index.js +440 -90
  34. package/dist/components/demos/index.js.map +1 -1
  35. package/dist/components/primitives/command.d.cts +1 -1
  36. package/dist/components/primitives/command.d.ts +1 -1
  37. package/dist/components/primitives/tooltip.cjs +75 -0
  38. package/dist/components/primitives/tooltip.cjs.map +1 -0
  39. package/dist/components/primitives/tooltip.d.cts +9 -0
  40. package/dist/components/primitives/tooltip.d.ts +9 -0
  41. package/dist/components/primitives/tooltip.js +38 -0
  42. package/dist/components/primitives/tooltip.js.map +1 -0
  43. package/dist/components/ui/Combobox.cjs +78 -40
  44. package/dist/components/ui/Combobox.cjs.map +1 -1
  45. package/dist/components/ui/Combobox.d.cts +5 -2
  46. package/dist/components/ui/Combobox.d.ts +5 -2
  47. package/dist/components/ui/Combobox.js +71 -33
  48. package/dist/components/ui/Combobox.js.map +1 -1
  49. package/dist/components/ui/Counter.cjs +248 -0
  50. package/dist/components/ui/Counter.cjs.map +1 -0
  51. package/dist/components/ui/Counter.d.cts +28 -0
  52. package/dist/components/ui/Counter.d.ts +28 -0
  53. package/dist/components/ui/Counter.js +214 -0
  54. package/dist/components/ui/Counter.js.map +1 -0
  55. package/dist/components/ui/Input.cjs +67 -28
  56. package/dist/components/ui/Input.cjs.map +1 -1
  57. package/dist/components/ui/Input.d.cts +2 -1
  58. package/dist/components/ui/Input.d.ts +2 -1
  59. package/dist/components/ui/Input.js +54 -25
  60. package/dist/components/ui/Input.js.map +1 -1
  61. package/dist/components/ui/Label.cjs +54 -16
  62. package/dist/components/ui/Label.cjs.map +1 -1
  63. package/dist/components/ui/Label.d.cts +2 -1
  64. package/dist/components/ui/Label.d.ts +2 -1
  65. package/dist/components/ui/Label.js +44 -16
  66. package/dist/components/ui/Label.js.map +1 -1
  67. package/dist/components/ui/PlacesQueryInput.cjs +321 -0
  68. package/dist/components/ui/PlacesQueryInput.cjs.map +1 -0
  69. package/dist/components/ui/PlacesQueryInput.d.cts +18 -0
  70. package/dist/components/ui/PlacesQueryInput.d.ts +18 -0
  71. package/dist/components/ui/PlacesQueryInput.js +289 -0
  72. package/dist/components/ui/PlacesQueryInput.js.map +1 -0
  73. package/dist/components/ui/Select.cjs +75 -46
  74. package/dist/components/ui/Select.cjs.map +1 -1
  75. package/dist/components/ui/Select.d.cts +3 -2
  76. package/dist/components/ui/Select.d.ts +3 -2
  77. package/dist/components/ui/Select.js +67 -38
  78. package/dist/components/ui/Select.js.map +1 -1
  79. package/dist/index.cjs +536 -230
  80. package/dist/index.cjs.map +1 -1
  81. package/dist/index.d.cts +3 -0
  82. package/dist/index.d.ts +3 -0
  83. package/dist/index.js +510 -206
  84. package/dist/index.js.map +1 -1
  85. package/dist/lib/google.cjs +43 -0
  86. package/dist/lib/google.cjs.map +1 -0
  87. package/dist/lib/google.d.cts +5 -0
  88. package/dist/lib/google.d.ts +5 -0
  89. package/dist/lib/google.js +19 -0
  90. package/dist/lib/google.js.map +1 -0
  91. package/dist/styles/globals.css +59 -2
  92. package/dist/styles/globals.css.map +1 -1
  93. package/package.json +22 -21
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 forwardRef2,
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 { jsx as jsx2, jsxs } from "react/jsx-runtime";
28
- function Label({ text, required, className, ...props }) {
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
- "label",
32
- {
33
- className: cn(
34
- "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
35
- className
36
- ),
37
- ...props,
38
- children: [
39
- text,
40
- required && /* @__PURE__ */ jsx2("span", { className: "text-red-600", children: "\xA0*" })
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 jsx3 } from "react/jsx-runtime";
51
- var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ jsx3("div", { className: twMerge2(chipVariants({ variant, size, className })), ...props });
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 React from "react";
76
- import { jsx as jsx4 } from "react/jsx-runtime";
77
- var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx4(
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 jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
95
- var Select = forwardRef2(
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__ */ jsx5(
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 min-w-80 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",
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__ */ jsx5("span", { className: "truncate", children: /* @__PURE__ */ jsx5(
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__ */ jsx5(
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__ */ jsx5(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ jsx5(
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__ */ jsx5(
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__ */ jsx5("span", { children: chip.title }),
198
- /* @__PURE__ */ jsx5(
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__ */ jsx5(Separator, {}),
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__ */ jsx5(SelectPrimitive.ItemText, { children: title }),
222
- /* @__PURE__ */ jsx5(
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__ */ jsx5(ErrorMessage_default, { message: error })
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 forwardRef3
281
+ forwardRef as forwardRef4
253
282
  } from "react";
254
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
255
- var CheckboxToggle = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
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__ */ jsx6(Check, { className: "hidden h-4 w-4 group-data-[state=checked]:block" }),
287
- /* @__PURE__ */ jsx6(Minus, { className: "hidden h-4 w-4 group-data-[state=indeterminate]:block" })
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 = forwardRef3(
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__ */ jsx6(CheckboxToggle, { id, disabled, ref, ...props }),
299
- /* @__PURE__ */ jsx6("label", { htmlFor: id, className: cn(labelClassName, classNames?.label), children })
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 jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
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__ */ jsx7(IconComponent, { size: 14 });
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__ */ jsx7("span", { className: "mr-2", children: optionIcon }),
339
- hasCheckbox && /* @__PURE__ */ jsx7(Checkbox_default, { id: value, checked: isSelected, onClick: (e) => e.preventDefault() }),
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__ */ jsx7("p", { children: title }),
342
- /* @__PURE__ */ jsx7("p", { className: "text-xs text-grey-80", children: description })
370
+ /* @__PURE__ */ jsx8("p", { children: title }),
371
+ /* @__PURE__ */ jsx8("p", { className: "text-xs text-grey-80", children: description })
343
372
  ] }),
344
- /* @__PURE__ */ jsx7(
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 forwardRef4 } from "react";
361
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
362
- var Input = forwardRef4(
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__ */ jsx8(
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__ */ jsx8(
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__ */ jsx8(
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__ */ jsx8(
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__ */ jsx8(ErrorMessage_default, { message: error })
440
+ /* @__PURE__ */ jsx9(ErrorMessage_default, { message: error })
411
441
  ] });
412
442
  }
413
443
  );
@@ -462,120 +492,6 @@ var inputVariants = cva2(
462
492
  );
463
493
  var Input_default = Input;
464
494
 
465
- // src/components/ui/Button.tsx
466
- import { Slot } from "@radix-ui/react-slot";
467
- import { cva as cva3 } from "cva";
468
- import { forwardRef as forwardRef5 } from "react";
469
- import { jsx as jsx9 } from "react/jsx-runtime";
470
- var Button = forwardRef5(
471
- ({ className, variant, size, asChild = false, ...props }, ref) => {
472
- const Component = asChild ? Slot : "button";
473
- return /* @__PURE__ */ jsx9(
474
- Component,
475
- {
476
- className: cn(buttonVariants({ variant, size, className })),
477
- ref,
478
- ...props
479
- }
480
- );
481
- }
482
- );
483
- Button.displayName = "Button";
484
- var buttonVariants = cva3(
485
- [
486
- "flex",
487
- "items-center",
488
- "justify-center",
489
- "gap-2",
490
- "rounded-full",
491
- "font-bold",
492
- "outline-2",
493
- "outline-offset-2",
494
- "outline-dashed",
495
- "outline-transparent"
496
- ],
497
- {
498
- variants: {
499
- variant: {
500
- neutral: [
501
- "bg-black",
502
- "text-white",
503
- "hover:bg-grey-90",
504
- "active:bg-grey-80",
505
- "focus:outline-purple-100",
506
- "disabled:text-grey-40",
507
- "disabled:bg-grey-10"
508
- ],
509
- primary: [
510
- "bg-pickle-100",
511
- "text-black",
512
- "hover:bg-pickle-80",
513
- "active:bg-pickle-60",
514
- "focus:outline-purple-100",
515
- "disabled:text-grey-40",
516
- "disabled:bg-grey-10"
517
- ],
518
- secondary: [
519
- "bg-green-80",
520
- "text-white",
521
- "hover:bg-green-90",
522
- "active:bg-green-100",
523
- "focus:outline-pickle-100",
524
- "disabled:text-grey-40",
525
- "disabled:bg-grey-10"
526
- ],
527
- transparent: [
528
- "text-white",
529
- "hover:bg-green-80",
530
- "active:bg-green-100",
531
- "focus:outline-pickle-100",
532
- "disabled:text-grey-40"
533
- ],
534
- link: [
535
- "leading-tight",
536
- "text-black",
537
- "underline",
538
- "hover:text-purple-100",
539
- "focus:text-black",
540
- "focus:outline-purple-100",
541
- "active:text-purple-80"
542
- ]
543
- },
544
- size: {
545
- small: ["h-10", "text-sm", "px-4", "py-2"],
546
- medium: ["h-12", "text-base", "px-6", "py-3"],
547
- large: ["h-14", "text-lg", "px-8", "py-4"]
548
- }
549
- },
550
- defaultVariants: {
551
- variant: "neutral",
552
- size: "medium"
553
- },
554
- compoundVariants: [
555
- {
556
- variant: "link",
557
- size: "small",
558
- class: ["h-3", "text-xs", "p-0"]
559
- },
560
- {
561
- variant: "link",
562
- size: "medium",
563
- class: ["h-4", "text-sm", "p-0"]
564
- },
565
- {
566
- variant: "link",
567
- size: "large",
568
- class: ["h-6", "text-base", "p-0"]
569
- }
570
- ]
571
- }
572
- );
573
-
574
- // src/components/ui/Combobox.tsx
575
- import { forwardRef as forwardRef9, useEffect as useEffect2, useState as useState2 } from "react";
576
- import { ChevronDownIcon as ChevronDownIcon2, CircleX, icons as icons3 } from "lucide-react";
577
- import { cva as cva5 } from "cva";
578
-
579
495
  // src/components/primitives/command.tsx
580
496
  import { Command as CommandPrimitive } from "cmdk";
581
497
  import { Search } from "lucide-react";
@@ -734,13 +650,246 @@ var CommandShortcut = ({ className, ...props }) => {
734
650
  };
735
651
  CommandShortcut.displayName = "CommandShortcut";
736
652
 
653
+ // src/lib/google.ts
654
+ import { Client, PlaceAutocompleteType } from "@googlemaps/google-maps-services-js";
655
+ var client = new Client();
656
+ var autocomplete = async (input, key) => {
657
+ try {
658
+ const response = await client.placeAutocomplete({
659
+ params: { input, key, types: PlaceAutocompleteType.address }
660
+ });
661
+ return response.data.predictions;
662
+ } catch (error) {
663
+ console.error(error);
664
+ }
665
+ };
666
+
667
+ // src/components/ui/PlacesQueryInput.tsx
668
+ import { CircleX, LoaderCircle } from "lucide-react";
669
+ import { useState as useState2, useCallback, useRef as useRef2, useEffect as useEffect2 } from "react";
670
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
671
+ function PlacesQueryInput({
672
+ apiKey,
673
+ selected,
674
+ onSelect,
675
+ className
676
+ }) {
677
+ const [predictions, setPredictions] = useState2(null);
678
+ const [input, setInput] = useState2(selected?.description ?? "");
679
+ const [isLoadingPredictions, setIsLoadingPredictions] = useState2(false);
680
+ const [shouldOpenUpward, setShouldOpenUpward] = useState2(false);
681
+ const timeoutRef = useRef2(null);
682
+ const inputRef = useRef2(null);
683
+ const debouncedAutocomplete = useCallback((value) => {
684
+ if (timeoutRef.current) {
685
+ clearTimeout(timeoutRef.current);
686
+ }
687
+ timeoutRef.current = setTimeout(async () => {
688
+ if (value.length > 2) {
689
+ setIsLoadingPredictions(true);
690
+ const fetchedPredictions = await autocomplete(value, apiKey);
691
+ fetchedPredictions && setIsLoadingPredictions(false);
692
+ setPredictions(fetchedPredictions ?? []);
693
+ } else {
694
+ setPredictions(null);
695
+ }
696
+ }, 300);
697
+ }, []);
698
+ const handleInputChange = (value) => {
699
+ setInput(value);
700
+ debouncedAutocomplete(value);
701
+ };
702
+ const handleSelect = (prediction) => {
703
+ onSelect(prediction);
704
+ setPredictions(null);
705
+ setInput(prediction.description);
706
+ };
707
+ const handleClear = () => {
708
+ onSelect();
709
+ setPredictions(null);
710
+ setInput("");
711
+ };
712
+ const handleBlur = () => setTimeout(() => setPredictions(null), 200);
713
+ useEffect2(() => {
714
+ const checkDropdownPosition = () => {
715
+ if (inputRef.current) {
716
+ const rect = inputRef.current.getBoundingClientRect();
717
+ const windowHeight = window.innerHeight;
718
+ setShouldOpenUpward(rect.bottom + 200 > windowHeight);
719
+ }
720
+ };
721
+ checkDropdownPosition();
722
+ window.addEventListener("resize", checkDropdownPosition);
723
+ return () => window.removeEventListener("resize", checkDropdownPosition);
724
+ }, []);
725
+ return /* @__PURE__ */ jsx12("div", { className: cn("relative w-full", className), ref: inputRef, onBlur: handleBlur, children: /* @__PURE__ */ jsxs8(Command, { children: [
726
+ /* @__PURE__ */ jsxs8("div", { className: "relative w-full", children: [
727
+ /* @__PURE__ */ jsx12(
728
+ CommandInput,
729
+ {
730
+ placeholder: "Type an address to search...",
731
+ value: input,
732
+ onValueChange: handleInputChange,
733
+ className: "truncate pr-8"
734
+ }
735
+ ),
736
+ isLoadingPredictions && /* @__PURE__ */ jsx12(LoaderCircle, { className: "absolute inset-y-0 right-2 my-auto flex h-8 w-8 animate-spin items-center justify-center rounded-full text-green-100" }),
737
+ input && /* @__PURE__ */ jsx12(
738
+ "button",
739
+ {
740
+ type: "button",
741
+ className: "absolute inset-y-0 right-2 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
742
+ onClick: handleClear,
743
+ children: /* @__PURE__ */ jsx12(CircleX, { className: "h-4 w-4 text-green-100" })
744
+ }
745
+ )
746
+ ] }),
747
+ predictions && /* @__PURE__ */ jsxs8(
748
+ CommandList,
749
+ {
750
+ className: cn(
751
+ "absolute z-50 w-full rounded-md border bg-white shadow-lg",
752
+ shouldOpenUpward ? "bottom-full" : "top-full"
753
+ ),
754
+ children: [
755
+ /* @__PURE__ */ jsx12(CommandEmpty, { children: "No results" }),
756
+ /* @__PURE__ */ jsx12(CommandGroup, { children: predictions.map((prediction) => /* @__PURE__ */ jsx12(
757
+ CommandItem,
758
+ {
759
+ onSelect: () => handleSelect(prediction),
760
+ className: "truncate",
761
+ children: prediction.description
762
+ },
763
+ prediction.place_id
764
+ )) })
765
+ ]
766
+ }
767
+ )
768
+ ] }) });
769
+ }
770
+ var PlacesQueryInput_default = PlacesQueryInput;
771
+
772
+ // src/components/ui/Button.tsx
773
+ import { Slot } from "@radix-ui/react-slot";
774
+ import { cva as cva3 } from "cva";
775
+ import { forwardRef as forwardRef8 } from "react";
776
+ import { jsx as jsx13 } from "react/jsx-runtime";
777
+ var Button = forwardRef8(
778
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
779
+ const Component = asChild ? Slot : "button";
780
+ return /* @__PURE__ */ jsx13(
781
+ Component,
782
+ {
783
+ className: cn(buttonVariants({ variant, size, className })),
784
+ ref,
785
+ ...props
786
+ }
787
+ );
788
+ }
789
+ );
790
+ Button.displayName = "Button";
791
+ var buttonVariants = cva3(
792
+ [
793
+ "flex",
794
+ "items-center",
795
+ "justify-center",
796
+ "gap-2",
797
+ "rounded-full",
798
+ "font-bold",
799
+ "outline-2",
800
+ "outline-offset-2",
801
+ "outline-dashed",
802
+ "outline-transparent"
803
+ ],
804
+ {
805
+ variants: {
806
+ variant: {
807
+ neutral: [
808
+ "bg-black",
809
+ "text-white",
810
+ "hover:bg-grey-90",
811
+ "active:bg-grey-80",
812
+ "focus:outline-purple-100",
813
+ "disabled:text-grey-40",
814
+ "disabled:bg-grey-10"
815
+ ],
816
+ primary: [
817
+ "bg-pickle-100",
818
+ "text-black",
819
+ "hover:bg-pickle-80",
820
+ "active:bg-pickle-60",
821
+ "focus:outline-purple-100",
822
+ "disabled:text-grey-40",
823
+ "disabled:bg-grey-10"
824
+ ],
825
+ secondary: [
826
+ "bg-green-80",
827
+ "text-white",
828
+ "hover:bg-green-90",
829
+ "active:bg-green-100",
830
+ "focus:outline-pickle-100",
831
+ "disabled:text-grey-40",
832
+ "disabled:bg-grey-10"
833
+ ],
834
+ transparent: [
835
+ "text-white",
836
+ "hover:bg-green-80",
837
+ "active:bg-green-100",
838
+ "focus:outline-pickle-100",
839
+ "disabled:text-grey-40"
840
+ ],
841
+ link: [
842
+ "leading-tight",
843
+ "text-black",
844
+ "underline",
845
+ "hover:text-purple-100",
846
+ "focus:text-black",
847
+ "focus:outline-purple-100",
848
+ "active:text-purple-80"
849
+ ]
850
+ },
851
+ size: {
852
+ small: ["h-10", "text-sm", "px-4", "py-2"],
853
+ medium: ["h-12", "text-base", "px-6", "py-3"],
854
+ large: ["h-14", "text-lg", "px-8", "py-4"]
855
+ }
856
+ },
857
+ defaultVariants: {
858
+ variant: "neutral",
859
+ size: "medium"
860
+ },
861
+ compoundVariants: [
862
+ {
863
+ variant: "link",
864
+ size: "small",
865
+ class: ["h-3", "text-xs", "p-0"]
866
+ },
867
+ {
868
+ variant: "link",
869
+ size: "medium",
870
+ class: ["h-4", "text-sm", "p-0"]
871
+ },
872
+ {
873
+ variant: "link",
874
+ size: "large",
875
+ class: ["h-6", "text-base", "p-0"]
876
+ }
877
+ ]
878
+ }
879
+ );
880
+
881
+ // src/components/ui/Combobox.tsx
882
+ import { forwardRef as forwardRef10, useEffect as useEffect3, useState as useState3 } from "react";
883
+ import { ChevronDownIcon as ChevronDownIcon2, CircleX as CircleX2, icons as icons3 } from "lucide-react";
884
+ import { cva as cva5 } from "cva";
885
+
737
886
  // src/components/primitives/popover.tsx
738
- import * as React5 from "react";
887
+ import * as React6 from "react";
739
888
  import * as PopoverPrimitive from "@radix-ui/react-popover";
740
- import { jsx as jsx12 } from "react/jsx-runtime";
889
+ import { jsx as jsx14 } from "react/jsx-runtime";
741
890
  var Popover = PopoverPrimitive.Root;
742
891
  var PopoverTrigger = PopoverPrimitive.Trigger;
743
- var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx12(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx12(
892
+ var PopoverContent = React6.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx14(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx14(
744
893
  PopoverPrimitive.Content,
745
894
  {
746
895
  ref,
@@ -757,7 +906,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
757
906
 
758
907
  // src/components/ui/Badge.tsx
759
908
  import { cva as cva4 } from "cva";
760
- import { jsx as jsx13 } from "react/jsx-runtime";
909
+ import { jsx as jsx15 } from "react/jsx-runtime";
761
910
  var badgeVariants = cva4("rounded-full px-2 py-0.5 text-xs font-semibold", {
762
911
  variants: {
763
912
  variant: {
@@ -771,12 +920,12 @@ var badgeVariants = cva4("rounded-full px-2 py-0.5 text-xs font-semibold", {
771
920
  }
772
921
  });
773
922
  function Badge({ className, variant, ...props }) {
774
- return /* @__PURE__ */ jsx13("div", { className: cn(badgeVariants({ variant }), className), ...props });
923
+ return /* @__PURE__ */ jsx15("div", { className: cn(badgeVariants({ variant }), className), ...props });
775
924
  }
776
925
 
777
926
  // src/components/ui/Combobox.tsx
778
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
779
- var Combobox = forwardRef9((props, ref) => {
927
+ import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
928
+ var Combobox = forwardRef10((props, ref) => {
780
929
  const {
781
930
  id,
782
931
  name,
@@ -784,6 +933,7 @@ var Combobox = forwardRef9((props, ref) => {
784
933
  label,
785
934
  options,
786
935
  required,
936
+ description,
787
937
  classNames,
788
938
  multiselect,
789
939
  placeholder,
@@ -794,8 +944,8 @@ var Combobox = forwardRef9((props, ref) => {
794
944
  onChange: handleChange,
795
945
  children: footer
796
946
  } = props;
797
- const [selected, setSelected] = useState2([]);
798
- const [open, setOpen] = useState2(false);
947
+ const [selected, setSelected] = useState3([]);
948
+ const [open, setOpen] = useState3(false);
799
949
  const IconComponent = icon && icons3[icon];
800
950
  const hideSearchBox = options?.length <= 5;
801
951
  const isDefault = variant === "default";
@@ -803,7 +953,7 @@ var Combobox = forwardRef9((props, ref) => {
803
953
  const isEmpty = selected.length == 0;
804
954
  const showChevron = isDefault ? isEmpty : true;
805
955
  const close = () => setOpen(false);
806
- useEffect2(() => {
956
+ useEffect3(() => {
807
957
  const valueArray = multiselect ? value ?? [] : value ? [value] : [];
808
958
  setSelected(
809
959
  valueArray.map((v) => options.find((o) => o.value === v)).filter((v) => v !== void 0)
@@ -831,17 +981,26 @@ var Combobox = forwardRef9((props, ref) => {
831
981
  const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
832
982
  return isDefault ? defaultLabel : label;
833
983
  };
834
- return /* @__PURE__ */ jsxs8("div", { className: cn("flex flex-col gap-1", className), children: [
835
- isDefault && /* @__PURE__ */ jsx14(Label_default, { text: label, htmlFor: name, required, className: classNames?.label }),
836
- /* @__PURE__ */ jsxs8("div", { className: "relative flex", children: [
837
- /* @__PURE__ */ jsxs8(Popover, { open, onOpenChange: setOpen, children: [
838
- /* @__PURE__ */ jsx14(
984
+ return /* @__PURE__ */ jsxs9("div", { className: cn("flex flex-col gap-1", className), children: [
985
+ isDefault && /* @__PURE__ */ jsx16(
986
+ Label_default,
987
+ {
988
+ text: label,
989
+ htmlFor: name,
990
+ required,
991
+ description,
992
+ className: classNames?.label
993
+ }
994
+ ),
995
+ /* @__PURE__ */ jsxs9("div", { className: "relative flex", children: [
996
+ /* @__PURE__ */ jsxs9(Popover, { open, onOpenChange: setOpen, children: [
997
+ /* @__PURE__ */ jsx16(
839
998
  PopoverTrigger,
840
999
  {
841
1000
  asChild: true,
842
1001
  disabled: options.length === 0,
843
1002
  "data-testid": `${id ?? name}-combobox-trigger`,
844
- children: /* @__PURE__ */ jsxs8(
1003
+ children: /* @__PURE__ */ jsxs9(
845
1004
  "div",
846
1005
  {
847
1006
  ref,
@@ -852,9 +1011,9 @@ var Combobox = forwardRef9((props, ref) => {
852
1011
  ),
853
1012
  "aria-expanded": open,
854
1013
  children: [
855
- isDefault && IconComponent && /* @__PURE__ */ jsx14(IconComponent, { className: "h-4 w-4 shrink-0" }),
856
- isChip && !isEmpty && /* @__PURE__ */ jsx14(Badge, { variant: "purple", children: selected.length }),
857
- /* @__PURE__ */ jsx14(
1014
+ isDefault && IconComponent && /* @__PURE__ */ jsx16(IconComponent, { className: "h-4 w-4 shrink-0" }),
1015
+ isChip && !isEmpty && /* @__PURE__ */ jsx16(Badge, { variant: "purple", children: selected.length }),
1016
+ /* @__PURE__ */ jsx16(
858
1017
  "span",
859
1018
  {
860
1019
  className: cn(
@@ -864,7 +1023,7 @@ var Combobox = forwardRef9((props, ref) => {
864
1023
  children: handleDisplayValue()
865
1024
  }
866
1025
  ),
867
- showChevron && /* @__PURE__ */ jsx14(
1026
+ showChevron && /* @__PURE__ */ jsx16(
868
1027
  ChevronDownIcon2,
869
1028
  {
870
1029
  className: "shrink-0 transform group-data-[state=open]:rotate-180",
@@ -876,7 +1035,7 @@ var Combobox = forwardRef9((props, ref) => {
876
1035
  )
877
1036
  }
878
1037
  ),
879
- /* @__PURE__ */ jsx14(
1038
+ /* @__PURE__ */ jsx16(
880
1039
  PopoverContent,
881
1040
  {
882
1041
  className: cn(
@@ -887,16 +1046,16 @@ var Combobox = forwardRef9((props, ref) => {
887
1046
  collisionPadding: 8,
888
1047
  sideOffset: 4,
889
1048
  align: "start",
890
- children: /* @__PURE__ */ jsxs8(Command, { children: [
891
- !hideSearchBox && /* @__PURE__ */ jsx14(CommandInput, { placeholder: "Search..." }),
892
- /* @__PURE__ */ jsxs8(CommandList, { children: [
893
- /* @__PURE__ */ jsx14(CommandEmpty, { children: "No results" }),
894
- /* @__PURE__ */ jsx14(CommandGroup, { children: options.map(({ id: id2, ...option }) => /* @__PURE__ */ jsx14(
1049
+ children: /* @__PURE__ */ jsxs9(Command, { children: [
1050
+ !hideSearchBox && /* @__PURE__ */ jsx16(CommandInput, { placeholder: "Search..." }),
1051
+ /* @__PURE__ */ jsxs9(CommandList, { children: [
1052
+ /* @__PURE__ */ jsx16(CommandEmpty, { children: "No results" }),
1053
+ /* @__PURE__ */ jsx16(CommandGroup, { children: options.map(({ id: id2, ...option }) => /* @__PURE__ */ jsx16(
895
1054
  CommandItem,
896
1055
  {
897
1056
  value: option.title,
898
1057
  onSelect: () => handleSelect(option.value),
899
- children: /* @__PURE__ */ jsx14(
1058
+ children: /* @__PURE__ */ jsx16(
900
1059
  ListItem_default,
901
1060
  {
902
1061
  className: cn(classNames?.items, "truncate py-1"),
@@ -909,19 +1068,19 @@ var Combobox = forwardRef9((props, ref) => {
909
1068
  id2
910
1069
  )) })
911
1070
  ] }),
912
- !!footer && /* @__PURE__ */ jsx14(Separator, {}),
1071
+ !!footer && /* @__PURE__ */ jsx16(Separator, {}),
913
1072
  footer && footer({ close })
914
1073
  ] })
915
1074
  }
916
1075
  )
917
1076
  ] }),
918
- isDefault && !isEmpty && /* @__PURE__ */ jsx14(
1077
+ isDefault && !isEmpty && /* @__PURE__ */ jsx16(
919
1078
  "button",
920
1079
  {
921
1080
  type: "button",
922
1081
  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
1082
  onClick: handleClear,
924
- children: /* @__PURE__ */ jsx14(CircleX, { className: "h-4 w-4 text-green-100" })
1083
+ children: /* @__PURE__ */ jsx16(CircleX2, { className: "h-4 w-4 text-green-100" })
925
1084
  }
926
1085
  )
927
1086
  ] })
@@ -953,15 +1112,160 @@ var triggerVariants = cva5(
953
1112
  }
954
1113
  }
955
1114
  );
1115
+
1116
+ // src/components/ui/Counter.tsx
1117
+ import { cva as cva6 } from "cva";
1118
+ import { Minus as Minus2, Plus } from "lucide-react";
1119
+ import { forwardRef as forwardRef11, useEffect as useEffect4, useState as useState4 } from "react";
1120
+ import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
1121
+ var Counter = forwardRef11(
1122
+ ({ label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props }, ref) => {
1123
+ const [count, setCount] = useState4(0);
1124
+ useEffect4(() => {
1125
+ setCount(value ?? 0);
1126
+ }, [value]);
1127
+ const handleChange = (e) => {
1128
+ const newValue = parseInt(e.target.value.replace(/\D/g, ""), 10);
1129
+ if (isNaN(newValue)) return;
1130
+ if (min && newValue < min) {
1131
+ onChange?.(min);
1132
+ setCount(min);
1133
+ return;
1134
+ }
1135
+ if (max && newValue > max) {
1136
+ onChange?.(max);
1137
+ setCount(max);
1138
+ return;
1139
+ }
1140
+ onChange?.(newValue);
1141
+ setCount(newValue);
1142
+ };
1143
+ const decrement = () => {
1144
+ const proposedValue = count - step;
1145
+ const newValue = Math.max(min ?? -Infinity, proposedValue);
1146
+ onChange?.(newValue);
1147
+ setCount(newValue);
1148
+ };
1149
+ const increment = () => {
1150
+ const proposedValue = count + step;
1151
+ const newValue = Math.min(max ?? Infinity, proposedValue);
1152
+ onChange?.(newValue);
1153
+ setCount(newValue);
1154
+ };
1155
+ return /* @__PURE__ */ jsxs10(
1156
+ "div",
1157
+ {
1158
+ className: cn("flex w-auto flex-col gap-1", classNames?.root),
1159
+ "data-testid": `counter-wrapper-${props.id}`,
1160
+ children: [
1161
+ label && /* @__PURE__ */ jsx17(
1162
+ Label_default,
1163
+ {
1164
+ text: label,
1165
+ htmlFor: props.name,
1166
+ required: props.required,
1167
+ description,
1168
+ className: classNames?.label
1169
+ }
1170
+ ),
1171
+ /* @__PURE__ */ jsxs10("div", { className: "relative flex w-[122px] flex-row items-center", children: [
1172
+ /* @__PURE__ */ jsx17(
1173
+ "button",
1174
+ {
1175
+ type: "button",
1176
+ 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",
1177
+ onClick: decrement,
1178
+ children: /* @__PURE__ */ jsx17(Minus2, { className: "h-4 w-4 text-green-100" })
1179
+ }
1180
+ ),
1181
+ /* @__PURE__ */ jsx17(
1182
+ "input",
1183
+ {
1184
+ className: cn(counterVariants({ theme }), classNames?.input),
1185
+ ref,
1186
+ value: count,
1187
+ onChange: handleChange,
1188
+ "data-testid": `counter-element-${props.id}`,
1189
+ ...props
1190
+ }
1191
+ ),
1192
+ /* @__PURE__ */ jsx17(
1193
+ "button",
1194
+ {
1195
+ type: "button",
1196
+ 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",
1197
+ onClick: increment,
1198
+ children: /* @__PURE__ */ jsx17(Plus, { className: "h-4 w-4 text-green-100" })
1199
+ }
1200
+ )
1201
+ ] }),
1202
+ /* @__PURE__ */ jsx17(ErrorMessage_default, { message: error })
1203
+ ]
1204
+ }
1205
+ );
1206
+ }
1207
+ );
1208
+ Counter.displayName = "Counter";
1209
+ var counterVariants = cva6(
1210
+ [
1211
+ "border-input",
1212
+ "placeholder:text-muted-foreground",
1213
+ "focus-visible:ring-ring",
1214
+ "inline-flex",
1215
+ "w-[122px]",
1216
+ "h-11",
1217
+ "items-center",
1218
+ "justify-start",
1219
+ "gap-3",
1220
+ "rounded-lg",
1221
+ "bg-transparent",
1222
+ "px-3",
1223
+ "pt-0.5",
1224
+ "text-sm",
1225
+ "text-center",
1226
+ "shadow-sm",
1227
+ "ring-grey-50",
1228
+ "transition-colors",
1229
+ "focus-visible:outline-none",
1230
+ "focus-visible:ring-1",
1231
+ "disabled:cursor-not-allowed",
1232
+ "disabled:opacity-50",
1233
+ "appearance-none",
1234
+ "[&::-webkit-search-cancel-button]:appearance-none",
1235
+ "[&::-webkit-search-decoration]:appearance-none",
1236
+ "[&::-webkit-search-results-button]:appearance-none",
1237
+ "[&::-webkit-search-results-decoration]:appearance-none",
1238
+ "[&::-ms-clear]:display-none",
1239
+ "[&::-ms-reveal]:display-none"
1240
+ ],
1241
+ {
1242
+ variants: {
1243
+ theme: {
1244
+ light: "text-grey-80 border",
1245
+ dark: "text-white"
1246
+ },
1247
+ hasIcon: {
1248
+ false: "pl-3",
1249
+ true: "pl-8"
1250
+ }
1251
+ },
1252
+ defaultVariants: {
1253
+ theme: "light",
1254
+ hasIcon: false
1255
+ }
1256
+ }
1257
+ );
956
1258
  export {
957
1259
  Badge,
958
1260
  Button,
959
1261
  Checkbox_default as Checkbox,
960
1262
  Chip_default as Chip,
961
1263
  Combobox,
1264
+ Counter,
962
1265
  Input_default as Input,
963
1266
  Label_default as Label,
964
1267
  ListItem_default as ListItem,
1268
+ PlacesQueryInput_default as PlacesQueryInput,
965
1269
  Select_default as Select,
966
1270
  cn
967
1271
  };