mimir-ui-kit 1.65.1 → 1.65.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import { FocusEventHandler } from 'react';
2
1
  import { EDatePickerBorderRadius } from './constants';
3
2
  import { TInputProps } from '../Input';
4
3
 
@@ -12,9 +11,9 @@ export type TProps = {
12
11
  */
13
12
  onError?: (e: TDatePickerOnError) => void;
14
13
  /**
15
- * Стандартный обработчик потери фокуса input
14
+ * Функция обратного вызова при потере фокуса компонентом
16
15
  */
17
- onBlur?: FocusEventHandler<HTMLInputElement>;
16
+ onBlur?: (e: TDatePickerFocusEvent) => void;
18
17
  /**
19
18
  * Функция ограничения выбора даты (до какой даты выбор не доступен)
20
19
  */
@@ -97,6 +96,12 @@ export type TDatePickerOnError = {
97
96
  name?: string;
98
97
  active: boolean;
99
98
  };
99
+ export type TDatePickerFocusEvent = {
100
+ target: {
101
+ value: string;
102
+ name?: string;
103
+ };
104
+ };
100
105
  export declare const DatePicker: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<{
101
106
  /**
102
107
  * Функция обратного вызова при изменении значения даты
@@ -107,9 +112,9 @@ export declare const DatePicker: import('react').MemoExoticComponent<import('rea
107
112
  */
108
113
  onError?: (e: TDatePickerOnError) => void;
109
114
  /**
110
- * Стандартный обработчик потери фокуса input
115
+ * Функция обратного вызова при потере фокуса компонентом
111
116
  */
112
- onBlur?: FocusEventHandler<HTMLInputElement>;
117
+ onBlur?: (e: TDatePickerFocusEvent) => void;
113
118
  /**
114
119
  * Функция ограничения выбора даты (до какой даты выбор не доступен)
115
120
  */
@@ -1,146 +1,180 @@
1
- import { jsxs as F, jsx as D } from "react/jsx-runtime";
2
- import { c as v } from "../../index-DIxK0V-G.js";
3
- import { memo as ht, forwardRef as Mt, useState as b, useEffect as P } from "react";
4
- import { months as S, EDatePickerBorderRadius as C, MAX_DAY as gt, MAX_MONTH as Tt, DATE_LENGTH as $t } from "./constants.js";
5
- import { DatePickerModal as bt } from "./DatePickerModal.js";
6
- import { MonthPickerModal as At } from "./MonthPickerModal.js";
1
+ import { jsxs as et, jsx as u } from "react/jsx-runtime";
2
+ import { c as H } from "../../index-DIxK0V-G.js";
3
+ import { memo as It, forwardRef as St, useState as $, useEffect as A } from "react";
4
+ import { months as j, EDatePickerBorderRadius as st, MAX_DAY as rt, MAX_MONTH as at, DATE_LENGTH as ot } from "./constants.js";
5
+ import { DatePickerModal as Pt } from "./DatePickerModal.js";
6
+ import { MonthPickerModal as Yt } from "./MonthPickerModal.js";
7
7
  import { c as m } from "../../styles.module-DjQdoVeY.js";
8
- import { formatDatePart as R } from "./utils.js";
9
- import { YearPickerModal as Pt } from "./YearPickerModal.js";
10
- import { useClickOutside as St } from "../../hooks/useClickOutside/useClickOutside.js";
11
- import { Icon as V } from "../../icons/Icon.js";
12
- import { formating as p } from "../../utils/index.js";
13
- import { I as Yt } from "../../Input-JwHUiwVK.js";
14
- import { EInputStatus as It, EInputSize as tt } from "../Input/constants.js";
15
- const xt = ht(
16
- Mt(
8
+ import { formatDatePart as O } from "./utils.js";
9
+ import { YearPickerModal as xt } from "./YearPickerModal.js";
10
+ import { useClickOutside as Ht } from "../../hooks/useClickOutside/useClickOutside.js";
11
+ import { Icon as it } from "../../icons/Icon.js";
12
+ import { formating as w } from "../../utils/index.js";
13
+ import { I as jt } from "../../Input-JwHUiwVK.js";
14
+ import { EInputStatus as Ot, EInputSize as ct } from "../Input/constants.js";
15
+ const Et = It(
16
+ St(
17
17
  ({
18
- size: H,
19
- value: w,
18
+ size: E,
19
+ value: g,
20
20
  onChangeValue: r,
21
21
  name: d,
22
- before: h,
23
- type: f = "days",
24
- dateFormat: N = "full",
25
- error: B,
26
- onError: g,
27
- onBlur: et,
28
- validateImmediately: G,
29
- variant: st,
30
- disabled: j = !1,
31
- editable: A = !1,
32
- openOnInput: W = !0,
33
- sendIntermediateValues: rt = !1,
34
- disableFuture: q = !1,
35
- disablePast: J = !1,
36
- disabledDate: E,
37
- validRange: a,
38
- borderRadius: L = C.All,
39
- full: ot,
40
- position: at,
41
- isFixed: O = !1,
42
- ...Y
43
- }, ct) => {
44
- const [T, y] = b(!1), [_, u] = b(f), [i, M] = b(
45
- () => w && !isNaN(new Date(w).getTime()) ? new Date(w) : void 0
46
- ), [I, U] = b(B), [it, x] = b(""), [nt, $] = b();
47
- Y.status = !!I && It.Error || Y.status;
48
- const K = () => {
22
+ before: M,
23
+ type: l = "days",
24
+ dateFormat: T = "full",
25
+ error: L,
26
+ onError: b,
27
+ onBlur: D,
28
+ validateImmediately: K,
29
+ variant: nt,
30
+ disabled: _ = !1,
31
+ editable: I = !1,
32
+ openOnInput: Q = !0,
33
+ sendIntermediateValues: ft = !1,
34
+ disableFuture: Z = !1,
35
+ disablePast: z = !1,
36
+ disabledDate: U,
37
+ validRange: n,
38
+ borderRadius: X = st.All,
39
+ full: lt,
40
+ position: mt,
41
+ isFixed: G = !1,
42
+ ...P
43
+ }, dt) => {
44
+ const [k, y] = $(!1), [W, p] = $(l), [f, h] = $(
45
+ () => g && !isNaN(new Date(g).getTime()) ? new Date(g) : void 0
46
+ ), [Y, q] = $(L), [yt, S] = $(""), [Dt, v] = $(), [pt, F] = $(!1);
47
+ P.status = !!Y && Ot.Error || P.status, A(() => {
48
+ !k && pt && (D == null || D({
49
+ target: {
50
+ value: f ? w.Date(f, "yyyy-mm-dd") : "",
51
+ name: d
52
+ }
53
+ })), F(k);
54
+ }, [k]);
55
+ const wt = (t) => {
56
+ var s;
57
+ if ((s = t.relatedTarget) != null && s.closest('[data-name="calendar-modal"]')) return;
58
+ F(!1);
59
+ const e = t.target.value.replace(/[^\d]/g, "");
60
+ if (e.length === 0)
61
+ S(""), h(void 0), t.target && (D == null || D({ target: { value: "", name: d } }));
62
+ else {
63
+ const [i, a, c] = [
64
+ O(e.substring(0, 2), rt),
65
+ O(e.substring(2, 4), at),
66
+ e.substring(4, 8)
67
+ ];
68
+ let o = c;
69
+ if (c.length === 2 && (o = "20" + c), [i, a, o].filter(Boolean).join("/").length === ot) {
70
+ const tt = parseInt(o), x = /* @__PURE__ */ new Date(
71
+ `${tt}-${a.padStart(2, "0")}-${i.padStart(2, "0")}`
72
+ );
73
+ isNaN(x.getTime()) || (h(x), r == null || r({
74
+ value: w.Date(x, "yyyy-mm-dd"),
75
+ name: d
76
+ }), t.target && (D == null || D({
77
+ target: { value: w.Date(x, "yyyy-mm-dd"), name: d }
78
+ })));
79
+ } else
80
+ t.target && (D == null || D({ target: { value: "Invalid date" } }));
81
+ }
82
+ }, B = () => {
49
83
  y(!1);
50
84
  };
51
- P(() => {
52
- if (!(!T || !O))
53
- return window.addEventListener("scroll", K, !0), () => window.removeEventListener("scroll", K, !0);
54
- }, [T, O]), P(() => {
55
- U(B);
56
- }, [B]), P(() => {
57
- M(
58
- w && !isNaN(new Date(w).getTime()) ? new Date(w) : void 0
85
+ A(() => {
86
+ if (!(!k || !G))
87
+ return window.addEventListener("scroll", B, !0), () => window.removeEventListener("scroll", B, !0);
88
+ }, [k, G]), A(() => {
89
+ q(L);
90
+ }, [L]), A(() => {
91
+ h(
92
+ g && !isNaN(new Date(g).getTime()) ? new Date(g) : void 0
59
93
  );
60
- }, [w]), P(() => {
61
- if (i && typeof i != "string" && !isNaN(i == null ? void 0 : i.getTime())) {
94
+ }, [g]), A(() => {
95
+ if (f && typeof f != "string" && !isNaN(f == null ? void 0 : f.getTime())) {
62
96
  let t = "";
63
- switch (N) {
97
+ switch (T) {
64
98
  case "year": {
65
- t = i.getFullYear().toString();
99
+ t = f.getFullYear().toString();
66
100
  break;
67
101
  }
68
102
  case "month": {
69
- const s = S[i.getMonth()], e = i.getFullYear();
70
- t = `${s} ${e}`;
103
+ const e = j[f.getMonth()], s = f.getFullYear();
104
+ t = `${e} ${s}`;
71
105
  break;
72
106
  }
73
107
  case "full": {
74
- t = p.Date(i, "dd/mm/yyyy");
108
+ t = w.Date(f, "dd/mm/yyyy");
75
109
  break;
76
110
  }
77
111
  default: {
78
- t = p.Date(i, "dd/mm/yyyy");
112
+ t = w.Date(f, "dd/mm/yyyy");
79
113
  break;
80
114
  }
81
115
  }
82
- x(t);
116
+ S(t);
83
117
  } else
84
- x("");
85
- }, [i, N]);
86
- const Q = w && new Date(w).getTime;
87
- P(() => {
88
- G && (Q ? (U(!1), g == null || g({ name: d, active: !1 })) : (U(!0), g == null || g({ name: d, active: !0 })));
89
- }, [G, d, Q]), St({
90
- isActive: T,
118
+ S("");
119
+ }, [f, T]);
120
+ const C = g && new Date(g).getTime;
121
+ A(() => {
122
+ K && (C ? (q(!1), b == null || b({ name: d, active: !1 })) : (q(!0), b == null || b({ name: d, active: !0 })));
123
+ }, [K, d, C]), Ht({
124
+ isActive: k,
91
125
  setActive: (t) => {
92
- y(t), u(f), t || $(void 0);
126
+ y(t), p(l), t || v(void 0);
93
127
  },
94
128
  className: m["calendar-block"]
95
129
  });
96
- const ft = () => {
97
- !j && (W || !A) && y(!0);
98
- }, Z = (t) => {
99
- const s = t.getTime();
100
- if (t.setHours(0, 0, 0, 0), h && (typeof h == "string" ? new Date(h) : h).getTime() > s)
130
+ const ut = () => {
131
+ !_ && (Q || !I) && y(!0);
132
+ }, R = (t) => {
133
+ const e = t.getTime();
134
+ if (t.setHours(0, 0, 0, 0), M && (typeof M == "string" ? new Date(M) : M).getTime() > e)
101
135
  return !1;
102
- if (q) {
103
- const e = /* @__PURE__ */ new Date();
104
- if (e.setHours(0, 0, 0, 0), t.getTime() > e.getTime()) return !1;
136
+ if (Z) {
137
+ const s = /* @__PURE__ */ new Date();
138
+ if (s.setHours(0, 0, 0, 0), t.getTime() > s.getTime()) return !1;
105
139
  }
106
- if (J) {
107
- const e = /* @__PURE__ */ new Date();
108
- if (e.setHours(0, 0, 0, 0), s < e.getTime()) return !1;
140
+ if (z) {
141
+ const s = /* @__PURE__ */ new Date();
142
+ if (s.setHours(0, 0, 0, 0), e < s.getTime()) return !1;
109
143
  }
110
- if (E && E(t)) return !1;
111
- if (a) {
112
- let e;
113
- typeof a[0] == "string" ? e = [
114
- new Date(a[0]),
115
- typeof a[1] == "string" ? new Date(a[1]) : a[1]
116
- ] : e = [
117
- a[0],
118
- typeof a[1] == "string" ? new Date(a[1]) : a[1]
144
+ if (U && U(t)) return !1;
145
+ if (n) {
146
+ let s;
147
+ typeof n[0] == "string" ? s = [
148
+ new Date(n[0]),
149
+ typeof n[1] == "string" ? new Date(n[1]) : n[1]
150
+ ] : s = [
151
+ n[0],
152
+ typeof n[1] == "string" ? new Date(n[1]) : n[1]
119
153
  ];
120
- const [c, o] = e, l = new Date(c), n = new Date(o);
121
- if (l.setHours(0, 0, 0, 0), n.setHours(23, 59, 59, 999), t < l || t > n) return !1;
154
+ const [i, a] = s, c = new Date(i), o = new Date(a);
155
+ if (c.setHours(0, 0, 0, 0), o.setHours(23, 59, 59, 999), t < c || t > o) return !1;
122
156
  }
123
157
  return !0;
124
- }, lt = (t) => {
158
+ }, Nt = (t) => {
125
159
  if (!isNaN(t.getTime())) {
126
- M(t), $(void 0);
160
+ h(t), v(void 0);
127
161
  let e = "";
128
- switch (N) {
162
+ switch (T) {
129
163
  case "year": {
130
164
  e = t.getFullYear().toString();
131
165
  break;
132
166
  }
133
167
  case "month": {
134
- const c = S[t.getMonth()], o = t.getFullYear();
135
- e = `${c} ${o}`;
168
+ const s = j[t.getMonth()], i = t.getFullYear();
169
+ e = `${s} ${i}`;
136
170
  break;
137
171
  }
138
172
  case "full": {
139
- e = p.Date(t, "yyyy-mm-dd");
173
+ e = w.Date(t, "yyyy-mm-dd");
140
174
  break;
141
175
  }
142
176
  default: {
143
- e = p.Date(t, "yyyy-mm-dd");
177
+ e = w.Date(t, "yyyy-mm-dd");
144
178
  break;
145
179
  }
146
180
  }
@@ -149,232 +183,208 @@ const xt = ht(
149
183
  name: d
150
184
  });
151
185
  }
152
- _ === "years" && (f === "years" ? (y(!1), u(f)) : u("months")), _ === "months" && (f === "months" ? (y(!1), u(f)) : u("days")), M(t);
153
- let s = "";
154
- switch (N) {
155
- case "year": {
156
- s = t.getFullYear().toString();
157
- break;
158
- }
159
- case "month": {
160
- const e = S[t.getMonth()], c = t.getFullYear();
161
- s = `${e} ${c}`;
162
- break;
163
- }
164
- case "full": {
165
- s = p.Date(t, "yyyy-mm-dd");
166
- break;
167
- }
168
- default: {
169
- s = p.Date(t, "yyyy-mm-dd");
170
- break;
171
- }
172
- }
173
- r == null || r({
174
- value: s,
175
- name: d
176
- });
177
- }, mt = (t) => {
178
- const s = i || /* @__PURE__ */ new Date(), e = s.getDate(), c = s.getMonth() + 1, o = new Date(t, c - 1, e);
179
- if (o.getFullYear() === t && o.getMonth() === c - 1 && o.getDate() === e && Z(o)) {
180
- M(o), $(void 0);
181
- let l = "";
182
- switch (N) {
186
+ W === "years" && (l === "years" ? (y(!1), p(l)) : p("months")), W === "months" && (l === "months" ? (y(!1), p(l)) : p("days")), h(t);
187
+ }, gt = (t) => {
188
+ const e = f || /* @__PURE__ */ new Date(), s = e.getDate(), i = e.getMonth() + 1, a = new Date(t, i - 1, s);
189
+ if (a.getFullYear() === t && a.getMonth() === i - 1 && a.getDate() === s && R(a)) {
190
+ h(a), v(void 0);
191
+ let c = "";
192
+ switch (T) {
183
193
  case "year": {
184
- l = t.toString();
194
+ c = t.toString();
185
195
  break;
186
196
  }
187
197
  case "month": {
188
- l = `${S[c - 1]} ${t}`;
198
+ c = `${j[i - 1]} ${t}`;
189
199
  break;
190
200
  }
191
201
  case "full": {
192
- l = p.Date(o, "yyyy-mm-dd");
202
+ c = w.Date(a, "yyyy-mm-dd");
193
203
  break;
194
204
  }
195
205
  default: {
196
- l = p.Date(o, "yyyy-mm-dd");
206
+ c = w.Date(a, "yyyy-mm-dd");
197
207
  break;
198
208
  }
199
209
  }
200
210
  if (r == null || r({
201
- value: l,
211
+ value: c,
202
212
  name: d
203
- }), f === "years") {
204
- y(!1), u(f);
213
+ }), l === "years") {
214
+ y(!1), p(l);
205
215
  return;
206
216
  }
207
217
  } else
208
- $(new Date(t, c - 1, 1));
209
- f === "years" ? (y(!1), u(f)) : u("months");
210
- }, yt = (t, s) => {
211
- const c = (i || /* @__PURE__ */ new Date()).getDate(), o = new Date(t, s, 0).getDate(), l = Math.min(c, o), n = new Date(t, s - 1, l);
212
- if (n.getFullYear() === t && n.getMonth() === s - 1 && n.getDate() === l && Z(n)) {
213
- M(n), $(void 0);
214
- let k = "";
215
- switch (N) {
218
+ v(new Date(t, i - 1, 1));
219
+ l === "years" ? (y(!1), p(l)) : p("months");
220
+ }, kt = (t, e) => {
221
+ const i = (f || /* @__PURE__ */ new Date()).getDate(), a = new Date(t, e, 0).getDate(), c = Math.min(i, a), o = new Date(t, e - 1, c);
222
+ if (o.getFullYear() === t && o.getMonth() === e - 1 && o.getDate() === c && R(o)) {
223
+ h(o), v(void 0);
224
+ let N = "";
225
+ switch (T) {
216
226
  case "year": {
217
- k = t.toString();
227
+ N = t.toString();
218
228
  break;
219
229
  }
220
230
  case "month": {
221
- k = `${S[s - 1]} ${t}`;
231
+ N = `${j[e - 1]} ${t}`;
222
232
  break;
223
233
  }
224
234
  case "full": {
225
- k = p.Date(n, "yyyy-mm-dd");
235
+ N = w.Date(o, "yyyy-mm-dd");
226
236
  break;
227
237
  }
228
238
  default: {
229
- k = p.Date(n, "yyyy-mm-dd");
239
+ N = w.Date(o, "yyyy-mm-dd");
230
240
  break;
231
241
  }
232
242
  }
233
243
  if (r == null || r({
234
- value: k,
244
+ value: N,
235
245
  name: d
236
- }), f === "months") {
237
- y(!1), u(f);
246
+ }), l === "months") {
247
+ y(!1), p(l);
238
248
  return;
239
249
  }
240
250
  } else
241
- $(new Date(t, s - 1, 1));
242
- f === "months" ? (y(!1), u(f)) : u("days");
243
- }, ut = (t) => {
244
- if (A || t.target.value === "") {
245
- const s = t.target.value.replace(/[^\d]/g, "");
246
- if (s.length === 0)
247
- x(""), M(void 0), y(!1), r == null || r({ value: "", name: d });
251
+ v(new Date(t, e - 1, 1));
252
+ l === "months" ? (y(!1), p(l)) : p("days");
253
+ }, ht = (t) => {
254
+ if (I || t.target.value === "") {
255
+ const e = t.target.value.replace(/[^\d]/g, "");
256
+ if (e.length === 0)
257
+ S(""), h(void 0), y(!1), r == null || r({ value: "", name: d });
248
258
  else {
249
- const [e, c, o] = [
250
- R(s.substring(0, 2), gt),
251
- R(s.substring(2, 4), Tt),
252
- s.substring(4, 8)
253
- ], l = [e, c, o].filter(Boolean).join("/");
254
- if (x(l), rt) {
255
- const n = o ? `${o}-${c || "00"}-${e || "00"}` : [e, c, o].filter(Boolean).join("-");
259
+ const [s, i, a] = [
260
+ O(e.substring(0, 2), rt),
261
+ O(e.substring(2, 4), at),
262
+ e.substring(4, 8)
263
+ ], c = [s, i, a].filter(Boolean).join("/");
264
+ if (S(c), ft) {
265
+ const o = a ? `${a}-${i || "00"}-${s || "00"}` : [s, i, a].filter(Boolean).join("-");
256
266
  r == null || r({
257
- value: n,
267
+ value: o,
258
268
  name: d
259
269
  });
260
270
  }
261
- if (l.length === $t) {
262
- const n = parseInt(o), k = /* @__PURE__ */ new Date(
263
- `${n}-${c.padStart(2, "0")}-${e.padStart(2, "0")}`
271
+ if (c.length === ot) {
272
+ const o = parseInt(a), N = /* @__PURE__ */ new Date(
273
+ `${o}-${i.padStart(2, "0")}-${s.padStart(2, "0")}`
264
274
  );
265
- isNaN(k.getTime()) || (M(k), r == null || r({
266
- value: p.Date(k, "yyyy-mm-dd"),
275
+ isNaN(N.getTime()) || (h(N), r == null || r({
276
+ value: w.Date(N, "yyyy-mm-dd"),
267
277
  name: d
268
278
  }));
269
279
  }
270
280
  }
271
281
  }
272
- }, Dt = v(
282
+ }, Mt = H(
273
283
  m.wrapper,
274
- T && !A && m.active
275
- ), pt = v(m.input, m.inputBorderControl);
276
- let z;
277
- if (a) {
278
- let t, s;
279
- typeof a[0] == "string" ? t = new Date(a[0]) : t = a[0], typeof a[1] == "string" ? s = new Date(a[1]) : s = a[1], z = [t, s];
284
+ k && !I && m.active
285
+ ), Tt = H(m.input, m.inputBorderControl);
286
+ let V;
287
+ if (n) {
288
+ let t, e;
289
+ typeof n[0] == "string" ? t = new Date(n[0]) : t = n[0], typeof n[1] == "string" ? e = new Date(n[1]) : e = n[1], V = [t, e];
280
290
  }
281
- const X = {
282
- onChangeValue: lt,
283
- date: nt || i || /* @__PURE__ */ new Date(),
284
- selectedDate: i,
285
- before: typeof h == "string" ? new Date(h) : h,
286
- onChangeType: u,
291
+ const J = {
292
+ onChangeValue: Nt,
293
+ date: Dt || f || /* @__PURE__ */ new Date(),
294
+ selectedDate: f,
295
+ before: typeof M == "string" ? new Date(M) : M,
296
+ onChangeType: p,
287
297
  setIsActive: y,
288
- disableFuture: q,
289
- disablePast: J,
290
- disabledDate: E,
291
- validRange: z,
292
- dateFormat: N,
293
- position: at,
294
- isFixed: O
295
- }, dt = {
296
- ...X,
297
- onChangeMonth: yt,
298
- dateFormat: N
299
- }, wt = {
300
- ...X,
301
- onChangeYear: mt
302
- }, kt = (() => {
303
- switch (_) {
298
+ disableFuture: Z,
299
+ disablePast: z,
300
+ disabledDate: U,
301
+ validRange: V,
302
+ dateFormat: T,
303
+ position: mt,
304
+ isFixed: G
305
+ }, $t = {
306
+ ...J,
307
+ onChangeMonth: kt,
308
+ dateFormat: T
309
+ }, bt = {
310
+ ...J,
311
+ onChangeYear: gt
312
+ }, vt = (() => {
313
+ switch (W) {
304
314
  case "months":
305
- return () => /* @__PURE__ */ D(At, { ...dt });
315
+ return () => /* @__PURE__ */ u(Yt, { ...$t });
306
316
  case "years":
307
- return () => /* @__PURE__ */ D(Pt, { ...wt });
317
+ return () => /* @__PURE__ */ u(xt, { ...bt });
308
318
  default:
309
- return () => /* @__PURE__ */ D(bt, { ...X });
319
+ return () => /* @__PURE__ */ u(Pt, { ...J });
310
320
  }
311
- })(), Nt = ({ isActive: t }) => /* @__PURE__ */ D("button", { onClick: (e) => {
312
- e.stopPropagation(), j || y(!t);
313
- }, className: m["icon-button"], children: t ? /* @__PURE__ */ D(
314
- V,
321
+ })(), At = ({ isActive: t }) => /* @__PURE__ */ u("button", { onClick: (s) => {
322
+ s.stopPropagation(), _ || y(!t);
323
+ }, className: m["icon-button"], children: t ? /* @__PURE__ */ u(
324
+ it,
315
325
  {
316
- iconName: H === tt.S ? "DropdownArrowUp16px" : "DropdownArrowUp24px"
326
+ iconName: E === ct.S ? "DropdownArrowUp16px" : "DropdownArrowUp24px"
317
327
  }
318
- ) : /* @__PURE__ */ D(
319
- V,
328
+ ) : /* @__PURE__ */ u(
329
+ it,
320
330
  {
321
- iconName: H === tt.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px"
331
+ iconName: E === ct.S ? "DropdownArrowBottom16px" : "DropdownArrowDown24px"
322
332
  }
323
333
  ) });
324
- return /* @__PURE__ */ F(
334
+ return /* @__PURE__ */ et(
325
335
  "div",
326
336
  {
327
- className: v(m["input-field-group-datePicker"], {
328
- [m.full]: ot
337
+ className: H(m["input-field-group-datePicker"], {
338
+ [m.full]: lt
329
339
  }),
330
340
  children: [
331
- /* @__PURE__ */ F("div", { className: Dt, "data-disabled": j, children: [
332
- /* @__PURE__ */ D(
341
+ /* @__PURE__ */ et("div", { className: Mt, "data-disabled": _, children: [
342
+ /* @__PURE__ */ u(
333
343
  "div",
334
344
  {
335
345
  role: "button",
336
- "data-status": Y.status,
337
- className: v(m["date-wrapper"], {
338
- [m.editable]: A,
339
- [m[`border-radius-${L}`]]: L !== C.All
346
+ "data-status": P.status,
347
+ className: H(m["date-wrapper"], {
348
+ [m.editable]: I,
349
+ [m[`border-radius-${X}`]]: X !== st.All
340
350
  }),
341
- onClick: ft,
342
- children: /* @__PURE__ */ D(
343
- Yt,
351
+ onClick: ut,
352
+ children: /* @__PURE__ */ u(
353
+ jt,
344
354
  {
345
- ref: ct,
346
- className: pt,
355
+ ref: dt,
356
+ className: Tt,
347
357
  wrapperClassName: m["input-wrapper"],
348
- size: H,
358
+ size: E,
349
359
  type: "text",
350
- variant: st,
351
- value: it,
352
- onChange: ut,
360
+ variant: nt,
361
+ value: yt,
362
+ onChange: ht,
353
363
  rightAddon: {
354
364
  addonType: "react-node",
355
- addonContent: /* @__PURE__ */ D(Nt, { isActive: T })
365
+ addonContent: /* @__PURE__ */ u(At, { isActive: k })
356
366
  },
357
367
  rightSlotClassName: m["right-slot"],
358
368
  onFocus: () => {
359
- W && !A && y(!0);
369
+ Q && !I && y(!0);
360
370
  },
361
- borderRadius: L,
362
- ...Y,
363
- onBlur: et
371
+ onBlur: wt,
372
+ borderRadius: X,
373
+ ...P
364
374
  }
365
375
  )
366
376
  }
367
377
  ),
368
- T && /* @__PURE__ */ D(kt, {})
378
+ k && /* @__PURE__ */ u(vt, {})
369
379
  ] }),
370
- I && typeof I == "string" && /* @__PURE__ */ D("div", { className: m.textError, children: I })
380
+ Y && typeof Y == "string" && /* @__PURE__ */ u("div", { className: m.textError, children: Y })
371
381
  ]
372
382
  }
373
383
  );
374
384
  }
375
385
  )
376
386
  );
377
- xt.displayName = "DatePicker";
387
+ Et.displayName = "DatePicker";
378
388
  export {
379
- xt as DatePicker
389
+ Et as DatePicker
380
390
  };
@@ -93,6 +93,7 @@ const it = ({
93
93
  className: g(n["calendar-block"], b && n.fixed),
94
94
  ref: L,
95
95
  "data-testid": "calendar-modal",
96
+ "data-name": "calendar-modal",
96
97
  children: [
97
98
  /* @__PURE__ */ u("div", { className: n.h, children: [
98
99
  /* @__PURE__ */ a(
@@ -1,37 +1,37 @@
1
1
  import { jsx as z, jsxs as De, Fragment as nt } from "react/jsx-runtime";
2
2
  import { c as fe } from "../../index-DIxK0V-G.js";
3
- import E, { createContext as ie, useState as J, useContext as re, useRef as A, useEffect as te, useMemo as q, Fragment as ve, useReducer as rt, createRef as ke, useId as be, memo as ot, useCallback as ce } from "react";
3
+ import E, { createContext as ie, useState as J, useContext as re, useRef as A, useEffect as te, useMemo as q, Fragment as ve, useReducer as rt, createRef as Fe, useId as be, memo as ot, useCallback as ce } from "react";
4
4
  import { u as lt, c as U } from "../../hooks-HgN6Yauq.js";
5
5
  import { Button as at } from "../Button/Button.js";
6
- import { o as T, u as He, M as me, W as Y, y as ne, O as ae, n as de, m as ut, t as it, H as se, s as Fe, p as st, a as V, T as ct, $ as dt, b as pt, D as Be, I as ft, c as le } from "../../keyboard-wis2TUql.js";
6
+ import { o as T, u as He, M as me, W as Y, y as ne, O as ae, n as de, m as ut, t as it, H as se, s as ke, p as st, a as V, T as ct, $ as dt, b as pt, D as Be, I as ft, c as le } from "../../keyboard-wis2TUql.js";
7
7
  import { w as vt } from "../../use-active-press-CnDeVvQq.js";
8
- import { n as ye, s as mt, l as Ke, e as bt, E as ht, R as Pt, v as yt, y as $t, x as Et, a as St, b as gt, m as Tt, f as wt, d as It, t as kt } from "../../portal-BnEqSZwo.js";
9
- import { e as Ft } from "../../use-resolve-button-type-DhFdPxnv.js";
8
+ import { n as ye, s as mt, l as Ke, e as bt, E as ht, R as Pt, v as yt, y as $t, x as Et, a as St, b as gt, m as Tt, f as wt, d as It, t as Ft } from "../../portal-BnEqSZwo.js";
9
+ import { e as kt } from "../../use-resolve-button-type-DhFdPxnv.js";
10
10
  import { T as he, s as Pe } from "../../hidden-CkTYbiNM.js";
11
11
  import { R as Oe, H as xe, i as X, c as Ge, u as $e, s as Bt } from "../../open-closed-CJijMeI2.js";
12
12
  import { C as Mt } from "../../close-provider-CEutdhG8.js";
13
13
  import { r as Ue } from "../../bugs-diTMAGNw.js";
14
14
  import { b as Re, P as ue, F as ee, A as Nt, h as Lt, T as Me } from "../../focus-management-BAl0GmRk.js";
15
15
  import { f as Ot } from "../../use-is-mounted-MBU4fiLr.js";
16
- function xt({ defaultContainers: e = [], portals: t, mainTreeNode: o } = {}) {
17
- let c = ye(o), p = T(() => {
16
+ function xt({ defaultContainers: e = [], portals: t, mainTreeNode: r } = {}) {
17
+ let c = ye(r), p = T(() => {
18
18
  var P, m;
19
19
  let l = [];
20
- for (let r of e) r !== null && (r instanceof HTMLElement ? l.push(r) : "current" in r && r.current instanceof HTMLElement && l.push(r.current));
21
- if (t != null && t.current) for (let r of t.current) l.push(r);
22
- for (let r of (P = c == null ? void 0 : c.querySelectorAll("html > *, body > *")) != null ? P : []) r !== document.body && r !== document.head && r instanceof HTMLElement && r.id !== "headlessui-portal-root" && (o && (r.contains(o) || r.contains((m = o == null ? void 0 : o.getRootNode()) == null ? void 0 : m.host)) || l.some((h) => r.contains(h)) || l.push(r));
20
+ for (let o of e) o !== null && (o instanceof HTMLElement ? l.push(o) : "current" in o && o.current instanceof HTMLElement && l.push(o.current));
21
+ if (t != null && t.current) for (let o of t.current) l.push(o);
22
+ for (let o of (P = c == null ? void 0 : c.querySelectorAll("html > *, body > *")) != null ? P : []) o !== document.body && o !== document.head && o instanceof HTMLElement && o.id !== "headlessui-portal-root" && (r && (o.contains(r) || o.contains((m = r == null ? void 0 : r.getRootNode()) == null ? void 0 : m.host)) || l.some((h) => o.contains(h)) || l.push(o));
23
23
  return l;
24
24
  });
25
25
  return { resolveContainers: p, contains: T((P) => p().some((m) => m.contains(P))) };
26
26
  }
27
27
  let je = ie(null);
28
28
  function We({ children: e, node: t }) {
29
- let [o, c] = J(null), p = Xe(t ?? o);
29
+ let [r, c] = J(null), p = Xe(t ?? r);
30
30
  return E.createElement(je.Provider, { value: p }, e, p === null && E.createElement(he, { features: Pe.Hidden, ref: (P) => {
31
31
  var m, l;
32
32
  if (P) {
33
- for (let r of (l = (m = He(P)) == null ? void 0 : m.querySelectorAll("html > *, body > *")) != null ? l : []) if (r !== document.body && r !== document.head && r instanceof HTMLElement && r != null && r.contains(P)) {
34
- c(r);
33
+ for (let o of (l = (m = He(P)) == null ? void 0 : m.querySelectorAll("html > *, body > *")) != null ? l : []) if (o !== document.body && o !== document.head && o instanceof HTMLElement && o != null && o.contains(P)) {
34
+ c(o);
35
35
  break;
36
36
  }
37
37
  }
@@ -71,7 +71,7 @@ function ge(e) {
71
71
  return "children" in e ? ge(e.children) : e.current.filter(({ el: t }) => t.current !== null).filter(({ state: t }) => t === "visible").length > 0;
72
72
  }
73
73
  function Je(e, t) {
74
- let o = Fe(e), c = A([]), p = Ot(), P = st(), m = T((d, a = ae.Hidden) => {
74
+ let r = ke(e), c = A([]), p = Ot(), P = st(), m = T((d, a = ae.Hidden) => {
75
75
  let s = c.current.findIndex(({ el: u }) => u === d);
76
76
  s !== -1 && (V(a, { [ae.Unmount]() {
77
77
  c.current.splice(s, 1);
@@ -79,43 +79,43 @@ function Je(e, t) {
79
79
  c.current[s].state = "hidden";
80
80
  } }), P.microTask(() => {
81
81
  var u;
82
- !ge(c) && p.current && ((u = o.current) == null || u.call(o));
82
+ !ge(c) && p.current && ((u = r.current) == null || u.call(r));
83
83
  }));
84
84
  }), l = T((d) => {
85
85
  let a = c.current.find(({ el: s }) => s === d);
86
86
  return a ? a.state !== "visible" && (a.state = "visible") : c.current.push({ el: d, state: "visible" }), () => m(d, ae.Unmount);
87
- }), r = A([]), h = A(Promise.resolve()), n = A({ enter: [], leave: [] }), f = T((d, a, s) => {
88
- r.current.splice(0), t && (t.chains.current[a] = t.chains.current[a].filter(([u]) => u !== d)), t == null || t.chains.current[a].push([d, new Promise((u) => {
89
- r.current.push(u);
87
+ }), o = A([]), h = A(Promise.resolve()), n = A({ enter: [], leave: [] }), f = T((d, a, s) => {
88
+ o.current.splice(0), t && (t.chains.current[a] = t.chains.current[a].filter(([u]) => u !== d)), t == null || t.chains.current[a].push([d, new Promise((u) => {
89
+ o.current.push(u);
90
90
  })]), t == null || t.chains.current[a].push([d, new Promise((u) => {
91
91
  Promise.all(n.current[a].map(([v, g]) => g)).then(() => u());
92
92
  })]), a === "enter" ? h.current = h.current.then(() => t == null ? void 0 : t.wait.current).then(() => s(a)) : s(a);
93
93
  }), $ = T((d, a, s) => {
94
94
  Promise.all(n.current[a].splice(0).map(([u, v]) => v)).then(() => {
95
95
  var u;
96
- (u = r.current.shift()) == null || u();
96
+ (u = o.current.shift()) == null || u();
97
97
  }).then(() => s(a));
98
98
  });
99
99
  return q(() => ({ children: c, register: l, unregister: m, onStart: f, onStop: $, wait: h, chains: n }), [l, m, c, f, $, n, h]);
100
100
  }
101
101
  let Qe = ve, Ve = me.RenderStrategy;
102
102
  function Ct(e, t) {
103
- var o, c;
104
- let { transition: p = !0, beforeEnter: P, afterEnter: m, beforeLeave: l, afterLeave: r, enter: h, enterFrom: n, enterTo: f, entered: $, leave: d, leaveFrom: a, leaveTo: s, ...u } = e, [v, g] = J(null), S = A(null), B = qe(e), D = ne(...B ? [S, t, g] : t === null ? [] : [t]), C = (o = u.unmount) == null || o ? ae.Unmount : ae.Hidden, { show: F, appear: N, initial: Z } = _t(), [M, L] = J(F ? "visible" : "hidden"), G = At(), { register: O, unregister: x } = G;
103
+ var r, c;
104
+ let { transition: p = !0, beforeEnter: P, afterEnter: m, beforeLeave: l, afterLeave: o, enter: h, enterFrom: n, enterTo: f, entered: $, leave: d, leaveFrom: a, leaveTo: s, ...u } = e, [v, g] = J(null), S = A(null), B = qe(e), D = ne(...B ? [S, t, g] : t === null ? [] : [t]), C = (r = u.unmount) == null || r ? ae.Unmount : ae.Hidden, { show: k, appear: N, initial: Z } = _t(), [M, L] = J(k ? "visible" : "hidden"), G = At(), { register: O, unregister: x } = G;
105
105
  de(() => O(S), [O, S]), de(() => {
106
106
  if (C === ae.Hidden && S.current) {
107
- if (F && M !== "visible") {
107
+ if (k && M !== "visible") {
108
108
  L("visible");
109
109
  return;
110
110
  }
111
111
  return V(M, { hidden: () => x(S), visible: () => O(S) });
112
112
  }
113
- }, [M, S, O, x, F, C]);
113
+ }, [M, S, O, x, k, C]);
114
114
  let H = Ke();
115
115
  de(() => {
116
116
  if (B && H && M === "visible" && S.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
117
117
  }, [S, M, H, B]);
118
- let R = Z && !N, _ = N && F && Z, y = A(!1), i = Je(() => {
118
+ let R = Z && !N, _ = N && k && Z, y = A(!1), i = Je(() => {
119
119
  y.current || (L("hidden"), x(S));
120
120
  }, G), b = T((W) => {
121
121
  y.current = !0;
@@ -126,30 +126,30 @@ function Ct(e, t) {
126
126
  }), w = T((W) => {
127
127
  let oe = W ? "enter" : "leave";
128
128
  y.current = !1, i.onStop(S, oe, (pe) => {
129
- pe === "enter" ? m == null || m() : pe === "leave" && (r == null || r());
129
+ pe === "enter" ? m == null || m() : pe === "leave" && (o == null || o());
130
130
  }), oe === "leave" && !ge(i) && (L("hidden"), x(S));
131
131
  });
132
132
  te(() => {
133
- B && p || (b(F), w(F));
134
- }, [F, B, p]);
135
- let I = !(!p || !B || !H || R), [, k] = Oe(I, v, F, { start: b, end: w }), K = ut({ ref: D, className: ((c = it(u.className, _ && h, _ && n, k.enter && h, k.enter && k.closed && n, k.enter && !k.closed && f, k.leave && d, k.leave && !k.closed && a, k.leave && k.closed && s, !k.transition && F && $)) == null ? void 0 : c.trim()) || void 0, ...xe(k) }), j = 0;
136
- return M === "visible" && (j |= X.Open), M === "hidden" && (j |= X.Closed), k.enter && (j |= X.Opening), k.leave && (j |= X.Closing), E.createElement(Se.Provider, { value: i }, E.createElement(Ge, { value: j }, se({ ourProps: K, theirProps: u, defaultTag: Qe, features: Ve, visible: M === "visible", name: "Transition.Child" })));
133
+ B && p || (b(k), w(k));
134
+ }, [k, B, p]);
135
+ let I = !(!p || !B || !H || R), [, F] = Oe(I, v, k, { start: b, end: w }), K = ut({ ref: D, className: ((c = it(u.className, _ && h, _ && n, F.enter && h, F.enter && F.closed && n, F.enter && !F.closed && f, F.leave && d, F.leave && !F.closed && a, F.leave && F.closed && s, !F.transition && k && $)) == null ? void 0 : c.trim()) || void 0, ...xe(F) }), j = 0;
136
+ return M === "visible" && (j |= X.Open), M === "hidden" && (j |= X.Closed), F.enter && (j |= X.Opening), F.leave && (j |= X.Closing), E.createElement(Se.Provider, { value: i }, E.createElement(Ge, { value: j }, se({ ourProps: K, theirProps: u, defaultTag: Qe, features: Ve, visible: M === "visible", name: "Transition.Child" })));
137
137
  }
138
138
  function Dt(e, t) {
139
- let { show: o, appear: c = !1, unmount: p = !0, ...P } = e, m = A(null), l = qe(e), r = ne(...l ? [m, t] : t === null ? [] : [t]);
139
+ let { show: r, appear: c = !1, unmount: p = !0, ...P } = e, m = A(null), l = qe(e), o = ne(...l ? [m, t] : t === null ? [] : [t]);
140
140
  Ke();
141
141
  let h = $e();
142
- if (o === void 0 && h !== null && (o = (h & X.Open) === X.Open), o === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
143
- let [n, f] = J(o ? "visible" : "hidden"), $ = Je(() => {
144
- o || f("hidden");
145
- }), [d, a] = J(!0), s = A([o]);
142
+ if (r === void 0 && h !== null && (r = (h & X.Open) === X.Open), r === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
143
+ let [n, f] = J(r ? "visible" : "hidden"), $ = Je(() => {
144
+ r || f("hidden");
145
+ }), [d, a] = J(!0), s = A([r]);
146
146
  de(() => {
147
- d !== !1 && s.current[s.current.length - 1] !== o && (s.current.push(o), a(!1));
148
- }, [s, o]);
149
- let u = q(() => ({ show: o, appear: c, initial: d }), [o, c, d]);
147
+ d !== !1 && s.current[s.current.length - 1] !== r && (s.current.push(r), a(!1));
148
+ }, [s, r]);
149
+ let u = q(() => ({ show: r, appear: c, initial: d }), [r, c, d]);
150
150
  de(() => {
151
- o ? f("visible") : !ge($) && m.current !== null && f("hidden");
152
- }, [o, $]);
151
+ r ? f("visible") : !ge($) && m.current !== null && f("hidden");
152
+ }, [r, $]);
153
153
  let v = { unmount: p }, g = T(() => {
154
154
  var B;
155
155
  d && a(!1), (B = e.beforeEnter) == null || B.call(e);
@@ -157,11 +157,11 @@ function Dt(e, t) {
157
157
  var B;
158
158
  d && a(!1), (B = e.beforeLeave) == null || B.call(e);
159
159
  });
160
- return E.createElement(Se.Provider, { value: $ }, E.createElement(Ee.Provider, { value: u }, se({ ourProps: { ...v, as: ve, children: E.createElement(Ye, { ref: r, ...v, ...P, beforeEnter: g, beforeLeave: S }) }, theirProps: {}, defaultTag: ve, features: Ve, visible: n === "visible", name: "Transition" })));
160
+ return E.createElement(Se.Provider, { value: $ }, E.createElement(Ee.Provider, { value: u }, se({ ourProps: { ...v, as: ve, children: E.createElement(Ye, { ref: o, ...v, ...P, beforeEnter: g, beforeLeave: S }) }, theirProps: {}, defaultTag: ve, features: Ve, visible: n === "visible", name: "Transition" })));
161
161
  }
162
162
  function Ht(e, t) {
163
- let o = re(Ee) !== null, c = $e() !== null;
164
- return E.createElement(E.Fragment, null, !o && c ? E.createElement(Ne, { ref: t, ...e }) : E.createElement(Ye, { ref: t, ...e }));
163
+ let r = re(Ee) !== null, c = $e() !== null;
164
+ return E.createElement(E.Fragment, null, !r && c ? E.createElement(Ne, { ref: t, ...e }) : E.createElement(Ye, { ref: t, ...e }));
165
165
  }
166
166
  let Ne = Y(Dt), Ye = Y(Ct), Kt = Y(Ht), Gt = Object.assign(Ne, { Child: Kt, Root: Ne });
167
167
  var Ut = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(Ut || {}), jt = ((e) => (e[e.TogglePopover = 0] = "TogglePopover", e[e.ClosePopover = 1] = "ClosePopover", e[e.SetButton = 2] = "SetButton", e[e.SetButtonId = 3] = "SetButtonId", e[e.SetPanel = 4] = "SetPanel", e[e.SetPanelId = 5] = "SetPanelId", e))(jt || {});
@@ -180,8 +180,8 @@ _e.displayName = "PopoverContext";
180
180
  function Te(e) {
181
181
  let t = re(_e);
182
182
  if (t === null) {
183
- let o = new Error(`<${e} /> is missing a parent <Popover /> component.`);
184
- throw Error.captureStackTrace && Error.captureStackTrace(o, Te), o;
183
+ let r = new Error(`<${e} /> is missing a parent <Popover /> component.`);
184
+ throw Error.captureStackTrace && Error.captureStackTrace(r, Te), r;
185
185
  }
186
186
  return t;
187
187
  }
@@ -190,8 +190,8 @@ we.displayName = "PopoverAPIContext";
190
190
  function Ae(e) {
191
191
  let t = re(we);
192
192
  if (t === null) {
193
- let o = new Error(`<${e} /> is missing a parent <Popover /> component.`);
194
- throw Error.captureStackTrace && Error.captureStackTrace(o, Ae), o;
193
+ let r = new Error(`<${e} /> is missing a parent <Popover /> component.`);
194
+ throw Error.captureStackTrace && Error.captureStackTrace(r, Ae), r;
195
195
  }
196
196
  return t;
197
197
  }
@@ -210,23 +210,23 @@ function Zt(e, t) {
210
210
  }
211
211
  let qt = "div";
212
212
  function Jt(e, t) {
213
- var o;
213
+ var r;
214
214
  let { __demoMode: c = !1, ...p } = e, P = A(null), m = ne(t, ct((y) => {
215
215
  P.current = y;
216
- })), l = A([]), r = rt(Zt, { __demoMode: c, popoverState: c ? 0 : 1, buttons: l, button: null, buttonId: null, panel: null, panelId: null, beforePanelSentinel: ke(), afterPanelSentinel: ke(), afterButtonSentinel: ke() }), [{ popoverState: h, button: n, buttonId: f, panel: $, panelId: d, beforePanelSentinel: a, afterPanelSentinel: s, afterButtonSentinel: u }, v] = r, g = ye((o = P.current) != null ? o : n), S = q(() => {
216
+ })), l = A([]), o = rt(Zt, { __demoMode: c, popoverState: c ? 0 : 1, buttons: l, button: null, buttonId: null, panel: null, panelId: null, beforePanelSentinel: Fe(), afterPanelSentinel: Fe(), afterButtonSentinel: Fe() }), [{ popoverState: h, button: n, buttonId: f, panel: $, panelId: d, beforePanelSentinel: a, afterPanelSentinel: s, afterButtonSentinel: u }, v] = o, g = ye((r = P.current) != null ? r : n), S = q(() => {
217
217
  if (!n || !$) return !1;
218
218
  for (let K of document.querySelectorAll("body > *")) if (Number(K == null ? void 0 : K.contains(n)) ^ Number(K == null ? void 0 : K.contains($))) return !0;
219
- let y = Re(), i = y.indexOf(n), b = (i + y.length - 1) % y.length, w = (i + 1) % y.length, I = y[b], k = y[w];
220
- return !$.contains(I) && !$.contains(k);
221
- }, [n, $]), B = Fe(f), D = Fe(d), C = q(() => ({ buttonId: B, panelId: D, close: () => v({ type: 1 }) }), [B, D, v]), F = ze(), N = F == null ? void 0 : F.registerPopover, Z = T(() => {
219
+ let y = Re(), i = y.indexOf(n), b = (i + y.length - 1) % y.length, w = (i + 1) % y.length, I = y[b], F = y[w];
220
+ return !$.contains(I) && !$.contains(F);
221
+ }, [n, $]), B = ke(f), D = ke(d), C = q(() => ({ buttonId: B, panelId: D, close: () => v({ type: 1 }) }), [B, D, v]), k = ze(), N = k == null ? void 0 : k.registerPopover, Z = T(() => {
222
222
  var y;
223
- return (y = F == null ? void 0 : F.isFocusWithinPopoverGroup()) != null ? y : (g == null ? void 0 : g.activeElement) && ((n == null ? void 0 : n.contains(g.activeElement)) || ($ == null ? void 0 : $.contains(g.activeElement)));
223
+ return (y = k == null ? void 0 : k.isFocusWithinPopoverGroup()) != null ? y : (g == null ? void 0 : g.activeElement) && ((n == null ? void 0 : n.contains(g.activeElement)) || ($ == null ? void 0 : $.contains(g.activeElement)));
224
224
  });
225
225
  te(() => N == null ? void 0 : N(C), [N, C]);
226
226
  let [M, L] = bt(), G = Xe(n), O = xt({ mainTreeNode: G, portals: M, defaultContainers: [n, $] });
227
227
  ht(g == null ? void 0 : g.defaultView, "focus", (y) => {
228
- var i, b, w, I, k, K;
229
- y.target !== window && y.target instanceof HTMLElement && h === 0 && (Z() || n && $ && (O.contains(y.target) || (b = (i = a.current) == null ? void 0 : i.contains) != null && b.call(i, y.target) || (I = (w = s.current) == null ? void 0 : w.contains) != null && I.call(w, y.target) || (K = (k = u.current) == null ? void 0 : k.contains) != null && K.call(k, y.target) || v({ type: 1 })));
228
+ var i, b, w, I, F, K;
229
+ y.target !== window && y.target instanceof HTMLElement && h === 0 && (Z() || n && $ && (O.contains(y.target) || (b = (i = a.current) == null ? void 0 : i.contains) != null && b.call(i, y.target) || (I = (w = s.current) == null ? void 0 : w.contains) != null && I.call(w, y.target) || (K = (F = u.current) == null ? void 0 : F.contains) != null && K.call(F, y.target) || v({ type: 1 })));
230
230
  }, !0), Pt(h === 0, O.resolveContainers, (y, i) => {
231
231
  v({ type: 1 }), Nt(i, Lt.Loose) || (y.preventDefault(), n == null || n.focus());
232
232
  });
@@ -235,16 +235,16 @@ function Jt(e, t) {
235
235
  let i = y ? y instanceof HTMLElement ? y : "current" in y && y.current instanceof HTMLElement ? y.current : n : n;
236
236
  i == null || i.focus();
237
237
  }), H = q(() => ({ close: x, isPortalled: S }), [x, S]), R = q(() => ({ open: h === 0, close: x }), [h, x]), _ = { ref: m };
238
- return E.createElement(We, { node: G }, E.createElement(yt, null, E.createElement(Ie.Provider, { value: null }, E.createElement(_e.Provider, { value: r }, E.createElement(we.Provider, { value: H }, E.createElement(Mt, { value: x }, E.createElement(Ge, { value: V(h, { 0: X.Open, 1: X.Closed }) }, E.createElement(L, null, se({ ourProps: _, theirProps: p, slot: R, defaultTag: qt, name: "Popover" })))))))));
238
+ return E.createElement(We, { node: G }, E.createElement(yt, null, E.createElement(Ie.Provider, { value: null }, E.createElement(_e.Provider, { value: o }, E.createElement(we.Provider, { value: H }, E.createElement(Mt, { value: x }, E.createElement(Ge, { value: V(h, { 0: X.Open, 1: X.Closed }) }, E.createElement(L, null, se({ ourProps: _, theirProps: p, slot: R, defaultTag: qt, name: "Popover" })))))))));
239
239
  }
240
240
  let Qt = "button";
241
241
  function Vt(e, t) {
242
- let o = be(), { id: c = `headlessui-popover-button-${o}`, disabled: p = !1, autoFocus: P = !1, ...m } = e, [l, r] = Te("Popover.Button"), { isPortalled: h } = Ae("Popover.Button"), n = A(null), f = `headlessui-focus-sentinel-${be()}`, $ = ze(), d = $ == null ? void 0 : $.closeOthers, a = Xt() !== null;
242
+ let r = be(), { id: c = `headlessui-popover-button-${r}`, disabled: p = !1, autoFocus: P = !1, ...m } = e, [l, o] = Te("Popover.Button"), { isPortalled: h } = Ae("Popover.Button"), n = A(null), f = `headlessui-focus-sentinel-${be()}`, $ = ze(), d = $ == null ? void 0 : $.closeOthers, a = Xt() !== null;
243
243
  te(() => {
244
- if (!a) return r({ type: 3, buttonId: c }), () => {
245
- r({ type: 3, buttonId: null });
244
+ if (!a) return o({ type: 3, buttonId: c }), () => {
245
+ o({ type: 3, buttonId: null });
246
246
  };
247
- }, [a, c, r]);
247
+ }, [a, c, o]);
248
248
  let [s] = J(() => Symbol()), u = ne(n, t, $t(), T((i) => {
249
249
  if (!a) {
250
250
  if (i) l.buttons.current.push(s);
@@ -252,7 +252,7 @@ function Vt(e, t) {
252
252
  let b = l.buttons.current.indexOf(s);
253
253
  b !== -1 && l.buttons.current.splice(b, 1);
254
254
  }
255
- l.buttons.current.length > 1 && console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."), i && r({ type: 2, button: i });
255
+ l.buttons.current.length > 1 && console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."), i && o({ type: 2, button: i });
256
256
  }
257
257
  })), v = ne(n, t), g = ye(n), S = T((i) => {
258
258
  var b, w, I;
@@ -261,28 +261,28 @@ function Vt(e, t) {
261
261
  switch (i.key) {
262
262
  case le.Space:
263
263
  case le.Enter:
264
- i.preventDefault(), (w = (b = i.target).click) == null || w.call(b), r({ type: 1 }), (I = l.button) == null || I.focus();
264
+ i.preventDefault(), (w = (b = i.target).click) == null || w.call(b), o({ type: 1 }), (I = l.button) == null || I.focus();
265
265
  break;
266
266
  }
267
267
  } else switch (i.key) {
268
268
  case le.Space:
269
269
  case le.Enter:
270
- i.preventDefault(), i.stopPropagation(), l.popoverState === 1 && (d == null || d(l.buttonId)), r({ type: 0 });
270
+ i.preventDefault(), i.stopPropagation(), l.popoverState === 1 && (d == null || d(l.buttonId)), o({ type: 0 });
271
271
  break;
272
272
  case le.Escape:
273
273
  if (l.popoverState !== 0) return d == null ? void 0 : d(l.buttonId);
274
274
  if (!n.current || g != null && g.activeElement && !n.current.contains(g.activeElement)) return;
275
- i.preventDefault(), i.stopPropagation(), r({ type: 1 });
275
+ i.preventDefault(), i.stopPropagation(), o({ type: 1 });
276
276
  break;
277
277
  }
278
278
  }), B = T((i) => {
279
279
  a || i.key === le.Space && i.preventDefault();
280
280
  }), D = T((i) => {
281
281
  var b, w;
282
- Ue(i.currentTarget) || p || (a ? (r({ type: 1 }), (b = l.button) == null || b.focus()) : (i.preventDefault(), i.stopPropagation(), l.popoverState === 1 && (d == null || d(l.buttonId)), r({ type: 0 }), (w = l.button) == null || w.focus()));
282
+ Ue(i.currentTarget) || p || (a ? (o({ type: 1 }), (b = l.button) == null || b.focus()) : (i.preventDefault(), i.stopPropagation(), l.popoverState === 1 && (d == null || d(l.buttonId)), o({ type: 0 }), (w = l.button) == null || w.focus()));
283
283
  }), C = T((i) => {
284
284
  i.preventDefault(), i.stopPropagation();
285
- }), { isFocusVisible: F, focusProps: N } = dt({ autoFocus: P }), { isHovered: Z, hoverProps: M } = pt({ isDisabled: p }), { pressed: L, pressProps: G } = vt({ disabled: p }), O = l.popoverState === 0, x = q(() => ({ open: O, active: L || O, disabled: p, hover: Z, focus: F, autofocus: P }), [O, Z, F, L, p, P]), H = Ft(e, l.button), R = a ? Be({ ref: v, type: H, onKeyDown: S, onClick: D, disabled: p || void 0, autoFocus: P }, N, M, G) : Be({ ref: u, id: l.buttonId, type: H, "aria-expanded": l.popoverState === 0, "aria-controls": l.panel ? l.panelId : void 0, disabled: p || void 0, autoFocus: P, onKeyDown: S, onKeyUp: B, onClick: D, onMouseDown: C }, N, M, G), _ = Ze(), y = T(() => {
285
+ }), { isFocusVisible: k, focusProps: N } = dt({ autoFocus: P }), { isHovered: Z, hoverProps: M } = pt({ isDisabled: p }), { pressed: L, pressProps: G } = vt({ disabled: p }), O = l.popoverState === 0, x = q(() => ({ open: O, active: L || O, disabled: p, hover: Z, focus: k, autofocus: P }), [O, Z, k, L, p, P]), H = kt(e, l.button), R = a ? Be({ ref: v, type: H, onKeyDown: S, onClick: D, disabled: p || void 0, autoFocus: P }, N, M, G) : Be({ ref: u, id: l.buttonId, type: H, "aria-expanded": l.popoverState === 0, "aria-controls": l.panel ? l.panelId : void 0, disabled: p || void 0, autoFocus: P, onKeyDown: S, onKeyUp: B, onClick: D, onMouseDown: C }, N, M, G), _ = Ze(), y = T(() => {
286
286
  let i = l.panel;
287
287
  if (!i) return;
288
288
  function b() {
@@ -294,7 +294,7 @@ function Vt(e, t) {
294
294
  }
295
295
  let Yt = "div", zt = me.RenderStrategy | me.Static;
296
296
  function et(e, t) {
297
- let o = be(), { id: c = `headlessui-popover-backdrop-${o}`, transition: p = !1, ...P } = e, [{ popoverState: m }, l] = Te("Popover.Backdrop"), [r, h] = J(null), n = ne(t, h), f = $e(), [$, d] = Oe(p, r, f !== null ? (f & X.Open) === X.Open : m === 0), a = T((v) => {
297
+ let r = be(), { id: c = `headlessui-popover-backdrop-${r}`, transition: p = !1, ...P } = e, [{ popoverState: m }, l] = Te("Popover.Backdrop"), [o, h] = J(null), n = ne(t, h), f = $e(), [$, d] = Oe(p, o, f !== null ? (f & X.Open) === X.Open : m === 0), a = T((v) => {
298
298
  if (Ue(v.currentTarget)) return v.preventDefault();
299
299
  l({ type: 1 });
300
300
  }), s = q(() => ({ open: m === 0 }), [m]), u = { ref: n, id: c, "aria-hidden": !0, onClick: a, ...xe(d) };
@@ -302,13 +302,13 @@ function et(e, t) {
302
302
  }
303
303
  let en = "div", tn = me.RenderStrategy | me.Static;
304
304
  function nn(e, t) {
305
- let o = be(), { id: c = `headlessui-popover-panel-${o}`, focus: p = !1, anchor: P, portal: m = !1, modal: l = !1, transition: r = !1, ...h } = e, [n, f] = Te("Popover.Panel"), { close: $, isPortalled: d } = Ae("Popover.Panel"), a = `headlessui-focus-sentinel-before-${o}`, s = `headlessui-focus-sentinel-after-${o}`, u = A(null), v = Et(P), [g, S] = St(v), B = gt();
305
+ let r = be(), { id: c = `headlessui-popover-panel-${r}`, focus: p = !1, anchor: P, portal: m = !1, modal: l = !1, transition: o = !1, ...h } = e, [n, f] = Te("Popover.Panel"), { close: $, isPortalled: d } = Ae("Popover.Panel"), a = `headlessui-focus-sentinel-before-${r}`, s = `headlessui-focus-sentinel-after-${r}`, u = A(null), v = Et(P), [g, S] = St(v), B = gt();
306
306
  v && (m = !0);
307
- let [D, C] = J(null), F = ne(u, t, v ? g : null, T((b) => f({ type: 4, panel: b })), C), N = ye(u), Z = ft();
307
+ let [D, C] = J(null), k = ne(u, t, v ? g : null, T((b) => f({ type: 4, panel: b })), C), N = ye(u), Z = ft();
308
308
  de(() => (f({ type: 5, panelId: c }), () => {
309
309
  f({ type: 5, panelId: null });
310
310
  }), [c, f]);
311
- let M = $e(), [L, G] = Oe(r, D, M !== null ? (M & X.Open) === X.Open : n.popoverState === 0);
311
+ let M = $e(), [L, G] = Oe(o, D, M !== null ? (M & X.Open) === X.Open : n.popoverState === 0);
312
312
  Tt(L, n.button, () => {
313
313
  f({ type: 1 });
314
314
  });
@@ -331,10 +331,10 @@ function nn(e, t) {
331
331
  let b = N == null ? void 0 : N.activeElement;
332
332
  u.current.contains(b) || ue(u.current, ee.First);
333
333
  }, [n.__demoMode, p, u.current, n.popoverState]);
334
- let H = q(() => ({ open: n.popoverState === 0, close: $ }), [n.popoverState, $]), R = Be(v ? B() : {}, { ref: F, id: c, onKeyDown: x, onBlur: p && n.popoverState === 0 ? (b) => {
335
- var w, I, k, K, j;
334
+ let H = q(() => ({ open: n.popoverState === 0, close: $ }), [n.popoverState, $]), R = Be(v ? B() : {}, { ref: k, id: c, onKeyDown: x, onBlur: p && n.popoverState === 0 ? (b) => {
335
+ var w, I, F, K, j;
336
336
  let W = b.relatedTarget;
337
- W && u.current && ((w = u.current) != null && w.contains(W) || (f({ type: 1 }), ((k = (I = n.beforePanelSentinel.current) == null ? void 0 : I.contains) != null && k.call(I, W) || (j = (K = n.afterPanelSentinel.current) == null ? void 0 : K.contains) != null && j.call(K, W)) && W.focus({ preventScroll: !0 })));
337
+ W && u.current && ((w = u.current) != null && w.contains(W) || (f({ type: 1 }), ((F = (I = n.beforePanelSentinel.current) == null ? void 0 : I.contains) != null && F.call(I, W) || (j = (K = n.afterPanelSentinel.current) == null ? void 0 : K.contains) != null && j.call(K, W)) && W.focus({ preventScroll: !0 })));
338
338
  } : void 0, tabIndex: -1, style: { ...h.style, ...S, "--button-width": It(n.button, !0).width }, ...xe(G) }), _ = Ze(), y = T(() => {
339
339
  let b = u.current;
340
340
  if (!b) return;
@@ -354,7 +354,7 @@ function nn(e, t) {
354
354
  function w() {
355
355
  V(_.current, { [Q.Forwards]: () => {
356
356
  if (!n.button) return;
357
- let I = Re(), k = I.indexOf(n.button), K = I.slice(0, k + 1), j = [...I.slice(k + 1), ...K];
357
+ let I = Re(), F = I.indexOf(n.button), K = I.slice(0, F + 1), j = [...I.slice(F + 1), ...K];
358
358
  for (let W of j.slice()) if (W.dataset.headlessuiFocusGuard === "true" || D != null && D.contains(W)) {
359
359
  let oe = j.indexOf(W);
360
360
  oe !== -1 && j.splice(oe, 1);
@@ -367,11 +367,11 @@ function nn(e, t) {
367
367
  }
368
368
  w();
369
369
  });
370
- return E.createElement(Bt, null, E.createElement(Ie.Provider, { value: c }, E.createElement(we.Provider, { value: { close: $, isPortalled: d } }, E.createElement(kt, { enabled: m ? e.static || L : !1 }, L && d && E.createElement(he, { id: a, ref: n.beforePanelSentinel, features: Pe.Focusable, "data-headlessui-focus-guard": !0, as: "button", type: "button", onFocus: y }), se({ mergeRefs: Z, ourProps: R, theirProps: h, slot: H, defaultTag: en, features: tn, visible: L, name: "Popover.Panel" }), L && d && E.createElement(he, { id: s, ref: n.afterPanelSentinel, features: Pe.Focusable, "data-headlessui-focus-guard": !0, as: "button", type: "button", onFocus: i })))));
370
+ return E.createElement(Bt, null, E.createElement(Ie.Provider, { value: c }, E.createElement(we.Provider, { value: { close: $, isPortalled: d } }, E.createElement(Ft, { enabled: m ? e.static || L : !1 }, L && d && E.createElement(he, { id: a, ref: n.beforePanelSentinel, features: Pe.Focusable, "data-headlessui-focus-guard": !0, as: "button", type: "button", onFocus: y }), se({ mergeRefs: Z, ourProps: R, theirProps: h, slot: H, defaultTag: en, features: tn, visible: L, name: "Popover.Panel" }), L && d && E.createElement(he, { id: s, ref: n.afterPanelSentinel, features: Pe.Focusable, "data-headlessui-focus-guard": !0, as: "button", type: "button", onFocus: i })))));
371
371
  }
372
372
  let rn = "div";
373
373
  function on(e, t) {
374
- let o = A(null), c = ne(o, t), [p, P] = J([]), m = T((a) => {
374
+ let r = A(null), c = ne(r, t), [p, P] = J([]), m = T((a) => {
375
375
  P((s) => {
376
376
  let u = s.indexOf(a);
377
377
  if (u !== -1) {
@@ -380,32 +380,32 @@ function on(e, t) {
380
380
  }
381
381
  return s;
382
382
  });
383
- }), l = T((a) => (P((s) => [...s, a]), () => m(a))), r = T(() => {
383
+ }), l = T((a) => (P((s) => [...s, a]), () => m(a))), o = T(() => {
384
384
  var a;
385
- let s = He(o);
385
+ let s = He(r);
386
386
  if (!s) return !1;
387
387
  let u = s.activeElement;
388
- return (a = o.current) != null && a.contains(u) ? !0 : p.some((v) => {
388
+ return (a = r.current) != null && a.contains(u) ? !0 : p.some((v) => {
389
389
  var g, S;
390
390
  return ((g = s.getElementById(v.buttonId.current)) == null ? void 0 : g.contains(u)) || ((S = s.getElementById(v.panelId.current)) == null ? void 0 : S.contains(u));
391
391
  });
392
392
  }), h = T((a) => {
393
393
  for (let s of p) s.buttonId.current !== a && s.close();
394
- }), n = q(() => ({ registerPopover: l, unregisterPopover: m, isFocusWithinPopoverGroup: r, closeOthers: h }), [l, m, r, h]), f = q(() => ({}), []), $ = e, d = { ref: c };
394
+ }), n = q(() => ({ registerPopover: l, unregisterPopover: m, isFocusWithinPopoverGroup: o, closeOthers: h }), [l, m, o, h]), f = q(() => ({}), []), $ = e, d = { ref: c };
395
395
  return E.createElement(We, null, E.createElement(Ce.Provider, { value: n }, se({ ourProps: d, theirProps: $, slot: f, defaultTag: rn, name: "Popover.Group" })));
396
396
  }
397
397
  let ln = Y(Jt), Le = Y(Vt), an = Y(et), un = Y(et), tt = Y(nn), sn = Y(on), cn = Object.assign(ln, { Button: Le, Backdrop: un, Overlay: an, Panel: tt, Group: sn });
398
- const kn = 300, Fn = ot(
398
+ const Fn = 300, kn = ot(
399
399
  ({
400
400
  children: e,
401
401
  position: t = "bottom end",
402
- popoverProps: o,
402
+ popoverProps: r,
403
403
  className: c,
404
404
  buttonClassName: p,
405
405
  panelClassName: P,
406
406
  menuItemsClassName: m,
407
407
  buttonContent: l,
408
- needCloseButton: r,
408
+ needCloseButton: o,
409
409
  openOnHover: h = !1,
410
410
  isOpen: n,
411
411
  isControlled: f = !1,
@@ -417,9 +417,9 @@ const kn = 300, Fn = ot(
417
417
  }) => {
418
418
  const [v, g] = J(
419
419
  n ?? !1
420
- ), [S, B] = J(!1), D = A(null), C = A(null), F = A(null), { getArrowClasses: N, getPositionClass: Z } = lt({
420
+ ), [S, B] = J(!1), D = A(null), C = A(null), k = A(null), { getArrowClasses: N, getPositionClass: Z } = lt({
421
421
  buttonRef: C,
422
- panelRef: F,
422
+ panelRef: k,
423
423
  initialPosition: t,
424
424
  isOpen: v || n,
425
425
  arrow: u,
@@ -436,7 +436,7 @@ const kn = 300, Fn = ot(
436
436
  (R) => {
437
437
  if (h) {
438
438
  const _ = R.relatedTarget;
439
- C.current && !C.current.contains(_) && F.current && !F.current.contains(_) && g(!1);
439
+ C.current && !C.current.contains(_) && k.current && !k.current.contains(_) && g(!1);
440
440
  }
441
441
  },
442
442
  [h]
@@ -460,7 +460,7 @@ const kn = 300, Fn = ot(
460
460
  {
461
461
  as: "div",
462
462
  className: fe(U.menu, c),
463
- ...o,
463
+ ...r,
464
464
  children: ({ open: R, close: _ }) => /* @__PURE__ */ De(
465
465
  dn,
466
466
  {
@@ -468,7 +468,7 @@ const kn = 300, Fn = ot(
468
468
  isControlled: f,
469
469
  onClose: () => H(_),
470
470
  buttonRef: C,
471
- panelRef: F,
471
+ panelRef: k,
472
472
  children: [
473
473
  a ? /* @__PURE__ */ z(
474
474
  Le,
@@ -508,7 +508,7 @@ const kn = 300, Fn = ot(
508
508
  children: /* @__PURE__ */ De(
509
509
  tt,
510
510
  {
511
- ref: F,
511
+ ref: k,
512
512
  anchor: t,
513
513
  static: f,
514
514
  onMouseEnter: G,
@@ -524,7 +524,7 @@ const kn = 300, Fn = ot(
524
524
  ),
525
525
  children: [
526
526
  u && /* @__PURE__ */ z("div", { className: N() }),
527
- r && /* @__PURE__ */ z(
527
+ o && /* @__PURE__ */ z(
528
528
  at,
529
529
  {
530
530
  isIconButton: !0,
@@ -559,25 +559,25 @@ const kn = 300, Fn = ot(
559
559
  function dn({
560
560
  isControlled: e,
561
561
  isOpen: t,
562
- onClose: o,
562
+ onClose: r,
563
563
  buttonRef: c,
564
564
  panelRef: p,
565
565
  children: P
566
566
  }) {
567
567
  return te(() => {
568
568
  if (!t || !e) return;
569
- const m = (r) => {
570
- console.log("handle key", r.key), r.key === "Escape" && (console.log("if if if handle key ===>", r.key), o == null || o());
571
- }, l = (r) => {
572
- const h = r.target, n = c.current && !c.current.contains(h), f = p.current && !p.current.contains(h);
573
- n && f && (o == null || o());
569
+ const m = (o) => {
570
+ o.key === "Escape" && (r == null || r());
571
+ }, l = (o) => {
572
+ const h = o.target, n = c.current && !c.current.contains(h), f = p.current && !p.current.contains(h);
573
+ n && f && (r == null || r());
574
574
  };
575
575
  return document.addEventListener("keydown", m), document.addEventListener("mousedown", l), () => {
576
576
  document.removeEventListener("keydown", m), document.removeEventListener("mousedown", l);
577
577
  };
578
- }, [e, e, t, o]), /* @__PURE__ */ z(nt, { children: P });
578
+ }, [e, e, t, r]), /* @__PURE__ */ z(nt, { children: P });
579
579
  }
580
580
  export {
581
- kn as ANIMATION_DELAY,
582
- Fn as Dropdown
581
+ Fn as ANIMATION_DELAY,
582
+ kn as Dropdown
583
583
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.65.1",
4
+ "version": "1.65.3",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {