mimir-ui-kit 1.5.4 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ ._switch_1g34c_2{position:relative;display:inline-block;width:24px;height:24px;padding:var(--space-2xs);vertical-align:middle;background-color:var(--sapphire-20);border-radius:var(--control-radius-s);cursor:pointer}._switch_1g34c_2 svg{display:none}._switch_1g34c_2 svg path{fill:var(--white)}._enabled_1g34c_20{background-color:var(--sapphire-100)}._enabled_1g34c_20 svg{display:block}
@@ -1,6 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { W, K, w, a, u, z as z$1, U, y, l, T, o, j as j$1, H, s, n, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, b as $6179b936705e76d3$export$ae780daf29e6d456, D, c as u$1, I, G, d as u$2, e as u$3, f as o$1, P, F, g as T$1, p, r, _ } from "../../focus-management-4cCSLNHi.js";
2
+ import { W, K, w, b as a, z as z$1, U, y, l, T, o, j as j$1, H, s, n, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, c as $6179b936705e76d3$export$ae780daf29e6d456, D, d as u$1, I, G, a as u$2, u as u$3, e as o$1, f as p, r } from "../../label-BXAcSLy0.js";
3
3
  import React__default, { createContext, useId, useReducer, useRef, useMemo, useCallback, useContext } from "react";
4
+ import { u, P, F, T as T$1, _ } from "../../focus-management-CFDo6ZSc.js";
4
5
  import { c as classNames } from "../../index-CweZ_OcN.js";
5
6
  import '../../assets/RadioGroup.css';var Le = ((e) => (e[e.RegisterOption = 0] = "RegisterOption", e[e.UnregisterOption = 1] = "UnregisterOption", e))(Le || {});
