@next-degree/pickle-shared-js 0.3.25 → 0.3.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/app/layout.css +30 -13
  2. package/dist/app/layout.css.map +1 -1
  3. package/dist/app/page.cjs +347 -116
  4. package/dist/app/page.cjs.map +1 -1
  5. package/dist/app/page.js +328 -97
  6. package/dist/app/page.js.map +1 -1
  7. package/dist/components/demos/ComboboxDemo.cjs +97 -54
  8. package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
  9. package/dist/components/demos/ComboboxDemo.js +91 -48
  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 +82 -35
  18. package/dist/components/demos/InputDemo.cjs.map +1 -1
  19. package/dist/components/demos/InputDemo.js +68 -31
  20. package/dist/components/demos/InputDemo.js.map +1 -1
  21. package/dist/components/demos/SelectDemo.cjs +92 -53
  22. package/dist/components/demos/SelectDemo.cjs.map +1 -1
  23. package/dist/components/demos/SelectDemo.js +83 -44
  24. package/dist/components/demos/SelectDemo.js.map +1 -1
  25. package/dist/components/demos/index.cjs +345 -114
  26. package/dist/components/demos/index.cjs.map +1 -1
  27. package/dist/components/demos/index.js +326 -95
  28. package/dist/components/demos/index.js.map +1 -1
  29. package/dist/components/primitives/tooltip.cjs +75 -0
  30. package/dist/components/primitives/tooltip.cjs.map +1 -0
  31. package/dist/components/primitives/tooltip.d.cts +9 -0
  32. package/dist/components/primitives/tooltip.d.ts +9 -0
  33. package/dist/components/primitives/tooltip.js +38 -0
  34. package/dist/components/primitives/tooltip.js.map +1 -0
  35. package/dist/components/ui/Combobox.cjs +83 -42
  36. package/dist/components/ui/Combobox.cjs.map +1 -1
  37. package/dist/components/ui/Combobox.d.cts +5 -2
  38. package/dist/components/ui/Combobox.d.ts +5 -2
  39. package/dist/components/ui/Combobox.js +77 -36
  40. package/dist/components/ui/Combobox.js.map +1 -1
  41. package/dist/components/ui/Counter.cjs +248 -0
  42. package/dist/components/ui/Counter.cjs.map +1 -0
  43. package/dist/components/ui/Counter.d.cts +28 -0
  44. package/dist/components/ui/Counter.d.ts +28 -0
  45. package/dist/components/ui/Counter.js +214 -0
  46. package/dist/components/ui/Counter.js.map +1 -0
  47. package/dist/components/ui/Input.cjs +75 -28
  48. package/dist/components/ui/Input.cjs.map +1 -1
  49. package/dist/components/ui/Input.d.cts +2 -1
  50. package/dist/components/ui/Input.d.ts +2 -1
  51. package/dist/components/ui/Input.js +63 -26
  52. package/dist/components/ui/Input.js.map +1 -1
  53. package/dist/components/ui/Label.cjs +54 -16
  54. package/dist/components/ui/Label.cjs.map +1 -1
  55. package/dist/components/ui/Label.d.cts +2 -1
  56. package/dist/components/ui/Label.d.ts +2 -1
  57. package/dist/components/ui/Label.js +44 -16
  58. package/dist/components/ui/Label.js.map +1 -1
  59. package/dist/components/ui/Select.cjs +83 -46
  60. package/dist/components/ui/Select.cjs.map +1 -1
  61. package/dist/components/ui/Select.d.cts +3 -2
  62. package/dist/components/ui/Select.d.ts +3 -2
  63. package/dist/components/ui/Select.js +75 -38
  64. package/dist/components/ui/Select.js.map +1 -1
  65. package/dist/index.cjs +344 -140
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.d.cts +1 -0
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.js +318 -115
  70. package/dist/index.js.map +1 -1
  71. package/dist/styles/globals.css +30 -13
  72. package/dist/styles/globals.css.map +1 -1
  73. package/package.json +1 -1
@@ -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,15 +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 space-y-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)(Label_default, { text: label, className: classNames?.label }),
165
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
192
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
193
+ Label_default,
194
+ {
195
+ text: label,
196
+ htmlFor: props.name,
197
+ required: props.required,
198
+ description,
199
+ className: classNames?.label
200
+ }
201
+ ),
202
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
166
203
  SelectPrimitive.Root,
