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
package/dist/assets/Input.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
._input-
|
1
|
+
._input-wrapper_1wv6m_2{position:relative}._input-wrapper_1wv6m_2 ._label_1wv6m_5{position:absolute;top:calc(var(--input-height) / 2 - var(--input-font-size) / 2);left:var(--space-m);z-index:1;display:block;color:var(--label-color);font-size:var(--input-font-size);white-space:nowrap;transform-origin:left center;transition:transform .15s ease-out,color .15s ease-out;pointer-events:none}._input-wrapper_1wv6m_2 ._label_1wv6m_5._active-label_1wv6m_18{transform:scale(var(--label-scaled)) translateY(calc(var(--input-font-size) * -1))}._input-wrapper_1wv6m_2:hover ._label_1wv6m_5,._input-wrapper_1wv6m_2:focus-within ._label_1wv6m_5{color:var(--label-color)}._input_1wv6m_2{--button-border-radius-l: 8px;--button-border-radius-m: 6px;--button-border-radius-s: 6px;position:relative;display:block;width:100%;min-width:0;height:var(--input-height);padding-top:0;color:var(--dark-text);font-size:var(--input-font-size);font-family:var(--font-inter);line-height:var(--input-line-height);letter-spacing:-.42px;background:none;background-color:var(--input-bg-color);border-bottom:1px solid transparent;border-radius:var(--input-border-radius);outline:none;cursor:var(--input-cursor);transition:background-color .2s ease,border-color .15s ease,box-shadow .15s ease,color .15s ease,fill .15s ease;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding-left:var(--input-padding);padding-right:var(--input-padding);font-feature-settings:"zero"}._input_1wv6m_2:hover{color:var(--input-color-hover);background:var(--input-bg-color-hover)}._input_1wv6m_2:focus{color:var(--input-color-active);background-color:var(--input-bg-color-active);border-bottom:1px solid var(--input-bottom-color-active)}._s_1wv6m_61{--input-height: var(--space-xxl);--input-font-size: var(--control-text-size-m);--input-line-height: var(--line-height-text-xs);--input-padding: var(--space-m);--input-padding-position: var(--space-1xs);--input-border-radius: var(--button-border-radius-s);--label-font-size: var(--size-text-xs);--label-scaled: .85;--label-spacing: var(--space-1xs)}._m_1wv6m_73{--input-height: var(--space-4xl);--input-font-size: var(--control-text-size-l);--input-line-height: var(--line-height-text-s1);--input-padding: var(--space-m);--input-padding-position: var(--space-xs);--input-border-radius: var(--button-border-radius-m);--label-font-size: var(--size-text-s);--label-scaled: .75;--label-spacing: var(--space-xs)}._l_1wv6m_5{--input-height: var(--space-4xxl);--input-font-size: var(--control-text-size-2xl);--input-line-height: var(--line-height-text-l);--input-padding: var(--space-m);--input-padding-position: var(--space-s);--input-border-radius: var(--button-border-radius-l);--label-font-size: var(--size-text-s);--label-scaled: .6;--label-spacing: var(--space-s)}._default-gray_1wv6m_97{--input-bg-color: var(--black-5);--input-bg-color-active: var(--black-10);--input-bg-color-hover: var(--black-10);--input-color: var(--dark-text);--input-color-hover: var(--dark-text);--input-color-active: var(--dark-text);--input-border: transparent;--input-bottom-color-active: var(--citrine-normal);--label-color: var(--black-60)}._default-white_1wv6m_109{--input-bg-color: var(--white);--input-bg-color-hover: var(--black-60);--input-bg-color-active: var(--white);--input-color: var(--dark-text);--input-color-hover: var(--dark-text);--input-color-active: var(--dark-text);--input-border: transparent;--input-bottom-color-active: var(--citrine-normal);--label-color: var(--black-60)}._default-white_1wv6m_109:hover{--label-color: var(--dark-text)}._success_1wv6m_124{--input-bg-color: var(--success-normal);--input-bg-color-hover: var(--success-bg-hover);--input-bg-color-active: var(--success-bg-active);--input-color: var(--dark-text);--input-color-hover: var(--dark-text);--input-color-active: var(--dark-text);--input-border: transparent;--input-bottom-color-active: var(--success-normal);--label-color: var(--black-60)}._success_1wv6m_124::-moz-placeholder{color:var(--input-color)}._success_1wv6m_124::placeholder{color:var(--input-color)}._success_1wv6m_124:hover::-moz-placeholder{color:var(--input-color)}._success_1wv6m_124:hover::placeholder{color:var(--input-color)}._alarm_1wv6m_142{--input-bg-color: var(--alarm-normal);--input-bg-color-hover: var(--alarm-bg-hover);--input-bg-color-active: var(--alarm-bg-active);--input-color: var(--dark-text);--input-color-hover: var(--dark-text);--input-color-active: var(--dark-text);--input-border: transparent;--input-bottom-color-active: var(--alarm-normal);--label-color: var(--black-60)}._alarm_1wv6m_142::-moz-placeholder{color:var(--input-color)}._alarm_1wv6m_142::placeholder{color:var(--input-color)}._alarm_1wv6m_142:hover::-moz-placeholder{color:var(--input-color)}._alarm_1wv6m_142:hover::placeholder{color:var(--input-color)}._error_1wv6m_160{--input-bg-color: var(--error-normal);--input-bg-color-hover: var(--error-bg-hover);--input-bg-color-active: var(--error-bg-active);--input-color: var(--dark-text);--input-color-hover: var(--dark-text);--input-color-active: var(--dark-text);--input-border: transparent;--input-bottom-color-active: var(--error-normal);--label-color: var(--black-60)}._error_1wv6m_160::-moz-placeholder{color:var(--input-color)}._error_1wv6m_160::placeholder{color:var(--input-color)}._error_1wv6m_160:hover::-moz-placeholder{color:var(--input-color)}._error_1wv6m_160:hover::placeholder{color:var(--input-color)}._disabled_1wv6m_178{--input-cursor: not-allowed;color:var(--light-text);background-color:var(--black-20)}._disabled_1wv6m_178:hover,._disabled_1wv6m_178:active,._disabled_1wv6m_178:focus{color:var(--light-text);background-color:var(--black-20);border:none;box-shadow:none}._disabled_1wv6m_178::-moz-placeholder{color:var(--light-text)}._disabled_1wv6m_178::placeholder{color:var(--light-text)}._disabled_1wv6m_178:hover::-moz-placeholder{color:var(--light-text)}._disabled_1wv6m_178:hover::placeholder{color:var(--light-text)}._has-label_1wv6m_196{padding-top:var(--input-padding-position)}
|
@@ -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}
|
@@ -2,30 +2,30 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c as classNames } from "../../index-CweZ_OcN.js";
|
3
3
|
import { memo, forwardRef, useState, useEffect } from "react";
|
4
4
|
import { EInputVariant } from "./constants.js";
|
5
|
-
import '../../assets/Input.css';const label = "
|
6
|
-
const input = "
|
7
|
-
const s = "
|
8
|
-
const m = "
|
9
|
-
const l = "
|
10
|
-
const success = "
|
11
|
-
const alarm = "
|
12
|
-
const error = "
|
13
|
-
const disabled = "
|
5
|
+
import '../../assets/Input.css';const label = "_label_1wv6m_5";
|
6
|
+
const input = "_input_1wv6m_2";
|
7
|
+
const s = "_s_1wv6m_61";
|
8
|
+
const m = "_m_1wv6m_73";
|
9
|
+
const l = "_l_1wv6m_5";
|
10
|
+
const success = "_success_1wv6m_124";
|
11
|
+
const alarm = "_alarm_1wv6m_142";
|
12
|
+
const error = "_error_1wv6m_160";
|
13
|
+
const disabled = "_disabled_1wv6m_178";
|
14
14
|
const cls = {
|
15
|
-
"input-wrapper": "_input-
|
15
|
+
"input-wrapper": "_input-wrapper_1wv6m_2",
|
16
16
|
label,
|
17
|
-
"active-label": "_active-
|
17
|
+
"active-label": "_active-label_1wv6m_18",
|
18
18
|
input,
|
19
19
|
s,
|
20
20
|
m,
|
21
21
|
l,
|
22
|
-
"default-gray": "_default-
|
23
|
-
"default-white": "_default-
|
22
|
+
"default-gray": "_default-gray_1wv6m_97",
|
23
|
+
"default-white": "_default-white_1wv6m_109",
|
24
24
|
success,
|
25
25
|
alarm,
|
26
26
|
error,
|
27
27
|
disabled,
|
28
|
-
"has-label": "_has-
|
28
|
+
"has-label": "_has-label_1wv6m_196"
|
29
29
|
};
|
30
30
|
const Input = memo(
|
31
31
|
forwardRef(
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
2
|
-
import { W, K, w, a,
|
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, {
|
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 {
|
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
|
13
|
-
|
14
|
-
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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:
|
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" &&
|
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$
|
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$
|
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((
|
3350
|
-
l2.requestAnimationFrame(function
|
3351
|
-
l2.nextFrame(
|
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$
|
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$
|
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$
|
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$
|
3652
|
+
}), E2 = o$2(() => {
|
3677
3653
|
R2({ type: 0 }), h2.current = true;
|
3678
|
-
}), ae = o$
|
3654
|
+
}), ae = o$2(() => {
|
3679
3655
|
R2({ type: 1 }), h2.current = false, n2 == null || n2();
|
3680
|
-
}), le = o$
|
3656
|
+
}), le = o$2((b) => {
|
3681
3657
|
R2({ type: 3, isTyping: b });
|
3682
|
-
}), l2 = o$
|
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$
|
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$
|
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$
|
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$
|
3698
|
+
let v2 = useRef(false), y2 = o$2(() => {
|
3723
3699
|
v2.current = true;
|
3724
|
-
}), A2 = o$
|
3700
|
+
}), A2 = o$2(() => {
|
3725
3701
|
L2.nextFrame(() => {
|
3726
3702
|
v2.current = false;
|
3727
3703
|
});
|
3728
|
-
}), R2 = o$
|
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$
|
3737
|
+
}), h2 = o$2((l2) => {
|
3762
3738
|
s2 == null || s2(l2), e2.mode === 0 && l2.target.value === "" && M2(), t2.openCombobox();
|
3763
|
-
}), O = o$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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$
|
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,52 @@
|
|
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
|
+
onChange == null ? void 0 : onChange(value);
|
37
|
+
};
|
38
|
+
return /* @__PURE__ */ jsx(
|
39
|
+
Re,
|
40
|
+
{
|
41
|
+
checked: enabled2,
|
42
|
+
onChange: handleChange,
|
43
|
+
className: classNames(cls.switch, {
|
44
|
+
[cls.enabled]: enabled2
|
45
|
+
}),
|
46
|
+
children: /* @__PURE__ */ jsx(Icon, { iconName: "Done16px" })
|
47
|
+
}
|
48
|
+
);
|
49
|
+
};
|
50
|
+
export {
|
51
|
+
Switch
|
52
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -7,8 +7,6 @@ export { InputPhoneNumber, getMaskedInputPhoneValue, getUnmaskedInputValue } fro
|
|
7
7
|
export { OtpInput } from './OtpInput';
|
8
8
|
export { RadioGroup } from './RadioGroup';
|
9
9
|
export type { TRadioOption } from './RadioGroup';
|
10
|
-
export { DatePicker } from './DatePicker';
|
11
|
-
export type { TDatePickerProps } from './DatePicker';
|
12
10
|
export { MergedButton } from './MergedButton';
|
13
11
|
export { EMergedButtonVariantRound } from './MergedButton';
|
14
12
|
export type { TButtonPropsWithoutStyles } from './MergedButton';
|
@@ -21,3 +19,5 @@ export { Steps, EStepsPrimaryColor, EStepsSecondaryColor, EStepsSize, type TComm
|
|
21
19
|
export { Vote, EVoteSize, type TCommonVoteProps } from './Vote';
|
22
20
|
export { SelectSearch, ESelectSearchSize } from './SelectSearch';
|
23
21
|
export type { TSelectSearchItem, TSelectSearchProps, TSelectSearchSize } from './SelectSearch';
|
22
|
+
export { Switch } from './Switch';
|
23
|
+
export type { TSwitchProps } from './Switch';
|
package/dist/components/index.js
CHANGED
@@ -7,7 +7,6 @@ import { InputPhoneNumber } from "./InputPhoneNumber/InputPhoneNumber.js";
|
|
7
7
|
import { getMaskedInputPhoneValue, getUnmaskedInputValue } from "./InputPhoneNumber/utils.js";
|
8
8
|
import { OtpInput } from "./OtpInput/OtpInput.js";
|
9
9
|
import { RadioGroup } from "./RadioGroup/RadioGroup.js";
|
10
|
-
import { DatePicker } from "./DatePicker/DatePicker.js";
|
11
10
|
import { MergedButton } from "./MergedButton/MergedButton.js";
|
12
11
|
import { EMergedButtonVariantRound } from "./MergedButton/constants.js";
|
13
12
|
import { AppImage } from "./Image/Image.js";
|
@@ -21,9 +20,9 @@ import { Vote } from "./Vote/Vote.js";
|
|
21
20
|
import { EVoteSize } from "./Vote/constants.js";
|
22
21
|
import { SelectSearch } from "./SelectSearch/SelectSearch.js";
|
23
22
|
import { ESelectSearchSize } from "./SelectSearch/constants.js";
|
23
|
+
import { Switch } from "./Switch/Switch.js";
|
24
24
|
export {
|
25
25
|
Button,
|
26
|
-
DatePicker,
|
27
26
|
Drawer,
|
28
27
|
EButtonForm,
|
29
28
|
EButtonSize,
|
@@ -49,6 +48,7 @@ export {
|
|
49
48
|
SelectSearch,
|
50
49
|
Slider,
|
51
50
|
Steps,
|
51
|
+
Switch,
|
52
52
|
Vote,
|
53
53
|
getMaskedInputPhoneValue,
|
54
54
|
getUnmaskedInputValue
|