@next-degree/pickle-shared-js 0.3.22 → 0.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/layout.css +106 -5
- package/dist/app/layout.css.map +1 -1
- package/dist/app/page.cjs +364 -4
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +369 -4
- package/dist/app/page.js.map +1 -1
- package/dist/components/demos/InputDemo.cjs +175 -0
- package/dist/components/demos/InputDemo.cjs.map +1 -0
- package/dist/components/demos/InputDemo.d.cts +5 -0
- package/dist/components/demos/InputDemo.d.ts +5 -0
- package/dist/components/demos/InputDemo.js +152 -0
- package/dist/components/demos/InputDemo.js.map +1 -0
- package/dist/components/demos/SelectDemo.cjs +323 -0
- package/dist/components/demos/SelectDemo.cjs.map +1 -0
- package/dist/components/demos/SelectDemo.d.cts +5 -0
- package/dist/components/demos/SelectDemo.d.ts +5 -0
- package/dist/components/demos/SelectDemo.js +295 -0
- package/dist/components/demos/SelectDemo.js.map +1 -0
- package/dist/components/demos/index.cjs +362 -2
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +367 -2
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/ui/ErrorMessage.cjs +41 -0
- package/dist/components/ui/ErrorMessage.cjs.map +1 -0
- package/dist/components/ui/ErrorMessage.d.cts +9 -0
- package/dist/components/ui/ErrorMessage.d.ts +9 -0
- package/dist/components/ui/ErrorMessage.js +18 -0
- package/dist/components/ui/ErrorMessage.js.map +1 -0
- package/dist/components/ui/Input.cjs +159 -0
- package/dist/components/ui/Input.cjs.map +1 -0
- package/dist/components/ui/Input.d.cts +22 -0
- package/dist/components/ui/Input.d.ts +22 -0
- package/dist/components/ui/Input.js +138 -0
- package/dist/components/ui/Input.js.map +1 -0
- package/dist/components/ui/Select.cjs +124 -105
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.d.cts +3 -1
- package/dist/components/ui/Select.d.ts +3 -1
- package/dist/components/ui/Select.js +124 -105
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/index.cjs +311 -190
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +301 -181
- package/dist/index.js.map +1 -1
- package/dist/styles/globals.css +106 -5
- package/dist/styles/globals.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
Checkbox: () => Checkbox_default,
|
|
36
36
|
Chip: () => Chip_default,
|
|
37
37
|
Combobox: () => Combobox,
|
|
38
|
+
Input: () => Input_default,
|
|
38
39
|
Label: () => Label_default,
|
|
39
40
|
ListItem: () => ListItem_default,
|
|
40
41
|
Select: () => Select_default,
|
|
@@ -54,11 +55,19 @@ function cn(...inputs) {
|
|
|
54
55
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
// src/components/ui/
|
|
58
|
+
// src/components/ui/ErrorMessage.tsx
|
|
58
59
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
60
|
+
function ErrorMessage({ message, className, ...props }) {
|
|
61
|
+
if (!message) return null;
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: cn("px-1 text-xs text-red-600", className), ...props, children: message });
|
|
63
|
+
}
|
|
64
|
+
var ErrorMessage_default = ErrorMessage;
|
|
65
|
+
|
|
66
|
+
// src/components/ui/Label.tsx
|
|
67
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
59
68
|
function Label({ text, className, ...props }) {
|
|
60
69
|
if (!text) return null;
|
|
61
|
-
return /* @__PURE__ */ (0,
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
62
71
|
"label",
|
|
63
72
|
{
|
|
64
73
|
className: cn(
|
|
@@ -75,8 +84,8 @@ var Label_default = Label;
|
|
|
75
84
|
// src/components/ui/Chip.tsx
|
|
76
85
|
var import_cva = require("cva");
|
|
77
86
|
var import_tailwind_merge2 = require("tailwind-merge");
|
|
78
|
-
var
|
|
79
|
-
var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ (0,
|
|
87
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
88
|
+
var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_tailwind_merge2.twMerge)(chipVariants({ variant, size, className })), ...props });
|
|
80
89
|
var chipVariants = (0, import_cva.cva)(["flex", "items-center", "rounded-3xl", "border", "w-fit"], {
|
|
81
90
|
variants: {
|
|
82
91
|
variant: {
|
|
@@ -101,8 +110,8 @@ var Chip_default = Chip;
|
|
|
101
110
|
// src/components/primitives/separator.tsx
|
|
102
111
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
103
112
|
var React = __toESM(require("react"), 1);
|
|
104
|
-
var
|
|
105
|
-
var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0,
|
|
113
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
114
|
+
var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
106
115
|
SeparatorPrimitive.Root,
|
|
107
116
|
{
|
|
108
117
|
ref,
|
|
@@ -119,9 +128,9 @@ var Separator = React.forwardRef(({ className, orientation = "horizontal", decor
|
|
|
119
128
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
120
129
|
|
|
121
130
|
// src/components/ui/Select.tsx
|
|
122
|
-
var
|
|
131
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
123
132
|
var Select = (0, import_react.forwardRef)(
|
|
124
|
-
({ label, options, placeholder, multiselect, classNames, ...props }, ref) => {
|
|
133
|
+
({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {
|
|
125
134
|
const { value, defaultValue, dir, className, onChange, ...rest } = props;
|
|
126
135
|
const [selected, setSelected] = (0, import_react.useState)([]);
|
|
127
136
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
@@ -151,104 +160,115 @@ var Select = (0, import_react.forwardRef)(
|
|
|
151
160
|
});
|
|
152
161
|
onChange?.(multiselect ? newSelected : newValue);
|
|
153
162
|
}
|
|
154
|
-
return /* @__PURE__ */ (0,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
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",
|
|
197
|
-
position: "popper",
|
|
198
|
-
sideOffset: 4,
|
|
199
|
-
onPointerDownOutside: toggleOpen,
|
|
200
|
-
onKeyDown: closeOnEscape,
|
|
201
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(SelectPrimitive.Viewport, { children: [
|
|
202
|
-
multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
203
|
-
SelectPrimitive.Group,
|
|
204
|
-
{
|
|
205
|
-
className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
|
|
206
|
-
"data-testid": "selected-labels",
|
|
207
|
-
children: chipLabels?.map(
|
|
208
|
-
(chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
|
|
209
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: chip.title }),
|
|
210
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
211
|
-
import_lucide_react.X,
|
|
212
|
-
{
|
|
213
|
-
size: 18,
|
|
214
|
-
"data-testid": `chip-remove-${chip.value}`,
|
|
215
|
-
className: "cursor-pointer",
|
|
216
|
-
onClick: () => handleChange(chip.value)
|
|
217
|
-
}
|
|
218
|
-
)
|
|
219
|
-
] }, chip.title)
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
className: cn("flex flex-col space-y-1", className),
|
|
167
|
+
ref: containerRef,
|
|
168
|
+
"data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label_default, { text: label, className: classNames?.label }),
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
172
|
+
SelectPrimitive.Root,
|
|
173
|
+
{
|
|
174
|
+
open,
|
|
175
|
+
value: selected.join(","),
|
|
176
|
+
onOpenChange: handleOnOpenChange,
|
|
177
|
+
onValueChange: multiselect ? void 0 : handleChange,
|
|
178
|
+
defaultValue: typeof defaultValue === "string" ? defaultValue : void 0,
|
|
179
|
+
dir: dir === "rtl" ? "rtl" : "ltr",
|
|
180
|
+
...rest,
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
183
|
+
SelectPrimitive.Trigger,
|
|
184
|
+
{
|
|
185
|
+
ref,
|
|
186
|
+
className: cn(
|
|
187
|
+
"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",
|
|
188
|
+
classNames?.trigger
|
|
189
|
+
),
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
192
|
+
SelectPrimitive.Value,
|
|
193
|
+
{
|
|
194
|
+
placeholder: placeholder ?? "Select an option",
|
|
195
|
+
"aria-label": handleLabels(),
|
|
196
|
+
children: handleLabels()
|
|
197
|
+
}
|
|
198
|
+
) }),
|
|
199
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
200
|
+
import_lucide_react.ChevronDownIcon,
|
|
201
|
+
{
|
|
202
|
+
className: "transform text-black group-data-[state=open]:rotate-180",
|
|
203
|
+
size: "16"
|
|
204
|
+
}
|
|
220
205
|
)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
210
|
+
SelectPrimitive.Content,
|
|
211
|
+
{
|
|
212
|
+
hideWhenDetached: true,
|
|
213
|
+
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",
|
|
214
|
+
position: "popper",
|
|
215
|
+
sideOffset: 4,
|
|
216
|
+
onPointerDownOutside: toggleOpen,
|
|
217
|
+
onKeyDown: closeOnEscape,
|
|
218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(SelectPrimitive.Viewport, { children: [
|
|
219
|
+
multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
220
|
+
SelectPrimitive.Group,
|
|
221
|
+
{
|
|
222
|
+
className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
|
|
223
|
+
"data-testid": "selected-labels",
|
|
224
|
+
children: chipLabels?.map(
|
|
225
|
+
(chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: chip.title }),
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
228
|
+
import_lucide_react.X,
|
|
229
|
+
{
|
|
230
|
+
size: 18,
|
|
231
|
+
"data-testid": `chip-remove-${chip.value}`,
|
|
232
|
+
className: "cursor-pointer",
|
|
233
|
+
onClick: () => handleChange(chip.value)
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
] }, chip.title)
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Separator, {}),
|
|
241
|
+
options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
242
|
+
SelectPrimitive.Item,
|
|
243
|
+
{
|
|
244
|
+
value: value2,
|
|
245
|
+
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",
|
|
246
|
+
"data-state": selected.includes(value2) ? "checked" : "unchecked",
|
|
247
|
+
onKeyDown: (e) => setValueOnEnter(e, value2),
|
|
248
|
+
onClick: () => handleChange(value2),
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.ItemText, { children: title }),
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
252
|
+
import_lucide_react.CheckIcon,
|
|
253
|
+
{
|
|
254
|
+
className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
|
|
255
|
+
size: 16
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
id2
|
|
261
|
+
))
|
|
262
|
+
] })
|
|
263
|
+
}
|
|
264
|
+
) })
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
),
|
|
268
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorMessage_default, { message: error, className: "mt-1" })
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
);
|
|
252
272
|
}
|
|
253
273
|
);
|
|
254
274
|
Select.displayName = "Select";
|
|
@@ -258,8 +278,8 @@ var Select_default = Select;
|
|
|
258
278
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
259
279
|
var import_lucide_react2 = require("lucide-react");
|
|
260
280
|
var import_react2 = require("react");
|
|
261
|
-
var
|
|
262
|
-
var CheckboxToggle = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
281
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
282
|
+
var CheckboxToggle = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
263
283
|
CheckboxPrimitive.Root,
|
|
264
284
|
{
|
|
265
285
|
ref,
|
|
@@ -289,9 +309,9 @@ var CheckboxToggle = (0, import_react2.forwardRef)(({ className, ...props }, ref
|
|
|
289
309
|
className
|
|
290
310
|
),
|
|
291
311
|
...props,
|
|
292
|
-
children: /* @__PURE__ */ (0,
|
|
293
|
-
/* @__PURE__ */ (0,
|
|
294
|
-
/* @__PURE__ */ (0,
|
|
312
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: [
|
|
313
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { className: "hidden h-4 w-4 group-data-[state=checked]:block" }),
|
|
314
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Minus, { className: "hidden h-4 w-4 group-data-[state=indeterminate]:block" })
|
|
295
315
|
] })
|
|
296
316
|
}
|
|
297
317
|
));
|
|
@@ -301,9 +321,9 @@ var Checkbox = (0, import_react2.forwardRef)(
|
|
|
301
321
|
const { disabled } = props;
|
|
302
322
|
const id = props.id ?? `${props.name ?? props.value?.toString()}-checkbox`;
|
|
303
323
|
const labelClassName = disabled ? "text-grey-40 pointer-events-none" : "";
|
|
304
|
-
return /* @__PURE__ */ (0,
|
|
305
|
-
/* @__PURE__ */ (0,
|
|
306
|
-
/* @__PURE__ */ (0,
|
|
324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn("flex space-x-2", classNames?.wrapper), children: [
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CheckboxToggle, { id, disabled, ref, ...props }),
|
|
326
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: id, className: cn(labelClassName, classNames?.label), children })
|
|
307
327
|
] });
|
|
308
328
|
}
|
|
309
329
|
);
|
|
@@ -313,7 +333,7 @@ var Checkbox_default = Checkbox;
|
|
|
313
333
|
// src/components/ui/ListItem.tsx
|
|
314
334
|
var import_lucide_react3 = require("lucide-react");
|
|
315
335
|
var import_lucide_react4 = require("lucide-react");
|
|
316
|
-
var
|
|
336
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
317
337
|
function ListItem({
|
|
318
338
|
icon,
|
|
319
339
|
hasCheckbox,
|
|
@@ -327,12 +347,12 @@ function ListItem({
|
|
|
327
347
|
const getIconIfValid = (icon2) => {
|
|
328
348
|
if (icon2 in import_lucide_react4.icons) {
|
|
329
349
|
const IconComponent = import_lucide_react4.icons[icon2];
|
|
330
|
-
return /* @__PURE__ */ (0,
|
|
350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconComponent, { size: 14 });
|
|
331
351
|
}
|
|
332
352
|
return null;
|
|
333
353
|
};
|
|
334
354
|
const optionIcon = icon ? getIconIfValid(icon) : void 0;
|
|
335
|
-
return /* @__PURE__ */ (0,
|
|
355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
336
356
|
"li",
|
|
337
357
|
{
|
|
338
358
|
className: cn(
|
|
@@ -342,13 +362,13 @@ function ListItem({
|
|
|
342
362
|
...props,
|
|
343
363
|
"data-state": isSelected ? "checked" : "unchecked",
|
|
344
364
|
children: [
|
|
345
|
-
optionIcon && /* @__PURE__ */ (0,
|
|
346
|
-
hasCheckbox && /* @__PURE__ */ (0,
|
|
347
|
-
/* @__PURE__ */ (0,
|
|
348
|
-
/* @__PURE__ */ (0,
|
|
349
|
-
/* @__PURE__ */ (0,
|
|
365
|
+
optionIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mr-2", children: optionIcon }),
|
|
366
|
+
hasCheckbox && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Checkbox_default, { id: value, checked: isSelected, onClick: (e) => e.preventDefault() }),
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: title }),
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-xs text-grey-80", children: description })
|
|
350
370
|
] }),
|
|
351
|
-
/* @__PURE__ */ (0,
|
|
371
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
352
372
|
import_lucide_react3.CheckIcon,
|
|
353
373
|
{
|
|
354
374
|
className: "absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",
|
|
@@ -361,15 +381,115 @@ function ListItem({
|
|
|
361
381
|
}
|
|
362
382
|
var ListItem_default = ListItem;
|
|
363
383
|
|
|
364
|
-
// src/components/ui/
|
|
365
|
-
var import_react_slot = require("@radix-ui/react-slot");
|
|
384
|
+
// src/components/ui/Input.tsx
|
|
366
385
|
var import_cva2 = require("cva");
|
|
386
|
+
var import_lucide_react5 = require("lucide-react");
|
|
367
387
|
var import_react3 = require("react");
|
|
368
|
-
var
|
|
369
|
-
var
|
|
388
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
389
|
+
var Input = (0, import_react3.forwardRef)(
|
|
390
|
+
({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
|
|
391
|
+
const handleClear = () => {
|
|
392
|
+
onChange?.({ target: { value: "" } });
|
|
393
|
+
onClear?.();
|
|
394
|
+
};
|
|
395
|
+
const IconComponent = icon && import_lucide_react5.icons[icon];
|
|
396
|
+
const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
|
|
397
|
+
const hasIcon = !!icon;
|
|
398
|
+
const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
|
|
399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "group flex w-full flex-col", "data-testid": `input-wrapper-${props.id}`, children: [
|
|
400
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label_default, { text: label, htmlFor: props.name, className: cn("body mb-1", classNames?.label) }),
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative flex flex-row items-center", children: [
|
|
402
|
+
IconComponent && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
403
|
+
IconComponent,
|
|
404
|
+
{
|
|
405
|
+
className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
|
|
406
|
+
}
|
|
407
|
+
),
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
409
|
+
"input",
|
|
410
|
+
{
|
|
411
|
+
className: cn(inputVariants({ theme, hasIcon })),
|
|
412
|
+
ref,
|
|
413
|
+
placeholder,
|
|
414
|
+
value,
|
|
415
|
+
onChange,
|
|
416
|
+
"data-testid": `input-element-${props.id}`,
|
|
417
|
+
...props
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
hasIcon && value && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
421
|
+
import_lucide_react5.X,
|
|
422
|
+
{
|
|
423
|
+
className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
|
|
424
|
+
onClick: handleClear,
|
|
425
|
+
"data-testid": "clear-button"
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
] }),
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ErrorMessage_default, { message: error, className: "mt-1" })
|
|
430
|
+
] });
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
Input.displayName = "Input";
|
|
434
|
+
var inputVariants = (0, import_cva2.cva)(
|
|
435
|
+
[
|
|
436
|
+
"border-input",
|
|
437
|
+
"placeholder:text-muted-foreground",
|
|
438
|
+
"focus-visible:ring-ring",
|
|
439
|
+
"inline-flex",
|
|
440
|
+
"w-full",
|
|
441
|
+
"h-11",
|
|
442
|
+
"items-center",
|
|
443
|
+
"justify-start",
|
|
444
|
+
"gap-3",
|
|
445
|
+
"rounded-lg",
|
|
446
|
+
"bg-transparent",
|
|
447
|
+
"px-3",
|
|
448
|
+
"pt-0.5",
|
|
449
|
+
"text-sm",
|
|
450
|
+
"shadow-sm",
|
|
451
|
+
"ring-grey-50",
|
|
452
|
+
"transition-colors",
|
|
453
|
+
"focus-visible:outline-none",
|
|
454
|
+
"focus-visible:ring-1",
|
|
455
|
+
"disabled:cursor-not-allowed",
|
|
456
|
+
"disabled:opacity-50",
|
|
457
|
+
"appearance-none",
|
|
458
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
459
|
+
"[&::-webkit-search-decoration]:appearance-none",
|
|
460
|
+
"[&::-webkit-search-results-button]:appearance-none",
|
|
461
|
+
"[&::-webkit-search-results-decoration]:appearance-none",
|
|
462
|
+
"[&::-ms-clear]:display-none",
|
|
463
|
+
"[&::-ms-reveal]:display-none"
|
|
464
|
+
],
|
|
465
|
+
{
|
|
466
|
+
variants: {
|
|
467
|
+
theme: {
|
|
468
|
+
light: "text-grey-80 border",
|
|
469
|
+
dark: "text-white"
|
|
470
|
+
},
|
|
471
|
+
hasIcon: {
|
|
472
|
+
false: "pl-3",
|
|
473
|
+
true: "pl-8"
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
defaultVariants: {
|
|
477
|
+
theme: "light",
|
|
478
|
+
hasIcon: false
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
var Input_default = Input;
|
|
483
|
+
|
|
484
|
+
// src/components/ui/Button.tsx
|
|
485
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
486
|
+
var import_cva3 = require("cva");
|
|
487
|
+
var import_react4 = require("react");
|
|
488
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
489
|
+
var Button = (0, import_react4.forwardRef)(
|
|
370
490
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
371
491
|
const Component = asChild ? import_react_slot.Slot : "button";
|
|
372
|
-
return /* @__PURE__ */ (0,
|
|
492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
373
493
|
Component,
|
|
374
494
|
{
|
|
375
495
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -380,7 +500,7 @@ var Button = (0, import_react3.forwardRef)(
|
|
|
380
500
|
}
|
|
381
501
|
);
|
|
382
502
|
Button.displayName = "Button";
|
|
383
|
-
var buttonVariants = (0,
|
|
503
|
+
var buttonVariants = (0, import_cva3.cva)(
|
|
384
504
|
[
|
|
385
505
|
"flex",
|
|
386
506
|
"items-center",
|
|
@@ -471,22 +591,22 @@ var buttonVariants = (0, import_cva2.cva)(
|
|
|
471
591
|
);
|
|
472
592
|
|
|
473
593
|
// src/components/ui/Combobox.tsx
|
|
474
|
-
var
|
|
475
|
-
var
|
|
476
|
-
var
|
|
594
|
+
var import_react5 = require("react");
|
|
595
|
+
var import_lucide_react8 = require("lucide-react");
|
|
596
|
+
var import_cva5 = require("cva");
|
|
477
597
|
|
|
478
598
|
// src/components/primitives/command.tsx
|
|
479
599
|
var import_cmdk = require("cmdk");
|
|
480
|
-
var
|
|
600
|
+
var import_lucide_react7 = require("lucide-react");
|
|
481
601
|
var React4 = __toESM(require("react"), 1);
|
|
482
602
|
|
|
483
603
|
// src/components/primitives/dialog.tsx
|
|
484
604
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
485
|
-
var
|
|
605
|
+
var import_lucide_react6 = require("lucide-react");
|
|
486
606
|
var React3 = __toESM(require("react"), 1);
|
|
487
|
-
var
|
|
607
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
488
608
|
var DialogPortal = DialogPrimitive.Portal;
|
|
489
|
-
var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
609
|
+
var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
490
610
|
DialogPrimitive.Overlay,
|
|
491
611
|
{
|
|
492
612
|
ref,
|
|
@@ -498,9 +618,9 @@ var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
498
618
|
}
|
|
499
619
|
));
|
|
500
620
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
501
|
-
var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
621
|
+
var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogPortal, { children: [
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogOverlay, {}),
|
|
623
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
504
624
|
DialogPrimitive.Content,
|
|
505
625
|
{
|
|
506
626
|
ref,
|
|
@@ -511,18 +631,18 @@ var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) =
|
|
|
511
631
|
...props,
|
|
512
632
|
children: [
|
|
513
633
|
children,
|
|
514
|
-
/* @__PURE__ */ (0,
|
|
515
|
-
/* @__PURE__ */ (0,
|
|
516
|
-
/* @__PURE__ */ (0,
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.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: [
|
|
635
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.X, { className: "h-4 w-4" }),
|
|
636
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: "Close" })
|
|
517
637
|
] })
|
|
518
638
|
]
|
|
519
639
|
}
|
|
520
640
|
)
|
|
521
641
|
] }));
|
|
522
642
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
523
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
643
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
524
644
|
DialogHeader.displayName = "DialogHeader";
|
|
525
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
645
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
526
646
|
"div",
|
|
527
647
|
{
|
|
528
648
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -530,7 +650,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
530
650
|
}
|
|
531
651
|
);
|
|
532
652
|
DialogFooter.displayName = "DialogFooter";
|
|
533
|
-
var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
653
|
+
var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
534
654
|
DialogPrimitive.Title,
|
|
535
655
|
{
|
|
536
656
|
ref,
|
|
@@ -539,7 +659,7 @@ var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
539
659
|
}
|
|
540
660
|
));
|
|
541
661
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
542
|
-
var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
662
|
+
var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
543
663
|
DialogPrimitive.Description,
|
|
544
664
|
{
|
|
545
665
|
ref,
|
|
@@ -550,8 +670,8 @@ var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
550
670
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
551
671
|
|
|
552
672
|
// src/components/primitives/command.tsx
|
|
553
|
-
var
|
|
554
|
-
var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
673
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
674
|
+
var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
555
675
|
import_cmdk.Command,
|
|
556
676
|
{
|
|
557
677
|
ref,
|
|
@@ -563,9 +683,9 @@ var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
563
683
|
}
|
|
564
684
|
));
|
|
565
685
|
Command.displayName = import_cmdk.Command.displayName;
|
|
566
|
-
var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
567
|
-
/* @__PURE__ */ (0,
|
|
568
|
-
/* @__PURE__ */ (0,
|
|
686
|
+
var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "m-1 flex items-center rounded-xl border px-3", "cmdk-input-wrapper": "", children: [
|
|
687
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
688
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
569
689
|
import_cmdk.Command.Input,
|
|
570
690
|
{
|
|
571
691
|
ref,
|
|
@@ -578,7 +698,7 @@ var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
578
698
|
)
|
|
579
699
|
] }));
|
|
580
700
|
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
581
|
-
var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
701
|
+
var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
582
702
|
import_cmdk.Command.List,
|
|
583
703
|
{
|
|
584
704
|
ref,
|
|
@@ -587,9 +707,9 @@ var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
587
707
|
}
|
|
588
708
|
));
|
|
589
709
|
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
590
|
-
var CommandEmpty = React4.forwardRef((props, ref) => /* @__PURE__ */ (0,
|
|
710
|
+
var CommandEmpty = React4.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_cmdk.Command.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
591
711
|
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
592
|
-
var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
712
|
+
var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
593
713
|
import_cmdk.Command.Group,
|
|
594
714
|
{
|
|
595
715
|
ref,
|
|
@@ -601,7 +721,7 @@ var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
601
721
|
}
|
|
602
722
|
));
|
|
603
723
|
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
604
|
-
var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
724
|
+
var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
605
725
|
import_cmdk.Command.Separator,
|
|
606
726
|
{
|
|
607
727
|
ref,
|
|
@@ -610,7 +730,7 @@ var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
610
730
|
}
|
|
611
731
|
));
|
|
612
732
|
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
613
|
-
var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
733
|
+
var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
614
734
|
import_cmdk.Command.Item,
|
|
615
735
|
{
|
|
616
736
|
ref,
|
|
@@ -623,7 +743,7 @@ var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
623
743
|
));
|
|
624
744
|
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
625
745
|
var CommandShortcut = ({ className, ...props }) => {
|
|
626
|
-
return /* @__PURE__ */ (0,
|
|
746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
627
747
|
"span",
|
|
628
748
|
{
|
|
629
749
|
className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
|
|
@@ -636,10 +756,10 @@ CommandShortcut.displayName = "CommandShortcut";
|
|
|
636
756
|
// src/components/primitives/popover.tsx
|
|
637
757
|
var React5 = __toESM(require("react"), 1);
|
|
638
758
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
639
|
-
var
|
|
759
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
640
760
|
var Popover = PopoverPrimitive.Root;
|
|
641
761
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
642
|
-
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0,
|
|
762
|
+
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
643
763
|
PopoverPrimitive.Content,
|
|
644
764
|
{
|
|
645
765
|
ref,
|
|
@@ -655,9 +775,9 @@ var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffse
|
|
|
655
775
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
656
776
|
|
|
657
777
|
// src/components/ui/Badge.tsx
|
|
658
|
-
var
|
|
659
|
-
var
|
|
660
|
-
var badgeVariants = (0,
|
|
778
|
+
var import_cva4 = require("cva");
|
|
779
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
780
|
+
var badgeVariants = (0, import_cva4.cva)("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
661
781
|
variants: {
|
|
662
782
|
variant: {
|
|
663
783
|
green: "bg-green-90 text-white",
|
|
@@ -670,12 +790,12 @@ var badgeVariants = (0, import_cva3.cva)("rounded-full px-2 py-0.5 text-xs font-
|
|
|
670
790
|
}
|
|
671
791
|
});
|
|
672
792
|
function Badge({ className, variant, ...props }) {
|
|
673
|
-
return /* @__PURE__ */ (0,
|
|
793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
674
794
|
}
|
|
675
795
|
|
|
676
796
|
// src/components/ui/Combobox.tsx
|
|
677
|
-
var
|
|
678
|
-
var Combobox = (0,
|
|
797
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
798
|
+
var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
679
799
|
const {
|
|
680
800
|
value,
|
|
681
801
|
label,
|
|
@@ -690,16 +810,16 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
690
810
|
onChange: handleChange,
|
|
691
811
|
children: footer
|
|
692
812
|
} = props;
|
|
693
|
-
const [selected, setSelected] = (0,
|
|
694
|
-
const [open, setOpen] = (0,
|
|
695
|
-
const IconComponent = icon &&
|
|
813
|
+
const [selected, setSelected] = (0, import_react5.useState)([]);
|
|
814
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
815
|
+
const IconComponent = icon && import_lucide_react8.icons[icon];
|
|
696
816
|
const hideSearchBox = options?.length <= 5;
|
|
697
817
|
const isDefault = variant === "default";
|
|
698
818
|
const isChip = variant === "chip";
|
|
699
819
|
const isEmpty = selected.length == 0;
|
|
700
820
|
const showChevron = isDefault ? isEmpty : true;
|
|
701
821
|
const close = () => setOpen(false);
|
|
702
|
-
(0,
|
|
822
|
+
(0, import_react5.useEffect)(() => {
|
|
703
823
|
const valueArray = multiselect ? value ?? [] : value ? [value] : [];
|
|
704
824
|
setSelected(
|
|
705
825
|
valueArray.map((v) => options.find((o) => o.value === v)).filter((v) => v !== void 0)
|
|
@@ -727,17 +847,17 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
727
847
|
const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
|
|
728
848
|
return isDefault ? defaultLabel : label;
|
|
729
849
|
};
|
|
730
|
-
return /* @__PURE__ */ (0,
|
|
731
|
-
isDefault && label && /* @__PURE__ */ (0,
|
|
732
|
-
/* @__PURE__ */ (0,
|
|
733
|
-
/* @__PURE__ */ (0,
|
|
734
|
-
/* @__PURE__ */ (0,
|
|
850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
851
|
+
isDefault && label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Label_default, { text: label, className: classNames?.label }),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative flex", children: [
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
735
855
|
PopoverTrigger,
|
|
736
856
|
{
|
|
737
857
|
asChild: true,
|
|
738
858
|
disabled: options.length === 0,
|
|
739
859
|
"data-testid": `${props.id ?? props.name}-combobox-trigger`,
|
|
740
|
-
children: /* @__PURE__ */ (0,
|
|
860
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
741
861
|
"div",
|
|
742
862
|
{
|
|
743
863
|
ref,
|
|
@@ -748,9 +868,9 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
748
868
|
),
|
|
749
869
|
"aria-expanded": open,
|
|
750
870
|
children: [
|
|
751
|
-
isDefault && IconComponent && /* @__PURE__ */ (0,
|
|
752
|
-
isChip && !isEmpty && /* @__PURE__ */ (0,
|
|
753
|
-
/* @__PURE__ */ (0,
|
|
871
|
+
isDefault && IconComponent && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IconComponent, { className: "h-4 w-4 shrink-0" }),
|
|
872
|
+
isChip && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Badge, { variant: "purple", children: selected.length }),
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
754
874
|
"span",
|
|
755
875
|
{
|
|
756
876
|
className: cn(
|
|
@@ -760,8 +880,8 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
760
880
|
children: handleDisplayValue()
|
|
761
881
|
}
|
|
762
882
|
),
|
|
763
|
-
showChevron && /* @__PURE__ */ (0,
|
|
764
|
-
|
|
883
|
+
showChevron && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
884
|
+
import_lucide_react8.ChevronDownIcon,
|
|
765
885
|
{
|
|
766
886
|
className: "shrink-0 transform group-data-[state=open]:rotate-180",
|
|
767
887
|
size: "16"
|
|
@@ -772,7 +892,7 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
772
892
|
)
|
|
773
893
|
}
|
|
774
894
|
),
|
|
775
|
-
/* @__PURE__ */ (0,
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
776
896
|
PopoverContent,
|
|
777
897
|
{
|
|
778
898
|
className: cn(
|
|
@@ -783,16 +903,16 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
783
903
|
collisionPadding: 8,
|
|
784
904
|
sideOffset: 4,
|
|
785
905
|
align: "start",
|
|
786
|
-
children: /* @__PURE__ */ (0,
|
|
787
|
-
!hideSearchBox && /* @__PURE__ */ (0,
|
|
788
|
-
/* @__PURE__ */ (0,
|
|
789
|
-
/* @__PURE__ */ (0,
|
|
790
|
-
/* @__PURE__ */ (0,
|
|
906
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Command, { children: [
|
|
907
|
+
!hideSearchBox && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommandInput, { placeholder: "Search..." }),
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(CommandList, { children: [
|
|
909
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommandEmpty, { children: "No results" }),
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommandGroup, { children: options.map(({ id, ...option }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
791
911
|
CommandItem,
|
|
792
912
|
{
|
|
793
913
|
value: option.title,
|
|
794
914
|
onSelect: () => handleSelect(option.value),
|
|
795
|
-
children: /* @__PURE__ */ (0,
|
|
915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
796
916
|
ListItem_default,
|
|
797
917
|
{
|
|
798
918
|
className: cn(classNames?.items, "truncate py-1"),
|
|
@@ -805,26 +925,26 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
805
925
|
id
|
|
806
926
|
)) })
|
|
807
927
|
] }),
|
|
808
|
-
!!footer && /* @__PURE__ */ (0,
|
|
928
|
+
!!footer && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Separator, {}),
|
|
809
929
|
footer && footer({ close })
|
|
810
930
|
] })
|
|
811
931
|
}
|
|
812
932
|
)
|
|
813
933
|
] }),
|
|
814
|
-
isDefault && !isEmpty && /* @__PURE__ */ (0,
|
|
934
|
+
isDefault && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
815
935
|
"button",
|
|
816
936
|
{
|
|
817
937
|
type: "button",
|
|
818
938
|
className: "absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
|
|
819
939
|
onClick: handleClear,
|
|
820
|
-
children: /* @__PURE__ */ (0,
|
|
940
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.CircleX, { className: "h-4 w-4 text-green-100" })
|
|
821
941
|
}
|
|
822
942
|
)
|
|
823
943
|
] })
|
|
824
944
|
] });
|
|
825
945
|
});
|
|
826
946
|
Combobox.displayName = "Combobox";
|
|
827
|
-
var triggerVariants = (0,
|
|
947
|
+
var triggerVariants = (0, import_cva5.cva)(
|
|
828
948
|
"group relative cursor-pointer text-green-100 flex flex-row items-center justify-between gap-2 border border-grey-20 focus:outline-green-80 disabled:bg-grey-5",
|
|
829
949
|
{
|
|
830
950
|
variants: {
|
|
@@ -856,6 +976,7 @@ var triggerVariants = (0, import_cva4.cva)(
|
|
|
856
976
|
Checkbox,
|
|
857
977
|
Chip,
|
|
858
978
|
Combobox,
|
|
979
|
+
Input,
|
|
859
980
|
Label,
|
|
860
981
|
ListItem,
|
|
861
982
|
Select,
|