6
7
  let ke = { [0](o2, t) {
@@ -1,41 +1,17 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import { c as classNames } from "../../index-CweZ_OcN.js";
3
3
  import * as React from "react";
4
- import React__default, { useRef, useState, useReducer, useMemo, useSyncExternalStore, useId as useId$1, useEffect, useCallback, useLayoutEffect, createContext, useContext, Fragment, createRef } from "react";
4
+ import React__default, { useReducer, useMemo, useSyncExternalStore, useId as useId$1, useEffect, useCallback, useRef, useState, useLayoutEffect, createContext, useContext, Fragment, createRef } from "react";
5
5
  import { ESelectSearchSize } from "./constants.js";
6
6
  import { useMediaQuery } from "../../hooks/useMediaQuery/useMediaQuery.js";
7
7
  import { EMediaQuery } from "../../hooks/useMediaQuery/constants.js";
8
8
  import { Icon } from "../../icons/Icon.js";
9
- import { h as p$1, o as o$1, e as u$4, n as n$3, i as o$2, s as s$3, A as A$1, k as h$1, m as f$6, t as t$3, q as s$4, W as W$1, y as y$3, v as T$1, H, M as M$2, K, a as a$5, l as l$4, T as T$2, u as u$5, d as u$6, z, j as j$1, c as u$7, I as I$1, G, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, b as $6179b936705e76d3$export$ae780daf29e6d456, D as D$3, f as o$3, r as r$2, _ } from "../../focus-management-4cCSLNHi.js";
9
+ import { n as n$3, u as u$4, g as o$1, s as s$3, o as o$2, p as p$1, t as t$3, h as s$4, W as W$1, y as y$3, i as T$1, H, M as M$2, K, b as a$5, l as l$4, T as T$2, a as u$6, z, j as j$1, d as u$7, I as I$1, G, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, c as $6179b936705e76d3$export$ae780daf29e6d456, D as D$3, e as o$3, r as r$2 } from "../../label-BXAcSLy0.js";
10
10
  import * as ReactDOM from "react-dom";
11
11
  import { flushSync, createPortal } from "react-dom";
12
- import '../../assets/SelectSearch.css';function E$1(e2) {
13
- let t2 = e2.width / 2, n2 = e2.height / 2;
14
- return { top: e2.clientY - n2, right: e2.clientX + t2, bottom: e2.clientY + n2, left: e2.clientX - t2 };
15
- }
16
- function P(e2, t2) {
17
- return !(!e2 || !t2 || e2.right < t2.left || e2.left > t2.right || e2.bottom < t2.top || e2.top > t2.bottom);
18
- }
19
- function w({ disabled: e2 = false } = {}) {
20
- let t2 = useRef(null), [n2, l2] = useState(false), r2 = p$1(), o2 = o$1(() => {
21
- t2.current = null, l2(false), r2.dispose();
22
- }), f2 = o$1((s2) => {
23
- if (r2.dispose(), t2.current === null) {
24
- t2.current = s2.currentTarget, l2(true);
25
- {
26
- let i2 = u$4(s2.currentTarget);
27
- r2.addEventListener(i2, "pointerup", o2, false), r2.addEventListener(i2, "pointermove", (c2) => {
28
- if (t2.current) {
29
- let p2 = E$1(c2);
30
- l2(P(p2, t2.current.getBoundingClientRect()));
31
- }
32
- }, false), r2.addEventListener(i2, "pointercancel", o2, false);
33
- }
34
- }
35
- });
36
- return { pressed: n2, pressProps: e2 ? {} : { onPointerDown: f2, onPointerUp: o2, onClick: o2 } };
37
- }
38
- function memo(getDeps, fn, opts) {
12
+ import { w } from "../../use-active-press-9MCrfRZk.js";
13
+ import { A as A$1, h as h$1, f as f$6, u as u$5, _ } from "../../focus-management-CFDo6ZSc.js";
14
+ import '../../assets/SelectSearch.css';function memo(getDeps, fn, opts) {
39
15
  let deps = opts.initialDeps ?? [];
40
16
  let result;
41
17
  return () => {
@@ -868,7 +844,7 @@ function y$2(t2, { allowed: r2, disallowed: e2 } = {}) {
868
844
  n$3(() => {
869
845
  var d2, c2;
870
846
  if (!i2) return;
871
- let a3 = o$2();
847
+ let a3 = o$1();
872
848
  for (let n2 of (d2 = e2 == null ? void 0 : e2()) != null ? d2 : []) n2 && a3.add(h(n2));
873
849
  let s2 = (c2 = r2 == null ? void 0 : r2()) != null ? c2 : [];
874
850
  for (let n2 of s2) {
@@ -893,7 +869,7 @@ function m$2(s2, n2, l2) {
893
869
  if (!s2) return;
894
870
  let t2 = n2 === null ? null : n2 instanceof HTMLElement ? n2 : n2.current;
895
871
  if (!t2) return;
896
- let e2 = o$2();
872
+ let e2 = o$1();
897
873
  if (typeof ResizeObserver != "undefined") {
898
874
  let r2 = new ResizeObserver(() => i2.current(t2));
899
875
  r2.observe(t2), e2.add(() => r2.disconnect());
@@ -985,7 +961,7 @@ function f$3(l2) {
985
961
  return E(l2.current, "blur", (e2) => {
986
962
  let t2 = e2.target;
987
963
  t2 instanceof HTMLInputElement && (n2.current = { value: t2.value, selectionStart: t2.selectionStart, selectionEnd: t2.selectionEnd });
988
- }), o$1(() => {
964
+ }), o$2(() => {
989
965
  let e2 = l2.current;
990
966
  if (document.activeElement !== e2 && e2 instanceof HTMLInputElement && e2.isConnected) {
991
967
  if (e2.focus({ preventScroll: true }), e2.value !== n2.current.value) e2.setSelectionRange(e2.value.length, e2.value.length);
@@ -1030,7 +1006,7 @@ function d() {
1030
1006
  n2.microTask(() => {
1031
1007
  var s2;
1032
1008
  if (window.getComputedStyle(r2.documentElement).scrollBehavior !== "auto") {
1033
- let t2 = o$2();
1009
+ let t2 = o$1();
1034
1010
  t2.style(r2.documentElement, "scrollBehavior", "auto"), n2.add(() => n2.microTask(() => t2.dispose()));
1035
1011
  }
1036
1012
  let a3 = (s2 = window.scrollY) != null ? s2 : window.pageYOffset, l2 = null;
@@ -1077,7 +1053,7 @@ function m$1(e2) {
1077
1053
  }
1078
1054
  let a$2 = a$3(() => /* @__PURE__ */ new Map(), { PUSH(e2, n2) {
1079
1055
  var o2;
1080
- let t2 = (o2 = this.get(e2)) != null ? o2 : { doc: e2, count: 0, d: o$2(), meta: /* @__PURE__ */ new Set() };
1056
+ let t2 = (o2 = this.get(e2)) != null ? o2 : { doc: e2, count: 0, d: o$1(), meta: /* @__PURE__ */ new Set() };
1081
1057
  return t2.count++, t2.meta.add(n2), this.set(e2, t2), this;
1082
1058
  }, POP(e2, n2) {
1083
1059
  let t2 = this.get(e2);
@@ -1157,13 +1133,13 @@ function V(e2, a3, t2, r2) {
1157
1133
  }, [e2, t2, a3, o2]), e2 ? [i2, { closed: d2(1), enter: d2(2), leave: d2(4), transition: d2(2) || d2(4) }] : [t2, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
1158
1134
  }
1159
1135
  function M$1(e2, { prepare: a3, run: t2, done: r2, inFlight: i2 }) {
1160
- let u2 = o$2();
1136
+ let u2 = o$1();
1161
1137
  return R(e2, { prepare: a3, inFlight: i2 }), u2.nextFrame(() => {
1162
1138
  u2.add(F$1(e2, r2)), t2();
1163
1139
  }), u2.dispose;
1164
1140
  }
1165
1141
  function F$1(e2, a3) {
1166
- let t2 = l$3(a3), r2 = o$2();
1142
+ let t2 = l$3(a3), r2 = o$1();
1167
1143
  if (!e2) return r2.dispose;
1168
1144
  let { transitionDuration: i2, transitionDelay: u2 } = getComputedStyle(e2), [d2, f2] = [i2, u2].map((l2) => {
1169
1145
  let [n2 = 0] = l2.split(",").filter(Boolean).map((o2) => o2.includes("ms") ? parseFloat(o2) : parseFloat(o2) * 1e3).sort((o2, p2) => p2 - o2);
@@ -1207,7 +1183,7 @@ function F(c2, { container: e2, accept: t2, walk: r2 }) {
1207
1183
  }, [e2, c2, o2, l2]);
1208
1184
  }
1209
1185
  function m(u2, t2) {
1210
- let e2 = useRef([]), r2 = o$1(u2);
1186
+ let e2 = useRef([]), r2 = o$2(u2);
1211
1187
  useEffect(() => {
1212
1188
  let o2 = [...e2.current];
1213
1189
  for (let [a3, l2] of t2.entries()) if (e2.current[a3] !== l2) {
@@ -3286,11 +3262,11 @@ let q = 4;
3286
3262
  function ve({ children: e2, enabled: t2 = true }) {
3287
3263
  let [n2, l2] = useState(null), [r2, o2] = useState(0), c2 = useRef(null), [u2, s2] = useState(null);
3288
3264
  pe(u2);
3289
- let i2 = t2 && n2 !== null && u2 !== null, { to: F2 = "bottom", gap: C = 0, offset: M2 = 0, padding: p2 = 0, inner: P2 } = ce(n2, u2), [a3, f2 = "center"] = F2.split(" ");
3265
+ let i2 = t2 && n2 !== null && u2 !== null, { to: F2 = "bottom", gap: C = 0, offset: M2 = 0, padding: p2 = 0, inner: P } = ce(n2, u2), [a3, f2 = "center"] = F2.split(" ");
3290
3266
  n$3(() => {
3291
3267
  i2 && o2(0);
3292
3268
  }, [i2]);
3293
- let { refs: b, floatingStyles: w2, context: g2 } = useFloating({ open: i2, placement: a3 === "selection" ? f2 === "center" ? "bottom" : `bottom-${f2}` : f2 === "center" ? `${a3}` : `${a3}-${f2}`, strategy: "absolute", transform: false, middleware: [offset({ mainAxis: a3 === "selection" ? 0 : C, crossAxis: M2 }), shift({ padding: p2 }), a3 !== "selection" && flip({ padding: p2 }), a3 === "selection" && P2 ? inner({ ...P2, padding: p2, overflowRef: c2, offset: r2, minItemsVisible: q, referenceOverflowThreshold: p2, onFallbackChange(h2) {
3269
+ let { refs: b, floatingStyles: w2, context: g2 } = useFloating({ open: i2, placement: a3 === "selection" ? f2 === "center" ? "bottom" : `bottom-${f2}` : f2 === "center" ? `${a3}` : `${a3}-${f2}`, strategy: "absolute", transform: false, middleware: [offset({ mainAxis: a3 === "selection" ? 0 : C, crossAxis: M2 }), shift({ padding: p2 }), a3 !== "selection" && flip({ padding: p2 }), a3 === "selection" && P ? inner({ ...P, padding: p2, overflowRef: c2, offset: r2, minItemsVisible: q, referenceOverflowThreshold: p2, onFallbackChange(h2) {
3294
3270
  var O, W2;
3295
3271
  if (!h2) return;
3296
3272
  let d2 = g2.elements.floating;
@@ -3312,7 +3288,7 @@ function ve({ children: e2, enabled: t2 = true }) {
3312
3288
  Object.assign(T2.floating.style, { overflow: "auto", maxWidth: `${h2}px`, maxHeight: `min(var(--anchor-max-height, 100vh), ${d2}px)` });
3313
3289
  } })].filter(Boolean), whileElementsMounted: autoUpdate }), [I2 = a3, V2 = f2] = g2.placement.split("-");
3314
3290
  a3 === "selection" && (I2 = "selection");
3315
- let G2 = useMemo(() => ({ anchor: [I2, V2].filter(Boolean).join(" ") }), [I2, V2]), K2 = useInnerOffset(g2, { overflowRef: c2, onChange: o2 }), { getReferenceProps: Q, getFloatingProps: X } = useInteractions([K2]), Y = o$1((h2) => {
3291
+ let G2 = useMemo(() => ({ anchor: [I2, V2].filter(Boolean).join(" ") }), [I2, V2]), K2 = useInnerOffset(g2, { overflowRef: c2, onChange: o2 }), { getReferenceProps: Q, getFloatingProps: X } = useInteractions([K2]), Y = o$2((h2) => {
3316
3292
  s2(h2), b.setFloating(h2);
3317
3293
  });
3318
3294
  return React.createElement(S$1.Provider, { value: l2 }, React.createElement(y$1.Provider, { value: { setFloating: Y, setReference: b.setReference, styles: w2, getReferenceProps: Q, getFloatingProps: X, slot: G2 } }, e2));
@@ -3337,7 +3313,7 @@ function ce(e2, t2) {
3337
3313
  return { ...e2, gap: n2, offset: l2, padding: r2 };
3338
3314
  }
3339
3315
  function L(e2, t2, n2 = void 0) {
3340
- let l2 = p$1(), r2 = o$1((s2, i2) => {
3316
+ let l2 = p$1(), r2 = o$2((s2, i2) => {
3341
3317
  if (s2 == null) return [n2, null];
3342
3318
  if (typeof s2 == "number") return [s2, null];
3343
3319
  if (typeof s2 == "string") {
@@ -3346,9 +3322,9 @@ function L(e2, t2, n2 = void 0) {
3346
3322
  return [F2, (C) => {
3347
3323
  let M2 = D$1(s2);
3348
3324
  {
3349
- let p2 = M2.map((P2) => window.getComputedStyle(i2).getPropertyValue(P2));
3350
- l2.requestAnimationFrame(function P2() {
3351
- l2.nextFrame(P2);
3325
+ let p2 = M2.map((P) => window.getComputedStyle(i2).getPropertyValue(P));
3326
+ l2.requestAnimationFrame(function P() {
3327
+ l2.nextFrame(P);
3352
3328
  let a3 = false;
3353
3329
  for (let [b, w2] of M2.entries()) {
3354
3330
  let g2 = window.getComputedStyle(i2).getPropertyValue(w2);
@@ -3458,7 +3434,7 @@ function f(l2, n2) {
3458
3434
  }
3459
3435
  var g = ((f2) => (f2[f2.Left = 0] = "Left", f2[f2.Right = 2] = "Right", f2))(g || {});
3460
3436
  function c(t2) {
3461
- let r2 = o$1(t2), e2 = useRef(false);
3437
+ let r2 = o$2(t2), e2 = useRef(false);
3462
3438
  useEffect(() => (e2.current = false, () => {
3463
3439
  e2.current = true, t$3(() => {
3464
3440
  e2.current && r2();
@@ -3639,7 +3615,7 @@ function Eo(o2, r2) {
3639
3615
  let _o = Fragment;
3640
3616
  function ho(o2, r2) {
3641
3617
  var ge, ve$1;
3642
- let e2 = a$5(), { value: t2, defaultValue: c2, onChange: d2, form: f2, name: s2, by: u2, disabled: a3 = e2 || false, onClose: n2, __demoMode: T2 = false, multiple: C = false, immediate: _2 = false, virtual: p2 = null, nullable: L2, ...M2 } = o2, F2 = l$4(c2), [v2 = C ? [] : void 0, y2] = T$2(t2, d2, F2), [A2, R2] = useReducer(Eo, { dataRef: createRef(), comboboxState: T2 ? 0 : 1, isTyping: false, options: [], virtual: p2 ? { options: p2.options, disabled: (ge = p2.disabled) != null ? ge : () => false } : null, activeOptionIndex: null, activationTrigger: 2, __demoMode: T2 }), h2 = useRef(false), O = useRef({ static: false, hold: false }), G2 = useRef(null), J2 = useRef(null), Q = useRef(null), I2 = u$5(u2), B = o$1((b) => p2 ? u2 === null ? p2.options.indexOf(b) : p2.options.findIndex((g2) => I2(g2, b)) : A2.options.findIndex((g2) => I2(g2.dataRef.current.value, b))), k = useCallback((b) => u$6(i$12.mode, { [1]: () => v2.some((g2) => I2(g2, b)), [0]: () => I2(v2, b) }), [v2]), K2 = o$1((b) => A2.activeOptionIndex === B(b)), i$12 = useMemo(() => ({ ...A2, immediate: _2, optionsPropsRef: O, inputRef: G2, buttonRef: J2, optionsRef: Q, value: v2, defaultValue: F2, disabled: a3, mode: C ? 1 : 0, virtual: p2 ? A2.virtual : null, get activeOptionIndex() {
3618
+ let e2 = a$5(), { value: t2, defaultValue: c2, onChange: d2, form: f2, name: s2, by: u2, disabled: a3 = e2 || false, onClose: n2, __demoMode: T2 = false, multiple: C = false, immediate: _2 = false, virtual: p2 = null, nullable: L2, ...M2 } = o2, F2 = l$4(c2), [v2 = C ? [] : void 0, y2] = T$2(t2, d2, F2), [A2, R2] = useReducer(Eo, { dataRef: createRef(), comboboxState: T2 ? 0 : 1, isTyping: false, options: [], virtual: p2 ? { options: p2.options, disabled: (ge = p2.disabled) != null ? ge : () => false } : null, activeOptionIndex: null, activationTrigger: 2, __demoMode: T2 }), h2 = useRef(false), O = useRef({ static: false, hold: false }), G2 = useRef(null), J2 = useRef(null), Q = useRef(null), I2 = u$5(u2), B = o$2((b) => p2 ? u2 === null ? p2.options.indexOf(b) : p2.options.findIndex((g2) => I2(g2, b)) : A2.options.findIndex((g2) => I2(g2.dataRef.current.value, b))), k = useCallback((b) => u$6(i$12.mode, { [1]: () => v2.some((g2) => I2(g2, b)), [0]: () => I2(v2, b) }), [v2]), K2 = o$2((b) => A2.activeOptionIndex === B(b)), i$12 = useMemo(() => ({ ...A2, immediate: _2, optionsPropsRef: O, inputRef: G2, buttonRef: J2, optionsRef: Q, value: v2, defaultValue: F2, disabled: a3, mode: C ? 1 : 0, virtual: p2 ? A2.virtual : null, get activeOptionIndex() {
3643
3619
  if (h2.current && A2.activeOptionIndex === null && (p2 ? p2.options.length > 0 : A2.options.length > 0)) {
3644
3620
  if (p2) {
3645
3621
  let g2 = p2.options.findIndex((j2) => {
@@ -3664,7 +3640,7 @@ function ho(o2, r2) {
3664
3640
  let q2 = useMemo(() => {
3665
3641
  var b, g2, j2;
3666
3642
  return { open: i$12.comboboxState === 0, disabled: a3, activeIndex: i$12.activeOptionIndex, activeOption: i$12.activeOptionIndex === null ? null : i$12.virtual ? i$12.virtual.options[(b = i$12.activeOptionIndex) != null ? b : 0] : (j2 = (g2 = i$12.options[i$12.activeOptionIndex]) == null ? void 0 : g2.dataRef.current.value) != null ? j2 : null, value: v2 };
3667
- }, [i$12, a3, v2]), Y = o$1(() => {
3643
+ }, [i$12, a3, v2]), Y = o$2(() => {
3668
3644
  if (i$12.activeOptionIndex !== null) {
3669
3645
  if (x2.setIsTyping(false), i$12.virtual) S2(i$12.virtual.options[i$12.activeOptionIndex]);
3670
3646
  else {
@@ -3673,20 +3649,20 @@ function ho(o2, r2) {
3673
3649
  }
3674
3650
  x2.goToOption(c$1.Specific, i$12.activeOptionIndex);
3675
3651
  }
3676
- }), E2 = o$1(() => {
3652
+ }), E2 = o$2(() => {
3677
3653
  R2({ type: 0 }), h2.current = true;
3678
- }), ae = o$1(() => {
3654
+ }), ae = o$2(() => {
3679
3655
  R2({ type: 1 }), h2.current = false, n2 == null || n2();
3680
- }), le = o$1((b) => {
3656
+ }), le = o$2((b) => {
3681
3657
  R2({ type: 3, isTyping: b });
3682
- }), l2 = o$1((b, g2, j2) => (h2.current = false, b === c$1.Specific ? R2({ type: 2, focus: c$1.Specific, idx: g2, trigger: j2 }) : R2({ type: 2, focus: b, trigger: j2 }))), U = o$1((b, g2) => (R2({ type: 4, payload: { id: b, dataRef: g2 } }), () => {
3658
+ }), l2 = o$2((b, g2, j2) => (h2.current = false, b === c$1.Specific ? R2({ type: 2, focus: c$1.Specific, idx: g2, trigger: j2 }) : R2({ type: 2, focus: b, trigger: j2 }))), U = o$2((b, g2) => (R2({ type: 4, payload: { id: b, dataRef: g2 } }), () => {
3683
3659
  i$12.isActive(g2.current.value) && (h2.current = true), R2({ type: 5, id: b });
3684
- })), S2 = o$1((b) => u$6(i$12.mode, { [0]() {
3660
+ })), S2 = o$2((b) => u$6(i$12.mode, { [0]() {
3685
3661
  return y2 == null ? void 0 : y2(b);
3686
3662
  }, [1]() {
3687
3663
  let g2 = i$12.value.slice(), j2 = g2.findIndex((ue) => I2(ue, b));
3688
3664
  return j2 === -1 ? g2.push(b) : g2.splice(j2, 1), y2 == null ? void 0 : y2(g2);
3689
- } })), H$1 = o$1((b) => {
3665
+ } })), H$1 = o$2((b) => {
3690
3666
  R2({ type: 6, trigger: b });
3691
3667
  }), x2 = useMemo(() => ({ onChange: S2, registerOption: U, goToOption: l2, setIsTyping: le, closeCombobox: ae, openCombobox: E2, setActivationTrigger: H$1, selectActiveOption: Y }), []), [w2, W2] = z(), we = r2 === null ? {} : { ref: r2 }, Be = useCallback(() => {
3692
3668
  if (F2 !== void 0) return y2 == null ? void 0 : y2(F2);
@@ -3696,7 +3672,7 @@ function ho(o2, r2) {
3696
3672
  let Do = "input";
3697
3673
  function Mo(o2, r$12) {
3698
3674
  var q2, Y, E2, ae, le;
3699
- let e2 = oe("Combobox.Input"), t2 = re("Combobox.Input"), c2 = useId$1(), d2 = u$7(), { id: f2 = d2 || `headlessui-combobox-input-${c2}`, onChange: s2, displayValue: u2, disabled: a3 = e2.disabled || false, autoFocus: n2 = false, type: T2 = "text", ...C } = o2, _2 = y$3(e2.inputRef, r$12, ye()), p2 = n$1(e2.inputRef), L2 = p$1(), M2 = o$1(() => {
3675
+ let e2 = oe("Combobox.Input"), t2 = re("Combobox.Input"), c2 = useId$1(), d2 = u$7(), { id: f2 = d2 || `headlessui-combobox-input-${c2}`, onChange: s2, displayValue: u2, disabled: a3 = e2.disabled || false, autoFocus: n2 = false, type: T2 = "text", ...C } = o2, _2 = y$3(e2.inputRef, r$12, ye()), p2 = n$1(e2.inputRef), L2 = p$1(), M2 = o$2(() => {
3700
3676
  t2.onChange(null), e2.optionsRef.current && (e2.optionsRef.current.scrollTop = 0), t2.goToOption(c$1.Nothing);
3701
3677
  }), F2 = useMemo(() => {
3702
3678
  var l2;
@@ -3719,13 +3695,13 @@ function Mo(o2, r$12) {
3719
3695
  S2.value = "", S2.value = H2, W2 !== null ? S2.setSelectionRange(x2, w2, W2) : S2.setSelectionRange(x2, w2);
3720
3696
  }
3721
3697
  }, [e2.comboboxState]);
3722
- let v2 = useRef(false), y2 = o$1(() => {
3698
+ let v2 = useRef(false), y2 = o$2(() => {
3723
3699
  v2.current = true;
3724
- }), A2 = o$1(() => {
3700
+ }), A2 = o$2(() => {
3725
3701
  L2.nextFrame(() => {
3726
3702
  v2.current = false;
3727
3703
  });
3728
- }), R2 = o$1((l2) => {
3704
+ }), R2 = o$2((l2) => {
3729
3705
  switch (t2.setIsTyping(true), l2.key) {
3730
3706
  case o$3.Enter:
3731
3707
  if (e2.comboboxState !== 0 || v2.current) return;
@@ -3758,13 +3734,13 @@ function Mo(o2, r$12) {
3758
3734
  e2.mode === 0 && e2.activationTrigger !== 1 && t2.selectActiveOption(), t2.closeCombobox();
3759
3735
  break;
3760
3736
  }
3761
- }), h2 = o$1((l2) => {
3737
+ }), h2 = o$2((l2) => {
3762
3738
  s2 == null || s2(l2), e2.mode === 0 && l2.target.value === "" && M2(), t2.openCombobox();
3763
- }), O = o$1((l2) => {
3739
+ }), O = o$2((l2) => {
3764
3740
  var S2, H2, x2;
3765
3741
  let U = (S2 = l2.relatedTarget) != null ? S2 : r.find((w2) => w2 !== l2.currentTarget);
3766
3742
  if (!((H2 = e2.optionsRef.current) != null && H2.contains(U)) && !((x2 = e2.buttonRef.current) != null && x2.contains(U)) && e2.comboboxState === 0) return l2.preventDefault(), e2.mode === 0 && e2.value === null && M2(), t2.closeCombobox();
3767
- }), G$1 = o$1((l2) => {
3743
+ }), G$1 = o$2((l2) => {
3768
3744
  var S2, H2, x2;
3769
3745
  let U = (S2 = l2.relatedTarget) != null ? S2 : r.find((w2) => w2 !== l2.currentTarget);
3770
3746
  (H2 = e2.buttonRef.current) != null && H2.contains(U) || (x2 = e2.optionsRef.current) != null && x2.contains(U) || e2.disabled || e2.immediate && e2.comboboxState !== 0 && L2.microTask(() => {
@@ -3776,7 +3752,7 @@ function Mo(o2, r$12) {
3776
3752
  let Fo = "button";
3777
3753
  function Vo(o2, r2) {
3778
3754
  var h2;
3779
- let e2 = oe("Combobox.Button"), t2 = re("Combobox.Button"), c2 = y$3(e2.buttonRef, r2), d2 = useId$1(), { id: f2 = `headlessui-combobox-button-${d2}`, disabled: s2 = e2.disabled || false, autoFocus: u2 = false, ...a3 } = o2, n2 = f$3(e2.inputRef), T$12 = o$1((O) => {
3755
+ let e2 = oe("Combobox.Button"), t2 = re("Combobox.Button"), c2 = y$3(e2.buttonRef, r2), d2 = useId$1(), { id: f2 = `headlessui-combobox-button-${d2}`, disabled: s2 = e2.disabled || false, autoFocus: u2 = false, ...a3 } = o2, n2 = f$3(e2.inputRef), T$12 = o$2((O) => {
3780
3756
  switch (O.key) {
3781
3757
  case o$3.Space:
3782
3758
  case o$3.Enter:
@@ -3795,7 +3771,7 @@ function Vo(o2, r2) {
3795
3771
  default:
3796
3772
  return;
3797
3773
  }
3798
- }), C = o$1((O) => {
3774
+ }), C = o$2((O) => {
3799
3775
  O.preventDefault(), !r$2(O.currentTarget) && (O.button === g.Left && (e2.comboboxState === 0 ? t2.closeCombobox() : t2.openCombobox()), n2());
3800
3776
  }), _2 = I$1([f2]), { isFocusVisible: p2, focusProps: L2 } = $f7dceffc5ad7768b$export$4e328f61c538687f({ autoFocus: u2 }), { isHovered: M2, hoverProps: F2 } = $6179b936705e76d3$export$ae780daf29e6d456({ isDisabled: s2 }), { pressed: v2, pressProps: y2 } = w({ disabled: s2 }), A2 = useMemo(() => ({ open: e2.comboboxState === 0, active: v2 || e2.comboboxState === 0, disabled: s2, value: e2.value, hover: M2, focus: p2 }), [e2, M2, p2, v2, s2]), R2 = D$3({ ref: c2, id: f2, type: T(o2, e2.buttonRef), tabIndex: -1, "aria-haspopup": "listbox", "aria-controls": (h2 = e2.optionsRef.current) == null ? void 0 : h2.id, "aria-expanded": e2.comboboxState === 0, "aria-labelledby": _2, disabled: s2 || void 0, autoFocus: u2, onMouseDown: C, onKeyDown: T$12 }, L2, F2, y2);
3801
3777
  return H({ ourProps: R2, theirProps: a3, slot: A2, defaultTag: Fo, name: "Combobox.Button" });
@@ -3810,7 +3786,7 @@ function Bo(o2, r2) {
3810
3786
  let R2 = n2.__demoMode ? false : s2 && n2.comboboxState === 0;
3811
3787
  f$2(R2, F$12);
3812
3788
  let h2 = n2.__demoMode ? false : s2 && n2.comboboxState === 0;
3813
- y$2(h2, { allowed: o$1(() => [n2.inputRef.current, n2.buttonRef.current, n2.optionsRef.current]) }), n$3(() => {
3789
+ y$2(h2, { allowed: o$2(() => [n2.inputRef.current, n2.buttonRef.current, n2.optionsRef.current]) }), n$3(() => {
3814
3790
  var E2;
3815
3791
  n2.optionsPropsRef.current.static = (E2 = o2.static) != null ? E2 : false;
3816
3792
  }, [n2.optionsPropsRef, o2.static]), n$3(() => {
@@ -3820,11 +3796,11 @@ function Bo(o2, r2) {
3820
3796
  }, walk(E2) {
3821
3797
  E2.setAttribute("role", "none");
3822
3798
  } });
3823
- let O = I$1([(N2 = n2.buttonRef.current) == null ? void 0 : N2.id]), G2 = useMemo(() => ({ open: n2.comboboxState === 0, option: void 0 }), [n2.comboboxState]), J2 = o$1(() => {
3799
+ let O = I$1([(N2 = n2.buttonRef.current) == null ? void 0 : N2.id]), G2 = useMemo(() => ({ open: n2.comboboxState === 0, option: void 0 }), [n2.comboboxState]), J2 = o$2(() => {
3824
3800
  T2.setActivationTrigger(0);
3825
- }), Q = o$1((E2) => {
3801
+ }), Q = o$2((E2) => {
3826
3802
  E2.preventDefault(), T2.setActivationTrigger(0);
3827
- }), I2 = D$3(C ? L2() : {}, { "aria-labelledby": O, role: "listbox", "aria-multiselectable": n2.mode === 1 ? true : void 0, id: t2, ref: M2, style: { ...a3.style, ...p2, "--input-width": f$5(n2.inputRef, true).width, "--button-width": f$5(n2.buttonRef, true).width }, onWheel: n2.activationTrigger === 0 ? void 0 : J2, onMouseDown: Q, ...A(A$12) }), B = y2 && n2.comboboxState === 1, k = l$2(B, (q2 = n2.virtual) == null ? void 0 : q2.options), K2 = l$2(B, n2.value), i$12 = o$1((E2) => n2.compare(K2, E2));
3803
+ }), I2 = D$3(C ? L2() : {}, { "aria-labelledby": O, role: "listbox", "aria-multiselectable": n2.mode === 1 ? true : void 0, id: t2, ref: M2, style: { ...a3.style, ...p2, "--input-width": f$5(n2.inputRef, true).width, "--button-width": f$5(n2.buttonRef, true).width }, onWheel: n2.activationTrigger === 0 ? void 0 : J2, onMouseDown: Q, ...A(A$12) }), B = y2 && n2.comboboxState === 1, k = l$2(B, (q2 = n2.virtual) == null ? void 0 : q2.options), K2 = l$2(B, n2.value), i$12 = o$2((E2) => n2.compare(K2, E2));
3828
3804
  if (n2.virtual) {
3829
3805
  if (k === void 0) throw new Error("Missing `options` in virtual mode");
3830
3806
  Object.assign(a3, { children: React__default.createElement(ie.Provider, { value: k !== n2.virtual.options ? { ...n2, virtual: { ...n2.virtual, options: k } } : n2 }, React__default.createElement(Io, { slot: G2 }, a3.children)) });
@@ -3834,32 +3810,32 @@ function Bo(o2, r2) {
3834
3810
  let ko = "div";
3835
3811
  function No(o2, r2) {
3836
3812
  var I2, B, k, K2;
3837
- let e2 = oe("Combobox.Option"), t2 = re("Combobox.Option"), c2 = useId$1(), { id: d2 = `headlessui-combobox-option-${c2}`, value: f2, disabled: s2 = (k = (B = (I2 = e2.virtual) == null ? void 0 : I2.disabled) == null ? void 0 : B.call(I2, f2)) != null ? k : false, order: u2 = null, ...a3 } = o2, n2 = f$3(e2.inputRef), T2 = e2.virtual ? e2.activeOptionIndex === e2.calculateIndex(f2) : e2.activeOptionIndex === null ? false : ((K2 = e2.options[e2.activeOptionIndex]) == null ? void 0 : K2.id) === d2, C = e2.isSelected(f2), _2 = useRef(null), p2 = s$3({ disabled: s2, value: f2, domRef: _2, order: u2 }), L2 = useContext(Le), M2 = y$3(r2, _2, L2 ? L2.measureElement : null), F2 = o$1(() => {
3813
+ let e2 = oe("Combobox.Option"), t2 = re("Combobox.Option"), c2 = useId$1(), { id: d2 = `headlessui-combobox-option-${c2}`, value: f2, disabled: s2 = (k = (B = (I2 = e2.virtual) == null ? void 0 : I2.disabled) == null ? void 0 : B.call(I2, f2)) != null ? k : false, order: u2 = null, ...a3 } = o2, n2 = f$3(e2.inputRef), T2 = e2.virtual ? e2.activeOptionIndex === e2.calculateIndex(f2) : e2.activeOptionIndex === null ? false : ((K2 = e2.options[e2.activeOptionIndex]) == null ? void 0 : K2.id) === d2, C = e2.isSelected(f2), _2 = useRef(null), p2 = s$3({ disabled: s2, value: f2, domRef: _2, order: u2 }), L2 = useContext(Le), M2 = y$3(r2, _2, L2 ? L2.measureElement : null), F2 = o$2(() => {
3838
3814
  t2.setIsTyping(false), t2.onChange(f2);
3839
3815
  });
3840
3816
  n$3(() => t2.registerOption(d2, p2), [p2, d2]);
3841
3817
  let v2 = useRef(!(e2.virtual || e2.__demoMode));
3842
3818
  n$3(() => {
3843
- if (!e2.virtual && !e2.__demoMode) return o$2().requestAnimationFrame(() => {
3819
+ if (!e2.virtual && !e2.__demoMode) return o$1().requestAnimationFrame(() => {
3844
3820
  v2.current = true;
3845
3821
  });
3846
3822
  }, [e2.virtual, e2.__demoMode]), n$3(() => {
3847
- if (v2.current && e2.comboboxState === 0 && T2 && e2.activationTrigger !== 0) return o$2().requestAnimationFrame(() => {
3823
+ if (v2.current && e2.comboboxState === 0 && T2 && e2.activationTrigger !== 0) return o$1().requestAnimationFrame(() => {
3848
3824
  var i2, N2;
3849
3825
  (N2 = (i2 = _2.current) == null ? void 0 : i2.scrollIntoView) == null || N2.call(i2, { block: "nearest" });
3850
3826
  });
3851
3827
  }, [_2, T2, e2.comboboxState, e2.activationTrigger, e2.activeOptionIndex]);
3852
- let y2 = o$1((i2) => {
3828
+ let y2 = o$2((i2) => {
3853
3829
  i2.preventDefault(), i2.button === g.Left && (s2 || (F2(), n$2() || requestAnimationFrame(() => n2()), e2.mode === 0 && t2.closeCombobox()));
3854
- }), A2 = o$1(() => {
3830
+ }), A2 = o$2(() => {
3855
3831
  if (s2) return t2.goToOption(c$1.Nothing);
3856
3832
  let i2 = e2.calculateIndex(f2);
3857
3833
  t2.goToOption(c$1.Specific, i2);
3858
- }), R2 = u$2(), h2 = o$1((i2) => R2.update(i2)), O = o$1((i2) => {
3834
+ }), R2 = u$2(), h2 = o$2((i2) => R2.update(i2)), O = o$2((i2) => {
3859
3835
  if (!R2.wasMoved(i2) || s2 || T2) return;
3860
3836
  let N2 = e2.calculateIndex(f2);
3861
3837
  t2.goToOption(c$1.Specific, N2, 0);
3862
- }), G2 = o$1((i2) => {
3838
+ }), G2 = o$2((i2) => {
3863
3839
  R2.wasMoved(i2) && (s2 || T2 && (e2.optionsPropsRef.current.hold || t2.goToOption(c$1.Nothing)));
3864
3840
  }), J2 = useMemo(() => ({ active: T2, focus: T2, selected: C, disabled: s2 }), [T2, C, s2]);
3865
3841
  return H({ ourProps: { id: d2, ref: M2, role: "option", tabIndex: s2 === true ? void 0 : -1, "aria-disabled": s2 === true ? true : void 0, "aria-selected": C, disabled: void 0, onMouseDown: y2, onFocus: A2, onPointerEnter: h2, onMouseEnter: h2, onPointerMove: O, onMouseMove: O, onPointerLeave: G2, onMouseLeave: G2 }, theirProps: a3, slot: J2, defaultTag: ko, name: "Combobox.Option" });
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { TSwitchProps } from './types';
3
+
4
+ export declare const Switch: FC<TSwitchProps>;
@@ -0,0 +1,54 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c as classNames } from "../../index-CweZ_OcN.js";
3
+ import React__default, { useId, useState, useMemo, useCallback } from "react";
4
+ import { Icon } from "../../icons/Icon.js";
5
+ import { W, d as u, b as a, l, T, I, G, p, o, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, c as $6179b936705e76d3$export$ae780daf29e6d456, D, j, H, r, e as o$1, f as p$1 } from "../../label-BXAcSLy0.js";
6
+ import { w } from "../../use-active-press-9MCrfRZk.js";
7
+ import '../../assets/Switch.css';let se = "span";
8
+ function ie(T$1, h) {
9
+ let C = useId(), k = u(), x = a(), { id: g = k || `headlessui-checkbox-${C}`, disabled: e = x || false, autoFocus: s = false, checked: E, defaultChecked: v, onChange: P, name: d, value: D$1, form: R, indeterminate: n = false, ...A } = T$1, r$1 = l(v), [a$1, t] = T(E, P, r$1 != null ? r$1 : false), F = I(), K = G(), _ = p(), [p$2, c] = useState(false), u$1 = o(() => {
10
+ c(true), t == null || t(!a$1), _.nextFrame(() => {
11
+ c(false);
12
+ });
13
+ }), H$1 = o((o2) => {
14
+ if (r(o2.currentTarget)) return o2.preventDefault();
15
+ o2.preventDefault(), u$1();
16
+ }), B = o((o2) => {
17
+ o2.key === o$1.Space ? (o2.preventDefault(), u$1()) : o2.key === o$1.Enter && p$1(o2.currentTarget);
18
+ }), L = o((o2) => o2.preventDefault()), { isFocusVisible: m, focusProps: I$1 } = $f7dceffc5ad7768b$export$4e328f61c538687f({ autoFocus: s }), { isHovered: f, hoverProps: M } = $6179b936705e76d3$export$ae780daf29e6d456({ isDisabled: e }), { pressed: b, pressProps: U } = w({ disabled: e }), O = D({ ref: h, id: g, role: "checkbox", "aria-checked": n ? "mixed" : a$1 ? "true" : "false", "aria-labelledby": F, "aria-describedby": K, "aria-disabled": e ? true : void 0, indeterminate: n ? "true" : void 0, tabIndex: e ? void 0 : 0, onKeyUp: e ? void 0 : B, onKeyPress: e ? void 0 : L, onClick: e ? void 0 : H$1 }, I$1, M, U), X = useMemo(() => ({ checked: a$1, disabled: e, hover: f, focus: m, active: b, indeterminate: n, changing: p$2, autofocus: s }), [a$1, n, e, f, m, b, p$2, s]), G$1 = useCallback(() => {
19
+ if (r$1 !== void 0) return t == null ? void 0 : t(r$1);
20
+ }, [t, r$1]);
21
+ return React__default.createElement(React__default.Fragment, null, d != null && React__default.createElement(j, { disabled: e, data: { [d]: D$1 || "on" }, overrides: { type: "checkbox", checked: a$1 }, form: R, onReset: G$1 }), H({ ourProps: O, theirProps: A, slot: X, defaultTag: se, name: "Checkbox" }));
22
+ }
23
+ let Re = W(ie);
24
+ const enabled = "_enabled_1g34c_20";
25
+ const cls = {
26
+ "switch": "_switch_1g34c_2",
27
+ enabled
28
+ };
29
+ const Switch = ({
30
+ checked,
31
+ onChange
32
+ }) => {
33
+ const [enabled2, setEnabled] = useState(checked);
34
+ const handleChange = (value) => {
35
+ setEnabled(value);
36
+ if (onChange) {
37
+ onChange(value);
38
+ }
39
+ };
40
+ return /* @__PURE__ */ jsx(
41
+ Re,
42
+ {
43
+ checked: enabled2,
44
+ onChange: handleChange,
45
+ className: classNames(cls.switch, {
46
+ [cls.enabled]: enabled2
47
+ }),
48
+ children: /* @__PURE__ */ jsx(Icon, { iconName: "Done16px" })
49
+ }
50
+ );
51
+ };
52
+ export {
53
+ Switch
54
+ };
@@ -0,0 +1,2 @@
1
+ export { Switch } from './Switch';
2
+ export type { TSwitchProps } from './types';
@@ -0,0 +1,4 @@
1
+ import { Switch } from "./Switch.js";
2
+ export {
3
+ Switch
4
+ };
@@ -0,0 +1,4 @@
1
+ export type TSwitchProps = {
2
+ checked: boolean;
3
+ onChange?: (checked: boolean) => void;
4
+ };
@@ -0,0 +1 @@
1
+
@@ -19,3 +19,5 @@ export { Steps, EStepsPrimaryColor, EStepsSecondaryColor, EStepsSize, type TComm
19
19
  export { Vote, EVoteSize, type TCommonVoteProps } from './Vote';
20
20
  export { SelectSearch, ESelectSearchSize } from './SelectSearch';
21
21
  export type { TSelectSearchItem, TSelectSearchProps, TSelectSearchSize } from './SelectSearch';
22
+ export { Switch } from './Switch';
23
+ export type { TSwitchProps } from './Switch';
@@ -20,6 +20,7 @@ import { Vote } from "./Vote/Vote.js";
20
20
  import { EVoteSize } from "./Vote/constants.js";
21
21
  import { SelectSearch } from "./SelectSearch/SelectSearch.js";
22
22
  import { ESelectSearchSize } from "./SelectSearch/constants.js";
23
+ import { Switch } from "./Switch/Switch.js";
23
24
  export {
24
25
  Button,
25
26
  Drawer,
@@ -47,6 +48,7 @@ export {
47
48
  SelectSearch,
48
49
  Slider,
49
50
  Steps,
51
+ Switch,
50
52
  Vote,
51
53
  getMaskedInputPhoneValue,
52
54
  getUnmaskedInputValue
@@ -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.js CHANGED
@@ -20,6 +20,7 @@ import { Vote } from "./components/Vote/Vote.js";
20
20
  import { EVoteSize } from "./components/Vote/constants.js";
21
21
  import { SelectSearch } from "./components/SelectSearch/SelectSearch.js";
22
22
  import { ESelectSearchSize } from "./components/SelectSearch/constants.js";
23
+ import { Switch } from "./components/Switch/Switch.js";
23
24
  import { useMediaQuery } from "./hooks/useMediaQuery/useMediaQuery.js";
24
25
  import { EMediaQuery } from "./hooks/useMediaQuery/constants.js";
25
26
  import { useLockBodyScroll } from "./hooks/useLockBodyScroll/useLockBodyScroll.js";
@@ -53,6 +54,7 @@ import './assets/index.css';export {
53
54
  SelectSearch,
54
55
  Slider,
55
56
  Steps,
57
+ Switch,
56
58
  Vote,
57
59
  getMaskedInputPhoneValue,
58
60
  getUnmaskedInputValue,
@@ -535,7 +535,7 @@ let o$4 = class o {
535
535
  }
536
536
  };
537
537
  let s$2 = new o$4();
538
- function u$4(r2) {
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$2() {
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$3(r2, n2, ...a2) {
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$3), t2;
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$1 = ((e2) => (e2[e2.Unmount = 0] = "Unmount", e2[e2.Hidden = 1] = "Hidden", e2))(O$1 || {});
615
- function H$1({ ourProps: r2, theirProps: n2, slot: e2, defaultTag: a2, features: s2, visible: t2 = true, name: l2, mergeRefs: i2 }) {
616
- i2 = i2 != null ? i2 : A$1;
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$1(o3, e2, a2, l2, i2);
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$1(u2, e2, a2, l2, i2);
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$3(f2 ? 0 : 1, { [0]() {
626
+ return u$2(f2 ? 0 : 1, { [0]() {
627
627
  return null;
628
628
  }, [1]() {
629
- return b$1({ ...u2, hidden: true, style: { display: "none" } }, e2, a2, l2, i2);
629
+ return b({ ...u2, hidden: true, style: { display: "none" } }, e2, a2, l2, i2);
630
630
  } });
631
631
  }
632
- return b$1(o3, e2, a2, l2, i2);
632
+ return b(o3, e2, a2, l2, i2);
633
633
  }
634
- function b$1(r2, n2 = {}, e2, a2, s2) {
635
- let { as: t$12 = e2, children: l2, refName: i2 = "ref", ...o3 } = h$1(r2, ["unmount", "static"]), y2 = r2.ref !== void 0 ? { [i2]: r2.ref } : {}, f2 = typeof l2 == "function" ? l2(n2) : l2;
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" ? (...F2) => t(p2(...F2), o3.className) : t(p2, o3.className), T2 = c2 ? { className: c2 } : {}, g = N$1(f2.props, m(h$1(o3, ["ref"])));
653
- for (let F2 in u2) F2 in g && delete u2[F2];
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$1(o3, ["ref"]), t$12 !== Fragment && y2, t$12 !== Fragment && u2), f2);
656
+ return createElement(t$12, Object.assign({}, h(o3, ["ref"]), t$12 !== Fragment && y2, t$12 !== Fragment && u2), f2);
657
657
  }
658
- function A$1(...r2) {
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$1(r2, n2 = []) {
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$3(l2, r2, c2) {
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$2(e2) {
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$3(s2, r2), n2);
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$3(i2, s2) {
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$3(s2, r2.toString()), n2);
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$1(i2) {
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$1(t2, r2) {
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$1({ ourProps: o3, theirProps: e2, slot: {}, defaultTag: a$1, name: "Hidden" });
741
+ return H({ ourProps: o3, theirProps: e2, slot: {}, defaultTag: a$1, name: "Hidden" });
742
742
  }
743
- let T$2 = W(l$1);
744
- let f$2 = createContext(null);
743
+ let T$1 = W(l);
744
+ let f$1 = createContext(null);
745
745
  function c$1({ children: t2 }) {
746
- let e2 = useContext(f$2);
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: F2 }) {
752
- let [i2, a2] = useState(null), p2 = p$2();
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$2, { features: s.Hidden, ...m({ key: s$12, as: "input", type: "hidden", hidden: true, readOnly: true, form: e2, disabled: r2, name: s$12, value: v, ...F2 }) })));
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$2, { features: s.Hidden, as: "input", type: "hidden", hidden: true, readOnly: true, ref: (r2) => {
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$2() {
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$1 = Symbol();
789
- function T$1(t2, n2 = true) {
790
- return Object.assign(t2, { [u$1]: n2 });
788
+ let u = Symbol();
789
+ function T(t2, n2 = true) {
790
+ return Object.assign(t2, { [u]: n2 });
791
791
  }
792
- function y$1(...t2) {
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$1])) ? void 0 : c2;
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$1() {
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$1), e2;
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$1 = "p";
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$1(), s2 = y$1(e2);
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$1({ ourProps: D2, theirProps: l2, slot: p2, defaultTag: S$1, name: n$1.name || "Description" });
831
+ return H({ ourProps: D2, theirProps: l2, slot: p2, defaultTag: S, name: n$1.name || "Description" });
832
832
  }
833
- let _$1 = W(C), w$1 = Object.assign(_$1, {});
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$1() {
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$1), l2;
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 y2;
863
- let a2 = useId(), e2 = P$1(), o3 = u$2(), g = a$2(), { id: t2 = `headlessui-label-${a2}`, htmlFor: s2 = o3 != null ? o3 : (y2 = e2.props) == null ? void 0 : y2.htmlFor, passive: m2 = false, ...i2 } = r2, p2 = y$1(l2);
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$1({ ourProps: f2, theirProps: i2, slot: C2, defaultTag: s2 ? N : "div", name: e2.name || "Label" });
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$1 as H,
885
+ H,
967
886
  I,
968
887
  K,
969
888
  M,
970
- P,
971
- T$3 as T,
889
+ T$2 as T,
972
890
  U$1 as U,
973
891
  W,
974
- _,
975
- a$2 as a,
976
- $6179b936705e76d3$export$ae780daf29e6d456 as b,
977
- u$2 as c,
978
- u$3 as d,
979
- u$4 as e,
980
- o2 as f,
981
- T as g,
982
- p$2 as h,
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
- h as k,
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
- T$1 as v,
997
- w$1 as w,
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
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.5.4",
4
+ "version": "1.7.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {