@starasia/dropdown 5.6.0 → 6.0.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.
@@ -1,10 +1,9 @@
1
1
  import { jsxs as d, jsx as n, Fragment as rn } from "react/jsx-runtime";
2
- import hn, { useState as L, useRef as J, useEffect as x, forwardRef as Nn } from "react";
3
- const Cn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
4
- * {
2
+ import hn, { useState as L, useRef as J, useEffect as v, forwardRef as Nn } from "react";
3
+ const Cn = `* {
5
4
  margin: 0;
6
5
  padding: 0;
7
- font-family: "Poppins", sans-serif;
6
+ font-family: var(--sa-font-family, "Inter", sans-serif);
8
7
  box-sizing: border-box;
9
8
  }
10
9
 
@@ -265,7 +264,7 @@ const Cn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
265
264
  width: 100%;
266
265
  display: flex;
267
266
  flex-direction: column;
268
- font-family: "Poppins", sans-serif;
267
+ font-family: var(--sa-font-family, "Inter", sans-serif);
269
268
  }
270
269
 
271
270
  /* === SEARCH BAR === */
@@ -460,7 +459,7 @@ const Cn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
460
459
  flex-direction: column;
461
460
  gap: 8px;
462
461
  width: max-content;
463
- font-family: "Poppins", sans-serif;
462
+ font-family: var(--sa-font-family, "Inter", sans-serif);
464
463
  }
465
464
  .sa-select-field-fullwidth {
466
465
  width: 100%;
@@ -583,7 +582,7 @@ function En(o) {
583
582
  const [t, i] = L(o), l = J(null), p = (s) => {
584
583
  l.current && !l.current.contains(s.target) && i(!1);
585
584
  };
586
- return x(() => (document.addEventListener("click", p, !0), () => {
585
+ return v(() => (document.addEventListener("click", p, !0), () => {
587
586
  document.removeEventListener("click", p, !0);
588
587
  }), []), { ref: l, isComponentVisible: t, setIsComponentVisible: i };
589
588
  }
@@ -650,17 +649,17 @@ const zn = ({ ...o }) => /* @__PURE__ */ d(
650
649
  handleChangeValue: T,
651
650
  multiSelect: E,
652
651
  searchValue: m,
653
- highlightedIndex: k,
652
+ highlightedIndex: y,
654
653
  footer: $,
655
654
  groupLabel: q,
656
- onSelectAll: y,
655
+ onSelectAll: k,
657
656
  emptyState: K
658
657
  }, X) => {
659
- const A = J([]), H = m !== void 0, [Y, Z] = L(""), M = H ? m : Y, c = !t || t.length === 0;
660
- x(() => {
658
+ const I = J([]), H = m !== void 0, [Y, Z] = L(""), A = H ? m : Y, c = !t || t.length === 0;
659
+ v(() => {
661
660
  var a;
662
- k >= 0 && A.current[k] && ((a = A.current[k]) == null || a.scrollIntoView({ block: "nearest" }));
663
- }, [k]);
661
+ y >= 0 && I.current[y] && ((a = I.current[y]) == null || a.scrollIntoView({ block: "nearest" }));
662
+ }, [y]);
664
663
  const Q = l && !p ? /* @__PURE__ */ d("div", { className: "sa-input-dropdown-container-dropdown-search", children: [
665
664
  /* @__PURE__ */ n(zn, { strokeWidth: 2, width: 16, style: { flexShrink: 0, color: "var(--sa-dropdown-placeholder-subtle)" } }),
666
665
  /* @__PURE__ */ n(
@@ -669,7 +668,7 @@ const zn = ({ ...o }) => /* @__PURE__ */ d(
669
668
  onChange: (a) => {
670
669
  H || Z(a.target.value), s && s(a.target.value);
671
670
  },
672
- value: M,
671
+ value: A,
673
672
  autoFocus: !0,
674
673
  placeholder: "Search..."
675
674
  }
@@ -696,42 +695,42 @@ const zn = ({ ...o }) => /* @__PURE__ */ d(
696
695
  {
697
696
  className: `sa-input-dropdown-item-container ${E ? "multi" : ""}`,
698
697
  children: [
699
- c && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-empty", children: K ?? (M ? /* @__PURE__ */ d(rn, { children: [
698
+ c && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-empty", children: K ?? (A ? /* @__PURE__ */ d(rn, { children: [
700
699
  "No results for",
701
700
  " ",
702
701
  /* @__PURE__ */ d("span", { className: "sa-input-dropdown-empty-query", children: [
703
702
  "“",
704
- M,
703
+ A,
705
704
  "”"
706
705
  ] })
707
706
  ] }) : "No data available") }),
708
707
  q && !c && /* @__PURE__ */ d("div", { className: "sa-input-dropdown-section-header", children: [
709
708
  /* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children: q }),
710
- E && y && /* @__PURE__ */ n(
709
+ E && k && /* @__PURE__ */ n(
711
710
  "button",
712
711
  {
713
712
  className: "sa-input-dropdown-section-select-all",
714
713
  onClick: (a) => {
715
- a.stopPropagation(), y();
714
+ a.stopPropagation(), k();
716
715
  },
717
716
  children: "Select all"
718
717
  }
719
718
  )
720
719
  ] }),
721
- t == null ? void 0 : t.map((a, O) => {
722
- const z = !!(j != null && j.find((S) => S.value === a.value)), P = !!a.description;
720
+ t == null ? void 0 : t.map((a, M) => {
721
+ const z = !!(j != null && j.find((S) => S.value === a.value)), O = !!a.description;
723
722
  return /* @__PURE__ */ d(
724
723
  "div",
725
724
  {
726
725
  className: [
727
726
  "sa-input-dropdown-item",
728
- P ? "has-description" : "",
727
+ O ? "has-description" : "",
729
728
  z ? "active" : "",
730
- O === k ? "highlight" : "",
729
+ M === y ? "highlight" : "",
731
730
  a.disable ? "sa-input-dropdown-item-disable" : ""
732
731
  ].filter(Boolean).join(" "),
733
732
  ref: (S) => {
734
- A.current[O] = S;
733
+ I.current[M] = S;
735
734
  },
736
735
  onClick: () => T(a.label, a.value),
737
736
  children: [
@@ -761,7 +760,7 @@ const zn = ({ ...o }) => /* @__PURE__ */ d(
761
760
  ] })
762
761
  ]
763
762
  },
764
- O
763
+ M
765
764
  );
766
765
  })
767
766
  ]
@@ -776,7 +775,7 @@ const zn = ({ ...o }) => /* @__PURE__ */ d(
776
775
  children: o,
777
776
  handleChangePosition: t,
778
777
  enabled: i = !0
779
- }) => (x(() => {
778
+ }) => (v(() => {
780
779
  if (i)
781
780
  return window.addEventListener("scroll", t, !0), () => {
782
781
  window.removeEventListener("scroll", t, !0);
@@ -799,24 +798,24 @@ const Sn = ({
799
798
  iconLeft: T,
800
799
  placeholder: E,
801
800
  onSearch: m,
802
- error: k,
801
+ error: y,
803
802
  onBlur: $,
804
803
  onFocus: q,
805
- disable: y,
804
+ disable: k,
806
805
  searchValue: K,
807
806
  variant: X = "outline",
808
- footer: A,
807
+ footer: I,
809
808
  groupLabel: H,
810
809
  onSelectAll: Y,
811
810
  emptyState: Z,
812
- fullWidth: M = !0,
811
+ fullWidth: A = !0,
813
812
  triggerInput: c = !1,
814
813
  clearOnSelect: Q = !1,
815
814
  hideChevronIcon: a = !1,
816
- clearable: O = !1,
815
+ clearable: M = !1,
817
816
  onClear: z,
818
817
  /* field wrapper */
819
- label: P,
818
+ label: O,
820
819
  labelPosition: S = "outside-top",
821
820
  required: an,
822
821
  optional: tn,
@@ -827,24 +826,24 @@ const Sn = ({
827
826
  const _ = [
828
827
  "sa-select-field",
829
828
  `sa-select-field-size-${p}`,
830
- M ? "sa-select-field-fullwidth" : ""
831
- ].filter(Boolean).join(" "), N = l !== void 0, V = J(), fn = k || !!h, [u, D] = L(
829
+ A ? "sa-select-field-fullwidth" : ""
830
+ ].filter(Boolean).join(" "), N = l !== void 0, V = J(), fn = y || !!h, [u, D] = L(
832
831
  N ? l || [] : i || []
833
- ), [bn, sn] = L(""), [v, nn] = L(-1), [dn, G] = L(
832
+ ), [bn, sn] = L(""), [x, nn] = L(-1), [dn, G] = L(
834
833
  () => {
835
834
  var e, r;
836
835
  return !s && (l != null && l.length || i != null && i.length) ? ((e = l == null ? void 0 : l[0]) == null ? void 0 : e.label) ?? ((r = i == null ? void 0 : i[0]) == null ? void 0 : r.label) ?? "" : "";
837
836
  }
838
- ), b = J(null), { isComponentVisible: w, ref: en, setIsComponentVisible: C } = En(!1), I = o !== void 0, ln = u.length > 0, gn = (e) => {
837
+ ), b = J(null), { isComponentVisible: w, ref: en, setIsComponentVisible: C } = En(!1), W = o !== void 0, ln = u.length > 0, gn = (e) => {
839
838
  e.stopPropagation();
840
839
  const r = [];
841
840
  N || D(r), t(r), c && G(""), z == null || z();
842
- }, xn = () => {
843
- I && C((e) => !e);
841
+ }, vn = () => {
842
+ W && C((e) => !e);
844
843
  }, U = (e, r) => {
845
844
  if (s) {
846
845
  if (u == null ? void 0 : u.find((g) => g.value === r)) {
847
- const g = u.filter((yn) => yn.value !== r);
846
+ const g = u.filter((kn) => kn.value !== r);
848
847
  N || D(g), t(g);
849
848
  } else {
850
849
  const g = [...u, { label: e, value: r }];
@@ -856,12 +855,12 @@ const Sn = ({
856
855
  N || D(f), t(f), c && G(Q ? "" : e), C(!1);
857
856
  }
858
857
  };
859
- x(() => {
858
+ v(() => {
860
859
  N && D(l || []);
861
- }, [l]), x(() => {
860
+ }, [l]), v(() => {
862
861
  N || JSON.stringify(V.current) === JSON.stringify(i) || (V.current = i, D(V.current || []));
863
862
  }, [i]);
864
- const vn = () => u.length ? s ? u == null ? void 0 : u.map((e, r) => /* @__PURE__ */ d("div", { className: "sa-input-dropdown-preview-item", children: [
863
+ const xn = () => u.length ? s ? u == null ? void 0 : u.map((e, r) => /* @__PURE__ */ d("div", { className: "sa-input-dropdown-preview-item", children: [
865
864
  /* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: e == null ? void 0 : e.label }),
866
865
  /* @__PURE__ */ n(
867
866
  wn,
@@ -871,28 +870,28 @@ const Sn = ({
871
870
  }
872
871
  }
873
872
  )
874
- ] }, r)) : /* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: u == null ? void 0 : u[0].label }) : /* @__PURE__ */ n("p", { className: "sa-input-dropdown-placeholder", children: E }), W = () => {
873
+ ] }, r)) : /* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: u == null ? void 0 : u[0].label }) : /* @__PURE__ */ n("p", { className: "sa-input-dropdown-placeholder", children: E }), P = () => {
875
874
  if (en.current && b.current) {
876
875
  const e = window.innerHeight, r = en.current.getBoundingClientRect(), f = b.current.getBoundingClientRect(), g = r.bottom + f.height;
877
876
  b.current.style.left = `${r.left}px`, b.current.style.width = `${r.width}px`, g >= e - 10 ? (b.current.style.top = `${r.top - f.height - 5}px`, sn("top")) : (b.current.style.top = `${r.top + r.height + 4}px`, sn("bottom"));
878
877
  }
879
878
  };
880
- x(() => (window.addEventListener("resize", W), () => {
881
- window.removeEventListener("resize", W);
882
- }), []), x(() => {
883
- W();
884
- }, [w]), x(() => {
879
+ v(() => (window.addEventListener("resize", P), () => {
880
+ window.removeEventListener("resize", P);
881
+ }), []), v(() => {
882
+ P();
883
+ }, [w]), v(() => {
885
884
  if (!w || !b.current)
886
885
  return;
887
886
  const e = new ResizeObserver(() => {
888
- W();
887
+ P();
889
888
  });
890
889
  return e.observe(b.current), () => e.disconnect();
891
- }, [w]), x(() => {
890
+ }, [w]), v(() => {
892
891
  w || nn(-1);
893
892
  }, [w]);
894
893
  const pn = (e) => {
895
- if (I) {
894
+ if (W) {
896
895
  if (!w) {
897
896
  (e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), C(!0));
898
897
  return;
@@ -900,20 +899,20 @@ const Sn = ({
900
899
  switch (e.key) {
901
900
  case "ArrowDown": {
902
901
  e.preventDefault();
903
- const r = un(o, v, 1);
902
+ const r = un(o, x, 1);
904
903
  r !== -1 && nn(r);
905
904
  break;
906
905
  }
907
906
  case "ArrowUp": {
908
907
  e.preventDefault();
909
- const r = un(o, v, -1);
908
+ const r = un(o, x, -1);
910
909
  r !== -1 && nn(r);
911
910
  break;
912
911
  }
913
912
  case "Enter": {
914
- e.preventDefault(), v >= 0 && o[v] && !o[v].disable && U(
915
- o[v].label,
916
- o[v].value
913
+ e.preventDefault(), x >= 0 && o[x] && !o[x].disable && U(
914
+ o[x].label,
915
+ o[x].value
917
916
  );
918
917
  break;
919
918
  }
@@ -922,7 +921,7 @@ const Sn = ({
922
921
  break;
923
922
  }
924
923
  }
925
- }, F = p === "lg" || p === "xl" ? 20 : p === "xs" ? 14 : 16, mn = O && !y ? /* @__PURE__ */ n(
924
+ }, F = p === "lg" || p === "xl" ? 20 : p === "xs" ? 14 : 16, mn = M && !k ? /* @__PURE__ */ n(
926
925
  "button",
927
926
  {
928
927
  type: "button",
@@ -934,7 +933,7 @@ const Sn = ({
934
933
  onMouseDown: (e) => e.preventDefault(),
935
934
  children: /* @__PURE__ */ n(jn, { width: F, height: F })
936
935
  }
937
- ) : null, kn = c ? /* @__PURE__ */ d(rn, { children: [
936
+ ) : null, yn = c ? /* @__PURE__ */ d(rn, { children: [
938
937
  s && u.map((e, r) => /* @__PURE__ */ d("div", { className: "sa-input-dropdown-preview-item", children: [
939
938
  /* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: e == null ? void 0 : e.label }),
940
939
  /* @__PURE__ */ n(
@@ -953,23 +952,23 @@ const Sn = ({
953
952
  value: dn,
954
953
  onChange: (e) => {
955
954
  const r = e.target.value;
956
- G(r), m == null || m(r), !w && I && C(!0);
955
+ G(r), m == null || m(r), !w && W && C(!0);
957
956
  },
958
957
  onFocus: () => {
959
- !y && I && C(!0);
958
+ !k && W && C(!0);
960
959
  },
961
960
  onBlur: () => {
962
961
  s || setTimeout(() => C(!1), 150);
963
962
  },
964
963
  onKeyDown: pn,
965
964
  placeholder: u.length === 0 || s ? E : void 0,
966
- disabled: y
965
+ disabled: k
967
966
  }
968
967
  )
969
968
  ] }) : null, on = /* @__PURE__ */ n(
970
969
  Dn,
971
970
  {
972
- handleChangePosition: W,
971
+ handleChangePosition: P,
973
972
  enabled: w,
974
973
  children: /* @__PURE__ */ d(
975
974
  "div",
@@ -981,10 +980,10 @@ const Sn = ({
981
980
  c ? "trigger-input" : "",
982
981
  w ? "active" : "",
983
982
  fn ? "error" : "",
984
- y ? "disable" : ""
983
+ k ? "disable" : ""
985
984
  ].filter(Boolean).join(" "),
986
985
  ref: en,
987
- onClick: c ? void 0 : xn,
986
+ onClick: c ? void 0 : vn,
988
987
  onKeyDown: c ? void 0 : pn,
989
988
  tabIndex: c ? void 0 : 0,
990
989
  onBlur: c ? void 0 : $,
@@ -995,11 +994,11 @@ const Sn = ({
995
994
  width: F,
996
995
  style: { color: "var(--sa-dropdown-placeholder)", flexShrink: 0 }
997
996
  }) : null,
998
- /* @__PURE__ */ n("div", { className: "sa-input-dropdown-container-preview-item", children: c ? kn : vn() }),
997
+ /* @__PURE__ */ n("div", { className: "sa-input-dropdown-container-preview-item", children: c ? yn : xn() }),
999
998
  mn,
1000
- !a && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-chevron", children: w ? /* @__PURE__ */ n(Mn, { width: F }) : /* @__PURE__ */ n(An, { width: F }) })
999
+ !a && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-chevron", children: w ? /* @__PURE__ */ n(An, { width: F }) : /* @__PURE__ */ n(In, { width: F }) })
1001
1000
  ] }),
1002
- I && /* @__PURE__ */ n(
1001
+ W && /* @__PURE__ */ n(
1003
1002
  Bn,
1004
1003
  {
1005
1004
  dropdownLists: o,
@@ -1013,8 +1012,8 @@ const Sn = ({
1013
1012
  ref: b,
1014
1013
  multiSelect: s,
1015
1014
  searchValue: c ? dn : K,
1016
- highlightedIndex: v,
1017
- footer: A,
1015
+ highlightedIndex: x,
1016
+ footer: I,
1018
1017
  groupLabel: H,
1019
1018
  onSelectAll: Y,
1020
1019
  emptyState: Z
@@ -1025,10 +1024,10 @@ const Sn = ({
1025
1024
  )
1026
1025
  }
1027
1026
  );
1028
- return P ? S === "outside-left" ? /* @__PURE__ */ d("div", { className: `${_} sa-select-field-left`, children: [
1027
+ return O ? S === "outside-left" ? /* @__PURE__ */ d("div", { className: `${_} sa-select-field-left`, children: [
1029
1028
  /* @__PURE__ */ d("div", { className: "sa-select-field-left-label", children: [
1030
1029
  /* @__PURE__ */ d("div", { className: "sa-select-field-label-row", children: [
1031
- /* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: P }),
1030
+ /* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: O }),
1032
1031
  tn && /* @__PURE__ */ n("span", { className: "sa-select-field-optional-badge", children: "Optional" }),
1033
1032
  an && /* @__PURE__ */ n("span", { className: "sa-select-field-required", children: "*" })
1034
1033
  ] }),
@@ -1041,7 +1040,7 @@ const Sn = ({
1041
1040
  ] })
1042
1041
  ] }) : /* @__PURE__ */ d("div", { className: _, children: [
1043
1042
  /* @__PURE__ */ d("div", { className: "sa-select-field-label-row", children: [
1044
- /* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: P }),
1043
+ /* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: O }),
1045
1044
  tn && /* @__PURE__ */ n("span", { className: "sa-select-field-optional-badge", children: "Optional" }),
1046
1045
  an && /* @__PURE__ */ n("span", { className: "sa-select-field-required", children: "*" })
1047
1046
  ] }),
@@ -1096,7 +1095,7 @@ const Sn = ({
1096
1095
  }
1097
1096
  )
1098
1097
  }
1099
- ), An = ({ width: o = 16 }) => /* @__PURE__ */ n(
1098
+ ), In = ({ width: o = 16 }) => /* @__PURE__ */ n(
1100
1099
  "svg",
1101
1100
  {
1102
1101
  xmlns: "http://www.w3.org/2000/svg",
@@ -1116,7 +1115,7 @@ const Sn = ({
1116
1115
  }
1117
1116
  )
1118
1117
  }
1119
- ), Mn = ({ width: o = 16 }) => /* @__PURE__ */ n(
1118
+ ), An = ({ width: o = 16 }) => /* @__PURE__ */ n(
1120
1119
  "svg",
1121
1120
  {
1122
1121
  xmlns: "http://www.w3.org/2000/svg",
@@ -1,8 +1,7 @@
1
- (function(x,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],n):(x=typeof globalThis<"u"?globalThis:x||self,n(x.Dropdown={},x.jsxRuntime,x.React))})(this,function(x,n,s){"use strict";const cn=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
2
- * {
1
+ (function(v,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],n):(v=typeof globalThis<"u"?globalThis:v||self,n(v.Dropdown={},v.jsxRuntime,v.React))})(this,function(v,n,s){"use strict";const cn=`* {
3
2
  margin: 0;
4
3
  padding: 0;
5
- font-family: "Poppins", sans-serif;
4
+ font-family: var(--sa-font-family, "Inter", sans-serif);
6
5
  box-sizing: border-box;
7
6
  }
8
7
 
@@ -263,7 +262,7 @@
263
262
  width: 100%;
264
263
  display: flex;
265
264
  flex-direction: column;
266
- font-family: "Poppins", sans-serif;
265
+ font-family: var(--sa-font-family, "Inter", sans-serif);
267
266
  }
