@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,309 @@
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
+
287
+ // src/components/demos/PlacesQueryInputDemo.tsx
288
+ import { useState as useState2 } from "react";
289
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
290
+ function PlacesQueryInputDemo() {
291
+ const [selected, setSelected] = useState2();
292
+ return /* @__PURE__ */ jsxs4("div", { className: "flex h-24 flex-col p-4", children: [
293
+ /* @__PURE__ */ jsx4(
294
+ PlacesQueryInput_default,
295
+ {
296
+ className: "max-w-96",
297
+ apiKey: process.env.NEXT_PUBLIC_GOOGLE_API_KEY ?? "",
298
+ selected,
299
+ onSelect: setSelected
300
+ }
301
+ ),
302
+ /* @__PURE__ */ jsx4("h3", { className: "px-3", children: selected?.description })
303
+ ] });
304
+ }
305
+ var PlacesQueryInputDemo_default = PlacesQueryInputDemo;
306
+ export {
307
+ PlacesQueryInputDemo_default as default
308
+ };
309
+ //# sourceMappingURL=PlacesQueryInputDemo.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","../../../src/components/demos/PlacesQueryInputDemo.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","'use client'\n\nimport PlacesQueryInput from '@/components/ui/PlacesQueryInput'\nimport { useState } from 'react'\n\ninterface Place {\n description: string\n place_id: string\n}\n\nfunction PlacesQueryInputDemo() {\n const [selected, setSelected] = useState<Place | undefined>()\n\n return (\n <div className=\"flex h-24 flex-col p-4\">\n <PlacesQueryInput\n className=\"max-w-96\"\n apiKey={process.env.NEXT_PUBLIC_GOOGLE_API_KEY ?? ''}\n selected={selected}\n onSelect={setSelected}\n />\n <h3 className=\"px-3\">{selected?.description}</h3>\n </div>\n )\n}\n\nexport default PlacesQueryInputDemo\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,qBAAqB;AACjC,SAAS,SAAS;AAClB,YAAY,WAAW;AAcrB,cA0BI,YA1BJ;AARF,IAAM,eAA+B;AAIrC,IAAM,gBAAsB,iBAG1B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAiB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,cAAc,cAA8B,wBAAQ;AAEpD,IAAM,gBAAsB,iBAG1B,CAAC,EAAE,WAAW,UAA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AO,+BAAQ;","names":["React","jsx","jsxs","jsxs","jsx","jsx","jsxs","useState","jsx","jsxs"]}
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(SelectDemo_exports);
36
36
 
37
37
  // src/components/ui/Select.tsx
38
38
  var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
39
- var import_lucide_react = require("lucide-react");
39
+ var import_lucide_react2 = require("lucide-react");
40
40
  var import_react = require("react");
41
41
 
42
42
  // src/lib/utils.ts
@@ -54,32 +54,60 @@ function ErrorMessage({ message, className, ...props }) {
54
54
  }
55
55
  var ErrorMessage_default = ErrorMessage;
56
56
 
57
- // src/components/ui/Label.tsx
57
+ // src/components/primitives/tooltip.tsx
58
+ var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
59
+ var React = __toESM(require("react"), 1);
58
60
  var import_jsx_runtime2 = require("react/jsx-runtime");