167
204
  {
168
205
  open,
@@ -173,16 +210,16 @@ var Select = (0, import_react.forwardRef)(
173
210
  dir: dir === "rtl" ? "rtl" : "ltr",
174
211
  ...rest,
175
212
  children: [
176
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
213
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
177
214
  SelectPrimitive.Trigger,
178
215
  {
179
216
  ref,
180
217
  className: cn(
181
- "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",
182
219
  classNames?.trigger
183
220
  ),
184
221
  children: [
185
- /* @__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)(
186
223
  SelectPrimitive.Value,
187
224
  {
188
225
  placeholder: placeholder ?? "Select an option",
@@ -190,8 +227,8 @@ var Select = (0, import_react.forwardRef)(
190
227
  children: handleLabels()
191
228
  }
192
229
  ) }),
193
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
194
- import_lucide_react.ChevronDownIcon,
230
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
231
+ import_lucide_react2.ChevronDownIcon,
195
232
  {
196
233
  className: "transform text-black group-data-[state=open]:rotate-180",
197
234
  size: "16"
@@ -200,7 +237,7 @@ var Select = (0, import_react.forwardRef)(
200
237
  ]
201
238
  }
202
239
  ),
203
- /* @__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)(
204
241
  SelectPrimitive.Content,
205
242
  {
206
243
  hideWhenDetached: true,
@@ -209,17 +246,17 @@ var Select = (0, import_react.forwardRef)(
209
246
  sideOffset: 4,
210
247
  onPointerDownOutside: toggleOpen,
211
248
  onKeyDown: closeOnEscape,
212
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(SelectPrimitive.Viewport, { children: [
213
- 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)(
214
251
  SelectPrimitive.Group,
215
252
  {
216
253
  className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
217
254
  "data-testid": "selected-labels",
218
255
  children: chipLabels?.map(
219
- (chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
220
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: chip.title }),
221
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
222
- 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,
223
260
  {
224
261
  size: 18,
225
262
  "data-testid": `chip-remove-${chip.value}`,
@@ -231,8 +268,8 @@ var Select = (0, import_react.forwardRef)(
231
268
  )
232
269
  }
233
270
  ),
234
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Separator, {}),
235
- 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)(
236
273
  SelectPrimitive.Item,
237
274
  {
238
275
  value: value2,
@@ -241,9 +278,9 @@ var Select = (0, import_react.forwardRef)(
241
278
  onKeyDown: (e) => setValueOnEnter(e, value2),
242
279
  onClick: () => handleChange(value2),
243
280
  children: [
244
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.ItemText, { children: title }),
245
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
246
- 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,
247
284
  {
248
285
  className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
249
286
  size: 16
@@ -259,7 +296,7 @@ var Select = (0, import_react.forwardRef)(
259
296
  ]
260
297
  }
261
298
  ),
262
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorMessage_default, { message: error, className: "mt-1" })
299
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ErrorMessage_default, { message: error })
263
300
  ]
264
301
  }
265
302
  );
@@ -269,14 +306,15 @@ Select.displayName = "Select";
269
306
  var Select_default = Select;
270
307
 
271
308
  // src/components/demos/SelectDemo.tsx
272
- var import_jsx_runtime6 = require("react/jsx-runtime");
309
+ var import_jsx_runtime7 = require("react/jsx-runtime");
273
310
  function SelectDemo() {
274
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "m-4", children: [
275
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: "Select" }),
276
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex max-w-sm flex-col gap-4 mt-2", children: [
277
- /* @__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)(
278
315
  Select_default,
279
316
  {
317
+ required: true,
280
318
  label: "Label - Singleselect",
281
319
  placeholder: "Select an option",
282
320
  options: [
@@ -286,12 +324,13 @@ function SelectDemo() {
286
324
  ]
287
325
  }
288
326
  ),
289
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
327
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
290
328
  Select_default,
291
329
  {
292
330
  multiselect: true,
293
331
  label: "Label - Multiselect",
294
332
  placeholder: "Select an option",
333
+ description: "This is a tooltip",
295
334
  options: [
296
335
  { id: "1", value: "1", title: "Option 1" },
297
336
  { id: "2", value: "2", title: "Option 2" },
@@ -306,7 +345,7 @@ function SelectDemo() {
306
345
  ]
307
346
  }
308
347
  ),
309
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
348
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
310
349
  Select_default,
311
350
  {
312
351
  disabled: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/demos/SelectDemo.tsx","../../../src/components/ui/Select.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/ui/Label.tsx","../../../src/components/ui/Chip.tsx","../../../src/components/primitives/separator.tsx"],"sourcesContent":["import Select from '@/components/ui/Select'\n\nfunction SelectDemo() {\n return (\n <div className='m-4'>\n <h3>Select</h3>\n <div className=\"flex max-w-sm flex-col gap-4 mt-2\">\n <Select\n label=\"Label - Singleselect\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n <Select\n multiselect\n label=\"Label - Multiselect\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n { id: '4', value: '4', title: 'Option 4' },\n { id: '5', value: '5', title: 'Option 5' },\n { id: '6', value: '6', title: 'Option 6' },\n { id: '7', value: '7', title: 'Option 7' },\n { id: '8', value: '8', title: 'Option 8' },\n { id: '9', value: '9', title: 'Option 9' },\n { id: '10', value: '10', title: 'Option 10' },\n ]}\n />\n <Select\n disabled\n label=\"Label - Disabled\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n </div>\n </div>\n )\n}\n\nexport default SelectDemo","'use client'\n\nimport * as SelectPrimitive from '@radix-ui/react-select'\nimport { CheckIcon, ChevronDownIcon, X } from 'lucide-react'\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type KeyboardEvent,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport Chip from '@/components/ui/Chip'\nimport { Separator } from '@/components/primitives/separator'\nimport { cn } from '@/lib/utils'\n\n\ninterface Props extends Omit<ComponentPropsWithoutRef<'select'>, 'value' | 'onChange'> {\n label?: string\n value?: string | string[]\n options?: { id: string | number; value: string; title: string }[]\n placeholder?: string\n multiselect?: boolean\n onChange?: (value: string | string[]) => void\n classNames?: { label?: string; trigger?: string }\n error?: string\n}\n\nconst Select = forwardRef<HTMLButtonElement, Props>(\n ({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {\n const { value, defaultValue, dir, className, onChange, ...rest } = props\n const [selected, setSelected] = useState<string[]>([])\n const [open, setOpen] = useState(false)\n const containerRef = useRef<HTMLDivElement>(null)\n\n\n useEffect(() => {\n if (!value) return setSelected([])\n setSelected(Array.isArray(value) ? value : [value])\n }, [value])\n\n const toggleOpen = () => setOpen((prev) => !prev)\n const closeOnEscape = (event: KeyboardEvent) => event.key === 'Escape' && setOpen(false)\n const setValueOnEnter = (event: KeyboardEvent, value: string) =>\n event.key === 'Enter' && handleChange(value)\n\n const chipLabels = selected\n ?.map((s) => options?.find(({ value }) => value === s))\n .filter(Boolean)\n\n function handleLabels() {\n if (multiselect) {\n return selected.map((o) => options?.find((option) => option.value === o)?.title).join(', ')\n }\n return options?.find((option) => option.value === selected.join())?.title\n }\n\n function handleOnOpenChange(isOpen: boolean) {\n if (!multiselect || isOpen) setOpen(isOpen)\n }\n\n function handleChange(newValue: string) {\n let newSelected: string[] = []\n setSelected((prev) => {\n newSelected = prev.includes(newValue)\n ? prev.filter((item) => item !== newValue)\n : [...prev, newValue]\n return multiselect ? newSelected : [newValue]\n })\n onChange?.(multiselect ? newSelected : newValue)\n }\n\n return (\n <div\n className={cn('flex flex-col space-y-1', className)}\n ref={containerRef}\n data-testid={`${(label ?? id)?.toLowerCase()}-select-element`}\n >\n <Label text={label} className={classNames?.label} />\n\n <SelectPrimitive.Root\n open={open}\n value={selected.join(',')}\n onOpenChange={handleOnOpenChange}\n onValueChange={multiselect ? undefined : handleChange}\n defaultValue={typeof defaultValue === 'string' ? defaultValue : undefined}\n dir={dir === 'rtl' ? 'rtl' : 'ltr'}\n {...rest}\n >\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n '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',\n classNames?.trigger\n )}\n >\n <span className=\"truncate\">\n <SelectPrimitive.Value\n placeholder={placeholder ?? 'Select an option'}\n aria-label={handleLabels()}\n >\n {handleLabels()}\n </SelectPrimitive.Value>\n </span>\n\n <ChevronDownIcon\n className=\"transform text-black group-data-[state=open]:rotate-180\"\n size=\"16\"\n />\n </SelectPrimitive.Trigger>\n\n <SelectPrimitive.Portal container={containerRef.current}>\n <SelectPrimitive.Content\n hideWhenDetached\n className=\"z-10 max-h-[var(--radix-select-content-available-height)] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-md bg-white py-2 shadow-lg\"\n position=\"popper\"\n sideOffset={4}\n onPointerDownOutside={toggleOpen}\n onKeyDown={closeOnEscape}\n >\n <SelectPrimitive.Viewport>\n {multiselect && !!chipLabels?.length && (\n <SelectPrimitive.Group\n className=\"mb-2 flex flex-row flex-wrap gap-1 px-2\"\n data-testid=\"selected-labels\"\n >\n {chipLabels?.map(\n (chip) =>\n chip && (\n <Chip key={chip.title} size=\"small\" variant=\"primary\">\n <span>{chip.title}</span>\n <X\n size={18}\n data-testid={`chip-remove-${chip.value}`}\n className=\"cursor-pointer\"\n onClick={() => handleChange(chip.value)}\n />\n </Chip>\n )\n )}\n </SelectPrimitive.Group>\n )}\n <Separator />\n {options?.map(({ id, title, value }) => (\n <SelectPrimitive.Item\n key={id}\n value={value}\n className=\"group relative cursor-pointer px-4 py-2 text-left text-sm hover:bg-purple-50 focus:bg-purple-50 focus:outline-none data-[state=checked]:bg-purple-50 data-[state=checked]:pr-10 data-[state=checked]:text-purple-100\"\n data-state={selected.includes(value) ? 'checked' : 'unchecked'}\n onKeyDown={(e) => setValueOnEnter(e, value)}\n onClick={() => handleChange(value)}\n >\n <SelectPrimitive.ItemText>{title}</SelectPrimitive.ItemText>\n <CheckIcon\n className=\"absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block\"\n size={16}\n />\n </SelectPrimitive.Item>\n ))}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n <ErrorMessage message={error} className=\"mt-1\" />\n </div>\n )\n }\n)\n\nSelect.displayName = 'Select'\n\nexport default Select\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","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n required?: boolean\n}\n\nfunction Label({ text, required, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n {required && <span className=\"text-red-600\">&nbsp;*</span>}\n </label>\n )\n}\n\nexport default Label\n","import { cva, type VariantProps } from 'cva'\nimport React from 'react'\nimport { twMerge } from 'tailwind-merge'\n\ninterface ChipProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof chipVariants> {}\n\nconst Chip = ({ className, variant, size, ...props }: ChipProps) => (\n <div className={twMerge(chipVariants({ variant, size, className }))} {...props} />\n)\n\nconst chipVariants = cva(['flex', 'items-center', 'rounded-3xl', 'border', 'w-fit'], {\n variants: {\n variant: {\n neutral: ['text-grey-80', 'border-grey-10'],\n primary: ['text-purple-100', 'border-purple-20'],\n danger: ['text-pumpkin-100', 'border-pumpkin-20'],\n onboarding: ['text-green-100', 'bg-green-10', 'cursor-pointer'],\n onboardingSelected: ['text-white', 'bg-green-90', 'cursor-pointer'],\n },\n size: {\n small: ['text-sm', 'leading-5', 'px-2', 'py-1', 'gap-1.5'],\n medium: ['text-base', 'leading-6', 'px-3', 'py-2', 'gap-2'],\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'medium',\n },\n})\n\nexport default Chip\n","'use client'\r\n\r\nimport * as SeparatorPrimitive from '@radix-ui/react-separator'\r\nimport * as React from 'react'\r\n\r\nimport { cn } from '@/lib/utils'\r\n\r\nconst Separator = React.forwardRef<\r\n React.ElementRef<typeof SeparatorPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\r\n>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (\r\n <SeparatorPrimitive.Root\r\n ref={ref}\r\n decorative={decorative}\r\n orientation={orientation}\r\n className={cn(\r\n 'shrink-0 bg-grey-10',\r\n orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',\r\n className\r\n )}\r\n {...props}\r\n />\r\n))\r\nSeparator.displayName = SeparatorPrimitive.Root.displayName\r\n\r\nexport { Separator }\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,sBAAiC;AACjC,0BAA8C;AAC9C,mBAOO;;;ACXP,kBAAsC;AACtC,4BAAw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,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,MAAM,OAAO,MAAM,OAAO,YAAY;AAAA,UAC9C;AAAA;AAAA,MACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,UAAQ;AAAA,UACR,OAAM;AAAA,UACN,aAAY;AAAA,UACZ,SAAS;AAAA,YACP,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,UAC3C;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,IAAO,qBAAQ;","names":["import_jsx_runtime","import_tailwind_merge","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","value","id","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/demos/SelectDemo.tsx","../../../src/components/ui/Select.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/primitives/tooltip.tsx","../../../src/components/ui/Label.tsx","../../../src/components/ui/Chip.tsx","../../../src/components/primitives/separator.tsx"],"sourcesContent":["import Select from '@/components/ui/Select'\n\nfunction SelectDemo() {\n return (\n <div className=\"m-4\">\n <h3>Select</h3>\n <div className=\"mt-2 flex max-w-sm flex-col gap-4\">\n <Select\n required\n label=\"Label - Singleselect\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n <Select\n multiselect\n label=\"Label - Multiselect\"\n placeholder=\"Select an option\"\n description=\"This is a tooltip\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n { id: '4', value: '4', title: 'Option 4' },\n { id: '5', value: '5', title: 'Option 5' },\n { id: '6', value: '6', title: 'Option 6' },\n { id: '7', value: '7', title: 'Option 7' },\n { id: '8', value: '8', title: 'Option 8' },\n { id: '9', value: '9', title: 'Option 9' },\n { id: '10', value: '10', title: 'Option 10' },\n ]}\n />\n <Select\n disabled\n label=\"Label - Disabled\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n </div>\n </div>\n )\n}\n\nexport default SelectDemo\n","'use client'\n\nimport * as SelectPrimitive from '@radix-ui/react-select'\nimport { CheckIcon, ChevronDownIcon, X } from 'lucide-react'\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type KeyboardEvent,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport Chip from '@/components/ui/Chip'\nimport { Separator } from '@/components/primitives/separator'\nimport { cn } from '@/lib/utils'\n\ninterface Props extends Omit<ComponentPropsWithoutRef<'select'>, 'value' | 'onChange'> {\n label?: string\n value?: string | string[]\n options?: { id: string | number; value: string; title: string }[]\n placeholder?: string\n multiselect?: boolean\n description?: string\n error?: string\n classNames?: { label?: string; trigger?: string }\n onChange?: (value: string | string[]) => void\n}\n\nconst Select = forwardRef<HTMLButtonElement, Props>(\n (\n { label, options, placeholder, multiselect, description, classNames, error, id, ...props },\n ref\n ) => {\n const { value, defaultValue, dir, className, onChange, ...rest } = props\n const [selected, setSelected] = useState<string[]>([])\n const [open, setOpen] = useState(false)\n const containerRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!value) return setSelected([])\n setSelected(Array.isArray(value) ? value : [value])\n }, [value])\n\n const toggleOpen = () => setOpen((prev) => !prev)\n const closeOnEscape = (event: KeyboardEvent) => event.key === 'Escape' && setOpen(false)\n const setValueOnEnter = (event: KeyboardEvent, value: string) =>\n event.key === 'Enter' && handleChange(value)\n\n const chipLabels = selected\n ?.map((s) => options?.find(({ value }) => value === s))\n .filter(Boolean)\n\n function handleLabels() {\n if (multiselect) {\n return selected.map((o) => options?.find((option) => option.value === o)?.title).join(', ')\n }\n return options?.find((option) => option.value === selected.join())?.title\n }\n\n function handleOnOpenChange(isOpen: boolean) {\n if (!multiselect || isOpen) setOpen(isOpen)\n }\n\n function handleChange(newValue: string) {\n let newSelected: string[] = []\n setSelected((prev) => {\n newSelected = prev.includes(newValue)\n ? prev.filter((item) => item !== newValue)\n : [...prev, newValue]\n return multiselect ? newSelected : [newValue]\n })\n onChange?.(multiselect ? newSelected : newValue)\n }\n\n return (\n <div\n className={cn('flex w-full flex-col gap-1', className)}\n ref={containerRef}\n data-testid={`${(label ?? id)?.toLowerCase()}-select-element`}\n >\n <Label\n text={label}\n htmlFor={props.name}\n required={props.required}\n description={description}\n className={classNames?.label}\n />\n\n <SelectPrimitive.Root\n open={open}\n value={selected.join(',')}\n onOpenChange={handleOnOpenChange}\n onValueChange={multiselect ? undefined : handleChange}\n defaultValue={typeof defaultValue === 'string' ? defaultValue : undefined}\n dir={dir === 'rtl' ? 'rtl' : 'ltr'}\n {...rest}\n >\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n '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',\n classNames?.trigger\n )}\n >\n <span className=\"truncate\">\n <SelectPrimitive.Value\n placeholder={placeholder ?? 'Select an option'}\n aria-label={handleLabels()}\n >\n {handleLabels()}\n </SelectPrimitive.Value>\n </span>\n\n <ChevronDownIcon\n className=\"transform text-black group-data-[state=open]:rotate-180\"\n size=\"16\"\n />\n </SelectPrimitive.Trigger>\n\n <SelectPrimitive.Portal container={containerRef.current}>\n <SelectPrimitive.Content\n hideWhenDetached\n className=\"z-10 max-h-[var(--radix-select-content-available-height)] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-md bg-white py-2 shadow-lg\"\n position=\"popper\"\n sideOffset={4}\n onPointerDownOutside={toggleOpen}\n onKeyDown={closeOnEscape}\n >\n <SelectPrimitive.Viewport>\n {multiselect && !!chipLabels?.length && (\n <SelectPrimitive.Group\n className=\"mb-2 flex flex-row flex-wrap gap-1 px-2\"\n data-testid=\"selected-labels\"\n >\n {chipLabels?.map(\n (chip) =>\n chip && (\n <Chip key={chip.title} size=\"small\" variant=\"primary\">\n <span>{chip.title}</span>\n <X\n size={18}\n data-testid={`chip-remove-${chip.value}`}\n className=\"cursor-pointer\"\n onClick={() => handleChange(chip.value)}\n />\n </Chip>\n )\n )}\n </SelectPrimitive.Group>\n )}\n <Separator />\n {options?.map(({ id, title, value }) => (\n <SelectPrimitive.Item\n key={id}\n value={value}\n className=\"group relative cursor-pointer px-4 py-2 text-left text-sm hover:bg-purple-50 focus:bg-purple-50 focus:outline-none data-[state=checked]:bg-purple-50 data-[state=checked]:pr-10 data-[state=checked]:text-purple-100\"\n data-state={selected.includes(value) ? 'checked' : 'unchecked'}\n onKeyDown={(e) => setValueOnEnter(e, value)}\n onClick={() => handleChange(value)}\n >\n <SelectPrimitive.ItemText>{title}</SelectPrimitive.ItemText>\n <CheckIcon\n className=\"absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block\"\n size={16}\n />\n </SelectPrimitive.Item>\n ))}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\n\nSelect.displayName = 'Select'\n\nexport default Select\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","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","'use client'\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n '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',\n className\n )}\n {...props}\n />\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { InfoIcon } from 'lucide-react'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n required?: boolean\n description?: string\n}\n\nfunction Label({ text, required, description, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <div className=\"flex w-full flex-row gap-1\">\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n {required && <span className=\"text-red-600\">&nbsp;*</span>}\n </label>\n\n {!!description && (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <InfoIcon className=\"h-4 w-4\" />\n </TooltipTrigger>\n <TooltipContent className=\"max-w-48\">{description}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n )\n}\n\nexport default Label\n","import { cva, type VariantProps } from 'cva'\nimport React from 'react'\nimport { twMerge } from 'tailwind-merge'\n\ninterface ChipProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof chipVariants> {}\n\nconst Chip = ({ className, variant, size, ...props }: ChipProps) => (\n <div className={twMerge(chipVariants({ variant, size, className }))} {...props} />\n)\n\nconst chipVariants = cva(['flex', 'items-center', 'rounded-3xl', 'border', 'w-fit'], {\n variants: {\n variant: {\n neutral: ['text-grey-80', 'border-grey-10'],\n primary: ['text-purple-100', 'border-purple-20'],\n danger: ['text-pumpkin-100', 'border-pumpkin-20'],\n onboarding: ['text-green-100', 'bg-green-10', 'cursor-pointer'],\n onboardingSelected: ['text-white', 'bg-green-90', 'cursor-pointer'],\n },\n size: {\n small: ['text-sm', 'leading-5', 'px-2', 'py-1', 'gap-1.5'],\n medium: ['text-base', 'leading-6', 'px-3', 'py-2', 'gap-2'],\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'medium',\n },\n})\n\nexport default Chip\n","'use client'\r\n\r\nimport * as SeparatorPrimitive from '@radix-ui/react-separator'\r\nimport * as React from 'react'\r\n\r\nimport { cn } from '@/lib/utils'\r\n\r\nconst Separator = React.forwardRef<\r\n React.ElementRef<typeof SeparatorPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\r\n>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (\r\n <SeparatorPrimitive.Root\r\n ref={ref}\r\n decorative={decorative}\r\n orientation={orientation}\r\n className={cn(\r\n 'shrink-0 bg-grey-10',\r\n orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',\r\n className\r\n )}\r\n {...props}\r\n />\r\n))\r\nSeparator.displayName = SeparatorPrimitive.Root.displayName\r\n\r\nexport { Separator }\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,sBAAiC;AACjC,IAAAA,uBAA8C;AAC9C,mBAOO;;;ACXP,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACOI;AAJJ,SAAS,aAAa,EAAE,SAAS,WAAW,GAAG,MAAM,GAAoB;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,SACE,4CAAC,OAAE,WAAW,GAAG,6BAA6B,SAAS,GAAI,GAAG,OAC3D,mBACH;AAEJ;AAEA,IAAO,uBAAQ;;;AChBf,uBAAkC;AAClC,YAAuB;AAcrB,IAAAC,sBAAA;AAVF,IAAM,kBAAmC;AAEzC,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAExC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,GAAG,MAAM,GAAG,QAC1C;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,eAAe,cAA+B,yBAAQ;;;AClBtD,0BAAyB;AAanB,IAAAC,sBAAA;AALN,SAAS,MAAM,EAAE,MAAM,UAAU,aAAa,WAAW,GAAG,MAAM,GAAoB;AACpF,MAAI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IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,MAAM,OAAO,MAAM,OAAO,YAAY;AAAA,UAC9C;AAAA;AAAA,MACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,UAAQ;AAAA,UACR,OAAM;AAAA,UACN,aAAY;AAAA,UACZ,SAAS;AAAA,YACP,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,UAC3C;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,IAAO,qBAAQ;","names":["import_lucide_react","import_jsx_runtime","import_jsx_runtime","import_tailwind_merge","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","value","id","import_jsx_runtime"]}
@@ -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,11 +154,20 @@ var Select = forwardRef2(
126
154
  return /* @__PURE__ */ jsxs2(
127
155
  "div",
128
156
  {
129
- className: cn("flex flex-col space-y-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(Label_default, { text: label, className: classNames?.label }),
161
+ /* @__PURE__ */ jsx6(
162
+ Label_default,
163
+ {
164
+ text: label,
165
+ htmlFor: props.name,
166
+ required: props.required,
167
+ description,
168
+ className: classNames?.label
169
+ }
170
+ ),
134
171
  /* @__PURE__ */ jsxs2(
135
172
  SelectPrimitive.Root,
136
173
  {
@@ -147,11 +184,11 @@ var Select = forwardRef2(
147
184
  {
148
185
  ref,
149
186
  className: cn(
150
- "group flex h-11 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",
151
188
  classNames?.trigger
152
189
  ),
153
190
  children: [
154
- /* @__PURE__ */ jsx5("span", { className: "truncate", children: /* @__PURE__ */ jsx5(
191
+ /* @__PURE__ */ jsx6("span", { className: "truncate", children: /* @__PURE__ */ jsx6(
155
192
  SelectPrimitive.Value,
156
193
  {
157
194
  placeholder: placeholder ?? "Select an option",
@@ -159,7 +196,7 @@ var Select = forwardRef2(
159
196
  children: handleLabels()
160
197
  }
161
198
  ) }),
162
- /* @__PURE__ */ jsx5(
199
+ /* @__PURE__ */ jsx6(
163
200
  ChevronDownIcon,
164
201
  {
165
202
  className: "transform text-black group-data-[state=open]:rotate-180",
@@ -169,7 +206,7 @@ var Select = forwardRef2(
169
206
  ]
170
207
  }
171
208
  ),
172
- /* @__PURE__ */ jsx5(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ jsx5(
209
+ /* @__PURE__ */ jsx6(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ jsx6(
173
210
  SelectPrimitive.Content,
174
211
  {
175
212
  hideWhenDetached: true,
@@ -179,15 +216,15 @@ var Select = forwardRef2(
179
216
  onPointerDownOutside: toggleOpen,
180
217
  onKeyDown: closeOnEscape,
181
218
  children: /* @__PURE__ */ jsxs2(SelectPrimitive.Viewport, { children: [
182
- multiselect && !!chipLabels?.length && /* @__PURE__ */ jsx5(
219
+ multiselect && !!chipLabels?.length && /* @__PURE__ */ jsx6(
183
220
  SelectPrimitive.Group,
184
221
  {
185
222
  className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
186
223
  "data-testid": "selected-labels",
187
224
  children: chipLabels?.map(
188
225
  (chip) => chip && /* @__PURE__ */ jsxs2(Chip_default, { size: "small", variant: "primary", children: [
189
- /* @__PURE__ */ jsx5("span", { children: chip.title }),
190
- /* @__PURE__ */ jsx5(
226
+ /* @__PURE__ */ jsx6("span", { children: chip.title }),
227
+ /* @__PURE__ */ jsx6(
191
228
  X,
192
229
  {
193
230
  size: 18,
@@ -200,7 +237,7 @@ var Select = forwardRef2(
200
237
  )
201
238
  }
202
239
  ),
203
- /* @__PURE__ */ jsx5(Separator, {}),
240
+ /* @__PURE__ */ jsx6(Separator, {}),
204
241
  options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs2(
205
242
  SelectPrimitive.Item,
206
243
  {
@@ -210,8 +247,8 @@ var Select = forwardRef2(
210
247
  onKeyDown: (e) => setValueOnEnter(e, value2),
211
248
  onClick: () => handleChange(value2),
212
249
  children: [
213
- /* @__PURE__ */ jsx5(SelectPrimitive.ItemText, { children: title }),
214
- /* @__PURE__ */ jsx5(
250
+ /* @__PURE__ */ jsx6(SelectPrimitive.ItemText, { children: title }),
251
+ /* @__PURE__ */ jsx6(
215
252
  CheckIcon,
216
253
  {
217
254
  className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
@@ -228,7 +265,7 @@ var Select = forwardRef2(
228
265
  ]
229
266
  }
230
267
  ),
231
- /* @__PURE__ */ jsx5(ErrorMessage_default, { message: error, className: "mt-1" })
268
+ /* @__PURE__ */ jsx6(ErrorMessage_default, { message: error })
232
269
  ]
233
270
  }
234
271
  );
@@ -238,14 +275,15 @@ Select.displayName = "Select";
238
275
  var Select_default = Select;
239
276
 
240
277
  // src/components/demos/SelectDemo.tsx
241
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
278
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
242
279
  function SelectDemo() {
243
280
  return /* @__PURE__ */ jsxs3("div", { className: "m-4", children: [
244
- /* @__PURE__ */ jsx6("h3", { children: "Select" }),
245
- /* @__PURE__ */ jsxs3("div", { className: "flex max-w-sm flex-col gap-4 mt-2", children: [
246
- /* @__PURE__ */ jsx6(
281
+ /* @__PURE__ */ jsx7("h3", { children: "Select" }),
282
+ /* @__PURE__ */ jsxs3("div", { className: "mt-2 flex max-w-sm flex-col gap-4", children: [
283
+ /* @__PURE__ */ jsx7(
247
284
  Select_default,
248
285
  {
286
+ required: true,
249
287
  label: "Label - Singleselect",
250
288
  placeholder: "Select an option",
251
289
  options: [
@@ -255,12 +293,13 @@ function SelectDemo() {
255
293
  ]
256
294
  }
257
295
  ),
258
- /* @__PURE__ */ jsx6(
296
+ /* @__PURE__ */ jsx7(
259
297
  Select_default,
260
298
  {
261
299
  multiselect: true,
262
300
  label: "Label - Multiselect",
263
301
  placeholder: "Select an option",
302
+ description: "This is a tooltip",
264
303
  options: [
265
304
  { id: "1", value: "1", title: "Option 1" },
266
305
  { id: "2", value: "2", title: "Option 2" },
@@ -275,7 +314,7 @@ function SelectDemo() {
275
314
  ]
276
315
  }
277
316
  ),
278
- /* @__PURE__ */ jsx6(
317
+ /* @__PURE__ */ jsx7(
279
318
  Select_default,
280
319
  {
281
320
  disabled: true,