@starasia/dropdown 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dropdown.es.js +215 -211
- package/dist/dropdown.umd.js +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/interface.d.ts +9 -8
- package/package.json +6 -6
- package/dist/SelectField.d.ts +0 -3
package/dist/dropdown.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as t, jsx as n, Fragment as sn } from "react/jsx-runtime";
|
|
2
|
+
import Y, { useState as P, useRef as I, useEffect as v, forwardRef as tn } from "react";
|
|
3
|
+
const dn = `@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;
|
|
@@ -500,15 +500,15 @@ const _ = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@30
|
|
|
500
500
|
width: 100%;
|
|
501
501
|
}
|
|
502
502
|
`;
|
|
503
|
-
function
|
|
504
|
-
const [
|
|
505
|
-
|
|
503
|
+
function ln(e) {
|
|
504
|
+
const [p, d] = P(e), l = I(null), o = (r) => {
|
|
505
|
+
l.current && !l.current.contains(r.target) && d(!1);
|
|
506
506
|
};
|
|
507
|
-
return
|
|
507
|
+
return v(() => (document.addEventListener("click", o, !0), () => {
|
|
508
508
|
document.removeEventListener("click", o, !0);
|
|
509
|
-
}), []), { ref:
|
|
509
|
+
}), []), { ref: l, isComponentVisible: p, setIsComponentVisible: d };
|
|
510
510
|
}
|
|
511
|
-
const
|
|
511
|
+
const pn = ({ ...e }) => /* @__PURE__ */ t(
|
|
512
512
|
"svg",
|
|
513
513
|
{
|
|
514
514
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -540,8 +540,8 @@ const en = ({ ...e }) => /* @__PURE__ */ p(
|
|
|
540
540
|
)
|
|
541
541
|
]
|
|
542
542
|
}
|
|
543
|
-
),
|
|
544
|
-
/* @__PURE__ */
|
|
543
|
+
), cn = ({ isChecked: e }) => /* @__PURE__ */ t("div", { className: "checkbox-wrapper-30", children: [
|
|
544
|
+
/* @__PURE__ */ t("span", { className: "checkbox", children: [
|
|
545
545
|
/* @__PURE__ */ n(
|
|
546
546
|
"input",
|
|
547
547
|
{
|
|
@@ -560,92 +560,92 @@ const en = ({ ...e }) => /* @__PURE__ */ p(
|
|
|
560
560
|
d: "M5.5,11.3L9,14.8L20.2,3.3l0,0c-0.5-1-1.5-1.8-2.7-1.8h-13c-1.7,0-3,1.3-3,3v13c0,1.7,1.3,3,3,3h13 c1.7,0,3-1.3,3-3v-13c0-0.4-0.1-0.8-0.3-1.2"
|
|
561
561
|
}
|
|
562
562
|
) }) })
|
|
563
|
-
] }),
|
|
563
|
+
] }), hn = tn(
|
|
564
564
|
({
|
|
565
565
|
positionDropdown: e,
|
|
566
|
-
dropdownLists:
|
|
567
|
-
isComponentVisible:
|
|
568
|
-
searchAble:
|
|
566
|
+
dropdownLists: p,
|
|
567
|
+
isComponentVisible: d,
|
|
568
|
+
searchAble: l,
|
|
569
569
|
onSearch: o,
|
|
570
570
|
value: r,
|
|
571
|
-
handleChangeValue:
|
|
572
|
-
multiSelect:
|
|
573
|
-
searchValue:
|
|
574
|
-
highlightedIndex:
|
|
575
|
-
footer:
|
|
576
|
-
groupLabel:
|
|
577
|
-
onSelectAll:
|
|
578
|
-
},
|
|
579
|
-
const
|
|
580
|
-
|
|
571
|
+
handleChangeValue: y,
|
|
572
|
+
multiSelect: h,
|
|
573
|
+
searchValue: F,
|
|
574
|
+
highlightedIndex: x,
|
|
575
|
+
footer: A,
|
|
576
|
+
groupLabel: O,
|
|
577
|
+
onSelectAll: D
|
|
578
|
+
}, H) => {
|
|
579
|
+
const R = I([]);
|
|
580
|
+
v(() => {
|
|
581
581
|
var a;
|
|
582
|
-
|
|
583
|
-
}, [
|
|
584
|
-
const
|
|
585
|
-
/* @__PURE__ */ n(
|
|
582
|
+
x >= 0 && R.current[x] && ((a = R.current[x]) == null || a.scrollIntoView({ block: "nearest" }));
|
|
583
|
+
}, [x]);
|
|
584
|
+
const j = l ? /* @__PURE__ */ t("div", { className: "sa-input-dropdown-container-dropdown-search", children: [
|
|
585
|
+
/* @__PURE__ */ n(pn, { strokeWidth: 2, width: 16, style: { flexShrink: 0, color: "var(--sa-dropdown-placeholder-subtle)" } }),
|
|
586
586
|
/* @__PURE__ */ n(
|
|
587
587
|
"input",
|
|
588
588
|
{
|
|
589
589
|
onChange: (a) => {
|
|
590
590
|
o && o(a.target.value);
|
|
591
591
|
},
|
|
592
|
-
value:
|
|
592
|
+
value: F,
|
|
593
593
|
autoFocus: !0,
|
|
594
594
|
placeholder: "Search..."
|
|
595
595
|
}
|
|
596
596
|
)
|
|
597
597
|
] }) : null;
|
|
598
|
-
return /* @__PURE__ */ n(
|
|
598
|
+
return /* @__PURE__ */ n(sn, { children: d ? /* @__PURE__ */ t(
|
|
599
599
|
"div",
|
|
600
600
|
{
|
|
601
601
|
className: "sa-input-dropdown-lists-container",
|
|
602
602
|
onClick: (a) => a.stopPropagation(),
|
|
603
|
-
ref:
|
|
603
|
+
ref: H,
|
|
604
604
|
children: [
|
|
605
|
-
e !== "top" &&
|
|
606
|
-
/* @__PURE__ */
|
|
605
|
+
e !== "top" && j,
|
|
606
|
+
/* @__PURE__ */ t(
|
|
607
607
|
"div",
|
|
608
608
|
{
|
|
609
|
-
className: `sa-input-dropdwon-item-container ${
|
|
609
|
+
className: `sa-input-dropdwon-item-container ${h ? "multi" : ""}`,
|
|
610
610
|
children: [
|
|
611
|
-
|
|
612
|
-
/* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children:
|
|
613
|
-
|
|
611
|
+
O && /* @__PURE__ */ t("div", { className: "sa-input-dropdown-section-header", children: [
|
|
612
|
+
/* @__PURE__ */ n("span", { className: "sa-input-dropdown-section-label", children: O }),
|
|
613
|
+
h && D && /* @__PURE__ */ n(
|
|
614
614
|
"button",
|
|
615
615
|
{
|
|
616
616
|
className: "sa-input-dropdown-section-select-all",
|
|
617
617
|
onClick: (a) => {
|
|
618
|
-
a.stopPropagation(),
|
|
618
|
+
a.stopPropagation(), D();
|
|
619
619
|
},
|
|
620
620
|
children: "Select all"
|
|
621
621
|
}
|
|
622
622
|
)
|
|
623
623
|
] }),
|
|
624
|
-
|
|
625
|
-
const
|
|
626
|
-
return /* @__PURE__ */
|
|
624
|
+
p.map((a, S) => {
|
|
625
|
+
const N = !!(r != null && r.find((g) => g.value === a.value));
|
|
626
|
+
return /* @__PURE__ */ t(
|
|
627
627
|
"div",
|
|
628
628
|
{
|
|
629
629
|
className: [
|
|
630
630
|
"sa-input-dropdwon-item",
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
N ? "active" : "",
|
|
632
|
+
S === x ? "highlight" : "",
|
|
633
633
|
a.disable ? "sa-input-dropdwon-item-disable" : ""
|
|
634
634
|
].filter(Boolean).join(" "),
|
|
635
|
-
ref: (
|
|
636
|
-
|
|
635
|
+
ref: (g) => {
|
|
636
|
+
R.current[S] = g;
|
|
637
637
|
},
|
|
638
|
-
onClick: () =>
|
|
638
|
+
onClick: () => y(a.label, a.value),
|
|
639
639
|
children: [
|
|
640
|
-
|
|
641
|
-
a.icon && /* @__PURE__ */ n("div", { style: { flexShrink: 0 }, children:
|
|
642
|
-
/* @__PURE__ */
|
|
640
|
+
h && /* @__PURE__ */ n("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ n(cn, { isChecked: N }) }),
|
|
641
|
+
a.icon && /* @__PURE__ */ n("div", { style: { flexShrink: 0 }, children: Y.cloneElement(a.icon, { width: 16 }) }),
|
|
642
|
+
/* @__PURE__ */ t("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
643
643
|
/* @__PURE__ */ n(
|
|
644
644
|
"p",
|
|
645
645
|
{
|
|
646
646
|
className: [
|
|
647
647
|
"sa-input-dropdwon-item-text",
|
|
648
|
-
|
|
648
|
+
N ? "active" : "",
|
|
649
649
|
a.disable ? "sa-input-dropdwon-item-disable" : ""
|
|
650
650
|
].filter(Boolean).join(" "),
|
|
651
651
|
children: a.label
|
|
@@ -656,7 +656,7 @@ const en = ({ ...e }) => /* @__PURE__ */ p(
|
|
|
656
656
|
{
|
|
657
657
|
className: [
|
|
658
658
|
"sa-input-dropdwon-item-text-description",
|
|
659
|
-
|
|
659
|
+
N ? "active" : "",
|
|
660
660
|
a.disable ? "sa-input-dropdwon-item-disable" : ""
|
|
661
661
|
].filter(Boolean).join(" "),
|
|
662
662
|
children: a.description
|
|
@@ -665,212 +665,249 @@ const en = ({ ...e }) => /* @__PURE__ */ p(
|
|
|
665
665
|
] })
|
|
666
666
|
]
|
|
667
667
|
},
|
|
668
|
-
|
|
668
|
+
S
|
|
669
669
|
);
|
|
670
670
|
})
|
|
671
671
|
]
|
|
672
672
|
}
|
|
673
673
|
),
|
|
674
|
-
e === "top" &&
|
|
675
|
-
|
|
674
|
+
e === "top" && j,
|
|
675
|
+
A && /* @__PURE__ */ n("div", { className: "sa-input-dropdown-footer", onClick: (a) => a.stopPropagation(), children: A })
|
|
676
676
|
]
|
|
677
677
|
}
|
|
678
678
|
) : null });
|
|
679
679
|
}
|
|
680
|
-
),
|
|
680
|
+
), un = ({
|
|
681
681
|
children: e,
|
|
682
|
-
handleChangePosition:
|
|
682
|
+
handleChangePosition: p
|
|
683
683
|
}) => {
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
var
|
|
684
|
+
const d = I(null);
|
|
685
|
+
v(() => {
|
|
686
|
+
var y;
|
|
687
687
|
const o = () => {
|
|
688
|
-
if (
|
|
689
|
-
let
|
|
690
|
-
for (;
|
|
691
|
-
|
|
692
|
-
|
|
688
|
+
if (d.current) {
|
|
689
|
+
let h = d.current.parentElement;
|
|
690
|
+
for (; h && !l(h); )
|
|
691
|
+
h = h.parentElement;
|
|
692
|
+
h && p();
|
|
693
693
|
}
|
|
694
694
|
};
|
|
695
|
-
let r = (
|
|
696
|
-
for (; r && !
|
|
695
|
+
let r = (y = d.current) == null ? void 0 : y.parentElement;
|
|
696
|
+
for (; r && !l(r); )
|
|
697
697
|
r = r.parentElement;
|
|
698
698
|
return r && r.addEventListener("scroll", o), o(), () => {
|
|
699
699
|
r && r.removeEventListener("scroll", o);
|
|
700
700
|
};
|
|
701
701
|
}, []);
|
|
702
|
-
const
|
|
703
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
704
|
-
},
|
|
705
|
-
if (!document.getElementById(
|
|
706
|
-
const
|
|
707
|
-
|
|
702
|
+
const l = (o) => o && (o.scrollHeight > o.clientHeight || o.scrollWidth > o.clientWidth);
|
|
703
|
+
return /* @__PURE__ */ n("div", { ref: d, children: e });
|
|
704
|
+
}, Z = "sa-input-dropdown-styles", wn = (e) => {
|
|
705
|
+
if (!document.getElementById(Z)) {
|
|
706
|
+
const p = document.createElement("style");
|
|
707
|
+
p.id = Z, p.textContent = e, document.head.appendChild(p);
|
|
708
708
|
}
|
|
709
709
|
};
|
|
710
|
-
|
|
711
|
-
const
|
|
710
|
+
wn(dn);
|
|
711
|
+
const mn = ({
|
|
712
712
|
dropdownLists: e,
|
|
713
|
-
onChange:
|
|
714
|
-
defaultValue:
|
|
715
|
-
value:
|
|
713
|
+
onChange: p,
|
|
714
|
+
defaultValue: d,
|
|
715
|
+
value: l,
|
|
716
716
|
size: o = "md",
|
|
717
717
|
multiSelect: r,
|
|
718
|
-
searchAble:
|
|
719
|
-
iconLeft:
|
|
720
|
-
placeholder:
|
|
721
|
-
onSearch:
|
|
722
|
-
error:
|
|
723
|
-
onBlur:
|
|
724
|
-
onFocus:
|
|
725
|
-
disable:
|
|
726
|
-
searchValue:
|
|
727
|
-
variant:
|
|
718
|
+
searchAble: y,
|
|
719
|
+
iconLeft: h,
|
|
720
|
+
placeholder: F,
|
|
721
|
+
onSearch: x,
|
|
722
|
+
error: A,
|
|
723
|
+
onBlur: O,
|
|
724
|
+
onFocus: D,
|
|
725
|
+
disable: H,
|
|
726
|
+
searchValue: R,
|
|
727
|
+
variant: j = "outline",
|
|
728
728
|
footer: a,
|
|
729
|
-
groupLabel:
|
|
730
|
-
onSelectAll:
|
|
729
|
+
groupLabel: S,
|
|
730
|
+
onSelectAll: N,
|
|
731
|
+
/* field wrapper */
|
|
732
|
+
label: g,
|
|
733
|
+
labelPosition: _ = "outside-top",
|
|
734
|
+
required: J,
|
|
735
|
+
optional: U,
|
|
736
|
+
description: E,
|
|
737
|
+
helperText: C,
|
|
738
|
+
errorText: u
|
|
731
739
|
}) => {
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
), [
|
|
735
|
-
|
|
736
|
-
},
|
|
740
|
+
const z = l !== void 0, M = I(), T = A || !!u, [c, L] = P(
|
|
741
|
+
z ? l || [] : d || []
|
|
742
|
+
), [nn, X] = P(""), [b, $] = P(-1), m = I(null), { isComponentVisible: k, ref: q, setIsComponentVisible: W } = ln(!1), en = () => {
|
|
743
|
+
W((i) => !i);
|
|
744
|
+
}, V = (i, s) => {
|
|
737
745
|
if (r)
|
|
738
|
-
if (
|
|
739
|
-
const
|
|
740
|
-
|
|
746
|
+
if (c == null ? void 0 : c.find((w) => w.value === s)) {
|
|
747
|
+
const w = c.filter((an) => an.value !== s);
|
|
748
|
+
z || L(w), p(w);
|
|
741
749
|
} else {
|
|
742
|
-
const
|
|
743
|
-
|
|
750
|
+
const w = [...c, { label: i, value: s }];
|
|
751
|
+
z || L(w), p(w);
|
|
744
752
|
}
|
|
745
753
|
else {
|
|
746
|
-
const
|
|
747
|
-
|
|
754
|
+
const f = [{ label: i, value: s }];
|
|
755
|
+
z || L(f), p(f), W(!1);
|
|
748
756
|
}
|
|
749
757
|
};
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}, [
|
|
753
|
-
|
|
754
|
-
}, [
|
|
755
|
-
const
|
|
756
|
-
/* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children:
|
|
758
|
+
v(() => {
|
|
759
|
+
z && L(l || []);
|
|
760
|
+
}, [l]), v(() => {
|
|
761
|
+
z || JSON.stringify(M.current) === JSON.stringify(d) || (M.current = d, L(M.current || []));
|
|
762
|
+
}, [d]);
|
|
763
|
+
const rn = () => c.length ? r ? c == null ? void 0 : c.map((i, s) => /* @__PURE__ */ t("div", { className: "sa-input-dropdown-preview-item", children: [
|
|
764
|
+
/* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: i == null ? void 0 : i.label }),
|
|
757
765
|
/* @__PURE__ */ n(
|
|
758
|
-
|
|
766
|
+
bn,
|
|
759
767
|
{
|
|
760
|
-
onClick: () =>
|
|
768
|
+
onClick: (f) => {
|
|
769
|
+
f.stopPropagation(), V(i.label, i.value);
|
|
770
|
+
}
|
|
761
771
|
}
|
|
762
772
|
)
|
|
763
|
-
] }, s)) : /* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children:
|
|
764
|
-
if (
|
|
765
|
-
const
|
|
766
|
-
m.current.style.left = `${s.left}px`, m.current.style.width = `${s.width}px`,
|
|
773
|
+
] }, s)) : /* @__PURE__ */ n("p", { style: { minWidth: "max-content" }, children: c == null ? void 0 : c[0].label }) : /* @__PURE__ */ n("p", { className: "sa-input-dropdown-placeholder", children: F }), B = () => {
|
|
774
|
+
if (q.current && m.current) {
|
|
775
|
+
const i = window.innerHeight, s = q.current.getBoundingClientRect(), f = m.current.getBoundingClientRect(), w = s.bottom + f.height;
|
|
776
|
+
m.current.style.left = `${s.left}px`, m.current.style.width = `${s.width}px`, w >= i - 10 ? (m.current.style.top = `${s.top - f.height - 5}px`, X("top")) : (m.current.style.top = `${s.top + s.height + 4}px`, X("bottom"));
|
|
767
777
|
}
|
|
768
778
|
};
|
|
769
|
-
|
|
770
|
-
window.removeEventListener("scroll",
|
|
771
|
-
}), []),
|
|
772
|
-
|
|
773
|
-
}, [k]),
|
|
774
|
-
k ||
|
|
779
|
+
v(() => (window.addEventListener("scroll", B), window.addEventListener("resize", B), () => {
|
|
780
|
+
window.removeEventListener("scroll", B), window.removeEventListener("resize", B);
|
|
781
|
+
}), []), v(() => {
|
|
782
|
+
B();
|
|
783
|
+
}, [k]), v(() => {
|
|
784
|
+
k || $(-1);
|
|
775
785
|
}, [k]);
|
|
776
|
-
const
|
|
786
|
+
const on = (i) => {
|
|
777
787
|
if (!k) {
|
|
778
|
-
(
|
|
788
|
+
(i.key === "ArrowDown" || i.key === "Enter") && (i.preventDefault(), W(!0));
|
|
779
789
|
return;
|
|
780
790
|
}
|
|
781
|
-
switch (
|
|
791
|
+
switch (i.key) {
|
|
782
792
|
case "ArrowDown": {
|
|
783
|
-
|
|
784
|
-
const s =
|
|
785
|
-
s !== -1 &&
|
|
793
|
+
i.preventDefault();
|
|
794
|
+
const s = Q(e, b, 1);
|
|
795
|
+
s !== -1 && $(s);
|
|
786
796
|
break;
|
|
787
797
|
}
|
|
788
798
|
case "ArrowUp": {
|
|
789
|
-
|
|
790
|
-
const s =
|
|
791
|
-
s !== -1 &&
|
|
799
|
+
i.preventDefault();
|
|
800
|
+
const s = Q(e, b, -1);
|
|
801
|
+
s !== -1 && $(s);
|
|
792
802
|
break;
|
|
793
803
|
}
|
|
794
804
|
case "Enter": {
|
|
795
|
-
|
|
796
|
-
e[
|
|
797
|
-
e[
|
|
805
|
+
i.preventDefault(), b >= 0 && e[b] && !e[b].disable && V(
|
|
806
|
+
e[b].label,
|
|
807
|
+
e[b].value
|
|
798
808
|
);
|
|
799
809
|
break;
|
|
800
810
|
}
|
|
801
|
-
case "Escape":
|
|
802
|
-
|
|
811
|
+
case "Escape":
|
|
812
|
+
W(!1);
|
|
803
813
|
break;
|
|
804
|
-
}
|
|
805
814
|
}
|
|
806
|
-
},
|
|
807
|
-
return /* @__PURE__ */ n(an, { handleChangePosition: E, children: /* @__PURE__ */ p(
|
|
815
|
+
}, K = o === "lg" || o === "xl" ? 20 : 16, G = /* @__PURE__ */ n(un, { handleChangePosition: B, children: /* @__PURE__ */ t(
|
|
808
816
|
"div",
|
|
809
817
|
{
|
|
810
818
|
className: [
|
|
811
819
|
"sa-input-dropdown-container",
|
|
812
|
-
|
|
820
|
+
j,
|
|
813
821
|
`sa-input-dropdown-size-${o}`,
|
|
814
822
|
k ? "active" : "",
|
|
815
|
-
|
|
816
|
-
|
|
823
|
+
T ? "error" : "",
|
|
824
|
+
H ? "disable" : ""
|
|
817
825
|
].filter(Boolean).join(" "),
|
|
818
|
-
ref:
|
|
819
|
-
onClick:
|
|
820
|
-
onKeyDown:
|
|
826
|
+
ref: q,
|
|
827
|
+
onClick: en,
|
|
828
|
+
onKeyDown: on,
|
|
821
829
|
tabIndex: 0,
|
|
822
|
-
onBlur:
|
|
823
|
-
onFocus:
|
|
830
|
+
onBlur: O,
|
|
831
|
+
onFocus: D,
|
|
824
832
|
children: [
|
|
825
|
-
/* @__PURE__ */
|
|
826
|
-
|
|
827
|
-
width:
|
|
828
|
-
color: "var(--sa-dropdown-placeholder)",
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
/* @__PURE__ */ n(
|
|
832
|
-
k ? /* @__PURE__ */ n(pn, { width: $ }) : /* @__PURE__ */ n(ln, { width: $ })
|
|
833
|
+
/* @__PURE__ */ t("div", { className: "sa-input-dropdown-preview-container", children: [
|
|
834
|
+
h ? Y.cloneElement(h, {
|
|
835
|
+
width: K,
|
|
836
|
+
style: { color: "var(--sa-dropdown-placeholder)", flexShrink: 0 }
|
|
837
|
+
}) : null,
|
|
838
|
+
/* @__PURE__ */ n("div", { className: "sa-input-dropdown-container-preview-item", children: rn() }),
|
|
839
|
+
k ? /* @__PURE__ */ n(vn, { width: K }) : /* @__PURE__ */ n(fn, { width: K })
|
|
833
840
|
] }),
|
|
834
841
|
/* @__PURE__ */ n(
|
|
835
|
-
|
|
842
|
+
hn,
|
|
836
843
|
{
|
|
837
844
|
dropdownLists: e,
|
|
838
|
-
handleChangeValue:
|
|
845
|
+
handleChangeValue: V,
|
|
839
846
|
isComponentVisible: k,
|
|
840
|
-
positionDropdown:
|
|
841
|
-
searchAble: !!
|
|
842
|
-
value:
|
|
843
|
-
onSearch:
|
|
847
|
+
positionDropdown: nn,
|
|
848
|
+
searchAble: !!y,
|
|
849
|
+
value: c,
|
|
850
|
+
onSearch: x,
|
|
844
851
|
ref: m,
|
|
845
852
|
multiSelect: r,
|
|
846
|
-
searchValue:
|
|
847
|
-
highlightedIndex:
|
|
853
|
+
searchValue: R,
|
|
854
|
+
highlightedIndex: b,
|
|
848
855
|
footer: a,
|
|
849
|
-
groupLabel:
|
|
850
|
-
onSelectAll:
|
|
856
|
+
groupLabel: S,
|
|
857
|
+
onSelectAll: N
|
|
851
858
|
}
|
|
852
859
|
)
|
|
853
860
|
]
|
|
854
861
|
}
|
|
855
862
|
) });
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
863
|
+
return g ? _ === "outside-left" ? /* @__PURE__ */ t("div", { className: "sa-select-field sa-select-field-left", children: [
|
|
864
|
+
/* @__PURE__ */ t("div", { className: "sa-select-field-left-label", children: [
|
|
865
|
+
/* @__PURE__ */ t("div", { className: "sa-select-field-label-row", children: [
|
|
866
|
+
/* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: g }),
|
|
867
|
+
U && /* @__PURE__ */ n("span", { className: "sa-select-field-optional-badge", children: "Optional" }),
|
|
868
|
+
J && /* @__PURE__ */ n("span", { className: "sa-select-field-required", children: "*" })
|
|
869
|
+
] }),
|
|
870
|
+
E && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: E })
|
|
871
|
+
] }),
|
|
872
|
+
/* @__PURE__ */ t("div", { className: "sa-select-field-input-wrap", children: [
|
|
873
|
+
G,
|
|
874
|
+
C && !u && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: C }),
|
|
875
|
+
u && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: u })
|
|
876
|
+
] })
|
|
877
|
+
] }) : /* @__PURE__ */ t("div", { className: "sa-select-field", children: [
|
|
878
|
+
/* @__PURE__ */ t("div", { className: "sa-select-field-label-row", children: [
|
|
879
|
+
/* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: g }),
|
|
880
|
+
U && /* @__PURE__ */ n("span", { className: "sa-select-field-optional-badge", children: "Optional" }),
|
|
881
|
+
J && /* @__PURE__ */ n("span", { className: "sa-select-field-required", children: "*" })
|
|
882
|
+
] }),
|
|
883
|
+
E && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: E }),
|
|
884
|
+
G,
|
|
885
|
+
C && !u && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: C }),
|
|
886
|
+
u && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: u })
|
|
887
|
+
] }) : /* @__PURE__ */ t("div", { className: "sa-select-field", children: [
|
|
888
|
+
E && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: E }),
|
|
889
|
+
G,
|
|
890
|
+
C && !u && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: C }),
|
|
891
|
+
u && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: u })
|
|
892
|
+
] });
|
|
893
|
+
}, Q = (e, p, d) => {
|
|
894
|
+
const l = e.length;
|
|
895
|
+
let o = p + d;
|
|
896
|
+
for (; o >= 0 && o < l; ) {
|
|
860
897
|
if (!e[o].disable)
|
|
861
898
|
return o;
|
|
862
|
-
o +=
|
|
899
|
+
o += d;
|
|
863
900
|
}
|
|
864
|
-
if (
|
|
865
|
-
for (let r = 0; r <
|
|
901
|
+
if (d === 1) {
|
|
902
|
+
for (let r = 0; r < l; r++)
|
|
866
903
|
if (!e[r].disable)
|
|
867
904
|
return r;
|
|
868
905
|
} else
|
|
869
|
-
for (let r =
|
|
906
|
+
for (let r = l - 1; r >= 0; r--)
|
|
870
907
|
if (!e[r].disable)
|
|
871
908
|
return r;
|
|
872
909
|
return -1;
|
|
873
|
-
},
|
|
910
|
+
}, bn = (e) => /* @__PURE__ */ n(
|
|
874
911
|
"svg",
|
|
875
912
|
{
|
|
876
913
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -878,6 +915,7 @@ const K = ({
|
|
|
878
915
|
height: "14",
|
|
879
916
|
viewBox: "0 0 18 18",
|
|
880
917
|
fill: "none",
|
|
918
|
+
style: { flexShrink: 0, cursor: "pointer" },
|
|
881
919
|
...e,
|
|
882
920
|
children: /* @__PURE__ */ n(
|
|
883
921
|
"path",
|
|
@@ -890,7 +928,7 @@ const K = ({
|
|
|
890
928
|
}
|
|
891
929
|
)
|
|
892
930
|
}
|
|
893
|
-
),
|
|
931
|
+
), fn = ({ width: e = 16 }) => /* @__PURE__ */ n(
|
|
894
932
|
"svg",
|
|
895
933
|
{
|
|
896
934
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -910,7 +948,7 @@ const K = ({
|
|
|
910
948
|
}
|
|
911
949
|
)
|
|
912
950
|
}
|
|
913
|
-
),
|
|
951
|
+
), vn = ({ width: e = 16 }) => /* @__PURE__ */ n(
|
|
914
952
|
"svg",
|
|
915
953
|
{
|
|
916
954
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -930,41 +968,7 @@ const K = ({
|
|
|
930
968
|
}
|
|
931
969
|
)
|
|
932
970
|
}
|
|
933
|
-
)
|
|
934
|
-
label: e,
|
|
935
|
-
labelPosition: l = "top",
|
|
936
|
-
required: i,
|
|
937
|
-
optional: d,
|
|
938
|
-
helperText: o,
|
|
939
|
-
helperTextTop: r,
|
|
940
|
-
errorMessage: c,
|
|
941
|
-
error: u,
|
|
942
|
-
...y
|
|
943
|
-
}) => {
|
|
944
|
-
const h = u || !!c, g = e ? /* @__PURE__ */ p("div", { className: "sa-select-field-label-row", children: [
|
|
945
|
-
/* @__PURE__ */ n("span", { className: "sa-select-field-label-text", children: e }),
|
|
946
|
-
d && /* @__PURE__ */ n("span", { className: "sa-select-field-optional-badge", children: "Optional" }),
|
|
947
|
-
i && /* @__PURE__ */ n("span", { className: "sa-select-field-required", children: "*" })
|
|
948
|
-
] }) : null;
|
|
949
|
-
return l === "left" ? /* @__PURE__ */ p("div", { className: "sa-select-field sa-select-field-left", children: [
|
|
950
|
-
/* @__PURE__ */ p("div", { className: "sa-select-field-left-label", children: [
|
|
951
|
-
g,
|
|
952
|
-
r && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: r })
|
|
953
|
-
] }),
|
|
954
|
-
/* @__PURE__ */ p("div", { className: "sa-select-field-input-wrap", children: [
|
|
955
|
-
/* @__PURE__ */ n(K, { ...y, error: h }),
|
|
956
|
-
o && !c && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: o }),
|
|
957
|
-
c && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: c })
|
|
958
|
-
] })
|
|
959
|
-
] }) : /* @__PURE__ */ p("div", { className: "sa-select-field", children: [
|
|
960
|
-
g,
|
|
961
|
-
r && /* @__PURE__ */ n("p", { className: "sa-select-field-helper-top", children: r }),
|
|
962
|
-
/* @__PURE__ */ n(K, { ...y, error: h }),
|
|
963
|
-
o && !c && /* @__PURE__ */ n("p", { className: "sa-select-field-helper", children: o }),
|
|
964
|
-
c && /* @__PURE__ */ n("p", { className: "sa-select-field-error-msg", children: c })
|
|
965
|
-
] });
|
|
966
|
-
};
|
|
971
|
+
);
|
|
967
972
|
export {
|
|
968
|
-
|
|
969
|
-
wn as SelectField
|
|
973
|
+
mn as Dropdown
|
|
970
974
|
};
|
package/dist/dropdown.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(b,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):(b=typeof globalThis<"u"?globalThis:b||self,n(b.Dropdown={},b.jsxRuntime,b.React))})(this,function(b,n,d){"use strict";const Z=`@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;
|
|
@@ -497,4 +497,4 @@
|
|
|
497
497
|
height: 100%;
|
|
498
498
|
width: 100%;
|
|
499
499
|
}
|
|
500
|
-
`;function
|
|
500
|
+
`;function Q(e){const[p,t]=d.useState(e),l=d.useRef(null),o=r=>{l.current&&!l.current.contains(r.target)&&t(!1)};return d.useEffect(()=>(document.addEventListener("click",o,!0),()=>{document.removeEventListener("click",o,!0)}),[]),{ref:l,isComponentVisible:p,setIsComponentVisible:t}}const Y=({...e})=>n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",...e,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"})]}),_=({isChecked:e})=>n.jsxs("div",{className:"checkbox-wrapper-30",children:[n.jsxs("span",{className:"checkbox",children:[n.jsx("input",{type:"checkbox",style:{pointerEvents:"none"},checked:e}),n.jsx("svg",{children:n.jsx("use",{xlinkHref:"#checkbox-30",className:"checkbox"})})]}),n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"none"},children:n.jsx("symbol",{id:"checkbox-30",viewBox:"0 0 22 22",children:n.jsx("path",{fill:"none",stroke:"currentColor",d:"M5.5,11.3L9,14.8L20.2,3.3l0,0c-0.5-1-1.5-1.8-2.7-1.8h-13c-1.7,0-3,1.3-3,3v13c0,1.7,1.3,3,3,3h13 c1.7,0,3-1.3,3-3v-13c0-0.4-0.1-0.8-0.3-1.2"})})})]}),R=d.forwardRef(({positionDropdown:e,dropdownLists:p,isComponentVisible:t,searchAble:l,onSearch:o,value:r,handleChangeValue:m,multiSelect:h,searchValue:P,highlightedIndex:x,footer:j,groupLabel:A,onSelectAll:D},F)=>{const B=d.useRef([]);d.useEffect(()=>{var a;x>=0&&B.current[x]&&((a=B.current[x])==null||a.scrollIntoView({block:"nearest"}))},[x]);const O=l?n.jsxs("div",{className:"sa-input-dropdown-container-dropdown-search",children:[n.jsx(Y,{strokeWidth:2,width:16,style:{flexShrink:0,color:"var(--sa-dropdown-placeholder-subtle)"}}),n.jsx("input",{onChange:a=>{o&&o(a.target.value)},value:P,autoFocus:!0,placeholder:"Search..."})]}):null;return n.jsx(n.Fragment,{children:t?n.jsxs("div",{className:"sa-input-dropdown-lists-container",onClick:a=>a.stopPropagation(),ref:F,children:[e!=="top"&&O,n.jsxs("div",{className:`sa-input-dropdwon-item-container ${h?"multi":""}`,children:[A&&n.jsxs("div",{className:"sa-input-dropdown-section-header",children:[n.jsx("span",{className:"sa-input-dropdown-section-label",children:A}),h&&D&&n.jsx("button",{className:"sa-input-dropdown-section-select-all",onClick:a=>{a.stopPropagation(),D()},children:"Select all"})]}),p.map((a,L)=>{const E=!!(r!=null&&r.find(g=>g.value===a.value));return n.jsxs("div",{className:["sa-input-dropdwon-item",E?"active":"",L===x?"highlight":"",a.disable?"sa-input-dropdwon-item-disable":""].filter(Boolean).join(" "),ref:g=>{B.current[L]=g},onClick:()=>m(a.label,a.value),children:[h&&n.jsx("div",{style:{flexShrink:0},children:n.jsx(_,{isChecked:E})}),a.icon&&n.jsx("div",{style:{flexShrink:0},children:d.cloneElement(a.icon,{width:16})}),n.jsxs("div",{style:{minWidth:0,flex:1},children:[n.jsx("p",{className:["sa-input-dropdwon-item-text",E?"active":"",a.disable?"sa-input-dropdwon-item-disable":""].filter(Boolean).join(" "),children:a.label}),a.description&&n.jsx("p",{className:["sa-input-dropdwon-item-text-description",E?"active":"",a.disable?"sa-input-dropdwon-item-disable":""].filter(Boolean).join(" "),children:a.description})]})]},L)})]}),e==="top"&&O,j&&n.jsx("div",{className:"sa-input-dropdown-footer",onClick:a=>a.stopPropagation(),children:j})]}):null})}),nn=({children:e,handleChangePosition:p})=>{const t=d.useRef(null);d.useEffect(()=>{var m;const o=()=>{if(t.current){let h=t.current.parentElement;for(;h&&!l(h);)h=h.parentElement;h&&p()}};let r=(m=t.current)==null?void 0:m.parentElement;for(;r&&!l(r);)r=r.parentElement;return r&&r.addEventListener("scroll",o),o(),()=>{r&&r.removeEventListener("scroll",o)}},[]);const l=o=>o&&(o.scrollHeight>o.clientHeight||o.scrollWidth>o.clientWidth);return n.jsx("div",{ref:t,children:e})},G="sa-input-dropdown-styles";(e=>{if(!document.getElementById(G)){const p=document.createElement("style");p.id=G,p.textContent=e,document.head.appendChild(p)}})(Z);const en=({dropdownLists:e,onChange:p,defaultValue:t,value:l,size:o="md",multiSelect:r,searchAble:m,iconLeft:h,placeholder:P,onSearch:x,error:j,onBlur:A,onFocus:D,disable:F,searchValue:B,variant:O="outline",footer:a,groupLabel:L,onSelectAll:E,label:g,labelPosition:sn="outside-top",required:U,optional:T,description:N,helperText:C,errorText:f})=>{const z=l!==void 0,H=d.useRef(),dn=j||!!f,[c,I]=d.useState(z?l||[]:t||[]),[tn,X]=d.useState(""),[u,M]=d.useState(-1),k=d.useRef(null),{isComponentVisible:y,ref:q,setIsComponentVisible:W}=Q(!1),ln=()=>{W(s=>!s)},$=(s,i)=>{if(r)if(c==null?void 0:c.find(w=>w.value===i)){const w=c.filter(hn=>hn.value!==i);z||I(w),p(w)}else{const w=[...c,{label:s,value:i}];z||I(w),p(w)}else{const v=[{label:s,value:i}];z||I(v),p(v),W(!1)}};d.useEffect(()=>{z&&I(l||[])},[l]),d.useEffect(()=>{z||JSON.stringify(H.current)===JSON.stringify(t)||(H.current=t,I(H.current||[]))},[t]);const pn=()=>c.length?r?c==null?void 0:c.map((s,i)=>n.jsxs("div",{className:"sa-input-dropdown-preview-item",children:[n.jsx("p",{style:{minWidth:"max-content"},children:s==null?void 0:s.label}),n.jsx(rn,{onClick:v=>{v.stopPropagation(),$(s.label,s.value)}})]},i)):n.jsx("p",{style:{minWidth:"max-content"},children:c==null?void 0:c[0].label}):n.jsx("p",{className:"sa-input-dropdown-placeholder",children:P}),S=()=>{if(q.current&&k.current){const s=window.innerHeight,i=q.current.getBoundingClientRect(),v=k.current.getBoundingClientRect(),w=i.bottom+v.height;k.current.style.left=`${i.left}px`,k.current.style.width=`${i.width}px`,w>=s-10?(k.current.style.top=`${i.top-v.height-5}px`,X("top")):(k.current.style.top=`${i.top+i.height+4}px`,X("bottom"))}};d.useEffect(()=>(window.addEventListener("scroll",S),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S),window.removeEventListener("resize",S)}),[]),d.useEffect(()=>{S()},[y]),d.useEffect(()=>{y||M(-1)},[y]);const cn=s=>{if(!y){(s.key==="ArrowDown"||s.key==="Enter")&&(s.preventDefault(),W(!0));return}switch(s.key){case"ArrowDown":{s.preventDefault();const i=J(e,u,1);i!==-1&&M(i);break}case"ArrowUp":{s.preventDefault();const i=J(e,u,-1);i!==-1&&M(i);break}case"Enter":{s.preventDefault(),u>=0&&e[u]&&!e[u].disable&&$(e[u].label,e[u].value);break}case"Escape":W(!1);break}},V=o==="lg"||o==="xl"?20:16,K=n.jsx(nn,{handleChangePosition:S,children:n.jsxs("div",{className:["sa-input-dropdown-container",O,`sa-input-dropdown-size-${o}`,y?"active":"",dn?"error":"",F?"disable":""].filter(Boolean).join(" "),ref:q,onClick:ln,onKeyDown:cn,tabIndex:0,onBlur:A,onFocus:D,children:[n.jsxs("div",{className:"sa-input-dropdown-preview-container",children:[h?d.cloneElement(h,{width:V,style:{color:"var(--sa-dropdown-placeholder)",flexShrink:0}}):null,n.jsx("div",{className:"sa-input-dropdown-container-preview-item",children:pn()}),y?n.jsx(an,{width:V}):n.jsx(on,{width:V})]}),n.jsx(R,{dropdownLists:e,handleChangeValue:$,isComponentVisible:y,positionDropdown:tn,searchAble:!!m,value:c,onSearch:x,ref:k,multiSelect:r,searchValue:B,highlightedIndex:u,footer:a,groupLabel:L,onSelectAll:E})]})});return g?sn==="outside-left"?n.jsxs("div",{className:"sa-select-field 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:g}),T&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),U&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),N&&n.jsx("p",{className:"sa-select-field-helper-top",children:N})]}),n.jsxs("div",{className:"sa-select-field-input-wrap",children:[K,C&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:C}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]})]}):n.jsxs("div",{className:"sa-select-field",children:[n.jsxs("div",{className:"sa-select-field-label-row",children:[n.jsx("span",{className:"sa-select-field-label-text",children:g}),T&&n.jsx("span",{className:"sa-select-field-optional-badge",children:"Optional"}),U&&n.jsx("span",{className:"sa-select-field-required",children:"*"})]}),N&&n.jsx("p",{className:"sa-select-field-helper-top",children:N}),K,C&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:C}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]}):n.jsxs("div",{className:"sa-select-field",children:[N&&n.jsx("p",{className:"sa-select-field-helper-top",children:N}),K,C&&!f&&n.jsx("p",{className:"sa-select-field-helper",children:C}),f&&n.jsx("p",{className:"sa-select-field-error-msg",children:f})]})},J=(e,p,t)=>{const l=e.length;let o=p+t;for(;o>=0&&o<l;){if(!e[o].disable)return o;o+=t}if(t===1){for(let r=0;r<l;r++)if(!e[r].disable)return r}else for(let r=l-1;r>=0;r--)if(!e[r].disable)return r;return-1},rn=e=>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"},...e,children:n.jsx("path",{d:"M12 6L6 12M6.00001 6L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),on=({width:e=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,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"})}),an=({width:e=16})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,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"})});b.Dropdown=en,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.d.ts
CHANGED
package/dist/interface.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface IconPropsDropdown extends React.SVGProps<SVGSVGElement> {
|
|
3
3
|
}
|
|
4
|
+
export type DropdownSize = "sm" | "md" | "lg" | "xl";
|
|
5
|
+
export type DropdownVariant = "standard" | "outline" | "flushed";
|
|
6
|
+
export type DropdownLabelPosition = "outside-top" | "outside-left";
|
|
4
7
|
export interface IDropdown {
|
|
5
8
|
onChange: (props: {
|
|
6
9
|
label: string;
|
|
@@ -21,7 +24,7 @@ export interface IDropdown {
|
|
|
21
24
|
label: string;
|
|
22
25
|
value: string;
|
|
23
26
|
}[];
|
|
24
|
-
size?:
|
|
27
|
+
size?: DropdownSize;
|
|
25
28
|
error?: boolean;
|
|
26
29
|
multiSelect?: boolean;
|
|
27
30
|
searchAble?: boolean;
|
|
@@ -33,17 +36,15 @@ export interface IDropdown {
|
|
|
33
36
|
onFocus?: (e: React.FocusEvent<HTMLDivElement, Element>) => void;
|
|
34
37
|
disable?: boolean;
|
|
35
38
|
searchValue?: string;
|
|
36
|
-
variant?:
|
|
39
|
+
variant?: DropdownVariant;
|
|
37
40
|
footer?: React.ReactNode;
|
|
38
41
|
groupLabel?: string;
|
|
39
42
|
onSelectAll?: () => void;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
label?: string;
|
|
43
|
-
labelPosition?: "top" | "left";
|
|
43
|
+
label?: React.ReactNode;
|
|
44
|
+
labelPosition?: DropdownLabelPosition;
|
|
44
45
|
required?: boolean;
|
|
45
46
|
optional?: boolean;
|
|
47
|
+
description?: string;
|
|
46
48
|
helperText?: string;
|
|
47
|
-
|
|
48
|
-
errorMessage?: string;
|
|
49
|
+
errorText?: string;
|
|
49
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starasia/dropdown",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "dropdown component for starasia UI",
|
|
5
5
|
"author": "Prawito Hudoro",
|
|
6
6
|
"main": "dist/dropdown.umd.js",
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
"dist/*.map",
|
|
13
13
|
"dist/*.css"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "vite --config vite.config.ts --port 3000",
|
|
17
|
-
"build": "vite build --config vite.config.ts"
|
|
18
|
-
},
|
|
19
15
|
"keywords": [],
|
|
20
16
|
"license": "ISC",
|
|
21
17
|
"type": "module",
|
|
@@ -37,5 +33,9 @@
|
|
|
37
33
|
"react-dom": "^18.2.0",
|
|
38
34
|
"@types/react": "^18.2.55",
|
|
39
35
|
"@types/react-dom": "^18.2.19"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"dev": "vite --config vite.config.ts --port 3000",
|
|
39
|
+
"build": "vite build --config vite.config.ts"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|
package/dist/SelectField.d.ts
DELETED