268
267
 
269
268
  /* === SEARCH BAR === */
@@ -458,7 +457,7 @@
458
457
  flex-direction: column;
459
458
  gap: 8px;
460
459
  width: max-content;
461
- font-family: "Poppins", sans-serif;
460
+ font-family: var(--sa-font-family, "Inter", sans-serif);
462
461
  }
463
462
  .sa-select-field-fullwidth {
464
463
  width: 100%;
@@ -576,4 +575,4 @@
576
575
  display: none;
577
576
  }
578
577
 
579
- `;function wn(o){const[t,d]=s.useState(o),l=s.useRef(null),p=i=>{l.current&&!l.current.contains(i.target)&&d(!1)};return s.useEffect(()=>(document.addEventListener("click",p,!0),()=>{document.removeEventListener("click",p,!0)}),[]),{ref:l,isComponentVisible:t,setIsComponentVisible:d}}const hn=({...o})=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...o,viewBox:"0 0 20 20",fill:"none",children:[n.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),fn=({width:o=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 16 16",fill:"none",children:n.jsx("path",{d:"M3.5 8L6.5 11L12.5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),un=s.forwardRef(({positionDropdown:o,dropdownLists:t,isComponentVisible:d,searchAble:l,hideSearch:p,onSearch:i,value:L,handleChangeValue:T,multiSelect:C,searchValue:m,highlightedIndex:y,footer:q,groupLabel:$,onSelectAll:k,emptyState:J},K)=>{const j=s.useRef([]),H=m!==void 0,[X,Y]=s.useState(""),A=H?m:X,c=!t||t.length===0;s.useEffect(()=>{var a;y>=0&&j.current[y]&&((a=j.current[y])==null||a.scrollIntoView({block:"nearest"}))},[y]);const Z=l&&!p?n.jsxs("div",{className:"sa-input-dropdown-container-dropdown-search",children:[n.jsx(hn,{strokeWidth:2,width:16,style:{flexShrink:0,color:"var(--sa-dropdown-placeholder-subtle)"}}),n.jsx("input",{onChange:a=>{H||Y(a.target.value),i&&i(a.target.value)},value:A,autoFocus:!0,placeholder:"Search..."})]}):null;return n.jsx(n.Fragment,{children:d?n.jsxs("div",{className:["sa-input-dropdown-lists-container",o==="top"?"search-bottom":""].filter(Boolean).join(" "),onClick:a=>a.stopPropagation(),ref:K,children:[Z,n.jsxs("div",{className:`sa-input-dropdown-item-container ${C?"multi":""}`,children:[c&&n.jsx("div",{className:"sa-input-dropdown-empty",children:J??(A?n.jsxs(n.Fragment,{children:["No results for"," ",n.jsxs("span",{className:"sa-input-dropdown-empty-query",children:["“",A,"”"]})]}):"No data available")}),$&&!c&&n.jsxs("div",{className:"sa-input-dropdown-section-header",children:[n.jsx("span",{className:"sa-input-dropdown-section-label",children:$}),C&&k&&n.jsx("button",{className:"sa-input-dropdown-section-select-all",onClick:a=>{a.stopPropagation(),k()},children:"Select all"})]}),t==null?void 0:t.map((a,M)=>{const z=!!(L!=null&&L.find(P=>P.value===a.value)),O=!!a.description;return n.jsxs("div",{className:["sa-input-dropdown-item",O?"has-description":"",z?"active":"",M===y?"highlight":"",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),ref:P=>{j.current[M]=P},onClick:()=>T(a.label,a.value),children:[C&&n.jsx("div",{className:"sa-input-dropdown-item-check",children:z&&n.jsx(fn,{width:16})}),a.icon&&n.jsx("div",{style:{flexShrink:0,display:"flex"},children:s.cloneElement(a.icon,{width:16})}),n.jsxs("div",{style:{minWidth:0,flex:1},children:[n.jsx("p",{className:["sa-input-dropdown-item-text",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:a.label}),a.description&&n.jsx("p",{className:["sa-input-dropdown-item-text-description",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:a.description})]})]},M)})]}),q&&n.jsx("div",{className:"sa-input-dropdown-footer",onClick:a=>a.stopPropagation(),children:q})]}):null})}),bn=({children:o,handleChangePosition:t,enabled:d=!0})=>(s.useEffect(()=>{if(d)return window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("scroll",t,!0)}},[d,t]),n.jsx("div",{children:o})),en="sa-input-dropdown-styles";(o=>{if(!(typeof document>"u")&&!document.getElementById(en)){const t=document.createElement("style");t.id=en,t.textContent=o,document.head.appendChild(t)}})(cn);const gn=({dropdownLists:o,onChange:t,defaultValue:d,value:l,size:p="sm",multiSelect:i,searchAble:L,iconLeft:T,placeholder:C,onSearch:m,error:y,onBlur:q,onFocus:$,disable:k,searchValue:J,variant:K="outline",footer:j,groupLabel:H,onSelectAll:X,emptyState:Y,fullWidth:A=!0,triggerInput:c=!1,clearOnSelect:Z=!1,hideChevronIcon:a=!1,clearable:M=!1,onClear:z,label:O,labelPosition:P="outside-top",required:an,optional:sn,description:B,helperText:D,errorText:f})=>{const Q=["sa-select-field",`sa-select-field-size-${p}`,A?"sa-select-field-fullwidth":""].filter(Boolean).join(" "),N=l!==void 0,_=s.useRef(),yn=y||!!f,[w,S]=s.useState(N?l||[]:d||[]),[kn,tn]=s.useState(""),[v,V]=s.useState(-1),[dn,G]=s.useState(()=>{var e,r;return!i&&(l!=null&&l.length||d!=null&&d.length)?((e=l==null?void 0:l[0])==null?void 0:e.label)??((r=d==null?void 0:d[0])==null?void 0:r.label)??"":""}),b=s.useRef(null),{isComponentVisible:h,ref:R,setIsComponentVisible:E}=wn(!1),I=o!==void 0,ln=w.length>0,Nn=e=>{e.stopPropagation();const r=[];N||S(r),t(r),c&&G(""),z==null||z()},En=()=>{I&&E(e=>!e)},U=(e,r)=>{if(i){if(w==null?void 0:w.find(g=>g.value===r)){const g=w.filter(Dn=>Dn.value!==r);N||S(g),t(g)}else{const g=[...w,{label:e,value:r}];N||S(g),t(g)}c&&G("")}else{const u=[{label:e,value:r}];N||S(u),t(u),c&&G(Z?"":e),E(!1)}};s.useEffect(()=>{N&&S(l||[])},[l]),s.useEffect(()=>{N||JSON.stringify(_.current)===JSON.stringify(d)||(_.current=d,S(_.current||[]))},[d]);const Cn=()=>w.length?i?w==null?void 0:w.map((e,r)=>n.jsxs("div",{className:"sa-input-dropdown-preview-item",children:[n.jsx("p",{style:{minWidth:"max-content"},children:e==null?void 0:e.label}),n.jsx(rn,{onClick:u=>{u.stopPropagation(),U(e.label,e.value)}})]},r)):n.jsx("p",{style:{minWidth:"max-content"},children:w==null?void 0:w[0].label}):n.jsx("p",{className:"sa-input-dropdown-placeholder",children:C}),F=()=>{if(R.current&&b.current){const e=window.innerHeight,r=R.current.getBoundingClientRect(),u=b.current.getBoundingClientRect(),g=r.bottom+u.height;b.current.style.left=`${r.left}px`,b.current.style.width=`${r.width}px`,g>=e-10?(b.current.style.top=`${r.top-u.height-5}px`,tn("top")):(b.current.style.top=`${r.top+r.height+4}px`,tn("bottom"))}};s.useEffect(()=>(window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F)}),[]),s.useEffect(()=>{F()},[h]),s.useEffect(()=>{if(!h||!b.current)return;const e=new ResizeObserver(()=>{F()});return e.observe(b.current),()=>e.disconnect()},[h]),s.useEffect(()=>{h||V(-1)},[h]);const pn=e=>{if(I){if(!h){(e.key==="ArrowDown"||e.key==="Enter")&&(e.preventDefault(),E(!0));return}switch(e.key){case"ArrowDown":{e.preventDefault();const r=on(o,v,1);r!==-1&&V(r);break}case"ArrowUp":{e.preventDefault();const r=on(o,v,-1);r!==-1&&V(r);break}case"Enter":{e.preventDefault(),v>=0&&o[v]&&!o[v].disable&&U(o[v].label,o[v].value);break}case"Escape":E(!1);break}}},W=p==="lg"||p==="xl"?20:p==="xs"?14:16,zn=M&&!k?n.jsx("button",{type:"button",className:`sa-input-dropdown-clear${ln?"":" sa-input-dropdown-clear-hidden"}`,"aria-label":"Clear selection","aria-hidden":!ln,tabIndex:-1,onClick:Nn,onMouseDown:e=>e.preventDefault(),children:n.jsx(xn,{width:W,height:W})}):null,Bn=c?n.jsxs(n.Fragment,{children:[i&&w.map((e,r)=>n.jsxs("div",{className:"sa-input-dropdown-preview-item",children:[n.jsx("p",{style:{minWidth:"max-content"},children:e==null?void 0:e.label}),n.jsx(rn,{onClick:u=>{u.stopPropagation(),U(e.label,e.value)}})]},r)),n.jsx("input",{className:"sa-input-dropdown-trigger-input",value:dn,onChange:e=>{const r=e.target.value;G(r),m==null||m(r),!h&&I&&E(!0)},onFocus:()=>{!k&&I&&E(!0)},onBlur:()=>{i||setTimeout(()=>E(!1),150)},onKeyDown:pn,placeholder:w.length===0||i?C:void 0,disabled:k})]}):null,nn=n.jsx(bn,{handleChangePosition:F,enabled:h,children:n.jsxs("div",{className:["sa-input-dropdown-container",K,`sa-input-dropdown-size-${p}`,c?"trigger-input":"",h?"active":"",yn?"error":"",k?"disable":""].filter(Boolean).join(" "),ref:R,onClick:c?void 0:En,onKeyDown:c?void 0:pn,tabIndex:c?void 0:0,onBlur:c?void 0:q,onFocus:c?void 0:$,children:[n.jsxs("div",{className:"sa-input-dropdown-preview-container",children:[T?s.cloneElement(T,{width:W,style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0}}):null,n.jsx("div",{className:"sa-input-dropdown-container-preview-item",children:c?Bn:Cn()}),zn,!a&&n.jsx("div",{className:"sa-input-dropdown-chevron",children:h?n.jsx(mn,{width:W}):n.jsx(vn,{width:W})})]}),I&&n.jsx(un,{dropdownLists:o,handleChangeValue:U,isComponentVisible:h,positionDropdown:kn,searchAble:!!L,hideSearch:c,value:w,onSearch:m,ref:b,multiSelect:i,searchValue:c?dn:J,highlightedIndex:v,footer:j,groupLabel:H,onSelectAll:X,emptyState:Y})]})});return O?P==="outside-left"?n.jsxs("div",{className:`${Q} sa-select-field-left`,children:[n.jsxs("div",{className:"sa-select-field-left-label",children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:O}),sn&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),an&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),B&&n.jsx("p",{className:"sa-select-field-helper-top",children:B})]}),n.jsxs("div",{className:"sa-select-field-input-wrap",children:[nn,D&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:D}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]})]}):n.jsxs("div",{className:Q,children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:O}),sn&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),an&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),B&&n.jsx("p",{className:"sa-select-field-helper-top",children:B}),nn,D&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:D}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]}):n.jsxs("div",{className:Q,children:[B&&n.jsx("p",{className:"sa-select-field-helper-top",children:B}),nn,D&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:D}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]})},on=(o,t,d)=>{const l=o.length;let p=t+d;for(;p>=0&&p<l;){if(!o[p].disable)return p;p+=d}if(d===1){for(let i=0;i<l;i++)if(!o[i].disable)return i}else for(let i=l-1;i>=0;i--)if(!o[i].disable)return i;return-1},xn=o=>n.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:[n.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"currentColor",opacity:"0.2"}),n.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]}),rn=o=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 18 18",fill:"none",style:{flexShrink:0,cursor:"pointer"},...o,children:n.jsx("path",{d:"M12 6L6 12M6.00001 6L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),vn=({width:o=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0},children:n.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),mn=({width:o=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0},children:n.jsx("path",{d:"M4 10L8 6L12 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});x.Dropdown=gn,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
578
+ `;function wn(o){const[t,d]=s.useState(o),l=s.useRef(null),p=i=>{l.current&&!l.current.contains(i.target)&&d(!1)};return s.useEffect(()=>(document.addEventListener("click",p,!0),()=>{document.removeEventListener("click",p,!0)}),[]),{ref:l,isComponentVisible:t,setIsComponentVisible:d}}const hn=({...o})=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...o,viewBox:"0 0 20 20",fill:"none",children:[n.jsx("circle",{cx:"9.80547",cy:"9.8055",r:"7.49047",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M15.0153 15.4043L17.9519 18.3333",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),fn=({width:o=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 16 16",fill:"none",children:n.jsx("path",{d:"M3.5 8L6.5 11L12.5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),un=s.forwardRef(({positionDropdown:o,dropdownLists:t,isComponentVisible:d,searchAble:l,hideSearch:p,onSearch:i,value:L,handleChangeValue:T,multiSelect:C,searchValue:m,highlightedIndex:y,footer:q,groupLabel:$,onSelectAll:k,emptyState:J},K)=>{const j=s.useRef([]),H=m!==void 0,[X,Y]=s.useState(""),I=H?m:X,c=!t||t.length===0;s.useEffect(()=>{var a;y>=0&&j.current[y]&&((a=j.current[y])==null||a.scrollIntoView({block:"nearest"}))},[y]);const Z=l&&!p?n.jsxs("div",{className:"sa-input-dropdown-container-dropdown-search",children:[n.jsx(hn,{strokeWidth:2,width:16,style:{flexShrink:0,color:"var(--sa-dropdown-placeholder-subtle)"}}),n.jsx("input",{onChange:a=>{H||Y(a.target.value),i&&i(a.target.value)},value:I,autoFocus:!0,placeholder:"Search..."})]}):null;return n.jsx(n.Fragment,{children:d?n.jsxs("div",{className:["sa-input-dropdown-lists-container",o==="top"?"search-bottom":""].filter(Boolean).join(" "),onClick:a=>a.stopPropagation(),ref:K,children:[Z,n.jsxs("div",{className:`sa-input-dropdown-item-container ${C?"multi":""}`,children:[c&&n.jsx("div",{className:"sa-input-dropdown-empty",children:J??(I?n.jsxs(n.Fragment,{children:["No results for"," ",n.jsxs("span",{className:"sa-input-dropdown-empty-query",children:["“",I,"”"]})]}):"No data available")}),$&&!c&&n.jsxs("div",{className:"sa-input-dropdown-section-header",children:[n.jsx("span",{className:"sa-input-dropdown-section-label",children:$}),C&&k&&n.jsx("button",{className:"sa-input-dropdown-section-select-all",onClick:a=>{a.stopPropagation(),k()},children:"Select all"})]}),t==null?void 0:t.map((a,A)=>{const z=!!(L!=null&&L.find(O=>O.value===a.value)),M=!!a.description;return n.jsxs("div",{className:["sa-input-dropdown-item",M?"has-description":"",z?"active":"",A===y?"highlight":"",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),ref:O=>{j.current[A]=O},onClick:()=>T(a.label,a.value),children:[C&&n.jsx("div",{className:"sa-input-dropdown-item-check",children:z&&n.jsx(fn,{width:16})}),a.icon&&n.jsx("div",{style:{flexShrink:0,display:"flex"},children:s.cloneElement(a.icon,{width:16})}),n.jsxs("div",{style:{minWidth:0,flex:1},children:[n.jsx("p",{className:["sa-input-dropdown-item-text",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:a.label}),a.description&&n.jsx("p",{className:["sa-input-dropdown-item-text-description",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:a.description})]})]},A)})]}),q&&n.jsx("div",{className:"sa-input-dropdown-footer",onClick:a=>a.stopPropagation(),children:q})]}):null})}),bn=({children:o,handleChangePosition:t,enabled:d=!0})=>(s.useEffect(()=>{if(d)return window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("scroll",t,!0)}},[d,t]),n.jsx("div",{children:o})),en="sa-input-dropdown-styles";(o=>{if(!(typeof document>"u")&&!document.getElementById(en)){const t=document.createElement("style");t.id=en,t.textContent=o,document.head.appendChild(t)}})(cn);const gn=({dropdownLists:o,onChange:t,defaultValue:d,value:l,size:p="sm",multiSelect:i,searchAble:L,iconLeft:T,placeholder:C,onSearch:m,error:y,onBlur:q,onFocus:$,disable:k,searchValue:J,variant:K="outline",footer:j,groupLabel:H,onSelectAll:X,emptyState:Y,fullWidth:I=!0,triggerInput:c=!1,clearOnSelect:Z=!1,hideChevronIcon:a=!1,clearable:A=!1,onClear:z,label:M,labelPosition:O="outside-top",required:an,optional:sn,description:B,helperText:D,errorText:f})=>{const Q=["sa-select-field",`sa-select-field-size-${p}`,I?"sa-select-field-fullwidth":""].filter(Boolean).join(" "),N=l!==void 0,_=s.useRef(),yn=y||!!f,[w,S]=s.useState(N?l||[]:d||[]),[kn,tn]=s.useState(""),[x,V]=s.useState(-1),[dn,G]=s.useState(()=>{var e,r;return!i&&(l!=null&&l.length||d!=null&&d.length)?((e=l==null?void 0:l[0])==null?void 0:e.label)??((r=d==null?void 0:d[0])==null?void 0:r.label)??"":""}),b=s.useRef(null),{isComponentVisible:h,ref:R,setIsComponentVisible:E}=wn(!1),F=o!==void 0,ln=w.length>0,Nn=e=>{e.stopPropagation();const r=[];N||S(r),t(r),c&&G(""),z==null||z()},En=()=>{F&&E(e=>!e)},U=(e,r)=>{if(i){if(w==null?void 0:w.find(g=>g.value===r)){const g=w.filter(Dn=>Dn.value!==r);N||S(g),t(g)}else{const g=[...w,{label:e,value:r}];N||S(g),t(g)}c&&G("")}else{const u=[{label:e,value:r}];N||S(u),t(u),c&&G(Z?"":e),E(!1)}};s.useEffect(()=>{N&&S(l||[])},[l]),s.useEffect(()=>{N||JSON.stringify(_.current)===JSON.stringify(d)||(_.current=d,S(_.current||[]))},[d]);const Cn=()=>w.length?i?w==null?void 0:w.map((e,r)=>n.jsxs("div",{className:"sa-input-dropdown-preview-item",children:[n.jsx("p",{style:{minWidth:"max-content"},children:e==null?void 0:e.label}),n.jsx(rn,{onClick:u=>{u.stopPropagation(),U(e.label,e.value)}})]},r)):n.jsx("p",{style:{minWidth:"max-content"},children:w==null?void 0:w[0].label}):n.jsx("p",{className:"sa-input-dropdown-placeholder",children:C}),P=()=>{if(R.current&&b.current){const e=window.innerHeight,r=R.current.getBoundingClientRect(),u=b.current.getBoundingClientRect(),g=r.bottom+u.height;b.current.style.left=`${r.left}px`,b.current.style.width=`${r.width}px`,g>=e-10?(b.current.style.top=`${r.top-u.height-5}px`,tn("top")):(b.current.style.top=`${r.top+r.height+4}px`,tn("bottom"))}};s.useEffect(()=>(window.addEventListener("resize",P),()=>{window.removeEventListener("resize",P)}),[]),s.useEffect(()=>{P()},[h]),s.useEffect(()=>{if(!h||!b.current)return;const e=new ResizeObserver(()=>{P()});return e.observe(b.current),()=>e.disconnect()},[h]),s.useEffect(()=>{h||V(-1)},[h]);const pn=e=>{if(F){if(!h){(e.key==="ArrowDown"||e.key==="Enter")&&(e.preventDefault(),E(!0));return}switch(e.key){case"ArrowDown":{e.preventDefault();const r=on(o,x,1);r!==-1&&V(r);break}case"ArrowUp":{e.preventDefault();const r=on(o,x,-1);r!==-1&&V(r);break}case"Enter":{e.preventDefault(),x>=0&&o[x]&&!o[x].disable&&U(o[x].label,o[x].value);break}case"Escape":E(!1);break}}},W=p==="lg"||p==="xl"?20:p==="xs"?14:16,zn=A&&!k?n.jsx("button",{type:"button",className:`sa-input-dropdown-clear${ln?"":" sa-input-dropdown-clear-hidden"}`,"aria-label":"Clear selection","aria-hidden":!ln,tabIndex:-1,onClick:Nn,onMouseDown:e=>e.preventDefault(),children:n.jsx(vn,{width:W,height:W})}):null,Bn=c?n.jsxs(n.Fragment,{children:[i&&w.map((e,r)=>n.jsxs("div",{className:"sa-input-dropdown-preview-item",children:[n.jsx("p",{style:{minWidth:"max-content"},children:e==null?void 0:e.label}),n.jsx(rn,{onClick:u=>{u.stopPropagation(),U(e.label,e.value)}})]},r)),n.jsx("input",{className:"sa-input-dropdown-trigger-input",value:dn,onChange:e=>{const r=e.target.value;G(r),m==null||m(r),!h&&F&&E(!0)},onFocus:()=>{!k&&F&&E(!0)},onBlur:()=>{i||setTimeout(()=>E(!1),150)},onKeyDown:pn,placeholder:w.length===0||i?C:void 0,disabled:k})]}):null,nn=n.jsx(bn,{handleChangePosition:P,enabled:h,children:n.jsxs("div",{className:["sa-input-dropdown-container",K,`sa-input-dropdown-size-${p}`,c?"trigger-input":"",h?"active":"",yn?"error":"",k?"disable":""].filter(Boolean).join(" "),ref:R,onClick:c?void 0:En,onKeyDown:c?void 0:pn,tabIndex:c?void 0:0,onBlur:c?void 0:q,onFocus:c?void 0:$,children:[n.jsxs("div",{className:"sa-input-dropdown-preview-container",children:[T?s.cloneElement(T,{width:W,style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0}}):null,n.jsx("div",{className:"sa-input-dropdown-container-preview-item",children:c?Bn:Cn()}),zn,!a&&n.jsx("div",{className:"sa-input-dropdown-chevron",children:h?n.jsx(mn,{width:W}):n.jsx(xn,{width:W})})]}),F&&n.jsx(un,{dropdownLists:o,handleChangeValue:U,isComponentVisible:h,positionDropdown:kn,searchAble:!!L,hideSearch:c,value:w,onSearch:m,ref:b,multiSelect:i,searchValue:c?dn:J,highlightedIndex:x,footer:j,groupLabel:H,onSelectAll:X,emptyState:Y})]})});return M?O==="outside-left"?n.jsxs("div",{className:`${Q} sa-select-field-left`,children:[n.jsxs("div",{className:"sa-select-field-left-label",children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:M}),sn&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),an&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),B&&n.jsx("p",{className:"sa-select-field-helper-top",children:B})]}),n.jsxs("div",{className:"sa-select-field-input-wrap",children:[nn,D&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:D}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]})]}):n.jsxs("div",{className:Q,children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:M}),sn&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),an&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),B&&n.jsx("p",{className:"sa-select-field-helper-top",children:B}),nn,D&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:D}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]}):n.jsxs("div",{className:Q,children:[B&&n.jsx("p",{className:"sa-select-field-helper-top",children:B}),nn,D&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:D}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]})},on=(o,t,d)=>{const l=o.length;let p=t+d;for(;p>=0&&p<l;){if(!o[p].disable)return p;p+=d}if(d===1){for(let i=0;i<l;i++)if(!o[i].disable)return i}else for(let i=l-1;i>=0;i--)if(!o[i].disable)return i;return-1},vn=o=>n.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:[n.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"currentColor",opacity:"0.2"}),n.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]}),rn=o=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 18 18",fill:"none",style:{flexShrink:0,cursor:"pointer"},...o,children:n.jsx("path",{d:"M12 6L6 12M6.00001 6L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),xn=({width:o=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0},children:n.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),mn=({width:o=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 16 16",fill:"none",style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0},children:n.jsx("path",{d:"M4 10L8 6L12 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});v.Dropdown=gn,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starasia/dropdown",
3
- "version": "5.6.0",
3
+ "version": "6.0.0",
4
4
  "description": "dropdown component for starasia UI",
5
5
  "author": "Prawito Hudoro",
6
6
  "main": "dist/dropdown.umd.js",