@starasia/dropdown 5.5.2 → 5.5.4
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/ScrollAwareWrapper.d.ts +21 -1
- package/dist/dropdown.es.js +250 -263
- package/dist/dropdown.umd.js +2 -7
- package/dist/interface.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Keeps a `position: fixed` popover glued to its trigger while ANY ancestor —
|
|
4
|
+
* the window or a nested scroll container — scrolls.
|
|
5
|
+
*
|
|
6
|
+
* Scroll events do not bubble, so listening on a single "scrollable parent"
|
|
7
|
+
* misses scrolls from other containers. The previous implementation also
|
|
8
|
+
* detected that parent with a heuristic (`scrollHeight > clientHeight ||
|
|
9
|
+
* scrollWidth > clientWidth`) that matched any ancestor whose content merely
|
|
10
|
+
* *overflowed* its box rather than one that actually scrolls — so it frequently
|
|
11
|
+
* latched onto a static element whose `scroll` event never fires, leaving the
|
|
12
|
+
* popover frozen while the real container scrolled. (This is why two dropdowns
|
|
13
|
+
* in the same toolbar could behave differently: whichever one happened to have
|
|
14
|
+
* an overflowing ancestor in its chain stopped tracking.)
|
|
15
|
+
*
|
|
16
|
+
* Listening on `window` in the capture phase sidesteps both problems: capture
|
|
17
|
+
* runs from the top of the propagation path, so the handler receives scroll
|
|
18
|
+
* events from every descendant scroll container regardless of overflow style.
|
|
19
|
+
* Gated by `enabled` so the listener is only active while the panel is open.
|
|
20
|
+
*/
|
|
21
|
+
declare const ScrollAwareWrapper: ({ children, handleChangePosition, enabled, }: {
|
|
3
22
|
children: ReactNode;
|
|
4
23
|
handleChangePosition: () => void;
|
|
24
|
+
enabled?: boolean | undefined;
|
|
5
25
|
}) => React.JSX.Element;
|
|
6
26
|
export default ScrollAwareWrapper;
|
package/dist/dropdown.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import ln, { useState as
|
|
1
|
+
import { jsxs as d, jsx as n, Fragment as dn } from "react/jsx-runtime";
|
|
2
|
+
import ln, { useState as P, useRef as G, useEffect as x, 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;
|
|
@@ -43,7 +43,6 @@ const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
43
43
|
--borderRadius: var(--sa-dropdown-radius);
|
|
44
44
|
--paddingInline: 8px;
|
|
45
45
|
--paddingBlock: 2px;
|
|
46
|
-
--iconSize: 14px;
|
|
47
46
|
--iconMarginTop: 4px;
|
|
48
47
|
}
|
|
49
48
|
.sa-input-dropdown-size-sm {
|
|
@@ -52,7 +51,6 @@ const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
52
51
|
--borderRadius: var(--sa-dropdown-radius);
|
|
53
52
|
--paddingInline: 12px;
|
|
54
53
|
--paddingBlock: 4px;
|
|
55
|
-
--iconSize: 16px;
|
|
56
54
|
--iconMarginTop: 4px;
|
|
57
55
|
}
|
|
58
56
|
.sa-input-dropdown-size-md {
|
|
@@ -61,7 +59,6 @@ const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
61
59
|
--borderRadius: var(--sa-dropdown-radius);
|
|
62
60
|
--paddingInline: 12px;
|
|
63
61
|
--paddingBlock: 8px;
|
|
64
|
-
--iconSize: 16px;
|
|
65
62
|
--iconMarginTop: 4px;
|
|
66
63
|
}
|
|
67
64
|
.sa-input-dropdown-size-lg {
|
|
@@ -70,7 +67,6 @@ const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
70
67
|
--borderRadius: var(--sa-dropdown-radius);
|
|
71
68
|
--paddingInline: 12px;
|
|
72
69
|
--paddingBlock: 12px;
|
|
73
|
-
--iconSize: 20px;
|
|
74
70
|
--iconMarginTop: 2px;
|
|
75
71
|
}
|
|
76
72
|
.sa-input-dropdown-size-xl {
|
|
@@ -79,7 +75,6 @@ const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
79
75
|
--borderRadius: var(--sa-dropdown-radius);
|
|
80
76
|
--paddingInline: 16px;
|
|
81
77
|
--paddingBlock: 16px;
|
|
82
|
-
--iconSize: 20px;
|
|
83
78
|
--iconMarginTop: 2px;
|
|
84
79
|
}
|
|
85
80
|
|
|
@@ -551,15 +546,15 @@ const Nn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
551
546
|
}
|
|
552
547
|
|
|
553
548
|
`;
|
|
554
|
-
function
|
|
555
|
-
const [
|
|
556
|
-
|
|
549
|
+
function Cn(o) {
|
|
550
|
+
const [l, i] = P(o), s = G(null), p = (t) => {
|
|
551
|
+
s.current && !s.current.contains(t.target) && i(!1);
|
|
557
552
|
};
|
|
558
|
-
return
|
|
559
|
-
document.removeEventListener("click",
|
|
560
|
-
}), []), { ref:
|
|
553
|
+
return x(() => (document.addEventListener("click", p, !0), () => {
|
|
554
|
+
document.removeEventListener("click", p, !0);
|
|
555
|
+
}), []), { ref: s, isComponentVisible: l, setIsComponentVisible: i };
|
|
561
556
|
}
|
|
562
|
-
const
|
|
557
|
+
const En = ({ ...o }) => /* @__PURE__ */ d(
|
|
563
558
|
"svg",
|
|
564
559
|
{
|
|
565
560
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -613,285 +608,270 @@ const Cn = ({ ...o }) => /* @__PURE__ */ l(
|
|
|
613
608
|
), Rn = yn(
|
|
614
609
|
({
|
|
615
610
|
positionDropdown: o,
|
|
616
|
-
dropdownLists:
|
|
617
|
-
isComponentVisible:
|
|
618
|
-
searchAble:
|
|
619
|
-
hideSearch:
|
|
620
|
-
onSearch:
|
|
621
|
-
value:
|
|
622
|
-
handleChangeValue:
|
|
623
|
-
multiSelect:
|
|
624
|
-
searchValue:
|
|
625
|
-
highlightedIndex:
|
|
611
|
+
dropdownLists: l,
|
|
612
|
+
isComponentVisible: i,
|
|
613
|
+
searchAble: s,
|
|
614
|
+
hideSearch: p,
|
|
615
|
+
onSearch: t,
|
|
616
|
+
value: L,
|
|
617
|
+
handleChangeValue: W,
|
|
618
|
+
multiSelect: C,
|
|
619
|
+
searchValue: E,
|
|
620
|
+
highlightedIndex: m,
|
|
626
621
|
footer: F,
|
|
627
|
-
groupLabel:
|
|
628
|
-
onSelectAll:
|
|
622
|
+
groupLabel: S,
|
|
623
|
+
onSelectAll: k
|
|
629
624
|
}, U) => {
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
var
|
|
633
|
-
|
|
634
|
-
}, [
|
|
635
|
-
const
|
|
636
|
-
/* @__PURE__ */ n(
|
|
625
|
+
const D = G([]);
|
|
626
|
+
x(() => {
|
|
627
|
+
var a;
|
|
628
|
+
m >= 0 && D.current[m] && ((a = D.current[m]) == null || a.scrollIntoView({ block: "nearest" }));
|
|
629
|
+
}, [m]);
|
|
630
|
+
const T = s && !p ? /* @__PURE__ */ d("div", { className: "sa-input-dropdown-container-dropdown-search", children: [
|
|
631
|
+
/* @__PURE__ */ n(En, { strokeWidth: 2, width: 16, style: { flexShrink: 0, color: "var(--sa-dropdown-placeholder-subtle)" } }),
|
|
637
632
|
/* @__PURE__ */ n(
|
|
638
633
|
"input",
|
|
639
634
|
{
|
|
640
|
-
onChange: (
|
|
641
|
-
|
|
635
|
+
onChange: (a) => {
|
|
636
|
+
t && t(a.target.value);
|
|
642
637
|
},
|
|
643
|
-
value:
|
|
638
|
+
value: E,
|
|
644
639
|
autoFocus: !0,
|
|
645
640
|
placeholder: "Search..."
|
|
646
641
|
}
|
|
647
642
|
)
|
|
648
643
|
] }) : null;
|
|
649
|
-
return /* @__PURE__ */ n(dn, { children:
|
|
644
|
+
return /* @__PURE__ */ n(dn, { children: i ? /* @__PURE__ */ d(
|
|
650
645
|
"div",
|
|
651
646
|
{
|
|
652
647
|
className: "sa-input-dropdown-lists-container",
|
|
653
|
-
onClick: (
|
|
648
|
+
onClick: (a) => a.stopPropagation(),
|
|
654
649
|
ref: U,
|
|
655
650
|
children: [
|
|
656
|
-
o !== "top" &&
|
|
657
|
-
/* @__PURE__ */
|
|
651
|
+
o !== "top" && T,
|
|
652
|
+
/* @__PURE__ */ d(
|
|
658
653
|
"div",
|
|
659
654
|
{
|
|
660
|
-
className: `sa-input-dropdown-item-container ${
|
|
655
|
+
className: `sa-input-dropdown-item-container ${C ? "multi" : ""}`,
|
|
661
656
|
children: [
|
|
662
|
-
|
|
663
|
-
/* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children:
|
|
664
|
-
|
|
657
|
+
S && /* @__PURE__ */ d("div", { className: "sa-input-dropdown-section-header", children: [
|
|
658
|
+
/* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children: S }),
|
|
659
|
+
C && k && /* @__PURE__ */ n(
|
|
665
660
|
"button",
|
|
666
661
|
{
|
|
667
662
|
className: "sa-input-dropdown-section-select-all",
|
|
668
|
-
onClick: (
|
|
669
|
-
|
|
663
|
+
onClick: (a) => {
|
|
664
|
+
a.stopPropagation(), k();
|
|
670
665
|
},
|
|
671
666
|
children: "Select all"
|
|
672
667
|
}
|
|
673
668
|
)
|
|
674
669
|
] }),
|
|
675
|
-
|
|
676
|
-
const
|
|
677
|
-
return /* @__PURE__ */
|
|
670
|
+
l.map((a, j) => {
|
|
671
|
+
const $ = !!(L != null && L.find((A) => A.value === a.value)), u = !!a.description;
|
|
672
|
+
return /* @__PURE__ */ d(
|
|
678
673
|
"div",
|
|
679
674
|
{
|
|
680
675
|
className: [
|
|
681
676
|
"sa-input-dropdown-item",
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
677
|
+
u ? "has-description" : "",
|
|
678
|
+
$ ? "active" : "",
|
|
679
|
+
j === m ? "highlight" : "",
|
|
680
|
+
a.disable ? "sa-input-dropdown-item-disable" : ""
|
|
686
681
|
].filter(Boolean).join(" "),
|
|
687
|
-
ref: (
|
|
688
|
-
|
|
682
|
+
ref: (A) => {
|
|
683
|
+
D.current[j] = A;
|
|
689
684
|
},
|
|
690
|
-
onClick: () =>
|
|
685
|
+
onClick: () => W(a.label, a.value),
|
|
691
686
|
children: [
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
/* @__PURE__ */
|
|
687
|
+
C && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-item-check", children: $ && /* @__PURE__ */ n(zn, { width: 16 }) }),
|
|
688
|
+
a.icon && /* @__PURE__ */ n("div", { style: { flexShrink: 0, display: "flex" }, children: ln.cloneElement(a.icon, { width: 16 }) }),
|
|
689
|
+
/* @__PURE__ */ d("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
695
690
|
/* @__PURE__ */ n(
|
|
696
691
|
"p",
|
|
697
692
|
{
|
|
698
693
|
className: [
|
|
699
694
|
"sa-input-dropdown-item-text",
|
|
700
|
-
|
|
695
|
+
a.disable ? "sa-input-dropdown-item-disable" : ""
|
|
701
696
|
].filter(Boolean).join(" "),
|
|
702
|
-
children:
|
|
697
|
+
children: a.label
|
|
703
698
|
}
|
|
704
699
|
),
|
|
705
|
-
|
|
700
|
+
a.description && /* @__PURE__ */ n(
|
|
706
701
|
"p",
|
|
707
702
|
{
|
|
708
703
|
className: [
|
|
709
704
|
"sa-input-dropdown-item-text-description",
|
|
710
|
-
|
|
705
|
+
a.disable ? "sa-input-dropdown-item-disable" : ""
|
|
711
706
|
].filter(Boolean).join(" "),
|
|
712
|
-
children:
|
|
707
|
+
children: a.description
|
|
713
708
|
}
|
|
714
709
|
)
|
|
715
710
|
] })
|
|
716
711
|
]
|
|
717
712
|
},
|
|
718
|
-
|
|
713
|
+
j
|
|
719
714
|
);
|
|
720
715
|
})
|
|
721
716
|
]
|
|
722
717
|
}
|
|
723
718
|
),
|
|
724
|
-
o === "top" &&
|
|
725
|
-
F && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-footer", onClick: (
|
|
719
|
+
o === "top" && T,
|
|
720
|
+
F && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-footer", onClick: (a) => a.stopPropagation(), children: F })
|
|
726
721
|
]
|
|
727
722
|
}
|
|
728
723
|
) : null });
|
|
729
724
|
}
|
|
730
|
-
),
|
|
725
|
+
), Bn = ({
|
|
731
726
|
children: o,
|
|
732
|
-
handleChangePosition:
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
if (s.current) {
|
|
739
|
-
let u = s.current.parentElement;
|
|
740
|
-
for (; u && !d(u); )
|
|
741
|
-
u = u.parentElement;
|
|
742
|
-
u && p();
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
|
-
let r = (m = s.current) == null ? void 0 : m.parentElement;
|
|
746
|
-
for (; r && !d(r); )
|
|
747
|
-
r = r.parentElement;
|
|
748
|
-
return r && r.addEventListener("scroll", a), a(), () => {
|
|
749
|
-
r && r.removeEventListener("scroll", a);
|
|
727
|
+
handleChangePosition: l,
|
|
728
|
+
enabled: i = !0
|
|
729
|
+
}) => (x(() => {
|
|
730
|
+
if (i)
|
|
731
|
+
return window.addEventListener("scroll", l, !0), () => {
|
|
732
|
+
window.removeEventListener("scroll", l, !0);
|
|
750
733
|
};
|
|
751
|
-
|
|
752
|
-
const d = (a) => a && (a.scrollHeight > a.clientHeight || a.scrollWidth > a.clientWidth);
|
|
753
|
-
return /* @__PURE__ */ n("div", { ref: s, children: o });
|
|
754
|
-
}, an = "sa-input-dropdown-styles", Bn = (o) => {
|
|
734
|
+
}, [i, l]), /* @__PURE__ */ n("div", { children: o })), an = "sa-input-dropdown-styles", Ln = (o) => {
|
|
755
735
|
if (!(typeof document > "u") && !document.getElementById(an)) {
|
|
756
|
-
const
|
|
757
|
-
|
|
736
|
+
const l = document.createElement("style");
|
|
737
|
+
l.id = an, l.textContent = o, document.head.appendChild(l);
|
|
758
738
|
}
|
|
759
739
|
};
|
|
760
|
-
|
|
761
|
-
const
|
|
740
|
+
Ln(Nn);
|
|
741
|
+
const Mn = ({
|
|
762
742
|
dropdownLists: o,
|
|
763
|
-
onChange:
|
|
764
|
-
defaultValue:
|
|
765
|
-
value:
|
|
766
|
-
size:
|
|
767
|
-
multiSelect:
|
|
768
|
-
searchAble:
|
|
769
|
-
iconLeft:
|
|
770
|
-
placeholder:
|
|
771
|
-
onSearch:
|
|
772
|
-
error:
|
|
743
|
+
onChange: l,
|
|
744
|
+
defaultValue: i,
|
|
745
|
+
value: s,
|
|
746
|
+
size: p = "sm",
|
|
747
|
+
multiSelect: t,
|
|
748
|
+
searchAble: L,
|
|
749
|
+
iconLeft: W,
|
|
750
|
+
placeholder: C,
|
|
751
|
+
onSearch: E,
|
|
752
|
+
error: m,
|
|
773
753
|
onBlur: F,
|
|
774
|
-
onFocus:
|
|
775
|
-
disable:
|
|
754
|
+
onFocus: S,
|
|
755
|
+
disable: k,
|
|
776
756
|
searchValue: U,
|
|
777
|
-
variant:
|
|
778
|
-
footer:
|
|
779
|
-
groupLabel:
|
|
780
|
-
onSelectAll:
|
|
781
|
-
fullWidth:
|
|
782
|
-
triggerInput:
|
|
783
|
-
clearOnSelect:
|
|
757
|
+
variant: D = "outline",
|
|
758
|
+
footer: T,
|
|
759
|
+
groupLabel: a,
|
|
760
|
+
onSelectAll: j,
|
|
761
|
+
fullWidth: $ = !0,
|
|
762
|
+
triggerInput: u = !1,
|
|
763
|
+
clearOnSelect: A = !1,
|
|
784
764
|
hideChevronIcon: pn = !1,
|
|
785
765
|
clearable: cn = !1,
|
|
786
766
|
onClear: K,
|
|
787
767
|
/* field wrapper */
|
|
788
768
|
label: J,
|
|
789
|
-
labelPosition:
|
|
769
|
+
labelPosition: un = "outside-top",
|
|
790
770
|
required: V,
|
|
791
771
|
optional: nn,
|
|
792
|
-
description:
|
|
793
|
-
helperText:
|
|
772
|
+
description: z,
|
|
773
|
+
helperText: R,
|
|
794
774
|
errorText: h
|
|
795
775
|
}) => {
|
|
796
776
|
const Z = [
|
|
797
777
|
"sa-select-field",
|
|
798
|
-
`sa-select-field-size-${
|
|
799
|
-
|
|
800
|
-
].filter(Boolean).join(" "),
|
|
801
|
-
|
|
802
|
-
), [hn, en] =
|
|
778
|
+
`sa-select-field-size-${p}`,
|
|
779
|
+
$ ? "sa-select-field-fullwidth" : ""
|
|
780
|
+
].filter(Boolean).join(" "), y = s !== void 0, Q = G(), wn = m || !!h, [c, B] = P(
|
|
781
|
+
y ? s || [] : i || []
|
|
782
|
+
), [hn, en] = P(""), [v, X] = P(-1), [fn, q] = P(
|
|
803
783
|
() => {
|
|
804
|
-
var e,
|
|
805
|
-
return !
|
|
784
|
+
var e, r;
|
|
785
|
+
return !t && (s != null && s.length || i != null && i.length) ? ((e = s == null ? void 0 : s[0]) == null ? void 0 : e.label) ?? ((r = i == null ? void 0 : i[0]) == null ? void 0 : r.label) ?? "" : "";
|
|
806
786
|
}
|
|
807
|
-
),
|
|
787
|
+
), b = G(null), { isComponentVisible: w, ref: Y, setIsComponentVisible: N } = Cn(!1), I = o !== void 0, on = c.length > 0, bn = (e) => {
|
|
808
788
|
e.stopPropagation();
|
|
809
|
-
const
|
|
810
|
-
|
|
789
|
+
const r = [];
|
|
790
|
+
y || B(r), l(r), u && q(""), K == null || K();
|
|
811
791
|
}, gn = () => {
|
|
812
|
-
I &&
|
|
813
|
-
},
|
|
814
|
-
if (
|
|
815
|
-
if (c == null ? void 0 : c.find((
|
|
816
|
-
const
|
|
817
|
-
|
|
792
|
+
I && N((e) => !e);
|
|
793
|
+
}, H = (e, r) => {
|
|
794
|
+
if (t) {
|
|
795
|
+
if (c == null ? void 0 : c.find((g) => g.value === r)) {
|
|
796
|
+
const g = c.filter((kn) => kn.value !== r);
|
|
797
|
+
y || B(g), l(g);
|
|
818
798
|
} else {
|
|
819
|
-
const
|
|
820
|
-
|
|
799
|
+
const g = [...c, { label: e, value: r }];
|
|
800
|
+
y || B(g), l(g);
|
|
821
801
|
}
|
|
822
|
-
|
|
802
|
+
u && q("");
|
|
823
803
|
} else {
|
|
824
|
-
const
|
|
825
|
-
|
|
804
|
+
const f = [{ label: e, value: r }];
|
|
805
|
+
y || B(f), l(f), u && q(A ? "" : e), N(!1);
|
|
826
806
|
}
|
|
827
807
|
};
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}, [
|
|
831
|
-
|
|
832
|
-
}, [
|
|
833
|
-
const xn = () => c.length ?
|
|
808
|
+
x(() => {
|
|
809
|
+
y && B(s || []);
|
|
810
|
+
}, [s]), x(() => {
|
|
811
|
+
y || JSON.stringify(Q.current) === JSON.stringify(i) || (Q.current = i, B(Q.current || []));
|
|
812
|
+
}, [i]);
|
|
813
|
+
const xn = () => c.length ? t ? c == null ? void 0 : c.map((e, r) => /* @__PURE__ */ d("div", { className: "sa-input-dropdown-preview-item", children: [
|
|
834
814
|
/* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: e == null ? void 0 : e.label }),
|
|
835
815
|
/* @__PURE__ */ n(
|
|
836
816
|
sn,
|
|
837
817
|
{
|
|
838
|
-
onClick: (
|
|
839
|
-
|
|
818
|
+
onClick: (f) => {
|
|
819
|
+
f.stopPropagation(), H(e.label, e.value);
|
|
840
820
|
}
|
|
841
821
|
}
|
|
842
822
|
)
|
|
843
|
-
] },
|
|
844
|
-
if (Y.current &&
|
|
845
|
-
const e = window.innerHeight,
|
|
846
|
-
|
|
823
|
+
] }, r)) : /* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: c == null ? void 0 : c[0].label }) : /* @__PURE__ */ n("p", { className: "sa-input-dropdown-placeholder", children: C }), O = () => {
|
|
824
|
+
if (Y.current && b.current) {
|
|
825
|
+
const e = window.innerHeight, r = Y.current.getBoundingClientRect(), f = b.current.getBoundingClientRect(), g = r.bottom + f.height;
|
|
826
|
+
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`, en("top")) : (b.current.style.top = `${r.top + r.height + 4}px`, en("bottom"));
|
|
847
827
|
}
|
|
848
828
|
};
|
|
849
|
-
|
|
850
|
-
window.removeEventListener("
|
|
851
|
-
}), []),
|
|
852
|
-
|
|
853
|
-
}, [
|
|
854
|
-
if (!
|
|
829
|
+
x(() => (window.addEventListener("resize", O), () => {
|
|
830
|
+
window.removeEventListener("resize", O);
|
|
831
|
+
}), []), x(() => {
|
|
832
|
+
O();
|
|
833
|
+
}, [w]), x(() => {
|
|
834
|
+
if (!w || !b.current)
|
|
855
835
|
return;
|
|
856
836
|
const e = new ResizeObserver(() => {
|
|
857
|
-
|
|
837
|
+
O();
|
|
858
838
|
});
|
|
859
|
-
return e.observe(
|
|
860
|
-
}, [
|
|
861
|
-
|
|
862
|
-
}, [
|
|
839
|
+
return e.observe(b.current), () => e.disconnect();
|
|
840
|
+
}, [w]), x(() => {
|
|
841
|
+
w || X(-1);
|
|
842
|
+
}, [w]);
|
|
863
843
|
const rn = (e) => {
|
|
864
844
|
if (I) {
|
|
865
|
-
if (!
|
|
866
|
-
(e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(),
|
|
845
|
+
if (!w) {
|
|
846
|
+
(e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), N(!0));
|
|
867
847
|
return;
|
|
868
848
|
}
|
|
869
849
|
switch (e.key) {
|
|
870
850
|
case "ArrowDown": {
|
|
871
851
|
e.preventDefault();
|
|
872
|
-
const
|
|
873
|
-
|
|
852
|
+
const r = tn(o, v, 1);
|
|
853
|
+
r !== -1 && X(r);
|
|
874
854
|
break;
|
|
875
855
|
}
|
|
876
856
|
case "ArrowUp": {
|
|
877
857
|
e.preventDefault();
|
|
878
|
-
const
|
|
879
|
-
|
|
858
|
+
const r = tn(o, v, -1);
|
|
859
|
+
r !== -1 && X(r);
|
|
880
860
|
break;
|
|
881
861
|
}
|
|
882
862
|
case "Enter": {
|
|
883
|
-
e.preventDefault(),
|
|
884
|
-
o[
|
|
885
|
-
o[
|
|
863
|
+
e.preventDefault(), v >= 0 && o[v] && !o[v].disable && H(
|
|
864
|
+
o[v].label,
|
|
865
|
+
o[v].value
|
|
886
866
|
);
|
|
887
867
|
break;
|
|
888
868
|
}
|
|
889
869
|
case "Escape":
|
|
890
|
-
|
|
870
|
+
N(!1);
|
|
891
871
|
break;
|
|
892
872
|
}
|
|
893
873
|
}
|
|
894
|
-
},
|
|
874
|
+
}, M = p === "lg" || p === "xl" ? 20 : p === "xs" ? 14 : 16, vn = cn && !k ? /* @__PURE__ */ n(
|
|
895
875
|
"button",
|
|
896
876
|
{
|
|
897
877
|
type: "button",
|
|
@@ -901,139 +881,146 @@ const In = ({
|
|
|
901
881
|
tabIndex: -1,
|
|
902
882
|
onClick: bn,
|
|
903
883
|
onMouseDown: (e) => e.preventDefault(),
|
|
904
|
-
children: /* @__PURE__ */ n(Dn, { width:
|
|
884
|
+
children: /* @__PURE__ */ n(Dn, { width: M, height: M })
|
|
905
885
|
}
|
|
906
|
-
) : null, mn =
|
|
907
|
-
|
|
886
|
+
) : null, mn = u ? /* @__PURE__ */ d(dn, { children: [
|
|
887
|
+
t && c.map((e, r) => /* @__PURE__ */ d("div", { className: "sa-input-dropdown-preview-item", children: [
|
|
908
888
|
/* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: e == null ? void 0 : e.label }),
|
|
909
889
|
/* @__PURE__ */ n(
|
|
910
890
|
sn,
|
|
911
891
|
{
|
|
912
|
-
onClick: (
|
|
913
|
-
|
|
892
|
+
onClick: (f) => {
|
|
893
|
+
f.stopPropagation(), H(e.label, e.value);
|
|
914
894
|
}
|
|
915
895
|
}
|
|
916
896
|
)
|
|
917
|
-
] },
|
|
897
|
+
] }, r)),
|
|
918
898
|
/* @__PURE__ */ n(
|
|
919
899
|
"input",
|
|
920
900
|
{
|
|
921
901
|
className: "sa-input-dropdown-trigger-input",
|
|
922
902
|
value: fn,
|
|
923
903
|
onChange: (e) => {
|
|
924
|
-
const
|
|
925
|
-
q(
|
|
904
|
+
const r = e.target.value;
|
|
905
|
+
q(r), E == null || E(r), !w && I && N(!0);
|
|
926
906
|
},
|
|
927
907
|
onFocus: () => {
|
|
928
|
-
!
|
|
908
|
+
!k && I && N(!0);
|
|
929
909
|
},
|
|
930
910
|
onBlur: () => {
|
|
931
|
-
|
|
911
|
+
t || setTimeout(() => N(!1), 150);
|
|
932
912
|
},
|
|
933
913
|
onKeyDown: rn,
|
|
934
|
-
placeholder: c.length === 0 ||
|
|
935
|
-
disabled:
|
|
914
|
+
placeholder: c.length === 0 || t ? C : void 0,
|
|
915
|
+
disabled: k
|
|
936
916
|
}
|
|
937
917
|
)
|
|
938
|
-
] }) : null, _ = /* @__PURE__ */ n(
|
|
939
|
-
|
|
918
|
+
] }) : null, _ = /* @__PURE__ */ n(
|
|
919
|
+
Bn,
|
|
940
920
|
{
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
u ?
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
921
|
+
handleChangePosition: O,
|
|
922
|
+
enabled: w,
|
|
923
|
+
children: /* @__PURE__ */ d(
|
|
924
|
+
"div",
|
|
925
|
+
{
|
|
926
|
+
className: [
|
|
927
|
+
"sa-input-dropdown-container",
|
|
928
|
+
D,
|
|
929
|
+
`sa-input-dropdown-size-${p}`,
|
|
930
|
+
u ? "trigger-input" : "",
|
|
931
|
+
w ? "active" : "",
|
|
932
|
+
wn ? "error" : "",
|
|
933
|
+
k ? "disable" : ""
|
|
934
|
+
].filter(Boolean).join(" "),
|
|
935
|
+
ref: Y,
|
|
936
|
+
onClick: u ? void 0 : gn,
|
|
937
|
+
onKeyDown: u ? void 0 : rn,
|
|
938
|
+
tabIndex: u ? void 0 : 0,
|
|
939
|
+
onBlur: u ? void 0 : F,
|
|
940
|
+
onFocus: u ? void 0 : S,
|
|
941
|
+
children: [
|
|
942
|
+
/* @__PURE__ */ d("div", { className: "sa-input-dropdown-preview-container", children: [
|
|
943
|
+
W ? ln.cloneElement(W, {
|
|
944
|
+
width: M,
|
|
945
|
+
style: { color: "var(--sa-dropdown-placeholder)", flexShrink: 0 }
|
|
946
|
+
}) : null,
|
|
947
|
+
/* @__PURE__ */ n("div", { className: "sa-input-dropdown-container-preview-item", children: u ? mn : xn() }),
|
|
948
|
+
vn,
|
|
949
|
+
!pn && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-chevron", children: w ? /* @__PURE__ */ n(An, { width: M }) : /* @__PURE__ */ n(jn, { width: M }) })
|
|
950
|
+
] }),
|
|
951
|
+
I && /* @__PURE__ */ n(
|
|
952
|
+
Rn,
|
|
953
|
+
{
|
|
954
|
+
dropdownLists: o,
|
|
955
|
+
handleChangeValue: H,
|
|
956
|
+
isComponentVisible: w,
|
|
957
|
+
positionDropdown: hn,
|
|
958
|
+
searchAble: !!L,
|
|
959
|
+
hideSearch: u,
|
|
960
|
+
value: c,
|
|
961
|
+
onSearch: E,
|
|
962
|
+
ref: b,
|
|
963
|
+
multiSelect: t,
|
|
964
|
+
searchValue: U,
|
|
965
|
+
highlightedIndex: v,
|
|
966
|
+
footer: T,
|
|
967
|
+
groupLabel: a,
|
|
968
|
+
onSelectAll: j
|
|
969
|
+
}
|
|
970
|
+
)
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
)
|
|
987
974
|
}
|
|
988
|
-
)
|
|
989
|
-
return J ?
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
975
|
+
);
|
|
976
|
+
return J ? un === "outside-left" ? /* @__PURE__ */ d("div", { className: `${Z} sa-select-field-left`, children: [
|
|
977
|
+
/* @__PURE__ */ d("div", { className: "sa-select-field-left-label", children: [
|
|
978
|
+
/* @__PURE__ */ d("div", { className: "sa-select-field-label-row", children: [
|
|
992
979
|
/* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: J }),
|
|
993
980
|
nn && /* @__PURE__ */ n("span", { className: "sa-select-field-optional-badge", children: "Optional" }),
|
|
994
981
|
V && /* @__PURE__ */ n("span", { className: "sa-select-field-required", children: "*" })
|
|
995
982
|
] }),
|
|
996
|
-
|
|
983
|
+
z && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: z })
|
|
997
984
|
] }),
|
|
998
|
-
/* @__PURE__ */
|
|
985
|
+
/* @__PURE__ */ d("div", { className: "sa-select-field-input-wrap", children: [
|
|
999
986
|
_,
|
|
1000
|
-
|
|
987
|
+
R && !h && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: R }),
|
|
1001
988
|
h && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: h })
|
|
1002
989
|
] })
|
|
1003
|
-
] }) : /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
990
|
+
] }) : /* @__PURE__ */ d("div", { className: Z, children: [
|
|
991
|
+
/* @__PURE__ */ d("div", { className: "sa-select-field-label-row", children: [
|
|
1005
992
|
/* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: J }),
|
|
1006
993
|
nn && /* @__PURE__ */ n("span", { className: "sa-select-field-optional-badge", children: "Optional" }),
|
|
1007
994
|
V && /* @__PURE__ */ n("span", { className: "sa-select-field-required", children: "*" })
|
|
1008
995
|
] }),
|
|
1009
|
-
|
|
996
|
+
z && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: z }),
|
|
1010
997
|
_,
|
|
1011
|
-
|
|
998
|
+
R && !h && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: R }),
|
|
1012
999
|
h && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: h })
|
|
1013
|
-
] }) : /* @__PURE__ */
|
|
1014
|
-
|
|
1000
|
+
] }) : /* @__PURE__ */ d("div", { className: Z, children: [
|
|
1001
|
+
z && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: z }),
|
|
1015
1002
|
_,
|
|
1016
|
-
|
|
1003
|
+
R && !h && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: R }),
|
|
1017
1004
|
h && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: h })
|
|
1018
1005
|
] });
|
|
1019
|
-
}, tn = (o,
|
|
1020
|
-
const
|
|
1021
|
-
let
|
|
1022
|
-
for (;
|
|
1023
|
-
if (!o[
|
|
1024
|
-
return
|
|
1025
|
-
|
|
1006
|
+
}, tn = (o, l, i) => {
|
|
1007
|
+
const s = o.length;
|
|
1008
|
+
let p = l + i;
|
|
1009
|
+
for (; p >= 0 && p < s; ) {
|
|
1010
|
+
if (!o[p].disable)
|
|
1011
|
+
return p;
|
|
1012
|
+
p += i;
|
|
1026
1013
|
}
|
|
1027
|
-
if (
|
|
1028
|
-
for (let
|
|
1029
|
-
if (!o[
|
|
1030
|
-
return
|
|
1014
|
+
if (i === 1) {
|
|
1015
|
+
for (let t = 0; t < s; t++)
|
|
1016
|
+
if (!o[t].disable)
|
|
1017
|
+
return t;
|
|
1031
1018
|
} else
|
|
1032
|
-
for (let
|
|
1033
|
-
if (!o[
|
|
1034
|
-
return
|
|
1019
|
+
for (let t = s - 1; t >= 0; t--)
|
|
1020
|
+
if (!o[t].disable)
|
|
1021
|
+
return t;
|
|
1035
1022
|
return -1;
|
|
1036
|
-
}, Dn = (o) => /* @__PURE__ */
|
|
1023
|
+
}, Dn = (o) => /* @__PURE__ */ d("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...o, children: [
|
|
1037
1024
|
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "7", fill: "currentColor", opacity: "0.2" }),
|
|
1038
1025
|
/* @__PURE__ */ n("path", { d: "M5.5 5.5l5 5M10.5 5.5l-5 5", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" })
|
|
1039
1026
|
] }), sn = (o) => /* @__PURE__ */ n(
|
|
@@ -1057,7 +1044,7 @@ const In = ({
|
|
|
1057
1044
|
}
|
|
1058
1045
|
)
|
|
1059
1046
|
}
|
|
1060
|
-
),
|
|
1047
|
+
), jn = ({ width: o = 16 }) => /* @__PURE__ */ n(
|
|
1061
1048
|
"svg",
|
|
1062
1049
|
{
|
|
1063
1050
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1077,7 +1064,7 @@ const In = ({
|
|
|
1077
1064
|
}
|
|
1078
1065
|
)
|
|
1079
1066
|
}
|
|
1080
|
-
),
|
|
1067
|
+
), An = ({ width: o = 16 }) => /* @__PURE__ */ n(
|
|
1081
1068
|
"svg",
|
|
1082
1069
|
{
|
|
1083
1070
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1099,5 +1086,5 @@ const In = ({
|
|
|
1099
1086
|
}
|
|
1100
1087
|
);
|
|
1101
1088
|
export {
|
|
1102
|
-
|
|
1089
|
+
Mn as Dropdown
|
|
1103
1090
|
};
|
package/dist/dropdown.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
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,i){"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;
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
--borderRadius: var(--sa-dropdown-radius);
|
|
42
42
|
--paddingInline: 8px;
|
|
43
43
|
--paddingBlock: 2px;
|
|
44
|
-
--iconSize: 14px;
|
|
45
44
|
--iconMarginTop: 4px;
|
|
46
45
|
}
|
|
47
46
|
.sa-input-dropdown-size-sm {
|
|
@@ -50,7 +49,6 @@
|
|
|
50
49
|
--borderRadius: var(--sa-dropdown-radius);
|
|
51
50
|
--paddingInline: 12px;
|
|
52
51
|
--paddingBlock: 4px;
|
|
53
|
-
--iconSize: 16px;
|
|
54
52
|
--iconMarginTop: 4px;
|
|
55
53
|
}
|
|
56
54
|
.sa-input-dropdown-size-md {
|
|
@@ -59,7 +57,6 @@
|
|
|
59
57
|
--borderRadius: var(--sa-dropdown-radius);
|
|
60
58
|
--paddingInline: 12px;
|
|
61
59
|
--paddingBlock: 8px;
|
|
62
|
-
--iconSize: 16px;
|
|
63
60
|
--iconMarginTop: 4px;
|
|
64
61
|
}
|
|
65
62
|
.sa-input-dropdown-size-lg {
|
|
@@ -68,7 +65,6 @@
|
|
|
68
65
|
--borderRadius: var(--sa-dropdown-radius);
|
|
69
66
|
--paddingInline: 12px;
|
|
70
67
|
--paddingBlock: 12px;
|
|
71
|
-
--iconSize: 20px;
|
|
72
68
|
--iconMarginTop: 2px;
|
|
73
69
|
}
|
|
74
70
|
.sa-input-dropdown-size-xl {
|
|
@@ -77,7 +73,6 @@
|
|
|
77
73
|
--borderRadius: var(--sa-dropdown-radius);
|
|
78
74
|
--paddingInline: 16px;
|
|
79
75
|
--paddingBlock: 16px;
|
|
80
|
-
--iconSize: 20px;
|
|
81
76
|
--iconMarginTop: 2px;
|
|
82
77
|
}
|
|
83
78
|
|
|
@@ -548,4 +543,4 @@
|
|
|
548
543
|
display: none;
|
|
549
544
|
}
|
|
550
545
|
|
|
551
|
-
`;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:f,multiSelect:L,searchValue:B,highlightedIndex:y,footer:W,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 $=!!(k!=null&&k.find(O=>O.value===i.value)),w=!!i.description;return n.jsxs("div",{className:["sa-input-dropdown-item",w?"has-description":"",$?"active":"",A===y?"highlight":"",i.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),ref:O=>{P.current[A]=O},onClick:()=>f(i.label,i.value),children:[L&&n.jsx("div",{className:"sa-input-dropdown-item-check",children:$&&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,W&&n.jsx("div",{className:"sa-input-dropdown-footer",onClick:i=>i.stopPropagation(),children:W})]}):null})}),cn=({children:o,handleChangePosition:p})=>{const d=l.useRef(null);l.useEffect(()=>{var k;const s=()=>{if(d.current){let f=d.current.parentElement;for(;f&&!t(f);)f=f.parentElement;f&&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(!(typeof document>"u")&&!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:f,placeholder:L,onSearch:B,error:y,onBlur:W,onFocus:F,disable:N,searchValue:G,variant:P="outline",footer:T,groupLabel:i,onSelectAll:A,fullWidth:$=!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:h})=>{const J=["sa-select-field",`sa-select-field-size-${s}`,$?"sa-select-field-fullwidth":""].filter(Boolean).join(" "),E=t!==void 0,Z=l.useRef(),vn=y||!!h,[c,j]=l.useState(E?t||[]:d||[]),[kn,on]=l.useState(""),[m,Q]=l.useState(-1),[mn,q]=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),I=o!==void 0,rn=c.length>0,yn=e=>{e.stopPropagation();const a=[];E||j(a),p(a),w&&q(""),U==null||U()},Nn=()=>{I&&C(e=>!e)},H=(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&&q("")}else{const b=[{label:e,value:a}];E||j(b),p(b),w&&q(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(),H(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(I){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&&H(o[m].label,o[m].value);break}case"Escape":C(!1);break}}},M=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(fn,{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(),H(e.label,e.value)}})]},a)),n.jsx("input",{className:"sa-input-dropdown-trigger-input",value:mn,onChange:e=>{const a=e.target.value;q(a),B==null||B(a),!u&&I&&C(!0)},onFocus:()=>{!N&&I&&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:W,onFocus:w?void 0:F,children:[n.jsxs("div",{className:"sa-input-dropdown-preview-container",children:[f?l.cloneElement(f,{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(hn,{width:M})})]}),I&&n.jsx(pn,{dropdownLists:o,handleChangeValue:H,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&&!h&&n.jsx("p",{className:"sa-select-field-helper",children:D}),h&&n.jsx("p",{className:"sa-select-field-error-msg",children:h})]})]}):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&&!h&&n.jsx("p",{className:"sa-select-field-helper",children:D}),h&&n.jsx("p",{className:"sa-select-field-error-msg",children:h})]}):n.jsxs("div",{className:J,children:[S&&n.jsx("p",{className:"sa-select-field-helper-top",children:S}),Y,D&&!h&&n.jsx("p",{className:"sa-select-field-helper",children:D}),h&&n.jsx("p",{className:"sa-select-field-error-msg",children:h})]})},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},fn=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"})}),hn=({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"})});
|
|
546
|
+
`;function dn(o){const[l,s]=i.useState(o),t=i.useRef(null),p=d=>{t.current&&!t.current.contains(d.target)&&s(!1)};return i.useEffect(()=>(document.addEventListener("click",p,!0),()=>{document.removeEventListener("click",p,!0)}),[]),{ref:t,isComponentVisible:l,setIsComponentVisible:s}}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=i.forwardRef(({positionDropdown:o,dropdownLists:l,isComponentVisible:s,searchAble:t,hideSearch:p,onSearch:d,value:D,handleChangeValue:P,multiSelect:E,searchValue:C,highlightedIndex:k,footer:W,groupLabel:F,onSelectAll:m},G)=>{const j=i.useRef([]);i.useEffect(()=>{var a;k>=0&&j.current[k]&&((a=j.current[k])==null||a.scrollIntoView({block:"nearest"}))},[k]);const T=t&&!p?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:a=>{d&&d(a.target.value)},value:C,autoFocus:!0,placeholder:"Search..."})]}):null;return n.jsx(n.Fragment,{children:s?n.jsxs("div",{className:"sa-input-dropdown-lists-container",onClick:a=>a.stopPropagation(),ref:G,children:[o!=="top"&&T,n.jsxs("div",{className:`sa-input-dropdown-item-container ${E?"multi":""}`,children:[F&&n.jsxs("div",{className:"sa-input-dropdown-section-header",children:[n.jsx("span",{className:"sa-input-dropdown-section-label",children:F}),E&&m&&n.jsx("button",{className:"sa-input-dropdown-section-select-all",onClick:a=>{a.stopPropagation(),m()},children:"Select all"})]}),l.map((a,S)=>{const $=!!(D!=null&&D.find(A=>A.value===a.value)),w=!!a.description;return n.jsxs("div",{className:["sa-input-dropdown-item",w?"has-description":"",$?"active":"",S===k?"highlight":"",a.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),ref:A=>{j.current[S]=A},onClick:()=>P(a.label,a.value),children:[E&&n.jsx("div",{className:"sa-input-dropdown-item-check",children:$&&n.jsx(ln,{width:16})}),a.icon&&n.jsx("div",{style:{flexShrink:0,display:"flex"},children:i.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})]})]},S)})]}),o==="top"&&T,W&&n.jsx("div",{className:"sa-input-dropdown-footer",onClick:a=>a.stopPropagation(),children:W})]}):null})}),cn=({children:o,handleChangePosition:l,enabled:s=!0})=>(i.useEffect(()=>{if(s)return window.addEventListener("scroll",l,!0),()=>{window.removeEventListener("scroll",l,!0)}},[s,l]),n.jsx("div",{children:o})),_="sa-input-dropdown-styles";(o=>{if(!(typeof document>"u")&&!document.getElementById(_)){const l=document.createElement("style");l.id=_,l.textContent=o,document.head.appendChild(l)}})(sn);const wn=({dropdownLists:o,onChange:l,defaultValue:s,value:t,size:p="sm",multiSelect:d,searchAble:D,iconLeft:P,placeholder:E,onSearch:C,error:k,onBlur:W,onFocus:F,disable:m,searchValue:G,variant:j="outline",footer:T,groupLabel:a,onSelectAll:S,fullWidth:$=!0,triggerInput:w=!1,clearOnSelect:A=!1,hideChevronIcon:bn=!1,clearable:gn=!1,onClear:U,label:K,labelPosition:xn="outside-top",required:nn,optional:en,description:z,helperText:B,errorText:h})=>{const J=["sa-select-field",`sa-select-field-size-${p}`,$?"sa-select-field-fullwidth":""].filter(Boolean).join(" "),y=t!==void 0,Z=i.useRef(),vn=k||!!h,[c,L]=i.useState(y?t||[]:s||[]),[kn,on]=i.useState(""),[v,Q]=i.useState(-1),[mn,q]=i.useState(()=>{var e,r;return!d&&(t!=null&&t.length||s!=null&&s.length)?((e=t==null?void 0:t[0])==null?void 0:e.label)??((r=s==null?void 0:s[0])==null?void 0:r.label)??"":""}),b=i.useRef(null),{isComponentVisible:f,ref:X,setIsComponentVisible:N}=dn(!1),O=o!==void 0,rn=c.length>0,yn=e=>{e.stopPropagation();const r=[];y||L(r),l(r),w&&q(""),U==null||U()},Nn=()=>{O&&N(e=>!e)},H=(e,r)=>{if(d){if(c==null?void 0:c.find(g=>g.value===r)){const g=c.filter(Bn=>Bn.value!==r);y||L(g),l(g)}else{const g=[...c,{label:e,value:r}];y||L(g),l(g)}w&&q("")}else{const u=[{label:e,value:r}];y||L(u),l(u),w&&q(A?"":e),N(!1)}};i.useEffect(()=>{y&&L(t||[])},[t]),i.useEffect(()=>{y||JSON.stringify(Z.current)===JSON.stringify(s)||(Z.current=s,L(Z.current||[]))},[s]);const En=()=>c.length?d?c==null?void 0:c.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(R,{onClick:u=>{u.stopPropagation(),H(e.label,e.value)}})]},r)):n.jsx("p",{style:{minWidth:"max-content"},children:c==null?void 0:c[0].label}):n.jsx("p",{className:"sa-input-dropdown-placeholder",children:E}),I=()=>{if(X.current&&b.current){const e=window.innerHeight,r=X.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`,on("top")):(b.current.style.top=`${r.top+r.height+4}px`,on("bottom"))}};i.useEffect(()=>(window.addEventListener("resize",I),()=>{window.removeEventListener("resize",I)}),[]),i.useEffect(()=>{I()},[f]),i.useEffect(()=>{if(!f||!b.current)return;const e=new ResizeObserver(()=>{I()});return e.observe(b.current),()=>e.disconnect()},[f]),i.useEffect(()=>{f||Q(-1)},[f]);const an=e=>{if(O){if(!f){(e.key==="ArrowDown"||e.key==="Enter")&&(e.preventDefault(),N(!0));return}switch(e.key){case"ArrowDown":{e.preventDefault();const r=V(o,v,1);r!==-1&&Q(r);break}case"ArrowUp":{e.preventDefault();const r=V(o,v,-1);r!==-1&&Q(r);break}case"Enter":{e.preventDefault(),v>=0&&o[v]&&!o[v].disable&&H(o[v].label,o[v].value);break}case"Escape":N(!1);break}}},M=p==="lg"||p==="xl"?20:p==="xs"?14:16,Cn=gn&&!m?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(fn,{width:M,height:M})}):null,zn=w?n.jsxs(n.Fragment,{children:[d&&c.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(R,{onClick:u=>{u.stopPropagation(),H(e.label,e.value)}})]},r)),n.jsx("input",{className:"sa-input-dropdown-trigger-input",value:mn,onChange:e=>{const r=e.target.value;q(r),C==null||C(r),!f&&O&&N(!0)},onFocus:()=>{!m&&O&&N(!0)},onBlur:()=>{d||setTimeout(()=>N(!1),150)},onKeyDown:an,placeholder:c.length===0||d?E:void 0,disabled:m})]}):null,Y=n.jsx(cn,{handleChangePosition:I,enabled:f,children:n.jsxs("div",{className:["sa-input-dropdown-container",j,`sa-input-dropdown-size-${p}`,w?"trigger-input":"",f?"active":"",vn?"error":"",m?"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:W,onFocus:w?void 0:F,children:[n.jsxs("div",{className:"sa-input-dropdown-preview-container",children:[P?i.cloneElement(P,{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:f?n.jsx(un,{width:M}):n.jsx(hn,{width:M})})]}),O&&n.jsx(pn,{dropdownLists:o,handleChangeValue:H,isComponentVisible:f,positionDropdown:kn,searchAble:!!D,hideSearch:w,value:c,onSearch:C,ref:b,multiSelect:d,searchValue:G,highlightedIndex:v,footer:T,groupLabel:a,onSelectAll:S})]})});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:"*"})]}),z&&n.jsx("p",{className:"sa-select-field-helper-top",children:z})]}),n.jsxs("div",{className:"sa-select-field-input-wrap",children:[Y,B&&!h&&n.jsx("p",{className:"sa-select-field-helper",children:B}),h&&n.jsx("p",{className:"sa-select-field-error-msg",children:h})]})]}):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:"*"})]}),z&&n.jsx("p",{className:"sa-select-field-helper-top",children:z}),Y,B&&!h&&n.jsx("p",{className:"sa-select-field-helper",children:B}),h&&n.jsx("p",{className:"sa-select-field-error-msg",children:h})]}):n.jsxs("div",{className:J,children:[z&&n.jsx("p",{className:"sa-select-field-helper-top",children:z}),Y,B&&!h&&n.jsx("p",{className:"sa-select-field-helper",children:B}),h&&n.jsx("p",{className:"sa-select-field-error-msg",children:h})]})},V=(o,l,s)=>{const t=o.length;let p=l+s;for(;p>=0&&p<t;){if(!o[p].disable)return p;p+=s}if(s===1){for(let d=0;d<t;d++)if(!o[d].disable)return d}else for(let d=t-1;d>=0;d--)if(!o[d].disable)return d;return-1},fn=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"})}),hn=({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"})});
|
package/dist/interface.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ export interface IDropdown {
|
|
|
31
31
|
iconLeft?: React.ReactElement<IconPropsDropdown>;
|
|
32
32
|
placeholder?: string;
|
|
33
33
|
onSearch?: (e: string) => void;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Panel placement is now computed automatically (it flips
|
|
36
|
+
* between top/bottom based on available viewport space). This prop is
|
|
37
|
+
* ignored and has no effect. It will be removed in a future major version.
|
|
38
|
+
*/
|
|
34
39
|
position?: "top" | "bottom";
|
|
35
40
|
onBlur?: (e: React.FocusEvent<HTMLDivElement, Element>) => void;
|
|
36
41
|
onFocus?: (e: React.FocusEvent<HTMLDivElement, Element>) => void;
|