@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.
- package/dist/app/layout.css +30 -13
- package/dist/app/layout.css.map +1 -1
- package/dist/app/page.cjs +347 -116
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +328 -97
- package/dist/app/page.js.map +1 -1
- package/dist/components/demos/ComboboxDemo.cjs +97 -54
- package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
- package/dist/components/demos/ComboboxDemo.js +91 -48
- package/dist/components/demos/ComboboxDemo.js.map +1 -1
- package/dist/components/demos/CounterDemo.cjs +270 -0
- package/dist/components/demos/CounterDemo.cjs.map +1 -0
- package/dist/components/demos/CounterDemo.d.cts +5 -0
- package/dist/components/demos/CounterDemo.d.ts +5 -0
- package/dist/components/demos/CounterDemo.js +238 -0
- package/dist/components/demos/CounterDemo.js.map +1 -0
- package/dist/components/demos/InputDemo.cjs +82 -35
- package/dist/components/demos/InputDemo.cjs.map +1 -1
- package/dist/components/demos/InputDemo.js +68 -31
- package/dist/components/demos/InputDemo.js.map +1 -1
- package/dist/components/demos/SelectDemo.cjs +92 -53
- package/dist/components/demos/SelectDemo.cjs.map +1 -1
- package/dist/components/demos/SelectDemo.js +83 -44
- package/dist/components/demos/SelectDemo.js.map +1 -1
- package/dist/components/demos/index.cjs +345 -114
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +326 -95
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/primitives/tooltip.cjs +75 -0
- package/dist/components/primitives/tooltip.cjs.map +1 -0
- package/dist/components/primitives/tooltip.d.cts +9 -0
- package/dist/components/primitives/tooltip.d.ts +9 -0
- package/dist/components/primitives/tooltip.js +38 -0
- package/dist/components/primitives/tooltip.js.map +1 -0
- package/dist/components/ui/Combobox.cjs +83 -42
- package/dist/components/ui/Combobox.cjs.map +1 -1
- package/dist/components/ui/Combobox.d.cts +5 -2
- package/dist/components/ui/Combobox.d.ts +5 -2
- package/dist/components/ui/Combobox.js +77 -36
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/components/ui/Counter.cjs +248 -0
- package/dist/components/ui/Counter.cjs.map +1 -0
- package/dist/components/ui/Counter.d.cts +28 -0
- package/dist/components/ui/Counter.d.ts +28 -0
- package/dist/components/ui/Counter.js +214 -0
- package/dist/components/ui/Counter.js.map +1 -0
- package/dist/components/ui/Input.cjs +75 -28
- package/dist/components/ui/Input.cjs.map +1 -1
- package/dist/components/ui/Input.d.cts +2 -1
- package/dist/components/ui/Input.d.ts +2 -1
- package/dist/components/ui/Input.js +63 -26
- package/dist/components/ui/Input.js.map +1 -1
- package/dist/components/ui/Label.cjs +54 -16
- package/dist/components/ui/Label.cjs.map +1 -1
- package/dist/components/ui/Label.d.cts +2 -1
- package/dist/components/ui/Label.d.ts +2 -1
- package/dist/components/ui/Label.js +44 -16
- package/dist/components/ui/Label.js.map +1 -1
- package/dist/components/ui/Select.cjs +83 -46
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.d.cts +3 -2
- package/dist/components/ui/Select.d.ts +3 -2
- package/dist/components/ui/Select.js +75 -38
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/index.cjs +344 -140
- 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 +318 -115
- package/dist/index.js.map +1 -1
- package/dist/styles/globals.css +30 -13
- 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
|
+
Counter: () => Counter,
|
|
38
39
|
Input: () => Input_default,
|
|
39
40
|
Label: () => Label_default,
|
|
40
41
|
ListItem: () => ListItem_default,
|
|
@@ -45,7 +46,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
45
46
|
|
|
46
47
|
// src/components/ui/Select.tsx
|
|
47
48
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
|
|
48
|
-
var
|
|
49
|
+
var import_lucide_react2 = require("lucide-react");
|
|
49
50
|
var import_react = require("react");
|
|
50
51
|
|
|
51
52
|
// src/lib/utils.ts
|
|
@@ -63,32 +64,60 @@ function ErrorMessage({ message, className, ...props }) {
|
|
|
63
64
|
}
|
|
64
65
|
var ErrorMessage_default = ErrorMessage;
|
|
65
66
|
|
|
66
|
-
// src/components/
|
|
67
|
+
// src/components/primitives/tooltip.tsx
|
|
68
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
69
|
+
var React = __toESM(require("react"), 1);
|
|
67
70
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
68
|
-
|
|
71
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
72
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
73
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
74
|
+
var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
75
|
+
TooltipPrimitive.Content,
|
|
76
|
+
{
|
|
77
|
+
ref,
|
|
78
|
+
sideOffset,
|
|
79
|
+
className: cn(
|
|
80
|
+
"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",
|
|
81
|
+
className
|
|
82
|
+
),
|
|
83
|
+
...props
|
|
84
|
+
}
|
|
85
|
+
));
|
|
86
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
87
|
+
|
|
88
|
+
// src/components/ui/Label.tsx
|
|
89
|
+
var import_lucide_react = require("lucide-react");
|
|
90
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
91
|
+
function Label({ text, required, description, className, ...props }) {
|
|
69
92
|
if (!text) return null;
|
|
70
|
-
return /* @__PURE__ */ (0,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex w-full flex-row gap-1", children: [
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
95
|
+
"label",
|
|
96
|
+
{
|
|
97
|
+
className: cn(
|
|
98
|
+
"text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
99
|
+
className
|
|
100
|
+
),
|
|
101
|
+
...props,
|
|
102
|
+
children: [
|
|
103
|
+
text,
|
|
104
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-red-600", children: "\xA0*" })
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Tooltip, { children: [
|
|
109
|
+
/* @__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" }) }),
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipContent, { className: "max-w-48", children: description })
|
|
111
|
+
] }) })
|
|
112
|
+
] });
|
|
84
113
|
}
|
|
85
114
|
var Label_default = Label;
|
|
86
115
|
|
|
87
116
|
// src/components/ui/Chip.tsx
|
|
88
117
|
var import_cva = require("cva");
|
|
89
118
|
var import_tailwind_merge2 = require("tailwind-merge");
|
|
90
|
-
var
|
|
91
|
-
var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ (0,
|
|
119
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
120
|
+
var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: (0, import_tailwind_merge2.twMerge)(chipVariants({ variant, size, className })), ...props });
|
|
92
121
|
var chipVariants = (0, import_cva.cva)(["flex", "items-center", "rounded-3xl", "border", "w-fit"], {
|
|
93
122
|
variants: {
|
|
94
123
|
variant: {
|
|
@@ -112,9 +141,9 @@ var Chip_default = Chip;
|
|
|
112
141
|
|
|
113
142
|
// src/components/primitives/separator.tsx
|
|
114
143
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
115
|
-
var
|
|
116
|
-
var
|
|
117
|
-
var Separator =
|
|
144
|
+
var React2 = __toESM(require("react"), 1);
|
|
145
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
146
|
+
var Separator = React2.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
118
147
|
SeparatorPrimitive.Root,
|
|
119
148
|
{
|
|
120
149
|
ref,
|
|
@@ -131,9 +160,9 @@ var Separator = React.forwardRef(({ className, orientation = "horizontal", decor
|
|
|
131
160
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
132
161
|
|
|
133
162
|
// src/components/ui/Select.tsx
|
|
134
|
-
var
|
|
163
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
135
164
|
var Select = (0, import_react.forwardRef)(
|
|
136
|
-
({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {
|
|
165
|
+
({ label, options, placeholder, multiselect, description, classNames, error, id, ...props }, ref) => {
|
|
137
166
|
const { value, defaultValue, dir, className, onChange, ...rest } = props;
|
|
138
167
|
const [selected, setSelected] = (0, import_react.useState)([]);
|
|
139
168
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
@@ -163,15 +192,24 @@ var Select = (0, import_react.forwardRef)(
|
|
|
163
192
|
});
|
|
164
193
|
onChange?.(multiselect ? newSelected : newValue);
|
|
165
194
|
}
|
|
166
|
-
return /* @__PURE__ */ (0,
|
|
195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
167
196
|
"div",
|
|
168
197
|
{
|
|
169
|
-
className: cn("flex flex-col
|
|
198
|
+
className: cn("flex w-full flex-col gap-1", className),
|
|
170
199
|
ref: containerRef,
|
|
171
200
|
"data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
|
|
172
201
|
children: [
|
|
173
|
-
/* @__PURE__ */ (0,
|
|
174
|
-
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
203
|
+
Label_default,
|
|
204
|
+
{
|
|
205
|
+
text: label,
|
|
206
|
+
htmlFor: props.name,
|
|
207
|
+
required: props.required,
|
|
208
|
+
description,
|
|
209
|
+
className: classNames?.label
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
175
213
|
SelectPrimitive.Root,
|
|
176
214
|
{
|
|
177
215
|
open,
|
|
@@ -182,16 +220,16 @@ var Select = (0, import_react.forwardRef)(
|
|
|
182
220
|
dir: dir === "rtl" ? "rtl" : "ltr",
|
|
183
221
|
...rest,
|
|
184
222
|
children: [
|
|
185
|
-
/* @__PURE__ */ (0,
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
186
224
|
SelectPrimitive.Trigger,
|
|
187
225
|
{
|
|
188
226
|
ref,
|
|
189
227
|
className: cn(
|
|
190
|
-
"group flex h-11
|
|
228
|
+
"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",
|
|
191
229
|
classNames?.trigger
|
|
192
230
|
),
|
|
193
231
|
children: [
|
|
194
|
-
/* @__PURE__ */ (0,
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "truncate", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
195
233
|
SelectPrimitive.Value,
|
|
196
234
|
{
|
|
197
235
|
placeholder: placeholder ?? "Select an option",
|
|
@@ -199,8 +237,8 @@ var Select = (0, import_react.forwardRef)(
|
|
|
199
237
|
children: handleLabels()
|
|
200
238
|
}
|
|
201
239
|
) }),
|
|
202
|
-
/* @__PURE__ */ (0,
|
|
203
|
-
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
241
|
+
import_lucide_react2.ChevronDownIcon,
|
|
204
242
|
{
|
|
205
243
|
className: "transform text-black group-data-[state=open]:rotate-180",
|
|
206
244
|
size: "16"
|
|
@@ -209,7 +247,7 @@ var Select = (0, import_react.forwardRef)(
|
|
|
209
247
|
]
|
|
210
248
|
}
|
|
211
249
|
),
|
|
212
|
-
/* @__PURE__ */ (0,
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
213
251
|
SelectPrimitive.Content,
|
|
214
252
|
{
|
|
215
253
|
hideWhenDetached: true,
|
|
@@ -218,17 +256,17 @@ var Select = (0, import_react.forwardRef)(
|
|
|
218
256
|
sideOffset: 4,
|
|
219
257
|
onPointerDownOutside: toggleOpen,
|
|
220
258
|
onKeyDown: closeOnEscape,
|
|
221
|
-
children: /* @__PURE__ */ (0,
|
|
222
|
-
multiselect && !!chipLabels?.length && /* @__PURE__ */ (0,
|
|
259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SelectPrimitive.Viewport, { children: [
|
|
260
|
+
multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
223
261
|
SelectPrimitive.Group,
|
|
224
262
|
{
|
|
225
263
|
className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
|
|
226
264
|
"data-testid": "selected-labels",
|
|
227
265
|
children: chipLabels?.map(
|
|
228
|
-
(chip) => chip && /* @__PURE__ */ (0,
|
|
229
|
-
/* @__PURE__ */ (0,
|
|
230
|
-
/* @__PURE__ */ (0,
|
|
231
|
-
|
|
266
|
+
(chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: chip.title }),
|
|
268
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
269
|
+
import_lucide_react2.X,
|
|
232
270
|
{
|
|
233
271
|
size: 18,
|
|
234
272
|
"data-testid": `chip-remove-${chip.value}`,
|
|
@@ -240,8 +278,8 @@ var Select = (0, import_react.forwardRef)(
|
|
|
240
278
|
)
|
|
241
279
|
}
|
|
242
280
|
),
|
|
243
|
-
/* @__PURE__ */ (0,
|
|
244
|
-
options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ (0,
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Separator, {}),
|
|
282
|
+
options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
245
283
|
SelectPrimitive.Item,
|
|
246
284
|
{
|
|
247
285
|
value: value2,
|
|
@@ -250,9 +288,9 @@ var Select = (0, import_react.forwardRef)(
|
|
|
250
288
|
onKeyDown: (e) => setValueOnEnter(e, value2),
|
|
251
289
|
onClick: () => handleChange(value2),
|
|
252
290
|
children: [
|
|
253
|
-
/* @__PURE__ */ (0,
|
|
254
|
-
/* @__PURE__ */ (0,
|
|
255
|
-
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectPrimitive.ItemText, { children: title }),
|
|
292
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
293
|
+
import_lucide_react2.CheckIcon,
|
|
256
294
|
{
|
|
257
295
|
className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
|
|
258
296
|
size: 16
|
|
@@ -268,7 +306,7 @@ var Select = (0, import_react.forwardRef)(
|
|
|
268
306
|
]
|
|
269
307
|
}
|
|
270
308
|
),
|
|
271
|
-
/* @__PURE__ */ (0,
|
|
309
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ErrorMessage_default, { message: error })
|
|
272
310
|
]
|
|
273
311
|
}
|
|
274
312
|
);
|
|
@@ -279,10 +317,10 @@ var Select_default = Select;
|
|
|
279
317
|
|
|
280
318
|
// src/components/ui/Checkbox.tsx
|
|
281
319
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
282
|
-
var
|
|
320
|
+
var import_lucide_react3 = require("lucide-react");
|
|
283
321
|
var import_react2 = require("react");
|
|
284
|
-
var
|
|
285
|
-
var CheckboxToggle = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
322
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
323
|
+
var CheckboxToggle = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
286
324
|
CheckboxPrimitive.Root,
|
|
287
325
|
{
|
|
288
326
|
ref,
|
|
@@ -312,9 +350,9 @@ var CheckboxToggle = (0, import_react2.forwardRef)(({ className, ...props }, ref
|
|
|
312
350
|
className
|
|
313
351
|
),
|
|
314
352
|
...props,
|
|
315
|
-
children: /* @__PURE__ */ (0,
|
|
316
|
-
/* @__PURE__ */ (0,
|
|
317
|
-
/* @__PURE__ */ (0,
|
|
353
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: [
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Check, { className: "hidden h-4 w-4 group-data-[state=checked]:block" }),
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.Minus, { className: "hidden h-4 w-4 group-data-[state=indeterminate]:block" })
|
|
318
356
|
] })
|
|
319
357
|
}
|
|
320
358
|
));
|
|
@@ -324,9 +362,9 @@ var Checkbox = (0, import_react2.forwardRef)(
|
|
|
324
362
|
const { disabled } = props;
|
|
325
363
|
const id = props.id ?? `${props.name ?? props.value?.toString()}-checkbox`;
|
|
326
364
|
const labelClassName = disabled ? "text-grey-40 pointer-events-none" : "";
|
|
327
|
-
return /* @__PURE__ */ (0,
|
|
328
|
-
/* @__PURE__ */ (0,
|
|
329
|
-
/* @__PURE__ */ (0,
|
|
365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("flex space-x-2", classNames?.wrapper), children: [
|
|
366
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CheckboxToggle, { id, disabled, ref, ...props }),
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: id, className: cn(labelClassName, classNames?.label), children })
|
|
330
368
|
] });
|
|
331
369
|
}
|
|
332
370
|
);
|
|
@@ -334,9 +372,9 @@ Checkbox.displayName = "Checkbox";
|
|
|
334
372
|
var Checkbox_default = Checkbox;
|
|
335
373
|
|
|
336
374
|
// src/components/ui/ListItem.tsx
|
|
337
|
-
var import_lucide_react3 = require("lucide-react");
|
|
338
375
|
var import_lucide_react4 = require("lucide-react");
|
|
339
|
-
var
|
|
376
|
+
var import_lucide_react5 = require("lucide-react");
|
|
377
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
340
378
|
function ListItem({
|
|
341
379
|
icon,
|
|
342
380
|
hasCheckbox,
|
|
@@ -348,14 +386,14 @@ function ListItem({
|
|
|
348
386
|
...props
|
|
349
387
|
}) {
|
|
350
388
|
const getIconIfValid = (icon2) => {
|
|
351
|
-
if (icon2 in
|
|
352
|
-
const IconComponent =
|
|
353
|
-
return /* @__PURE__ */ (0,
|
|
389
|
+
if (icon2 in import_lucide_react5.icons) {
|
|
390
|
+
const IconComponent = import_lucide_react5.icons[icon2];
|
|
391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconComponent, { size: 14 });
|
|
354
392
|
}
|
|
355
393
|
return null;
|
|
356
394
|
};
|
|
357
395
|
const optionIcon = icon ? getIconIfValid(icon) : void 0;
|
|
358
|
-
return /* @__PURE__ */ (0,
|
|
396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
359
397
|
"li",
|
|
360
398
|
{
|
|
361
399
|
className: cn(
|
|
@@ -365,14 +403,14 @@ function ListItem({
|
|
|
365
403
|
...props,
|
|
366
404
|
"data-state": isSelected ? "checked" : "unchecked",
|
|
367
405
|
children: [
|
|
368
|
-
optionIcon && /* @__PURE__ */ (0,
|
|
369
|
-
hasCheckbox && /* @__PURE__ */ (0,
|
|
370
|
-
/* @__PURE__ */ (0,
|
|
371
|
-
/* @__PURE__ */ (0,
|
|
372
|
-
/* @__PURE__ */ (0,
|
|
406
|
+
optionIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mr-2", children: optionIcon }),
|
|
407
|
+
hasCheckbox && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Checkbox_default, { id: value, checked: isSelected, onClick: (e) => e.preventDefault() }),
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: title }),
|
|
410
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-grey-80", children: description })
|
|
373
411
|
] }),
|
|
374
|
-
/* @__PURE__ */ (0,
|
|
375
|
-
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
413
|
+
import_lucide_react4.CheckIcon,
|
|
376
414
|
{
|
|
377
415
|
className: "absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",
|
|
378
416
|
size: 16
|
|
@@ -386,29 +424,38 @@ var ListItem_default = ListItem;
|
|
|
386
424
|
|
|
387
425
|
// src/components/ui/Input.tsx
|
|
388
426
|
var import_cva2 = require("cva");
|
|
389
|
-
var
|
|
427
|
+
var import_lucide_react6 = require("lucide-react");
|
|
390
428
|
var import_react3 = require("react");
|
|
391
|
-
var
|
|
429
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
392
430
|
var Input = (0, import_react3.forwardRef)(
|
|
393
|
-
({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
|
|
431
|
+
({ label, error, description, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
|
|
394
432
|
const handleClear = () => {
|
|
395
433
|
onChange?.({ target: { value: "" } });
|
|
396
434
|
onClear?.();
|
|
397
435
|
};
|
|
398
|
-
const IconComponent = icon &&
|
|
436
|
+
const IconComponent = icon && import_lucide_react6.icons[icon];
|
|
399
437
|
const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
|
|
400
438
|
const hasIcon = !!icon;
|
|
401
439
|
const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
|
|
402
|
-
return /* @__PURE__ */ (0,
|
|
403
|
-
label && /* @__PURE__ */ (0,
|
|
404
|
-
|
|
405
|
-
|
|
440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "group flex w-full flex-col gap-1", "data-testid": `input-wrapper-${props.id}`, children: [
|
|
441
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
442
|
+
Label_default,
|
|
443
|
+
{
|
|
444
|
+
text: label,
|
|
445
|
+
htmlFor: props.name,
|
|
446
|
+
required: props.required,
|
|
447
|
+
description,
|
|
448
|
+
className: classNames?.label
|
|
449
|
+
}
|
|
450
|
+
),
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative flex flex-row items-center", children: [
|
|
452
|
+
IconComponent && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
406
453
|
IconComponent,
|
|
407
454
|
{
|
|
408
455
|
className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
|
|
409
456
|
}
|
|
410
457
|
),
|
|
411
|
-
/* @__PURE__ */ (0,
|
|
458
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
412
459
|
"input",
|
|
413
460
|
{
|
|
414
461
|
className: cn(inputVariants({ theme, hasIcon })),
|
|
@@ -420,8 +467,8 @@ var Input = (0, import_react3.forwardRef)(
|
|
|
420
467
|
...props
|
|
421
468
|
}
|
|
422
469
|
),
|
|
423
|
-
hasIcon && value && /* @__PURE__ */ (0,
|
|
424
|
-
|
|
470
|
+
hasIcon && value && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
471
|
+
import_lucide_react6.X,
|
|
425
472
|
{
|
|
426
473
|
className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
|
|
427
474
|
onClick: handleClear,
|
|
@@ -429,7 +476,7 @@ var Input = (0, import_react3.forwardRef)(
|
|
|
429
476
|
}
|
|
430
477
|
)
|
|
431
478
|
] }),
|
|
432
|
-
/* @__PURE__ */ (0,
|
|
479
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ErrorMessage_default, { message: error })
|
|
433
480
|
] });
|
|
434
481
|
}
|
|
435
482
|
);
|
|
@@ -488,11 +535,11 @@ var Input_default = Input;
|
|
|
488
535
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
489
536
|
var import_cva3 = require("cva");
|
|
490
537
|
var import_react4 = require("react");
|
|
491
|
-
var
|
|
538
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
492
539
|
var Button = (0, import_react4.forwardRef)(
|
|
493
540
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
494
541
|
const Component = asChild ? import_react_slot.Slot : "button";
|
|
495
|
-
return /* @__PURE__ */ (0,
|
|
542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
496
543
|
Component,
|
|
497
544
|
{
|
|
498
545
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -595,21 +642,21 @@ var buttonVariants = (0, import_cva3.cva)(
|
|
|
595
642
|
|
|
596
643
|
// src/components/ui/Combobox.tsx
|
|
597
644
|
var import_react5 = require("react");
|
|
598
|
-
var
|
|
645
|
+
var import_lucide_react9 = require("lucide-react");
|
|
599
646
|
var import_cva5 = require("cva");
|
|
600
647
|
|
|
601
648
|
// src/components/primitives/command.tsx
|
|
602
649
|
var import_cmdk = require("cmdk");
|
|
603
|
-
var
|
|
604
|
-
var
|
|
650
|
+
var import_lucide_react8 = require("lucide-react");
|
|
651
|
+
var React5 = __toESM(require("react"), 1);
|
|
605
652
|
|
|
606
653
|
// src/components/primitives/dialog.tsx
|
|
607
654
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
608
|
-
var
|
|
609
|
-
var
|
|
610
|
-
var
|
|
655
|
+
var import_lucide_react7 = require("lucide-react");
|
|
656
|
+
var React4 = __toESM(require("react"), 1);
|
|
657
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
611
658
|
var DialogPortal = DialogPrimitive.Portal;
|
|
612
|
-
var DialogOverlay =
|
|
659
|
+
var DialogOverlay = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
613
660
|
DialogPrimitive.Overlay,
|
|
614
661
|
{
|
|
615
662
|
ref,
|
|
@@ -621,9 +668,9 @@ var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
621
668
|
}
|
|
622
669
|
));
|
|
623
670
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
624
|
-
var DialogContent =
|
|
625
|
-
/* @__PURE__ */ (0,
|
|
626
|
-
/* @__PURE__ */ (0,
|
|
671
|
+
var DialogContent = React4.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(DialogPortal, { children: [
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogOverlay, {}),
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
627
674
|
DialogPrimitive.Content,
|
|
628
675
|
{
|
|
629
676
|
ref,
|
|
@@ -634,18 +681,18 @@ var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) =
|
|
|
634
681
|
...props,
|
|
635
682
|
children: [
|
|
636
683
|
children,
|
|
637
|
-
/* @__PURE__ */ (0,
|
|
638
|
-
/* @__PURE__ */ (0,
|
|
639
|
-
/* @__PURE__ */ (0,
|
|
684
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.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: [
|
|
685
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.X, { className: "h-4 w-4" }),
|
|
686
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Close" })
|
|
640
687
|
] })
|
|
641
688
|
]
|
|
642
689
|
}
|
|
643
690
|
)
|
|
644
691
|
] }));
|
|
645
692
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
646
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
693
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
647
694
|
DialogHeader.displayName = "DialogHeader";
|
|
648
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
695
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
649
696
|
"div",
|
|
650
697
|
{
|
|
651
698
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -653,7 +700,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
653
700
|
}
|
|
654
701
|
);
|
|
655
702
|
DialogFooter.displayName = "DialogFooter";
|
|
656
|
-
var DialogTitle =
|
|
703
|
+
var DialogTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
657
704
|
DialogPrimitive.Title,
|
|
658
705
|
{
|
|
659
706
|
ref,
|
|
@@ -662,7 +709,7 @@ var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
662
709
|
}
|
|
663
710
|
));
|
|
664
711
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
665
|
-
var DialogDescription =
|
|
712
|
+
var DialogDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
666
713
|
DialogPrimitive.Description,
|
|
667
714
|
{
|
|
668
715
|
ref,
|
|
@@ -673,8 +720,8 @@ var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
673
720
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
674
721
|
|
|
675
722
|
// src/components/primitives/command.tsx
|
|
676
|
-
var
|
|
677
|
-
var Command =
|
|
723
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
724
|
+
var Command = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
678
725
|
import_cmdk.Command,
|
|
679
726
|
{
|
|
680
727
|
ref,
|
|
@@ -686,9 +733,9 @@ var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
686
733
|
}
|
|
687
734
|
));
|
|
688
735
|
Command.displayName = import_cmdk.Command.displayName;
|
|
689
|
-
var CommandInput =
|
|
690
|
-
/* @__PURE__ */ (0,
|
|
691
|
-
/* @__PURE__ */ (0,
|
|
736
|
+
var CommandInput = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "m-1 flex items-center rounded-xl border px-3", "cmdk-input-wrapper": "", children: [
|
|
737
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
692
739
|
import_cmdk.Command.Input,
|
|
693
740
|
{
|
|
694
741
|
ref,
|
|
@@ -701,7 +748,7 @@ var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
701
748
|
)
|
|
702
749
|
] }));
|
|
703
750
|
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
704
|
-
var CommandList =
|
|
751
|
+
var CommandList = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
705
752
|
import_cmdk.Command.List,
|
|
706
753
|
{
|
|
707
754
|
ref,
|
|
@@ -710,9 +757,9 @@ var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
710
757
|
}
|
|
711
758
|
));
|
|
712
759
|
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
713
|
-
var CommandEmpty =
|
|
760
|
+
var CommandEmpty = React5.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_cmdk.Command.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
714
761
|
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
715
|
-
var CommandGroup =
|
|
762
|
+
var CommandGroup = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
716
763
|
import_cmdk.Command.Group,
|
|
717
764
|
{
|
|
718
765
|
ref,
|
|
@@ -724,7 +771,7 @@ var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
724
771
|
}
|
|
725
772
|
));
|
|
726
773
|
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
727
|
-
var CommandSeparator =
|
|
774
|
+
var CommandSeparator = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
728
775
|
import_cmdk.Command.Separator,
|
|
729
776
|
{
|
|
730
777
|
ref,
|
|
@@ -733,7 +780,7 @@ var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
733
780
|
}
|
|
734
781
|
));
|
|
735
782
|
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
736
|
-
var CommandItem =
|
|
783
|
+
var CommandItem = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
737
784
|
import_cmdk.Command.Item,
|
|
738
785
|
{
|
|
739
786
|
ref,
|
|
@@ -746,7 +793,7 @@ var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
746
793
|
));
|
|
747
794
|
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
748
795
|
var CommandShortcut = ({ className, ...props }) => {
|
|
749
|
-
return /* @__PURE__ */ (0,
|
|
796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
750
797
|
"span",
|
|
751
798
|
{
|
|
752
799
|
className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
|
|
@@ -757,12 +804,12 @@ var CommandShortcut = ({ className, ...props }) => {
|
|
|
757
804
|
CommandShortcut.displayName = "CommandShortcut";
|
|
758
805
|
|
|
759
806
|
// src/components/primitives/popover.tsx
|
|
760
|
-
var
|
|
807
|
+
var React6 = __toESM(require("react"), 1);
|
|
761
808
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
762
|
-
var
|
|
809
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
763
810
|
var Popover = PopoverPrimitive.Root;
|
|
764
811
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
765
|
-
var PopoverContent =
|
|
812
|
+
var PopoverContent = React6.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
766
813
|
PopoverPrimitive.Content,
|
|
767
814
|
{
|
|
768
815
|
ref,
|
|
@@ -779,7 +826,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
779
826
|
|
|
780
827
|
// src/components/ui/Badge.tsx
|
|
781
828
|
var import_cva4 = require("cva");
|
|
782
|
-
var
|
|
829
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
783
830
|
var badgeVariants = (0, import_cva4.cva)("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
784
831
|
variants: {
|
|
785
832
|
variant: {
|
|
@@ -793,16 +840,20 @@ var badgeVariants = (0, import_cva4.cva)("rounded-full px-2 py-0.5 text-xs font-
|
|
|
793
840
|
}
|
|
794
841
|
});
|
|
795
842
|
function Badge({ className, variant, ...props }) {
|
|
796
|
-
return /* @__PURE__ */ (0,
|
|
843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
797
844
|
}
|
|
798
845
|
|
|
799
846
|
// src/components/ui/Combobox.tsx
|
|
800
|
-
var
|
|
847
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
801
848
|
var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
802
849
|
const {
|
|
850
|
+
id,
|
|
851
|
+
name,
|
|
803
852
|
value,
|
|
804
853
|
label,
|
|
805
854
|
options,
|
|
855
|
+
required,
|
|
856
|
+
description,
|
|
806
857
|
classNames,
|
|
807
858
|
multiselect,
|
|
808
859
|
placeholder,
|
|
@@ -815,7 +866,7 @@ var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
815
866
|
} = props;
|
|
816
867
|
const [selected, setSelected] = (0, import_react5.useState)([]);
|
|
817
868
|
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
818
|
-
const IconComponent = icon &&
|
|
869
|
+
const IconComponent = icon && import_lucide_react9.icons[icon];
|
|
819
870
|
const hideSearchBox = options?.length <= 5;
|
|
820
871
|
const isDefault = variant === "default";
|
|
821
872
|
const isChip = variant === "chip";
|
|
@@ -850,17 +901,26 @@ var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
850
901
|
const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
|
|
851
902
|
return isDefault ? defaultLabel : label;
|
|
852
903
|
};
|
|
853
|
-
return /* @__PURE__ */ (0,
|
|
854
|
-
isDefault &&
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("flex flex-col gap-1", className), children: [
|
|
905
|
+
isDefault && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
906
|
+
Label_default,
|
|
907
|
+
{
|
|
908
|
+
text: label,
|
|
909
|
+
htmlFor: name,
|
|
910
|
+
required,
|
|
911
|
+
description,
|
|
912
|
+
className: classNames?.label
|
|
913
|
+
}
|
|
914
|
+
),
|
|
915
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative flex", children: [
|
|
916
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
858
918
|
PopoverTrigger,
|
|
859
919
|
{
|
|
860
920
|
asChild: true,
|
|
861
921
|
disabled: options.length === 0,
|
|
862
|
-
"data-testid": `${
|
|
863
|
-
children: /* @__PURE__ */ (0,
|
|
922
|
+
"data-testid": `${id ?? name}-combobox-trigger`,
|
|
923
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
864
924
|
"div",
|
|
865
925
|
{
|
|
866
926
|
ref,
|
|
@@ -871,9 +931,9 @@ var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
871
931
|
),
|
|
872
932
|
"aria-expanded": open,
|
|
873
933
|
children: [
|
|
874
|
-
isDefault && IconComponent && /* @__PURE__ */ (0,
|
|
875
|
-
isChip && !isEmpty && /* @__PURE__ */ (0,
|
|
876
|
-
/* @__PURE__ */ (0,
|
|
934
|
+
isDefault && IconComponent && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IconComponent, { className: "h-4 w-4 shrink-0" }),
|
|
935
|
+
isChip && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Badge, { variant: "purple", children: selected.length }),
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
877
937
|
"span",
|
|
878
938
|
{
|
|
879
939
|
className: cn(
|
|
@@ -883,8 +943,8 @@ var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
883
943
|
children: handleDisplayValue()
|
|
884
944
|
}
|
|
885
945
|
),
|
|
886
|
-
showChevron && /* @__PURE__ */ (0,
|
|
887
|
-
|
|
946
|
+
showChevron && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
947
|
+
import_lucide_react9.ChevronDownIcon,
|
|
888
948
|
{
|
|
889
949
|
className: "shrink-0 transform group-data-[state=open]:rotate-180",
|
|
890
950
|
size: "16"
|
|
@@ -895,7 +955,7 @@ var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
895
955
|
)
|
|
896
956
|
}
|
|
897
957
|
),
|
|
898
|
-
/* @__PURE__ */ (0,
|
|
958
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
899
959
|
PopoverContent,
|
|
900
960
|
{
|
|
901
961
|
className: cn(
|
|
@@ -906,16 +966,16 @@ var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
906
966
|
collisionPadding: 8,
|
|
907
967
|
sideOffset: 4,
|
|
908
968
|
align: "start",
|
|
909
|
-
children: /* @__PURE__ */ (0,
|
|
910
|
-
!hideSearchBox && /* @__PURE__ */ (0,
|
|
911
|
-
/* @__PURE__ */ (0,
|
|
912
|
-
/* @__PURE__ */ (0,
|
|
913
|
-
/* @__PURE__ */ (0,
|
|
969
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Command, { children: [
|
|
970
|
+
!hideSearchBox && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommandInput, { placeholder: "Search..." }),
|
|
971
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(CommandList, { children: [
|
|
972
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommandEmpty, { children: "No results" }),
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommandGroup, { children: options.map(({ id: id2, ...option }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
914
974
|
CommandItem,
|
|
915
975
|
{
|
|
916
976
|
value: option.title,
|
|
917
977
|
onSelect: () => handleSelect(option.value),
|
|
918
|
-
children: /* @__PURE__ */ (0,
|
|
978
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
919
979
|
ListItem_default,
|
|
920
980
|
{
|
|
921
981
|
className: cn(classNames?.items, "truncate py-1"),
|
|
@@ -925,22 +985,22 @@ var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
925
985
|
}
|
|
926
986
|
)
|
|
927
987
|
},
|
|
928
|
-
|
|
988
|
+
id2
|
|
929
989
|
)) })
|
|
930
990
|
] }),
|
|
931
|
-
!!footer && /* @__PURE__ */ (0,
|
|
991
|
+
!!footer && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Separator, {}),
|
|
932
992
|
footer && footer({ close })
|
|
933
993
|
] })
|
|
934
994
|
}
|
|
935
995
|
)
|
|
936
996
|
] }),
|
|
937
|
-
isDefault && !isEmpty && /* @__PURE__ */ (0,
|
|
997
|
+
isDefault && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
938
998
|
"button",
|
|
939
999
|
{
|
|
940
1000
|
type: "button",
|
|
941
1001
|
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",
|
|
942
1002
|
onClick: handleClear,
|
|
943
|
-
children: /* @__PURE__ */ (0,
|
|
1003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react9.CircleX, { className: "h-4 w-4 text-green-100" })
|
|
944
1004
|
}
|
|
945
1005
|
)
|
|
946
1006
|
] })
|
|
@@ -972,6 +1032,149 @@ var triggerVariants = (0, import_cva5.cva)(
|
|
|
972
1032
|
}
|
|
973
1033
|
}
|
|
974
1034
|
);
|
|
1035
|
+
|
|
1036
|
+
// src/components/ui/Counter.tsx
|
|
1037
|
+
var import_cva6 = require("cva");
|
|
1038
|
+
var import_lucide_react10 = require("lucide-react");
|
|
1039
|
+
var import_react6 = require("react");
|
|
1040
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1041
|
+
var Counter = (0, import_react6.forwardRef)(
|
|
1042
|
+
({ label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props }, ref) => {
|
|
1043
|
+
const [count, setCount] = (0, import_react6.useState)(0);
|
|
1044
|
+
(0, import_react6.useEffect)(() => {
|
|
1045
|
+
setCount(value ?? 0);
|
|
1046
|
+
}, [value]);
|
|
1047
|
+
const handleChange = (e) => {
|
|
1048
|
+
const newValue = parseInt(e.target.value.replace(/\D/g, ""), 10);
|
|
1049
|
+
if (isNaN(newValue)) return;
|
|
1050
|
+
if (min && newValue < min) {
|
|
1051
|
+
onChange?.(min);
|
|
1052
|
+
setCount(min);
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
if (max && newValue > max) {
|
|
1056
|
+
onChange?.(max);
|
|
1057
|
+
setCount(max);
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
onChange?.(newValue);
|
|
1061
|
+
setCount(newValue);
|
|
1062
|
+
};
|
|
1063
|
+
const decrement = () => {
|
|
1064
|
+
const proposedValue = count - step;
|
|
1065
|
+
const newValue = Math.max(min ?? -Infinity, proposedValue);
|
|
1066
|
+
onChange?.(newValue);
|
|
1067
|
+
setCount(newValue);
|
|
1068
|
+
};
|
|
1069
|
+
const increment = () => {
|
|
1070
|
+
const proposedValue = count + step;
|
|
1071
|
+
const newValue = Math.min(max ?? Infinity, proposedValue);
|
|
1072
|
+
onChange?.(newValue);
|
|
1073
|
+
setCount(newValue);
|
|
1074
|
+
};
|
|
1075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1076
|
+
"div",
|
|
1077
|
+
{
|
|
1078
|
+
className: cn("flex w-auto flex-col gap-1", classNames?.root),
|
|
1079
|
+
"data-testid": `counter-wrapper-${props.id}`,
|
|
1080
|
+
children: [
|
|
1081
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1082
|
+
Label_default,
|
|
1083
|
+
{
|
|
1084
|
+
text: label,
|
|
1085
|
+
htmlFor: props.name,
|
|
1086
|
+
required: props.required,
|
|
1087
|
+
description,
|
|
1088
|
+
className: classNames?.label
|
|
1089
|
+
}
|
|
1090
|
+
),
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative flex w-[122px] flex-row items-center", children: [
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1093
|
+
"button",
|
|
1094
|
+
{
|
|
1095
|
+
type: "button",
|
|
1096
|
+
className: "absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
|
|
1097
|
+
onClick: decrement,
|
|
1098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Minus, { className: "h-4 w-4 text-green-100" })
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1102
|
+
"input",
|
|
1103
|
+
{
|
|
1104
|
+
className: cn(counterVariants({ theme }), classNames?.input),
|
|
1105
|
+
ref,
|
|
1106
|
+
value: count,
|
|
1107
|
+
onChange: handleChange,
|
|
1108
|
+
"data-testid": `counter-element-${props.id}`,
|
|
1109
|
+
...props
|
|
1110
|
+
}
|
|
1111
|
+
),
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1113
|
+
"button",
|
|
1114
|
+
{
|
|
1115
|
+
type: "button",
|
|
1116
|
+
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",
|
|
1117
|
+
onClick: increment,
|
|
1118
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4 text-green-100" })
|
|
1119
|
+
}
|
|
1120
|
+
)
|
|
1121
|
+
] }),
|
|
1122
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ErrorMessage_default, { message: error })
|
|
1123
|
+
]
|
|
1124
|
+
}
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1127
|
+
);
|
|
1128
|
+
Counter.displayName = "Counter";
|
|
1129
|
+
var counterVariants = (0, import_cva6.cva)(
|
|
1130
|
+
[
|
|
1131
|
+
"border-input",
|
|
1132
|
+
"placeholder:text-muted-foreground",
|
|
1133
|
+
"focus-visible:ring-ring",
|
|
1134
|
+
"inline-flex",
|
|
1135
|
+
"w-[122px]",
|
|
1136
|
+
"h-11",
|
|
1137
|
+
"items-center",
|
|
1138
|
+
"justify-start",
|
|
1139
|
+
"gap-3",
|
|
1140
|
+
"rounded-lg",
|
|
1141
|
+
"bg-transparent",
|
|
1142
|
+
"px-3",
|
|
1143
|
+
"pt-0.5",
|
|
1144
|
+
"text-sm",
|
|
1145
|
+
"text-center",
|
|
1146
|
+
"shadow-sm",
|
|
1147
|
+
"ring-grey-50",
|
|
1148
|
+
"transition-colors",
|
|
1149
|
+
"focus-visible:outline-none",
|
|
1150
|
+
"focus-visible:ring-1",
|
|
1151
|
+
"disabled:cursor-not-allowed",
|
|
1152
|
+
"disabled:opacity-50",
|
|
1153
|
+
"appearance-none",
|
|
1154
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
1155
|
+
"[&::-webkit-search-decoration]:appearance-none",
|
|
1156
|
+
"[&::-webkit-search-results-button]:appearance-none",
|
|
1157
|
+
"[&::-webkit-search-results-decoration]:appearance-none",
|
|
1158
|
+
"[&::-ms-clear]:display-none",
|
|
1159
|
+
"[&::-ms-reveal]:display-none"
|
|
1160
|
+
],
|
|
1161
|
+
{
|
|
1162
|
+
variants: {
|
|
1163
|
+
theme: {
|
|
1164
|
+
light: "text-grey-80 border",
|
|
1165
|
+
dark: "text-white"
|
|
1166
|
+
},
|
|
1167
|
+
hasIcon: {
|
|
1168
|
+
false: "pl-3",
|
|
1169
|
+
true: "pl-8"
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
defaultVariants: {
|
|
1173
|
+
theme: "light",
|
|
1174
|
+
hasIcon: false
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
);
|
|
975
1178
|
// Annotate the CommonJS export names for ESM import in node:
|
|
976
1179
|
0 && (module.exports = {
|
|
977
1180
|
Badge,
|
|
@@ -979,6 +1182,7 @@ var triggerVariants = (0, import_cva5.cva)(
|
|
|
979
1182
|
Checkbox,
|
|
980
1183
|
Chip,
|
|
981
1184
|
Combobox,
|
|
1185
|
+
Counter,
|
|
982
1186
|
Input,
|
|
983
1187
|
Label,
|
|
984
1188
|
ListItem,
|