@sustaina/shared-ui 1.21.1 → 1.23.0

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/index.d.mts CHANGED
@@ -730,7 +730,7 @@ declare const inputVariants: (props?: ({
730
730
  fullWidth?: boolean | null | undefined;
731
731
  appearance?: "filled" | "unfilled" | null | undefined;
732
732
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
733
- type InputProps = Omit<InputPrimitiveProps, "size"> & VariantProps<typeof inputVariants> & {
733
+ type InputProps = Omit<InputPrimitiveProps, "size" | "prefix"> & VariantProps<typeof inputVariants> & {
734
734
  prefix?: React$1.ReactNode;
735
735
  prefixProps?: React$1.HTMLAttributes<HTMLSpanElement>;
736
736
  prefixInteractive?: boolean;
@@ -746,7 +746,7 @@ type InputProps = Omit<InputPrimitiveProps, "size"> & VariantProps<typeof inputV
746
746
  validationMessageProps?: React$1.HTMLAttributes<HTMLParagraphElement>;
747
747
  onValueChange?: (value: string) => void;
748
748
  };
749
- declare const Input: React$1.ForwardRefExoticComponent<Omit<InputPrimitiveProps, "size"> & VariantProps<(props?: ({
749
+ declare const Input: React$1.ForwardRefExoticComponent<Omit<InputPrimitiveProps, "prefix" | "size"> & VariantProps<(props?: ({
750
750
  controlSize?: "sm" | "lg" | "md" | null | undefined;
751
751
  fullWidth?: boolean | null | undefined;
752
752
  appearance?: "filled" | "unfilled" | null | undefined;
package/dist/index.d.ts CHANGED
@@ -730,7 +730,7 @@ declare const inputVariants: (props?: ({
730
730
  fullWidth?: boolean | null | undefined;
731
731
  appearance?: "filled" | "unfilled" | null | undefined;
732
732
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
733
- type InputProps = Omit<InputPrimitiveProps, "size"> & VariantProps<typeof inputVariants> & {
733
+ type InputProps = Omit<InputPrimitiveProps, "size" | "prefix"> & VariantProps<typeof inputVariants> & {
734
734
  prefix?: React$1.ReactNode;
735
735
  prefixProps?: React$1.HTMLAttributes<HTMLSpanElement>;
736
736
  prefixInteractive?: boolean;
@@ -746,7 +746,7 @@ type InputProps = Omit<InputPrimitiveProps, "size"> & VariantProps<typeof inputV
746
746
  validationMessageProps?: React$1.HTMLAttributes<HTMLParagraphElement>;
747
747
  onValueChange?: (value: string) => void;
748
748
  };
749
- declare const Input: React$1.ForwardRefExoticComponent<Omit<InputPrimitiveProps, "size"> & VariantProps<(props?: ({
749
+ declare const Input: React$1.ForwardRefExoticComponent<Omit<InputPrimitiveProps, "prefix" | "size"> & VariantProps<(props?: ({
750
750
  controlSize?: "sm" | "lg" | "md" | null | undefined;
751
751
  fullWidth?: boolean | null | undefined;
752
752
  appearance?: "filled" | "unfilled" | null | undefined;
package/dist/index.js CHANGED
@@ -648,6 +648,7 @@ var ExpandCollapse = ({ title, children, portalId }) => {
648
648
  {
649
649
  onClick: () => setIsOpen(false),
650
650
  className: "absolute top-2 right-2 text-gray-500 hover:text-gray-700",
651
+ "data-testid": "advsearch-icon-close",
651
652
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-5 h-5" })
652
653
  }
653
654
  ),
@@ -661,6 +662,7 @@ var ExpandCollapse = ({ title, children, portalId }) => {
661
662
  {
662
663
  onClick: () => setIsOpen(!isOpen),
663
664
  className: "px-4 py-2 text-sm text-gray-700 hover:text-black",
665
+ "data-testid": "advsearch-icon-search",
664
666
  children: title
665
667
  }
666
668
  ),
@@ -1014,7 +1016,14 @@ function SelectScrollDownButton({
1014
1016
  );
1015
1017
  }
1016
1018
  var FieldSelect = ({ row, fieldOptions, onChangeField }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: row.fieldName, onValueChange: (value) => onChangeField(value), children: [
1017
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select field" }) }),
1019
+ /* @__PURE__ */ jsxRuntime.jsx(
1020
+ SelectTrigger,
1021
+ {
1022
+ className: "w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0",
1023
+ "data-testid": "advsearch-dropdown-selectfield",
1024
+ children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select field" })
1025
+ }
1026
+ ),
1018
1027
  /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "w-full min-w-[unset]", children: fieldOptions.map((f) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: f.value, children: f.label }, f.value)) })
1019
1028
  ] }) });
1020
1029
 
@@ -1056,6 +1065,7 @@ var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
1056
1065
  {
1057
1066
  "aria-invalid": error ? "true" : "false",
1058
1067
  className: `w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0 ${error ? "border border-red-500" : ""}`,
1068
+ "data-testid": "advsearch-dropdown-cond",
1059
1069
  children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select operator" })
1060
1070
  }
1061
1071
  ),
@@ -1271,14 +1281,14 @@ var Input = React4__namespace.forwardRef(
1271
1281
  type = "text",
1272
1282
  ...rest
1273
1283
  }, ref) => {
1284
+ const inputProps = rest;
1274
1285
  const hasPrefix = Boolean(prefix);
1275
1286
  const hasSuffix = Boolean(suffix) || loading;
1276
1287
  const isFullWidth = fullWidth ?? true;
1277
1288
  const {
1278
1289
  "aria-invalid": ariaInvalidProp,
1279
1290
  "aria-describedby": ariaDescribedByProp,
1280
- onChange: onChangeProp,
1281
- ...inputProps
1291
+ onChange: onChangeProp
1282
1292
  } = rest;
1283
1293
  const ariaInvalid = invalid ?? ariaInvalidProp;
1284
1294
  const messageId = React4__namespace.useId();
@@ -1355,7 +1365,7 @@ var Input = React4__namespace.forwardRef(
1355
1365
  return inputWithAffixes;
1356
1366
  }
1357
1367
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1", isFullWidth ? "w-full" : "w-fit", wrapperClassName), children: [
1358
- hasPrefix || hasSuffix ? inputWithAffixes : inputElement,
1368
+ inputWithAffixes,
1359
1369
  /* @__PURE__ */ jsxRuntime.jsxs(
1360
1370
  "p",
1361
1371
  {
@@ -1426,7 +1436,8 @@ var ConditionTextInput = ({ row, control, onClear }) => /* @__PURE__ */ jsxRunti
1426
1436
  value: field.value ?? "",
1427
1437
  autoComplete: "off",
1428
1438
  inputMode: "text",
1429
- className: "w-full h-9 rounded-md bg-white pr-8 text-sm text-gray-700 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"
1439
+ className: "w-full h-9 rounded-md bg-white pr-8 text-sm text-gray-700 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0",
1440
+ "data-testid": "advsearch-input-value"
1430
1441
  }
1431
1442
  ) }),
1432
1443
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-y-0 right-3 flex items-center", children: field.value && /* @__PURE__ */ jsxRuntime.jsx(ClearButton, { onClick: handleClear }) }),
@@ -2002,7 +2013,8 @@ var ConditionDateInput = ({
2002
2013
  clearAriaLabel: buildClearLabel(options?.isEnd),
2003
2014
  invalid: Boolean(fieldState.error),
2004
2015
  displayFormatter: (d) => formatISODate(d, shortDateFormat),
2005
- wrapperClassName: "min-w-0"
2016
+ wrapperClassName: "min-w-0",
2017
+ "data-testid": "advsearch-date-value"
2006
2018
  }
2007
2019
  ) }),
2008
2020
  /* @__PURE__ */ jsxRuntime.jsx(FormMessage, { className: "absolute left-0 top-full mt-1 text-xs text-red-600" })
@@ -2470,6 +2482,7 @@ var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) => /* @__P
2470
2482
  "w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0",
2471
2483
  hasValue ? "pr-8" : "pr-4"
2472
2484
  ),
2485
+ "data-testid": "advsearch-dropdown-value",
2473
2486
  children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select value" })
2474
2487
  }
2475
2488
  ) }),
@@ -2845,7 +2858,8 @@ var ConditionLookupInput = ({
2845
2858
  suggestionDebounce: fieldSchema?.suggestionDebounce,
2846
2859
  noOptionsMessage: fieldSchema?.noOptionsMessage,
2847
2860
  loadingMessage: fieldSchema?.loadingMessage,
2848
- dropdownPortalId
2861
+ dropdownPortalId,
2862
+ "data-testid": "advsearch-lookup-list"
2849
2863
  }
2850
2864
  ) }),
2851
2865
  /* @__PURE__ */ jsxRuntime.jsx(FormMessage, { className: "absolute left-0 top-full mt-1 text-xs text-red-600" })
@@ -2980,6 +2994,7 @@ var AddRemoveButtons = ({ isFirst, onAdd, onRemove, disableAdd }) => /* @__PURE_
2980
2994
  className: `circle-btn border transition-colors ${disableAdd ? "cursor-not-allowed border-[#5a5a5a] bg-[#5a5a5a] text-[#e1e1e1]" : "border-[#379a2a] bg-[#379a2a] text-white"}`,
2981
2995
  "aria-label": "Add row",
2982
2996
  title: disableAdd ? "Cannot add more rows" : "Add condition",
2997
+ "data-testid": "advsearch-btn-add",
2983
2998
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-3 w-3 stroke-[2]" })
2984
2999
  }
2985
3000
  ) : /* @__PURE__ */ jsxRuntime.jsx(
@@ -2991,6 +3006,7 @@ var AddRemoveButtons = ({ isFirst, onAdd, onRemove, disableAdd }) => /* @__PURE_
2991
3006
  className: "circle-btn border border-[#379a2a] bg-white text-[#379a2a]",
2992
3007
  "aria-label": "Remove row",
2993
3008
  title: "Remove condition",
3009
+ "data-testid": "advsearch-btn-remove",
2994
3010
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minus, { className: "h-3 w-3 stroke-[2]" })
2995
3011
  }
2996
3012
  ) });
@@ -3625,6 +3641,7 @@ var AdvanceSearch = ({
3625
3641
  Object.keys(getValues()).forEach((k) => resetField(k));
3626
3642
  if (onClear) onClear();
3627
3643
  },
3644
+ "data-testid": "advsearch-btn-clear",
3628
3645
  children: "Clear Search"
3629
3646
  }
3630
3647
  ),
@@ -3633,6 +3650,7 @@ var AdvanceSearch = ({
3633
3650
  {
3634
3651
  type: "submit",
3635
3652
  className: "w-full bg-[#379a2a] text-white hover:bg-[#2f7c21] md:w-auto md:min-w-[120px]",
3653
+ "data-testid": "advsearch-btn-search",
3636
3654
  children: "Search"
3637
3655
  }
3638
3656
  )
@@ -3891,6 +3909,7 @@ var HeaderCell = ({
3891
3909
  rootClassName
3892
3910
  ),
3893
3911
  onClick: (event) => {
3912
+ if (!showSorter) return;
3894
3913
  event.preventDefault();
3895
3914
  if (context?.column?.getCanSort()) {
3896
3915
  context?.column?.toggleSorting();
@@ -3918,8 +3937,8 @@ var HeaderCell = ({
3918
3937
  lucideReact.ChevronUp,
3919
3938
  {
3920
3939
  className: cn("stroke-[#BBBBBB]", {
3921
- "stroke-[#41875c]": context?.column?.getIsSorted() === "asc",
3922
- "stroke-[#41875c]/45": context?.column?.getNextSortingOrder() === "asc" && hovering
3940
+ "stroke-sus-gray-5": context?.column?.getIsSorted() === "asc",
3941
+ "stroke-sus-gray-5/45": context?.column?.getNextSortingOrder() === "asc" && hovering
3923
3942
  }),
3924
3943
  size: 16,
3925
3944
  strokeWidth: 3
@@ -3929,8 +3948,8 @@ var HeaderCell = ({
3929
3948
  lucideReact.ChevronDown,
3930
3949
  {
3931
3950
  className: cn("stroke-[#BBBBBB]", {
3932
- "stroke-[#41875c]": context?.column?.getIsSorted() === "desc",
3933
- "stroke-[#41875c]/45": context?.column?.getNextSortingOrder() === "desc" && hovering
3951
+ "stroke-sus-gray-5": context?.column?.getIsSorted() === "desc",
3952
+ "stroke-sus-gray-5/45": context?.column?.getNextSortingOrder() === "desc" && hovering
3934
3953
  }),
3935
3954
  size: 16,
3936
3955
  strokeWidth: 3