@next-degree/pickle-shared-js 0.3.24 → 0.3.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/app/layout.css +0 -11
  2. package/dist/app/layout.css.map +1 -1
  3. package/dist/app/page.cjs +40 -16
  4. package/dist/app/page.cjs.map +1 -1
  5. package/dist/app/page.js +66 -42
  6. package/dist/app/page.js.map +1 -1
  7. package/dist/components/demos/ComboboxDemo.cjs +15 -8
  8. package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
  9. package/dist/components/demos/ComboboxDemo.js +25 -18
  10. package/dist/components/demos/ComboboxDemo.js.map +1 -1
  11. package/dist/components/demos/InputDemo.cjs +18 -7
  12. package/dist/components/demos/InputDemo.cjs.map +1 -1
  13. package/dist/components/demos/InputDemo.js +24 -13
  14. package/dist/components/demos/InputDemo.js.map +1 -1
  15. package/dist/components/demos/SelectDemo.cjs +19 -7
  16. package/dist/components/demos/SelectDemo.cjs.map +1 -1
  17. package/dist/components/demos/SelectDemo.js +29 -17
  18. package/dist/components/demos/SelectDemo.js.map +1 -1
  19. package/dist/components/demos/index.cjs +40 -16
  20. package/dist/components/demos/index.cjs.map +1 -1
  21. package/dist/components/demos/index.js +66 -42
  22. package/dist/components/demos/index.js.map +1 -1
  23. package/dist/components/ui/Combobox.cjs +14 -8
  24. package/dist/components/ui/Combobox.cjs.map +1 -1
  25. package/dist/components/ui/Combobox.js +21 -15
  26. package/dist/components/ui/Combobox.js.map +1 -1
  27. package/dist/components/ui/Input.cjs +17 -6
  28. package/dist/components/ui/Input.cjs.map +1 -1
  29. package/dist/components/ui/Input.js +20 -9
  30. package/dist/components/ui/Input.js.map +1 -1
  31. package/dist/components/ui/Label.cjs +6 -3
  32. package/dist/components/ui/Label.cjs.map +1 -1
  33. package/dist/components/ui/Label.d.cts +2 -1
  34. package/dist/components/ui/Label.d.ts +2 -1
  35. package/dist/components/ui/Label.js +7 -4
  36. package/dist/components/ui/Label.js.map +1 -1
  37. package/dist/components/ui/Select.cjs +17 -6
  38. package/dist/components/ui/Select.cjs.map +1 -1
  39. package/dist/components/ui/Select.js +25 -14
  40. package/dist/components/ui/Select.js.map +1 -1
  41. package/dist/index.cjs +36 -14
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.js +64 -42
  44. package/dist/index.js.map +1 -1
  45. package/dist/styles/globals.css +0 -11
  46. package/dist/styles/globals.css.map +1 -1
  47. package/package.json +1 -1
@@ -343,10 +343,10 @@ function Badge({ className, variant, ...props }) {
343
343
  }
344
344
 
345
345
  // src/components/ui/Label.tsx
