@starasia/dropdown 5.4.0 → 5.5.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,5 +1,5 @@
1
1
  import { jsxs as l, jsx as n, Fragment as sn } from "react/jsx-runtime";
2
- import ln, { useState as I, useRef as M, useEffect as x, forwardRef as yn } from "react";
2
+ import ln, { useState as I, useRef as M, useEffect as v, forwardRef as yn } from "react";
3
3
  const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
4
4
  * {
5
5
  margin: 0;
@@ -37,6 +37,15 @@ const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
37
37
  }
38
38
 
39
39
  /* === SIZE VARIANTS === */
40
+ .sa-input-dropdown-size-xs {
41
+ --baseFont: 12px;
42
+ --height: 28px;
43
+ --borderRadius: var(--sa-dropdown-radius);
44
+ --paddingInline: 8px;
45
+ --paddingBlock: 2px;
46
+ --iconSize: 14px;
47
+ --iconMarginTop: 4px;
48
+ }
40
49
  .sa-input-dropdown-size-sm {
41
50
  --baseFont: 12px;
42
51
  --height: 32px;
@@ -352,6 +361,7 @@ const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
352
361
  min-height: 32px;
353
362
  font-size: 12px;
354
363
  }
364
+ .sa-input-dropdown-size-xs .sa-input-dropdown-item,
355
365
  .sa-input-dropdown-size-sm .sa-input-dropdown-item,
