@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.
Files changed (53) hide show
  1. package/dist/app/layout.css +84 -0
  2. package/dist/app/layout.css.map +1 -1
  3. package/dist/app/page.cjs +127 -9
  4. package/dist/app/page.cjs.map +1 -1
  5. package/dist/app/page.js +148 -30
  6. package/dist/app/page.js.map +1 -1
  7. package/dist/components/demos/ComboboxDemo.cjs +6 -3
  8. package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
  9. package/dist/components/demos/ComboboxDemo.js +17 -14
  10. package/dist/components/demos/ComboboxDemo.js.map +1 -1
  11. package/dist/components/demos/InputDemo.cjs +178 -0
  12. package/dist/components/demos/InputDemo.cjs.map +1 -0
  13. package/dist/components/demos/InputDemo.d.cts +5 -0
  14. package/dist/components/demos/InputDemo.d.ts +5 -0
  15. package/dist/components/demos/InputDemo.js +155 -0
  16. package/dist/components/demos/InputDemo.js.map +1 -0
  17. package/dist/components/demos/SelectDemo.cjs +6 -3
  18. package/dist/components/demos/SelectDemo.cjs.map +1 -1
  19. package/dist/components/demos/SelectDemo.js +17 -14
  20. package/dist/components/demos/SelectDemo.js.map +1 -1
  21. package/dist/components/demos/index.cjs +125 -7
  22. package/dist/components/demos/index.cjs.map +1 -1
  23. package/dist/components/demos/index.js +146 -28
  24. package/dist/components/demos/index.js.map +1 -1
  25. package/dist/components/ui/Combobox.cjs +6 -3
  26. package/dist/components/ui/Combobox.cjs.map +1 -1
  27. package/dist/components/ui/Combobox.js +14 -11
  28. package/dist/components/ui/Combobox.js.map +1 -1
  29. package/dist/components/ui/Input.cjs +162 -0
  30. package/dist/components/ui/Input.cjs.map +1 -0
  31. package/dist/components/ui/Input.d.cts +22 -0
  32. package/dist/components/ui/Input.d.ts +22 -0
  33. package/dist/components/ui/Input.js +141 -0
  34. package/dist/components/ui/Input.js.map +1 -0
  35. package/dist/components/ui/Label.cjs +6 -3
  36. package/dist/components/ui/Label.cjs.map +1 -1
  37. package/dist/components/ui/Label.d.cts +2 -1
  38. package/dist/components/ui/Label.d.ts +2 -1
  39. package/dist/components/ui/Label.js +7 -4
  40. package/dist/components/ui/Label.js.map +1 -1
  41. package/dist/components/ui/Select.cjs +6 -3
  42. package/dist/components/ui/Select.cjs.map +1 -1
  43. package/dist/components/ui/Select.js +14 -11
  44. package/dist/components/ui/Select.js.map +1 -1
  45. package/dist/index.cjs +175 -70
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.cts +1 -0
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.js +184 -80
  50. package/dist/index.js.map +1 -1
  51. package/dist/styles/globals.css +84 -0
  52. package/dist/styles/globals.css.map +1 -1
  53. 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,14 +354,17 @@ 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 {
367
370
  value,
@@ -414,17 +417,17 @@ var Combobox = forwardRef6((props, ref) => {
414
417
  const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
415
418
  return isDefault ? defaultLabel : label;
416
419
  };
417
- return /* @__PURE__ */ jsxs5("div", { className: cn("flex flex-col gap-2", className), children: [
420
+ return /* @__PURE__ */ jsxs6("div", { className: cn("flex flex-col gap-2", className), children: [
418
421
  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: [
422
+ /* @__PURE__ */ jsxs6("div", { className: "relative flex", children: [
423
+ /* @__PURE__ */ jsxs6(Popover, { open, onOpenChange: setOpen, children: [
421
424
  /* @__PURE__ */ jsx9(
422
425
  PopoverTrigger,
423
426
  {
424
427
  asChild: true,
425
428
  disabled: options.length === 0,
426
429
  "data-testid": `${props.id ?? props.name}-combobox-trigger`,
427
- children: /* @__PURE__ */ jsxs5(
430
+ children: /* @__PURE__ */ jsxs6(
428
431
  "div",
429
432
  {
430
433
  ref,
@@ -470,9 +473,9 @@ var Combobox = forwardRef6((props, ref) => {
470
473
  collisionPadding: 8,
471
474
  sideOffset: 4,
472
475
  align: "start",
473
- children: /* @__PURE__ */ jsxs5(Command, { children: [
476
+ children: /* @__PURE__ */ jsxs6(Command, { children: [
474
477
  !hideSearchBox && /* @__PURE__ */ jsx9(CommandInput, { placeholder: "Search..." }),
475
- /* @__PURE__ */ jsxs5(CommandList, { children: [
478
+ /* @__PURE__ */ jsxs6(CommandList, { children: [
476
479
  /* @__PURE__ */ jsx9(CommandEmpty, { children: "No results" }),
477
480
  /* @__PURE__ */ jsx9(CommandGroup, { children: options.map(({ id, ...option }) => /* @__PURE__ */ jsx9(
478
481
  CommandItem,
@@ -647,7 +650,7 @@ var buttonVariants = cva3(
647
650
  );
648
651
 
649
652
  // src/components/demos/ComboboxDemo.tsx
650
- import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
653
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
651
654
  function ComboboxDemo() {
652
655
  const [selectedBands, setSelectedBands] = useState2([]);
653
656
  const [selectedFruit, setSelectedFruit] = useState2("");
@@ -687,7 +690,7 @@ function ComboboxDemo() {
687
690
  { title: "Cherry", value: "Cherry", id: "1", icon: "Cherry" },
688
691
  { title: "Grape", value: "Grape", id: "2", icon: "Grape" }
689
692
  ];
690
- return /* @__PURE__ */ jsxs6("div", { className: "flex max-w-sm flex-col flex-wrap gap-4 p-4", children: [
693
+ return /* @__PURE__ */ jsxs7("div", { className: "flex max-w-sm flex-col flex-wrap gap-4 p-4", children: [
691
694
  /* @__PURE__ */ jsx11(
692
695
  Combobox,
693
696
  {
@@ -721,7 +724,7 @@ function ComboboxDemo() {
721
724
  options: fruits,
722
725
  value: selectedFruit,
723
726
  onChange: setSelectedFruit,
724
- children: ({ close }) => /* @__PURE__ */ jsxs6("div", { className: "flex flex-row items-center justify-between bg-white p-2 pl-4", children: [
727
+ children: ({ close }) => /* @__PURE__ */ jsxs7("div", { className: "flex flex-row items-center justify-between bg-white p-2 pl-4", children: [
725
728
  /* @__PURE__ */ jsx11(Button, { variant: "link", tabIndex: -1, onClick: close, children: "Clear" }),
726
729
  /* @__PURE__ */ jsx11(Button, { variant: "primary", size: "small", tabIndex: -1, children: "Apply" })
727
730
  ] })
@@ -778,7 +781,7 @@ var chipVariants = cva4(["flex", "items-center", "rounded-3xl", "border", "w-fit
778
781
  var Chip_default = Chip;
779
782
 
780
783
  // src/components/ui/Select.tsx
781
- import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
784
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
782
785
  var Select = forwardRef8(
783
786
  ({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {
784
787
  const { value, defaultValue, dir, className, onChange, ...rest } = props;
@@ -810,7 +813,7 @@ var Select = forwardRef8(
810
813
  });
811
814
  onChange?.(multiselect ? newSelected : newValue);
812
815
  }
813
- return /* @__PURE__ */ jsxs7(
816
+ return /* @__PURE__ */ jsxs8(
814
817
  "div",
815
818
  {
816
819
  className: cn("flex flex-col space-y-1", className),
@@ -818,7 +821,7 @@ var Select = forwardRef8(
818
821
  "data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
819
822
  children: [
820
823
  /* @__PURE__ */ jsx14(Label_default, { text: label, className: classNames?.label }),
821
- /* @__PURE__ */ jsxs7(
824
+ /* @__PURE__ */ jsxs8(
822
825
  SelectPrimitive.Root,
823
826
  {
824
827
  open,
@@ -829,7 +832,7 @@ var Select = forwardRef8(
829
832
  dir: dir === "rtl" ? "rtl" : "ltr",
830
833
  ...rest,
831
834
  children: [
832
- /* @__PURE__ */ jsxs7(
835
+ /* @__PURE__ */ jsxs8(
833
836
  SelectPrimitive.Trigger,
834
837
  {
835
838
  ref,
@@ -865,14 +868,14 @@ var Select = forwardRef8(
865
868
  sideOffset: 4,
866
869
  onPointerDownOutside: toggleOpen,
867
870
  onKeyDown: closeOnEscape,
868
- children: /* @__PURE__ */ jsxs7(SelectPrimitive.Viewport, { children: [
871
+ children: /* @__PURE__ */ jsxs8(SelectPrimitive.Viewport, { children: [
869
872
  multiselect && !!chipLabels?.length && /* @__PURE__ */ jsx14(
870
873
  SelectPrimitive.Group,
871
874
  {
872
875
  className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
873
876
  "data-testid": "selected-labels",
874
877
  children: chipLabels?.map(
875
- (chip) => chip && /* @__PURE__ */ jsxs7(Chip_default, { size: "small", variant: "primary", children: [
878
+ (chip) => chip && /* @__PURE__ */ jsxs8(Chip_default, { size: "small", variant: "primary", children: [
876
879
  /* @__PURE__ */ jsx14("span", { children: chip.title }),
877
880
  /* @__PURE__ */ jsx14(
878
881
  X2,
@@ -888,7 +891,7 @@ var Select = forwardRef8(
888
891
  }
889
892
  ),
890
893
  /* @__PURE__ */ jsx14(Separator, {}),
891
- options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs7(
894
+ options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs8(
892
895
  SelectPrimitive.Item,
893
896
  {
894
897
  value: value2,
@@ -925,11 +928,11 @@ Select.displayName = "Select";
925
928
  var Select_default = Select;
926
929
 
927
930
  // src/components/demos/SelectDemo.tsx
928
- import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
931
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
929
932
  function SelectDemo() {
930
- return /* @__PURE__ */ jsxs8("div", { className: "m-4", children: [
933
+ return /* @__PURE__ */ jsxs9("div", { className: "m-4", children: [
931
934
  /* @__PURE__ */ jsx15("h3", { children: "Select" }),
932
- /* @__PURE__ */ jsxs8("div", { className: "flex max-w-sm flex-col gap-4 mt-2", children: [
935
+ /* @__PURE__ */ jsxs9("div", { className: "flex max-w-sm flex-col gap-4 mt-2", children: [
933
936
  /* @__PURE__ */ jsx15(
934
937
  Select_default,
935
938
  {
@@ -980,12 +983,127 @@ function SelectDemo() {
980
983
  }
981
984
  var SelectDemo_default = SelectDemo;
982
985
 
986
+ // src/components/ui/Input.tsx
987
+ import { cva as cva5 } from "cva";
988
+ import { icons as icons3, X as X3 } from "lucide-react";
989
+ import { forwardRef as forwardRef9 } from "react";
990
+ import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
991
+ var Input = forwardRef9(
992
+ ({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
993
+ const handleClear = () => {
994
+ onChange?.({ target: { value: "" } });
995
+ onClear?.();
996
+ };
997
+ const IconComponent = icon && icons3[icon];
998
+ const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
999
+ const hasIcon = !!icon;
1000
+ const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
1001
+ return /* @__PURE__ */ jsxs10("div", { className: "group flex w-full flex-col", "data-testid": `input-wrapper-${props.id}`, children: [
1002
+ label && /* @__PURE__ */ jsx16(Label_default, { text: label, htmlFor: props.name, className: cn("body mb-1", classNames?.label) }),
1003
+ /* @__PURE__ */ jsxs10("div", { className: "relative flex flex-row items-center", children: [
1004
+ IconComponent && /* @__PURE__ */ jsx16(
1005
+ IconComponent,
1006
+ {
1007
+ className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
1008
+ }
1009
+ ),
1010
+ /* @__PURE__ */ jsx16(
1011
+ "input",
1012
+ {
1013
+ className: cn(inputVariants({ theme, hasIcon })),
1014
+ ref,
1015
+ placeholder,
1016
+ value,
1017
+ onChange,
1018
+ "data-testid": `input-element-${props.id}`,
1019
+ ...props
1020
+ }
1021
+ ),
1022
+ hasIcon && value && /* @__PURE__ */ jsx16(
1023
+ X3,
1024
+ {
1025
+ className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
1026
+ onClick: handleClear,
1027
+ "data-testid": "clear-button"
1028
+ }
1029
+ )
1030
+ ] }),
1031
+ /* @__PURE__ */ jsx16(ErrorMessage_default, { message: error, className: "mt-1" })
1032
+ ] });
1033
+ }
1034
+ );
1035
+ Input.displayName = "Input";
1036
+ var inputVariants = cva5(
1037
+ [
1038
+ "border-input",
1039
+ "placeholder:text-muted-foreground",
1040
+ "focus-visible:ring-ring",
1041
+ "inline-flex",
1042
+ "w-full",
1043
+ "h-11",
1044
+ "items-center",
1045
+ "justify-start",
1046
+ "gap-3",
1047
+ "rounded-lg",
1048
+ "bg-transparent",
1049
+ "px-3",
1050
+ "pt-0.5",
1051
+ "text-sm",
1052
+ "shadow-sm",
1053
+ "ring-grey-50",
1054
+ "transition-colors",
1055
+ "focus-visible:outline-none",
1056
+ "focus-visible:ring-1",
1057
+ "disabled:cursor-not-allowed",
1058
+ "disabled:opacity-50",
1059
+ "appearance-none",
1060
+ "[&::-webkit-search-cancel-button]:appearance-none",
1061
+ "[&::-webkit-search-decoration]:appearance-none",
1062
+ "[&::-webkit-search-results-button]:appearance-none",
1063
+ "[&::-webkit-search-results-decoration]:appearance-none",
1064
+ "[&::-ms-clear]:display-none",
1065
+ "[&::-ms-reveal]:display-none"
1066
+ ],
1067
+ {
1068
+ variants: {
1069
+ theme: {
1070
+ light: "text-grey-80 border",
1071
+ dark: "text-white"
1072
+ },
1073
+ hasIcon: {
1074
+ false: "pl-3",
1075
+ true: "pl-8"
1076
+ }
1077
+ },
1078
+ defaultVariants: {
1079
+ theme: "light",
1080
+ hasIcon: false
1081
+ }
1082
+ }
1083
+ );
1084
+ var Input_default = Input;
1085
+
1086
+ // src/components/demos/InputDemo.tsx
1087
+ import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
1088
+ function InputDemo() {
1089
+ return /* @__PURE__ */ jsxs11("div", { className: "m-4", children: [
1090
+ /* @__PURE__ */ jsx17("h3", { children: "Input" }),
1091
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 md:flex-row", children: [
1092
+ /* @__PURE__ */ jsx17("div", { className: "bg-green-80 p-2", children: /* @__PURE__ */ jsx17(Input_default, { theme: "dark", icon: "Search" }) }),
1093
+ /* @__PURE__ */ jsx17("div", { className: "p-2", children: /* @__PURE__ */ jsx17(Input_default, {}) }),
1094
+ /* @__PURE__ */ jsx17("div", { className: "p-2", children: /* @__PURE__ */ jsx17(Input_default, { icon: "MapPin" }) })
1095
+ ] })
1096
+ ] });
1097
+ }
1098
+ var InputDemo_default = InputDemo;
1099
+
983
1100
  // src/components/demos/index.tsx
984
- import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
1101
+ import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
985
1102
  function Demos() {
986
- return /* @__PURE__ */ jsxs9("div", { children: [
987
- /* @__PURE__ */ jsx16(ComboboxDemo_default, {}),
988
- /* @__PURE__ */ jsx16(SelectDemo_default, {})
1103
+ return /* @__PURE__ */ jsxs12("div", { children: [
1104
+ /* @__PURE__ */ jsx18(ComboboxDemo_default, {}),
1105
+ /* @__PURE__ */ jsx18(SelectDemo_default, {}),
1106
+ /* @__PURE__ */ jsx18(InputDemo_default, {})
989
1107
  ] });
990
1108
  }
991
1109
  var demos_default = Demos;