@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
@@ -0,0 +1,289 @@
1
+ "use client";
2
+
3
+ // src/components/primitives/command.tsx
4
+ import { Command as CommandPrimitive } from "cmdk";
5
+ import { Search } from "lucide-react";
6
+ import * as React2 from "react";
7
+
8
+ // src/lib/utils.ts
9
+ import { clsx } from "clsx";
10
+ import { twMerge } from "tailwind-merge";
11
+ function cn(...inputs) {
12
+ return twMerge(clsx(inputs));
13
+ }
14
+
15
+ // src/components/primitives/dialog.tsx
16
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
17
+ import { X } from "lucide-react";
18
+ import * as React from "react";
19
+ import { jsx, jsxs } from "react/jsx-runtime";
20
+ var DialogPortal = DialogPrimitive.Portal;
21
+ var DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
22
+ DialogPrimitive.Overlay,
23
+ {
24
+ ref,
25
+ className: cn(
26
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
27
+ className
28
+ ),
29
+ ...props
30
+ }
31
+ ));
32
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
33
+ var DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
34
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
35
+ /* @__PURE__ */ jsxs(
36
+ DialogPrimitive.Content,
37
+ {
38
+ ref,
39
+ className: cn(
40
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-neutral-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-neutral-800 dark:bg-neutral-950",
41
+ className
42
+ ),
43
+ ...props,
44
+ children: [
45
+ children,
46
+ /* @__PURE__ */ jsxs(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: [
47
+ /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
48
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
49
+ ] })
50
+ ]
51
+ }
52
+ )
53
+ ] }));
54
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
55
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
56
+ DialogHeader.displayName = "DialogHeader";
57
+ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx(
58
+ "div",
59
+ {
60
+ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
61
+ ...props
62
+ }
63
+ );
64
+ DialogFooter.displayName = "DialogFooter";
65
+ var DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
66
+ DialogPrimitive.Title,
67
+ {
68
+ ref,
69
+ className: cn("text-lg font-semibold leading-none tracking-tight", className),
70
+ ...props
71
+ }
72
+ ));
73
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
74
+ var DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
75
+ DialogPrimitive.Description,
76
+ {
77
+ ref,
78
+ className: cn("text-sm text-neutral-500 dark:text-neutral-400", className),
79
+ ...props
80
+ }
81
+ ));
82
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
83
+
84
+ // src/components/primitives/command.tsx
85
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
86
+ var Command = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
87
+ CommandPrimitive,
88
+ {
89
+ ref,
90
+ className: cn(
91
+ "flex h-full w-full flex-col overflow-hidden rounded-xl bg-white text-neutral-950",
92
+ className
93
+ ),
94
+ ...props
95
+ }
96
+ ));
97
+ Command.displayName = CommandPrimitive.displayName;
98
+ var CommandInput = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs2("div", { className: "m-1 flex items-center rounded-xl border px-3", "cmdk-input-wrapper": "", children: [
99
+ /* @__PURE__ */ jsx2(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
100
+ /* @__PURE__ */ jsx2(
101
+ CommandPrimitive.Input,
102
+ {
103
+ ref,
104
+ className: cn(
105
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-neutral-500 disabled:cursor-not-allowed disabled:opacity-50",
106
+ className
107
+ ),
108
+ ...props
109
+ }
110
+ )
111
+ ] }));
112
+ CommandInput.displayName = CommandPrimitive.Input.displayName;
113
+ var CommandList = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
114
+ CommandPrimitive.List,
115
+ {
116
+ ref,
117
+ className: cn("overflow-y-auto overflow-x-hidden", className),
118
+ ...props
119
+ }
120
+ ));
121
+ CommandList.displayName = CommandPrimitive.List.displayName;
122
+ var CommandEmpty = React2.forwardRef((props, ref) => /* @__PURE__ */ jsx2(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
123
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
124
+ var CommandGroup = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
125
+ CommandPrimitive.Group,
126
+ {
127
+ ref,
128
+ className: cn(
129
+ "overflow-hidden p-1 text-neutral-950 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-neutral-500",
130
+ className
131
+ ),
132
+ ...props
133
+ }
134
+ ));
135
+ CommandGroup.displayName = CommandPrimitive.Group.displayName;
136
+ var CommandSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
137
+ CommandPrimitive.Separator,
138
+ {
139
+ ref,
140
+ className: cn("-mx-1 h-px bg-neutral-200", className),
141
+ ...props
142
+ }
143
+ ));
144
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
145
+ var CommandItem = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
146
+ CommandPrimitive.Item,
147
+ {
148
+ ref,
149
+ className: cn(
150
+ "relative flex cursor-pointer select-none items-center rounded-xl px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-neutral-100 data-[selected=true]:text-neutral-900 data-[disabled=true]:opacity-50",
151
+ className
152
+ ),
153
+ ...props
154
+ }
155
+ ));
156
+ CommandItem.displayName = CommandPrimitive.Item.displayName;
157
+ var CommandShortcut = ({ className, ...props }) => {
158
+ return /* @__PURE__ */ jsx2(
159
+ "span",
160
+ {
161
+ className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
162
+ ...props
163
+ }
164
+ );
165
+ };
166
+ CommandShortcut.displayName = "CommandShortcut";
167
+
168
+ // src/lib/google.ts
169
+ import { Client, PlaceAutocompleteType } from "@googlemaps/google-maps-services-js";
170
+ var client = new Client();
171
+ var autocomplete = async (input, key) => {
172
+ try {
173
+ const response = await client.placeAutocomplete({
174
+ params: { input, key, types: PlaceAutocompleteType.address }
175
+ });
176
+ return response.data.predictions;
177
+ } catch (error) {
178
+ console.error(error);
179
+ }
180
+ };
181
+
182
+ // src/components/ui/PlacesQueryInput.tsx
183
+ import { CircleX, LoaderCircle } from "lucide-react";
184
+ import { useState, useCallback, useRef, useEffect } from "react";
185
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
186
+ function PlacesQueryInput({
187
+ apiKey,
188
+ selected,
189
+ onSelect,
190
+ className
191
+ }) {
192
+ const [predictions, setPredictions] = useState(null);
193
+ const [input, setInput] = useState(selected?.description ?? "");
194
+ const [isLoadingPredictions, setIsLoadingPredictions] = useState(false);
195
+ const [shouldOpenUpward, setShouldOpenUpward] = useState(false);
196
+ const timeoutRef = useRef(null);
197
+ const inputRef = useRef(null);
198
+ const debouncedAutocomplete = useCallback((value) => {
199
+ if (timeoutRef.current) {
200
+ clearTimeout(timeoutRef.current);
201
+ }
202
+ timeoutRef.current = setTimeout(async () => {
203
+ if (value.length > 2) {
204
+ setIsLoadingPredictions(true);
205
+ const fetchedPredictions = await autocomplete(value, apiKey);
206
+ fetchedPredictions && setIsLoadingPredictions(false);
207
+ setPredictions(fetchedPredictions ?? []);
208
+ } else {
209
+ setPredictions(null);
210
+ }
211
+ }, 300);
212
+ }, []);
213
+ const handleInputChange = (value) => {
214
+ setInput(value);
215
+ debouncedAutocomplete(value);
216
+ };
217
+ const handleSelect = (prediction) => {
218
+ onSelect(prediction);
219
+ setPredictions(null);
220
+ setInput(prediction.description);
221
+ };
222
+ const handleClear = () => {
223
+ onSelect();
224
+ setPredictions(null);
225
+ setInput("");
226
+ };
227
+ const handleBlur = () => setTimeout(() => setPredictions(null), 200);
228
+ useEffect(() => {
229
+ const checkDropdownPosition = () => {
230
+ if (inputRef.current) {
231
+ const rect = inputRef.current.getBoundingClientRect();
232
+ const windowHeight = window.innerHeight;
233
+ setShouldOpenUpward(rect.bottom + 200 > windowHeight);
234
+ }
235
+ };
236
+ checkDropdownPosition();
237
+ window.addEventListener("resize", checkDropdownPosition);
238
+ return () => window.removeEventListener("resize", checkDropdownPosition);
239
+ }, []);
240
+ return /* @__PURE__ */ jsx3("div", { className: cn("relative w-full", className), ref: inputRef, onBlur: handleBlur, children: /* @__PURE__ */ jsxs3(Command, { children: [
241
+ /* @__PURE__ */ jsxs3("div", { className: "relative w-full", children: [
242
+ /* @__PURE__ */ jsx3(
243
+ CommandInput,
244
+ {
245
+ placeholder: "Type an address to search...",
246
+ value: input,
247
+ onValueChange: handleInputChange,
248
+ className: "truncate pr-8"
249
+ }
250
+ ),
251
+ isLoadingPredictions && /* @__PURE__ */ jsx3(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" }),
252
+ input && /* @__PURE__ */ jsx3(
253
+ "button",
254
+ {
255
+ type: "button",
256
+ 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",
257
+ onClick: handleClear,
258
+ children: /* @__PURE__ */ jsx3(CircleX, { className: "h-4 w-4 text-green-100" })
259
+ }
260
+ )
261
+ ] }),
262
+ predictions && /* @__PURE__ */ jsxs3(
263
+ CommandList,
264
+ {
265
+ className: cn(
266
+ "absolute z-50 w-full rounded-md border bg-white shadow-lg",
267
+ shouldOpenUpward ? "bottom-full" : "top-full"
268
+ ),
269
+ children: [
270
+ /* @__PURE__ */ jsx3(CommandEmpty, { children: "No results" }),
271
+ /* @__PURE__ */ jsx3(CommandGroup, { children: predictions.map((prediction) => /* @__PURE__ */ jsx3(
272
+ CommandItem,
273
+ {
274
+ onSelect: () => handleSelect(prediction),
275
+ className: "truncate",
276
+ children: prediction.description
277
+ },
278
+ prediction.place_id
279
+ )) })
280
+ ]
281
+ }
282
+ )
283
+ ] }) });
284
+ }
285
+ var PlacesQueryInput_default = PlacesQueryInput;
286
+ export {
287
+ PlacesQueryInput_default as default
288
+ };
289
+ //# sourceMappingURL=PlacesQueryInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/primitives/command.tsx","../../../src/lib/utils.ts","../../../src/components/primitives/dialog.tsx","../../../src/lib/google.ts","../../../src/components/ui/PlacesQueryInput.tsx"],"sourcesContent":["'use client'\n\nimport { type DialogProps } from '@radix-ui/react-dialog'\nimport { Command as CommandPrimitive } from 'cmdk'\nimport { Search } from 'lucide-react'\nimport * as React from 'react'\n\nimport { Dialog, DialogContent } from '@/components/primitives/dialog'\n\nimport { cn } from '@/lib/utils'\n\nconst Command = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n 'flex h-full w-full flex-col overflow-hidden rounded-xl bg-white text-neutral-950',\n className\n )}\n {...props}\n />\n))\nCommand.displayName = CommandPrimitive.displayName\n\ntype CommandDialogProps = DialogProps\n\nconst CommandDialog = ({ children, ...props }: CommandDialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0 shadow-lg\">\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-neutral-500 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nconst CommandInput = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"m-1 flex items-center rounded-xl border px-3\" cmdk-input-wrapper=\"\">\n <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n 'flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-neutral-500 disabled:cursor-not-allowed disabled:opacity-50',\n className\n )}\n {...props}\n />\n </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn('overflow-y-auto overflow-x-hidden', className)}\n {...props}\n />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty ref={ref} className=\"py-6 text-center text-sm\" {...props} />\n))\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName\n\nconst CommandGroup = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n 'overflow-hidden p-1 text-neutral-950 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-neutral-500',\n className\n )}\n {...props}\n />\n))\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName\n\nconst CommandSeparator = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 h-px bg-neutral-200', className)}\n {...props}\n />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center rounded-xl px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-neutral-100 data-[selected=true]:text-neutral-900 data-[disabled=true]:opacity-50\",\n className\n )}\n {...props}\n />\n))\n\nCommandItem.displayName = CommandPrimitive.Item.displayName\n\nconst CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn('ml-auto text-xs tracking-widest text-neutral-500', className)}\n {...props}\n />\n )\n}\nCommandShortcut.displayName = 'CommandShortcut'\n\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n}\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","'use client'\n\nimport { cn } from '@/lib/utils'\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport { X } from 'lucide-react'\nimport * as React from 'react'\n\nconst Dialog = DialogPrimitive.Root\n\nconst DialogTrigger = DialogPrimitive.Trigger\n\nconst DialogPortal = DialogPrimitive.Portal\n\nconst DialogClose = DialogPrimitive.Close\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n className\n )}\n {...props}\n />\n))\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-neutral-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-neutral-800 dark:bg-neutral-950',\n className\n )}\n {...props}\n >\n {children}\n <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\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n))\nDialogContent.displayName = DialogPrimitive.Content.displayName\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />\n)\nDialogHeader.displayName = 'DialogHeader'\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n)\nDialogFooter.displayName = 'DialogFooter'\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn('text-lg font-semibold leading-none tracking-tight', className)}\n {...props}\n />\n))\nDialogTitle.displayName = DialogPrimitive.Title.displayName\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-sm text-neutral-500 dark:text-neutral-400', className)}\n {...props}\n />\n))\nDialogDescription.displayName = DialogPrimitive.Description.displayName\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n","'use server'\n\nimport { Client, PlaceAutocompleteType } from '@googlemaps/google-maps-services-js'\n\nconst client = new Client()\nexport const autocomplete = async (input: string, key: string) => {\n try {\n const response = await client.placeAutocomplete({\n params: { input, key, types: PlaceAutocompleteType.address },\n })\n\n return response.data.predictions\n } catch (error) {\n console.error(error)\n }\n}\n","'use client'\n\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from '@/components/primitives/command'\nimport { autocomplete } from '@/lib/google'\nimport { cn } from '@/lib/utils'\nimport { type PlaceAutocompleteResult } from '@googlemaps/google-maps-services-js'\nimport { CircleX, LoaderCircle } from 'lucide-react'\nimport { useState, useCallback, useRef, useEffect } from 'react'\n\n/**\n * The idea is of this type is to have a more specific type for the Place object,\n * without the repos that use it having to import the PlaceAutocompleteResult type.\n * 'place_id' can be used to query the Google Places API directly for more information about the place.\n */\nexport type Place = Pick<PlaceAutocompleteResult, 'description' | 'place_id'>\n\ninterface PlacesQueryInputProps {\n apiKey: string\n selected?: Place\n onSelect: (place?: Place) => void\n className?: string\n}\n\nfunction PlacesQueryInput({\n apiKey,\n selected,\n onSelect,\n className,\n}: Readonly<PlacesQueryInputProps>) {\n const [predictions, setPredictions] = useState<PlaceAutocompleteResult[] | null>(null)\n const [input, setInput] = useState(selected?.description ?? '')\n const [isLoadingPredictions, setIsLoadingPredictions] = useState(false)\n const [shouldOpenUpward, setShouldOpenUpward] = useState(false)\n const timeoutRef = useRef<NodeJS.Timeout | null>(null)\n const inputRef = useRef<HTMLDivElement | null>(null)\n\n const debouncedAutocomplete = useCallback((value: string) => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n }\n\n timeoutRef.current = setTimeout(async () => {\n if (value.length > 2) {\n setIsLoadingPredictions(true)\n const fetchedPredictions = await autocomplete(value, apiKey)\n fetchedPredictions && setIsLoadingPredictions(false)\n setPredictions(fetchedPredictions ?? [])\n } else {\n setPredictions(null)\n }\n }, 300)\n }, [])\n\n const handleInputChange = (value: string) => {\n setInput(value)\n debouncedAutocomplete(value)\n }\n\n const handleSelect = (prediction: PlaceAutocompleteResult) => {\n onSelect(prediction)\n setPredictions(null)\n setInput(prediction.description)\n }\n\n const handleClear = () => {\n onSelect()\n setPredictions(null)\n setInput('')\n }\n\n /** Close the dropdown when the input loses focus, with the timeout to allow the user to click on a prediction.\n * */\n const handleBlur = () => setTimeout(() => setPredictions(null), 200)\n\n useEffect(() => {\n const checkDropdownPosition = () => {\n if (inputRef.current) {\n const rect = inputRef.current.getBoundingClientRect()\n const windowHeight = window.innerHeight\n setShouldOpenUpward(rect.bottom + 200 > windowHeight)\n }\n }\n\n checkDropdownPosition()\n window.addEventListener('resize', checkDropdownPosition)\n return () => window.removeEventListener('resize', checkDropdownPosition)\n }, [])\n\n return (\n <div className={cn('relative w-full', className)} ref={inputRef} onBlur={handleBlur}>\n <Command>\n <div className=\"relative w-full\">\n <CommandInput\n placeholder=\"Type an address to search...\"\n value={input}\n onValueChange={handleInputChange}\n className=\"truncate pr-8\"\n />\n {isLoadingPredictions && (\n <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\" />\n )}\n {input && (\n <button\n type=\"button\"\n 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\"\n onClick={handleClear}\n >\n <CircleX className=\"h-4 w-4 text-green-100\" />\n </button>\n )}\n </div>\n {predictions && (\n <CommandList\n className={cn(\n 'absolute z-50 w-full rounded-md border bg-white shadow-lg',\n shouldOpenUpward ? 'bottom-full' : 'top-full'\n )}\n >\n <CommandEmpty>No results</CommandEmpty>\n <CommandGroup>\n {predictions.map((prediction) => (\n <CommandItem\n key={prediction.place_id}\n onSelect={() => handleSelect(prediction)}\n className=\"truncate\"\n >\n {prediction.description}\n </CommandItem>\n ))}\n </CommandGroup>\n </CommandList>\n )}\n </Command>\n </div>\n )\n}\n\nexport default PlacesQueryInput\n"],"mappings":";;;AAGA,SAAS,WAAW,wBAAwB;AAC5C,SAAS,cAAc;AACvB,YAAYA,YAAW;;;ACLvB,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACFA,YAAY,qBAAq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 +35,7 @@ __export(Select_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(Select_exports);
37
37
  var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
38
- var import_lucide_react = require("lucide-react");
38
+ var import_lucide_react2 = require("lucide-react");
39
39
  var import_react = require("react");
40
40
 
41
41
  // src/lib/utils.ts
@@ -53,32 +53,60 @@ function ErrorMessage({ message, className, ...props }) {
53
53
  }
54
54
  var ErrorMessage_default = ErrorMessage;
55
55
 
56
- // src/components/ui/Label.tsx
56
+ // src/components/primitives/tooltip.tsx
57
+ var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
58
+ var React = __toESM(require("react"), 1);
57
59
  var import_jsx_runtime2 = require("react/jsx-runtime");
58
- function Label({ text, required, className, ...props }) {
60
+ var TooltipProvider = TooltipPrimitive.Provider;
61
+ var Tooltip = TooltipPrimitive.Root;
62
+ var TooltipTrigger = TooltipPrimitive.Trigger;
63
+ var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
64
+ TooltipPrimitive.Content,
65
+ {
66
+ ref,
67
+ sideOffset,
68
+ className: cn(
69
+ "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",
70
+ className
71
+ ),
72
+ ...props
73
+ }
74
+ ));
75
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
76
+
77
+ // src/components/ui/Label.tsx
78
+ var import_lucide_react = require("lucide-react");
79
+ var import_jsx_runtime3 = require("react/jsx-runtime");
80
+ function Label({ text, required, description, className, ...props }) {
59
81
  if (!text) return null;
60
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
61
- "label",
62
- {
63
- className: cn(
64
- "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
65
- className
66
- ),
67
- ...props,
68
- children: [
69
- text,
70
- required && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-red-600", children: "\xA0*" })
71
- ]
72
- }
73
- );
82
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex w-full flex-row gap-1", children: [
83
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
84
+ "label",
85
+ {
86
+ className: cn(
87
+ "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
88
+ className
89
+ ),
90
+ ...props,
91
+ children: [
92
+ text,
93
+ required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-red-600", children: "\xA0*" })
94
+ ]
95
+ }
96
+ ),
97
+ !!description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Tooltip, { children: [
98
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.InfoIcon, { className: "h-4 w-4" }) }),
99
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipContent, { className: "max-w-48", children: description })
100
+ ] }) })
101
+ ] });
74
102
  }
