@purpurds/autocomplete 8.13.0 → 8.14.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/LICENSE.txt +3 -3
- package/dist/autocomplete.cjs.js +1 -1
- package/dist/autocomplete.cjs.js.map +1 -1
- package/dist/autocomplete.es.js +158 -158
- package/dist/autocomplete.es.js.map +1 -1
- package/package.json +13 -13
package/dist/autocomplete.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as l, jsxs as O, Fragment as Nt } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { forwardRef as Y, Children as Ot, isValidElement as Qe, useId as jt, useRef as G, useCallback as At, useEffect as
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import { forwardRef as Y, Children as Ot, isValidElement as Qe, useId as jt, useRef as G, useCallback as At, useEffect as qt, useState as re, cloneElement as Ct } from "react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
function
|
|
5
|
+
function Pt(t) {
|
|
6
6
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
7
7
|
}
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
return
|
|
8
|
+
var ve = { exports: {} }, ge;
|
|
9
|
+
function It() {
|
|
10
|
+
return ge || (ge = 1, (function(t) {
|
|
11
11
|
(function() {
|
|
12
12
|
var u = {}.hasOwnProperty;
|
|
13
13
|
function n() {
|
|
@@ -36,10 +36,10 @@ function kt() {
|
|
|
36
36
|
}
|
|
37
37
|
t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
|
|
38
38
|
})();
|
|
39
|
-
})(
|
|
39
|
+
})(ve)), ve.exports;
|
|
40
40
|
}
|
|
41
|
-
var
|
|
42
|
-
const
|
|
41
|
+
var kt = It();
|
|
42
|
+
const Mt = /* @__PURE__ */ Pt(kt), Bt = {
|
|
43
43
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
44
44
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
45
45
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -47,7 +47,7 @@ const Bt = /* @__PURE__ */ It(Mt), qt = {
|
|
|
47
47
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
48
48
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
49
49
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
50
|
-
}, Lt =
|
|
50
|
+
}, Lt = Mt.bind(Bt), he = "purpur-icon", Rt = "md", zt = (t) => t.filter((u) => Object.keys(u).length >= 1).map((u) => `${u.name}="${u.value}"`).join(" "), Et = ({ content: t = "", title: u } = {}) => {
|
|
51
51
|
const n = [
|
|
52
52
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
53
53
|
{ name: "fill", value: "currentColor" },
|
|
@@ -59,7 +59,7 @@ const Bt = /* @__PURE__ */ It(Mt), qt = {
|
|
|
59
59
|
const e = Et({
|
|
60
60
|
content: Tt(t.svg),
|
|
61
61
|
title: u
|
|
62
|
-
}), r = Lt(
|
|
62
|
+
}), r = Lt(he, `${he}--${o}`, n);
|
|
63
63
|
return /* @__PURE__ */ l("span", { className: r, dangerouslySetInnerHTML: { __html: e }, ...a });
|
|
64
64
|
};
|
|
65
65
|
Xe.displayName = "Icon";
|
|
@@ -343,10 +343,10 @@ function fr() {
|
|
|
343
343
|
})();
|
|
344
344
|
})(Oe)), Oe.exports;
|
|
345
345
|
}
|
|
346
|
-
var
|
|
347
|
-
const
|
|
346
|
+
var vr = fr();
|
|
347
|
+
const gr = /* @__PURE__ */ _r(vr), hr = "_rotate_12t9p_1", mr = "_dash_12t9p_1", br = {
|
|
348
348
|
"purpur-spinner": "_purpur-spinner_12t9p_2",
|
|
349
|
-
rotate:
|
|
349
|
+
rotate: hr,
|
|
350
350
|
"purpur-spinner--xxs": "_purpur-spinner--xxs_12t9p_6",
|
|
351
351
|
"purpur-spinner--xs": "_purpur-spinner--xs_12t9p_10",
|
|
352
352
|
"purpur-spinner--sm": "_purpur-spinner--sm_12t9p_14",
|
|
@@ -356,7 +356,7 @@ const vr = /* @__PURE__ */ _r(hr), gr = "_rotate_12t9p_1", mr = "_dash_12t9p_1",
|
|
|
356
356
|
dash: mr,
|
|
357
357
|
"purpur-spinner__circle--disabled": "_purpur-spinner__circle--disabled_12t9p_41",
|
|
358
358
|
"purpur-spinner__circle--negative": "_purpur-spinner__circle--negative_12t9p_44"
|
|
359
|
-
}, Ae =
|
|
359
|
+
}, Ae = gr.bind(br), K = "purpur-spinner", yr = {
|
|
360
360
|
SM: "sm"
|
|
361
361
|
}, at = ({
|
|
362
362
|
disabled: t = !1,
|
|
@@ -380,9 +380,9 @@ at.displayName = "Spinner";
|
|
|
380
380
|
function xr(t) {
|
|
381
381
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
382
382
|
}
|
|
383
|
-
var
|
|
383
|
+
var qe = { exports: {} }, Ce;
|
|
384
384
|
function wr() {
|
|
385
|
-
return
|
|
385
|
+
return Ce || (Ce = 1, (function(t) {
|
|
386
386
|
(function() {
|
|
387
387
|
var u = {}.hasOwnProperty;
|
|
388
388
|
function n() {
|
|
@@ -411,7 +411,7 @@ function wr() {
|
|
|
411
411
|
}
|
|
412
412
|
t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
|
|
413
413
|
})();
|
|
414
|
-
})(
|
|
414
|
+
})(qe)), qe.exports;
|
|
415
415
|
}
|
|
416
416
|
var $r = wr();
|
|
417
417
|
const Sr = /* @__PURE__ */ xr($r), Nr = {
|
|
@@ -437,7 +437,7 @@ const Sr = /* @__PURE__ */ xr($r), Nr = {
|
|
|
437
437
|
"purpur-button--text-negative": "_purpur-button--text-negative_10jh0_185",
|
|
438
438
|
"purpur-button--text": "_purpur-button--text_10jh0_185",
|
|
439
439
|
"purpur-button__spinner": "_purpur-button__spinner_10jh0_235"
|
|
440
|
-
},
|
|
440
|
+
}, Pe = Sr.bind(Nr), I = "purpur-button", ot = Y(
|
|
441
441
|
({
|
|
442
442
|
children: t,
|
|
443
443
|
className: u,
|
|
@@ -451,33 +451,33 @@ const Sr = /* @__PURE__ */ xr($r), Nr = {
|
|
|
451
451
|
variant: _,
|
|
452
452
|
type: y = "button",
|
|
453
453
|
...x
|
|
454
|
-
},
|
|
454
|
+
}, q) => {
|
|
455
455
|
if (a && _ === "destructive")
|
|
456
456
|
return null;
|
|
457
|
-
const
|
|
457
|
+
const k = Pe(
|
|
458
458
|
[
|
|
459
|
-
|
|
460
|
-
`${
|
|
461
|
-
`${
|
|
459
|
+
I,
|
|
460
|
+
`${I}--${r ? `${_}-negative` : _}`,
|
|
461
|
+
`${I}--${d}`
|
|
462
462
|
],
|
|
463
463
|
{
|
|
464
|
-
[`${
|
|
465
|
-
[`${
|
|
466
|
-
[`${
|
|
467
|
-
[`${
|
|
464
|
+
[`${I}--icon-only`]: a,
|
|
465
|
+
[`${I}--negative`]: r,
|
|
466
|
+
[`${I}--full-width`]: o,
|
|
467
|
+
[`${I}--disabled`]: n || e
|
|
468
468
|
},
|
|
469
469
|
u
|
|
470
|
-
),
|
|
470
|
+
), g = (S) => {
|
|
471
471
|
n || e ? S.preventDefault() : i && i(S);
|
|
472
472
|
}, c = !!x["aria-disabled"] || n || e;
|
|
473
473
|
return /* @__PURE__ */ O(
|
|
474
474
|
"button",
|
|
475
475
|
{
|
|
476
|
-
className:
|
|
476
|
+
className: k,
|
|
477
477
|
type: y,
|
|
478
|
-
ref:
|
|
478
|
+
ref: q,
|
|
479
479
|
"aria-disabled": c,
|
|
480
|
-
onClick:
|
|
480
|
+
onClick: g,
|
|
481
481
|
...x,
|
|
482
482
|
children: [
|
|
483
483
|
e && /* @__PURE__ */ l(
|
|
@@ -486,7 +486,7 @@ const Sr = /* @__PURE__ */ xr($r), Nr = {
|
|
|
486
486
|
size: d === dr.LG ? "xs" : "xxs",
|
|
487
487
|
negative: r,
|
|
488
488
|
disabled: c,
|
|
489
|
-
className:
|
|
489
|
+
className: Pe(`${I}__spinner`)
|
|
490
490
|
}
|
|
491
491
|
),
|
|
492
492
|
" ",
|
|
@@ -500,9 +500,9 @@ ot.displayName = "Button";
|
|
|
500
500
|
function Or(t) {
|
|
501
501
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
502
502
|
}
|
|
503
|
-
var
|
|
503
|
+
var Ie = { exports: {} }, ke;
|
|
504
504
|
function jr() {
|
|
505
|
-
return
|
|
505
|
+
return ke || (ke = 1, (function(t) {
|
|
506
506
|
(function() {
|
|
507
507
|
var u = {}.hasOwnProperty;
|
|
508
508
|
function n() {
|
|
@@ -531,10 +531,10 @@ function jr() {
|
|
|
531
531
|
}
|
|
532
532
|
t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
|
|
533
533
|
})();
|
|
534
|
-
})(
|
|
534
|
+
})(Ie)), Ie.exports;
|
|
535
535
|
}
|
|
536
536
|
var Ar = jr();
|
|
537
|
-
const
|
|
537
|
+
const qr = /* @__PURE__ */ Or(Ar), Cr = {
|
|
538
538
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
539
539
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
540
540
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -542,19 +542,19 @@ const Cr = /* @__PURE__ */ Or(Ar), Pr = {
|
|
|
542
542
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
543
543
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
544
544
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
545
|
-
},
|
|
545
|
+
}, Pr = qr.bind(Cr), Me = "purpur-icon", Ir = "md", kr = (t) => t.filter((u) => Object.keys(u).length >= 1).map((u) => `${u.name}="${u.value}"`).join(" "), Mr = ({ content: t = "", title: u } = {}) => {
|
|
546
546
|
const n = [
|
|
547
547
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
548
548
|
{ name: "fill", value: "currentColor" },
|
|
549
549
|
{ name: "viewBox", value: "0 0 24 24" },
|
|
550
550
|
u ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
551
551
|
], o = u ? `<title>${u}</title>` : "";
|
|
552
|
-
return `<svg ${
|
|
553
|
-
},
|
|
554
|
-
const e =
|
|
555
|
-
content:
|
|
552
|
+
return `<svg ${kr(n)}>${o}${t}</svg>`;
|
|
553
|
+
}, Br = (t) => t.replace(/<(\/?)svg([^>]*)>/g, "").trim(), pt = ({ svg: t, allyTitle: u, className: n, size: o = Ir, ...a }) => {
|
|
554
|
+
const e = Mr({
|
|
555
|
+
content: Br(t.svg),
|
|
556
556
|
title: u
|
|
557
|
-
}), r =
|
|
557
|
+
}), r = Pr(Me, `${Me}--${o}`, n);
|
|
558
558
|
return /* @__PURE__ */ l("span", { className: r, dangerouslySetInnerHTML: { __html: e }, ...a });
|
|
559
559
|
};
|
|
560
560
|
pt.displayName = "Icon";
|
|
@@ -567,7 +567,7 @@ const Lr = {
|
|
|
567
567
|
function Rr(t) {
|
|
568
568
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
569
569
|
}
|
|
570
|
-
var
|
|
570
|
+
var Be = { exports: {} }, Le;
|
|
571
571
|
function zr() {
|
|
572
572
|
return Le || (Le = 1, (function(t) {
|
|
573
573
|
(function() {
|
|
@@ -598,7 +598,7 @@ function zr() {
|
|
|
598
598
|
}
|
|
599
599
|
t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
|
|
600
600
|
})();
|
|
601
|
-
})(
|
|
601
|
+
})(Be)), Be.exports;
|
|
602
602
|
}
|
|
603
603
|
var Er = zr();
|
|
604
604
|
const Tr = /* @__PURE__ */ Rr(Er), Dr = {
|
|
@@ -664,9 +664,9 @@ function Zr() {
|
|
|
664
664
|
}
|
|
665
665
|
var Kr = Zr();
|
|
666
666
|
const Hr = /* @__PURE__ */ Fr(Kr), Wr = {
|
|
667
|
-
"purpur-field-helper-text": "_purpur-field-helper-
|
|
668
|
-
"purpur-field-helper-text--disabled": "_purpur-field-helper-text--
|
|
669
|
-
"purpur-field-helper-text--negative": "_purpur-field-helper-text--
|
|
667
|
+
"purpur-field-helper-text": "_purpur-field-helper-text_1ociq_1",
|
|
668
|
+
"purpur-field-helper-text--disabled": "_purpur-field-helper-text--disabled_1ociq_9",
|
|
669
|
+
"purpur-field-helper-text--negative": "_purpur-field-helper-text--negative_1ociq_12"
|
|
670
670
|
}, Gr = Hr.bind(Wr), ie = "purpur-field-helper-text", Ur = ({
|
|
671
671
|
children: t,
|
|
672
672
|
className: u,
|
|
@@ -779,11 +779,11 @@ function ln(...t) {
|
|
|
779
779
|
}
|
|
780
780
|
// @__NO_SIDE_EFFECTS__
|
|
781
781
|
function sn(t) {
|
|
782
|
-
const u = /* @__PURE__ */ cn(t), n =
|
|
783
|
-
const { children: e, ...r } = o, i =
|
|
782
|
+
const u = /* @__PURE__ */ cn(t), n = h.forwardRef((o, a) => {
|
|
783
|
+
const { children: e, ...r } = o, i = h.Children.toArray(e), d = i.find(_n);
|
|
784
784
|
if (d) {
|
|
785
|
-
const _ = d.props.children, y = i.map((x) => x === d ?
|
|
786
|
-
return /* @__PURE__ */ l(u, { ...r, ref: a, children:
|
|
785
|
+
const _ = d.props.children, y = i.map((x) => x === d ? h.Children.count(_) > 1 ? h.Children.only(null) : h.isValidElement(_) ? _.props.children : null : x);
|
|
786
|
+
return /* @__PURE__ */ l(u, { ...r, ref: a, children: h.isValidElement(_) ? h.cloneElement(_, void 0, y) : null });
|
|
787
787
|
}
|
|
788
788
|
return /* @__PURE__ */ l(u, { ...r, ref: a, children: e });
|
|
789
789
|
});
|
|
@@ -791,19 +791,19 @@ function sn(t) {
|
|
|
791
791
|
}
|
|
792
792
|
// @__NO_SIDE_EFFECTS__
|
|
793
793
|
function cn(t) {
|
|
794
|
-
const u =
|
|
794
|
+
const u = h.forwardRef((n, o) => {
|
|
795
795
|
const { children: a, ...e } = n;
|
|
796
|
-
if (
|
|
797
|
-
const r =
|
|
798
|
-
return a.type !==
|
|
796
|
+
if (h.isValidElement(a)) {
|
|
797
|
+
const r = vn(a), i = fn(e, a.props);
|
|
798
|
+
return a.type !== h.Fragment && (i.ref = o ? ln(o, r) : r), h.cloneElement(a, i);
|
|
799
799
|
}
|
|
800
|
-
return
|
|
800
|
+
return h.Children.count(a) > 1 ? h.Children.only(null) : null;
|
|
801
801
|
});
|
|
802
802
|
return u.displayName = `${t}.SlotClone`, u;
|
|
803
803
|
}
|
|
804
804
|
var dn = Symbol("radix.slottable");
|
|
805
805
|
function _n(t) {
|
|
806
|
-
return
|
|
806
|
+
return h.isValidElement(t) && typeof t.type == "function" && "__radixId" in t.type && t.type.__radixId === dn;
|
|
807
807
|
}
|
|
808
808
|
function fn(t, u) {
|
|
809
809
|
const n = { ...u };
|
|
@@ -816,11 +816,11 @@ function fn(t, u) {
|
|
|
816
816
|
}
|
|
817
817
|
return { ...t, ...n };
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function vn(t) {
|
|
820
820
|
let u = Object.getOwnPropertyDescriptor(t.props, "ref")?.get, n = u && "isReactWarning" in u && u.isReactWarning;
|
|
821
821
|
return n ? t.ref : (u = Object.getOwnPropertyDescriptor(t, "ref")?.get, n = u && "isReactWarning" in u && u.isReactWarning, n ? t.props.ref : t.props.ref || t.ref);
|
|
822
822
|
}
|
|
823
|
-
var
|
|
823
|
+
var gn = [
|
|
824
824
|
"a",
|
|
825
825
|
"button",
|
|
826
826
|
"div",
|
|
@@ -838,14 +838,14 @@ var vn = [
|
|
|
838
838
|
"span",
|
|
839
839
|
"svg",
|
|
840
840
|
"ul"
|
|
841
|
-
],
|
|
842
|
-
const n = /* @__PURE__ */ sn(`Primitive.${u}`), o =
|
|
841
|
+
], hn = gn.reduce((t, u) => {
|
|
842
|
+
const n = /* @__PURE__ */ sn(`Primitive.${u}`), o = h.forwardRef((a, e) => {
|
|
843
843
|
const { asChild: r, ...i } = a, d = r ? n : u;
|
|
844
844
|
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ l(d, { ...i, ref: e });
|
|
845
845
|
});
|
|
846
846
|
return o.displayName = `Primitive.${u}`, { ...t, [u]: o };
|
|
847
|
-
}, {}), mn = "Label", ct =
|
|
848
|
-
|
|
847
|
+
}, {}), mn = "Label", ct = h.forwardRef((t, u) => /* @__PURE__ */ l(
|
|
848
|
+
hn.label,
|
|
849
849
|
{
|
|
850
850
|
...t,
|
|
851
851
|
ref: u,
|
|
@@ -946,25 +946,25 @@ function An() {
|
|
|
946
946
|
})();
|
|
947
947
|
})(He)), He.exports;
|
|
948
948
|
}
|
|
949
|
-
var
|
|
950
|
-
const
|
|
949
|
+
var qn = An();
|
|
950
|
+
const Cn = /* @__PURE__ */ jn(qn), Pn = "_rotate_12t9p_1", In = "_dash_12t9p_1", kn = {
|
|
951
951
|
"purpur-spinner": "_purpur-spinner_12t9p_2",
|
|
952
|
-
rotate:
|
|
952
|
+
rotate: Pn,
|
|
953
953
|
"purpur-spinner--xxs": "_purpur-spinner--xxs_12t9p_6",
|
|
954
954
|
"purpur-spinner--xs": "_purpur-spinner--xs_12t9p_10",
|
|
955
955
|
"purpur-spinner--sm": "_purpur-spinner--sm_12t9p_14",
|
|
956
956
|
"purpur-spinner--md": "_purpur-spinner--md_12t9p_18",
|
|
957
957
|
"purpur-spinner--lg": "_purpur-spinner--lg_12t9p_22",
|
|
958
958
|
"purpur-spinner__circle": "_purpur-spinner__circle_12t9p_26",
|
|
959
|
-
dash:
|
|
959
|
+
dash: In,
|
|
960
960
|
"purpur-spinner__circle--disabled": "_purpur-spinner__circle--disabled_12t9p_41",
|
|
961
961
|
"purpur-spinner__circle--negative": "_purpur-spinner__circle--negative_12t9p_44"
|
|
962
|
-
}, Ge =
|
|
962
|
+
}, Ge = Cn.bind(kn), H = "purpur-spinner", Mn = {
|
|
963
963
|
SM: "sm"
|
|
964
964
|
}, dt = ({
|
|
965
965
|
disabled: t = !1,
|
|
966
966
|
negative: u = !1,
|
|
967
|
-
size: n =
|
|
967
|
+
size: n = Mn.SM,
|
|
968
968
|
className: o,
|
|
969
969
|
...a
|
|
970
970
|
}) => /* @__PURE__ */ l("div", { className: Ge(H, `${H}--${n}`, o), ...a, children: /* @__PURE__ */ l("svg", { viewBox: "0 0 50 50", children: /* @__PURE__ */ l(
|
|
@@ -980,7 +980,7 @@ const Pn = /* @__PURE__ */ jn(Cn), In = "_rotate_12t9p_1", kn = "_dash_12t9p_1",
|
|
|
980
980
|
}
|
|
981
981
|
) }) });
|
|
982
982
|
dt.displayName = "Spinner";
|
|
983
|
-
function
|
|
983
|
+
function Bn(t) {
|
|
984
984
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
985
985
|
}
|
|
986
986
|
var Ue = { exports: {} }, Ye;
|
|
@@ -1017,27 +1017,27 @@ function Ln() {
|
|
|
1017
1017
|
})(Ue)), Ue.exports;
|
|
1018
1018
|
}
|
|
1019
1019
|
var Rn = Ln();
|
|
1020
|
-
const zn = /* @__PURE__ */
|
|
1021
|
-
"purpur-text-field": "_purpur-text-
|
|
1022
|
-
"purpur-text-field__label": "_purpur-text-
|
|
1023
|
-
"purpur-text-field__label-text": "_purpur-text-field__label-
|
|
1024
|
-
"purpur-text-field__field-row": "_purpur-text-field__field-
|
|
1025
|
-
"purpur-text-field__frame": "_purpur-text-
|
|
1026
|
-
"purpur-text-field__frame--negative": "_purpur-text-field__frame--
|
|
1027
|
-
"purpur-text-field__input-container": "_purpur-text-field__input-
|
|
1028
|
-
"purpur-text-field__input-container--disabled": "_purpur-text-field__input-container--
|
|
1029
|
-
"purpur-text-field__input-container--readonly": "_purpur-text-field__input-container--
|
|
1030
|
-
"purpur-text-field__input-container--has-clear-button": "_purpur-text-field__input-container--has-clear-
|
|
1031
|
-
"purpur-text-field__input-container--end-adornment": "_purpur-text-field__input-container--end-
|
|
1032
|
-
"purpur-text-field__input": "_purpur-text-
|
|
1033
|
-
"purpur-text-field__input-container--start-adornment": "_purpur-text-field__input-container--start-
|
|
1034
|
-
"purpur-text-field__input-container--negative": "_purpur-text-field__input-container--
|
|
1035
|
-
"purpur-text-field__input--valid": "_purpur-text-field__input--
|
|
1036
|
-
"purpur-text-field__input--error": "_purpur-text-field__input--
|
|
1037
|
-
"purpur-text-field__input--negative": "_purpur-text-field__input--
|
|
1038
|
-
"purpur-text-field__adornment-container": "_purpur-text-field__adornment-
|
|
1039
|
-
"purpur-text-field__valid-icon": "_purpur-text-field__valid-
|
|
1040
|
-
"purpur-text-field__valid-icon--negative": "_purpur-text-field__valid-icon--
|
|
1020
|
+
const zn = /* @__PURE__ */ Bn(Rn), En = {
|
|
1021
|
+
"purpur-text-field": "_purpur-text-field_1n0q1_1",
|
|
1022
|
+
"purpur-text-field__label": "_purpur-text-field__label_1n0q1_7",
|
|
1023
|
+
"purpur-text-field__label-text": "_purpur-text-field__label-text_1n0q1_12",
|
|
1024
|
+
"purpur-text-field__field-row": "_purpur-text-field__field-row_1n0q1_15",
|
|
1025
|
+
"purpur-text-field__frame": "_purpur-text-field__frame_1n0q1_19",
|
|
1026
|
+
"purpur-text-field__frame--negative": "_purpur-text-field__frame--negative_1n0q1_26",
|
|
1027
|
+
"purpur-text-field__input-container": "_purpur-text-field__input-container_1n0q1_29",
|
|
1028
|
+
"purpur-text-field__input-container--disabled": "_purpur-text-field__input-container--disabled_1n0q1_40",
|
|
1029
|
+
"purpur-text-field__input-container--readonly": "_purpur-text-field__input-container--readonly_1n0q1_43",
|
|
1030
|
+
"purpur-text-field__input-container--has-clear-button": "_purpur-text-field__input-container--has-clear-button_1n0q1_46",
|
|
1031
|
+
"purpur-text-field__input-container--end-adornment": "_purpur-text-field__input-container--end-adornment_1n0q1_49",
|
|
1032
|
+
"purpur-text-field__input": "_purpur-text-field__input_1n0q1_29",
|
|
1033
|
+
"purpur-text-field__input-container--start-adornment": "_purpur-text-field__input-container--start-adornment_1n0q1_55",
|
|
1034
|
+
"purpur-text-field__input-container--negative": "_purpur-text-field__input-container--negative_1n0q1_61",
|
|
1035
|
+
"purpur-text-field__input--valid": "_purpur-text-field__input--valid_1n0q1_109",
|
|
1036
|
+
"purpur-text-field__input--error": "_purpur-text-field__input--error_1n0q1_109",
|
|
1037
|
+
"purpur-text-field__input--negative": "_purpur-text-field__input--negative_1n0q1_130",
|
|
1038
|
+
"purpur-text-field__adornment-container": "_purpur-text-field__adornment-container_1n0q1_146",
|
|
1039
|
+
"purpur-text-field__valid-icon": "_purpur-text-field__valid-icon_1n0q1_151",
|
|
1040
|
+
"purpur-text-field__valid-icon--negative": "_purpur-text-field__valid-icon--negative_1n0q1_154"
|
|
1041
1041
|
}, Tn = (t) => G(t), A = zn.bind(En), f = "purpur-text-field", _t = Y(
|
|
1042
1042
|
({
|
|
1043
1043
|
["data-testid"]: t,
|
|
@@ -1052,30 +1052,30 @@ const zn = /* @__PURE__ */ qn(Rn), En = {
|
|
|
1052
1052
|
label: _,
|
|
1053
1053
|
loading: y = !1,
|
|
1054
1054
|
onClear: x,
|
|
1055
|
-
startAdornment:
|
|
1056
|
-
valid:
|
|
1057
|
-
negative:
|
|
1055
|
+
startAdornment: q,
|
|
1056
|
+
valid: k = !1,
|
|
1057
|
+
negative: g = !1,
|
|
1058
1058
|
...c
|
|
1059
1059
|
}, S) => {
|
|
1060
|
-
const N = jt(), s = c.id ?? N, m = (w) => t ? `${t}-${w}` : void 0,
|
|
1060
|
+
const N = jt(), s = c.id ?? N, m = (w) => t ? `${t}-${w}` : void 0, C = k && !r, M = i ? `${s}-helper-text` : void 0, E = [q].filter((w) => !!w), b = (typeof c.value == "number" ? c.value !== void 0 : c.value?.length) && !c.disabled && !c.readOnly && !y && x && n, j = Tn(null), T = (w) => {
|
|
1061
1061
|
j.current = w, typeof S == "function" ? S(w) : S && (S.current = w);
|
|
1062
1062
|
}, J = () => {
|
|
1063
1063
|
x?.(), j.current?.focus();
|
|
1064
|
-
},
|
|
1064
|
+
}, B = [
|
|
1065
1065
|
y && /* @__PURE__ */ l(
|
|
1066
1066
|
dt,
|
|
1067
1067
|
{
|
|
1068
1068
|
disabled: c.disabled,
|
|
1069
1069
|
size: "xs",
|
|
1070
1070
|
"data-testid": m("spinner"),
|
|
1071
|
-
negative:
|
|
1071
|
+
negative: g
|
|
1072
1072
|
},
|
|
1073
1073
|
"spinner"
|
|
1074
1074
|
),
|
|
1075
1075
|
b && /* @__PURE__ */ l(
|
|
1076
1076
|
ot,
|
|
1077
1077
|
{
|
|
1078
|
-
negative:
|
|
1078
|
+
negative: g,
|
|
1079
1079
|
variant: "tertiary-purple",
|
|
1080
1080
|
onClick: J,
|
|
1081
1081
|
iconOnly: !0,
|
|
@@ -1086,23 +1086,23 @@ const zn = /* @__PURE__ */ qn(Rn), En = {
|
|
|
1086
1086
|
},
|
|
1087
1087
|
"clear-button"
|
|
1088
1088
|
),
|
|
1089
|
-
|
|
1089
|
+
C && /* @__PURE__ */ l(
|
|
1090
1090
|
lt,
|
|
1091
1091
|
{
|
|
1092
1092
|
"data-testid": m("valid-icon"),
|
|
1093
1093
|
className: A(`${f}__valid-icon`, {
|
|
1094
|
-
[`${f}__valid-icon--negative`]:
|
|
1094
|
+
[`${f}__valid-icon--negative`]: g
|
|
1095
1095
|
})
|
|
1096
1096
|
},
|
|
1097
1097
|
"valid-icon"
|
|
1098
1098
|
)
|
|
1099
1099
|
].filter((w) => !!w), D = A(`${f}__input-container`, {
|
|
1100
1100
|
[`${f}__input-container--start-adornment`]: E.length,
|
|
1101
|
-
[`${f}__input-container--end-adornment`]:
|
|
1101
|
+
[`${f}__input-container--end-adornment`]: B.length || e,
|
|
1102
1102
|
[`${f}__input-container--disabled`]: c.disabled,
|
|
1103
1103
|
[`${f}__input-container--has-clear-button`]: b,
|
|
1104
1104
|
[`${f}__input-container--readonly`]: c.readOnly && !c.disabled,
|
|
1105
|
-
[`${f}__input-container--negative`]:
|
|
1105
|
+
[`${f}__input-container--negative`]: g
|
|
1106
1106
|
});
|
|
1107
1107
|
return /* @__PURE__ */ O("div", { className: A(u, f), children: [
|
|
1108
1108
|
_ && /* @__PURE__ */ O(
|
|
@@ -1112,7 +1112,7 @@ const zn = /* @__PURE__ */ qn(Rn), En = {
|
|
|
1112
1112
|
className: A(`${f}__label`),
|
|
1113
1113
|
"data-testid": m("label"),
|
|
1114
1114
|
disabled: c.disabled,
|
|
1115
|
-
negative:
|
|
1115
|
+
negative: g,
|
|
1116
1116
|
children: [
|
|
1117
1117
|
c.required && !d && /* @__PURE__ */ l("span", { "aria-hidden": !0, children: "*" }),
|
|
1118
1118
|
_
|
|
@@ -1137,14 +1137,14 @@ const zn = /* @__PURE__ */ qn(Rn), En = {
|
|
|
1137
1137
|
id: s,
|
|
1138
1138
|
ref: T,
|
|
1139
1139
|
"data-testid": m("input"),
|
|
1140
|
-
"aria-describedby": c["aria-describedby"] ||
|
|
1140
|
+
"aria-describedby": c["aria-describedby"] || M,
|
|
1141
1141
|
"aria-invalid": c["aria-invalid"] || !!r,
|
|
1142
1142
|
className: A([
|
|
1143
1143
|
`${f}__input`,
|
|
1144
1144
|
{
|
|
1145
|
-
[`${f}__input--valid`]:
|
|
1145
|
+
[`${f}__input--valid`]: C,
|
|
1146
1146
|
[`${f}__input--error`]: !!r,
|
|
1147
|
-
[`${f}__input--negative`]:
|
|
1147
|
+
[`${f}__input--negative`]: g
|
|
1148
1148
|
}
|
|
1149
1149
|
])
|
|
1150
1150
|
}
|
|
@@ -1153,17 +1153,17 @@ const zn = /* @__PURE__ */ qn(Rn), En = {
|
|
|
1153
1153
|
"div",
|
|
1154
1154
|
{
|
|
1155
1155
|
className: A(`${f}__frame`, {
|
|
1156
|
-
[`${f}__frame--negative`]:
|
|
1156
|
+
[`${f}__frame--negative`]: g
|
|
1157
1157
|
})
|
|
1158
1158
|
}
|
|
1159
1159
|
),
|
|
1160
|
-
(!!
|
|
1160
|
+
(!!B.length || e) && /* @__PURE__ */ O(
|
|
1161
1161
|
"div",
|
|
1162
1162
|
{
|
|
1163
1163
|
"data-testid": m("end-adornments"),
|
|
1164
1164
|
className: A(`${f}__adornment-container`),
|
|
1165
1165
|
children: [
|
|
1166
|
-
|
|
1166
|
+
B,
|
|
1167
1167
|
e
|
|
1168
1168
|
]
|
|
1169
1169
|
}
|
|
@@ -1171,17 +1171,17 @@ const zn = /* @__PURE__ */ qn(Rn), En = {
|
|
|
1171
1171
|
] }),
|
|
1172
1172
|
!!a && a
|
|
1173
1173
|
] }),
|
|
1174
|
-
|
|
1174
|
+
M && /* @__PURE__ */ l(
|
|
1175
1175
|
Ur,
|
|
1176
1176
|
{
|
|
1177
1177
|
"data-testid": m("helper-text"),
|
|
1178
|
-
id:
|
|
1179
|
-
negative:
|
|
1178
|
+
id: M,
|
|
1179
|
+
negative: g,
|
|
1180
1180
|
disabled: c.disabled,
|
|
1181
1181
|
children: i
|
|
1182
1182
|
}
|
|
1183
1183
|
),
|
|
1184
|
-
r && /* @__PURE__ */ l(Vr, { "data-testid": m("error-text"), negative:
|
|
1184
|
+
r && /* @__PURE__ */ l(Vr, { "data-testid": m("error-text"), negative: g, children: r })
|
|
1185
1185
|
] });
|
|
1186
1186
|
}
|
|
1187
1187
|
);
|
|
@@ -1238,7 +1238,7 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1238
1238
|
},
|
|
1239
1239
|
[u, t]
|
|
1240
1240
|
);
|
|
1241
|
-
|
|
1241
|
+
qt(() => (document.addEventListener("mousedown", n), () => {
|
|
1242
1242
|
document.removeEventListener("mousedown", n);
|
|
1243
1243
|
}), [n]);
|
|
1244
1244
|
}, Un = ({
|
|
@@ -1254,18 +1254,18 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1254
1254
|
onInputBlur: _,
|
|
1255
1255
|
onInputChange: y,
|
|
1256
1256
|
onInputFocus: x,
|
|
1257
|
-
onInputKeyDown:
|
|
1258
|
-
onInputMouseDown:
|
|
1259
|
-
openOnFocus:
|
|
1257
|
+
onInputKeyDown: q,
|
|
1258
|
+
onInputMouseDown: k,
|
|
1259
|
+
openOnFocus: g,
|
|
1260
1260
|
noOptionsText: c,
|
|
1261
1261
|
onSelect: S,
|
|
1262
1262
|
options: N,
|
|
1263
1263
|
selectedOption: s,
|
|
1264
1264
|
["data-testid"]: m
|
|
1265
1265
|
}) => {
|
|
1266
|
-
const [
|
|
1266
|
+
const [C, M] = re(
|
|
1267
1267
|
((typeof a == "string" ? a : o) || s?.label) ?? ""
|
|
1268
|
-
), E = typeof a == "string" ? a :
|
|
1268
|
+
), E = typeof a == "string" ? a : C, [b, j] = re(n ? N[0] : void 0), T = G(null), J = Wn(null), B = G(null), D = G({}), [w, le] = re(!1);
|
|
1269
1269
|
function X(p) {
|
|
1270
1270
|
return m ? `${m}-${p}` : void 0;
|
|
1271
1271
|
}
|
|
@@ -1282,37 +1282,37 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1282
1282
|
return N.filter(($) => e(p, $));
|
|
1283
1283
|
if (!p)
|
|
1284
1284
|
return N;
|
|
1285
|
-
const
|
|
1285
|
+
const v = p.toUpperCase().split(" ") || [];
|
|
1286
1286
|
return N.filter(
|
|
1287
|
-
($) =>
|
|
1287
|
+
($) => v.every(
|
|
1288
1288
|
(R) => ($.value || $.label).toUpperCase().includes(R)
|
|
1289
1289
|
)
|
|
1290
1290
|
);
|
|
1291
|
-
}, se = (p) => s && s?.label === p ? N : ft(p),
|
|
1292
|
-
y?.(p),
|
|
1291
|
+
}, se = (p) => s && s?.label === p ? N : ft(p), P = se(E), ee = (p) => {
|
|
1292
|
+
y?.(p), M(p);
|
|
1293
1293
|
}, te = (p) => {
|
|
1294
1294
|
if (p) {
|
|
1295
|
-
const
|
|
1296
|
-
(
|
|
1295
|
+
const v = p.getBoundingClientRect(), $ = B.current?.getBoundingClientRect() || { top: 0, bottom: 0 };
|
|
1296
|
+
(v.top < $.top || v.bottom > $.bottom) && p.scrollIntoView({ block: "nearest" });
|
|
1297
1297
|
}
|
|
1298
1298
|
}, ce = (p) => {
|
|
1299
1299
|
p && (T.current?.focus(), ee(p.label), S?.(p)), V();
|
|
1300
|
-
},
|
|
1301
|
-
const
|
|
1302
|
-
return p === "ArrowDown" ?
|
|
1303
|
-
}, L = w && (!!
|
|
1300
|
+
}, vt = (p) => {
|
|
1301
|
+
const v = n && !b ? 0 : P.findIndex((R) => R && b?.id === R.id), $ = P.length;
|
|
1302
|
+
return p === "ArrowDown" ? P[(v ?? -1) + 1] || P[0] : P[(v ?? $) - 1] || P[$ - 1];
|
|
1303
|
+
}, L = w && (!!P.length || !!c), gt = (p) => {
|
|
1304
1304
|
!L && F({ eventType: "KEYBOARD" });
|
|
1305
|
-
const
|
|
1306
|
-
j(
|
|
1307
|
-
},
|
|
1308
|
-
switch (
|
|
1305
|
+
const v = vt(p);
|
|
1306
|
+
j(v), v && te(D.current[v.id]);
|
|
1307
|
+
}, ht = (p) => {
|
|
1308
|
+
switch (q?.(p), p.key) {
|
|
1309
1309
|
case "ArrowUp":
|
|
1310
1310
|
case "ArrowDown":
|
|
1311
|
-
p.preventDefault(),
|
|
1311
|
+
p.preventDefault(), gt(p.key);
|
|
1312
1312
|
break;
|
|
1313
1313
|
case "Enter": {
|
|
1314
|
-
const
|
|
1315
|
-
L && ce(
|
|
1314
|
+
const v = b || (n ? N[0] : void 0);
|
|
1315
|
+
L && ce(v), !L && F({ eventType: "KEYBOARD" });
|
|
1316
1316
|
break;
|
|
1317
1317
|
}
|
|
1318
1318
|
case "Escape":
|
|
@@ -1321,15 +1321,15 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1321
1321
|
break;
|
|
1322
1322
|
}
|
|
1323
1323
|
}, mt = (p) => {
|
|
1324
|
-
const
|
|
1325
|
-
ee(p.target.value), j(void 0), !L && F({ eventType: "KEYBOARD" }), n &&
|
|
1324
|
+
const v = se(p.target.value);
|
|
1325
|
+
ee(p.target.value), j(void 0), !L && F({ eventType: "KEYBOARD" }), n && v[0] && te(D.current[v[0].id]);
|
|
1326
1326
|
}, bt = (p) => {
|
|
1327
|
-
|
|
1327
|
+
k?.(p), L ? V() : F({ eventType: "CLICK" });
|
|
1328
1328
|
}, yt = (p) => {
|
|
1329
|
-
x?.(p), !w &&
|
|
1329
|
+
x?.(p), !w && g && F({ eventType: "KEYBOARD" }), T.current?.select();
|
|
1330
1330
|
}, xt = (p) => {
|
|
1331
1331
|
_?.(p), setTimeout(() => {
|
|
1332
|
-
!T.current?.contains(document.activeElement) && !
|
|
1332
|
+
!T.current?.contains(document.activeElement) && !B.current?.contains(document.activeElement) && (V(), t && ee(s ? s.label : ""));
|
|
1333
1333
|
});
|
|
1334
1334
|
}, wt = {
|
|
1335
1335
|
maxHeight: typeof d == "number" ? `${d}px` : d
|
|
@@ -1338,11 +1338,11 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1338
1338
|
"aria-expanded": L,
|
|
1339
1339
|
"data-testid": X("listbox"),
|
|
1340
1340
|
id: `${r}-listbox`,
|
|
1341
|
-
ref:
|
|
1341
|
+
ref: B,
|
|
1342
1342
|
onMouseLeave: () => j(void 0),
|
|
1343
1343
|
style: d ? wt : void 0
|
|
1344
|
-
}, _e = (p) => `${r}-listbox-item-${p.id}`, $t = (p,
|
|
1345
|
-
const $ = () => p.id !== b?.id && j({ ...p, isSetByClickEvent: !0 }), R = (p.id === b?.id || !!n && !b &&
|
|
1344
|
+
}, _e = (p) => `${r}-listbox-item-${p.id}`, $t = (p, v) => {
|
|
1345
|
+
const $ = () => p.id !== b?.id && j({ ...p, isSetByClickEvent: !0 }), R = (p.id === b?.id || !!n && !b && v === 0) && !b?.isSetByClickEvent;
|
|
1346
1346
|
return {
|
|
1347
1347
|
"data-testid": X(`listbox-item-${p.id}`),
|
|
1348
1348
|
id: _e(p),
|
|
@@ -1368,7 +1368,7 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1368
1368
|
onChange: mt,
|
|
1369
1369
|
onMouseDown: bt,
|
|
1370
1370
|
onFocus: yt,
|
|
1371
|
-
onKeyDown:
|
|
1371
|
+
onKeyDown: ht,
|
|
1372
1372
|
onBlur: xt,
|
|
1373
1373
|
ref: T,
|
|
1374
1374
|
role: "combobox",
|
|
@@ -1378,7 +1378,7 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1378
1378
|
id: r,
|
|
1379
1379
|
inputProps: St,
|
|
1380
1380
|
internalRef: J,
|
|
1381
|
-
optionsToShow:
|
|
1381
|
+
optionsToShow: P,
|
|
1382
1382
|
showListbox: L,
|
|
1383
1383
|
noOptionsText: c,
|
|
1384
1384
|
combobox: t,
|
|
@@ -1395,18 +1395,18 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1395
1395
|
showListbox: _,
|
|
1396
1396
|
noOptionsText: y,
|
|
1397
1397
|
combobox: x,
|
|
1398
|
-
comboboxButtonAriaLabel:
|
|
1399
|
-
getListBoxItemProps:
|
|
1400
|
-
listboxProps:
|
|
1398
|
+
comboboxButtonAriaLabel: q,
|
|
1399
|
+
getListBoxItemProps: k,
|
|
1400
|
+
listboxProps: g
|
|
1401
1401
|
} = Un(o), c = (s, m) => {
|
|
1402
|
-
const { key:
|
|
1403
|
-
return /* @__PURE__ */ l(U.Item, { ...
|
|
1402
|
+
const { key: C, ...M } = k(s, m);
|
|
1403
|
+
return /* @__PURE__ */ l(U.Item, { ...M, children: n ? n?.(s) : s.label }, C);
|
|
1404
1404
|
}, S = (s) => {
|
|
1405
1405
|
i.current = s, typeof a == "function" ? a(s) : a && (a.current = s);
|
|
1406
1406
|
}, N = () => {
|
|
1407
1407
|
const s = u(r);
|
|
1408
|
-
if (x &&
|
|
1409
|
-
const
|
|
1408
|
+
if (x && q && y && s && Dn(s)) {
|
|
1409
|
+
const C = /* @__PURE__ */ O(Nt, { children: [
|
|
1410
1410
|
s.props.endAdornment,
|
|
1411
1411
|
/* @__PURE__ */ l(
|
|
1412
1412
|
"button",
|
|
@@ -1417,9 +1417,9 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1417
1417
|
onClick: () => {
|
|
1418
1418
|
r.onFocus(void 0), r.onMouseDown(void 0);
|
|
1419
1419
|
},
|
|
1420
|
-
"aria-label":
|
|
1420
|
+
"aria-label": q,
|
|
1421
1421
|
"aria-expanded": _,
|
|
1422
|
-
"aria-controls":
|
|
1422
|
+
"aria-controls": g.id,
|
|
1423
1423
|
children: /* @__PURE__ */ l(
|
|
1424
1424
|
et,
|
|
1425
1425
|
{
|
|
@@ -1432,13 +1432,13 @@ const Kn = /* @__PURE__ */ Vn(Zn), Hn = {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
)
|
|
1434
1434
|
] });
|
|
1435
|
-
return
|
|
1435
|
+
return Ct(s, { endAdornment: C });
|
|
1436
1436
|
}
|
|
1437
1437
|
return s;
|
|
1438
1438
|
};
|
|
1439
1439
|
return /* @__PURE__ */ O("div", { id: e, ref: S, className: Q([W, t]), children: [
|
|
1440
1440
|
N(),
|
|
1441
|
-
_ && /* @__PURE__ */ l(U, { ...
|
|
1441
|
+
_ && /* @__PURE__ */ l(U, { ...g, className: Q(`${W}__listbox`), children: d.length ? d.filter((s) => !!s).map(c) : /* @__PURE__ */ l(U.Item, { noninteractive: !0, children: y }) })
|
|
1442
1442
|
] });
|
|
1443
1443
|
}, Jn = Y(Yn);
|
|
1444
1444
|
Jn.displayName = "Autocomplete";
|