@sustaina/shared-ui 1.2.0 → 1.3.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.mjs CHANGED
@@ -1476,7 +1476,9 @@ function SortableRow({
1476
1476
  children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Choose column..." })
1477
1477
  }
1478
1478
  ) }),
1479
- /* @__PURE__ */ jsx(SelectContent, { children: options.filter((i2) => i2.id === field.value || !currentColumns?.some((c) => c.id === i2.id)).sort(
1479
+ /* @__PURE__ */ jsx(SelectContent, { children: options.filter(
1480
+ (i2) => i2.id === field.value || !currentColumns?.some((c, idx) => c.id === i2.id && idx !== index)
1481
+ ).sort(
1480
1482
  (a, b) => a.id === field.value ? -1 : b.id === field.value ? 1 : 0
1481
1483
  ).map((opt) => /* @__PURE__ */ jsx(
1482
1484
  SelectItem,
@@ -1690,16 +1692,16 @@ var GridSettingsModal = ({
1690
1692
  {
1691
1693
  items: fields?.slice(1).map((c) => c?.fieldId),
1692
1694
  strategy: verticalListSortingStrategy,
1693
- children: fields?.slice(1).map((col, index) => /* @__PURE__ */ jsx(
1695
+ children: fields?.slice(1).map((col, index2) => /* @__PURE__ */ jsx(
1694
1696
  SortableRow,
1695
1697
  {
1696
1698
  value: col?.fieldId,
1697
1699
  control,
1698
- name: `columns.${index + 1}.id`,
1700
+ name: `columns.${index2 + 1}.id`,
1699
1701
  isDragging,
1700
1702
  availableColumns,
1701
1703
  currentColumns: fields,
1702
- onRemove: () => remove(index + 1)
1704
+ onRemove: () => remove(index2 + 1)
1703
1705
  },
1704
1706
  col?.fieldId
1705
1707
  ))
@@ -1832,10 +1834,12 @@ var Navbar = ({
1832
1834
  subButtonDisable = false,
1833
1835
  onMainButtonClick,
1834
1836
  onSubButtonClick,
1837
+ separatorDisable = false,
1835
1838
  searchButton
1836
1839
  }) => {
1837
1840
  const { isMobile, isTablet, isDesktop } = useScreenSize_default();
1838
1841
  const Icon3 = CircleHelp;
1842
+ const shouldShowSeparator = !separatorDisable && isValidElement(searchButton);
1839
1843
  return /* @__PURE__ */ jsxs(
1840
1844
  "nav",
1841
1845
  {
@@ -1931,7 +1935,7 @@ var Navbar = ({
1931
1935
  children: subButtonText
1932
1936
  }
1933
1937
  ),
1934
- isValidElement(searchButton) ? /* @__PURE__ */ jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }) : "",
1938
+ shouldShowSeparator && /* @__PURE__ */ jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
1935
1939
  isValidElement(searchButton) ? searchButton : ""
1936
1940
  ] })
1937
1941
  ]
@@ -2584,8 +2588,8 @@ var TagsInput = ({ value = [], onChange, onClear, error }) => {
2584
2588
  onChange([...value, trimmed]);
2585
2589
  setInputValue("");
2586
2590
  };
2587
- const removeTag = (index) => {
2588
- const newTags = value.filter((_, i2) => i2 !== index);
2591
+ const removeTag = (index2) => {
2592
+ const newTags = value.filter((_, i2) => i2 !== index2);
2589
2593
  onChange(newTags);
2590
2594
  };
2591
2595
  const handleKeyDown = (e2) => {
@@ -2924,8 +2928,8 @@ function buildLocalizeFn(args) {
2924
2928
  const width = options?.width ? String(options.width) : args.defaultWidth;
2925
2929
  valuesArray = args.values[width] || args.values[defaultWidth];
2926
2930
  }
2927
- const index = args.argumentCallback ? args.argumentCallback(value) : value;
2928
- return valuesArray[index];
2931
+ const index2 = args.argumentCallback ? args.argumentCallback(value) : value;
2932
+ return valuesArray[index2];
2929
2933
  };
2930
2934
  }
2931
2935
 
@@ -3245,7 +3249,7 @@ var match = {
3245
3249
  defaultMatchWidth: "wide",
3246
3250
  parsePatterns: parseQuarterPatterns,
3247
3251
  defaultParseWidth: "any",
3248
- valueCallback: (index) => index + 1
3252
+ valueCallback: (index2) => index2 + 1
3249
3253
  }),
3250
3254
  month: buildMatchFn({
3251
3255
  matchPatterns: matchMonthPatterns,
@@ -4687,7 +4691,8 @@ var AdvanceSearch = ({
4687
4691
  portalId,
4688
4692
  iconColor = "#ffffff",
4689
4693
  limitRows = 4,
4690
- onSearch
4694
+ onSearch,
4695
+ onClear
4691
4696
  }) => {
4692
4697
  const fieldsData = useMemo(() => fields || [], [fields]);
4693
4698
  const {
@@ -4730,6 +4735,8 @@ var AdvanceSearch = ({
4730
4735
  return { [r2.fieldName]: { startsWith: val1 } };
4731
4736
  case "endsWith":
4732
4737
  return { [r2.fieldName]: { endsWith: val1 } };
4738
+ case "equals":
4739
+ return { [r2.fieldName]: { equals: val1 } };
4733
4740
  case "notEquals":
4734
4741
  return { [r2.fieldName]: { not: val1 } };
4735
4742
  case "gt":
@@ -4756,8 +4763,12 @@ var AdvanceSearch = ({
4756
4763
  return { [r2.fieldName]: { hasEvery: String(val1).split(",") } };
4757
4764
  case "containsOnly":
4758
4765
  return { [r2.fieldName]: { equals: String(val1).split(",") } };
4759
- default:
4760
- return { [r2.fieldName]: val1 };
4766
+ case "on":
4767
+ return { [r2.fieldName]: { on: val1 } };
4768
+ case "after":
4769
+ return { [r2.fieldName]: { after: val1 } };
4770
+ case "before":
4771
+ return { [r2.fieldName]: { before: val1 } };
4761
4772
  }
4762
4773
  }).filter(Boolean)
4763
4774
  };
@@ -4813,7 +4824,7 @@ var AdvanceSearch = ({
4813
4824
  onClick: () => {
4814
4825
  clearAllRow();
4815
4826
  Object.keys(getValues()).forEach((k) => resetField(k));
4816
- onSubmit();
4827
+ if (onClear) onClear();
4817
4828
  },
4818
4829
  children: "Clear Search"
4819
4830
  }