346
- import { jsx as jsx8 } from "react/jsx-runtime";
347
- function Label({ text, className, ...props }) {
346
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
347
+ function Label({ text, required, className, ...props }) {
348
348
  if (!text) return null;
349
- return /* @__PURE__ */ jsx8(
349
+ return /* @__PURE__ */ jsxs5(
350
350
  "label",
351
351
  {
352
352
  className: cn(
@@ -354,19 +354,25 @@ function Label({ text, className, ...props }) {
354
354
  className
355
355
  ),
356
356
  ...props,
357
- children: text
357
+ children: [
358
+ text,
359
+ required && /* @__PURE__ */ jsx8("span", { className: "text-red-600", children: "\xA0*" })
360
+ ]
358
361
  }
359
362
  );
360
363
  }
361
364
  var Label_default = Label;
362
365
 
363
366
  // src/components/ui/Combobox.tsx
364
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
367
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
365
368
  var Combobox = forwardRef6((props, ref) => {
366
369
  const {
370
+ id,
371
+ name,
367
372
  value,
368
373
  label,
369
374
  options,
375
+ required,
370
376
  classNames,
371
377
  multiselect,
372
378
  placeholder,
@@ -414,17 +420,17 @@ var Combobox = forwardRef6((props, ref) => {
414
420
  const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
415
421
  return isDefault ? defaultLabel : label;
416
422
  };
417
- return /* @__PURE__ */ jsxs5("div", { className: cn("flex flex-col gap-2", className), children: [
418
- isDefault && label && /* @__PURE__ */ jsx9(Label_default, { text: label, className: classNames?.label }),
419
- /* @__PURE__ */ jsxs5("div", { className: "relative flex", children: [
420
- /* @__PURE__ */ jsxs5(Popover, { open, onOpenChange: setOpen, children: [
423
+ return /* @__PURE__ */ jsxs6("div", { className: cn("flex flex-col gap-1", className), children: [
424
+ isDefault && /* @__PURE__ */ jsx9(Label_default, { text: label, htmlFor: name, required, className: classNames?.label }),
425
+ /* @__PURE__ */ jsxs6("div", { className: "relative flex", children: [
426
+ /* @__PURE__ */ jsxs6(Popover, { open, onOpenChange: setOpen, children: [
421
427
  /* @__PURE__ */ jsx9(
422
428
  PopoverTrigger,
423
429
  {
424
430
  asChild: true,
425
431
  disabled: options.length === 0,
426
- "data-testid": `${props.id ?? props.name}-combobox-trigger`,
427
- children: /* @__PURE__ */ jsxs5(
432
+ "data-testid": `${id ?? name}-combobox-trigger`,
433
+ children: /* @__PURE__ */ jsxs6(
428
434
  "div",
429
435
  {
430
436
  ref,
@@ -470,11 +476,11 @@ var Combobox = forwardRef6((props, ref) => {
470
476
  collisionPadding: 8,
471
477
  sideOffset: 4,
472
478
  align: "start",
473
- children: /* @__PURE__ */ jsxs5(Command, { children: [
479
+ children: /* @__PURE__ */ jsxs6(Command, { children: [
474
480
  !hideSearchBox && /* @__PURE__ */ jsx9(CommandInput, { placeholder: "Search..." }),
475
- /* @__PURE__ */ jsxs5(CommandList, { children: [
481
+ /* @__PURE__ */ jsxs6(CommandList, { children: [
476
482
  /* @__PURE__ */ jsx9(CommandEmpty, { children: "No results" }),
477
- /* @__PURE__ */ jsx9(CommandGroup, { children: options.map(({ id, ...option }) => /* @__PURE__ */ jsx9(
483
+ /* @__PURE__ */ jsx9(CommandGroup, { children: options.map(({ id: id2, ...option }) => /* @__PURE__ */ jsx9(
478
484
  CommandItem,
479
485
  {
480
486
  value: option.title,
@@ -489,7 +495,7 @@ var Combobox = forwardRef6((props, ref) => {
489
495
  }
490
496
  )
491
497
  },
492
- id
498
+ id2
493
499
  )) })
494
500
  ] }),
495
501
  !!footer && /* @__PURE__ */ jsx9(Separator, {}),
@@ -647,7 +653,7 @@ var buttonVariants = cva3(
647
653
  );
648
654
 
649
655
  // src/components/demos/ComboboxDemo.tsx
650
- import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
656
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
651
657
  function ComboboxDemo() {
652
658
  const [selectedBands, setSelectedBands] = useState2([]);
653
659
  const [selectedFruit, setSelectedFruit] = useState2("");
@@ -687,10 +693,11 @@ function ComboboxDemo() {
687
693
  { title: "Cherry", value: "Cherry", id: "1", icon: "Cherry" },
688
694
  { title: "Grape", value: "Grape", id: "2", icon: "Grape" }
689
695
  ];
690
- return /* @__PURE__ */ jsxs6("div", { className: "flex max-w-sm flex-col flex-wrap gap-4 p-4", children: [
696
+ return /* @__PURE__ */ jsxs7("div", { className: "flex max-w-sm flex-col flex-wrap gap-4 p-4", children: [
691
697
  /* @__PURE__ */ jsx11(
692
698
  Combobox,
693
699
  {
700
+ required: true,
694
701
  label: "US bands from the 90's",
695
702
  placeholder: "Select a band",
696
703
  icon: "Music",
@@ -721,7 +728,7 @@ function ComboboxDemo() {
721
728
  options: fruits,
722
729
  value: selectedFruit,
723
730
  onChange: setSelectedFruit,
724
- children: ({ close }) => /* @__PURE__ */ jsxs6("div", { className: "flex flex-row items-center justify-between bg-white p-2 pl-4", children: [
731
+ children: ({ close }) => /* @__PURE__ */ jsxs7("div", { className: "flex flex-row items-center justify-between bg-white p-2 pl-4", children: [
725
732
  /* @__PURE__ */ jsx11(Button, { variant: "link", tabIndex: -1, onClick: close, children: "Clear" }),
726
733
  /* @__PURE__ */ jsx11(Button, { variant: "primary", size: "small", tabIndex: -1, children: "Apply" })
727
734
  ] })
@@ -778,7 +785,7 @@ var chipVariants = cva4(["flex", "items-center", "rounded-3xl", "border", "w-fit
778
785
  var Chip_default = Chip;
779
786
 
780
787
  // src/components/ui/Select.tsx
781
- import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
788
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
782
789
  var Select = forwardRef8(
783
790
  ({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {
784
791
  const { value, defaultValue, dir, className, onChange, ...rest } = props;
@@ -810,15 +817,23 @@ var Select = forwardRef8(
810
817
  });
811
818
  onChange?.(multiselect ? newSelected : newValue);
812
819
  }
813
- return /* @__PURE__ */ jsxs7(
820
+ return /* @__PURE__ */ jsxs8(
814
821
  "div",
815
822
  {
816
- className: cn("flex flex-col space-y-1", className),
823
+ className: cn("flex flex-col gap-1", className),
817
824
  ref: containerRef,
818
825
  "data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
819
826
  children: [
820
- /* @__PURE__ */ jsx14(Label_default, { text: label, className: classNames?.label }),
821
- /* @__PURE__ */ jsxs7(
827
+ /* @__PURE__ */ jsx14(
828
+ Label_default,
829
+ {
830
+ text: label,
831
+ htmlFor: props.name,
832
+ required: props.required,
833
+ className: classNames?.label
834
+ }
835
+ ),
836
+ /* @__PURE__ */ jsxs8(
822
837
  SelectPrimitive.Root,
823
838
  {
824
839
  open,
@@ -829,7 +844,7 @@ var Select = forwardRef8(
829
844
  dir: dir === "rtl" ? "rtl" : "ltr",
830
845
  ...rest,
831
846
  children: [
832
- /* @__PURE__ */ jsxs7(
847
+ /* @__PURE__ */ jsxs8(
833
848
  SelectPrimitive.Trigger,
834
849
  {
835
850
  ref,
@@ -865,14 +880,14 @@ var Select = forwardRef8(
865
880
  sideOffset: 4,
866
881
  onPointerDownOutside: toggleOpen,
867
882
  onKeyDown: closeOnEscape,
868
- children: /* @__PURE__ */ jsxs7(SelectPrimitive.Viewport, { children: [
883
+ children: /* @__PURE__ */ jsxs8(SelectPrimitive.Viewport, { children: [
869
884
  multiselect && !!chipLabels?.length && /* @__PURE__ */ jsx14(
870
885
  SelectPrimitive.Group,
871
886
  {
872
887
  className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
873
888
  "data-testid": "selected-labels",
874
889
  children: chipLabels?.map(
875
- (chip) => chip && /* @__PURE__ */ jsxs7(Chip_default, { size: "small", variant: "primary", children: [
890
+ (chip) => chip && /* @__PURE__ */ jsxs8(Chip_default, { size: "small", variant: "primary", children: [
876
891
  /* @__PURE__ */ jsx14("span", { children: chip.title }),
877
892
  /* @__PURE__ */ jsx14(
878
893
  X2,
@@ -888,7 +903,7 @@ var Select = forwardRef8(
888
903
  }
889
904
  ),
890
905
  /* @__PURE__ */ jsx14(Separator, {}),
891
- options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs7(
906
+ options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs8(
892
907
  SelectPrimitive.Item,
893
908
  {
894
909
  value: value2,
@@ -915,7 +930,7 @@ var Select = forwardRef8(
915
930
  ]
916
931
  }
917
932
  ),
918
- /* @__PURE__ */ jsx14(ErrorMessage_default, { message: error, className: "mt-1" })
933
+ /* @__PURE__ */ jsx14(ErrorMessage_default, { message: error })
919
934
  ]
920
935
  }
921
936
  );
@@ -925,14 +940,15 @@ Select.displayName = "Select";
925
940
  var Select_default = Select;
926
941
 
927
942
  // src/components/demos/SelectDemo.tsx
928
- import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
943
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
929
944
  function SelectDemo() {
930
- return /* @__PURE__ */ jsxs8("div", { className: "m-4", children: [
945
+ return /* @__PURE__ */ jsxs9("div", { className: "m-4", children: [
931
946
  /* @__PURE__ */ jsx15("h3", { children: "Select" }),
932
- /* @__PURE__ */ jsxs8("div", { className: "flex max-w-sm flex-col gap-4 mt-2", children: [
947
+ /* @__PURE__ */ jsxs9("div", { className: "mt-2 flex max-w-sm flex-col gap-4", children: [
933
948
  /* @__PURE__ */ jsx15(
934
949
  Select_default,
935
950
  {
951
+ required: true,
936
952
  label: "Label - Singleselect",
937
953
  placeholder: "Select an option",
938
954
  options: [
@@ -984,7 +1000,7 @@ var SelectDemo_default = SelectDemo;
984
1000
  import { cva as cva5 } from "cva";
985
1001
  import { icons as icons3, X as X3 } from "lucide-react";
986
1002
  import { forwardRef as forwardRef9 } from "react";
987
- import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
1003
+ import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
988
1004
  var Input = forwardRef9(
989
1005
  ({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
990
1006
  const handleClear = () => {
@@ -995,9 +1011,17 @@ var Input = forwardRef9(
995
1011
  const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
996
1012
  const hasIcon = !!icon;
997
1013
  const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
998
- return /* @__PURE__ */ jsxs9("div", { className: "group flex w-full flex-col", "data-testid": `input-wrapper-${props.id}`, children: [
999
- label && /* @__PURE__ */ jsx16(Label_default, { text: label, htmlFor: props.name, className: cn("body mb-1", classNames?.label) }),
1000
- /* @__PURE__ */ jsxs9("div", { className: "relative flex flex-row items-center", children: [
1014
+ return /* @__PURE__ */ jsxs10("div", { className: "group flex w-full flex-col gap-1", "data-testid": `input-wrapper-${props.id}`, children: [
1015
+ label && /* @__PURE__ */ jsx16(
1016
+ Label_default,
1017
+ {
1018
+ text: label,
1019
+ htmlFor: props.name,
1020
+ required: props.required,
1021
+ className: classNames?.label
1022
+ }
1023
+ ),
1024
+ /* @__PURE__ */ jsxs10("div", { className: "relative flex flex-row items-center", children: [
1001
1025
  IconComponent && /* @__PURE__ */ jsx16(
1002
1026
  IconComponent,
1003
1027
  {
@@ -1025,7 +1049,7 @@ var Input = forwardRef9(
1025
1049
  }
1026
1050
  )
1027
1051
  ] }),
1028
- /* @__PURE__ */ jsx16(ErrorMessage_default, { message: error, className: "mt-1" })
1052
+ /* @__PURE__ */ jsx16(ErrorMessage_default, { message: error })
1029
1053
  ] });
1030
1054
  }
1031
1055
  );
@@ -1081,13 +1105,13 @@ var inputVariants = cva5(
1081
1105
  var Input_default = Input;
1082
1106
 
1083
1107
  // src/components/demos/InputDemo.tsx
1084
- import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
1108
+ import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
1085
1109
  function InputDemo() {
1086
- return /* @__PURE__ */ jsxs10("div", { className: "m-4", children: [
1110
+ return /* @__PURE__ */ jsxs11("div", { className: "m-4", children: [
1087
1111
  /* @__PURE__ */ jsx17("h3", { children: "Input" }),
1088
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 md:flex-row", children: [
1112
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 md:flex-row", children: [
1089
1113
  /* @__PURE__ */ jsx17("div", { className: "bg-green-80 p-2", children: /* @__PURE__ */ jsx17(Input_default, { theme: "dark", icon: "Search" }) }),
1090
- /* @__PURE__ */ jsx17("div", { className: "p-2", children: /* @__PURE__ */ jsx17(Input_default, {}) }),
1114
+ /* @__PURE__ */ jsx17("div", { className: "p-2", children: /* @__PURE__ */ jsx17(Input_default, { label: "Required input", required: true }) }),
1091
1115
  /* @__PURE__ */ jsx17("div", { className: "p-2", children: /* @__PURE__ */ jsx17(Input_default, { icon: "MapPin" }) })
1092
1116
  ] })
1093
1117
  ] });
@@ -1095,9 +1119,9 @@ function InputDemo() {
1095
1119
  var InputDemo_default = InputDemo;
1096
1120
 
1097
1121
  // src/components/demos/index.tsx
1098
- import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
1122
+ import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
1099
1123
  function Demos() {
1100
- return /* @__PURE__ */ jsxs11("div", { children: [
1124
+ return /* @__PURE__ */ jsxs12("div", { children: [
1101
1125
  /* @__PURE__ */ jsx18(ComboboxDemo_default, {}),
1102
1126
  /* @__PURE__ */ jsx18(SelectDemo_default, {}),
1103
1127
  /* @__PURE__ */ jsx18(InputDemo_default, {})