@next-degree/pickle-shared-js 0.3.23 → 0.3.25
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 +84 -0
- package/dist/app/layout.css.map +1 -1
- package/dist/app/page.cjs +127 -9
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +148 -30
- package/dist/app/page.js.map +1 -1
- package/dist/components/demos/ComboboxDemo.cjs +6 -3
- package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
- package/dist/components/demos/ComboboxDemo.js +17 -14
- package/dist/components/demos/ComboboxDemo.js.map +1 -1
- package/dist/components/demos/InputDemo.cjs +178 -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 +155 -0
- package/dist/components/demos/InputDemo.js.map +1 -0
- package/dist/components/demos/SelectDemo.cjs +6 -3
- package/dist/components/demos/SelectDemo.cjs.map +1 -1
- package/dist/components/demos/SelectDemo.js +17 -14
- package/dist/components/demos/SelectDemo.js.map +1 -1
- package/dist/components/demos/index.cjs +125 -7
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +146 -28
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/ui/Combobox.cjs +6 -3
- package/dist/components/ui/Combobox.cjs.map +1 -1
- package/dist/components/ui/Combobox.js +14 -11
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/components/ui/Input.cjs +162 -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 +141 -0
- package/dist/components/ui/Input.js.map +1 -0
- package/dist/components/ui/Label.cjs +6 -3
- 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 +7 -4
- package/dist/components/ui/Label.js.map +1 -1
- package/dist/components/ui/Select.cjs +6 -3
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.js +14 -11
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/index.cjs +175 -70
- 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 +184 -80
- package/dist/index.js.map +1 -1
- package/dist/styles/globals.css +84 -0
- 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,
|
|
@@ -64,9 +65,9 @@ var ErrorMessage_default = ErrorMessage;
|
|
|
64
65
|
|
|
65
66
|
// src/components/ui/Label.tsx
|
|
66
67
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
67
|
-
function Label({ text, className, ...props }) {
|
|
68
|
+
function Label({ text, required, className, ...props }) {
|
|
68
69
|
if (!text) return null;
|
|
69
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
70
71
|
"label",
|
|
71
72
|
{
|
|
72
73
|
className: cn(
|
|
@@ -74,7 +75,10 @@ function Label({ text, className, ...props }) {
|
|
|
74
75
|
className
|
|
75
76
|
),
|
|
76
77
|
...props,
|
|
77
|
-
children:
|
|
78
|
+
children: [
|
|
79
|
+
text,
|
|
80
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-red-600", children: "\xA0*" })
|
|
81
|
+
]
|
|
78
82
|
}
|
|
79
83
|
);
|
|
80
84
|
}
|
|
@@ -380,15 +384,115 @@ function ListItem({
|
|
|
380
384
|
}
|
|
381
385
|
var ListItem_default = ListItem;
|
|
382
386
|
|
|
383
|
-
// src/components/ui/
|
|
384
|
-
var import_react_slot = require("@radix-ui/react-slot");
|
|
387
|
+
// src/components/ui/Input.tsx
|
|
385
388
|
var import_cva2 = require("cva");
|
|
389
|
+
var import_lucide_react5 = require("lucide-react");
|
|
386
390
|
var import_react3 = require("react");
|
|
387
391
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
388
|
-
var
|
|
392
|
+
var Input = (0, import_react3.forwardRef)(
|
|
393
|
+
({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
|
|
394
|
+
const handleClear = () => {
|
|
395
|
+
onChange?.({ target: { value: "" } });
|
|
396
|
+
onClear?.();
|
|
397
|
+
};
|
|
398
|
+
const IconComponent = icon && import_lucide_react5.icons[icon];
|
|
399
|
+
const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
|
|
400
|
+
const hasIcon = !!icon;
|
|
401
|
+
const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
|
|
402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "group flex w-full flex-col", "data-testid": `input-wrapper-${props.id}`, children: [
|
|
403
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label_default, { text: label, htmlFor: props.name, className: cn("body mb-1", classNames?.label) }),
|
|
404
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative flex flex-row items-center", children: [
|
|
405
|
+
IconComponent && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
406
|
+
IconComponent,
|
|
407
|
+
{
|
|
408
|
+
className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
412
|
+
"input",
|
|
413
|
+
{
|
|
414
|
+
className: cn(inputVariants({ theme, hasIcon })),
|
|
415
|
+
ref,
|
|
416
|
+
placeholder,
|
|
417
|
+
value,
|
|
418
|
+
onChange,
|
|
419
|
+
"data-testid": `input-element-${props.id}`,
|
|
420
|
+
...props
|
|
421
|
+
}
|
|
422
|
+
),
|
|
423
|
+
hasIcon && value && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
424
|
+
import_lucide_react5.X,
|
|
425
|
+
{
|
|
426
|
+
className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
|
|
427
|
+
onClick: handleClear,
|
|
428
|
+
"data-testid": "clear-button"
|
|
429
|
+
}
|
|
430
|
+
)
|
|
431
|
+
] }),
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ErrorMessage_default, { message: error, className: "mt-1" })
|
|
433
|
+
] });
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
Input.displayName = "Input";
|
|
437
|
+
var inputVariants = (0, import_cva2.cva)(
|
|
438
|
+
[
|
|
439
|
+
"border-input",
|
|
440
|
+
"placeholder:text-muted-foreground",
|
|
441
|
+
"focus-visible:ring-ring",
|
|
442
|
+
"inline-flex",
|
|
443
|
+
"w-full",
|
|
444
|
+
"h-11",
|
|
445
|
+
"items-center",
|
|
446
|
+
"justify-start",
|
|
447
|
+
"gap-3",
|
|
448
|
+
"rounded-lg",
|
|
449
|
+
"bg-transparent",
|
|
450
|
+
"px-3",
|
|
451
|
+
"pt-0.5",
|
|
452
|
+
"text-sm",
|
|
453
|
+
"shadow-sm",
|
|
454
|
+
"ring-grey-50",
|
|
455
|
+
"transition-colors",
|
|
456
|
+
"focus-visible:outline-none",
|
|
457
|
+
"focus-visible:ring-1",
|
|
458
|
+
"disabled:cursor-not-allowed",
|
|
459
|
+
"disabled:opacity-50",
|
|
460
|
+
"appearance-none",
|
|
461
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
462
|
+
"[&::-webkit-search-decoration]:appearance-none",
|
|
463
|
+
"[&::-webkit-search-results-button]:appearance-none",
|
|
464
|
+
"[&::-webkit-search-results-decoration]:appearance-none",
|
|
465
|
+
"[&::-ms-clear]:display-none",
|
|
466
|
+
"[&::-ms-reveal]:display-none"
|
|
467
|
+
],
|
|
468
|
+
{
|
|
469
|
+
variants: {
|
|
470
|
+
theme: {
|
|
471
|
+
light: "text-grey-80 border",
|
|
472
|
+
dark: "text-white"
|
|
473
|
+
},
|
|
474
|
+
hasIcon: {
|
|
475
|
+
false: "pl-3",
|
|
476
|
+
true: "pl-8"
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
defaultVariants: {
|
|
480
|
+
theme: "light",
|
|
481
|
+
hasIcon: false
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
);
|
|
485
|
+
var Input_default = Input;
|
|
486
|
+
|
|
487
|
+
// src/components/ui/Button.tsx
|
|
488
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
489
|
+
var import_cva3 = require("cva");
|
|
490
|
+
var import_react4 = require("react");
|
|
491
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
492
|
+
var Button = (0, import_react4.forwardRef)(
|
|
389
493
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
390
494
|
const Component = asChild ? import_react_slot.Slot : "button";
|
|
391
|
-
return /* @__PURE__ */ (0,
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
392
496
|
Component,
|
|
393
497
|
{
|
|
394
498
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -399,7 +503,7 @@ var Button = (0, import_react3.forwardRef)(
|
|
|
399
503
|
}
|
|
400
504
|
);
|
|
401
505
|
Button.displayName = "Button";
|
|
402
|
-
var buttonVariants = (0,
|
|
506
|
+
var buttonVariants = (0, import_cva3.cva)(
|
|
403
507
|
[
|
|
404
508
|
"flex",
|
|
405
509
|
"items-center",
|
|
@@ -490,22 +594,22 @@ var buttonVariants = (0, import_cva2.cva)(
|
|
|
490
594
|
);
|
|
491
595
|
|
|
492
596
|
// src/components/ui/Combobox.tsx
|
|
493
|
-
var
|
|
494
|
-
var
|
|
495
|
-
var
|
|
597
|
+
var import_react5 = require("react");
|
|
598
|
+
var import_lucide_react8 = require("lucide-react");
|
|
599
|
+
var import_cva5 = require("cva");
|
|
496
600
|
|
|
497
601
|
// src/components/primitives/command.tsx
|
|
498
602
|
var import_cmdk = require("cmdk");
|
|
499
|
-
var
|
|
603
|
+
var import_lucide_react7 = require("lucide-react");
|
|
500
604
|
var React4 = __toESM(require("react"), 1);
|
|
501
605
|
|
|
502
606
|
// src/components/primitives/dialog.tsx
|
|
503
607
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
504
|
-
var
|
|
608
|
+
var import_lucide_react6 = require("lucide-react");
|
|
505
609
|
var React3 = __toESM(require("react"), 1);
|
|
506
|
-
var
|
|
610
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
507
611
|
var DialogPortal = DialogPrimitive.Portal;
|
|
508
|
-
var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
612
|
+
var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
509
613
|
DialogPrimitive.Overlay,
|
|
510
614
|
{
|
|
511
615
|
ref,
|
|
@@ -517,9 +621,9 @@ var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
517
621
|
}
|
|
518
622
|
));
|
|
519
623
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
520
|
-
var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
521
|
-
/* @__PURE__ */ (0,
|
|
522
|
-
/* @__PURE__ */ (0,
|
|
624
|
+
var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogPortal, { children: [
|
|
625
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogOverlay, {}),
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
523
627
|
DialogPrimitive.Content,
|
|
524
628
|
{
|
|
525
629
|
ref,
|
|
@@ -530,18 +634,18 @@ var DialogContent = React3.forwardRef(({ className, children, ...props }, ref) =
|
|
|
530
634
|
...props,
|
|
531
635
|
children: [
|
|
532
636
|
children,
|
|
533
|
-
/* @__PURE__ */ (0,
|
|
534
|
-
/* @__PURE__ */ (0,
|
|
535
|
-
/* @__PURE__ */ (0,
|
|
637
|
+
/* @__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: [
|
|
638
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.X, { className: "h-4 w-4" }),
|
|
639
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: "Close" })
|
|
536
640
|
] })
|
|
537
641
|
]
|
|
538
642
|
}
|
|
539
643
|
)
|
|
540
644
|
] }));
|
|
541
645
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
542
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
646
|
+
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 });
|
|
543
647
|
DialogHeader.displayName = "DialogHeader";
|
|
544
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
648
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
545
649
|
"div",
|
|
546
650
|
{
|
|
547
651
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -549,7 +653,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
549
653
|
}
|
|
550
654
|
);
|
|
551
655
|
DialogFooter.displayName = "DialogFooter";
|
|
552
|
-
var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
656
|
+
var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
553
657
|
DialogPrimitive.Title,
|
|
554
658
|
{
|
|
555
659
|
ref,
|
|
@@ -558,7 +662,7 @@ var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
558
662
|
}
|
|
559
663
|
));
|
|
560
664
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
561
|
-
var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
665
|
+
var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
562
666
|
DialogPrimitive.Description,
|
|
563
667
|
{
|
|
564
668
|
ref,
|
|
@@ -569,8 +673,8 @@ var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
569
673
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
570
674
|
|
|
571
675
|
// src/components/primitives/command.tsx
|
|
572
|
-
var
|
|
573
|
-
var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
676
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
677
|
+
var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
574
678
|
import_cmdk.Command,
|
|
575
679
|
{
|
|
576
680
|
ref,
|
|
@@ -582,9 +686,9 @@ var Command = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
582
686
|
}
|
|
583
687
|
));
|
|
584
688
|
Command.displayName = import_cmdk.Command.displayName;
|
|
585
|
-
var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
586
|
-
/* @__PURE__ */ (0,
|
|
587
|
-
/* @__PURE__ */ (0,
|
|
689
|
+
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: [
|
|
690
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
691
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
588
692
|
import_cmdk.Command.Input,
|
|
589
693
|
{
|
|
590
694
|
ref,
|
|
@@ -597,7 +701,7 @@ var CommandInput = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
597
701
|
)
|
|
598
702
|
] }));
|
|
599
703
|
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
600
|
-
var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
704
|
+
var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
601
705
|
import_cmdk.Command.List,
|
|
602
706
|
{
|
|
603
707
|
ref,
|
|
@@ -606,9 +710,9 @@ var CommandList = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
606
710
|
}
|
|
607
711
|
));
|
|
608
712
|
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
609
|
-
var CommandEmpty = React4.forwardRef((props, ref) => /* @__PURE__ */ (0,
|
|
713
|
+
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 }));
|
|
610
714
|
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
611
|
-
var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
715
|
+
var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
612
716
|
import_cmdk.Command.Group,
|
|
613
717
|
{
|
|
614
718
|
ref,
|
|
@@ -620,7 +724,7 @@ var CommandGroup = React4.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
620
724
|
}
|
|
621
725
|
));
|
|
622
726
|
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
623
|
-
var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
727
|
+
var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
624
728
|
import_cmdk.Command.Separator,
|
|
625
729
|
{
|
|
626
730
|
ref,
|
|
@@ -629,7 +733,7 @@ var CommandSeparator = React4.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
629
733
|
}
|
|
630
734
|
));
|
|
631
735
|
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
632
|
-
var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
736
|
+
var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
633
737
|
import_cmdk.Command.Item,
|
|
634
738
|
{
|
|
635
739
|
ref,
|
|
@@ -642,7 +746,7 @@ var CommandItem = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
642
746
|
));
|
|
643
747
|
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
644
748
|
var CommandShortcut = ({ className, ...props }) => {
|
|
645
|
-
return /* @__PURE__ */ (0,
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
646
750
|
"span",
|
|
647
751
|
{
|
|
648
752
|
className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
|
|
@@ -655,10 +759,10 @@ CommandShortcut.displayName = "CommandShortcut";
|
|
|
655
759
|
// src/components/primitives/popover.tsx
|
|
656
760
|
var React5 = __toESM(require("react"), 1);
|
|
657
761
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
658
|
-
var
|
|
762
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
659
763
|
var Popover = PopoverPrimitive.Root;
|
|
660
764
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
661
|
-
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0,
|
|
765
|
+
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)(
|
|
662
766
|
PopoverPrimitive.Content,
|
|
663
767
|
{
|
|
664
768
|
ref,
|
|
@@ -674,9 +778,9 @@ var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffse
|
|
|
674
778
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
675
779
|
|
|
676
780
|
// src/components/ui/Badge.tsx
|
|
677
|
-
var
|
|
678
|
-
var
|
|
679
|
-
var badgeVariants = (0,
|
|
781
|
+
var import_cva4 = require("cva");
|
|
782
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
783
|
+
var badgeVariants = (0, import_cva4.cva)("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
680
784
|
variants: {
|
|
681
785
|
variant: {
|
|
682
786
|
green: "bg-green-90 text-white",
|
|
@@ -689,12 +793,12 @@ var badgeVariants = (0, import_cva3.cva)("rounded-full px-2 py-0.5 text-xs font-
|
|
|
689
793
|
}
|
|
690
794
|
});
|
|
691
795
|
function Badge({ className, variant, ...props }) {
|
|
692
|
-
return /* @__PURE__ */ (0,
|
|
796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
693
797
|
}
|
|
694
798
|
|
|
695
799
|
// src/components/ui/Combobox.tsx
|
|
696
|
-
var
|
|
697
|
-
var Combobox = (0,
|
|
800
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
801
|
+
var Combobox = (0, import_react5.forwardRef)((props, ref) => {
|
|
698
802
|
const {
|
|
699
803
|
value,
|
|
700
804
|
label,
|
|
@@ -709,16 +813,16 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
709
813
|
onChange: handleChange,
|
|
710
814
|
children: footer
|
|
711
815
|
} = props;
|
|
712
|
-
const [selected, setSelected] = (0,
|
|
713
|
-
const [open, setOpen] = (0,
|
|
714
|
-
const IconComponent = icon &&
|
|
816
|
+
const [selected, setSelected] = (0, import_react5.useState)([]);
|
|
817
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
818
|
+
const IconComponent = icon && import_lucide_react8.icons[icon];
|
|
715
819
|
const hideSearchBox = options?.length <= 5;
|
|
716
820
|
const isDefault = variant === "default";
|
|
717
821
|
const isChip = variant === "chip";
|
|
718
822
|
const isEmpty = selected.length == 0;
|
|
719
823
|
const showChevron = isDefault ? isEmpty : true;
|
|
720
824
|
const close = () => setOpen(false);
|
|
721
|
-
(0,
|
|
825
|
+
(0, import_react5.useEffect)(() => {
|
|
722
826
|
const valueArray = multiselect ? value ?? [] : value ? [value] : [];
|
|
723
827
|
setSelected(
|
|
724
828
|
valueArray.map((v) => options.find((o) => o.value === v)).filter((v) => v !== void 0)
|
|
@@ -746,17 +850,17 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
746
850
|
const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
|
|
747
851
|
return isDefault ? defaultLabel : label;
|
|
748
852
|
};
|
|
749
|
-
return /* @__PURE__ */ (0,
|
|
750
|
-
isDefault && label && /* @__PURE__ */ (0,
|
|
751
|
-
/* @__PURE__ */ (0,
|
|
752
|
-
/* @__PURE__ */ (0,
|
|
753
|
-
/* @__PURE__ */ (0,
|
|
853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
854
|
+
isDefault && label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Label_default, { text: label, className: classNames?.label }),
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative flex", children: [
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
754
858
|
PopoverTrigger,
|
|
755
859
|
{
|
|
756
860
|
asChild: true,
|
|
757
861
|
disabled: options.length === 0,
|
|
758
862
|
"data-testid": `${props.id ?? props.name}-combobox-trigger`,
|
|
759
|
-
children: /* @__PURE__ */ (0,
|
|
863
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
760
864
|
"div",
|
|
761
865
|
{
|
|
762
866
|
ref,
|
|
@@ -767,9 +871,9 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
767
871
|
),
|
|
768
872
|
"aria-expanded": open,
|
|
769
873
|
children: [
|
|
770
|
-
isDefault && IconComponent && /* @__PURE__ */ (0,
|
|
771
|
-
isChip && !isEmpty && /* @__PURE__ */ (0,
|
|
772
|
-
/* @__PURE__ */ (0,
|
|
874
|
+
isDefault && IconComponent && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IconComponent, { className: "h-4 w-4 shrink-0" }),
|
|
875
|
+
isChip && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Badge, { variant: "purple", children: selected.length }),
|
|
876
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
773
877
|
"span",
|
|
774
878
|
{
|
|
775
879
|
className: cn(
|
|
@@ -779,8 +883,8 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
779
883
|
children: handleDisplayValue()
|
|
780
884
|
}
|
|
781
885
|
),
|
|
782
|
-
showChevron && /* @__PURE__ */ (0,
|
|
783
|
-
|
|
886
|
+
showChevron && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
887
|
+
import_lucide_react8.ChevronDownIcon,
|
|
784
888
|
{
|
|
785
889
|
className: "shrink-0 transform group-data-[state=open]:rotate-180",
|
|
786
890
|
size: "16"
|
|
@@ -791,7 +895,7 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
791
895
|
)
|
|
792
896
|
}
|
|
793
897
|
),
|
|
794
|
-
/* @__PURE__ */ (0,
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
795
899
|
PopoverContent,
|
|
796
900
|
{
|
|
797
901
|
className: cn(
|
|
@@ -802,16 +906,16 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
802
906
|
collisionPadding: 8,
|
|
803
907
|
sideOffset: 4,
|
|
804
908
|
align: "start",
|
|
805
|
-
children: /* @__PURE__ */ (0,
|
|
806
|
-
!hideSearchBox && /* @__PURE__ */ (0,
|
|
807
|
-
/* @__PURE__ */ (0,
|
|
808
|
-
/* @__PURE__ */ (0,
|
|
809
|
-
/* @__PURE__ */ (0,
|
|
909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Command, { children: [
|
|
910
|
+
!hideSearchBox && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommandInput, { placeholder: "Search..." }),
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(CommandList, { children: [
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommandEmpty, { children: "No results" }),
|
|
913
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CommandGroup, { children: options.map(({ id, ...option }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
810
914
|
CommandItem,
|
|
811
915
|
{
|
|
812
916
|
value: option.title,
|
|
813
917
|
onSelect: () => handleSelect(option.value),
|
|
814
|
-
children: /* @__PURE__ */ (0,
|
|
918
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
815
919
|
ListItem_default,
|
|
816
920
|
{
|
|
817
921
|
className: cn(classNames?.items, "truncate py-1"),
|
|
@@ -824,26 +928,26 @@ var Combobox = (0, import_react4.forwardRef)((props, ref) => {
|
|
|
824
928
|
id
|
|
825
929
|
)) })
|
|
826
930
|
] }),
|
|
827
|
-
!!footer && /* @__PURE__ */ (0,
|
|
931
|
+
!!footer && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Separator, {}),
|
|
828
932
|
footer && footer({ close })
|
|
829
933
|
] })
|
|
830
934
|
}
|
|
831
935
|
)
|
|
832
936
|
] }),
|
|
833
|
-
isDefault && !isEmpty && /* @__PURE__ */ (0,
|
|
937
|
+
isDefault && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
834
938
|
"button",
|
|
835
939
|
{
|
|
836
940
|
type: "button",
|
|
837
941
|
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",
|
|
838
942
|
onClick: handleClear,
|
|
839
|
-
children: /* @__PURE__ */ (0,
|
|
943
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.CircleX, { className: "h-4 w-4 text-green-100" })
|
|
840
944
|
}
|
|
841
945
|
)
|
|
842
946
|
] })
|
|
843
947
|
] });
|
|
844
948
|
});
|
|
845
949
|
Combobox.displayName = "Combobox";
|
|
846
|
-
var triggerVariants = (0,
|
|
950
|
+
var triggerVariants = (0, import_cva5.cva)(
|
|
847
951
|
"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",
|
|
848
952
|
{
|
|
849
953
|
variants: {
|
|
@@ -875,6 +979,7 @@ var triggerVariants = (0, import_cva4.cva)(
|
|
|
875
979
|
Checkbox,
|
|
876
980
|
Chip,
|
|
877
981
|
Combobox,
|
|
982
|
+
Input,
|
|
878
983
|
Label,
|
|
879
984
|
ListItem,
|
|
880
985
|
Select,
|