mimir-ui-kit 1.6.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/Input.css +1 -1
- package/dist/assets/Switch.css +1 -0
- package/dist/components/Input/Input.js +14 -14
- package/dist/components/RadioGroup/RadioGroup.js +2 -1
- package/dist/components/SelectSearch/SelectSearch.js +49 -73
- package/dist/components/Switch/Switch.d.ts +4 -0
- package/dist/components/Switch/Switch.js +52 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +4 -0
- package/dist/components/Switch/types.d.ts +4 -0
- package/dist/components/Switch/types.js +1 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +2 -2
- package/dist/focus-management-CFDo6ZSc.js +91 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -4
- package/dist/{focus-management-4cCSLNHi.js → label-BXAcSLy0.js} +66 -153
- package/dist/use-active-press-9MCrfRZk.js +31 -0
- package/package.json +1 -1
- package/dist/DatePickerModal-CbzwSnA7.js +0 -202
- package/dist/assets/DatePickerModal.css +0 -1
- package/dist/components/DatePicker/DatePicker.d.ts +0 -44
- package/dist/components/DatePicker/DatePicker.js +0 -78
- package/dist/components/DatePicker/DatePickerModal.d.ts +0 -8
- package/dist/components/DatePicker/DatePickerModal.js +0 -8
- package/dist/components/DatePicker/constants.d.ts +0 -5
- package/dist/components/DatePicker/constants.js +0 -9
- package/dist/components/DatePicker/index.d.ts +0 -2
- package/dist/components/DatePicker/index.js +0 -4
- package/dist/utils/formating/Date.d.ts +0 -1
- package/dist/utils/formating/Date.js +0 -27
- package/dist/utils/formating/Month.d.ts +0 -8
- package/dist/utils/formating/Month.js +0 -80
- package/dist/utils/formating/Number.d.ts +0 -6
- package/dist/utils/formating/Number.js +0 -8
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.js +0 -11
@@ -0,0 +1,91 @@
|
|
1
|
+
import { useCallback } from "react";
|
2
|
+
import { u as u$1, a as u$2 } from "./label-BXAcSLy0.js";
|
3
|
+
function l(e, r) {
|
4
|
+
return e !== null && r !== null && typeof e == "object" && typeof r == "object" && "id" in e && "id" in r ? e.id === r.id : e === r;
|
5
|
+
}
|
6
|
+
function u(e = l) {
|
7
|
+
return useCallback((r, t) => {
|
8
|
+
if (typeof e == "string") {
|
9
|
+
let o = e;
|
10
|
+
return (r == null ? void 0 : r[o]) === (t == null ? void 0 : t[o]);
|
11
|
+
}
|
12
|
+
return e(r, t);
|
13
|
+
}, [e]);
|
14
|
+
}
|
15
|
+
let f = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(","), p = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
|
16
|
+
var F = ((n) => (n[n.First = 1] = "First", n[n.Previous = 2] = "Previous", n[n.Next = 4] = "Next", n[n.Last = 8] = "Last", n[n.WrapAround = 16] = "WrapAround", n[n.NoScroll = 32] = "NoScroll", n[n.AutoFocus = 64] = "AutoFocus", n))(F || {}), T = ((o) => (o[o.Error = 0] = "Error", o[o.Overflow = 1] = "Overflow", o[o.Success = 2] = "Success", o[o.Underflow = 3] = "Underflow", o))(T || {}), y = ((t) => (t[t.Previous = -1] = "Previous", t[t.Next = 1] = "Next", t))(y || {});
|
17
|
+
function b(e = document.body) {
|
18
|
+
return e == null ? [] : Array.from(e.querySelectorAll(f)).sort((r, t) => Math.sign((r.tabIndex || Number.MAX_SAFE_INTEGER) - (t.tabIndex || Number.MAX_SAFE_INTEGER)));
|
19
|
+
}
|
20
|
+
function S(e = document.body) {
|
21
|
+
return e == null ? [] : Array.from(e.querySelectorAll(p)).sort((r, t) => Math.sign((r.tabIndex || Number.MAX_SAFE_INTEGER) - (t.tabIndex || Number.MAX_SAFE_INTEGER)));
|
22
|
+
}
|
23
|
+
var h = ((t) => (t[t.Strict = 0] = "Strict", t[t.Loose = 1] = "Loose", t))(h || {});
|
24
|
+
function A(e, r = 0) {
|
25
|
+
var t;
|
26
|
+
return e === ((t = u$1(e)) == null ? void 0 : t.body) ? false : u$2(r, { [0]() {
|
27
|
+
return e.matches(f);
|
28
|
+
}, [1]() {
|
29
|
+
let u2 = e;
|
30
|
+
for (; u2 !== null; ) {
|
31
|
+
if (u2.matches(f)) return true;
|
32
|
+
u2 = u2.parentElement;
|
33
|
+
}
|
34
|
+
return false;
|
35
|
+
} });
|
36
|
+
}
|
37
|
+
var H = ((t) => (t[t.Keyboard = 0] = "Keyboard", t[t.Mouse = 1] = "Mouse", t))(H || {});
|
38
|
+
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("keydown", (e) => {
|
39
|
+
e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
|
40
|
+
}, true), document.addEventListener("click", (e) => {
|
41
|
+
e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
|
42
|
+
}, true));
|
43
|
+
let w = ["textarea", "input"].join(",");
|
44
|
+
function O(e) {
|
45
|
+
var r, t;
|
46
|
+
return (t = (r = e == null ? void 0 : e.matches) == null ? void 0 : r.call(e, w)) != null ? t : false;
|
47
|
+
}
|
48
|
+
function _(e, r = (t) => t) {
|
49
|
+
return e.slice().sort((t, u2) => {
|
50
|
+
let o = r(t), c = r(u2);
|
51
|
+
if (o === null || c === null) return 0;
|
52
|
+
let l2 = o.compareDocumentPosition(c);
|
53
|
+
return l2 & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : l2 & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
54
|
+
});
|
55
|
+
}
|
56
|
+
function P(e, r, { sorted: t = true, relativeTo: u2 = null, skipElements: o = [] } = {}) {
|
57
|
+
let c = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, l2 = Array.isArray(e) ? t ? _(e) : e : r & 64 ? S(e) : b(e);
|
58
|
+
o.length > 0 && l2.length > 1 && (l2 = l2.filter((s) => !o.some((a) => a != null && "current" in a ? (a == null ? void 0 : a.current) === s : a === s))), u2 = u2 != null ? u2 : c.activeElement;
|
59
|
+
let n = (() => {
|
60
|
+
if (r & 5) return 1;
|
61
|
+
if (r & 10) return -1;
|
62
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
63
|
+
})(), x = (() => {
|
64
|
+
if (r & 1) return 0;
|
65
|
+
if (r & 2) return Math.max(0, l2.indexOf(u2)) - 1;
|
66
|
+
if (r & 4) return Math.max(0, l2.indexOf(u2)) + 1;
|
67
|
+
if (r & 8) return l2.length - 1;
|
68
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
69
|
+
})(), M = r & 32 ? { preventScroll: true } : {}, m = 0, d = l2.length, i;
|
70
|
+
do {
|
71
|
+
if (m >= d || m + d <= 0) return 0;
|
72
|
+
let s = x + m;
|
73
|
+
if (r & 16) s = (s + d) % d;
|
74
|
+
else {
|
75
|
+
if (s < 0) return 3;
|
76
|
+
if (s >= d) return 1;
|
77
|
+
}
|
78
|
+
i = l2[s], i == null || i.focus(M), m += n;
|
79
|
+
} while (i !== c.activeElement);
|
80
|
+
return r & 6 && O(i) && i.select(), 2;
|
81
|
+
}
|
82
|
+
export {
|
83
|
+
A,
|
84
|
+
F,
|
85
|
+
P,
|
86
|
+
T,
|
87
|
+
_,
|
88
|
+
f,
|
89
|
+
h,
|
90
|
+
u
|
91
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -7,7 +7,6 @@ import { InputPhoneNumber } from "./components/InputPhoneNumber/InputPhoneNumber
|
|
7
7
|
import { getMaskedInputPhoneValue, getUnmaskedInputValue } from "./components/InputPhoneNumber/utils.js";
|
8
8
|
import { OtpInput } from "./components/OtpInput/OtpInput.js";
|
9
9
|
import { RadioGroup } from "./components/RadioGroup/RadioGroup.js";
|
10
|
-
import { DatePicker } from "./components/DatePicker/DatePicker.js";
|
11
10
|
import { MergedButton } from "./components/MergedButton/MergedButton.js";
|
12
11
|
import { EMergedButtonVariantRound } from "./components/MergedButton/constants.js";
|
13
12
|
import { AppImage } from "./components/Image/Image.js";
|
@@ -21,14 +20,13 @@ import { Vote } from "./components/Vote/Vote.js";
|
|
21
20
|
import { EVoteSize } from "./components/Vote/constants.js";
|
22
21
|
import { SelectSearch } from "./components/SelectSearch/SelectSearch.js";
|
23
22
|
import { ESelectSearchSize } from "./components/SelectSearch/constants.js";
|
23
|
+
import { Switch } from "./components/Switch/Switch.js";
|
24
24
|
import { useMediaQuery } from "./hooks/useMediaQuery/useMediaQuery.js";
|
25
25
|
import { EMediaQuery } from "./hooks/useMediaQuery/constants.js";
|
26
26
|
import { useLockBodyScroll } from "./hooks/useLockBodyScroll/useLockBodyScroll.js";
|
27
27
|
import { Icon } from "./icons/Icon.js";
|
28
|
-
import { formating } from "./utils/index.js";
|
29
28
|
import './assets/index.css';export {
|
30
29
|
Button,
|
31
|
-
DatePicker,
|
32
30
|
Drawer,
|
33
31
|
EButtonForm,
|
34
32
|
EButtonSize,
|
@@ -56,8 +54,8 @@ import './assets/index.css';export {
|
|
56
54
|
SelectSearch,
|
57
55
|
Slider,
|
58
56
|
Steps,
|
57
|
+
Switch,
|
59
58
|
Vote,
|
60
|
-
formating,
|
61
59
|
getMaskedInputPhoneValue,
|
62
60
|
getUnmaskedInputValue,
|
63
61
|
useLockBodyScroll,
|
@@ -535,7 +535,7 @@ let o$4 = class o {
|
|
535
535
|
}
|
536
536
|
};
|
537
537
|
let s$2 = new o$4();
|
538
|
-
function u$
|
538
|
+
function u$3(r2) {
|
539
539
|
return s$2.isServer ? null : r2 instanceof Node ? r2.ownerDocument : r2 != null && r2.hasOwnProperty("current") && r2.current instanceof Node ? r2.current.ownerDocument : document;
|
540
540
|
}
|
541
541
|
function t$1(e2) {
|
@@ -579,7 +579,7 @@ function o$3() {
|
|
579
579
|
} };
|
580
580
|
return r2;
|
581
581
|
}
|
582
|
-
function p$
|
582
|
+
function p$1() {
|
583
583
|
let [e2] = useState(o$3);
|
584
584
|
return useEffect(() => () => e2.dispose(), [e2]), e2;
|
585
585
|
}
|
@@ -603,36 +603,36 @@ function a$2() {
|
|
603
603
|
function t(...r2) {
|
604
604
|
return Array.from(new Set(r2.flatMap((n2) => typeof n2 == "string" ? n2.split(" ") : []))).filter(Boolean).join(" ");
|
605
605
|
}
|
606
|
-
function u$
|
606
|
+
function u$2(r2, n2, ...a2) {
|
607
607
|
if (r2 in n2) {
|
608
608
|
let e2 = n2[r2];
|
609
609
|
return typeof e2 == "function" ? e2(...a2) : e2;
|
610
610
|
}
|
611
611
|
let t2 = new Error(`Tried to handle "${r2}" but there is no handler defined. Only defined handlers are: ${Object.keys(n2).map((e2) => `"${e2}"`).join(", ")}.`);
|
612
|
-
throw Error.captureStackTrace && Error.captureStackTrace(t2, u$
|
612
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t2, u$2), t2;
|
613
613
|
}
|
614
|
-
var M = ((a2) => (a2[a2.None = 0] = "None", a2[a2.RenderStrategy = 1] = "RenderStrategy", a2[a2.Static = 2] = "Static", a2))(M || {}), O
|
615
|
-
function H
|
616
|
-
i2 = i2 != null ? i2 : A
|
614
|
+
var M = ((a2) => (a2[a2.None = 0] = "None", a2[a2.RenderStrategy = 1] = "RenderStrategy", a2[a2.Static = 2] = "Static", a2))(M || {}), O = ((e2) => (e2[e2.Unmount = 0] = "Unmount", e2[e2.Hidden = 1] = "Hidden", e2))(O || {});
|
615
|
+
function H({ ourProps: r2, theirProps: n2, slot: e2, defaultTag: a2, features: s2, visible: t2 = true, name: l2, mergeRefs: i2 }) {
|
616
|
+
i2 = i2 != null ? i2 : A;
|
617
617
|
let o3 = N$1(n2, r2);
|
618
|
-
if (t2) return b
|
618
|
+
if (t2) return b(o3, e2, a2, l2, i2);
|
619
619
|
let y2 = s2 != null ? s2 : 0;
|
620
620
|
if (y2 & 2) {
|
621
621
|
let { static: f2 = false, ...u2 } = o3;
|
622
|
-
if (f2) return b
|
622
|
+
if (f2) return b(u2, e2, a2, l2, i2);
|
623
623
|
}
|
624
624
|
if (y2 & 1) {
|
625
625
|
let { unmount: f2 = true, ...u2 } = o3;
|
626
|
-
return u$
|
626
|
+
return u$2(f2 ? 0 : 1, { [0]() {
|
627
627
|
return null;
|
628
628
|
}, [1]() {
|
629
|
-
return b
|
629
|
+
return b({ ...u2, hidden: true, style: { display: "none" } }, e2, a2, l2, i2);
|
630
630
|
} });
|
631
631
|
}
|
632
|
-
return b
|
632
|
+
return b(o3, e2, a2, l2, i2);
|
633
633
|
}
|
634
|
-
function b
|
635
|
-
let { as: t$12 = e2, children: l2, refName: i2 = "ref", ...o3 } = h
|
634
|
+
function b(r2, n2 = {}, e2, a2, s2) {
|
635
|
+
let { as: t$12 = e2, children: l2, refName: i2 = "ref", ...o3 } = h(r2, ["unmount", "static"]), y2 = r2.ref !== void 0 ? { [i2]: r2.ref } : {}, f2 = typeof l2 == "function" ? l2(n2) : l2;
|
636
636
|
"className" in o3 && o3.className && typeof o3.className == "function" && (o3.className = o3.className(n2)), o3["aria-labelledby"] && o3["aria-labelledby"] === o3.id && (o3["aria-labelledby"] = void 0);
|
637
637
|
let u2 = {};
|
638
638
|
if (n2) {
|
@@ -649,13 +649,13 @@ function b$1(r2, n2 = {}, e2, a2, s2) {
|
|
649
649
|
`)].join(`
|
650
650
|
`));
|
651
651
|
} else {
|
652
|
-
let d2 = f2.props, p2 = d2 == null ? void 0 : d2.className, c2 = typeof p2 == "function" ? (...
|
653
|
-
for (let
|
652
|
+
let d2 = f2.props, p2 = d2 == null ? void 0 : d2.className, c2 = typeof p2 == "function" ? (...F) => t(p2(...F), o3.className) : t(p2, o3.className), T2 = c2 ? { className: c2 } : {}, g = N$1(f2.props, m(h(o3, ["ref"])));
|
653
|
+
for (let F in u2) F in g && delete u2[F];
|
654
654
|
return cloneElement(f2, Object.assign({}, g, u2, y2, { ref: s2(f2.ref, y2.ref) }, T2));
|
655
655
|
}
|
656
|
-
return createElement(t$12, Object.assign({}, h
|
656
|
+
return createElement(t$12, Object.assign({}, h(o3, ["ref"]), t$12 !== Fragment && y2, t$12 !== Fragment && u2), f2);
|
657
657
|
}
|
658
|
-
function A
|
658
|
+
function A(...r2) {
|
659
659
|
return r2.every((n2) => n2 == null) ? void 0 : (n2) => {
|
660
660
|
for (let e2 of r2) e2 != null && (typeof e2 == "function" ? e2(n2) : e2.current = n2);
|
661
661
|
};
|
@@ -698,31 +698,31 @@ function m(r2) {
|
|
698
698
|
for (let e2 in n2) n2[e2] === void 0 && delete n2[e2];
|
699
699
|
return n2;
|
700
700
|
}
|
701
|
-
function h
|
701
|
+
function h(r2, n2 = []) {
|
702
702
|
let e2 = Object.assign({}, r2);
|
703
703
|
for (let a2 of n2) a2 in e2 && delete e2[a2];
|
704
704
|
return e2;
|
705
705
|
}
|
706
|
-
function T$
|
706
|
+
function T$2(l2, r2, c2) {
|
707
707
|
let [i2, s2] = useState(c2), e2 = l2 !== void 0, t2 = useRef(e2), u2 = useRef(false), d2 = useRef(false);
|
708
708
|
return e2 && !t2.current && !u2.current ? (u2.current = true, t2.current = e2, console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")) : !e2 && t2.current && !d2.current && (d2.current = true, t2.current = e2, console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")), [e2 ? l2 : i2, o$2((n2) => (e2 || s2(n2), r2 == null ? void 0 : r2(n2)))];
|
709
709
|
}
|
710
|
-
function l$
|
710
|
+
function l$1(e2) {
|
711
711
|
let [t2] = useState(e2);
|
712
712
|
return t2;
|
713
713
|
}
|
714
714
|
function e$1(i2 = {}, s2 = null, t2 = []) {
|
715
|
-
for (let [r2, n2] of Object.entries(i2)) o$1(t2, f$
|
715
|
+
for (let [r2, n2] of Object.entries(i2)) o$1(t2, f$2(s2, r2), n2);
|
716
716
|
return t2;
|
717
717
|
}
|
718
|
-
function f$
|
718
|
+
function f$2(i2, s2) {
|
719
719
|
return i2 ? i2 + "[" + s2 + "]" : s2;
|
720
720
|
}
|
721
721
|
function o$1(i2, s2, t2) {
|
722
|
-
if (Array.isArray(t2)) for (let [r2, n2] of t2.entries()) o$1(i2, f$
|
722
|
+
if (Array.isArray(t2)) for (let [r2, n2] of t2.entries()) o$1(i2, f$2(s2, r2.toString()), n2);
|
723
723
|
else t2 instanceof Date ? i2.push([s2, t2.toISOString()]) : typeof t2 == "boolean" ? i2.push([s2, t2 ? "1" : "0"]) : typeof t2 == "string" ? i2.push([s2, t2]) : typeof t2 == "number" ? i2.push([s2, `${t2}`]) : t2 == null ? i2.push([s2, ""]) : e$1(t2, s2, i2);
|
724
724
|
}
|
725
|
-
function p
|
725
|
+
function p(i2) {
|
726
726
|
var t2, r2;
|
727
727
|
let s2 = (t2 = i2 == null ? void 0 : i2.form) != null ? t2 : i2.closest("form");
|
728
728
|
if (s2) {
|
@@ -735,24 +735,24 @@ function p$1(i2) {
|
|
735
735
|
}
|
736
736
|
let a$1 = "span";
|
737
737
|
var s = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s || {});
|
738
|
-
function l
|
738
|
+
function l(t2, r2) {
|
739
739
|
var n2;
|
740
740
|
let { features: d2 = 1, ...e2 } = t2, o3 = { ref: r2, "aria-hidden": (d2 & 2) === 2 ? true : (n2 = e2["aria-hidden"]) != null ? n2 : void 0, hidden: (d2 & 4) === 4 ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(d2 & 4) === 4 && (d2 & 2) !== 2 && { display: "none" } } };
|
741
|
-
return H
|
741
|
+
return H({ ourProps: o3, theirProps: e2, slot: {}, defaultTag: a$1, name: "Hidden" });
|
742
742
|
}
|
743
|
-
let T$
|
744
|
-
let f$
|
743
|
+
let T$1 = W(l);
|
744
|
+
let f$1 = createContext(null);
|
745
745
|
function c$1({ children: t2 }) {
|
746
|
-
let e2 = useContext(f$
|
746
|
+
let e2 = useContext(f$1);
|
747
747
|
if (!e2) return React__default.createElement(React__default.Fragment, null, t2);
|
748
748
|
let { target: r2 } = e2;
|
749
749
|
return r2 ? createPortal(React__default.createElement(React__default.Fragment, null, t2), r2) : null;
|
750
750
|
}
|
751
|
-
function j({ data: t2, form: e2, disabled: r2, onReset: n2, overrides:
|
752
|
-
let [i2, a2] = useState(null), p2 = p$
|
751
|
+
function j({ data: t2, form: e2, disabled: r2, onReset: n2, overrides: F }) {
|
752
|
+
let [i2, a2] = useState(null), p2 = p$1();
|
753
753
|
return useEffect(() => {
|
754
754
|
if (n2 && i2) return p2.addEventListener(i2, "reset", n2);
|
755
|
-
}, [i2, e2, n2]), React__default.createElement(c$1, null, React__default.createElement(C$1, { setForm: a2, formId: e2 }), e$1(t2).map(([s$12, v]) => React__default.createElement(T$
|
755
|
+
}, [i2, e2, n2]), React__default.createElement(c$1, null, React__default.createElement(C$1, { setForm: a2, formId: e2 }), e$1(t2).map(([s$12, v]) => React__default.createElement(T$1, { features: s.Hidden, ...m({ key: s$12, as: "input", type: "hidden", hidden: true, readOnly: true, form: e2, disabled: r2, name: s$12, value: v, ...F }) })));
|
756
756
|
}
|
757
757
|
function C$1({ setForm: t2, formId: e2 }) {
|
758
758
|
return useEffect(() => {
|
@@ -760,14 +760,14 @@ function C$1({ setForm: t2, formId: e2 }) {
|
|
760
760
|
let r2 = document.getElementById(e2);
|
761
761
|
r2 && t2(r2);
|
762
762
|
}
|
763
|
-
}, [t2, e2]), e2 ? null : React__default.createElement(T$
|
763
|
+
}, [t2, e2]), e2 ? null : React__default.createElement(T$1, { features: s.Hidden, as: "input", type: "hidden", hidden: true, readOnly: true, ref: (r2) => {
|
764
764
|
if (!r2) return;
|
765
765
|
let n2 = r2.closest("form");
|
766
766
|
n2 && t2(n2);
|
767
767
|
} });
|
768
768
|
}
|
769
769
|
let e = createContext(void 0);
|
770
|
-
function u$
|
770
|
+
function u$1() {
|
771
771
|
return useContext(e);
|
772
772
|
}
|
773
773
|
function r(n2) {
|
@@ -785,11 +785,11 @@ function i(n2) {
|
|
785
785
|
}
|
786
786
|
return true;
|
787
787
|
}
|
788
|
-
let u
|
789
|
-
function T
|
790
|
-
return Object.assign(t2, { [u
|
788
|
+
let u = Symbol();
|
789
|
+
function T(t2, n2 = true) {
|
790
|
+
return Object.assign(t2, { [u]: n2 });
|
791
791
|
}
|
792
|
-
function y
|
792
|
+
function y(...t2) {
|
793
793
|
let n2 = useRef(t2);
|
794
794
|
useEffect(() => {
|
795
795
|
n2.current = t2;
|
@@ -797,15 +797,15 @@ function y$1(...t2) {
|
|
797
797
|
let c2 = o$2((e2) => {
|
798
798
|
for (let o3 of n2.current) o3 != null && (typeof o3 == "function" ? o3(e2) : o3.current = e2);
|
799
799
|
});
|
800
|
-
return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u
|
800
|
+
return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u])) ? void 0 : c2;
|
801
801
|
}
|
802
802
|
let a = createContext(null);
|
803
803
|
a.displayName = "DescriptionContext";
|
804
|
-
function f
|
804
|
+
function f() {
|
805
805
|
let r2 = useContext(a);
|
806
806
|
if (r2 === null) {
|
807
807
|
let e2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
|
808
|
-
throw Error.captureStackTrace && Error.captureStackTrace(e2, f
|
808
|
+
throw Error.captureStackTrace && Error.captureStackTrace(e2, f), e2;
|
809
809
|
}
|
810
810
|
return r2;
|
811
811
|
}
|
@@ -823,22 +823,22 @@ function U$1() {
|
|
823
823
|
return React__default.createElement(a.Provider, { value: l2 }, t2.children);
|
824
824
|
}, [e2])];
|
825
825
|
}
|
826
|
-
let S
|
826
|
+
let S = "p";
|
827
827
|
function C(r2, e2) {
|
828
|
-
let d2 = useId(), t2 = a$2(), { id: i2 = `headlessui-description-${d2}`, ...l2 } = r2, n$1 = f
|
828
|
+
let d2 = useId(), t2 = a$2(), { id: i2 = `headlessui-description-${d2}`, ...l2 } = r2, n$1 = f(), s2 = y(e2);
|
829
829
|
n(() => n$1.register(i2), [i2, n$1.register]);
|
830
830
|
let o3 = t2 || false, p2 = useMemo(() => ({ ...n$1.slot, disabled: o3 }), [n$1.slot, o3]), D2 = { ref: s2, ...n$1.props, id: i2 };
|
831
|
-
return H
|
831
|
+
return H({ ourProps: D2, theirProps: l2, slot: p2, defaultTag: S, name: n$1.name || "Description" });
|
832
832
|
}
|
833
|
-
let _
|
833
|
+
let _ = W(C), w = Object.assign(_, {});
|
834
834
|
var o2 = ((r2) => (r2.Space = " ", r2.Enter = "Enter", r2.Escape = "Escape", r2.Backspace = "Backspace", r2.Delete = "Delete", r2.ArrowLeft = "ArrowLeft", r2.ArrowUp = "ArrowUp", r2.ArrowRight = "ArrowRight", r2.ArrowDown = "ArrowDown", r2.Home = "Home", r2.End = "End", r2.PageUp = "PageUp", r2.PageDown = "PageDown", r2.Tab = "Tab", r2))(o2 || {});
|
835
835
|
let c = createContext(null);
|
836
836
|
c.displayName = "LabelContext";
|
837
|
-
function P
|
837
|
+
function P() {
|
838
838
|
let r2 = useContext(c);
|
839
839
|
if (r2 === null) {
|
840
840
|
let l2 = new Error("You used a <Label /> component, but it is not inside a relevant parent.");
|
841
|
-
throw Error.captureStackTrace && Error.captureStackTrace(l2, P
|
841
|
+
throw Error.captureStackTrace && Error.captureStackTrace(l2, P), l2;
|
842
842
|
}
|
843
843
|
return r2;
|
844
844
|
}
|
@@ -859,8 +859,8 @@ function z({ inherit: r2 = false } = {}) {
|
|
859
859
|
}
|
860
860
|
let N = "label";
|
861
861
|
function G(r2, l2) {
|
862
|
-
var
|
863
|
-
let a2 = useId(), e2 = P
|
862
|
+
var y$1;
|
863
|
+
let a2 = useId(), e2 = P(), o3 = u$1(), g = a$2(), { id: t2 = `headlessui-label-${a2}`, htmlFor: s2 = o3 != null ? o3 : (y$1 = e2.props) == null ? void 0 : y$1.htmlFor, passive: m2 = false, ...i2 } = r2, p2 = y(l2);
|
864
864
|
n(() => e2.register(t2), [t2, e2.register]);
|
865
865
|
let u2 = o$2((L) => {
|
866
866
|
let b2 = L.currentTarget;
|
@@ -875,126 +875,39 @@ function G(r2, l2) {
|
|
875
875
|
}
|
876
876
|
}
|
877
877
|
}), d2 = g || false, C2 = useMemo(() => ({ ...e2.slot, disabled: d2 }), [e2.slot, d2]), f2 = { ref: p2, ...e2.props, id: t2, htmlFor: s2, onClick: u2 };
|
878
|
-
return m2 && ("onClick" in f2 && (delete f2.htmlFor, delete f2.onClick), "onClick" in i2 && delete i2.onClick), H
|
878
|
+
return m2 && ("onClick" in f2 && (delete f2.htmlFor, delete f2.onClick), "onClick" in i2 && delete i2.onClick), H({ ourProps: f2, theirProps: i2, slot: C2, defaultTag: s2 ? N : "div", name: e2.name || "Label" });
|
879
879
|
}
|
880
880
|
let U = W(G), K = Object.assign(U, {});
|
881
|
-
function l(e2, r2) {
|
882
|
-
return e2 !== null && r2 !== null && typeof e2 == "object" && typeof r2 == "object" && "id" in e2 && "id" in r2 ? e2.id === r2.id : e2 === r2;
|
883
|
-
}
|
884
|
-
function u(e2 = l) {
|
885
|
-
return useCallback((r2, t2) => {
|
886
|
-
if (typeof e2 == "string") {
|
887
|
-
let o3 = e2;
|
888
|
-
return (r2 == null ? void 0 : r2[o3]) === (t2 == null ? void 0 : t2[o3]);
|
889
|
-
}
|
890
|
-
return e2(r2, t2);
|
891
|
-
}, [e2]);
|
892
|
-
}
|
893
|
-
let f = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e2) => `${e2}:not([tabindex='-1'])`).join(","), p = ["[data-autofocus]"].map((e2) => `${e2}:not([tabindex='-1'])`).join(",");
|
894
|
-
var F = ((n2) => (n2[n2.First = 1] = "First", n2[n2.Previous = 2] = "Previous", n2[n2.Next = 4] = "Next", n2[n2.Last = 8] = "Last", n2[n2.WrapAround = 16] = "WrapAround", n2[n2.NoScroll = 32] = "NoScroll", n2[n2.AutoFocus = 64] = "AutoFocus", n2))(F || {}), T = ((o3) => (o3[o3.Error = 0] = "Error", o3[o3.Overflow = 1] = "Overflow", o3[o3.Success = 2] = "Success", o3[o3.Underflow = 3] = "Underflow", o3))(T || {}), y = ((t2) => (t2[t2.Previous = -1] = "Previous", t2[t2.Next = 1] = "Next", t2))(y || {});
|
895
|
-
function b(e2 = document.body) {
|
896
|
-
return e2 == null ? [] : Array.from(e2.querySelectorAll(f)).sort((r2, t2) => Math.sign((r2.tabIndex || Number.MAX_SAFE_INTEGER) - (t2.tabIndex || Number.MAX_SAFE_INTEGER)));
|
897
|
-
}
|
898
|
-
function S(e2 = document.body) {
|
899
|
-
return e2 == null ? [] : Array.from(e2.querySelectorAll(p)).sort((r2, t2) => Math.sign((r2.tabIndex || Number.MAX_SAFE_INTEGER) - (t2.tabIndex || Number.MAX_SAFE_INTEGER)));
|
900
|
-
}
|
901
|
-
var h = ((t2) => (t2[t2.Strict = 0] = "Strict", t2[t2.Loose = 1] = "Loose", t2))(h || {});
|
902
|
-
function A(e2, r2 = 0) {
|
903
|
-
var t2;
|
904
|
-
return e2 === ((t2 = u$4(e2)) == null ? void 0 : t2.body) ? false : u$3(r2, { [0]() {
|
905
|
-
return e2.matches(f);
|
906
|
-
}, [1]() {
|
907
|
-
let u2 = e2;
|
908
|
-
for (; u2 !== null; ) {
|
909
|
-
if (u2.matches(f)) return true;
|
910
|
-
u2 = u2.parentElement;
|
911
|
-
}
|
912
|
-
return false;
|
913
|
-
} });
|
914
|
-
}
|
915
|
-
var H = ((t2) => (t2[t2.Keyboard = 0] = "Keyboard", t2[t2.Mouse = 1] = "Mouse", t2))(H || {});
|
916
|
-
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("keydown", (e2) => {
|
917
|
-
e2.metaKey || e2.altKey || e2.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
|
918
|
-
}, true), document.addEventListener("click", (e2) => {
|
919
|
-
e2.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e2.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
|
920
|
-
}, true));
|
921
|
-
let w = ["textarea", "input"].join(",");
|
922
|
-
function O(e2) {
|
923
|
-
var r2, t2;
|
924
|
-
return (t2 = (r2 = e2 == null ? void 0 : e2.matches) == null ? void 0 : r2.call(e2, w)) != null ? t2 : false;
|
925
|
-
}
|
926
|
-
function _(e2, r2 = (t2) => t2) {
|
927
|
-
return e2.slice().sort((t2, u2) => {
|
928
|
-
let o3 = r2(t2), c2 = r2(u2);
|
929
|
-
if (o3 === null || c2 === null) return 0;
|
930
|
-
let l2 = o3.compareDocumentPosition(c2);
|
931
|
-
return l2 & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : l2 & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
932
|
-
});
|
933
|
-
}
|
934
|
-
function P(e2, r2, { sorted: t2 = true, relativeTo: u2 = null, skipElements: o3 = [] } = {}) {
|
935
|
-
let c2 = Array.isArray(e2) ? e2.length > 0 ? e2[0].ownerDocument : document : e2.ownerDocument, l2 = Array.isArray(e2) ? t2 ? _(e2) : e2 : r2 & 64 ? S(e2) : b(e2);
|
936
|
-
o3.length > 0 && l2.length > 1 && (l2 = l2.filter((s2) => !o3.some((a2) => a2 != null && "current" in a2 ? (a2 == null ? void 0 : a2.current) === s2 : a2 === s2))), u2 = u2 != null ? u2 : c2.activeElement;
|
937
|
-
let n2 = (() => {
|
938
|
-
if (r2 & 5) return 1;
|
939
|
-
if (r2 & 10) return -1;
|
940
|
-
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
941
|
-
})(), x = (() => {
|
942
|
-
if (r2 & 1) return 0;
|
943
|
-
if (r2 & 2) return Math.max(0, l2.indexOf(u2)) - 1;
|
944
|
-
if (r2 & 4) return Math.max(0, l2.indexOf(u2)) + 1;
|
945
|
-
if (r2 & 8) return l2.length - 1;
|
946
|
-
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
947
|
-
})(), M2 = r2 & 32 ? { preventScroll: true } : {}, m2 = 0, d2 = l2.length, i2;
|
948
|
-
do {
|
949
|
-
if (m2 >= d2 || m2 + d2 <= 0) return 0;
|
950
|
-
let s2 = x + m2;
|
951
|
-
if (r2 & 16) s2 = (s2 + d2) % d2;
|
952
|
-
else {
|
953
|
-
if (s2 < 0) return 3;
|
954
|
-
if (s2 >= d2) return 1;
|
955
|
-
}
|
956
|
-
i2 = l2[s2], i2 == null || i2.focus(M2), m2 += n2;
|
957
|
-
} while (i2 !== c2.activeElement);
|
958
|
-
return r2 & 6 && O(i2) && i2.select(), 2;
|
959
|
-
}
|
960
881
|
export {
|
961
882
|
$f7dceffc5ad7768b$export$4e328f61c538687f as $,
|
962
|
-
A,
|
963
883
|
D,
|
964
|
-
F,
|
965
884
|
G$1 as G,
|
966
|
-
H
|
885
|
+
H,
|
967
886
|
I,
|
968
887
|
K,
|
969
888
|
M,
|
970
|
-
|
971
|
-
T$3 as T,
|
889
|
+
T$2 as T,
|
972
890
|
U$1 as U,
|
973
891
|
W,
|
974
|
-
|
975
|
-
a$2 as
|
976
|
-
$6179b936705e76d3$export$ae780daf29e6d456 as
|
977
|
-
u$
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
o$3 as i,
|
892
|
+
u$2 as a,
|
893
|
+
a$2 as b,
|
894
|
+
$6179b936705e76d3$export$ae780daf29e6d456 as c,
|
895
|
+
u$1 as d,
|
896
|
+
o2 as e,
|
897
|
+
p as f,
|
898
|
+
o$3 as g,
|
899
|
+
s$2 as h,
|
900
|
+
T as i,
|
984
901
|
j,
|
985
|
-
|
986
|
-
l$2 as l,
|
987
|
-
f as m,
|
902
|
+
l$1 as l,
|
988
903
|
n,
|
989
904
|
o$2 as o,
|
990
905
|
p$1 as p,
|
991
|
-
s$2 as q,
|
992
906
|
r,
|
993
907
|
s$1 as s,
|
994
908
|
t$1 as t,
|
995
|
-
u,
|
996
|
-
|
997
|
-
|
998
|
-
y$1 as y,
|
909
|
+
u$3 as u,
|
910
|
+
w,
|
911
|
+
y,
|
999
912
|
z
|
1000
913
|
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { useRef, useState } from "react";
|
2
|
+
import { p, o, u } from "./label-BXAcSLy0.js";
|
3
|
+
function E(e) {
|
4
|
+
let t = e.width / 2, n = e.height / 2;
|
5
|
+
return { top: e.clientY - n, right: e.clientX + t, bottom: e.clientY + n, left: e.clientX - t };
|
6
|
+
}
|
7
|
+
function P(e, t) {
|
8
|
+
return !(!e || !t || e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom);
|
9
|
+
}
|
10
|
+
function w({ disabled: e = false } = {}) {
|
11
|
+
let t = useRef(null), [n, l] = useState(false), r = p(), o$1 = o(() => {
|
12
|
+
t.current = null, l(false), r.dispose();
|
13
|
+
}), f = o((s) => {
|
14
|
+
if (r.dispose(), t.current === null) {
|
15
|
+
t.current = s.currentTarget, l(true);
|
16
|
+
{
|
17
|
+
let i = u(s.currentTarget);
|
18
|
+
r.addEventListener(i, "pointerup", o$1, false), r.addEventListener(i, "pointermove", (c) => {
|
19
|
+
if (t.current) {
|
20
|
+
let p2 = E(c);
|
21
|
+
l(P(p2, t.current.getBoundingClientRect()));
|
22
|
+
}
|
23
|
+
}, false), r.addEventListener(i, "pointercancel", o$1, false);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
});
|
27
|
+
return { pressed: n, pressProps: e ? {} : { onPointerDown: f, onPointerUp: o$1, onClick: o$1 } };
|
28
|
+
}
|
29
|
+
export {
|
30
|
+
w
|
31
|
+
};
|