mimir-ui-kit 1.37.18 → 1.38.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/Dropdown.css +1 -0
- package/dist/close-provider-CEutdhG8.js +9 -0
- package/dist/combobox-CVtJDVoZ.js +980 -0
- package/dist/components/Accordion/Accordion.js +91 -95
- package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
- package/dist/components/DatePicker/DatePicker.js +19 -19
- package/dist/components/DatePicker/hooks.js +11 -11
- package/dist/components/Dropdown/Dropdown.d.ts +45 -0
- package/dist/components/Dropdown/Dropdown.js +333 -0
- package/dist/components/Dropdown/index.d.ts +1 -0
- package/dist/components/Dropdown/index.js +4 -0
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +18 -18
- package/dist/components/RadioGroup/RadioGroup.js +3 -3
- package/dist/components/SelectSearch/SelectSearch.js +21 -21
- package/dist/components/Switcher/Switcher.js +4 -4
- package/dist/components/TabTrail/TabTrail.js +4 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +117 -115
- package/dist/{field-C1kt7aNM.js → field-FJ34aSs4.js} +2 -2
- package/dist/{focus-management-DOYCPyGg.js → focus-management-DE4t_lW3.js} +2 -1
- package/dist/{hidden-PvGXrYUY.js → hidden-DbgtYPOH.js} +1 -1
- package/dist/index.js +141 -139
- package/dist/{keyboard-mgWkd2Vh.js → keyboard-B0lm_zyn.js} +111 -114
- package/dist/{label-D4GFpe5F.js → label-y3ANLTNC.js} +2 -2
- package/dist/open-closed-CdldUPoq.js +86 -0
- package/dist/portal-WDFNoIMz.js +1908 -0
- package/dist/{use-active-press-CqLGIFz7.js → use-active-press-86hajhdd.js} +1 -1
- package/package.json +1 -1
- package/dist/combobox-BpYucpxz.js +0 -2896
- package/dist/open-closed-D2VjDhAN.js +0 -86
@@ -1,28 +1,24 @@
|
|
1
|
-
import { jsxs as A, Fragment as
|
2
|
-
import { c as
|
3
|
-
import
|
1
|
+
import { jsxs as A, Fragment as H, jsx as I } from "react/jsx-runtime";
|
2
|
+
import { c as v } from "../../index-DIxK0V-G.js";
|
3
|
+
import x, { createContext as K, useRef as oe, Fragment as re, useReducer as pe, useMemo as O, useId as se, useEffect as le, useState as ae, useContext as U, forwardRef as me } from "react";
|
4
4
|
import { AccordionItem as fe } from "./AccordionItem/AccordionItem.js";
|
5
|
-
import { EAccordionButtonType as
|
5
|
+
import { EAccordionButtonType as P, EAccordionSize as B, EAccordionLinkIconSize as J, EAccordionButtonStyle as _e, EAccordionIconType as Y, EAccordionButtonIconSize as Z } from "./constants.js";
|
6
6
|
import { useMediaQuery as ye } from "../../hooks/useMediaQuery/useMediaQuery.js";
|
7
7
|
import { EMediaQuery as Ee } from "../../hooks/useMediaQuery/constants.js";
|
8
8
|
import { Icon as Se } from "../../icons/Icon.js";
|
9
9
|
import { Link as ke } from "../AnchorLink/Link.js";
|
10
|
-
import { M as ee, W as q, y as j, T as Ie, o as $, a as W, H as Q, I as ce, $ as be, b as
|
11
|
-
import { w as he } from "../../use-active-press-
|
12
|
-
import { e as
|
13
|
-
import { c as $e, i as R, u as
|
14
|
-
import {
|
15
|
-
import
|
16
|
-
|
17
|
-
|
18
|
-
return b.createElement(Ce.Provider, { value: e }, t);
|
19
|
-
}
|
20
|
-
var ne;
|
21
|
-
let Be = (ne = b.startTransition) != null ? ne : function(e) {
|
10
|
+
import { M as ee, W as q, y as j, T as Ie, o as $, a as W, H as Q, I as ce, $ as be, b as xe, D as te, u as De, c as T } from "../../keyboard-B0lm_zyn.js";
|
11
|
+
import { w as he } from "../../use-active-press-86hajhdd.js";
|
12
|
+
import { e as ve } from "../../use-resolve-button-type-DhFdPxnv.js";
|
13
|
+
import { c as $e, i as R, u as ge, R as Pe, H as Te, s as we } from "../../open-closed-CdldUPoq.js";
|
14
|
+
import { C as Ne } from "../../close-provider-CEutdhG8.js";
|
15
|
+
import { r as Ce } from "../../bugs-diTMAGNw.js";
|
16
|
+
import '../../assets/Accordion.css';var ne;
|
17
|
+
let Ae = (ne = x.startTransition) != null ? ne : function(e) {
|
22
18
|
e();
|
23
19
|
};
|
24
|
-
var
|
25
|
-
let
|
20
|
+
var Be = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(Be || {}), Oe = ((e) => (e[e.ToggleDisclosure = 0] = "ToggleDisclosure", e[e.CloseDisclosure = 1] = "CloseDisclosure", e[e.SetButtonId = 2] = "SetButtonId", e[e.SetPanelId = 3] = "SetPanelId", e[e.SetButtonElement = 4] = "SetButtonElement", e[e.SetPanelElement = 5] = "SetPanelElement", e))(Oe || {});
|
21
|
+
let Re = { 0: (e) => ({ ...e, disclosureState: W(e.disclosureState, { 0: 1, 1: 0 }) }), 1: (e) => e.disclosureState === 1 ? e : { ...e, disclosureState: 1 }, 2(e, t) {
|
26
22
|
return e.buttonId === t.buttonId ? e : { ...e, buttonId: t.buttonId };
|
27
23
|
}, 3(e, t) {
|
28
24
|
return e.panelId === t.panelId ? e : { ...e, panelId: t.panelId };
|
@@ -30,7 +26,7 @@ let Me = { 0: (e) => ({ ...e, disclosureState: W(e.disclosureState, { 0: 1, 1: 0
|
|
30
26
|
return e.buttonElement === t.element ? e : { ...e, buttonElement: t.element };
|
31
27
|
}, 5(e, t) {
|
32
28
|
return e.panelElement === t.element ? e : { ...e, panelElement: t.element };
|
33
|
-
} }, V =
|
29
|
+
} }, V = K(null);
|
34
30
|
V.displayName = "DisclosureContext";
|
35
31
|
function z(e) {
|
36
32
|
let t = U(V);
|
@@ -40,7 +36,7 @@ function z(e) {
|
|
40
36
|
}
|
41
37
|
return t;
|
42
38
|
}
|
43
|
-
let X =
|
39
|
+
let X = K(null);
|
44
40
|
X.displayName = "DisclosureAPIContext";
|
45
41
|
function ie(e) {
|
46
42
|
let t = U(X);
|
@@ -50,40 +46,40 @@ function ie(e) {
|
|
50
46
|
}
|
51
47
|
return t;
|
52
48
|
}
|
53
|
-
let G =
|
49
|
+
let G = K(null);
|
54
50
|
G.displayName = "DisclosurePanelContext";
|
55
|
-
function
|
51
|
+
function Me() {
|
56
52
|
return U(G);
|
57
53
|
}
|
58
|
-
function
|
59
|
-
return W(t.type,
|
54
|
+
function Fe(e, t) {
|
55
|
+
return W(t.type, Re, e, t);
|
60
56
|
}
|
61
|
-
let
|
62
|
-
function
|
63
|
-
let { defaultOpen: u = !1, ...p } = e,
|
64
|
-
|
65
|
-
}, e.as === void 0 || e.as === re)), a = pe(
|
57
|
+
let Le = re;
|
58
|
+
function He(e, t) {
|
59
|
+
let { defaultOpen: u = !1, ...p } = e, l = oe(null), m = j(t, Ie((c) => {
|
60
|
+
l.current = c;
|
61
|
+
}, e.as === void 0 || e.as === re)), a = pe(Fe, { disclosureState: u ? 0 : 1, buttonElement: null, panelElement: null, buttonId: null, panelId: null }), [{ disclosureState: n, buttonId: r }, y] = a, s = $((c) => {
|
66
62
|
y({ type: 1 });
|
67
|
-
let f =
|
63
|
+
let f = De(l);
|
68
64
|
if (!f || !r) return;
|
69
65
|
let _ = c ? c instanceof HTMLElement ? c : c.current instanceof HTMLElement ? c.current : f.getElementById(r) : f.getElementById(r);
|
70
66
|
_ == null || _.focus();
|
71
|
-
}),
|
72
|
-
return
|
67
|
+
}), b = O(() => ({ close: s }), [s]), E = O(() => ({ open: n === 0, close: s }), [n, s]), S = { ref: m };
|
68
|
+
return x.createElement(V.Provider, { value: a }, x.createElement(X.Provider, { value: b }, x.createElement(Ne, { value: s }, x.createElement($e, { value: W(n, { 0: R.Open, 1: R.Closed }) }, Q({ ourProps: S, theirProps: p, slot: E, defaultTag: Le, name: "Disclosure" })))));
|
73
69
|
}
|
74
|
-
let
|
75
|
-
function
|
76
|
-
let u =
|
77
|
-
if (!
|
70
|
+
let Ke = "button";
|
71
|
+
function Ue(e, t) {
|
72
|
+
let u = se(), { id: p = `headlessui-disclosure-button-${u}`, disabled: l = !1, autoFocus: m = !1, ...a } = e, [n, r] = z("Disclosure.Button"), y = Me(), s = y === null ? !1 : y === n.panelId, b = oe(null), E = j(b, t, $((i) => {
|
73
|
+
if (!s) return r({ type: 4, element: i });
|
78
74
|
})), S = ce();
|
79
|
-
|
80
|
-
if (!
|
75
|
+
le(() => {
|
76
|
+
if (!s) return r({ type: 2, buttonId: p }), () => {
|
81
77
|
r({ type: 2, buttonId: null });
|
82
78
|
};
|
83
|
-
}, [p, r,
|
79
|
+
}, [p, r, s]);
|
84
80
|
let c = $((i) => {
|
85
81
|
var o;
|
86
|
-
if (
|
82
|
+
if (s) {
|
87
83
|
if (n.disclosureState === 1) return;
|
88
84
|
switch (i.key) {
|
89
85
|
case T.Space:
|
@@ -105,85 +101,85 @@ function qe(e, t) {
|
|
105
101
|
}
|
106
102
|
}), _ = $((i) => {
|
107
103
|
var o;
|
108
|
-
|
109
|
-
}), { isFocusVisible:
|
110
|
-
return Q({ mergeRefs: S, ourProps:
|
104
|
+
Ce(i.currentTarget) || l || (s ? (r({ type: 0 }), (o = n.buttonElement) == null || o.focus()) : r({ type: 0 }));
|
105
|
+
}), { isFocusVisible: D, focusProps: h } = be({ autoFocus: m }), { isHovered: w, hoverProps: N } = xe({ isDisabled: l }), { pressed: k, pressProps: g } = he({ disabled: l }), M = O(() => ({ open: n.disclosureState === 0, hover: w, active: k, disabled: l, focus: D, autofocus: m }), [n, w, k, D, l, m]), C = ve(e, n.buttonElement), F = s ? te({ ref: E, type: C, disabled: l || void 0, autoFocus: m, onKeyDown: c, onClick: _ }, h, N, g) : te({ ref: E, id: p, type: C, "aria-expanded": n.disclosureState === 0, "aria-controls": n.panelElement ? n.panelId : void 0, disabled: l || void 0, autoFocus: m, onKeyDown: c, onKeyUp: f, onClick: _ }, h, N, g);
|
106
|
+
return Q({ mergeRefs: S, ourProps: F, theirProps: a, slot: M, defaultTag: Ke, name: "Disclosure.Button" });
|
111
107
|
}
|
112
|
-
let
|
113
|
-
function
|
114
|
-
let u =
|
115
|
-
|
116
|
-
}),
|
117
|
-
|
108
|
+
let qe = "div", je = ee.RenderStrategy | ee.Static;
|
109
|
+
function We(e, t) {
|
110
|
+
let u = se(), { id: p = `headlessui-disclosure-panel-${u}`, transition: l = !1, ...m } = e, [a, n] = z("Disclosure.Panel"), { close: r } = ie("Disclosure.Panel"), y = ce(), [s, b] = ae(null), E = j(t, $((h) => {
|
111
|
+
Ae(() => n({ type: 5, element: h }));
|
112
|
+
}), b);
|
113
|
+
le(() => (n({ type: 3, panelId: p }), () => {
|
118
114
|
n({ type: 3, panelId: null });
|
119
115
|
}), [p, n]);
|
120
|
-
let S =
|
121
|
-
return
|
116
|
+
let S = ge(), [c, f] = Pe(l, s, S !== null ? (S & R.Open) === R.Open : a.disclosureState === 0), _ = O(() => ({ open: a.disclosureState === 0, close: r }), [a.disclosureState, r]), D = { ref: E, id: p, ...Te(f) };
|
117
|
+
return x.createElement(we, null, x.createElement(G.Provider, { value: a.panelId }, Q({ mergeRefs: y, ourProps: D, theirProps: m, slot: _, defaultTag: qe, features: je, visible: c, name: "Disclosure.Panel" })));
|
122
118
|
}
|
123
|
-
let
|
124
|
-
const
|
125
|
-
icon:
|
119
|
+
let Qe = q(He), ue = q(Ue), de = q(We), Ve = Object.assign(Qe, { Button: ue, Panel: de });
|
120
|
+
const ze = "_icon_1yk0x_2", Xe = "_open_1yk0x_15", Ge = "_square_1yk0x_19", Je = "_circle_1yk0x_23", Ye = "_disabled_1yk0x_23", Ze = "_accordion_1yk0x_37", et = "_header_1yk0x_45", tt = "_title_1yk0x_61", nt = "_panel_1yk0x_88", ot = "_m_1yk0x_112", rt = "_s_1yk0x_19", d = {
|
121
|
+
icon: ze,
|
126
122
|
"icon-container": "_icon-container_1yk0x_8",
|
127
|
-
open:
|
128
|
-
square:
|
129
|
-
circle:
|
130
|
-
disabled:
|
131
|
-
accordion:
|
123
|
+
open: Xe,
|
124
|
+
square: Ge,
|
125
|
+
circle: Je,
|
126
|
+
disabled: Ye,
|
127
|
+
accordion: Ze,
|
132
128
|
"is-link": "_is-link_1yk0x_41",
|
133
|
-
header:
|
134
|
-
title:
|
129
|
+
header: et,
|
130
|
+
title: tt,
|
135
131
|
"title-uppercase": "_title-uppercase_1yk0x_64",
|
136
|
-
panel:
|
132
|
+
panel: nt,
|
137
133
|
"link-open": "_link-open_1yk0x_108",
|
138
|
-
m:
|
139
|
-
s:
|
134
|
+
m: ot,
|
135
|
+
s: rt,
|
140
136
|
"wrapper-button": "_wrapper-button_1yk0x_140"
|
141
137
|
}, It = me(
|
142
138
|
({
|
143
139
|
title: e,
|
144
140
|
disabled: t,
|
145
|
-
buttonType: u =
|
141
|
+
buttonType: u = P.BUTTON,
|
146
142
|
children: p,
|
147
|
-
showTitleByDefault:
|
143
|
+
showTitleByDefault: l = !0,
|
148
144
|
linkClassName: m,
|
149
145
|
size: a = B.M,
|
150
146
|
titleUppercase: n,
|
151
147
|
buttonStyle: r = _e.CIRCLE,
|
152
148
|
iconType: y = Y.ARROW,
|
153
|
-
classNameTitle:
|
154
|
-
classNameContent:
|
149
|
+
classNameTitle: s,
|
150
|
+
classNameContent: b,
|
155
151
|
classNameAccordion: E,
|
156
152
|
classNameIconButton: S,
|
157
153
|
subtitleNode: c,
|
158
154
|
onlyOpenSubtitleNode: f,
|
159
155
|
classNameSubtitleContainer: _
|
160
|
-
},
|
161
|
-
const [h, w] = ae(!1), N = ye(Ee.XS1), k = u ===
|
156
|
+
}, D) => {
|
157
|
+
const [h, w] = ae(!1), N = ye(Ee.XS1), k = u === P.LINK, g = {
|
162
158
|
[d["is-link"]]: k
|
163
|
-
},
|
159
|
+
}, M = () => {
|
164
160
|
t || w((o) => !o);
|
165
|
-
}, C = a === B.S ? J.S : J.M,
|
161
|
+
}, C = a === B.S ? J.S : J.M, F = (o) => ({
|
166
162
|
variant: "anchor",
|
167
163
|
size: N ? "s" : "l",
|
168
164
|
rightIcon: {
|
169
165
|
iconName: C,
|
170
|
-
className:
|
166
|
+
className: v({
|
171
167
|
[d["link-open"]]: o
|
172
168
|
})
|
173
169
|
}
|
174
170
|
}), i = (o) => {
|
175
|
-
const
|
171
|
+
const L = () => y === Y.DROPDOWN ? a === B.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px" : a === B.S ? Z.S : Z.M;
|
176
172
|
switch (u) {
|
177
|
-
case
|
173
|
+
case P.LINK:
|
178
174
|
return e;
|
179
|
-
case
|
180
|
-
return /* @__PURE__ */ A(
|
175
|
+
case P.BUTTON:
|
176
|
+
return /* @__PURE__ */ A(H, { children: [
|
181
177
|
/* @__PURE__ */ I(
|
182
178
|
"span",
|
183
179
|
{
|
184
|
-
className:
|
180
|
+
className: v(
|
185
181
|
d.title,
|
186
|
-
|
182
|
+
s,
|
187
183
|
n && d["title-uppercase"]
|
188
184
|
),
|
189
185
|
children: e
|
@@ -192,7 +188,7 @@ const Xe = "_icon_1yk0x_2", Ge = "_open_1yk0x_15", Je = "_square_1yk0x_19", Ye =
|
|
192
188
|
/* @__PURE__ */ I(
|
193
189
|
"div",
|
194
190
|
{
|
195
|
-
className:
|
191
|
+
className: v(
|
196
192
|
d["icon-container"],
|
197
193
|
o && d.open,
|
198
194
|
t && d.disabled,
|
@@ -203,7 +199,7 @@ const Xe = "_icon_1yk0x_2", Ge = "_open_1yk0x_15", Je = "_square_1yk0x_19", Ye =
|
|
203
199
|
children: /* @__PURE__ */ I(
|
204
200
|
Se,
|
205
201
|
{
|
206
|
-
iconName:
|
202
|
+
iconName: L(),
|
207
203
|
className: d.icon,
|
208
204
|
"data-testid": "accordion-icon"
|
209
205
|
}
|
@@ -215,44 +211,44 @@ const Xe = "_icon_1yk0x_2", Ge = "_open_1yk0x_15", Je = "_square_1yk0x_19", Ye =
|
|
215
211
|
return null;
|
216
212
|
}
|
217
213
|
};
|
218
|
-
return /* @__PURE__ */ A(
|
214
|
+
return /* @__PURE__ */ A(H, { children: [
|
219
215
|
/* @__PURE__ */ I(
|
220
216
|
"div",
|
221
217
|
{
|
222
|
-
className:
|
218
|
+
className: v(
|
223
219
|
d.accordion,
|
224
220
|
d[a],
|
225
|
-
|
221
|
+
g,
|
226
222
|
E
|
227
223
|
),
|
228
|
-
children: /* @__PURE__ */ I(
|
229
|
-
(!o ||
|
224
|
+
children: /* @__PURE__ */ I(Ve, { ref: D, children: ({ open: o, close: L }) => /* @__PURE__ */ A(H, { children: [
|
225
|
+
(!o || l) && /* @__PURE__ */ I(
|
230
226
|
ue,
|
231
227
|
{
|
232
228
|
disabled: t,
|
233
|
-
as: k ? ke :
|
234
|
-
onClick:
|
235
|
-
className:
|
229
|
+
as: k ? ke : P.BUTTON,
|
230
|
+
onClick: M,
|
231
|
+
className: v({
|
236
232
|
[d.header]: !k,
|
237
233
|
[d.disabled]: t,
|
238
234
|
[m ?? ""]: k && m
|
239
235
|
}),
|
240
|
-
...k ?
|
241
|
-
children: (!o ||
|
236
|
+
...k ? F(o) : {},
|
237
|
+
children: (!o || l) && i(o)
|
242
238
|
}
|
243
239
|
),
|
244
240
|
o && /* @__PURE__ */ I(
|
245
241
|
de,
|
246
242
|
{
|
247
243
|
"data-testid": "accordion-panel",
|
248
|
-
className:
|
244
|
+
className: v(
|
249
245
|
d.panel,
|
250
|
-
|
251
|
-
|
246
|
+
b,
|
247
|
+
g
|
252
248
|
),
|
253
249
|
children: /* @__PURE__ */ I(fe, { size: a, children: typeof p == "function" ? p({
|
254
250
|
open: o,
|
255
|
-
close:
|
251
|
+
close: L
|
256
252
|
}) : p })
|
257
253
|
}
|
258
254
|
)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { jsxs as L, jsx as p } from "react/jsx-runtime";
|
2
|
-
import { W as O, p as V, o as d, $ as W, b as X, D as q, H as z, c as D } from "../../keyboard-
|
2
|
+
import { W as O, p as V, o as d, $ as W, b as X, D as q, H as z, c as D } from "../../keyboard-B0lm_zyn.js";
|
3
3
|
import h, { useId as J, useState as Q, useMemo as Y, useCallback as Z, forwardRef as ee } from "react";
|
4
|
-
import { w as re } from "../../use-active-press-
|
5
|
-
import { u as ae, a as oe, b as te, T as ce, I as ne, G as se, j as ie, p as le, K as de } from "../../label-
|
4
|
+
import { w as re } from "../../use-active-press-86hajhdd.js";
|
5
|
+
import { u as ae, a as oe, b as te, T as ce, I as ne, G as se, j as ie, p as le, K as de } from "../../label-y3ANLTNC.js";
|
6
6
|
import { r as be } from "../../bugs-diTMAGNw.js";
|
7
|
-
import { H as ue } from "../../field-
|
7
|
+
import { H as ue } from "../../field-FJ34aSs4.js";
|
8
8
|
import { c as me } from "../../index-DIxK0V-G.js";
|
9
9
|
import { Icon as fe } from "../../icons/Icon.js";
|
10
10
|
import '../../assets/CheckboxMimir.css';let pe = "span";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsxs as H, jsx as a } from "react/jsx-runtime";
|
2
2
|
import { c as _ } from "../../index-DIxK0V-G.js";
|
3
|
-
import { memo as V, forwardRef as tt, useState as
|
3
|
+
import { memo as V, forwardRef as tt, useState as N, useEffect as T } from "react";
|
4
4
|
import { MAX_DAY as st, MAX_MONTH as et, DATE_LENGTH as it } from "./constants.js";
|
5
5
|
import { DatePickerModal as rt } from "./DatePickerModal.js";
|
6
6
|
import { MonthPickerModal as ot } from "./MonthPickerModal.js";
|
@@ -31,13 +31,13 @@ const dt = {
|
|
31
31
|
validateImmediately: b,
|
32
32
|
variant: X,
|
33
33
|
disabled: S = !1,
|
34
|
-
editable:
|
34
|
+
editable: w = !1,
|
35
35
|
openOnInput: j = !0,
|
36
36
|
...E
|
37
37
|
}, F) => {
|
38
|
-
const [
|
38
|
+
const [D, m] = N(!1), [g, f] = N(p), [o, k] = N(
|
39
39
|
() => i && !isNaN(new Date(i).getTime()) ? new Date(i) : void 0
|
40
|
-
), [n, h] =
|
40
|
+
), [n, h] = N(x), [G, A] = N("");
|
41
41
|
T(() => {
|
42
42
|
h(x);
|
43
43
|
}, [x]), T(() => {
|
@@ -51,14 +51,14 @@ const dt = {
|
|
51
51
|
T(() => {
|
52
52
|
b && (u ? (h(!1), d == null || d({ name: c, active: !1 })) : (h(!0), d == null || d({ name: c, active: !0 })));
|
53
53
|
}, [b, c, u]), ct({
|
54
|
-
isActive:
|
54
|
+
isActive: D,
|
55
55
|
setActive: (t) => {
|
56
56
|
m(t), f(p);
|
57
57
|
},
|
58
58
|
className: e["calendar-block"]
|
59
59
|
});
|
60
60
|
const K = () => {
|
61
|
-
!S && (j || !
|
61
|
+
!S && (j || !w) && m(!0);
|
62
62
|
}, W = (t) => {
|
63
63
|
isNaN(t.getTime()) || (k(t), s == null || s({
|
64
64
|
value: y.Date(t, "yyyy-mm-dd"),
|
@@ -68,15 +68,15 @@ const dt = {
|
|
68
68
|
name: c
|
69
69
|
}), r == null || r(y.Date(t, "yyyy-mm-dd"));
|
70
70
|
}, q = (t) => {
|
71
|
-
if (
|
72
|
-
const
|
73
|
-
if (
|
71
|
+
if (w) {
|
72
|
+
const l = t.target.value.replace(/[^\d]/g, "");
|
73
|
+
if (l.length === 0)
|
74
74
|
A(""), s == null || s({ value: "", name: c }), r == null || r("");
|
75
75
|
else {
|
76
76
|
const [I, O, Y] = [
|
77
|
-
L(
|
78
|
-
L(
|
79
|
-
|
77
|
+
L(l.substring(0, 2), st),
|
78
|
+
L(l.substring(2, 4), et),
|
79
|
+
l.substring(4, 8)
|
80
80
|
], $ = [I, O, Y].filter(Boolean).join("/");
|
81
81
|
if (A($), $.length === it) {
|
82
82
|
const B = parseInt(Y), P = /* @__PURE__ */ new Date(
|
@@ -89,7 +89,7 @@ const dt = {
|
|
89
89
|
}
|
90
90
|
}
|
91
91
|
}
|
92
|
-
}, J = _(e.wrapper,
|
92
|
+
}, J = _(e.wrapper, D && e.active), Q = _(e.input, e.inputBorderControl), Z = {
|
93
93
|
onChangeValue: W,
|
94
94
|
date: o || /* @__PURE__ */ new Date(),
|
95
95
|
before: typeof v == "string" ? new Date(v) : v,
|
@@ -114,9 +114,9 @@ const dt = {
|
|
114
114
|
"div",
|
115
115
|
{
|
116
116
|
role: "button",
|
117
|
-
"data-error": n,
|
117
|
+
"data-error": !!n,
|
118
118
|
className: _(e["date-wrapper"], {
|
119
|
-
[e.editable]:
|
119
|
+
[e.editable]: w
|
120
120
|
}),
|
121
121
|
onClick: K,
|
122
122
|
children: /* @__PURE__ */ a(
|
@@ -133,18 +133,18 @@ const dt = {
|
|
133
133
|
onChange: q,
|
134
134
|
rightAddon: {
|
135
135
|
addonType: "react-node",
|
136
|
-
addonContent: /* @__PURE__ */ a(C, { isActive:
|
136
|
+
addonContent: /* @__PURE__ */ a(C, { isActive: D })
|
137
137
|
},
|
138
138
|
onFocus: () => {
|
139
|
-
j && !
|
139
|
+
j && !w && m(!0);
|
140
140
|
},
|
141
|
-
"data-error": n,
|
141
|
+
"data-error": !!n,
|
142
142
|
...E
|
143
143
|
}
|
144
144
|
)
|
145
145
|
}
|
146
146
|
),
|
147
|
-
|
147
|
+
D && /* @__PURE__ */ a(z, { ...Z })
|
148
148
|
] }),
|
149
149
|
n && typeof n == "string" && /* @__PURE__ */ a("div", { className: e.textError, children: n })
|
150
150
|
] });
|
@@ -1,20 +1,20 @@
|
|
1
|
-
import { useRef as
|
1
|
+
import { useRef as x, useEffect as a } from "react";
|
2
2
|
import { BLOCK_WIDTH as f } from "./constants.js";
|
3
|
-
const
|
4
|
-
const t =
|
5
|
-
return
|
6
|
-
var
|
7
|
-
const h = window.innerHeight,
|
3
|
+
const H = (d) => {
|
4
|
+
const t = x(null);
|
5
|
+
return a(() => {
|
6
|
+
var o, r, s, c, l, u;
|
7
|
+
const h = window.innerHeight, y = window.innerWidth;
|
8
8
|
if (t.current !== null) {
|
9
|
-
const
|
10
|
-
if (h <
|
11
|
-
const e =
|
12
|
-
t.current.style.left = (e < 0 ? e / 2 : e) + "px";
|
9
|
+
const w = ((r = (o = t == null ? void 0 : t.current) == null ? void 0 : o.parentElement) == null ? void 0 : r.offsetWidth) ?? 0, p = ((c = (s = t == null ? void 0 : t.current) == null ? void 0 : s.parentElement) == null ? void 0 : c.offsetHeight) ?? 0, n = (u = (l = t == null ? void 0 : t.current) == null ? void 0 : l.parentElement) == null ? void 0 : u.getBoundingClientRect(), i = t.current.offsetHeight;
|
10
|
+
if (h < n.y + i + p ? n.y - i > 0 ? t.current.style.top = -i + "px" : t.current.style.position = "fixed" : t.current.style.top = p + "px", y < n.x + f) {
|
11
|
+
const e = w - f;
|
12
|
+
n.x - e < 0 ? t.current.style.left = (e < 0 ? e / 2 : e) + "px" : t.current.style.left = -e + "px";
|
13
13
|
}
|
14
14
|
t.current.style.opacity = "1";
|
15
15
|
}
|
16
16
|
}, [d]), t;
|
17
17
|
};
|
18
18
|
export {
|
19
|
-
|
19
|
+
H as useDatePickerPosition
|
20
20
|
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { PopoverProps, PopoverPanelProps } from '@headlessui/react';
|
2
|
+
import { ReactNode } from 'react';
|
3
|
+
|
4
|
+
export declare const ANIMATION_DELAY = 300;
|
5
|
+
type TProps = {
|
6
|
+
/**
|
7
|
+
* Пропсы для Popover
|
8
|
+
*/
|
9
|
+
popoverProps?: PopoverProps;
|
10
|
+
/**
|
11
|
+
* Позиция выпадающего меню относительно кнопки.
|
12
|
+
*/
|
13
|
+
position?: PopoverPanelProps['anchor'];
|
14
|
+
/**
|
15
|
+
* Компонент при клике на который выпадающее меню открывается.
|
16
|
+
*/
|
17
|
+
buttonContent?: ReactNode;
|
18
|
+
/**
|
19
|
+
* Компонент выпадающего меню.
|
20
|
+
*/
|
21
|
+
children?: ReactNode | ((props: {
|
22
|
+
close: VoidFunction;
|
23
|
+
}) => JSX.Element);
|
24
|
+
/**
|
25
|
+
* Дополнительный класс для компонента.
|
26
|
+
*/
|
27
|
+
className?: string;
|
28
|
+
/**
|
29
|
+
* Дополнительный класс для кнопки.
|
30
|
+
*/
|
31
|
+
buttonClassName?: string;
|
32
|
+
/**
|
33
|
+
* Дополнительный класс для панели.
|
34
|
+
*/
|
35
|
+
panelClassName?: string;
|
36
|
+
/**
|
37
|
+
* Дополнительный класс для меню.
|
38
|
+
*/
|
39
|
+
menuItemsClassName?: string;
|
40
|
+
};
|
41
|
+
/**
|
42
|
+
* Компонент Dropdown, содержит в себе кнопку и панель выпадающего меню
|
43
|
+
*/
|
44
|
+
export declare const Dropdown: import('react').MemoExoticComponent<({ children, position, popoverProps, className, buttonClassName, panelClassName, menuItemsClassName, buttonContent }: TProps) => import("react/jsx-runtime").JSX.Element>;
|
45
|
+
export {};
|