356
366
  .sa-input-dropdown-size-md .sa-input-dropdown-item {
357
367
  font-size: 12px;
@@ -536,12 +546,12 @@ const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
536
546
 
537
547
  `;
538
548
  function En(o) {
539
- const [p, t] = I(o), s = M(null), d = (r) => {
540
- s.current && !s.current.contains(r.target) && t(!1);
549
+ const [p, d] = I(o), s = M(null), i = (r) => {
550
+ s.current && !s.current.contains(r.target) && d(!1);
541
551
  };
542
- return x(() => (document.addEventListener("click", d, !0), () => {
543
- document.removeEventListener("click", d, !0);
544
- }), []), { ref: s, isComponentVisible: p, setIsComponentVisible: t };
552
+ return v(() => (document.addEventListener("click", i, !0), () => {
553
+ document.removeEventListener("click", i, !0);
554
+ }), []), { ref: s, isComponentVisible: p, setIsComponentVisible: d };
545
555
  }
546
556
  const Cn = ({ ...o }) => /* @__PURE__ */ l(
547
557
  "svg",
@@ -598,9 +608,9 @@ const Cn = ({ ...o }) => /* @__PURE__ */ l(
598
608
  ({
599
609
  positionDropdown: o,
600
610
  dropdownLists: p,
601
- isComponentVisible: t,
611
+ isComponentVisible: d,
602
612
  searchAble: s,
603
- hideSearch: d,
613
+ hideSearch: i,
604
614
  onSearch: r,
605
615
  value: m,
606
616
  handleChangeValue: u,
@@ -608,21 +618,21 @@ const Cn = ({ ...o }) => /* @__PURE__ */ l(
608
618
  searchValue: L,
609
619
  highlightedIndex: y,
610
620
  footer: F,
611
- groupLabel: H,
621
+ groupLabel: T,
612
622
  onSelectAll: N
613
623
  }, U) => {
614
624
  const j = M([]);
615
- x(() => {
616
- var i;
617
- y >= 0 && j.current[y] && ((i = j.current[y]) == null || i.scrollIntoView({ block: "nearest" }));
625
+ v(() => {
626
+ var t;
627
+ y >= 0 && j.current[y] && ((t = j.current[y]) == null || t.scrollIntoView({ block: "nearest" }));
618
628
  }, [y]);
619
- const T = s && !d ? /* @__PURE__ */ l("div", { className: "sa-input-dropdown-container-dropdown-search", children: [
629
+ const H = s && !i ? /* @__PURE__ */ l("div", { className: "sa-input-dropdown-container-dropdown-search", children: [
620
630
  /* @__PURE__ */ n(Cn, { strokeWidth: 2, width: 16, style: { flexShrink: 0, color: "var(--sa-dropdown-placeholder-subtle)" } }),
621
631
  /* @__PURE__ */ n(
622
632
  "input",
623
633
  {
624
- onChange: (i) => {
625
- r && r(i.target.value);
634
+ onChange: (t) => {
635
+ r && r(t.target.value);
626
636
  },
627
637
  value: L,
628
638
  autoFocus: !0,
@@ -630,34 +640,34 @@ const Cn = ({ ...o }) => /* @__PURE__ */ l(
630
640
  }
631
641
  )
632
642
  ] }) : null;
633
- return /* @__PURE__ */ n(sn, { children: t ? /* @__PURE__ */ l(
643
+ return /* @__PURE__ */ n(sn, { children: d ? /* @__PURE__ */ l(
634
644
  "div",
635
645
  {
636
646
  className: "sa-input-dropdown-lists-container",
637
- onClick: (i) => i.stopPropagation(),
647
+ onClick: (t) => t.stopPropagation(),
638
648
  ref: U,
639
649
  children: [
640
- o !== "top" && T,
650
+ o !== "top" && H,
641
651
  /* @__PURE__ */ l(
642
652
  "div",
643
653
  {
644
654
  className: `sa-input-dropdown-item-container ${R ? "multi" : ""}`,
645
655
  children: [
646
- H && /* @__PURE__ */ l("div", { className: "sa-input-dropdown-section-header", children: [
647
- /* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children: H }),
656
+ T && /* @__PURE__ */ l("div", { className: "sa-input-dropdown-section-header", children: [
657
+ /* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children: T }),
648
658
  R && N && /* @__PURE__ */ n(
649
659
  "button",
650
660
  {
651
661
  className: "sa-input-dropdown-section-select-all",
652
- onClick: (i) => {
653
- i.stopPropagation(), N();
662
+ onClick: (t) => {
663
+ t.stopPropagation(), N();
654
664
  },
655
665
  children: "Select all"
656
666
  }
657
667
  )
658
668
  ] }),
659
- p.map((i, A) => {
660
- const $ = !!(m != null && m.find((P) => P.value === i.value)), w = !!i.description;
669
+ p.map((t, A) => {
670
+ const $ = !!(m != null && m.find((P) => P.value === t.value)), w = !!t.description;
661
671
  return /* @__PURE__ */ l(
662
672
  "div",
663
673
  {
@@ -666,34 +676,34 @@ const Cn = ({ ...o }) => /* @__PURE__ */ l(
666
676
  w ? "has-description" : "",
667
677
  $ ? "active" : "",
668
678
  A === y ? "highlight" : "",
669
- i.disable ? "sa-input-dropdown-item-disable" : ""
679
+ t.disable ? "sa-input-dropdown-item-disable" : ""
670
680
  ].filter(Boolean).join(" "),
671
681
  ref: (P) => {
672
682
  j.current[A] = P;
673
683
  },
674
- onClick: () => u(i.label, i.value),
684
+ onClick: () => u(t.label, t.value),
675
685
  children: [
676
686
  R && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-item-check", children: $ && /* @__PURE__ */ n(zn, { width: 16 }) }),
677
- i.icon && /* @__PURE__ */ n("div", { style: { flexShrink: 0, display: "flex" }, children: ln.cloneElement(i.icon, { width: 16 }) }),
687
+ t.icon && /* @__PURE__ */ n("div", { style: { flexShrink: 0, display: "flex" }, children: ln.cloneElement(t.icon, { width: 16 }) }),
678
688
  /* @__PURE__ */ l("div", { style: { minWidth: 0, flex: 1 }, children: [
679
689
  /* @__PURE__ */ n(
680
690
  "p",
681
691
  {
682
692
  className: [
683
693
  "sa-input-dropdown-item-text",
684
- i.disable ? "sa-input-dropdown-item-disable" : ""
694
+ t.disable ? "sa-input-dropdown-item-disable" : ""
685
695
  ].filter(Boolean).join(" "),
686
- children: i.label
696
+ children: t.label
687
697
  }
688
698
  ),
689
- i.description && /* @__PURE__ */ n(
699
+ t.description && /* @__PURE__ */ n(
690
700
  "p",
691
701
  {
692
702
  className: [
693
703
  "sa-input-dropdown-item-text-description",
694
- i.disable ? "sa-input-dropdown-item-disable" : ""
704
+ t.disable ? "sa-input-dropdown-item-disable" : ""
695
705
  ].filter(Boolean).join(" "),
696
- children: i.description
706
+ children: t.description
697
707
  }
698
708
  )
699
709
  ] })
@@ -705,8 +715,8 @@ const Cn = ({ ...o }) => /* @__PURE__ */ l(
705
715
  ]
706
716
  }
707
717
  ),
708
- o === "top" && T,
709
- F && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-footer", onClick: (i) => i.stopPropagation(), children: F })
718
+ o === "top" && H,
719
+ F && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-footer", onClick: (t) => t.stopPropagation(), children: F })
710
720
  ]
711
721
  }
712
722
  ) : null });
@@ -715,26 +725,26 @@ const Cn = ({ ...o }) => /* @__PURE__ */ l(
715
725
  children: o,
716
726
  handleChangePosition: p
717
727
  }) => {
718
- const t = M(null);
719
- x(() => {
728
+ const d = M(null);
729
+ v(() => {
720
730
  var m;
721
- const d = () => {
722
- if (t.current) {
723
- let u = t.current.parentElement;
731
+ const i = () => {
732
+ if (d.current) {
733
+ let u = d.current.parentElement;
724
734
  for (; u && !s(u); )
725
735
  u = u.parentElement;
726
736
  u && p();
727
737
  }
728
738
  };
729
- let r = (m = t.current) == null ? void 0 : m.parentElement;
739
+ let r = (m = d.current) == null ? void 0 : m.parentElement;
730
740
  for (; r && !s(r); )
731
741
  r = r.parentElement;
732
- return r && r.addEventListener("scroll", d), d(), () => {
733
- r && r.removeEventListener("scroll", d);
742
+ return r && r.addEventListener("scroll", i), i(), () => {
743
+ r && r.removeEventListener("scroll", i);
734
744
  };
735
745
  }, []);
736
- const s = (d) => d && (d.scrollHeight > d.clientHeight || d.scrollWidth > d.clientWidth);
737
- return /* @__PURE__ */ n("div", { ref: t, children: o });
746
+ const s = (i) => i && (i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth);
747
+ return /* @__PURE__ */ n("div", { ref: d, children: o });
738
748
  }, an = "sa-input-dropdown-styles", Bn = (o) => {
739
749
  if (!document.getElementById(an)) {
740
750
  const p = document.createElement("style");
@@ -745,9 +755,9 @@ Bn(Nn);
745
755
  const On = ({
746
756
  dropdownLists: o,
747
757
  onChange: p,
748
- defaultValue: t,
758
+ defaultValue: d,
749
759
  value: s,
750
- size: d = "md",
760
+ size: i = "sm",
751
761
  multiSelect: r,
752
762
  searchAble: m,
753
763
  iconLeft: u,
@@ -755,12 +765,12 @@ const On = ({
755
765
  onSearch: L,
756
766
  error: y,
757
767
  onBlur: F,
758
- onFocus: H,
768
+ onFocus: T,
759
769
  disable: N,
760
770
  searchValue: U,
761
771
  variant: j = "outline",
762
- footer: T,
763
- groupLabel: i,
772
+ footer: H,
773
+ groupLabel: t,
764
774
  onSelectAll: A,
765
775
  fullWidth: $ = !0,
766
776
  triggerInput: w = !1,
@@ -781,11 +791,11 @@ const On = ({
781
791
  "sa-select-field",
782
792
  $ ? "sa-select-field-fullwidth" : ""
783
793
  ].filter(Boolean).join(" "), E = s !== void 0, Q = M(), un = y || !!h, [c, S] = I(
784
- E ? s || [] : t || []
794
+ E ? s || [] : d || []
785
795
  ), [hn, en] = I(""), [k, X] = I(-1), [fn, q] = I(
786
796
  () => {
787
797
  var e, a;
788
- return !r && (s != null && s.length || t != null && t.length) ? ((e = s == null ? void 0 : s[0]) == null ? void 0 : e.label) ?? ((a = t == null ? void 0 : t[0]) == null ? void 0 : a.label) ?? "" : "";
798
+ return !r && (s != null && s.length || d != null && d.length) ? ((e = s == null ? void 0 : s[0]) == null ? void 0 : e.label) ?? ((a = d == null ? void 0 : d[0]) == null ? void 0 : a.label) ?? "" : "";
789
799
  }
790
800
  ), g = M(null), { isComponentVisible: f, ref: Y, setIsComponentVisible: C } = En(!1), O = o !== void 0, on = c.length > 0, bn = (e) => {
791
801
  e.stopPropagation();
@@ -795,12 +805,12 @@ const On = ({
795
805
  O && C((e) => !e);
796
806
  }, G = (e, a) => {
797
807
  if (r) {
798
- if (c == null ? void 0 : c.find((v) => v.value === a)) {
799
- const v = c.filter((kn) => kn.value !== a);
800
- E || S(v), p(v);
808
+ if (c == null ? void 0 : c.find((x) => x.value === a)) {
809
+ const x = c.filter((kn) => kn.value !== a);
810
+ E || S(x), p(x);
801
811
  } else {
802
- const v = [...c, { label: e, value: a }];
803
- E || S(v), p(v);
812
+ const x = [...c, { label: e, value: a }];
813
+ E || S(x), p(x);
804
814
  }
805
815
  w && q("");
806
816
  } else {
@@ -808,12 +818,12 @@ const On = ({
808
818
  E || S(b), p(b), w && q(P ? "" : e), C(!1);
809
819
  }
810
820
  };
811
- x(() => {
821
+ v(() => {
812
822
  E && S(s || []);
813
- }, [s]), x(() => {
814
- E || JSON.stringify(Q.current) === JSON.stringify(t) || (Q.current = t, S(Q.current || []));
815
- }, [t]);
816
- const vn = () => c.length ? r ? c == null ? void 0 : c.map((e, a) => /* @__PURE__ */ l("div", { className: "sa-input-dropdown-preview-item", children: [
823
+ }, [s]), v(() => {
824
+ E || JSON.stringify(Q.current) === JSON.stringify(d) || (Q.current = d, S(Q.current || []));
825
+ }, [d]);
826
+ const xn = () => c.length ? r ? c == null ? void 0 : c.map((e, a) => /* @__PURE__ */ l("div", { className: "sa-input-dropdown-preview-item", children: [
817
827
  /* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: e == null ? void 0 : e.label }),
818
828
  /* @__PURE__ */ n(
819
829
  dn,
@@ -825,22 +835,22 @@ const On = ({
825
835
  )
826
836
  ] }, a)) : /* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: c == null ? void 0 : c[0].label }) : /* @__PURE__ */ n("p", { className: "sa-input-dropdown-placeholder", children: R }), z = () => {
827
837
  if (Y.current && g.current) {
828
- const e = window.innerHeight, a = Y.current.getBoundingClientRect(), b = g.current.getBoundingClientRect(), v = a.bottom + b.height;
829
- g.current.style.left = `${a.left}px`, g.current.style.width = `${a.width}px`, v >= e - 10 ? (g.current.style.top = `${a.top - b.height - 5}px`, en("top")) : (g.current.style.top = `${a.top + a.height + 4}px`, en("bottom"));
838
+ const e = window.innerHeight, a = Y.current.getBoundingClientRect(), b = g.current.getBoundingClientRect(), x = a.bottom + b.height;
839
+ g.current.style.left = `${a.left}px`, g.current.style.width = `${a.width}px`, x >= e - 10 ? (g.current.style.top = `${a.top - b.height - 5}px`, en("top")) : (g.current.style.top = `${a.top + a.height + 4}px`, en("bottom"));
830
840
  }
831
841
  };
832
- x(() => (window.addEventListener("scroll", z), window.addEventListener("resize", z), () => {
842
+ v(() => (window.addEventListener("scroll", z), window.addEventListener("resize", z), () => {
833
843
  window.removeEventListener("scroll", z), window.removeEventListener("resize", z);
834
- }), []), x(() => {
844
+ }), []), v(() => {
835
845
  z();
836
- }, [f]), x(() => {
846
+ }, [f]), v(() => {
837
847
  if (!f || !g.current)
838
848
  return;
839
849
  const e = new ResizeObserver(() => {
840
850
  z();
841
851
  });
842
852
  return e.observe(g.current), () => e.disconnect();
843
- }, [f]), x(() => {
853
+ }, [f]), v(() => {
844
854
  f || X(-1);
845
855
  }, [f]);
846
856
  const rn = (e) => {
@@ -874,7 +884,7 @@ const On = ({
874
884
  break;
875
885
  }
876
886
  }
877
- }, W = d === "lg" || d === "xl" ? 20 : 16, xn = cn && !N ? /* @__PURE__ */ n(
887
+ }, W = i === "lg" || i === "xl" ? 20 : i === "xs" ? 14 : 16, vn = cn && !N ? /* @__PURE__ */ n(
878
888
  "button",
879
889
  {
880
890
  type: "button",
@@ -924,7 +934,7 @@ const On = ({
924
934
  className: [
925
935
  "sa-input-dropdown-container",
926
936
  j,
927
- `sa-input-dropdown-size-${d}`,
937
+ `sa-input-dropdown-size-${i}`,
928
938
  w ? "trigger-input" : "",
929
939
  f ? "active" : "",
930
940
  un ? "error" : "",
@@ -935,15 +945,15 @@ const On = ({
935
945
  onKeyDown: w ? void 0 : rn,
936
946
  tabIndex: w ? void 0 : 0,
937
947
  onBlur: w ? void 0 : F,
938
- onFocus: w ? void 0 : H,
948
+ onFocus: w ? void 0 : T,
939
949
  children: [
940
950
  /* @__PURE__ */ l("div", { className: "sa-input-dropdown-preview-container", children: [
941
951
  u ? ln.cloneElement(u, {
942
952
  width: W,
943
953
  style: { color: "var(--sa-dropdown-placeholder)", flexShrink: 0 }
944
954
  }) : null,
945
- /* @__PURE__ */ n("div", { className: "sa-input-dropdown-container-preview-item", children: w ? mn : vn() }),
946
- xn,
955
+ /* @__PURE__ */ n("div", { className: "sa-input-dropdown-container-preview-item", children: w ? mn : xn() }),
956
+ vn,
947
957
  !pn && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-chevron", children: f ? /* @__PURE__ */ n(jn, { width: W }) : /* @__PURE__ */ n(Sn, { width: W }) })
948
958
  ] }),
949
959
  O && /* @__PURE__ */ n(
@@ -961,8 +971,8 @@ const On = ({
961
971
  multiSelect: r,
962
972
  searchValue: U,
963
973
  highlightedIndex: k,
964
- footer: T,
965
- groupLabel: i,
974
+ footer: H,
975
+ groupLabel: t,
966
976
  onSelectAll: A
967
977
  }
968
978
  )
@@ -999,15 +1009,15 @@ const On = ({
999
1009
  D && !h && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: D }),
1000
1010
  h && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: h })
1001
1011
  ] });
1002
- }, tn = (o, p, t) => {
1012
+ }, tn = (o, p, d) => {
1003
1013
  const s = o.length;
1004
- let d = p + t;
1005
- for (; d >= 0 && d < s; ) {
1006
- if (!o[d].disable)
1007
- return d;
1008
- d += t;
1014
+ let i = p + d;
1015
+ for (; i >= 0 && i < s; ) {
1016
+ if (!o[i].disable)
1017
+ return i;
1018
+ i += d;
1009
1019
  }
1010
- if (t === 1) {
1020
+ if (d === 1) {
1011
1021
  for (let r = 0; r < s; r++)
1012
1022
  if (!o[r].disable)
1013
1023
  return r;
@@ -1,4 +1,4 @@
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,l){"use strict";const sn=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
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,l){"use strict";const sn=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
2
2
  * {
3
3
  margin: 0;
4
4
  padding: 0;
@@ -35,6 +35,15 @@
35
35
  }
36
36
 
37
37
  /* === SIZE VARIANTS === */
38
+ .sa-input-dropdown-size-xs {
39
+ --baseFont: 12px;
40
+ --height: 28px;
41
+ --borderRadius: var(--sa-dropdown-radius);
42
+ --paddingInline: 8px;
43
+ --paddingBlock: 2px;
44
+ --iconSize: 14px;
45
+ --iconMarginTop: 4px;
46
+ }
38
47
  .sa-input-dropdown-size-sm {
39
48
  --baseFont: 12px;
40
49
  --height: 32px;
@@ -350,6 +359,7 @@
350
359
  min-height: 32px;
351
360
  font-size: 12px;
352
361
  }
362
+ .sa-input-dropdown-size-xs .sa-input-dropdown-item,
353
363
  .sa-input-dropdown-size-sm .sa-input-dropdown-item,
354
364
  .sa-input-dropdown-size-md .sa-input-dropdown-item {
355
365
  font-size: 12px;
@@ -532,4 +542,4 @@
532
542
  display: none;
533
543
  }
534
544
 
535
- `;function dn(o){const[p,i]=l.useState(o),t=l.useRef(null),d=r=>{t.current&&!t.current.contains(r.target)&&i(!1)};return l.useEffect(()=>(document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}),[]),{ref:t,isComponentVisible:p,setIsComponentVisible:i}}const tn=({...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"})]}),ln=({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"})}),pn=l.forwardRef(({positionDropdown:o,dropdownLists:p,isComponentVisible:i,searchAble:t,hideSearch:d,onSearch:r,value:k,handleChangeValue:h,multiSelect:L,searchValue:B,highlightedIndex:m,footer:I,groupLabel:F,onSelectAll:N},G)=>{const P=l.useRef([]);l.useEffect(()=>{var s;m>=0&&P.current[m]&&((s=P.current[m])==null||s.scrollIntoView({block:"nearest"}))},[m]);const T=t&&!d?n.jsxs("div",{className:"sa-input-dropdown-container-dropdown-search",children:[n.jsx(tn,{strokeWidth:2,width:16,style:{flexShrink:0,color:"var(--sa-dropdown-placeholder-subtle)"}}),n.jsx("input",{onChange:s=>{r&&r(s.target.value)},value:B,autoFocus:!0,placeholder:"Search..."})]}):null;return n.jsx(n.Fragment,{children:i?n.jsxs("div",{className:"sa-input-dropdown-lists-container",onClick:s=>s.stopPropagation(),ref:G,children:[o!=="top"&&T,n.jsxs("div",{className:`sa-input-dropdown-item-container ${L?"multi":""}`,children:[F&&n.jsxs("div",{className:"sa-input-dropdown-section-header",children:[n.jsx("span",{className:"sa-input-dropdown-section-label",children:F}),L&&N&&n.jsx("button",{className:"sa-input-dropdown-section-select-all",onClick:s=>{s.stopPropagation(),N()},children:"Select all"})]}),p.map((s,A)=>{const H=!!(k!=null&&k.find(O=>O.value===s.value)),w=!!s.description;return n.jsxs("div",{className:["sa-input-dropdown-item",w?"has-description":"",H?"active":"",A===m?"highlight":"",s.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),ref:O=>{P.current[A]=O},onClick:()=>h(s.label,s.value),children:[L&&n.jsx("div",{className:"sa-input-dropdown-item-check",children:H&&n.jsx(ln,{width:16})}),s.icon&&n.jsx("div",{style:{flexShrink:0,display:"flex"},children:l.cloneElement(s.icon,{width:16})}),n.jsxs("div",{style:{minWidth:0,flex:1},children:[n.jsx("p",{className:["sa-input-dropdown-item-text",s.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:s.label}),s.description&&n.jsx("p",{className:["sa-input-dropdown-item-text-description",s.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:s.description})]})]},A)})]}),o==="top"&&T,I&&n.jsx("div",{className:"sa-input-dropdown-footer",onClick:s=>s.stopPropagation(),children:I})]}):null})}),cn=({children:o,handleChangePosition:p})=>{const i=l.useRef(null);l.useEffect(()=>{var k;const d=()=>{if(i.current){let h=i.current.parentElement;for(;h&&!t(h);)h=h.parentElement;h&&p()}};let r=(k=i.current)==null?void 0:k.parentElement;for(;r&&!t(r);)r=r.parentElement;return r&&r.addEventListener("scroll",d),d(),()=>{r&&r.removeEventListener("scroll",d)}},[]);const t=d=>d&&(d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth);return n.jsx("div",{ref:i,children:o})},_="sa-input-dropdown-styles";(o=>{if(!document.getElementById(_)){const p=document.createElement("style");p.id=_,p.textContent=o,document.head.appendChild(p)}})(sn);const wn=({dropdownLists:o,onChange:p,defaultValue:i,value:t,size:d="md",multiSelect:r,searchAble:k,iconLeft:h,placeholder:L,onSearch:B,error:m,onBlur:I,onFocus:F,disable:N,searchValue:G,variant:P="outline",footer:T,groupLabel:s,onSelectAll:A,fullWidth:H=!0,triggerInput:w=!1,clearOnSelect:O=!1,hideChevronIcon:bn=!1,clearable:gn=!1,onClear:U,label:K,labelPosition:vn="outside-top",required:nn,optional:en,description:S,helperText:D,errorText:f})=>{const J=["sa-select-field",H?"sa-select-field-fullwidth":""].filter(Boolean).join(" "),E=t!==void 0,Z=l.useRef(),xn=m||!!f,[c,j]=l.useState(E?t||[]:i||[]),[kn,on]=l.useState(""),[y,Q]=l.useState(-1),[yn,$]=l.useState(()=>{var e,a;return!r&&(t!=null&&t.length||i!=null&&i.length)?((e=t==null?void 0:t[0])==null?void 0:e.label)??((a=i==null?void 0:i[0])==null?void 0:a.label)??"":""}),g=l.useRef(null),{isComponentVisible:u,ref:X,setIsComponentVisible:C}=dn(!1),W=o!==void 0,rn=c.length>0,mn=e=>{e.stopPropagation();const a=[];E||j(a),p(a),w&&$(""),U==null||U()},Nn=()=>{W&&C(e=>!e)},q=(e,a)=>{if(r){if(c==null?void 0:c.find(v=>v.value===a)){const v=c.filter(Ln=>Ln.value!==a);E||j(v),p(v)}else{const v=[...c,{label:e,value:a}];E||j(v),p(v)}w&&$("")}else{const b=[{label:e,value:a}];E||j(b),p(b),w&&$(O?"":e),C(!1)}};l.useEffect(()=>{E&&j(t||[])},[t]),l.useEffect(()=>{E||JSON.stringify(Z.current)===JSON.stringify(i)||(Z.current=i,j(Z.current||[]))},[i]);const En=()=>c.length?r?c==null?void 0:c.map((e,a)=>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(R,{onClick:b=>{b.stopPropagation(),q(e.label,e.value)}})]},a)):n.jsx("p",{style:{minWidth:"max-content"},children:c==null?void 0:c[0].label}):n.jsx("p",{className:"sa-input-dropdown-placeholder",children:L}),z=()=>{if(X.current&&g.current){const e=window.innerHeight,a=X.current.getBoundingClientRect(),b=g.current.getBoundingClientRect(),v=a.bottom+b.height;g.current.style.left=`${a.left}px`,g.current.style.width=`${a.width}px`,v>=e-10?(g.current.style.top=`${a.top-b.height-5}px`,on("top")):(g.current.style.top=`${a.top+a.height+4}px`,on("bottom"))}};l.useEffect(()=>(window.addEventListener("scroll",z),window.addEventListener("resize",z),()=>{window.removeEventListener("scroll",z),window.removeEventListener("resize",z)}),[]),l.useEffect(()=>{z()},[u]),l.useEffect(()=>{if(!u||!g.current)return;const e=new ResizeObserver(()=>{z()});return e.observe(g.current),()=>e.disconnect()},[u]),l.useEffect(()=>{u||Q(-1)},[u]);const an=e=>{if(W){if(!u){(e.key==="ArrowDown"||e.key==="Enter")&&(e.preventDefault(),C(!0));return}switch(e.key){case"ArrowDown":{e.preventDefault();const a=V(o,y,1);a!==-1&&Q(a);break}case"ArrowUp":{e.preventDefault();const a=V(o,y,-1);a!==-1&&Q(a);break}case"Enter":{e.preventDefault(),y>=0&&o[y]&&!o[y].disable&&q(o[y].label,o[y].value);break}case"Escape":C(!1);break}}},M=d==="lg"||d==="xl"?20:16,Cn=gn&&!N?n.jsx("button",{type:"button",className:`sa-input-dropdown-clear${rn?"":" sa-input-dropdown-clear-hidden"}`,"aria-label":"Clear selection","aria-hidden":!rn,tabIndex:-1,onClick:mn,onMouseDown:e=>e.preventDefault(),children:n.jsx(hn,{width:M,height:M})}):null,zn=w?n.jsxs(n.Fragment,{children:[r&&c.map((e,a)=>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(R,{onClick:b=>{b.stopPropagation(),q(e.label,e.value)}})]},a)),n.jsx("input",{className:"sa-input-dropdown-trigger-input",value:yn,onChange:e=>{const a=e.target.value;$(a),B==null||B(a),!u&&W&&C(!0)},onFocus:()=>{!N&&W&&C(!0)},onBlur:()=>{r||setTimeout(()=>C(!1),150)},onKeyDown:an,placeholder:c.length===0||r?L:void 0,disabled:N})]}):null,Y=n.jsx(cn,{handleChangePosition:z,children:n.jsxs("div",{className:["sa-input-dropdown-container",P,`sa-input-dropdown-size-${d}`,w?"trigger-input":"",u?"active":"",xn?"error":"",N?"disable":""].filter(Boolean).join(" "),ref:X,onClick:w?void 0:Nn,onKeyDown:w?void 0:an,tabIndex:w?void 0:0,onBlur:w?void 0:I,onFocus:w?void 0:F,children:[n.jsxs("div",{className:"sa-input-dropdown-preview-container",children:[h?l.cloneElement(h,{width:M,style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0}}):null,n.jsx("div",{className:"sa-input-dropdown-container-preview-item",children:w?zn:En()}),Cn,!bn&&n.jsx("div",{className:"sa-input-dropdown-chevron",children:u?n.jsx(un,{width:M}):n.jsx(fn,{width:M})})]}),W&&n.jsx(pn,{dropdownLists:o,handleChangeValue:q,isComponentVisible:u,positionDropdown:kn,searchAble:!!k,hideSearch:w,value:c,onSearch:B,ref:g,multiSelect:r,searchValue:G,highlightedIndex:y,footer:T,groupLabel:s,onSelectAll:A})]})});return K?vn==="outside-left"?n.jsxs("div",{className:`${J} 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:K}),en&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),nn&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),S&&n.jsx("p",{className:"sa-select-field-helper-top",children:S})]}),n.jsxs("div",{className:"sa-select-field-input-wrap",children:[Y,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:J,children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:K}),en&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),nn&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),S&&n.jsx("p",{className:"sa-select-field-helper-top",children:S}),Y,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:J,children:[S&&n.jsx("p",{className:"sa-select-field-helper-top",children:S}),Y,D&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:D}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]})},V=(o,p,i)=>{const t=o.length;let d=p+i;for(;d>=0&&d<t;){if(!o[d].disable)return d;d+=i}if(i===1){for(let r=0;r<t;r++)if(!o[r].disable)return r}else for(let r=t-1;r>=0;r--)if(!o[r].disable)return r;return-1},hn=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"})]}),R=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"})}),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",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"})}),un=({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=wn,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
545
+ `;function dn(o){const[p,d]=l.useState(o),t=l.useRef(null),s=r=>{t.current&&!t.current.contains(r.target)&&d(!1)};return l.useEffect(()=>(document.addEventListener("click",s,!0),()=>{document.removeEventListener("click",s,!0)}),[]),{ref:t,isComponentVisible:p,setIsComponentVisible:d}}const tn=({...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"})]}),ln=({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"})}),pn=l.forwardRef(({positionDropdown:o,dropdownLists:p,isComponentVisible:d,searchAble:t,hideSearch:s,onSearch:r,value:k,handleChangeValue:h,multiSelect:L,searchValue:B,highlightedIndex:y,footer:I,groupLabel:F,onSelectAll:N},G)=>{const P=l.useRef([]);l.useEffect(()=>{var i;y>=0&&P.current[y]&&((i=P.current[y])==null||i.scrollIntoView({block:"nearest"}))},[y]);const T=t&&!s?n.jsxs("div",{className:"sa-input-dropdown-container-dropdown-search",children:[n.jsx(tn,{strokeWidth:2,width:16,style:{flexShrink:0,color:"var(--sa-dropdown-placeholder-subtle)"}}),n.jsx("input",{onChange:i=>{r&&r(i.target.value)},value:B,autoFocus:!0,placeholder:"Search..."})]}):null;return n.jsx(n.Fragment,{children:d?n.jsxs("div",{className:"sa-input-dropdown-lists-container",onClick:i=>i.stopPropagation(),ref:G,children:[o!=="top"&&T,n.jsxs("div",{className:`sa-input-dropdown-item-container ${L?"multi":""}`,children:[F&&n.jsxs("div",{className:"sa-input-dropdown-section-header",children:[n.jsx("span",{className:"sa-input-dropdown-section-label",children:F}),L&&N&&n.jsx("button",{className:"sa-input-dropdown-section-select-all",onClick:i=>{i.stopPropagation(),N()},children:"Select all"})]}),p.map((i,A)=>{const H=!!(k!=null&&k.find(O=>O.value===i.value)),w=!!i.description;return n.jsxs("div",{className:["sa-input-dropdown-item",w?"has-description":"",H?"active":"",A===y?"highlight":"",i.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),ref:O=>{P.current[A]=O},onClick:()=>h(i.label,i.value),children:[L&&n.jsx("div",{className:"sa-input-dropdown-item-check",children:H&&n.jsx(ln,{width:16})}),i.icon&&n.jsx("div",{style:{flexShrink:0,display:"flex"},children:l.cloneElement(i.icon,{width:16})}),n.jsxs("div",{style:{minWidth:0,flex:1},children:[n.jsx("p",{className:["sa-input-dropdown-item-text",i.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:i.label}),i.description&&n.jsx("p",{className:["sa-input-dropdown-item-text-description",i.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),children:i.description})]})]},A)})]}),o==="top"&&T,I&&n.jsx("div",{className:"sa-input-dropdown-footer",onClick:i=>i.stopPropagation(),children:I})]}):null})}),cn=({children:o,handleChangePosition:p})=>{const d=l.useRef(null);l.useEffect(()=>{var k;const s=()=>{if(d.current){let h=d.current.parentElement;for(;h&&!t(h);)h=h.parentElement;h&&p()}};let r=(k=d.current)==null?void 0:k.parentElement;for(;r&&!t(r);)r=r.parentElement;return r&&r.addEventListener("scroll",s),s(),()=>{r&&r.removeEventListener("scroll",s)}},[]);const t=s=>s&&(s.scrollHeight>s.clientHeight||s.scrollWidth>s.clientWidth);return n.jsx("div",{ref:d,children:o})},_="sa-input-dropdown-styles";(o=>{if(!document.getElementById(_)){const p=document.createElement("style");p.id=_,p.textContent=o,document.head.appendChild(p)}})(sn);const wn=({dropdownLists:o,onChange:p,defaultValue:d,value:t,size:s="sm",multiSelect:r,searchAble:k,iconLeft:h,placeholder:L,onSearch:B,error:y,onBlur:I,onFocus:F,disable:N,searchValue:G,variant:P="outline",footer:T,groupLabel:i,onSelectAll:A,fullWidth:H=!0,triggerInput:w=!1,clearOnSelect:O=!1,hideChevronIcon:bn=!1,clearable:gn=!1,onClear:U,label:K,labelPosition:xn="outside-top",required:nn,optional:en,description:S,helperText:D,errorText:f})=>{const J=["sa-select-field",H?"sa-select-field-fullwidth":""].filter(Boolean).join(" "),E=t!==void 0,Z=l.useRef(),vn=y||!!f,[c,j]=l.useState(E?t||[]:d||[]),[kn,on]=l.useState(""),[m,Q]=l.useState(-1),[mn,$]=l.useState(()=>{var e,a;return!r&&(t!=null&&t.length||d!=null&&d.length)?((e=t==null?void 0:t[0])==null?void 0:e.label)??((a=d==null?void 0:d[0])==null?void 0:a.label)??"":""}),g=l.useRef(null),{isComponentVisible:u,ref:X,setIsComponentVisible:C}=dn(!1),M=o!==void 0,rn=c.length>0,yn=e=>{e.stopPropagation();const a=[];E||j(a),p(a),w&&$(""),U==null||U()},Nn=()=>{M&&C(e=>!e)},q=(e,a)=>{if(r){if(c==null?void 0:c.find(x=>x.value===a)){const x=c.filter(Ln=>Ln.value!==a);E||j(x),p(x)}else{const x=[...c,{label:e,value:a}];E||j(x),p(x)}w&&$("")}else{const b=[{label:e,value:a}];E||j(b),p(b),w&&$(O?"":e),C(!1)}};l.useEffect(()=>{E&&j(t||[])},[t]),l.useEffect(()=>{E||JSON.stringify(Z.current)===JSON.stringify(d)||(Z.current=d,j(Z.current||[]))},[d]);const En=()=>c.length?r?c==null?void 0:c.map((e,a)=>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(R,{onClick:b=>{b.stopPropagation(),q(e.label,e.value)}})]},a)):n.jsx("p",{style:{minWidth:"max-content"},children:c==null?void 0:c[0].label}):n.jsx("p",{className:"sa-input-dropdown-placeholder",children:L}),z=()=>{if(X.current&&g.current){const e=window.innerHeight,a=X.current.getBoundingClientRect(),b=g.current.getBoundingClientRect(),x=a.bottom+b.height;g.current.style.left=`${a.left}px`,g.current.style.width=`${a.width}px`,x>=e-10?(g.current.style.top=`${a.top-b.height-5}px`,on("top")):(g.current.style.top=`${a.top+a.height+4}px`,on("bottom"))}};l.useEffect(()=>(window.addEventListener("scroll",z),window.addEventListener("resize",z),()=>{window.removeEventListener("scroll",z),window.removeEventListener("resize",z)}),[]),l.useEffect(()=>{z()},[u]),l.useEffect(()=>{if(!u||!g.current)return;const e=new ResizeObserver(()=>{z()});return e.observe(g.current),()=>e.disconnect()},[u]),l.useEffect(()=>{u||Q(-1)},[u]);const an=e=>{if(M){if(!u){(e.key==="ArrowDown"||e.key==="Enter")&&(e.preventDefault(),C(!0));return}switch(e.key){case"ArrowDown":{e.preventDefault();const a=V(o,m,1);a!==-1&&Q(a);break}case"ArrowUp":{e.preventDefault();const a=V(o,m,-1);a!==-1&&Q(a);break}case"Enter":{e.preventDefault(),m>=0&&o[m]&&!o[m].disable&&q(o[m].label,o[m].value);break}case"Escape":C(!1);break}}},W=s==="lg"||s==="xl"?20:s==="xs"?14:16,Cn=gn&&!N?n.jsx("button",{type:"button",className:`sa-input-dropdown-clear${rn?"":" sa-input-dropdown-clear-hidden"}`,"aria-label":"Clear selection","aria-hidden":!rn,tabIndex:-1,onClick:yn,onMouseDown:e=>e.preventDefault(),children:n.jsx(hn,{width:W,height:W})}):null,zn=w?n.jsxs(n.Fragment,{children:[r&&c.map((e,a)=>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(R,{onClick:b=>{b.stopPropagation(),q(e.label,e.value)}})]},a)),n.jsx("input",{className:"sa-input-dropdown-trigger-input",value:mn,onChange:e=>{const a=e.target.value;$(a),B==null||B(a),!u&&M&&C(!0)},onFocus:()=>{!N&&M&&C(!0)},onBlur:()=>{r||setTimeout(()=>C(!1),150)},onKeyDown:an,placeholder:c.length===0||r?L:void 0,disabled:N})]}):null,Y=n.jsx(cn,{handleChangePosition:z,children:n.jsxs("div",{className:["sa-input-dropdown-container",P,`sa-input-dropdown-size-${s}`,w?"trigger-input":"",u?"active":"",vn?"error":"",N?"disable":""].filter(Boolean).join(" "),ref:X,onClick:w?void 0:Nn,onKeyDown:w?void 0:an,tabIndex:w?void 0:0,onBlur:w?void 0:I,onFocus:w?void 0:F,children:[n.jsxs("div",{className:"sa-input-dropdown-preview-container",children:[h?l.cloneElement(h,{width:W,style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0}}):null,n.jsx("div",{className:"sa-input-dropdown-container-preview-item",children:w?zn:En()}),Cn,!bn&&n.jsx("div",{className:"sa-input-dropdown-chevron",children:u?n.jsx(un,{width:W}):n.jsx(fn,{width:W})})]}),M&&n.jsx(pn,{dropdownLists:o,handleChangeValue:q,isComponentVisible:u,positionDropdown:kn,searchAble:!!k,hideSearch:w,value:c,onSearch:B,ref:g,multiSelect:r,searchValue:G,highlightedIndex:m,footer:T,groupLabel:i,onSelectAll:A})]})});return K?xn==="outside-left"?n.jsxs("div",{className:`${J} 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:K}),en&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),nn&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),S&&n.jsx("p",{className:"sa-select-field-helper-top",children:S})]}),n.jsxs("div",{className:"sa-select-field-input-wrap",children:[Y,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:J,children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:K}),en&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),nn&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),S&&n.jsx("p",{className:"sa-select-field-helper-top",children:S}),Y,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:J,children:[S&&n.jsx("p",{className:"sa-select-field-helper-top",children:S}),Y,D&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:D}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]})},V=(o,p,d)=>{const t=o.length;let s=p+d;for(;s>=0&&s<t;){if(!o[s].disable)return s;s+=d}if(d===1){for(let r=0;r<t;r++)if(!o[r].disable)return r}else for(let r=t-1;r>=0;r--)if(!o[r].disable)return r;return-1},hn=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"})]}),R=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"})}),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",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"})}),un=({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=wn,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  export interface IconPropsDropdown extends React.SVGProps<SVGSVGElement> {
3
3
  }
4
- export type DropdownSize = "sm" | "md" | "lg" | "xl";
4
+ export type DropdownSize = "xs" | "sm" | "md" | "lg" | "xl";
5
5
  export type DropdownVariant = "standard" | "outline" | "flushed";
6
6
  export type DropdownLabelPosition = "outside-top" | "outside-left";
7
7
  export interface IDropdown {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starasia/dropdown",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "dropdown component for starasia UI",
5
5
  "author": "Prawito Hudoro",
6
6
  "main": "dist/dropdown.umd.js",