@next-degree/pickle-shared-js 0.3.21 → 0.3.23
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 +22 -5
- package/dist/app/layout.css.map +1 -1
- package/dist/app/page.cjs +265 -12
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +270 -12
- package/dist/app/page.js.map +1 -1
- package/dist/components/demos/ComboboxDemo.cjs +16 -8
- package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
- package/dist/components/demos/ComboboxDemo.js +16 -8
- package/dist/components/demos/ComboboxDemo.js.map +1 -1
- 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 +263 -10
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +268 -10
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/ui/Combobox.cjs +16 -8
- package/dist/components/ui/Combobox.cjs.map +1 -1
- package/dist/components/ui/Combobox.js +16 -8
- package/dist/components/ui/Combobox.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/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 +205 -178
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +191 -164
- package/dist/index.js.map +1 -1
- package/dist/styles/globals.css +22 -5
- package/dist/styles/globals.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -54,11 +54,19 @@ function cn(...inputs) {
|
|
|
54
54
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
// src/components/ui/
|
|
57
|
+
// src/components/ui/ErrorMessage.tsx
|
|
58
58
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
59
|
+
function ErrorMessage({ message, className, ...props }) {
|
|
60
|
+
if (!message) return null;
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: cn("px-1 text-xs text-red-600", className), ...props, children: message });
|
|
62
|
+
}
|
|
63
|
+
var ErrorMessage_default = ErrorMessage;
|
|
64
|
+
|
|
65
|
+
// src/components/ui/Label.tsx
|
|
66
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
59
67
|
function Label({ text, className, ...props }) {
|
|
60
68
|
if (!text) return null;
|
|
61
|
-
return /* @__PURE__ */ (0,
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
62
70
|
"label",
|
|
63
71
|
{
|
|
64
72
|
className: cn(
|
|
@@ -75,8 +83,8 @@ var Label_default = Label;
|
|
|
75
83
|
// src/components/ui/Chip.tsx
|
|
76
84
|
var import_cva = require("cva");
|
|
77
85
|
var import_tailwind_merge2 = require("tailwind-merge");
|
|
78
|
-
var
|
|
79
|
-
var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ (0,
|
|
86
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
87
|
+
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
88
|
var chipVariants = (0, import_cva.cva)(["flex", "items-center", "rounded-3xl", "border", "w-fit"], {
|
|
81
89
|
variants: {
|
|
82
90
|
variant: {
|
|
@@ -101,8 +109,8 @@ var Chip_default = Chip;
|
|
|
101
109
|
// src/components/primitives/separator.tsx
|
|
102
110
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
103
111
|
var React = __toESM(require("react"), 1);
|
|
104
|
-
var
|
|
105
|
-
var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0,
|
|
112
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
113
|
+
var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
106
114
|
SeparatorPrimitive.Root,
|
|
107
115
|
{
|
|
108
116
|
ref,
|
|
@@ -119,9 +127,9 @@ var Separator = React.forwardRef(({ className, orientation = "horizontal", decor
|
|
|
119
127
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
120
128
|
|
|
121
129
|
// src/components/ui/Select.tsx
|
|
122
|
-
var
|
|
130
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
123
131
|
var Select = (0, import_react.forwardRef)(
|
|
124
|
-
({ label, options, placeholder, multiselect, classNames, ...props }, ref) => {
|
|
132
|
+
({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {
|
|
125
133
|
const { value, defaultValue, dir, className, onChange, ...rest } = props;
|
|
126
134
|
const [selected, setSelected] = (0, import_react.useState)([]);
|
|
127
135
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
@@ -151,104 +159,115 @@ var Select = (0, import_react.forwardRef)(
|
|
|
151
159
|
});
|
|
152
160
|
onChange?.(multiselect ? newSelected : newValue);
|
|
153
161
|
}
|
|
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)
|
|
162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
className: cn("flex flex-col space-y-1", className),
|
|
166
|
+
ref: containerRef,
|
|
167
|
+
"data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label_default, { text: label, className: classNames?.label }),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
171
|
+
SelectPrimitive.Root,
|
|
172
|
+
{
|
|
173
|
+
open,
|
|
174
|
+
value: selected.join(","),
|
|
175
|
+
onOpenChange: handleOnOpenChange,
|
|
176
|
+
onValueChange: multiselect ? void 0 : handleChange,
|
|
177
|
+
defaultValue: typeof defaultValue === "string" ? defaultValue : void 0,
|
|
178
|
+
dir: dir === "rtl" ? "rtl" : "ltr",
|
|
179
|
+
...rest,
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
182
|
+
SelectPrimitive.Trigger,
|
|
183
|
+
{
|
|
184
|
+
ref,
|
|
185
|
+
className: cn(
|
|
186
|
+
"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
|
+
classNames?.trigger
|
|
188
|
+
),
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
191
|
+
SelectPrimitive.Value,
|
|
192
|
+
{
|
|
193
|
+
placeholder: placeholder ?? "Select an option",
|
|
194
|
+
"aria-label": handleLabels(),
|
|
195
|
+
children: handleLabels()
|
|
196
|
+
}
|
|
197
|
+
) }),
|
|
198
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
199
|
+
import_lucide_react.ChevronDownIcon,
|
|
200
|
+
{
|
|
201
|
+
className: "transform text-black group-data-[state=open]:rotate-180",
|
|
202
|
+
size: "16"
|
|
203
|
+
}
|
|
220
204
|
)
|
|
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
|
-
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
209
|
+
SelectPrimitive.Content,
|
|
210
|
+
{
|
|
211
|
+
hideWhenDetached: true,
|
|
212
|
+
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",
|
|
213
|
+
position: "popper",
|
|
214
|
+
sideOffset: 4,
|
|
215
|
+
onPointerDownOutside: toggleOpen,
|
|
216
|
+
onKeyDown: closeOnEscape,
|
|
217
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(SelectPrimitive.Viewport, { children: [
|
|
218
|
+
multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
219
|
+
SelectPrimitive.Group,
|
|
220
|
+
{
|
|
221
|
+
className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
|
|
222
|
+
"data-testid": "selected-labels",
|
|
223
|
+
children: chipLabels?.map(
|
|
224
|
+
(chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: chip.title }),
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
227
|
+
import_lucide_react.X,
|
|
228
|
+
{
|
|
229
|
+
size: 18,
|
|
230
|
+
"data-testid": `chip-remove-${chip.value}`,
|
|
231
|
+
className: "cursor-pointer",
|
|
232
|
+
onClick: () => handleChange(chip.value)
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
] }, chip.title)
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Separator, {}),
|
|
240
|
+
options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
241
|
+
SelectPrimitive.Item,
|
|
242
|
+
{
|
|
243
|
+
value: value2,
|
|
244
|
+
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",
|
|
245
|
+
"data-state": selected.includes(value2) ? "checked" : "unchecked",
|
|
246
|
+
onKeyDown: (e) => setValueOnEnter(e, value2),
|
|
247
|
+
onClick: () => handleChange(value2),
|
|
248
|
+
children: [
|
|
249
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.ItemText, { children: title }),
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
251
|
+
import_lucide_react.CheckIcon,
|
|
252
|
+
{
|
|
253
|
+
className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
|
|
254
|
+
size: 16
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
id2
|
|
260
|
+
))
|
|
261
|
+
] })
|
|
262
|
+
}
|
|
263
|
+
) })
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorMessage_default, { message: error, className: "mt-1" })
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
);
|
|
252
271
|
}
|
|
253
272
|
);
|
|
254
273
|
Select.displayName = "Select";
|
|
@@ -258,8 +277,8 @@ var Select_default = Select;
|
|
|
258
277
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
259
278
|
var import_lucide_react2 = require("lucide-react");
|
|
260
279
|
var import_react2 = require("react");
|
|
261
|
-
var
|
|
262
|
-
var CheckboxToggle = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
280
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
281
|
+
var CheckboxToggle = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
263
282
|
CheckboxPrimitive.Root,
|
|
264
283
|
{
|
|
265
284
|
ref,
|
|
@@ -289,9 +308,9 @@ var CheckboxToggle = (0, import_react2.forwardRef)(({ className, ...props }, ref
|
|
|
289
308
|
className
|
|
290
309
|
),
|
|
291
310
|
...props,
|
|
292
|
-
children: /* @__PURE__ */ (0,
|
|
293
|
-
/* @__PURE__ */ (0,
|
|
294
|
-
/* @__PURE__ */ (0,
|
|
311
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: [
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { className: "hidden h-4 w-4 group-data-[state=checked]:block" }),
|
|
313
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Minus, { className: "hidden h-4 w-4 group-data-[state=indeterminate]:block" })
|
|
295
314
|
] })
|
|
296
315
|
}
|
|
297
316
|
));
|
|
@@ -301,9 +320,9 @@ var Checkbox = (0, import_react2.forwardRef)(
|
|
|
301
320
|
const { disabled } = props;
|
|
302
321
|
const id = props.id ?? `${props.name ?? props.value?.toString()}-checkbox`;
|
|
303
322
|
const labelClassName = disabled ? "text-grey-40 pointer-events-none" : "";
|
|
304
|
-
return /* @__PURE__ */ (0,
|
|
305
|
-
/* @__PURE__ */ (0,
|
|
306
|
-
/* @__PURE__ */ (0,
|
|
323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn("flex space-x-2", classNames?.wrapper), children: [
|
|
324
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CheckboxToggle, { id, disabled, ref, ...props }),
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: id, className: cn(labelClassName, classNames?.label), children })
|
|
307
326
|
] });
|
|
308
327
|
}
|
|
309
328
|
);
|
|
@@ -313,7 +332,7 @@ var Checkbox_default = Checkbox;
|
|
|
313
332
|
// src/components/ui/ListItem.tsx
|
|
314
333
|
var import_lucide_react3 = require("lucide-react");
|
|
315
334
|
var import_lucide_react4 = require("lucide-react");
|
|
316
|
-
var
|
|
335
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
317
336
|
function ListItem({
|
|
318
337
|
icon,
|
|
319
338
|
hasCheckbox,
|
|
@@ -327,12 +346,12 @@ function ListItem({
|
|
|
327
346
|
const getIconIfValid = (icon2) => {
|
|
328
347
|
if (icon2 in import_lucide_react4.icons) {
|
|
329
348
|
const IconComponent = import_lucide_react4.icons[icon2];
|
|
330
|
-
return /* @__PURE__ */ (0,
|
|
349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconComponent, { size: 14 });
|
|
331
350
|
}
|
|
332
351
|
return null;
|
|
333
352
|
};
|
|
334
353
|
const optionIcon = icon ? getIconIfValid(icon) : void 0;
|
|
335
|
-
return /* @__PURE__ */ (0,
|
|
354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
336
355
|
"li",
|
|
337
356
|
{
|
|
338
357
|
className: cn(
|
|
@@ -342,13 +361,13 @@ function ListItem({
|
|
|
342
361
|
...props,
|
|
343
362
|
"data-state": isSelected ? "checked" : "unchecked",
|
|
344
363
|
children: [
|
|
345
|
-
optionIcon && /* @__PURE__ */ (0,
|
|
346
|
-
hasCheckbox && /* @__PURE__ */ (0,
|
|
347
|
-
/* @__PURE__ */ (0,
|
|
348
|
-
/* @__PURE__ */ (0,
|
|
349
|
-
/* @__PURE__ */ (0,
|
|
364
|
+
optionIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mr-2", children: optionIcon }),
|
|
365
|
+
hasCheckbox && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Checkbox_default, { id: value, checked: isSelected, onClick: (e) => e.preventDefault() }),
|
|
366
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: title }),
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-xs text-grey-80", children: description })
|
|
350
369
|
] }),
|
|
351
|
-
/* @__PURE__ */ (0,
|
|
370
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
352
371
|
import_lucide_react3.CheckIcon,
|
|
353
372
|
{
|
|
354
373
|
className: "absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",
|
|
@@ -365,11 +384,11 @@ var ListItem_default = ListItem;
|
|
|
365
384
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
366
385
|
var import_cva2 = require("cva");
|
|
367
386
|
var import_react3 = require("react");
|
|
368
|
-
var
|
|
387
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
369
388
|
var Button = (0, import_react3.forwardRef)(
|
|
370
389
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
371
390
|
const Component = asChild ? import_react_slot.Slot : "button";
|
|
372
|
-
return /* @__PURE__ */ (0,
|
|
391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
373
392
|
Component,
|
|
374
393
|
{
|
|
375
394
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -484,9 +503,9 @@ var React4 = __toESM(require("react"), 1);
|
|
|
484
503
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
485
504
|
var import_lucide_react5 = require("lucide-react");
|
|
486
505
|
var React3 = __toESM(require("react"), 1);
|
|
487
|
-
var
|
|
506
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
488
507
|
var DialogPortal = DialogPrimitive.Portal;
|
|
489
|
-
var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
508
|
+
var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
490
509
|
DialogPrimitive.Overlay,
|
|
491
510
|
{
|
|
492
511
|
ref,
|
|
@@ -498,9 +517,9 @@ var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
498
517
|
}
|
|
499
518
|
));
|
|
500
519
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
501
|
-
var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
520
|
+
var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogPortal, { children: [
|
|
521
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DialogOverlay, {}),
|
|
522
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
504
523
|
DialogPrimitive.Content,
|
|
505
524
|
{
|
|
506
525
|
ref,
|
|
@@ -511,18 +530,18 @@ var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) =
|
|
|
511
530
|
...props,
|
|
512
531
|
children: [
|
|
513
532
|
children,
|
|
514
|
-
/* @__PURE__ */ (0,
|
|
515
|
-
/* @__PURE__ */ (0,
|
|
516
|
-
/* @__PURE__ */ (0,
|
|
533
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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: [
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react5.X, { className: "h-4 w-4" }),
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sr-only", children: "Close" })
|
|
517
536
|
] })
|
|
518
537
|
]
|
|
519
538
|
}
|
|
520
539
|
)
|
|
521
540
|
] }));
|
|
522
541
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
523
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
542
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
524
543
|
DialogHeader.displayName = "DialogHeader";
|
|
525
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
544
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
526
545
|
"div",
|
|
527
546
|
{
|
|
528
547
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -530,7 +549,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
530
549
|
}
|
|
531
550
|
);
|
|
532
551
|
DialogFooter.displayName = "DialogFooter";
|
|
533
|
-
var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
552
|
+
var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
534
553
|
DialogPrimitive.Title,
|
|
535
554
|
{
|
|
536
555
|
ref,
|
|
@@ -539,7 +558,7 @@ var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
539
558
|
}
|
|
540
559
|
));
|
|
541
560
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
542
|
-
var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
561
|
+
var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
543
562
|
DialogPrimitive.Description,
|
|
544
563
|
{
|
|
545
564
|
ref,
|
|
@@ -550,8 +569,8 @@ var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
550
569
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
551
570
|
|
|
552
571
|
// src/components/primitives/command.tsx
|
|
553
|
-
var
|
|
554
|
-
var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
572
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
573
|
+
var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
555
574
|
import_cmdk.Command,
|
|
556
575
|
{
|
|
557
576
|
ref,
|
|
@@ -563,9 +582,9 @@ var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
563
582
|
}
|
|
564
583
|
));
|
|
565
584
|
Command.displayName = import_cmdk.Command.displayName;
|
|
566
|
-
var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
567
|
-
/* @__PURE__ */ (0,
|
|
568
|
-
/* @__PURE__ */ (0,
|
|
585
|
+
var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "m-1 flex items-center rounded-xl border px-3", "cmdk-input-wrapper": "", children: [
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
569
588
|
import_cmdk.Command.Input,
|
|
570
589
|
{
|
|
571
590
|
ref,
|
|
@@ -578,7 +597,7 @@ var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
578
597
|
)
|
|
579
598
|
] }));
|
|
580
599
|
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
581
|
-
var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
600
|
+
var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
582
601
|
import_cmdk.Command.List,
|
|
583
602
|
{
|
|
584
603
|
ref,
|
|
@@ -587,9 +606,9 @@ var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
587
606
|
}
|
|
588
607
|
));
|
|
589
608
|
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
590
|
-
var CommandEmpty = React4.forwardRef((props, ref) => /* @__PURE__ */ (0,
|
|
609
|
+
var CommandEmpty = React4.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_cmdk.Command.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
591
610
|
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
592
|
-
var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
611
|
+
var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
593
612
|
import_cmdk.Command.Group,
|
|
594
613
|
{
|
|
595
614
|
ref,
|
|
@@ -601,7 +620,7 @@ var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
601
620
|
}
|
|
602
621
|
));
|
|
603
622
|
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
604
|
-
var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
623
|
+
var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
605
624
|
import_cmdk.Command.Separator,
|
|
606
625
|
{
|
|
607
626
|
ref,
|
|
@@ -610,7 +629,7 @@ var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
610
629
|
}
|
|
611
630
|
));
|
|
612
631
|
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
613
|
-
var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
632
|
+
var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
614
633
|
import_cmdk.Command.Item,
|
|
615
634
|
{
|
|
616
635
|
ref,
|
|
@@ -623,7 +642,7 @@ var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
623
642
|
));
|
|
624
643
|
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
625
644
|
var CommandShortcut = ({ className, ...props }) => {
|
|
626
|
-
return /* @__PURE__ */ (0,
|
|
645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
627
646
|
"span",
|
|
628
647
|
{
|
|
629
648
|
className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
|
|
@@ -636,10 +655,10 @@ CommandShortcut.displayName = "CommandShortcut";
|
|
|
636
655
|
// src/components/primitives/popover.tsx
|
|
637
656
|
var React5 = __toESM(require("react"), 1);
|
|
638
657
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
639
|
-
var
|
|
658
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
640
659
|
var Popover = PopoverPrimitive.Root;
|
|
641
660
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
642
|
-
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0,
|
|
661
|
+
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
643
662
|
PopoverPrimitive.Content,
|
|
644
663
|
{
|
|
645
664
|
ref,
|
|
@@ -656,7 +675,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
656
675
|
|
|
657
676
|
// src/components/ui/Badge.tsx
|
|
658
677
|
var import_cva3 = require("cva");
|
|
659
|
-
var
|
|
678
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
660
679
|
var badgeVariants = (0, import_cva3.cva)("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
661
680
|
variants: {
|
|
662
681
|
variant: {
|
|
@@ -670,11 +689,11 @@ var badgeVariants = (0, import_cva3.cva)("rounded-full px-2 py-0.5 text-xs font-
|
|
|
670
689
|
}
|
|
671
690
|
});
|
|
672
691
|
function Badge({ className, variant, ...props }) {
|
|
673
|
-
return /* @__PURE__ */ (0,
|
|
692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
674
693
|
}
|
|
675
694
|
|
|
676
695
|
// src/components/ui/Combobox.tsx
|
|
677
|
-
var
|
|
696
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
678
697
|
var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
679
698
|
const {
|
|
680
699
|
value,
|
|
@@ -727,17 +746,17 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
727
746
|
const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
|
|
728
747
|
return isDefault ? defaultLabel : label;
|
|
729
748
|
};
|
|
730
|
-
return /* @__PURE__ */ (0,
|
|
731
|
-
isDefault && label && /* @__PURE__ */ (0,
|
|
732
|
-
/* @__PURE__ */ (0,
|
|
733
|
-
/* @__PURE__ */ (0,
|
|
734
|
-
/* @__PURE__ */ (0,
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
750
|
+
isDefault && label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Label_default, { text: label, className: classNames?.label }),
|
|
751
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative flex", children: [
|
|
752
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
753
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
735
754
|
PopoverTrigger,
|
|
736
755
|
{
|
|
737
756
|
asChild: true,
|
|
738
757
|
disabled: options.length === 0,
|
|
739
758
|
"data-testid": `${props.id ?? props.name}-combobox-trigger`,
|
|
740
|
-
children: /* @__PURE__ */ (0,
|
|
759
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
741
760
|
"div",
|
|
742
761
|
{
|
|
743
762
|
ref,
|
|
@@ -748,9 +767,9 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
748
767
|
),
|
|
749
768
|
"aria-expanded": open,
|
|
750
769
|
children: [
|
|
751
|
-
isDefault && IconComponent && /* @__PURE__ */ (0,
|
|
752
|
-
isChip && !isEmpty && /* @__PURE__ */ (0,
|
|
753
|
-
/* @__PURE__ */ (0,
|
|
770
|
+
isDefault && IconComponent && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconComponent, { className: "h-4 w-4 shrink-0" }),
|
|
771
|
+
isChip && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge, { variant: "purple", children: selected.length }),
|
|
772
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
754
773
|
"span",
|
|
755
774
|
{
|
|
756
775
|
className: cn(
|
|
@@ -760,7 +779,7 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
760
779
|
children: handleDisplayValue()
|
|
761
780
|
}
|
|
762
781
|
),
|
|
763
|
-
showChevron && /* @__PURE__ */ (0,
|
|
782
|
+
showChevron && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
764
783
|
import_lucide_react7.ChevronDownIcon,
|
|
765
784
|
{
|
|
766
785
|
className: "shrink-0 transform group-data-[state=open]:rotate-180",
|
|
@@ -772,7 +791,7 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
772
791
|
)
|
|
773
792
|
}
|
|
774
793
|
),
|
|
775
|
-
/* @__PURE__ */ (0,
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
776
795
|
PopoverContent,
|
|
777
796
|
{
|
|
778
797
|
className: cn(
|
|
@@ -783,33 +802,41 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
783
802
|
collisionPadding: 8,
|
|
784
803
|
sideOffset: 4,
|
|
785
804
|
align: "start",
|
|
786
|
-
children: /* @__PURE__ */ (0,
|
|
787
|
-
!hideSearchBox && /* @__PURE__ */ (0,
|
|
788
|
-
/* @__PURE__ */ (0,
|
|
789
|
-
/* @__PURE__ */ (0,
|
|
790
|
-
/* @__PURE__ */ (0,
|
|
791
|
-
|
|
805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Command, { children: [
|
|
806
|
+
!hideSearchBox && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CommandInput, { placeholder: "Search..." }),
|
|
807
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(CommandList, { children: [
|
|
808
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CommandEmpty, { children: "No results" }),
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CommandGroup, { children: options.map(({ id, ...option }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
810
|
+
CommandItem,
|
|
792
811
|
{
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
812
|
+
value: option.title,
|
|
813
|
+
onSelect: () => handleSelect(option.value),
|
|
814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
815
|
+
ListItem_default,
|
|
816
|
+
{
|
|
817
|
+
className: cn(classNames?.items, "truncate py-1"),
|
|
818
|
+
isSelected: selected.some((s) => s.value === option.value),
|
|
819
|
+
hasCheckbox: multiselect,
|
|
820
|
+
...option
|
|
821
|
+
}
|
|
822
|
+
)
|
|
823
|
+
},
|
|
824
|
+
id
|
|
825
|
+
)) })
|
|
799
826
|
] }),
|
|
800
|
-
!!footer && /* @__PURE__ */ (0,
|
|
827
|
+
!!footer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Separator, {}),
|
|
801
828
|
footer && footer({ close })
|
|
802
829
|
] })
|
|
803
830
|
}
|
|
804
831
|
)
|
|
805
832
|
] }),
|
|
806
|
-
isDefault && !isEmpty && /* @__PURE__ */ (0,
|
|
833
|
+
isDefault && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
807
834
|
"button",
|
|
808
835
|
{
|
|
809
836
|
type: "button",
|
|
810
837
|
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",
|
|
811
838
|
onClick: handleClear,
|
|
812
|
-
children: /* @__PURE__ */ (0,
|
|
839
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.CircleX, { className: "h-4 w-4 text-green-100" })
|
|
813
840
|
}
|
|
814
841
|
)
|
|
815
842
|
] })
|