59
- function Label({ text, required, className, ...props }) {
61
+ var TooltipProvider = TooltipPrimitive.Provider;
62
+ var Tooltip = TooltipPrimitive.Root;
63
+ var TooltipTrigger = TooltipPrimitive.Trigger;
64
+ var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
65
+ TooltipPrimitive.Content,
66
+ {
67
+ ref,
68
+ sideOffset,
69
+ className: cn(
70
+ "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",
71
+ className
72
+ ),
73
+ ...props
74
+ }
75
+ ));
76
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
77
+
78
+ // src/components/ui/Label.tsx
79
+ var import_lucide_react = require("lucide-react");
80
+ var import_jsx_runtime3 = require("react/jsx-runtime");
81
+ function Label({ text, required, description, className, ...props }) {
60
82
  if (!text) return null;
61
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
62
- "label",
63
- {
64
- className: cn(
65
- "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
66
- className
67
- ),
68
- ...props,
69
- children: [
70
- text,
71
- required && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-red-600", children: "\xA0*" })
72
- ]
73
- }
74
- );
83
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex w-full flex-row gap-1", children: [
84
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
85
+ "label",
86
+ {
87
+ className: cn(
88
+ "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
89
+ className
90
+ ),
91
+ ...props,
92
+ children: [
93
+ text,
94
+ required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-red-600", children: "\xA0*" })
95
+ ]
96
+ }
97
+ ),
98
+ !!description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Tooltip, { children: [
99
+ /* @__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" }) }),
100
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipContent, { className: "max-w-48", children: description })
101
+ ] }) })
102
+ ] });
75
103
  }
76
104
  var Label_default = Label;
77
105
 
78
106
  // src/components/ui/Chip.tsx
79
107
  var import_cva = require("cva");
80
108
  var import_tailwind_merge2 = require("tailwind-merge");
81
- var import_jsx_runtime3 = require("react/jsx-runtime");
82
- var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_tailwind_merge2.twMerge)(chipVariants({ variant, size, className })), ...props });
109
+ var import_jsx_runtime4 = require("react/jsx-runtime");
110
+ var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: (0, import_tailwind_merge2.twMerge)(chipVariants({ variant, size, className })), ...props });
83
111
  var chipVariants = (0, import_cva.cva)(["flex", "items-center", "rounded-3xl", "border", "w-fit"], {
84
112
  variants: {
85
113
  variant: {
@@ -103,9 +131,9 @@ var Chip_default = Chip;
103
131
 
104
132
  // src/components/primitives/separator.tsx
105
133
  var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
106
- var React = __toESM(require("react"), 1);
107
- var import_jsx_runtime4 = require("react/jsx-runtime");
108
- var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
134
+ var React2 = __toESM(require("react"), 1);
135
+ var import_jsx_runtime5 = require("react/jsx-runtime");
136
+ var Separator = React2.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
109
137
  SeparatorPrimitive.Root,
110
138
  {
111
139
  ref,
@@ -122,9 +150,9 @@ var Separator = React.forwardRef(({ className, orientation = "horizontal", decor
122
150
  Separator.displayName = SeparatorPrimitive.Root.displayName;
123
151
 
124
152
  // src/components/ui/Select.tsx
125
- var import_jsx_runtime5 = require("react/jsx-runtime");
153
+ var import_jsx_runtime6 = require("react/jsx-runtime");
126
154
  var Select = (0, import_react.forwardRef)(
127
- ({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {
155
+ ({ label, options, placeholder, multiselect, description, classNames, error, id, ...props }, ref) => {
128
156
  const { value, defaultValue, dir, className, onChange, ...rest } = props;
129
157
  const [selected, setSelected] = (0, import_react.useState)([]);
130
158
  const [open, setOpen] = (0, import_react.useState)(false);
@@ -154,23 +182,24 @@ var Select = (0, import_react.forwardRef)(
154
182
  });
155
183
  onChange?.(multiselect ? newSelected : newValue);
156
184
  }
157
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
185
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
158
186
  "div",
159
187
  {
160
- className: cn("flex flex-col gap-1", className),
188
+ className: cn("flex w-full flex-col gap-1", className),
161
189
  ref: containerRef,
162
190
  "data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
163
191
  children: [
164
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
192
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
165
193
  Label_default,
166
194
  {
167
195
  text: label,
168
196
  htmlFor: props.name,
169
197
  required: props.required,
198
+ description,
170
199
  className: classNames?.label
171
200
  }
172
201
  ),
173
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
202
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
174
203
  SelectPrimitive.Root,
175
204
  {
176
205
  open,
@@ -181,16 +210,16 @@ var Select = (0, import_react.forwardRef)(
181
210
  dir: dir === "rtl" ? "rtl" : "ltr",
182
211
  ...rest,
183
212
  children: [
184
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
213
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
185
214
  SelectPrimitive.Trigger,
186
215
  {
187
216
  ref,
188
217
  className: cn(
189
- "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",
218
+ "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",
190
219
  classNames?.trigger
191
220
  ),
192
221
  children: [
193
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
222
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
194
223
  SelectPrimitive.Value,
195
224
  {
196
225
  placeholder: placeholder ?? "Select an option",
@@ -198,8 +227,8 @@ var Select = (0, import_react.forwardRef)(
198
227
  children: handleLabels()
199
228
  }
200
229
  ) }),
201
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
202
- import_lucide_react.ChevronDownIcon,
230
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
231
+ import_lucide_react2.ChevronDownIcon,
203
232
  {
204
233
  className: "transform text-black group-data-[state=open]:rotate-180",
205
234
  size: "16"
@@ -208,7 +237,7 @@ var Select = (0, import_react.forwardRef)(
208
237
  ]
209
238
  }
210
239
  ),
211
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
240
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
212
241
  SelectPrimitive.Content,
213
242
  {
214
243
  hideWhenDetached: true,
@@ -217,17 +246,17 @@ var Select = (0, import_react.forwardRef)(
217
246
  sideOffset: 4,
218
247
  onPointerDownOutside: toggleOpen,
219
248
  onKeyDown: closeOnEscape,
220
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(SelectPrimitive.Viewport, { children: [
221
- multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
249
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SelectPrimitive.Viewport, { children: [
250
+ multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
222
251
  SelectPrimitive.Group,
223
252
  {
224
253
  className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
225
254
  "data-testid": "selected-labels",
226
255
  children: chipLabels?.map(
227
- (chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
228
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: chip.title }),
229
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
230
- import_lucide_react.X,
256
+ (chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
257
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: chip.title }),
258
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
259
+ import_lucide_react2.X,
231
260
  {
232
261
  size: 18,
233
262
  "data-testid": `chip-remove-${chip.value}`,
@@ -239,8 +268,8 @@ var Select = (0, import_react.forwardRef)(
239
268
  )
240
269
  }
241
270
  ),
242
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Separator, {}),
243
- options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
271
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Separator, {}),
272
+ options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
244
273
  SelectPrimitive.Item,
245
274
  {
246
275
  value: value2,
@@ -249,9 +278,9 @@ var Select = (0, import_react.forwardRef)(
249
278
  onKeyDown: (e) => setValueOnEnter(e, value2),
250
279
  onClick: () => handleChange(value2),
251
280
  children: [
252
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.ItemText, { children: title }),
253
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
254
- import_lucide_react.CheckIcon,
281
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectPrimitive.ItemText, { children: title }),
282
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
283
+ import_lucide_react2.CheckIcon,
255
284
  {
256
285
  className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
257
286
  size: 16
@@ -267,7 +296,7 @@ var Select = (0, import_react.forwardRef)(
267
296
  ]
268
297
  }
269
298
  ),
270
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorMessage_default, { message: error })
299
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ErrorMessage_default, { message: error })
271
300
  ]
272
301
  }
273
302
  );
@@ -277,12 +306,12 @@ Select.displayName = "Select";
277
306
  var Select_default = Select;
278
307
 
279
308
  // src/components/demos/SelectDemo.tsx
280
- var import_jsx_runtime6 = require("react/jsx-runtime");
309
+ var import_jsx_runtime7 = require("react/jsx-runtime");
281
310
  function SelectDemo() {
282
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "m-4", children: [
283
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: "Select" }),
284
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mt-2 flex max-w-sm flex-col gap-4", children: [
285
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
311
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "m-4", children: [
312
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: "Select" }),
313
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mt-2 flex max-w-sm flex-col gap-4", children: [
314
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
286
315
  Select_default,
287
316
  {
288
317
  required: true,
@@ -295,12 +324,13 @@ function SelectDemo() {
295
324
  ]
296
325
  }
297
326
  ),
298
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
327
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
299
328
  Select_default,
300
329
  {
301
330
  multiselect: true,
302
331
  label: "Label - Multiselect",
303
332
  placeholder: "Select an option",
333
+ description: "This is a tooltip",
304
334
  options: [
305
335
  { id: "1", value: "1", title: "Option 1" },
306
336
  { id: "2", value: "2", title: "Option 2" },
@@ -315,7 +345,7 @@ function SelectDemo() {
315
345
  ]
316
346
  }
317
347
  ),
318
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
348
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
319
349
  Select_default,
320
350
  {
321
351
  disabled: true,