welcome-ui 10.0.0-alpha.10 → 10.0.0-alpha.12
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/Alert.css +1 -1
- package/dist/Alert.js +62 -62
- package/dist/Checkbox.js +12 -11
- package/dist/DatePicker.js +69 -68
- package/dist/DateTimePicker.js +10 -10
- package/dist/Field.css +1 -1
- package/dist/Field.js +48 -49
- package/dist/FileDrop.js +7 -1
- package/dist/Icon.js +212 -211
- package/dist/InputText.js +6 -6
- package/dist/Modal.js +65 -56
- package/dist/Search.js +1 -1
- package/dist/Select.js +350 -332
- package/dist/Slider.js +1 -1
- package/dist/Swiper.js +201 -191
- package/dist/Tabs.css +1 -1
- package/dist/Tabs.js +320 -319
- package/dist/Textarea.js +14 -13
- package/dist/TimePicker.js +46 -45
- package/dist/Toggle.js +11 -11
- package/dist/types/components/Icon/icons.d.ts +2 -2
- package/dist/types/components/Modal/Assets/AssetContent.d.ts +1 -1
- package/dist/types/components/Modal/Assets/index.d.ts +1 -1
- package/dist/types/components/Modal/components/Content.d.ts +1 -1
- package/dist/types/components/Modal/index.d.ts +2 -2
- package/dist/types/components/Modal/types.d.ts +1 -1
- package/dist/types/components/Select/types.d.ts +1 -0
- package/dist/types/components/Tabs/Tab.d.ts +2 -0
- package/dist/types/components/Tabs/{components/TabPanel/index.d.ts → TabPanel.d.ts} +1 -1
- package/dist/types/components/Tabs/index.d.ts +6 -5
- package/dist/types/components/Tabs/types.d.ts +6 -12
- package/dist/types/components/Tabs/utils.d.ts +4 -7
- package/package.json +1 -1
- package/dist/types/components/Tabs/components/ActiveBar/index.d.ts +0 -5
- package/dist/types/components/Tabs/components/TabList/index.d.ts +0 -3
- package/dist/use-viewport-CgrficYB.js +0 -17
- package/dist/useForkRef-D807AV7D.js +0 -22
package/dist/Select.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import './Select.css';
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { D as
|
|
5
|
-
import { g as
|
|
6
|
-
import {
|
|
7
|
-
import { CloseButton as
|
|
8
|
-
import { useField as
|
|
9
|
-
import { Icon as
|
|
10
|
-
import { c as
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
pe = 1;
|
|
3
|
+
import { jsx as p, jsxs as L } from "react/jsx-runtime";
|
|
4
|
+
import { D as pe } from "./downshift.esm-xtYanIDi.js";
|
|
5
|
+
import { g as Ye, c as Ce } from "./index-PAaZGbyz.js";
|
|
6
|
+
import { useRef as Be, useMemo as be, forwardRef as Xe, useState as $, useEffect as ge, useCallback as Ze, Fragment as Qe } from "react";
|
|
7
|
+
import { CloseButton as Ge } from "./CloseButton.js";
|
|
8
|
+
import { useField as Je } from "./Field.js";
|
|
9
|
+
import { Icon as Ae } from "./Icon.js";
|
|
10
|
+
import { c as et } from "./create-event-rXDe5aCQ.js";
|
|
11
|
+
import { Tag as tt } from "./Tag.js";
|
|
12
|
+
var H = { exports: {} }, Ie;
|
|
13
|
+
function nt() {
|
|
14
|
+
if (Ie) return H.exports;
|
|
15
|
+
Ie = 1;
|
|
17
16
|
var e = {
|
|
18
17
|
À: "A",
|
|
19
18
|
Á: "A",
|
|
@@ -475,25 +474,25 @@ function Je() {
|
|
|
475
474
|
ё: "е",
|
|
476
475
|
Ё: "Е"
|
|
477
476
|
}, t = Object.keys(e).join("|"), n = new RegExp(t, "g"), r = new RegExp(t, "");
|
|
478
|
-
function
|
|
479
|
-
return e[
|
|
477
|
+
function a(l) {
|
|
478
|
+
return e[l];
|
|
480
479
|
}
|
|
481
|
-
var
|
|
482
|
-
return
|
|
483
|
-
},
|
|
484
|
-
return !!
|
|
480
|
+
var i = function(l) {
|
|
481
|
+
return l.replace(n, a);
|
|
482
|
+
}, f = function(l) {
|
|
483
|
+
return !!l.match(r);
|
|
485
484
|
};
|
|
486
|
-
return
|
|
485
|
+
return H.exports = i, H.exports.has = f, H.exports.remove = i, H.exports;
|
|
487
486
|
}
|
|
488
|
-
var
|
|
489
|
-
const
|
|
487
|
+
var rt = nt();
|
|
488
|
+
const st = /* @__PURE__ */ Ye(rt);
|
|
490
489
|
/**
|
|
491
490
|
* @name match-sorter
|
|
492
491
|
* @license MIT license.
|
|
493
492
|
* @copyright (c) 2020 Kent C. Dodds
|
|
494
493
|
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
|
495
494
|
*/
|
|
496
|
-
const
|
|
495
|
+
const A = {
|
|
497
496
|
CASE_SENSITIVE_EQUAL: 7,
|
|
498
497
|
EQUAL: 6,
|
|
499
498
|
STARTS_WITH: 5,
|
|
@@ -502,125 +501,125 @@ const g = {
|
|
|
502
501
|
ACRONYM: 2,
|
|
503
502
|
MATCHES: 1,
|
|
504
503
|
NO_MATCH: 0
|
|
505
|
-
},
|
|
506
|
-
function
|
|
504
|
+
}, at = (e, t) => String(e.rankedValue).localeCompare(String(t.rankedValue));
|
|
505
|
+
function te(e, t, n) {
|
|
507
506
|
n === void 0 && (n = {});
|
|
508
507
|
const {
|
|
509
508
|
keys: r,
|
|
510
|
-
threshold:
|
|
511
|
-
baseSort:
|
|
512
|
-
sorter:
|
|
513
|
-
} = n,
|
|
514
|
-
return
|
|
509
|
+
threshold: a = A.MATCHES,
|
|
510
|
+
baseSort: i = at,
|
|
511
|
+
sorter: f = (u) => u.sort((o, m) => ot(o, m, i))
|
|
512
|
+
} = n, l = e.reduce(s, []);
|
|
513
|
+
return f(l).map((u) => {
|
|
515
514
|
let {
|
|
516
|
-
item:
|
|
517
|
-
} =
|
|
518
|
-
return
|
|
515
|
+
item: o
|
|
516
|
+
} = u;
|
|
517
|
+
return o;
|
|
519
518
|
});
|
|
520
|
-
function
|
|
521
|
-
const
|
|
522
|
-
rank:
|
|
523
|
-
keyThreshold:
|
|
524
|
-
} =
|
|
525
|
-
return
|
|
526
|
-
...
|
|
527
|
-
item:
|
|
528
|
-
index:
|
|
529
|
-
}),
|
|
519
|
+
function s(u, o, m) {
|
|
520
|
+
const C = lt(o, r, t, n), {
|
|
521
|
+
rank: q,
|
|
522
|
+
keyThreshold: v = a
|
|
523
|
+
} = C;
|
|
524
|
+
return q >= v && u.push({
|
|
525
|
+
...C,
|
|
526
|
+
item: o,
|
|
527
|
+
index: m
|
|
528
|
+
}), u;
|
|
530
529
|
}
|
|
531
530
|
}
|
|
532
|
-
|
|
533
|
-
function
|
|
531
|
+
te.rankings = A;
|
|
532
|
+
function lt(e, t, n, r) {
|
|
534
533
|
if (!t) {
|
|
535
|
-
const
|
|
534
|
+
const i = e;
|
|
536
535
|
return {
|
|
537
536
|
// ends up being duplicate of 'item' in matches but consistent
|
|
538
|
-
rankedValue:
|
|
539
|
-
rank:
|
|
537
|
+
rankedValue: i,
|
|
538
|
+
rank: ve(i, n, r),
|
|
540
539
|
keyIndex: -1,
|
|
541
540
|
keyThreshold: r.threshold
|
|
542
541
|
};
|
|
543
542
|
}
|
|
544
|
-
return
|
|
543
|
+
return ft(e, t).reduce((i, f, l) => {
|
|
545
544
|
let {
|
|
546
|
-
rank:
|
|
547
|
-
rankedValue:
|
|
548
|
-
keyIndex:
|
|
549
|
-
keyThreshold:
|
|
550
|
-
} =
|
|
551
|
-
itemValue:
|
|
552
|
-
attributes:
|
|
553
|
-
} =
|
|
545
|
+
rank: s,
|
|
546
|
+
rankedValue: u,
|
|
547
|
+
keyIndex: o,
|
|
548
|
+
keyThreshold: m
|
|
549
|
+
} = i, {
|
|
550
|
+
itemValue: C,
|
|
551
|
+
attributes: q
|
|
552
|
+
} = f, v = ve(C, n, r), g = u;
|
|
554
553
|
const {
|
|
555
|
-
minRanking:
|
|
556
|
-
maxRanking:
|
|
557
|
-
threshold:
|
|
558
|
-
} =
|
|
559
|
-
return
|
|
560
|
-
rankedValue:
|
|
561
|
-
rank:
|
|
562
|
-
keyIndex:
|
|
563
|
-
keyThreshold:
|
|
554
|
+
minRanking: E,
|
|
555
|
+
maxRanking: U,
|
|
556
|
+
threshold: P
|
|
557
|
+
} = q;
|
|
558
|
+
return v < E && v >= A.MATCHES ? v = E : v > U && (v = U), v > s && (s = v, o = l, m = P, g = C), {
|
|
559
|
+
rankedValue: g,
|
|
560
|
+
rank: s,
|
|
561
|
+
keyIndex: o,
|
|
562
|
+
keyThreshold: m
|
|
564
563
|
};
|
|
565
564
|
}, {
|
|
566
565
|
rankedValue: e,
|
|
567
|
-
rank:
|
|
566
|
+
rank: A.NO_MATCH,
|
|
568
567
|
keyIndex: -1,
|
|
569
568
|
keyThreshold: r.threshold
|
|
570
569
|
});
|
|
571
570
|
}
|
|
572
|
-
function
|
|
573
|
-
return e =
|
|
571
|
+
function ve(e, t, n) {
|
|
572
|
+
return e = Ee(e, n), t = Ee(t, n), t.length > e.length ? A.NO_MATCH : e === t ? A.CASE_SENSITIVE_EQUAL : (e = e.toLowerCase(), t = t.toLowerCase(), e === t ? A.EQUAL : e.startsWith(t) ? A.STARTS_WITH : e.includes(` ${t}`) ? A.WORD_STARTS_WITH : e.includes(t) ? A.CONTAINS : t.length === 1 ? A.NO_MATCH : ct(e).includes(t) ? A.ACRONYM : it(e, t));
|
|
574
573
|
}
|
|
575
|
-
function
|
|
574
|
+
function ct(e) {
|
|
576
575
|
let t = "";
|
|
577
576
|
return e.split(" ").forEach((r) => {
|
|
578
|
-
r.split("-").forEach((
|
|
579
|
-
t +=
|
|
577
|
+
r.split("-").forEach((i) => {
|
|
578
|
+
t += i.substr(0, 1);
|
|
580
579
|
});
|
|
581
580
|
}), t;
|
|
582
581
|
}
|
|
583
|
-
function
|
|
582
|
+
function it(e, t) {
|
|
584
583
|
let n = 0, r = 0;
|
|
585
|
-
function s
|
|
586
|
-
for (let
|
|
587
|
-
if (
|
|
588
|
-
return n += 1,
|
|
584
|
+
function a(s, u, o) {
|
|
585
|
+
for (let m = o, C = u.length; m < C; m++)
|
|
586
|
+
if (u[m] === s)
|
|
587
|
+
return n += 1, m + 1;
|
|
589
588
|
return -1;
|
|
590
589
|
}
|
|
591
|
-
function
|
|
592
|
-
const
|
|
593
|
-
return
|
|
590
|
+
function i(s) {
|
|
591
|
+
const u = 1 / s, o = n / t.length;
|
|
592
|
+
return A.MATCHES + o * u;
|
|
594
593
|
}
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
597
|
-
return
|
|
598
|
-
r =
|
|
599
|
-
for (let
|
|
600
|
-
const
|
|
601
|
-
if (r =
|
|
602
|
-
return
|
|
594
|
+
const f = a(t[0], e, 0);
|
|
595
|
+
if (f < 0)
|
|
596
|
+
return A.NO_MATCH;
|
|
597
|
+
r = f;
|
|
598
|
+
for (let s = 1, u = t.length; s < u; s++) {
|
|
599
|
+
const o = t[s];
|
|
600
|
+
if (r = a(o, e, r), !(r > -1))
|
|
601
|
+
return A.NO_MATCH;
|
|
603
602
|
}
|
|
604
|
-
const
|
|
605
|
-
return
|
|
603
|
+
const l = r - f;
|
|
604
|
+
return i(l);
|
|
606
605
|
}
|
|
607
606
|
function ot(e, t, n) {
|
|
608
607
|
const {
|
|
609
|
-
rank:
|
|
610
|
-
keyIndex:
|
|
608
|
+
rank: i,
|
|
609
|
+
keyIndex: f
|
|
611
610
|
} = e, {
|
|
612
|
-
rank:
|
|
613
|
-
keyIndex:
|
|
611
|
+
rank: l,
|
|
612
|
+
keyIndex: s
|
|
614
613
|
} = t;
|
|
615
|
-
return
|
|
614
|
+
return i === l ? f === s ? n(e, t) : f < s ? -1 : 1 : i > l ? -1 : 1;
|
|
616
615
|
}
|
|
617
|
-
function
|
|
616
|
+
function Ee(e, t) {
|
|
618
617
|
let {
|
|
619
618
|
keepDiacritics: n
|
|
620
619
|
} = t;
|
|
621
|
-
return e = `${e}`, n || (e =
|
|
620
|
+
return e = `${e}`, n || (e = st(e)), e;
|
|
622
621
|
}
|
|
623
|
-
function
|
|
622
|
+
function ut(e, t) {
|
|
624
623
|
typeof t == "object" && (t = t.key);
|
|
625
624
|
let n;
|
|
626
625
|
if (typeof t == "function")
|
|
@@ -631,65 +630,77 @@ function lt(e, t) {
|
|
|
631
630
|
n = e[t];
|
|
632
631
|
else {
|
|
633
632
|
if (t.includes("."))
|
|
634
|
-
return
|
|
633
|
+
return dt(t, e);
|
|
635
634
|
n = null;
|
|
636
635
|
}
|
|
637
636
|
return n == null ? [] : Array.isArray(n) ? n : [String(n)];
|
|
638
637
|
}
|
|
639
|
-
function
|
|
638
|
+
function dt(e, t) {
|
|
640
639
|
const n = e.split(".");
|
|
641
640
|
let r = [t];
|
|
642
|
-
for (let
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
for (let
|
|
646
|
-
const
|
|
647
|
-
if (
|
|
648
|
-
if (Object.hasOwnProperty.call(
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
} else
|
|
641
|
+
for (let a = 0, i = n.length; a < i; a++) {
|
|
642
|
+
const f = n[a];
|
|
643
|
+
let l = [];
|
|
644
|
+
for (let s = 0, u = r.length; s < u; s++) {
|
|
645
|
+
const o = r[s];
|
|
646
|
+
if (o != null)
|
|
647
|
+
if (Object.hasOwnProperty.call(o, f)) {
|
|
648
|
+
const m = o[f];
|
|
649
|
+
m != null && l.push(m);
|
|
650
|
+
} else f === "*" && (l = l.concat(o));
|
|
652
651
|
}
|
|
653
|
-
r =
|
|
652
|
+
r = l;
|
|
654
653
|
}
|
|
655
654
|
return Array.isArray(r[0]) ? [].concat(...r) : r;
|
|
656
655
|
}
|
|
657
|
-
function
|
|
656
|
+
function ft(e, t) {
|
|
658
657
|
const n = [];
|
|
659
|
-
for (let r = 0,
|
|
660
|
-
const
|
|
661
|
-
for (let
|
|
658
|
+
for (let r = 0, a = t.length; r < a; r++) {
|
|
659
|
+
const i = t[r], f = mt(i), l = ut(e, i);
|
|
660
|
+
for (let s = 0, u = l.length; s < u; s++)
|
|
662
661
|
n.push({
|
|
663
|
-
itemValue:
|
|
664
|
-
attributes:
|
|
662
|
+
itemValue: l[s],
|
|
663
|
+
attributes: f
|
|
665
664
|
});
|
|
666
665
|
}
|
|
667
666
|
return n;
|
|
668
667
|
}
|
|
669
|
-
const
|
|
668
|
+
const ye = {
|
|
670
669
|
maxRanking: 1 / 0,
|
|
671
670
|
minRanking: -1 / 0
|
|
672
671
|
};
|
|
673
|
-
function
|
|
674
|
-
return typeof e == "string" ?
|
|
675
|
-
...
|
|
672
|
+
function mt(e) {
|
|
673
|
+
return typeof e == "string" ? ye : {
|
|
674
|
+
...ye,
|
|
676
675
|
...e
|
|
677
676
|
};
|
|
678
677
|
}
|
|
679
|
-
|
|
680
|
-
|
|
678
|
+
function ht(...e) {
|
|
679
|
+
return (t) => {
|
|
680
|
+
e.forEach((n) => _t(n, t));
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
function _t(e, t) {
|
|
684
|
+
e && (typeof e == "function" && t !== void 0 ? e(t) : e.current = t ?? null);
|
|
685
|
+
}
|
|
686
|
+
function pt(e, t) {
|
|
687
|
+
const n = Be(null), r = be(() => ht(e, n, t), [e, n, t]);
|
|
688
|
+
return [n, r];
|
|
689
|
+
}
|
|
690
|
+
const gt = "_indicators_1tqnt_2", At = "_open_1tqnt_34", It = "_disabled_1tqnt_40", vt = "_root_1tqnt_51", Et = "_clearable_1tqnt_86", yt = "_transparent_1tqnt_104", Ot = "_wrapper_1tqnt_204", wt = "_menu_1tqnt_211", xt = "_item_1tqnt_239", Ct = "_highlighted_1tqnt_253", bt = "_selected_1tqnt_256", Nt = "_multiple_1tqnt_256", qt = "_allowUnselectFromList_1tqnt_260", Rt = "_tags_1tqnt_268", Ne = {
|
|
691
|
+
indicators: gt,
|
|
681
692
|
"size-xs": "_size-xs_1tqnt_11",
|
|
682
693
|
"dropdown-indicator": "_dropdown-indicator_1tqnt_14",
|
|
683
694
|
"styled-icon": "_styled-icon_1tqnt_28",
|
|
684
|
-
open:
|
|
685
|
-
disabled:
|
|
695
|
+
open: At,
|
|
696
|
+
disabled: It,
|
|
686
697
|
"input-wrapper": "_input-wrapper_1tqnt_44",
|
|
687
698
|
"icon-placement-right": "_icon-placement-right_1tqnt_47",
|
|
688
|
-
root:
|
|
699
|
+
root: vt,
|
|
689
700
|
"icon-placement-left": "_icon-placement-left_1tqnt_83",
|
|
690
701
|
"icon-placement-both": "_icon-placement-both_1tqnt_83",
|
|
691
|
-
clearable:
|
|
692
|
-
transparent:
|
|
702
|
+
clearable: Et,
|
|
703
|
+
transparent: yt,
|
|
693
704
|
"variant-danger": "_variant-danger_1tqnt_140",
|
|
694
705
|
"variant-success": "_variant-success_1tqnt_143",
|
|
695
706
|
"variant-warning": "_variant-warning_1tqnt_146",
|
|
@@ -697,23 +708,23 @@ const dt = "_indicators_1tqnt_2", ft = "_open_1tqnt_34", mt = "_disabled_1tqnt_4
|
|
|
697
708
|
"size-md": "_size-md_1tqnt_157",
|
|
698
709
|
"size-sm": "_size-sm_1tqnt_165",
|
|
699
710
|
"icon-wrapper": "_icon-wrapper_1tqnt_173",
|
|
700
|
-
wrapper:
|
|
701
|
-
menu:
|
|
702
|
-
item:
|
|
703
|
-
highlighted:
|
|
704
|
-
selected:
|
|
705
|
-
multiple:
|
|
706
|
-
allowUnselectFromList:
|
|
707
|
-
tags:
|
|
711
|
+
wrapper: Ot,
|
|
712
|
+
menu: wt,
|
|
713
|
+
item: xt,
|
|
714
|
+
highlighted: Ct,
|
|
715
|
+
selected: bt,
|
|
716
|
+
multiple: Nt,
|
|
717
|
+
allowUnselectFromList: qt,
|
|
718
|
+
tags: Rt,
|
|
708
719
|
"styled-tag": "_styled-tag_1tqnt_271"
|
|
709
|
-
},
|
|
710
|
-
function
|
|
711
|
-
return /* @__PURE__ */
|
|
720
|
+
}, Oe = Ce(Ne);
|
|
721
|
+
function kt(e, t) {
|
|
722
|
+
return /* @__PURE__ */ p("div", { className: Oe("tags"), role: "list", children: e.map((n) => (
|
|
712
723
|
// TODO migrate after WUI-187/tag
|
|
713
|
-
/* @__PURE__ */
|
|
714
|
-
|
|
724
|
+
/* @__PURE__ */ p(
|
|
725
|
+
tt,
|
|
715
726
|
{
|
|
716
|
-
className:
|
|
727
|
+
className: Oe("styled-tag"),
|
|
717
728
|
onRemove: () => t(n.value.toString()),
|
|
718
729
|
role: "listitem",
|
|
719
730
|
children: n.label
|
|
@@ -722,174 +733,177 @@ function Ct(e, t) {
|
|
|
722
733
|
)
|
|
723
734
|
)) });
|
|
724
735
|
}
|
|
725
|
-
const
|
|
736
|
+
const re = "", St = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g, qe = (e) => {
|
|
726
737
|
if (typeof e == "number")
|
|
727
738
|
return String(e);
|
|
728
739
|
if (typeof e == "string") {
|
|
729
|
-
const t = e.match(
|
|
740
|
+
const t = e.match(St);
|
|
730
741
|
return t && t.map((n) => n.toLowerCase()).join("-");
|
|
731
742
|
}
|
|
732
|
-
},
|
|
743
|
+
}, we = (e) => e ? e.label : re, Ut = (e) => e.reduce(
|
|
733
744
|
(t, n) => n.label && t.length > n.label.length ? t : n.label,
|
|
734
|
-
|
|
735
|
-
),
|
|
736
|
-
const r = t.find((
|
|
737
|
-
return r && n ? t.filter((
|
|
738
|
-
},
|
|
745
|
+
re
|
|
746
|
+
), Vt = (e, t, n) => {
|
|
747
|
+
const r = t.find((a) => e.value === a.value);
|
|
748
|
+
return r && n ? t.filter((a) => e.value !== a.value) : r ? t : [...t, e];
|
|
749
|
+
}, ee = (e, t) => !!t.find((n) => n.value === e), ne = (e, t = []) => t.find(
|
|
739
750
|
(r) => r.label === (e.label || e) || r.value === (e.value || e)
|
|
740
|
-
) || { label: e, value:
|
|
741
|
-
const r = n ? t.flatMap((
|
|
742
|
-
return !e && e !== 0 ? [] : Array.isArray(e) ? e.map((
|
|
743
|
-
},
|
|
751
|
+
) || { label: e, value: qe(e) }, Tt = (e, t, n = !1) => {
|
|
752
|
+
const r = n ? t.flatMap((a) => a.options) : t;
|
|
753
|
+
return !e && e !== 0 ? [] : Array.isArray(e) ? e.map((a) => ne(a, r)) : [ne(e, r)];
|
|
754
|
+
}, Ht = (e, t) => !!t.find((n) => n.value === e.value), zt = (e, t) => Ht(e, t) ? e.value : e.label, xe = (e, t) => e ? e.map((n) => zt(n, t)) : [], Ft = (e, t) => e ? e.filter(
|
|
744
755
|
(n) => !t.find((r) => r.value === n.value)
|
|
745
|
-
) : [],
|
|
756
|
+
) : [], Dt = ({
|
|
746
757
|
inputValue: e,
|
|
747
758
|
isMultiple: t,
|
|
748
759
|
isSearchable: n,
|
|
749
760
|
options: r,
|
|
750
|
-
renderItem:
|
|
761
|
+
renderItem: a
|
|
751
762
|
}) => {
|
|
752
|
-
const
|
|
753
|
-
return t ? e :
|
|
754
|
-
},
|
|
763
|
+
const i = ne(e, r);
|
|
764
|
+
return t ? e : i.label ? n ? i.label : a(i) : re;
|
|
765
|
+
}, y = Ce(Ne), jt = pe.default || pe, Mt = Xe(
|
|
755
766
|
({
|
|
756
767
|
allowUnselectFromList: e,
|
|
757
768
|
autoComplete: t = "off",
|
|
758
769
|
autoFocus: n,
|
|
759
770
|
className: r,
|
|
760
|
-
dataTestId:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
771
|
+
dataTestId: a,
|
|
772
|
+
defaultHighlightedIndex: i,
|
|
773
|
+
disableCloseOnSelect: f,
|
|
774
|
+
disabled: l,
|
|
775
|
+
groupsEnabled: s,
|
|
776
|
+
highlightedIndex: u,
|
|
777
|
+
icon: o,
|
|
778
|
+
iconPlacement: m = "left",
|
|
779
|
+
id: C,
|
|
780
|
+
isClearable: q,
|
|
781
|
+
isCreatable: v,
|
|
782
|
+
isMultiple: g,
|
|
783
|
+
isSearchable: E,
|
|
784
|
+
name: U,
|
|
785
|
+
onBlur: P,
|
|
786
|
+
onChange: Y,
|
|
787
|
+
onClick: B,
|
|
788
|
+
onCreate: X,
|
|
789
|
+
onFocus: Re,
|
|
777
790
|
options: I = [],
|
|
778
|
-
placeholder:
|
|
779
|
-
renderCreateItem:
|
|
780
|
-
renderGroupHeader:
|
|
781
|
-
renderItem:
|
|
782
|
-
renderMultiple:
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
791
|
+
placeholder: se = "Choose from…",
|
|
792
|
+
renderCreateItem: ke = (D) => `Create "${D}"`,
|
|
793
|
+
renderGroupHeader: ae,
|
|
794
|
+
renderItem: z = we,
|
|
795
|
+
renderMultiple: Se = kt,
|
|
796
|
+
renderNoResults: V,
|
|
797
|
+
size: F = "lg",
|
|
798
|
+
transparent: le,
|
|
799
|
+
value: ce,
|
|
800
|
+
variant: ie,
|
|
787
801
|
...oe
|
|
788
|
-
},
|
|
789
|
-
const { getInputProps:
|
|
790
|
-
() =>
|
|
791
|
-
[
|
|
792
|
-
),
|
|
793
|
-
|
|
794
|
-
const [
|
|
795
|
-
|
|
796
|
-
n &&
|
|
797
|
-
}, [
|
|
798
|
-
|
|
799
|
-
}, [
|
|
800
|
-
const
|
|
801
|
-
if (
|
|
802
|
-
let
|
|
803
|
-
|
|
802
|
+
}, Ue) => {
|
|
803
|
+
const { getInputProps: D, variant: Ve } = Je(), ue = Ve || ie, j = be(
|
|
804
|
+
() => Tt(ce, I, s),
|
|
805
|
+
[ce, I, s]
|
|
806
|
+
), Z = !g && j[0] || null, Q = Z ? Z.label : "", [b, G] = $(j), [w, T] = $(Q), [k, M] = $(I), [N, S] = $(!1);
|
|
807
|
+
E = v || E;
|
|
808
|
+
const [J, Te] = pt(Ue);
|
|
809
|
+
ge(() => {
|
|
810
|
+
n && J.current && (J.current.focus(), E && S(!0));
|
|
811
|
+
}, [E, n, J]), ge(() => {
|
|
812
|
+
G(j), T(Q), M(I);
|
|
813
|
+
}, [Q, I, j]);
|
|
814
|
+
const He = (c) => {
|
|
815
|
+
if (E && c !== w) {
|
|
816
|
+
let d = [];
|
|
817
|
+
s ? d = te(I, c, {
|
|
804
818
|
// should match on group.label OR group.options.label
|
|
805
|
-
keys: [(
|
|
806
|
-
}) :
|
|
819
|
+
keys: [(_) => _.label, (_) => _.options.map((O) => O.label)]
|
|
820
|
+
}) : d = te(I, c, { keys: ["label"] }), T(c), M(d);
|
|
807
821
|
}
|
|
808
|
-
},
|
|
809
|
-
|
|
810
|
-
},
|
|
811
|
-
let
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
I.flatMap((
|
|
815
|
-
) :
|
|
816
|
-
const
|
|
817
|
-
if (
|
|
818
|
-
const
|
|
819
|
-
|
|
822
|
+
}, ze = () => {
|
|
823
|
+
E && !N && S(!0);
|
|
824
|
+
}, de = (c) => {
|
|
825
|
+
let d = [];
|
|
826
|
+
s ? d = xe(
|
|
827
|
+
c,
|
|
828
|
+
I.flatMap((h) => h.options)
|
|
829
|
+
) : d = xe(c, I);
|
|
830
|
+
const _ = g ? d : d[0], O = et({ name: U, value: g ? c : c[0] });
|
|
831
|
+
if (Y == null || Y(_, O), v) {
|
|
832
|
+
const h = Ft(c, I);
|
|
833
|
+
h.length && (X == null || X(h[0].label, O));
|
|
820
834
|
}
|
|
821
|
-
},
|
|
822
|
-
let
|
|
823
|
-
!
|
|
824
|
-
},
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
},
|
|
828
|
-
|
|
829
|
-
},
|
|
830
|
-
|
|
831
|
-
},
|
|
832
|
-
inputValue:
|
|
833
|
-
isMultiple:
|
|
834
|
-
isSearchable:
|
|
835
|
+
}, Fe = (c) => {
|
|
836
|
+
let d, _;
|
|
837
|
+
!c || c != null && c.disabled ? (d = g ? b : [], _ = !0) : (d = g ? Vt(c, b, e) : [c], _ = g), _ && T(""), M(I), G(d), de(d), f || S(!1);
|
|
838
|
+
}, De = (c) => {
|
|
839
|
+
const d = b.filter((_) => _.value !== c);
|
|
840
|
+
G(d), de(d);
|
|
841
|
+
}, je = (c) => {
|
|
842
|
+
B == null || B(c), S(!N);
|
|
843
|
+
}, Me = (c) => {
|
|
844
|
+
g && c.selectedItem ? T("") : E && c.selectedItem && T(c.selectedItem.label), M(I), S(!1);
|
|
845
|
+
}, We = Ut(I), fe = Dt({
|
|
846
|
+
inputValue: w,
|
|
847
|
+
isMultiple: g,
|
|
848
|
+
isSearchable: E,
|
|
835
849
|
options: I,
|
|
836
|
-
renderItem:
|
|
837
|
-
}),
|
|
850
|
+
renderItem: z
|
|
851
|
+
}), Ke = Ze(
|
|
838
852
|
({
|
|
839
|
-
getItemProps:
|
|
840
|
-
highlightedIndex:
|
|
841
|
-
options:
|
|
842
|
-
}) =>
|
|
843
|
-
(O,
|
|
844
|
-
if (
|
|
853
|
+
getItemProps: c,
|
|
854
|
+
highlightedIndex: d,
|
|
855
|
+
options: _
|
|
856
|
+
}) => _.reduce(
|
|
857
|
+
(O, h, W) => {
|
|
858
|
+
if (s && "options" in h)
|
|
845
859
|
O.itemsToRender.push(
|
|
846
|
-
/* @__PURE__ */ L(
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
const
|
|
850
|
-
return /* @__PURE__ */
|
|
860
|
+
/* @__PURE__ */ L(Qe, { children: [
|
|
861
|
+
ae(h),
|
|
862
|
+
h.options ? h.options.map((x) => {
|
|
863
|
+
const R = O.itemIndex++, K = ee(x.value, b);
|
|
864
|
+
return /* @__PURE__ */ p(
|
|
851
865
|
"li",
|
|
852
866
|
{
|
|
853
|
-
className:
|
|
867
|
+
className: y(
|
|
854
868
|
"item",
|
|
855
|
-
|
|
856
|
-
|
|
869
|
+
d === R && "highlighted",
|
|
870
|
+
g && "multiple",
|
|
857
871
|
e && "allowUnselectFromList",
|
|
858
|
-
|
|
872
|
+
x.disabled && "disabled",
|
|
859
873
|
K && "selected"
|
|
860
874
|
),
|
|
861
|
-
...
|
|
862
|
-
index:
|
|
863
|
-
item:
|
|
875
|
+
...c({
|
|
876
|
+
index: R,
|
|
877
|
+
item: x
|
|
864
878
|
}),
|
|
865
|
-
children:
|
|
879
|
+
children: z(x, K)
|
|
866
880
|
},
|
|
867
|
-
|
|
881
|
+
x.value
|
|
868
882
|
);
|
|
869
883
|
}) : null
|
|
870
|
-
] },
|
|
884
|
+
] }, h.label)
|
|
871
885
|
);
|
|
872
|
-
else if ("value" in
|
|
873
|
-
const
|
|
886
|
+
else if ("value" in h) {
|
|
887
|
+
const x = ee(h.value, b), R = d === W;
|
|
874
888
|
O.itemsToRender.push(
|
|
875
|
-
/* @__PURE__ */
|
|
889
|
+
/* @__PURE__ */ p(
|
|
876
890
|
"li",
|
|
877
891
|
{
|
|
878
|
-
className:
|
|
892
|
+
className: y(
|
|
879
893
|
"item",
|
|
880
|
-
|
|
881
|
-
|
|
894
|
+
R && "highlighted",
|
|
895
|
+
g && "multiple",
|
|
882
896
|
e && "allowUnselectFromList",
|
|
883
|
-
|
|
884
|
-
|
|
897
|
+
h.disabled && "disabled",
|
|
898
|
+
x && "selected"
|
|
885
899
|
),
|
|
886
|
-
...
|
|
900
|
+
...c({
|
|
887
901
|
index: W,
|
|
888
|
-
item:
|
|
902
|
+
item: h
|
|
889
903
|
}),
|
|
890
|
-
children:
|
|
904
|
+
children: z(h, x)
|
|
891
905
|
},
|
|
892
|
-
|
|
906
|
+
h.value
|
|
893
907
|
)
|
|
894
908
|
);
|
|
895
909
|
}
|
|
@@ -897,116 +911,120 @@ const ee = "", xt = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|
|
|
|
897
911
|
},
|
|
898
912
|
{ itemIndex: 0, itemsToRender: [] }
|
|
899
913
|
).itemsToRender,
|
|
900
|
-
[
|
|
901
|
-
),
|
|
914
|
+
[g, e, b, s, ae, z]
|
|
915
|
+
), me = y(
|
|
902
916
|
"root",
|
|
903
|
-
`size-${
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
917
|
+
`size-${F}`,
|
|
918
|
+
ue && `variant-${ue}`,
|
|
919
|
+
q && "clearable",
|
|
920
|
+
le && "transparent",
|
|
921
|
+
o && `icon-placement-${m}`,
|
|
908
922
|
r,
|
|
909
|
-
|
|
923
|
+
l && "disabled"
|
|
910
924
|
);
|
|
911
|
-
return /* @__PURE__ */
|
|
912
|
-
|
|
925
|
+
return /* @__PURE__ */ p(
|
|
926
|
+
jt,
|
|
913
927
|
{
|
|
914
|
-
|
|
915
|
-
|
|
928
|
+
defaultHighlightedIndex: i,
|
|
929
|
+
highlightedIndex: u,
|
|
930
|
+
id: C,
|
|
931
|
+
inputValue: E ? fe : "",
|
|
916
932
|
isOpen: N,
|
|
917
|
-
itemToString:
|
|
918
|
-
onInputValueChange:
|
|
919
|
-
onOuterClick:
|
|
920
|
-
onSelect:
|
|
921
|
-
selectedItem:
|
|
933
|
+
itemToString: we,
|
|
934
|
+
onInputValueChange: He,
|
|
935
|
+
onOuterClick: Me,
|
|
936
|
+
onSelect: Fe,
|
|
937
|
+
selectedItem: Z,
|
|
922
938
|
children: ({
|
|
923
|
-
clearSelection:
|
|
924
|
-
getInputProps:
|
|
925
|
-
getItemProps:
|
|
939
|
+
clearSelection: c,
|
|
940
|
+
getInputProps: d,
|
|
941
|
+
getItemProps: _,
|
|
926
942
|
getMenuProps: O,
|
|
927
|
-
getRootProps:
|
|
943
|
+
getRootProps: h,
|
|
928
944
|
getToggleButtonProps: W,
|
|
929
|
-
highlightedIndex:
|
|
945
|
+
highlightedIndex: x
|
|
930
946
|
}) => {
|
|
931
|
-
const
|
|
932
|
-
|
|
947
|
+
const R = !!(v && w && !ee(w, b)), K = N && (k.length || R), he = q && w, Le = /* @__PURE__ */ p("div", { className: y("dropdown-indicator", N && "open"), children: /* @__PURE__ */ p(
|
|
948
|
+
Ge,
|
|
933
949
|
{
|
|
934
950
|
animatePresence: !0,
|
|
935
|
-
onClick:
|
|
951
|
+
onClick: c,
|
|
936
952
|
title: "Clear"
|
|
937
953
|
}
|
|
938
|
-
) }),
|
|
954
|
+
) }), $e = /* @__PURE__ */ p(
|
|
939
955
|
"div",
|
|
940
956
|
{
|
|
941
|
-
className:
|
|
942
|
-
"data-testid":
|
|
943
|
-
disabled:
|
|
957
|
+
className: y("dropdown-indicator", N && "open", l && "disabled"),
|
|
958
|
+
"data-testid": a ? `${a}-arrow-icon` : null,
|
|
959
|
+
disabled: l,
|
|
944
960
|
tabIndex: -1,
|
|
945
961
|
...W({
|
|
946
|
-
onClick: () => !
|
|
962
|
+
onClick: () => !l && S(!N)
|
|
947
963
|
}),
|
|
948
|
-
children: /* @__PURE__ */
|
|
964
|
+
children: /* @__PURE__ */ p(Ae, { className: y("styled-icon"), name: "angle-down", size: "lg" })
|
|
949
965
|
}
|
|
950
|
-
),
|
|
966
|
+
), Pe = h(oe, { suppressRefError: !0 }), _e = d({
|
|
951
967
|
autoComplete: t,
|
|
952
968
|
autoFocus: n,
|
|
953
|
-
"data-spacer":
|
|
954
|
-
"data-testid":
|
|
955
|
-
disabled:
|
|
956
|
-
id:
|
|
957
|
-
name:
|
|
958
|
-
onBlur:
|
|
959
|
-
onClick:
|
|
960
|
-
onFocus:
|
|
961
|
-
onKeyDown:
|
|
962
|
-
placeholder:
|
|
963
|
-
ref:
|
|
964
|
-
size:
|
|
969
|
+
"data-spacer": We || se,
|
|
970
|
+
"data-testid": a,
|
|
971
|
+
disabled: l,
|
|
972
|
+
id: C,
|
|
973
|
+
name: U,
|
|
974
|
+
onBlur: P,
|
|
975
|
+
onClick: l ? void 0 : je,
|
|
976
|
+
onFocus: Re,
|
|
977
|
+
onKeyDown: ze,
|
|
978
|
+
placeholder: se,
|
|
979
|
+
ref: Te,
|
|
980
|
+
size: F,
|
|
965
981
|
tabIndex: 0,
|
|
966
|
-
transparent:
|
|
967
|
-
variant: N ? "focused" :
|
|
982
|
+
transparent: le,
|
|
983
|
+
variant: N ? "focused" : ie,
|
|
968
984
|
...oe
|
|
969
985
|
});
|
|
970
|
-
return /* @__PURE__ */ L("div", { ...
|
|
971
|
-
|
|
986
|
+
return /* @__PURE__ */ L("div", { ...Pe, className: y("wrapper", l && "disabled", "field-input"), children: [
|
|
987
|
+
E ? /* @__PURE__ */ p(
|
|
972
988
|
"input",
|
|
973
989
|
{
|
|
974
|
-
className:
|
|
990
|
+
className: me,
|
|
975
991
|
type: "text",
|
|
976
|
-
...
|
|
992
|
+
...D(_e)
|
|
977
993
|
}
|
|
978
|
-
) : /* @__PURE__ */
|
|
979
|
-
|
|
980
|
-
/* @__PURE__ */ L("div", { className:
|
|
981
|
-
|
|
982
|
-
|
|
994
|
+
) : /* @__PURE__ */ p("div", { className: me, ...D(_e), children: fe }),
|
|
995
|
+
o ? /* @__PURE__ */ p("div", { className: y("icon-wrapper", "icon-placement-left", `size-${F}`), children: /* @__PURE__ */ p(Ae, { ...o.props, size: "md" }) }) : null,
|
|
996
|
+
/* @__PURE__ */ L("div", { className: y("indicators", `size-${F}`), children: [
|
|
997
|
+
he ? Le : null,
|
|
998
|
+
$e
|
|
983
999
|
] }),
|
|
984
|
-
K ? /* @__PURE__ */ L("ul", { className:
|
|
985
|
-
|
|
986
|
-
|
|
1000
|
+
K ? /* @__PURE__ */ L("ul", { className: y("menu"), ...O(), children: [
|
|
1001
|
+
Ke({ getItemProps: _, highlightedIndex: x, options: k }),
|
|
1002
|
+
k.length ? null : V == null ? void 0 : V(w),
|
|
1003
|
+
R && w.length ? /* @__PURE__ */ p(
|
|
987
1004
|
"li",
|
|
988
1005
|
{
|
|
989
|
-
className:
|
|
990
|
-
...
|
|
991
|
-
index:
|
|
1006
|
+
className: y("item", x === k.length && "highlighted"),
|
|
1007
|
+
..._({
|
|
1008
|
+
index: k.length,
|
|
992
1009
|
item: {
|
|
993
|
-
label:
|
|
994
|
-
value:
|
|
1010
|
+
label: w,
|
|
1011
|
+
value: qe(w)
|
|
995
1012
|
}
|
|
996
1013
|
}),
|
|
997
|
-
children:
|
|
1014
|
+
children: ke(w)
|
|
998
1015
|
},
|
|
999
1016
|
"add"
|
|
1000
1017
|
) : null
|
|
1001
1018
|
] }) : null,
|
|
1002
|
-
|
|
1019
|
+
!k.length && V ? /* @__PURE__ */ p("ul", { className: y("menu"), ...O(), children: /* @__PURE__ */ p("li", { className: `${y("item")} cursor-default`, children: V(w) }) }) : null,
|
|
1020
|
+
g ? Se(b, De) : null
|
|
1003
1021
|
] });
|
|
1004
1022
|
}
|
|
1005
1023
|
}
|
|
1006
1024
|
);
|
|
1007
1025
|
}
|
|
1008
1026
|
);
|
|
1009
|
-
|
|
1027
|
+
Mt.displayName = "Select";
|
|
1010
1028
|
export {
|
|
1011
|
-
|
|
1029
|
+
Mt as Select
|
|
1012
1030
|
};
|