@starasia/dropdown 5.2.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dropdown.es.js +262 -188
- package/dist/dropdown.umd.js +52 -3
- package/dist/interface.d.ts +4 -1
- package/package.json +1 -1
package/dist/dropdown.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as l, jsx as n, Fragment as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
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";
|
|
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;
|
|
6
6
|
padding: 0;
|
|
@@ -44,6 +44,7 @@ const bn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
44
44
|
--paddingInline: 12px;
|
|
45
45
|
--paddingBlock: 4px;
|
|
46
46
|
--iconSize: 16px;
|
|
47
|
+
--iconMarginTop: 4px;
|
|
47
48
|
}
|
|
48
49
|
.sa-input-dropdown-size-md {
|
|
49
50
|
--baseFont: 14px;
|
|
@@ -52,6 +53,7 @@ const bn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
52
53
|
--paddingInline: 12px;
|
|
53
54
|
--paddingBlock: 8px;
|
|
54
55
|
--iconSize: 16px;
|
|
56
|
+
--iconMarginTop: 4px;
|
|
55
57
|
}
|
|
56
58
|
.sa-input-dropdown-size-lg {
|
|
57
59
|
--baseFont: 14px;
|
|
@@ -60,6 +62,7 @@ const bn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
60
62
|
--paddingInline: 12px;
|
|
61
63
|
--paddingBlock: 12px;
|
|
62
64
|
--iconSize: 20px;
|
|
65
|
+
--iconMarginTop: 2px;
|
|
63
66
|
}
|
|
64
67
|
.sa-input-dropdown-size-xl {
|
|
65
68
|
--baseFont: 16px;
|
|
@@ -68,6 +71,7 @@ const bn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
68
71
|
--paddingInline: 16px;
|
|
69
72
|
--paddingBlock: 16px;
|
|
70
73
|
--iconSize: 20px;
|
|
74
|
+
--iconMarginTop: 2px;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
/* === BASE CONTAINER === */
|
|
@@ -159,12 +163,26 @@ const bn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
159
163
|
display: flex;
|
|
160
164
|
flex-direction: row;
|
|
161
165
|
gap: 8px;
|
|
162
|
-
align-items:
|
|
166
|
+
align-items: flex-start;
|
|
163
167
|
justify-content: space-between;
|
|
164
168
|
width: 100%;
|
|
165
169
|
min-width: 0;
|
|
166
170
|
}
|
|
167
171
|
|
|
172
|
+
/* Chevron + clear button — top-aligned with margin so they appear visually
|
|
173
|
+
centered when single-line, and snap to top-right when content wraps */
|
|
174
|
+
.sa-input-dropdown-chevron,
|
|
175
|
+
.sa-input-dropdown-clear {
|
|
176
|
+
align-self: flex-start;
|
|
177
|
+
margin-top: var(--iconMarginTop, 4px);
|
|
178
|
+
}
|
|
179
|
+
.sa-input-dropdown-chevron {
|
|
180
|
+
display: inline-flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
justify-content: center;
|
|
183
|
+
flex-shrink: 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
168
186
|
.sa-input-dropdown-container-preview-item {
|
|
169
187
|
flex: 1;
|
|
170
188
|
display: flex;
|
|
@@ -485,16 +503,47 @@ const bn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
485
503
|
margin: 0;
|
|
486
504
|
}
|
|
487
505
|
|
|
506
|
+
/* === CLEAR BUTTON === */
|
|
507
|
+
.sa-input-dropdown-clear {
|
|
508
|
+
appearance: none;
|
|
509
|
+
border: 0;
|
|
510
|
+
background: transparent;
|
|
511
|
+
padding: 0;
|
|
512
|
+
cursor: pointer;
|
|
513
|
+
color: var(--sa-dropdown-placeholder);
|
|
514
|
+
border-radius: 50%;
|
|
515
|
+
flex-shrink: 0;
|
|
516
|
+
display: inline-flex;
|
|
517
|
+
align-items: center;
|
|
518
|
+
justify-content: center;
|
|
519
|
+
opacity: 1;
|
|
520
|
+
transition: opacity 120ms ease, color 120ms ease, transform 80ms ease;
|
|
521
|
+
}
|
|
522
|
+
.sa-input-dropdown-clear:hover {
|
|
523
|
+
color: var(--sa-dropdown-text-secondary);
|
|
524
|
+
}
|
|
525
|
+
.sa-input-dropdown-clear:active {
|
|
526
|
+
transform: scale(0.92);
|
|
527
|
+
}
|
|
528
|
+
.sa-input-dropdown-clear-hidden {
|
|
529
|
+
opacity: 0;
|
|
530
|
+
pointer-events: none;
|
|
531
|
+
cursor: default;
|
|
532
|
+
}
|
|
533
|
+
.sa-input-dropdown-container.disable .sa-input-dropdown-clear {
|
|
534
|
+
display: none;
|
|
535
|
+
}
|
|
536
|
+
|
|
488
537
|
`;
|
|
489
|
-
function
|
|
490
|
-
const [p, t] =
|
|
538
|
+
function En(o) {
|
|
539
|
+
const [p, t] = I(o), s = M(null), d = (r) => {
|
|
491
540
|
s.current && !s.current.contains(r.target) && t(!1);
|
|
492
541
|
};
|
|
493
542
|
return x(() => (document.addEventListener("click", d, !0), () => {
|
|
494
543
|
document.removeEventListener("click", d, !0);
|
|
495
544
|
}), []), { ref: s, isComponentVisible: p, setIsComponentVisible: t };
|
|
496
545
|
}
|
|
497
|
-
const
|
|
546
|
+
const Cn = ({ ...o }) => /* @__PURE__ */ l(
|
|
498
547
|
"svg",
|
|
499
548
|
{
|
|
500
549
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -526,7 +575,7 @@ const vn = ({ ...o }) => /* @__PURE__ */ l(
|
|
|
526
575
|
)
|
|
527
576
|
]
|
|
528
577
|
}
|
|
529
|
-
),
|
|
578
|
+
), zn = ({ width: o = 16 }) => /* @__PURE__ */ n(
|
|
530
579
|
"svg",
|
|
531
580
|
{
|
|
532
581
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -545,7 +594,7 @@ const vn = ({ ...o }) => /* @__PURE__ */ l(
|
|
|
545
594
|
}
|
|
546
595
|
)
|
|
547
596
|
}
|
|
548
|
-
),
|
|
597
|
+
), Rn = yn(
|
|
549
598
|
({
|
|
550
599
|
positionDropdown: o,
|
|
551
600
|
dropdownLists: p,
|
|
@@ -555,96 +604,96 @@ const vn = ({ ...o }) => /* @__PURE__ */ l(
|
|
|
555
604
|
onSearch: r,
|
|
556
605
|
value: m,
|
|
557
606
|
handleChangeValue: u,
|
|
558
|
-
multiSelect:
|
|
559
|
-
searchValue:
|
|
607
|
+
multiSelect: R,
|
|
608
|
+
searchValue: L,
|
|
560
609
|
highlightedIndex: y,
|
|
561
|
-
footer:
|
|
562
|
-
groupLabel:
|
|
563
|
-
onSelectAll:
|
|
564
|
-
},
|
|
565
|
-
const
|
|
610
|
+
footer: F,
|
|
611
|
+
groupLabel: H,
|
|
612
|
+
onSelectAll: N
|
|
613
|
+
}, U) => {
|
|
614
|
+
const j = M([]);
|
|
566
615
|
x(() => {
|
|
567
|
-
var
|
|
568
|
-
y >= 0 &&
|
|
616
|
+
var i;
|
|
617
|
+
y >= 0 && j.current[y] && ((i = j.current[y]) == null || i.scrollIntoView({ block: "nearest" }));
|
|
569
618
|
}, [y]);
|
|
570
|
-
const
|
|
571
|
-
/* @__PURE__ */ n(
|
|
619
|
+
const T = s && !d ? /* @__PURE__ */ l("div", { className: "sa-input-dropdown-container-dropdown-search", children: [
|
|
620
|
+
/* @__PURE__ */ n(Cn, { strokeWidth: 2, width: 16, style: { flexShrink: 0, color: "var(--sa-dropdown-placeholder-subtle)" } }),
|
|
572
621
|
/* @__PURE__ */ n(
|
|
573
622
|
"input",
|
|
574
623
|
{
|
|
575
|
-
onChange: (
|
|
576
|
-
r && r(
|
|
624
|
+
onChange: (i) => {
|
|
625
|
+
r && r(i.target.value);
|
|
577
626
|
},
|
|
578
|
-
value:
|
|
627
|
+
value: L,
|
|
579
628
|
autoFocus: !0,
|
|
580
629
|
placeholder: "Search..."
|
|
581
630
|
}
|
|
582
631
|
)
|
|
583
632
|
] }) : null;
|
|
584
|
-
return /* @__PURE__ */ n(
|
|
633
|
+
return /* @__PURE__ */ n(sn, { children: t ? /* @__PURE__ */ l(
|
|
585
634
|
"div",
|
|
586
635
|
{
|
|
587
636
|
className: "sa-input-dropdown-lists-container",
|
|
588
|
-
onClick: (
|
|
589
|
-
ref:
|
|
637
|
+
onClick: (i) => i.stopPropagation(),
|
|
638
|
+
ref: U,
|
|
590
639
|
children: [
|
|
591
|
-
o !== "top" &&
|
|
640
|
+
o !== "top" && T,
|
|
592
641
|
/* @__PURE__ */ l(
|
|
593
642
|
"div",
|
|
594
643
|
{
|
|
595
|
-
className: `sa-input-dropdown-item-container ${
|
|
644
|
+
className: `sa-input-dropdown-item-container ${R ? "multi" : ""}`,
|
|
596
645
|
children: [
|
|
597
|
-
|
|
598
|
-
/* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children:
|
|
599
|
-
|
|
646
|
+
H && /* @__PURE__ */ l("div", { className: "sa-input-dropdown-section-header", children: [
|
|
647
|
+
/* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children: H }),
|
|
648
|
+
R && N && /* @__PURE__ */ n(
|
|
600
649
|
"button",
|
|
601
650
|
{
|
|
602
651
|
className: "sa-input-dropdown-section-select-all",
|
|
603
|
-
onClick: (
|
|
604
|
-
|
|
652
|
+
onClick: (i) => {
|
|
653
|
+
i.stopPropagation(), N();
|
|
605
654
|
},
|
|
606
655
|
children: "Select all"
|
|
607
656
|
}
|
|
608
657
|
)
|
|
609
658
|
] }),
|
|
610
|
-
p.map((
|
|
611
|
-
const
|
|
659
|
+
p.map((i, A) => {
|
|
660
|
+
const $ = !!(m != null && m.find((P) => P.value === i.value)), w = !!i.description;
|
|
612
661
|
return /* @__PURE__ */ l(
|
|
613
662
|
"div",
|
|
614
663
|
{
|
|
615
664
|
className: [
|
|
616
665
|
"sa-input-dropdown-item",
|
|
617
666
|
w ? "has-description" : "",
|
|
618
|
-
|
|
667
|
+
$ ? "active" : "",
|
|
619
668
|
A === y ? "highlight" : "",
|
|
620
|
-
|
|
669
|
+
i.disable ? "sa-input-dropdown-item-disable" : ""
|
|
621
670
|
].filter(Boolean).join(" "),
|
|
622
|
-
ref: (
|
|
623
|
-
|
|
671
|
+
ref: (P) => {
|
|
672
|
+
j.current[A] = P;
|
|
624
673
|
},
|
|
625
|
-
onClick: () => u(
|
|
674
|
+
onClick: () => u(i.label, i.value),
|
|
626
675
|
children: [
|
|
627
|
-
|
|
628
|
-
|
|
676
|
+
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 }) }),
|
|
629
678
|
/* @__PURE__ */ l("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
630
679
|
/* @__PURE__ */ n(
|
|
631
680
|
"p",
|
|
632
681
|
{
|
|
633
682
|
className: [
|
|
634
683
|
"sa-input-dropdown-item-text",
|
|
635
|
-
|
|
684
|
+
i.disable ? "sa-input-dropdown-item-disable" : ""
|
|
636
685
|
].filter(Boolean).join(" "),
|
|
637
|
-
children:
|
|
686
|
+
children: i.label
|
|
638
687
|
}
|
|
639
688
|
),
|
|
640
|
-
|
|
689
|
+
i.description && /* @__PURE__ */ n(
|
|
641
690
|
"p",
|
|
642
691
|
{
|
|
643
692
|
className: [
|
|
644
693
|
"sa-input-dropdown-item-text-description",
|
|
645
|
-
|
|
694
|
+
i.disable ? "sa-input-dropdown-item-disable" : ""
|
|
646
695
|
].filter(Boolean).join(" "),
|
|
647
|
-
children:
|
|
696
|
+
children: i.description
|
|
648
697
|
}
|
|
649
698
|
)
|
|
650
699
|
] })
|
|
@@ -656,17 +705,17 @@ const vn = ({ ...o }) => /* @__PURE__ */ l(
|
|
|
656
705
|
]
|
|
657
706
|
}
|
|
658
707
|
),
|
|
659
|
-
o === "top" &&
|
|
660
|
-
|
|
708
|
+
o === "top" && T,
|
|
709
|
+
F && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-footer", onClick: (i) => i.stopPropagation(), children: F })
|
|
661
710
|
]
|
|
662
711
|
}
|
|
663
712
|
) : null });
|
|
664
713
|
}
|
|
665
|
-
),
|
|
714
|
+
), Ln = ({
|
|
666
715
|
children: o,
|
|
667
716
|
handleChangePosition: p
|
|
668
717
|
}) => {
|
|
669
|
-
const t =
|
|
718
|
+
const t = M(null);
|
|
670
719
|
x(() => {
|
|
671
720
|
var m;
|
|
672
721
|
const d = () => {
|
|
@@ -686,14 +735,14 @@ const vn = ({ ...o }) => /* @__PURE__ */ l(
|
|
|
686
735
|
}, []);
|
|
687
736
|
const s = (d) => d && (d.scrollHeight > d.clientHeight || d.scrollWidth > d.clientWidth);
|
|
688
737
|
return /* @__PURE__ */ n("div", { ref: t, children: o });
|
|
689
|
-
},
|
|
690
|
-
if (!document.getElementById(
|
|
738
|
+
}, an = "sa-input-dropdown-styles", Bn = (o) => {
|
|
739
|
+
if (!document.getElementById(an)) {
|
|
691
740
|
const p = document.createElement("style");
|
|
692
|
-
p.id =
|
|
741
|
+
p.id = an, p.textContent = o, document.head.appendChild(p);
|
|
693
742
|
}
|
|
694
743
|
};
|
|
695
|
-
|
|
696
|
-
const
|
|
744
|
+
Bn(Nn);
|
|
745
|
+
const On = ({
|
|
697
746
|
dropdownLists: o,
|
|
698
747
|
onChange: p,
|
|
699
748
|
defaultValue: t,
|
|
@@ -702,233 +751,255 @@ const Rn = ({
|
|
|
702
751
|
multiSelect: r,
|
|
703
752
|
searchAble: m,
|
|
704
753
|
iconLeft: u,
|
|
705
|
-
placeholder:
|
|
706
|
-
onSearch:
|
|
754
|
+
placeholder: R,
|
|
755
|
+
onSearch: L,
|
|
707
756
|
error: y,
|
|
708
|
-
onBlur:
|
|
709
|
-
onFocus:
|
|
710
|
-
disable:
|
|
711
|
-
searchValue:
|
|
712
|
-
variant:
|
|
713
|
-
footer:
|
|
714
|
-
groupLabel:
|
|
757
|
+
onBlur: F,
|
|
758
|
+
onFocus: H,
|
|
759
|
+
disable: N,
|
|
760
|
+
searchValue: U,
|
|
761
|
+
variant: j = "outline",
|
|
762
|
+
footer: T,
|
|
763
|
+
groupLabel: i,
|
|
715
764
|
onSelectAll: A,
|
|
716
|
-
fullWidth:
|
|
765
|
+
fullWidth: $ = !0,
|
|
717
766
|
triggerInput: w = !1,
|
|
718
|
-
clearOnSelect:
|
|
767
|
+
clearOnSelect: P = !1,
|
|
768
|
+
hideChevronIcon: pn = !1,
|
|
769
|
+
clearable: cn = !1,
|
|
770
|
+
onClear: K,
|
|
719
771
|
/* field wrapper */
|
|
720
|
-
label:
|
|
721
|
-
labelPosition:
|
|
722
|
-
required:
|
|
723
|
-
optional:
|
|
724
|
-
description:
|
|
725
|
-
helperText:
|
|
772
|
+
label: J,
|
|
773
|
+
labelPosition: wn = "outside-top",
|
|
774
|
+
required: V,
|
|
775
|
+
optional: nn,
|
|
776
|
+
description: B,
|
|
777
|
+
helperText: D,
|
|
726
778
|
errorText: h
|
|
727
779
|
}) => {
|
|
728
|
-
const
|
|
780
|
+
const Z = [
|
|
729
781
|
"sa-select-field",
|
|
730
|
-
|
|
731
|
-
].filter(Boolean).join(" "),
|
|
732
|
-
|
|
733
|
-
), [
|
|
782
|
+
$ ? "sa-select-field-fullwidth" : ""
|
|
783
|
+
].filter(Boolean).join(" "), E = s !== void 0, Q = M(), un = y || !!h, [c, S] = I(
|
|
784
|
+
E ? s || [] : t || []
|
|
785
|
+
), [hn, en] = I(""), [k, X] = I(-1), [fn, q] = I(
|
|
734
786
|
() => {
|
|
735
|
-
var e,
|
|
736
|
-
return !r && (s != null && s.length || t != null && t.length) ? ((e = s == null ? void 0 : s[0]) == null ? void 0 : e.label) ?? ((
|
|
787
|
+
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) ?? "" : "";
|
|
737
789
|
}
|
|
738
|
-
), g =
|
|
739
|
-
|
|
740
|
-
|
|
790
|
+
), g = M(null), { isComponentVisible: f, ref: Y, setIsComponentVisible: C } = En(!1), O = o !== void 0, on = c.length > 0, bn = (e) => {
|
|
791
|
+
e.stopPropagation();
|
|
792
|
+
const a = [];
|
|
793
|
+
E || S(a), p(a), w && q(""), K == null || K();
|
|
794
|
+
}, gn = () => {
|
|
795
|
+
O && C((e) => !e);
|
|
796
|
+
}, G = (e, a) => {
|
|
741
797
|
if (r) {
|
|
742
|
-
if (c == null ? void 0 : c.find((v) => v.value ===
|
|
743
|
-
const v = c.filter((
|
|
744
|
-
|
|
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);
|
|
745
801
|
} else {
|
|
746
|
-
const v = [...c, { label: e, value:
|
|
747
|
-
|
|
802
|
+
const v = [...c, { label: e, value: a }];
|
|
803
|
+
E || S(v), p(v);
|
|
748
804
|
}
|
|
749
|
-
w &&
|
|
805
|
+
w && q("");
|
|
750
806
|
} else {
|
|
751
|
-
const b = [{ label: e, value:
|
|
752
|
-
|
|
807
|
+
const b = [{ label: e, value: a }];
|
|
808
|
+
E || S(b), p(b), w && q(P ? "" : e), C(!1);
|
|
753
809
|
}
|
|
754
810
|
};
|
|
755
811
|
x(() => {
|
|
756
|
-
|
|
812
|
+
E && S(s || []);
|
|
757
813
|
}, [s]), x(() => {
|
|
758
|
-
|
|
814
|
+
E || JSON.stringify(Q.current) === JSON.stringify(t) || (Q.current = t, S(Q.current || []));
|
|
759
815
|
}, [t]);
|
|
760
|
-
const
|
|
816
|
+
const vn = () => c.length ? r ? c == null ? void 0 : c.map((e, a) => /* @__PURE__ */ l("div", { className: "sa-input-dropdown-preview-item", children: [
|
|
761
817
|
/* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: e == null ? void 0 : e.label }),
|
|
762
818
|
/* @__PURE__ */ n(
|
|
763
|
-
|
|
819
|
+
dn,
|
|
764
820
|
{
|
|
765
821
|
onClick: (b) => {
|
|
766
|
-
b.stopPropagation(),
|
|
822
|
+
b.stopPropagation(), G(e.label, e.value);
|
|
767
823
|
}
|
|
768
824
|
}
|
|
769
825
|
)
|
|
770
|
-
] },
|
|
771
|
-
if (
|
|
772
|
-
const e = window.innerHeight,
|
|
773
|
-
g.current.style.left = `${
|
|
826
|
+
] }, 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
|
+
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"));
|
|
774
830
|
}
|
|
775
831
|
};
|
|
776
|
-
x(() => (window.addEventListener("scroll",
|
|
777
|
-
window.removeEventListener("scroll",
|
|
832
|
+
x(() => (window.addEventListener("scroll", z), window.addEventListener("resize", z), () => {
|
|
833
|
+
window.removeEventListener("scroll", z), window.removeEventListener("resize", z);
|
|
778
834
|
}), []), x(() => {
|
|
779
|
-
|
|
835
|
+
z();
|
|
780
836
|
}, [f]), x(() => {
|
|
781
837
|
if (!f || !g.current)
|
|
782
838
|
return;
|
|
783
839
|
const e = new ResizeObserver(() => {
|
|
784
|
-
|
|
840
|
+
z();
|
|
785
841
|
});
|
|
786
842
|
return e.observe(g.current), () => e.disconnect();
|
|
787
843
|
}, [f]), x(() => {
|
|
788
|
-
f ||
|
|
844
|
+
f || X(-1);
|
|
789
845
|
}, [f]);
|
|
790
|
-
const
|
|
791
|
-
if (
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
switch (e.key) {
|
|
796
|
-
case "ArrowDown": {
|
|
797
|
-
e.preventDefault();
|
|
798
|
-
const i = on(o, k, 1);
|
|
799
|
-
i !== -1 && J(i);
|
|
800
|
-
break;
|
|
846
|
+
const rn = (e) => {
|
|
847
|
+
if (O) {
|
|
848
|
+
if (!f) {
|
|
849
|
+
(e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), C(!0));
|
|
850
|
+
return;
|
|
801
851
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
o
|
|
812
|
-
|
|
813
|
-
|
|
852
|
+
switch (e.key) {
|
|
853
|
+
case "ArrowDown": {
|
|
854
|
+
e.preventDefault();
|
|
855
|
+
const a = tn(o, k, 1);
|
|
856
|
+
a !== -1 && X(a);
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
case "ArrowUp": {
|
|
860
|
+
e.preventDefault();
|
|
861
|
+
const a = tn(o, k, -1);
|
|
862
|
+
a !== -1 && X(a);
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
865
|
+
case "Enter": {
|
|
866
|
+
e.preventDefault(), k >= 0 && o[k] && !o[k].disable && G(
|
|
867
|
+
o[k].label,
|
|
868
|
+
o[k].value
|
|
869
|
+
);
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
case "Escape":
|
|
873
|
+
C(!1);
|
|
874
|
+
break;
|
|
814
875
|
}
|
|
815
|
-
case "Escape":
|
|
816
|
-
N(!1);
|
|
817
|
-
break;
|
|
818
876
|
}
|
|
819
|
-
},
|
|
820
|
-
|
|
877
|
+
}, W = d === "lg" || d === "xl" ? 20 : 16, xn = cn && !N ? /* @__PURE__ */ n(
|
|
878
|
+
"button",
|
|
879
|
+
{
|
|
880
|
+
type: "button",
|
|
881
|
+
className: `sa-input-dropdown-clear${on ? "" : " sa-input-dropdown-clear-hidden"}`,
|
|
882
|
+
"aria-label": "Clear selection",
|
|
883
|
+
"aria-hidden": !on,
|
|
884
|
+
tabIndex: -1,
|
|
885
|
+
onClick: bn,
|
|
886
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
887
|
+
children: /* @__PURE__ */ n(Dn, { width: W, height: W })
|
|
888
|
+
}
|
|
889
|
+
) : null, mn = w ? /* @__PURE__ */ l(sn, { children: [
|
|
890
|
+
r && c.map((e, a) => /* @__PURE__ */ l("div", { className: "sa-input-dropdown-preview-item", children: [
|
|
821
891
|
/* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: e == null ? void 0 : e.label }),
|
|
822
892
|
/* @__PURE__ */ n(
|
|
823
|
-
|
|
893
|
+
dn,
|
|
824
894
|
{
|
|
825
895
|
onClick: (b) => {
|
|
826
|
-
b.stopPropagation(),
|
|
896
|
+
b.stopPropagation(), G(e.label, e.value);
|
|
827
897
|
}
|
|
828
898
|
}
|
|
829
899
|
)
|
|
830
|
-
] },
|
|
900
|
+
] }, a)),
|
|
831
901
|
/* @__PURE__ */ n(
|
|
832
902
|
"input",
|
|
833
903
|
{
|
|
834
904
|
className: "sa-input-dropdown-trigger-input",
|
|
835
|
-
value:
|
|
905
|
+
value: fn,
|
|
836
906
|
onChange: (e) => {
|
|
837
|
-
const
|
|
838
|
-
|
|
907
|
+
const a = e.target.value;
|
|
908
|
+
q(a), L == null || L(a), !f && O && C(!0);
|
|
839
909
|
},
|
|
840
910
|
onFocus: () => {
|
|
841
|
-
|
|
911
|
+
!N && O && C(!0);
|
|
842
912
|
},
|
|
843
913
|
onBlur: () => {
|
|
844
|
-
setTimeout(() =>
|
|
914
|
+
r || setTimeout(() => C(!1), 150);
|
|
845
915
|
},
|
|
846
|
-
onKeyDown:
|
|
847
|
-
placeholder: c.length === 0 || r ?
|
|
848
|
-
disabled:
|
|
916
|
+
onKeyDown: rn,
|
|
917
|
+
placeholder: c.length === 0 || r ? R : void 0,
|
|
918
|
+
disabled: N
|
|
849
919
|
}
|
|
850
920
|
)
|
|
851
|
-
] }) : null,
|
|
921
|
+
] }) : null, _ = /* @__PURE__ */ n(Ln, { handleChangePosition: z, children: /* @__PURE__ */ l(
|
|
852
922
|
"div",
|
|
853
923
|
{
|
|
854
924
|
className: [
|
|
855
925
|
"sa-input-dropdown-container",
|
|
856
|
-
|
|
926
|
+
j,
|
|
857
927
|
`sa-input-dropdown-size-${d}`,
|
|
858
928
|
w ? "trigger-input" : "",
|
|
859
929
|
f ? "active" : "",
|
|
860
|
-
|
|
861
|
-
|
|
930
|
+
un ? "error" : "",
|
|
931
|
+
N ? "disable" : ""
|
|
862
932
|
].filter(Boolean).join(" "),
|
|
863
|
-
ref:
|
|
864
|
-
onClick: w ? void 0 :
|
|
865
|
-
onKeyDown: w ? void 0 :
|
|
933
|
+
ref: Y,
|
|
934
|
+
onClick: w ? void 0 : gn,
|
|
935
|
+
onKeyDown: w ? void 0 : rn,
|
|
866
936
|
tabIndex: w ? void 0 : 0,
|
|
867
|
-
onBlur: w ? void 0 :
|
|
868
|
-
onFocus: w ? void 0 :
|
|
937
|
+
onBlur: w ? void 0 : F,
|
|
938
|
+
onFocus: w ? void 0 : H,
|
|
869
939
|
children: [
|
|
870
940
|
/* @__PURE__ */ l("div", { className: "sa-input-dropdown-preview-container", children: [
|
|
871
|
-
u ?
|
|
872
|
-
width:
|
|
941
|
+
u ? ln.cloneElement(u, {
|
|
942
|
+
width: W,
|
|
873
943
|
style: { color: "var(--sa-dropdown-placeholder)", flexShrink: 0 }
|
|
874
944
|
}) : null,
|
|
875
|
-
/* @__PURE__ */ n("div", { className: "sa-input-dropdown-container-preview-item", children: w ?
|
|
876
|
-
|
|
945
|
+
/* @__PURE__ */ n("div", { className: "sa-input-dropdown-container-preview-item", children: w ? mn : vn() }),
|
|
946
|
+
xn,
|
|
947
|
+
!pn && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-chevron", children: f ? /* @__PURE__ */ n(jn, { width: W }) : /* @__PURE__ */ n(Sn, { width: W }) })
|
|
877
948
|
] }),
|
|
878
|
-
/* @__PURE__ */ n(
|
|
879
|
-
|
|
949
|
+
O && /* @__PURE__ */ n(
|
|
950
|
+
Rn,
|
|
880
951
|
{
|
|
881
952
|
dropdownLists: o,
|
|
882
|
-
handleChangeValue:
|
|
953
|
+
handleChangeValue: G,
|
|
883
954
|
isComponentVisible: f,
|
|
884
|
-
positionDropdown:
|
|
955
|
+
positionDropdown: hn,
|
|
885
956
|
searchAble: !!m,
|
|
886
957
|
hideSearch: w,
|
|
887
958
|
value: c,
|
|
888
|
-
onSearch:
|
|
959
|
+
onSearch: L,
|
|
889
960
|
ref: g,
|
|
890
961
|
multiSelect: r,
|
|
891
|
-
searchValue:
|
|
962
|
+
searchValue: U,
|
|
892
963
|
highlightedIndex: k,
|
|
893
|
-
footer:
|
|
894
|
-
groupLabel:
|
|
964
|
+
footer: T,
|
|
965
|
+
groupLabel: i,
|
|
895
966
|
onSelectAll: A
|
|
896
967
|
}
|
|
897
968
|
)
|
|
898
969
|
]
|
|
899
970
|
}
|
|
900
971
|
) });
|
|
901
|
-
return
|
|
972
|
+
return J ? wn === "outside-left" ? /* @__PURE__ */ l("div", { className: `${Z} sa-select-field-left`, children: [
|
|
902
973
|
/* @__PURE__ */ l("div", { className: "sa-select-field-left-label", children: [
|
|
903
974
|
/* @__PURE__ */ l("div", { className: "sa-select-field-label-row", children: [
|
|
904
|
-
/* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children:
|
|
905
|
-
|
|
906
|
-
|
|
975
|
+
/* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: J }),
|
|
976
|
+
nn && /* @__PURE__ */ n("span", { className: "sa-select-field-optional-badge", children: "Optional" }),
|
|
977
|
+
V && /* @__PURE__ */ n("span", { className: "sa-select-field-required", children: "*" })
|
|
907
978
|
] }),
|
|
908
|
-
|
|
979
|
+
B && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: B })
|
|
909
980
|
] }),
|
|
910
981
|
/* @__PURE__ */ l("div", { className: "sa-select-field-input-wrap", children: [
|
|
911
|
-
|
|
912
|
-
|
|
982
|
+
_,
|
|
983
|
+
D && !h && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: D }),
|
|
913
984
|
h && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: h })
|
|
914
985
|
] })
|
|
915
|
-
] }) : /* @__PURE__ */ l("div", { className:
|
|
986
|
+
] }) : /* @__PURE__ */ l("div", { className: Z, children: [
|
|
916
987
|
/* @__PURE__ */ l("div", { className: "sa-select-field-label-row", children: [
|
|
917
|
-
/* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children:
|
|
918
|
-
|
|
919
|
-
|
|
988
|
+
/* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: J }),
|
|
989
|
+
nn && /* @__PURE__ */ n("span", { className: "sa-select-field-optional-badge", children: "Optional" }),
|
|
990
|
+
V && /* @__PURE__ */ n("span", { className: "sa-select-field-required", children: "*" })
|
|
920
991
|
] }),
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
992
|
+
B && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: B }),
|
|
993
|
+
_,
|
|
994
|
+
D && !h && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: D }),
|
|
924
995
|
h && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: h })
|
|
925
|
-
] }) : /* @__PURE__ */ l("div", { className:
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
996
|
+
] }) : /* @__PURE__ */ l("div", { className: Z, children: [
|
|
997
|
+
B && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: B }),
|
|
998
|
+
_,
|
|
999
|
+
D && !h && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: D }),
|
|
929
1000
|
h && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: h })
|
|
930
1001
|
] });
|
|
931
|
-
},
|
|
1002
|
+
}, tn = (o, p, t) => {
|
|
932
1003
|
const s = o.length;
|
|
933
1004
|
let d = p + t;
|
|
934
1005
|
for (; d >= 0 && d < s; ) {
|
|
@@ -945,7 +1016,10 @@ const Rn = ({
|
|
|
945
1016
|
if (!o[r].disable)
|
|
946
1017
|
return r;
|
|
947
1018
|
return -1;
|
|
948
|
-
},
|
|
1019
|
+
}, Dn = (o) => /* @__PURE__ */ l("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...o, children: [
|
|
1020
|
+
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "7", fill: "currentColor", opacity: "0.2" }),
|
|
1021
|
+
/* @__PURE__ */ n("path", { d: "M5.5 5.5l5 5M10.5 5.5l-5 5", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" })
|
|
1022
|
+
] }), dn = (o) => /* @__PURE__ */ n(
|
|
949
1023
|
"svg",
|
|
950
1024
|
{
|
|
951
1025
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -966,7 +1040,7 @@ const Rn = ({
|
|
|
966
1040
|
}
|
|
967
1041
|
)
|
|
968
1042
|
}
|
|
969
|
-
),
|
|
1043
|
+
), Sn = ({ width: o = 16 }) => /* @__PURE__ */ n(
|
|
970
1044
|
"svg",
|
|
971
1045
|
{
|
|
972
1046
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -986,7 +1060,7 @@ const Rn = ({
|
|
|
986
1060
|
}
|
|
987
1061
|
)
|
|
988
1062
|
}
|
|
989
|
-
),
|
|
1063
|
+
), jn = ({ width: o = 16 }) => /* @__PURE__ */ n(
|
|
990
1064
|
"svg",
|
|
991
1065
|
{
|
|
992
1066
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1008,5 +1082,5 @@ const Rn = ({
|
|
|
1008
1082
|
}
|
|
1009
1083
|
);
|
|
1010
1084
|
export {
|
|
1011
|
-
|
|
1085
|
+
On as Dropdown
|
|
1012
1086
|
};
|
package/dist/dropdown.umd.js
CHANGED
|
@@ -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
|
|
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");
|
|
2
2
|
* {
|
|
3
3
|
margin: 0;
|
|
4
4
|
padding: 0;
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
--paddingInline: 12px;
|
|
43
43
|
--paddingBlock: 4px;
|
|
44
44
|
--iconSize: 16px;
|
|
45
|
+
--iconMarginTop: 4px;
|
|
45
46
|
}
|
|
46
47
|
.sa-input-dropdown-size-md {
|
|
47
48
|
--baseFont: 14px;
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
--paddingInline: 12px;
|
|
51
52
|
--paddingBlock: 8px;
|
|
52
53
|
--iconSize: 16px;
|
|
54
|
+
--iconMarginTop: 4px;
|
|
53
55
|
}
|
|
54
56
|
.sa-input-dropdown-size-lg {
|
|
55
57
|
--baseFont: 14px;
|
|
@@ -58,6 +60,7 @@
|
|
|
58
60
|
--paddingInline: 12px;
|
|
59
61
|
--paddingBlock: 12px;
|
|
60
62
|
--iconSize: 20px;
|
|
63
|
+
--iconMarginTop: 2px;
|
|
61
64
|
}
|
|
62
65
|
.sa-input-dropdown-size-xl {
|
|
63
66
|
--baseFont: 16px;
|
|
@@ -66,6 +69,7 @@
|
|
|
66
69
|
--paddingInline: 16px;
|
|
67
70
|
--paddingBlock: 16px;
|
|
68
71
|
--iconSize: 20px;
|
|
72
|
+
--iconMarginTop: 2px;
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
/* === BASE CONTAINER === */
|
|
@@ -157,12 +161,26 @@
|
|
|
157
161
|
display: flex;
|
|
158
162
|
flex-direction: row;
|
|
159
163
|
gap: 8px;
|
|
160
|
-
align-items:
|
|
164
|
+
align-items: flex-start;
|
|
161
165
|
justify-content: space-between;
|
|
162
166
|
width: 100%;
|
|
163
167
|
min-width: 0;
|
|
164
168
|
}
|
|
165
169
|
|
|
170
|
+
/* Chevron + clear button — top-aligned with margin so they appear visually
|
|
171
|
+
centered when single-line, and snap to top-right when content wraps */
|
|
172
|
+
.sa-input-dropdown-chevron,
|
|
173
|
+
.sa-input-dropdown-clear {
|
|
174
|
+
align-self: flex-start;
|
|
175
|
+
margin-top: var(--iconMarginTop, 4px);
|
|
176
|
+
}
|
|
177
|
+
.sa-input-dropdown-chevron {
|
|
178
|
+
display: inline-flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
flex-shrink: 0;
|
|
182
|
+
}
|
|
183
|
+
|
|
166
184
|
.sa-input-dropdown-container-preview-item {
|
|
167
185
|
flex: 1;
|
|
168
186
|
display: flex;
|
|
@@ -483,4 +501,35 @@
|
|
|
483
501
|
margin: 0;
|
|
484
502
|
}
|
|
485
503
|
|
|
486
|
-
`;function rn(o){const[p,d]=l.useState(o),t=l.useRef(null),i=r=>{t.current&&!t.current.contains(r.target)&&d(!1)};return l.useEffect(()=>(document.addEventListener("click",i,!0),()=>{document.removeEventListener("click",i,!0)}),[]),{ref:t,isComponentVisible:p,setIsComponentVisible:d}}const an=({...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"})]}),sn=({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"})}),dn=l.forwardRef(({positionDropdown:o,dropdownLists:p,isComponentVisible:d,searchAble:t,hideSearch:i,onSearch:r,value:k,handleChangeValue:f,multiSelect:C,searchValue:z,highlightedIndex:y,footer:W,groupLabel:I,onSelectAll:L},$)=>{const j=l.useRef([]);l.useEffect(()=>{var s;y>=0&&j.current[y]&&((s=j.current[y])==null||s.scrollIntoView({block:"nearest"}))},[y]);const F=t&&!i?n.jsxs("div",{className:"sa-input-dropdown-container-dropdown-search",children:[n.jsx(an,{strokeWidth:2,width:16,style:{flexShrink:0,color:"var(--sa-dropdown-placeholder-subtle)"}}),n.jsx("input",{onChange:s=>{r&&r(s.target.value)},value:z,autoFocus:!0,placeholder:"Search..."})]}):null;return n.jsx(n.Fragment,{children:d?n.jsxs("div",{className:"sa-input-dropdown-lists-container",onClick:s=>s.stopPropagation(),ref:$,children:[o!=="top"&&F,n.jsxs("div",{className:`sa-input-dropdown-item-container ${C?"multi":""}`,children:[I&&n.jsxs("div",{className:"sa-input-dropdown-section-header",children:[n.jsx("span",{className:"sa-input-dropdown-section-label",children:I}),C&&L&&n.jsx("button",{className:"sa-input-dropdown-section-select-all",onClick:s=>{s.stopPropagation(),L()},children:"Select all"})]}),p.map((s,A)=>{const M=!!(k!=null&&k.find(O=>O.value===s.value)),w=!!s.description;return n.jsxs("div",{className:["sa-input-dropdown-item",w?"has-description":"",M?"active":"",A===y?"highlight":"",s.disable?"sa-input-dropdown-item-disable":""].filter(Boolean).join(" "),ref:O=>{j.current[A]=O},onClick:()=>f(s.label,s.value),children:[C&&n.jsx("div",{className:"sa-input-dropdown-item-check",children:M&&n.jsx(sn,{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"&&F,W&&n.jsx("div",{className:"sa-input-dropdown-footer",onClick:s=>s.stopPropagation(),children:W})]}):null})}),tn=({children:o,handleChangePosition:p})=>{const d=l.useRef(null);l.useEffect(()=>{var k;const i=()=>{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",i),i(),()=>{r&&r.removeEventListener("scroll",i)}},[]);const t=i=>i&&(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth);return n.jsx("div",{ref:d,children:o})},X="sa-input-dropdown-styles";(o=>{if(!document.getElementById(X)){const p=document.createElement("style");p.id=X,p.textContent=o,document.head.appendChild(p)}})(on);const ln=({dropdownLists:o,onChange:p,defaultValue:d,value:t,size:i="md",multiSelect:r,searchAble:k,iconLeft:f,placeholder:C,onSearch:z,error:y,onBlur:W,onFocus:I,disable:L,searchValue:$,variant:j="outline",footer:F,groupLabel:s,onSelectAll:A,fullWidth:M=!0,triggerInput:w=!1,clearOnSelect:O=!1,label:q,labelPosition:wn="outside-top",required:V,optional:R,description:S,helperText:B,errorText:h})=>{const G=["sa-select-field",M?"sa-select-field-fullwidth":""].filter(Boolean).join(" "),D=t!==void 0,T=l.useRef(),fn=y||!!h,[c,P]=l.useState(D?t||[]:d||[]),[hn,nn]=l.useState(""),[m,K]=l.useState(-1),[un,U]=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:J,setIsComponentVisible:E}=rn(!1),bn=()=>{E(e=>!e)},H=(e,a)=>{if(r){if(c==null?void 0:c.find(v=>v.value===a)){const v=c.filter(xn=>xn.value!==a);D||P(v),p(v)}else{const v=[...c,{label:e,value:a}];D||P(v),p(v)}w&&U("")}else{const b=[{label:e,value:a}];D||P(b),p(b),w&&U(O?"":e),E(!1)}};l.useEffect(()=>{D&&P(t||[])},[t]),l.useEffect(()=>{D||JSON.stringify(T.current)===JSON.stringify(d)||(T.current=d,P(T.current||[]))},[d]);const gn=()=>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(_,{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:C}),N=()=>{if(J.current&&g.current){const e=window.innerHeight,a=J.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`,nn("top")):(g.current.style.top=`${a.top+a.height+4}px`,nn("bottom"))}};l.useEffect(()=>(window.addEventListener("scroll",N),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N),window.removeEventListener("resize",N)}),[]),l.useEffect(()=>{N()},[u]),l.useEffect(()=>{if(!u||!g.current)return;const e=new ResizeObserver(()=>{N()});return e.observe(g.current),()=>e.disconnect()},[u]),l.useEffect(()=>{u||K(-1)},[u]);const en=e=>{if(!u){(e.key==="ArrowDown"||e.key==="Enter")&&(e.preventDefault(),E(!0));return}switch(e.key){case"ArrowDown":{e.preventDefault();const a=Y(o,m,1);a!==-1&&K(a);break}case"ArrowUp":{e.preventDefault();const a=Y(o,m,-1);a!==-1&&K(a);break}case"Enter":{e.preventDefault(),m>=0&&o[m]&&!o[m].disable&&H(o[m].label,o[m].value);break}case"Escape":E(!1);break}},Z=i==="lg"||i==="xl"?20:16,vn=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(_,{onClick:b=>{b.stopPropagation(),H(e.label,e.value)}})]},a)),n.jsx("input",{className:"sa-input-dropdown-trigger-input",value:un,onChange:e=>{const a=e.target.value;U(a),z==null||z(a),u||E(!0)},onFocus:()=>{L||E(!0)},onBlur:()=>{setTimeout(()=>E(!1),150)},onKeyDown:en,placeholder:c.length===0||r?C:void 0,disabled:L})]}):null,Q=n.jsx(tn,{handleChangePosition:N,children:n.jsxs("div",{className:["sa-input-dropdown-container",j,`sa-input-dropdown-size-${i}`,w?"trigger-input":"",u?"active":"",fn?"error":"",L?"disable":""].filter(Boolean).join(" "),ref:J,onClick:w?void 0:bn,onKeyDown:w?void 0:en,tabIndex:w?void 0:0,onBlur:w?void 0:W,onFocus:w?void 0:I,children:[n.jsxs("div",{className:"sa-input-dropdown-preview-container",children:[f?l.cloneElement(f,{width:Z,style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0}}):null,n.jsx("div",{className:"sa-input-dropdown-container-preview-item",children:w?vn:gn()}),u?n.jsx(cn,{width:Z}):n.jsx(pn,{width:Z})]}),n.jsx(dn,{dropdownLists:o,handleChangeValue:H,isComponentVisible:u,positionDropdown:hn,searchAble:!!k,hideSearch:w,value:c,onSearch:z,ref:g,multiSelect:r,searchValue:$,highlightedIndex:m,footer:F,groupLabel:s,onSelectAll:A})]})});return q?wn==="outside-left"?n.jsxs("div",{className:`${G} 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:q}),R&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),V&&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:[Q,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:G,children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:q}),R&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),V&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),S&&n.jsx("p",{className:"sa-select-field-helper-top",children:S}),Q,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:G,children:[S&&n.jsx("p",{className:"sa-select-field-helper-top",children:S}),Q,B&&!h&&n.jsx("p",{className:"sa-select-field-helper",children:B}),h&&n.jsx("p",{className:"sa-select-field-error-msg",children:h})]})},Y=(o,p,d)=>{const t=o.length;let i=p+d;for(;i>=0&&i<t;){if(!o[i].disable)return i;i+=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},_=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"})}),pn=({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"})}),cn=({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=ln,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|
|
504
|
+
/* === CLEAR BUTTON === */
|
|
505
|
+
.sa-input-dropdown-clear {
|
|
506
|
+
appearance: none;
|
|
507
|
+
border: 0;
|
|
508
|
+
background: transparent;
|
|
509
|
+
padding: 0;
|
|
510
|
+
cursor: pointer;
|
|
511
|
+
color: var(--sa-dropdown-placeholder);
|
|
512
|
+
border-radius: 50%;
|
|
513
|
+
flex-shrink: 0;
|
|
514
|
+
display: inline-flex;
|
|
515
|
+
align-items: center;
|
|
516
|
+
justify-content: center;
|
|
517
|
+
opacity: 1;
|
|
518
|
+
transition: opacity 120ms ease, color 120ms ease, transform 80ms ease;
|
|
519
|
+
}
|
|
520
|
+
.sa-input-dropdown-clear:hover {
|
|
521
|
+
color: var(--sa-dropdown-text-secondary);
|
|
522
|
+
}
|
|
523
|
+
.sa-input-dropdown-clear:active {
|
|
524
|
+
transform: scale(0.92);
|
|
525
|
+
}
|
|
526
|
+
.sa-input-dropdown-clear-hidden {
|
|
527
|
+
opacity: 0;
|
|
528
|
+
pointer-events: none;
|
|
529
|
+
cursor: default;
|
|
530
|
+
}
|
|
531
|
+
.sa-input-dropdown-container.disable .sa-input-dropdown-clear {
|
|
532
|
+
display: none;
|
|
533
|
+
}
|
|
534
|
+
|
|
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"})});
|
package/dist/interface.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface IDropdown {
|
|
|
9
9
|
label: string;
|
|
10
10
|
value: string;
|
|
11
11
|
}[]) => void;
|
|
12
|
-
dropdownLists
|
|
12
|
+
dropdownLists?: {
|
|
13
13
|
icon?: React.ReactElement<IconPropsDropdown>;
|
|
14
14
|
label: string;
|
|
15
15
|
value: string;
|
|
@@ -43,6 +43,9 @@ export interface IDropdown {
|
|
|
43
43
|
fullWidth?: boolean;
|
|
44
44
|
triggerInput?: boolean;
|
|
45
45
|
clearOnSelect?: boolean;
|
|
46
|
+
hideChevronIcon?: boolean;
|
|
47
|
+
clearable?: boolean;
|
|
48
|
+
onClear?: () => void;
|
|
46
49
|
label?: React.ReactNode;
|
|
47
50
|
labelPosition?: DropdownLabelPosition;
|
|
48
51
|
required?: boolean;
|