75
103
  var Label_default = Label;
76
104
 
77
105
  // src/components/ui/Chip.tsx
78
106
  var import_cva = require("cva");
79
107
  var import_tailwind_merge2 = require("tailwind-merge");
80
- var import_jsx_runtime3 = require("react/jsx-runtime");
81
- var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_tailwind_merge2.twMerge)(chipVariants({ variant, size, className })), ...props });
108
+ var import_jsx_runtime4 = require("react/jsx-runtime");
109
+ var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: (0, import_tailwind_merge2.twMerge)(chipVariants({ variant, size, className })), ...props });
82
110
  var chipVariants = (0, import_cva.cva)(["flex", "items-center", "rounded-3xl", "border", "w-fit"], {
83
111
  variants: {
84
112
  variant: {
@@ -102,9 +130,9 @@ var Chip_default = Chip;
102
130
 
103
131
  // src/components/primitives/separator.tsx
104
132
  var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
105
- var React = __toESM(require("react"), 1);
106
- var import_jsx_runtime4 = require("react/jsx-runtime");
107
- var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
133
+ var React2 = __toESM(require("react"), 1);
134
+ var import_jsx_runtime5 = require("react/jsx-runtime");
135
+ var Separator = React2.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
108
136
  SeparatorPrimitive.Root,
109
137
  {
110
138
  ref,
@@ -121,9 +149,9 @@ var Separator = React.forwardRef(({ className, orientation = "horizontal", decor
121
149
  Separator.displayName = SeparatorPrimitive.Root.displayName;
122
150
 
123
151
  // src/components/ui/Select.tsx
124
- var import_jsx_runtime5 = require("react/jsx-runtime");
152
+ var import_jsx_runtime6 = require("react/jsx-runtime");
125
153
  var Select = (0, import_react.forwardRef)(
126
- ({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {
154
+ ({ label, options, placeholder, multiselect, description, classNames, error, id, ...props }, ref) => {
127
155
  const { value, defaultValue, dir, className, onChange, ...rest } = props;
128
156
  const [selected, setSelected] = (0, import_react.useState)([]);
129
157
  const [open, setOpen] = (0, import_react.useState)(false);
@@ -153,23 +181,24 @@ var Select = (0, import_react.forwardRef)(
153
181
  });
154
182
  onChange?.(multiselect ? newSelected : newValue);
155
183
  }
156
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
184
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
157
185
  "div",
158
186
  {
159
- className: cn("flex flex-col gap-1", className),
187
+ className: cn("flex w-full flex-col gap-1", className),
160
188
  ref: containerRef,
161
189
  "data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
162
190
  children: [
163
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
191
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
164
192
  Label_default,
165
193
  {
166
194
  text: label,
167
195
  htmlFor: props.name,
168
196
  required: props.required,
197
+ description,
169
198
  className: classNames?.label
170
199
  }
171
200
  ),
172
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
201
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
173
202
  SelectPrimitive.Root,
174
203
  {
175
204
  open,
@@ -180,16 +209,16 @@ var Select = (0, import_react.forwardRef)(
180
209
  dir: dir === "rtl" ? "rtl" : "ltr",
181
210
  ...rest,
182
211
  children: [
183
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
212
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
184
213
  SelectPrimitive.Trigger,
185
214
  {
186
215
  ref,
187
216
  className: cn(
188
- "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",
217
+ "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",
189
218
  classNames?.trigger
190
219
  ),
191
220
  children: [
192
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
221
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
193
222
  SelectPrimitive.Value,
194
223
  {
195
224
  placeholder: placeholder ?? "Select an option",
@@ -197,8 +226,8 @@ var Select = (0, import_react.forwardRef)(
197
226
  children: handleLabels()
198
227
  }
199
228
  ) }),
200
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
201
- import_lucide_react.ChevronDownIcon,
229
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
230
+ import_lucide_react2.ChevronDownIcon,
202
231
  {
203
232
  className: "transform text-black group-data-[state=open]:rotate-180",
204
233
  size: "16"
@@ -207,7 +236,7 @@ var Select = (0, import_react.forwardRef)(
207
236
  ]
208
237
  }
209
238
  ),
210
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
239
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
211
240
  SelectPrimitive.Content,
212
241
  {
213
242
  hideWhenDetached: true,
@@ -216,17 +245,17 @@ var Select = (0, import_react.forwardRef)(
216
245
  sideOffset: 4,
217
246
  onPointerDownOutside: toggleOpen,
218
247
  onKeyDown: closeOnEscape,
219
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(SelectPrimitive.Viewport, { children: [
220
- multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
248
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SelectPrimitive.Viewport, { children: [
249
+ multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
221
250
  SelectPrimitive.Group,
222
251
  {
223
252
  className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
224
253
  "data-testid": "selected-labels",
225
254
  children: chipLabels?.map(
226
- (chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
227
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: chip.title }),
228
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
229
- import_lucide_react.X,
255
+ (chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
256
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: chip.title }),
257
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
258
+ import_lucide_react2.X,
230
259
  {
231
260
  size: 18,
232
261
  "data-testid": `chip-remove-${chip.value}`,
@@ -238,8 +267,8 @@ var Select = (0, import_react.forwardRef)(
238
267
  )
239
268
  }
240
269
  ),
241
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Separator, {}),
242
- options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
270
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Separator, {}),
271
+ options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
243
272
  SelectPrimitive.Item,
244
273
  {
245
274
  value: value2,
@@ -248,9 +277,9 @@ var Select = (0, import_react.forwardRef)(
248
277
  onKeyDown: (e) => setValueOnEnter(e, value2),
249
278
  onClick: () => handleChange(value2),
250
279
  children: [
251
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.ItemText, { children: title }),
252
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
253
- import_lucide_react.CheckIcon,
280
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectPrimitive.ItemText, { children: title }),
281
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
282
+ import_lucide_react2.CheckIcon,
254
283
  {
255
284
  className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
256
285
  size: 16
@@ -266,7 +295,7 @@ var Select = (0, import_react.forwardRef)(
266
295
  ]
267
296
  }
268
297
  ),
269
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorMessage_default, { message: error })
298
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ErrorMessage_default, { message: error })
270
299
  ]
271
300
  }
272
301
  );