snapflow-ui-kit 0.0.4 → 1.0.0

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.
Files changed (55) hide show
  1. package/dist/CloseIcon-BASungOx.js +217 -0
  2. package/dist/CloseIcon-BASungOx.js.map +1 -0
  3. package/dist/components/Alert/Alert.d.ts +3 -0
  4. package/dist/components/Alert/Alert.types.d.ts +8 -0
  5. package/dist/components/Alert/index.d.ts +2 -0
  6. package/dist/components/Alert/toast.d.ts +11 -0
  7. package/dist/components/Card/Card.d.ts +2 -0
  8. package/dist/components/Card/Card.types.d.ts +4 -0
  9. package/dist/components/Card/index.d.ts +2 -0
  10. package/dist/components/DatePicker/DatePicker.d.ts +2 -0
  11. package/dist/components/DatePicker/DatePicker.types.d.ts +15 -0
  12. package/dist/components/DatePicker/hooks/useDatePickerState.d.ts +4 -0
  13. package/dist/components/DatePicker/hooks/useDismiss.d.ts +8 -0
  14. package/dist/components/DatePicker/index.d.ts +1 -0
  15. package/dist/components/DatePicker/utils/formatDateValue.d.ts +4 -0
  16. package/dist/components/DatePicker/utils/getDayPickerProps.d.ts +38 -0
  17. package/dist/components/DatePicker/utils/handleDateSelect.d.ts +10 -0
  18. package/dist/components/DatePicker/utils/parseDateValue.d.ts +4 -0
  19. package/dist/components/DatePicker/utils/updateMonthFromDate.d.ts +2 -0
  20. package/dist/components/Input/Input.d.ts +11 -0
  21. package/dist/components/Input/Input.types.d.ts +12 -0
  22. package/dist/components/Input/index.d.ts +1 -0
  23. package/dist/components/Label/Label.d.ts +2 -0
  24. package/dist/components/Label/Label.types.d.ts +9 -0
  25. package/dist/components/Label/index.d.ts +1 -0
  26. package/dist/components/Modal/Modal.d.ts +2 -0
  27. package/dist/components/Modal/Modal.types.d.ts +8 -0
  28. package/dist/components/Modal/index.d.ts +2 -0
  29. package/dist/components/Pagination/PageSizeSelect/PageSizeSelect.d.ts +2 -0
  30. package/dist/components/Pagination/PageSizeSelect/PageSizeSelect.types.d.ts +5 -0
  31. package/dist/components/Pagination/PageSizeSelect/index.d.ts +1 -0
  32. package/dist/components/Pagination/Pager/Pager.d.ts +2 -0
  33. package/dist/components/Pagination/Pager/Pager.types.d.ts +6 -0
  34. package/dist/components/Pagination/Pager/index.d.ts +1 -0
  35. package/dist/components/Pagination/Pagination.d.ts +3 -0
  36. package/dist/components/Pagination/Pagination.type.d.ts +18 -0
  37. package/dist/components/Pagination/index.d.ts +1 -0
  38. package/dist/components/Tab/Tab.d.ts +2 -0
  39. package/dist/components/Tab/Tab.types.d.ts +4 -0
  40. package/dist/components/Tab/index.d.ts +1 -0
  41. package/dist/components/Textarea/Textarea.d.ts +7 -0
  42. package/dist/components/Textarea/Textarea.types.d.ts +8 -0
  43. package/dist/components/Textarea/index.d.ts +1 -0
  44. package/dist/components/index.d.ts +9 -0
  45. package/dist/icons/BellIcon/BellIcon.d.ts +6 -0
  46. package/dist/icons/BellIcon/index.d.ts +1 -0
  47. package/dist/icons/index.d.ts +1 -0
  48. package/dist/icons.js +115 -280
  49. package/dist/icons.js.map +1 -1
  50. package/dist/index.css +1 -1
  51. package/dist/index.js +615 -113
  52. package/dist/index.js.map +1 -1
  53. package/package.json +7 -2
  54. package/dist/ArrowDownIcon-XyCc_cD9.js +0 -30
  55. package/dist/ArrowDownIcon-XyCc_cD9.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,144 +1,646 @@
1
- import { clsx as i } from "clsx";
2
- import { clsx as ye } from "clsx";
3
- import v from "simplebar-react";
4
- import { default as ve } from "simplebar-react";
5
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
6
- import { useState as S, useRef as w, useEffect as q } from "react";
7
- import { A as C } from "./ArrowDownIcon-XyCc_cD9.js";
8
- const O = "_button_dqki1_1", $ = "_primary_dqki1_25", I = "_secondary_dqki1_48", B = "_outlined_dqki1_71", E = "_text_dqki1_97", L = "_icon_dqki1_117", g = {
9
- button: O,
10
- primary: $,
11
- secondary: I,
12
- outlined: B,
13
- text: E,
14
- icon: L
15
- }, be = (s) => {
16
- const { className: r, variant: c = "primary", asLink: l, icon: o, ...p } = s, d = i(g.button, g[c], r);
17
- if (l) {
18
- const { children: u, ...b } = p;
19
- return /* @__PURE__ */ a("a", { className: d, ...b, children: [
20
- o && /* @__PURE__ */ e("span", { className: g.icon, children: o }),
21
- u
1
+ import D, { clsx as u } from "clsx";
2
+ import { clsx as Pn } from "clsx";
3
+ import nt from "simplebar-react";
4
+ import { default as zn } from "simplebar-react";
5
+ import { jsxs as i, jsx as a, Fragment as ot } from "react/jsx-runtime";
6
+ import { E as at, a as st, C as J, A as rt, b as ct } from "./CloseIcon-BASungOx.js";
7
+ import { forwardRef as K, useId as Q, useState as L, useEffect as G, useMemo as F, useRef as U } from "react";
8
+ import { DayPicker as H } from "react-day-picker";
9
+ import { parse as O, isValid as P, format as R } from "date-fns";
10
+ import { toast as j } from "react-hot-toast";
11
+ const lt = "_button_dqki1_1", it = "_primary_dqki1_25", dt = "_secondary_dqki1_48", _t = "_outlined_dqki1_71", pt = "_text_dqki1_97", ut = "_icon_dqki1_117", $ = {
12
+ button: lt,
13
+ primary: it,
14
+ secondary: dt,
15
+ outlined: _t,
16
+ text: pt,
17
+ icon: ut
18
+ }, xn = (t) => {
19
+ const { className: e, variant: n = "primary", asLink: o, icon: s, ...r } = t, c = u($.button, $[n], e);
20
+ if (o) {
21
+ const { children: m, ...h } = r;
22
+ return /* @__PURE__ */ i("a", { className: c, ...h, children: [
23
+ s && /* @__PURE__ */ a("span", { className: $.icon, children: s }),
24
+ m
22
25
  ] });
23
26
  }
24
- const { children: m, ..._ } = p;
25
- return /* @__PURE__ */ a("button", { className: d, ..._, children: [
26
- o && /* @__PURE__ */ e("span", { className: g.icon, children: o }),
27
- m
27
+ const { children: d, ...p } = r;
28
+ return /* @__PURE__ */ i("button", { className: c, ...p, children: [
29
+ s && /* @__PURE__ */ a("span", { className: $.icon, children: s }),
30
+ d
28
31
  ] });
29
- }, R = "_checkbox_1q28z_1", j = "_input_1q28z_11", A = "_labelSpan_1q28z_16", P = "_control_1q28z_23", z = {
30
- checkbox: R,
31
- input: j,
32
- labelSpan: A,
33
- control: P
34
- }, he = ({ children: s, className: r, checked: c, onChange: l, ...o }) => /* @__PURE__ */ a("label", { className: i(z.checkbox, r), children: [
35
- /* @__PURE__ */ e("input", { type: "checkbox", className: z.input, checked: c, onChange: l, ...o }),
36
- /* @__PURE__ */ e("span", { className: z.control }),
37
- s && /* @__PURE__ */ e("span", { className: z.labelSpan, children: s })
38
- ] }), T = "_radio_yk69v_1", D = "_input_yk69v_12", H = "_labelSpan_yk69v_18", F = "_control_yk69v_26", x = {
39
- radio: T,
40
- input: D,
41
- labelSpan: H,
42
- control: F
43
- }, ge = ({ children: s, className: r, checked: c, onChange: l, ...o }) => /* @__PURE__ */ a("label", { className: i(x.radio, r), children: [
44
- /* @__PURE__ */ e("input", { type: "radio", className: x.input, checked: c, onChange: l, ...o }),
45
- /* @__PURE__ */ e("span", { className: x.control }),
46
- s && /* @__PURE__ */ e("span", { className: x.labelSpan, children: s })
47
- ] }), G = "_container_zuge2_1", J = "_label_zuge2_7", K = "_select_zuge2_14", M = "_trigger_zuge2_19", Q = "_triggerOpen_zuge2_46", U = "_placeholder_zuge2_67", V = "_selectedContent_zuge2_71", W = "_optionIcon_zuge2_81", X = "_arrow_zuge2_87", Y = "_open_zuge2_98", Z = "_dropdown_zuge2_102", ee = "_option_zuge2_81", te = "_selected_zuge2_71", n = {
48
- container: G,
49
- label: J,
50
- select: K,
51
- trigger: M,
52
- triggerOpen: Q,
53
- placeholder: U,
54
- selectedContent: V,
55
- optionIcon: W,
56
- arrow: X,
57
- open: Y,
58
- dropdown: Z,
59
- option: ee,
32
+ }, mt = "_wrapper_ck06d_1", ht = "_label_ck06d_7", bt = "_disabled_ck06d_14", ft = "_inputContainer_ck06d_18", yt = "_input_ck06d_18", wt = "_error_ck06d_51", gt = "_withStartIcon_ck06d_64", Nt = "_withEndIcon_ck06d_68", vt = "_startIcon_ck06d_72", xt = "_endIcon_ck06d_73", kt = "_errorMessage_ck06d_115", Ct = "_required_ck06d_122", b = {
33
+ wrapper: mt,
34
+ label: ht,
35
+ disabled: bt,
36
+ inputContainer: ft,
37
+ input: yt,
38
+ error: wt,
39
+ withStartIcon: gt,
40
+ withEndIcon: Nt,
41
+ startIcon: vt,
42
+ endIcon: xt,
43
+ errorMessage: kt,
44
+ required: Ct
45
+ }, It = K(
46
+ ({
47
+ label: t,
48
+ errorMessage: e,
49
+ startIcon: n,
50
+ endIcon: o,
51
+ onEndIconClick: s,
52
+ allowPasswordToggle: r,
53
+ disabled: c,
54
+ type: d = "text",
55
+ className: p,
56
+ required: m,
57
+ id: h,
58
+ ...y
59
+ }, N) => {
60
+ const w = Q(), _ = h ?? w, C = e ? `${_}-error` : void 0, S = !!e, I = d === "password" && r, [x, E] = L(!1);
61
+ return /* @__PURE__ */ i("div", { className: u(b.wrapper, p), children: [
62
+ t && /* @__PURE__ */ i("label", { htmlFor: _, className: u(b.label, { [b.disabled]: c }), children: [
63
+ t,
64
+ m && /* @__PURE__ */ a("sup", { className: b.required, children: " *" })
65
+ ] }),
66
+ /* @__PURE__ */ i(
67
+ "div",
68
+ {
69
+ className: u(b.inputContainer, {
70
+ [b.error]: S,
71
+ [b.disabled]: c,
72
+ [b.withStartIcon]: !!n,
73
+ [b.withEndIcon]: !!o || I
74
+ }),
75
+ children: [
76
+ n && /* @__PURE__ */ a("span", { className: b.startIcon, children: n }),
77
+ /* @__PURE__ */ a(
78
+ "input",
79
+ {
80
+ ref: N,
81
+ id: _,
82
+ className: b.input,
83
+ type: I && x ? "text" : d,
84
+ autoComplete: d === "password" ? "current-password" : "off",
85
+ required: m,
86
+ disabled: c,
87
+ "aria-invalid": S,
88
+ "aria-describedby": C,
89
+ ...y
90
+ }
91
+ ),
92
+ I && /* @__PURE__ */ a(
93
+ "button",
94
+ {
95
+ type: "button",
96
+ className: b.endIcon,
97
+ onClick: () => E((v) => !v),
98
+ "aria-label": x ? "Hide password" : "Show password",
99
+ disabled: c,
100
+ tabIndex: -1,
101
+ children: x ? /* @__PURE__ */ a(at, {}) : /* @__PURE__ */ a(st, {})
102
+ }
103
+ ),
104
+ o && !I && /* @__PURE__ */ a(
105
+ "button",
106
+ {
107
+ type: "button",
108
+ className: b.endIcon,
109
+ onClick: s,
110
+ "aria-label": "Action",
111
+ disabled: c,
112
+ children: o
113
+ }
114
+ )
115
+ ]
116
+ }
117
+ ),
118
+ S && /* @__PURE__ */ a("span", { id: C, className: b.errorMessage, role: "alert", children: e })
119
+ ] });
120
+ }
121
+ );
122
+ It.displayName = "Input";
123
+ const St = "_textareaWrapper_ahoiy_1", Dt = "_label_ahoiy_7", Et = "_disabled_ahoiy_14", $t = "_textarea_ahoiy_1", Bt = "_errorState_ahoiy_46", qt = "_errorMessage_ahoiy_52", Ot = "_required_ahoiy_59", k = {
124
+ textareaWrapper: St,
125
+ label: Dt,
126
+ disabled: Et,
127
+ textarea: $t,
128
+ errorState: Bt,
129
+ errorMessage: qt,
130
+ required: Ot
131
+ }, Pt = K(
132
+ ({ label: t, errorMessage: e, id: n, className: o, disabled: s, minHeight: r = 84, required: c, ...d }, p) => {
133
+ const m = Q(), h = n ?? m, y = e ? `${h}-error` : void 0;
134
+ return /* @__PURE__ */ i("div", { className: u(k.textareaWrapper, o), children: [
135
+ t && /* @__PURE__ */ i("label", { htmlFor: h, className: u(k.label, { [k.disabled]: s }), children: [
136
+ t,
137
+ c && /* @__PURE__ */ a("sup", { className: k.required, children: " *" })
138
+ ] }),
139
+ /* @__PURE__ */ a(
140
+ "textarea",
141
+ {
142
+ ref: p,
143
+ id: h,
144
+ className: u(k.textarea, { [k.errorState]: !!e }),
145
+ "aria-invalid": !!e,
146
+ "aria-describedby": y,
147
+ required: c,
148
+ disabled: s,
149
+ style: { minHeight: r },
150
+ ...d
151
+ }
152
+ ),
153
+ e && /* @__PURE__ */ a("span", { id: y, role: "alert", className: k.errorMessage, children: e })
154
+ ] });
155
+ }
156
+ );
157
+ Pt.displayName = "Textarea";
158
+ const Rt = "_alert_5jfpm_1", zt = "_content_5jfpm_15", Tt = "_error_5jfpm_22", jt = "_success_5jfpm_28", Lt = "_closeButton_5jfpm_33", Mt = "_message_5jfpm_39", At = "_title_5jfpm_40", Wt = "_toastEnter_5jfpm_50", Ft = "_toastExit_5jfpm_54", g = {
159
+ alert: Rt,
160
+ content: zt,
161
+ error: Tt,
162
+ success: jt,
163
+ closeButton: Lt,
164
+ message: Mt,
165
+ title: At,
166
+ toastEnter: Wt,
167
+ "fade-in": "_fade-in_5jfpm_1",
168
+ toastExit: Ft,
169
+ "fade-out": "_fade-out_5jfpm_1"
170
+ }, X = ({
171
+ variant: t = "error",
172
+ title: e,
173
+ message: n,
174
+ className: o,
175
+ onClose: s
176
+ }) => /* @__PURE__ */ i("div", { className: D(g.alert, g[t], o), role: "alert", children: [
177
+ /* @__PURE__ */ i("div", { className: g.content, children: [
178
+ e && /* @__PURE__ */ a("div", { className: g.title, children: e }),
179
+ /* @__PURE__ */ a("div", { className: g.message, children: n })
180
+ ] }),
181
+ s && /* @__PURE__ */ a("button", { type: "button", className: g.closeButton, onClick: s, "aria-label": "Close alert", children: /* @__PURE__ */ a(J, {}) })
182
+ ] }), kn = (t) => {
183
+ j.custom((e) => /* @__PURE__ */ a(
184
+ X,
185
+ {
186
+ variant: "success",
187
+ message: t,
188
+ className: e.visible ? g.toastEnter : g.toastExit,
189
+ onClose: () => j.dismiss(e.id)
190
+ }
191
+ ));
192
+ }, Cn = (t, e = "Error!") => {
193
+ j.custom((n) => /* @__PURE__ */ a(
194
+ X,
195
+ {
196
+ variant: "error",
197
+ title: e,
198
+ message: t,
199
+ className: n.visible ? g.toastEnter : g.toastExit,
200
+ onClose: () => j.dismiss(n.id)
201
+ }
202
+ ));
203
+ }, Vt = "_card_1ah7i_1", Gt = {
204
+ card: Vt
205
+ }, In = ({ className: t, children: e, ...n }) => /* @__PURE__ */ a("div", { className: u(Gt.card, t), ...n, children: e }), Ht = "_checkbox_1q28z_1", Yt = "_input_1q28z_11", Jt = "_labelSpan_1q28z_16", Kt = "_control_1q28z_23", B = {
206
+ checkbox: Ht,
207
+ input: Yt,
208
+ labelSpan: Jt,
209
+ control: Kt
210
+ }, Sn = ({ children: t, className: e, checked: n, onChange: o, ...s }) => /* @__PURE__ */ i("label", { className: u(B.checkbox, e), children: [
211
+ /* @__PURE__ */ a("input", { type: "checkbox", className: B.input, checked: n, onChange: o, ...s }),
212
+ /* @__PURE__ */ a("span", { className: B.control }),
213
+ t && /* @__PURE__ */ a("span", { className: B.labelSpan, children: t })
214
+ ] }), Qt = "_label_ndvr9_1", Ut = "_required_ndvr9_5", Xt = "_srOnly_ndvr9_10", M = {
215
+ label: Qt,
216
+ required: Ut,
217
+ srOnly: Xt
218
+ }, Dn = ({
219
+ text: t,
220
+ textVariant: e = "text-14-medium",
221
+ required: n = !1,
222
+ color: o,
223
+ className: s,
224
+ htmlFor: r,
225
+ ...c
226
+ }) => /* @__PURE__ */ i(
227
+ V,
228
+ {
229
+ as: "label",
230
+ variant: e,
231
+ className: D(M.label, s),
232
+ htmlFor: r,
233
+ style: o ? { color: o } : void 0,
234
+ ...c,
235
+ children: [
236
+ t,
237
+ n && /* @__PURE__ */ i(ot, { children: [
238
+ /* @__PURE__ */ a("span", { className: M.required, "aria-hidden": "true", children: "*" }),
239
+ /* @__PURE__ */ a("span", { className: M.srOnly, children: " (required)" })
240
+ ] })
241
+ ]
242
+ }
243
+ ), Zt = "_tab_78cv0_1", te = "_selected_78cv0_21", A = {
244
+ tab: Zt,
60
245
  selected: te
61
- }, ze = (s) => {
62
- const { className: r, disabled: c = !1, label: l, onChange: o, options: p, placeholder: d, value: m } = s, [_, u] = S(!1), b = w(null), h = p.find((t) => t.value === m), k = () => {
63
- c || u(!_);
64
- }, y = (t) => {
65
- o?.(t), u(!1);
246
+ }, En = (t) => {
247
+ const { children: e, selected: n = !1, className: o, disabled: s = !1, ...r } = t, c = u(A.tab, n && A.selected, s && A.disabled, o);
248
+ return /* @__PURE__ */ a(
249
+ "button",
250
+ {
251
+ type: "button",
252
+ role: "tab",
253
+ className: c,
254
+ disabled: s,
255
+ tabIndex: s ? -1 : 0,
256
+ "aria-selected": n,
257
+ "aria-disabled": s,
258
+ ...r,
259
+ children: e
260
+ }
261
+ );
262
+ }, ee = "_radio_10hqy_1", ne = "_input_10hqy_12", oe = "_labelSpan_10hqy_18", ae = "_control_10hqy_26", q = {
263
+ radio: ee,
264
+ input: ne,
265
+ labelSpan: oe,
266
+ control: ae
267
+ }, $n = ({ children: t, className: e, checked: n, onChange: o, ...s }) => /* @__PURE__ */ i("label", { className: u(q.radio, e), children: [
268
+ /* @__PURE__ */ a("input", { type: "radio", className: q.input, checked: n, onChange: o, ...s }),
269
+ /* @__PURE__ */ a("span", { className: q.control }),
270
+ t && /* @__PURE__ */ a("span", { className: q.labelSpan, children: t })
271
+ ] }), se = "_typography_11tbz_1", re = "_icon_11tbz_8", ce = "_large_11tbz_14", le = "_h1_11tbz_20", ie = "_h2_11tbz_26", de = "_h3_11tbz_32", _e = "_small_11tbz_68", pe = "_link_11tbz_80", W = {
272
+ typography: se,
273
+ icon: re,
274
+ large: ce,
275
+ h1: le,
276
+ h2: ie,
277
+ h3: de,
278
+ "text-16": "_text-16_11tbz_38",
279
+ "text-16-bold": "_text-16-bold_11tbz_44",
280
+ "text-14": "_text-14_11tbz_50",
281
+ "text-14-bold": "_text-14-bold_11tbz_56",
282
+ "text-14-medium": "_text-14-medium_11tbz_62",
283
+ small: _e,
284
+ "small-semibold": "_small-semibold_11tbz_74",
285
+ link: pe,
286
+ "small-link": "_small-link_11tbz_89"
287
+ }, V = (t) => {
288
+ const { as: e = "span", children: n, className: o, icon: s, variant: r, ...c } = t;
289
+ return /* @__PURE__ */ i(e, { className: u(W.typography, W[r], o), ...c, children: [
290
+ s && /* @__PURE__ */ a("span", { className: W.icon, children: s }),
291
+ n
292
+ ] });
293
+ }, ue = "_wrapper_l023w_1", me = "_inputContainer_l023w_5", he = "_label_l023w_11", be = "_inputWrapper_l023w_15", fe = "_trigger_l023w_22", ye = "_icon_l023w_38", we = "_placeholder_l023w_45", ge = "_clearButton_l023w_49", Ne = "_clearIcon_l023w_89", ve = "_disabledLabel_l023w_101", xe = "_error_l023w_123", ke = "_calendar_l023w_141", Ce = "_open_l023w_160", Ie = "_monthsCaption_l023w_166", Se = "_navButtonPrevious_l023w_172", De = "_navButtonNext_l023w_173", Ee = "_navIcon_l023w_193", $e = "_monthGrid_l023w_199", Be = "_dropdowns_l023w_205", qe = "_weekday_l023w_209", Oe = "_day_l023w_220", Pe = "_dayButton_l023w_227", Re = "_dayOutside_l023w_254", ze = "_dayToday_l023w_258", Te = "_daySelected_l023w_263", je = "_dayRangeStart_l023w_264", Le = "_dayRangeEnd_l023w_265", Me = "_dayRangeMiddle_l023w_266", l = {
294
+ wrapper: ue,
295
+ inputContainer: me,
296
+ label: he,
297
+ inputWrapper: be,
298
+ trigger: fe,
299
+ icon: ye,
300
+ placeholder: we,
301
+ clearButton: ge,
302
+ clearIcon: Ne,
303
+ disabledLabel: ve,
304
+ error: xe,
305
+ calendar: ke,
306
+ open: Ce,
307
+ monthsCaption: Ie,
308
+ navButtonPrevious: Se,
309
+ navButtonNext: De,
310
+ navIcon: Ee,
311
+ monthGrid: $e,
312
+ dropdowns: Be,
313
+ weekday: qe,
314
+ day: Oe,
315
+ dayButton: Pe,
316
+ dayOutside: Re,
317
+ dayToday: ze,
318
+ daySelected: Te,
319
+ dayRangeStart: je,
320
+ dayRangeEnd: Le,
321
+ dayRangeMiddle: Me
322
+ }, Ae = ({
323
+ ref: t,
324
+ isOpen: e,
325
+ onDismiss: n
326
+ }) => {
327
+ G(() => {
328
+ if (!e) return;
329
+ const o = (r) => {
330
+ t.current && !t.current.contains(r.target) && n();
331
+ }, s = (r) => {
332
+ r.key === "Escape" && n();
333
+ };
334
+ return document.addEventListener("mousedown", o), document.addEventListener("touchstart", o), document.addEventListener("keydown", s), () => {
335
+ document.removeEventListener("mousedown", o), document.removeEventListener("touchstart", o), document.removeEventListener("keydown", s);
336
+ };
337
+ }, [e, n, t]);
338
+ }, z = "dd.MM.yyyy", We = (t) => {
339
+ if (!t) return;
340
+ const e = O(t, z, /* @__PURE__ */ new Date());
341
+ return P(e) ? e : void 0;
342
+ }, Fe = (t) => {
343
+ if (!t) return;
344
+ const e = " - ", n = t.indexOf(e);
345
+ if (n === -1) {
346
+ const d = O(t.trim(), z, /* @__PURE__ */ new Date());
347
+ return P(d) ? { from: d, to: void 0 } : void 0;
348
+ }
349
+ const o = t.substring(0, n).trim(), s = t.substring(n + e.length).trim();
350
+ if (!o || !s) return;
351
+ const r = O(o, z, /* @__PURE__ */ new Date()), c = O(s, z, /* @__PURE__ */ new Date());
352
+ if (P(r) && P(c))
353
+ return { from: r, to: c };
354
+ }, Z = (t, e) => {
355
+ if (t)
356
+ return e === "single" ? We(t) : Fe(t);
357
+ }, Ve = (t, e) => {
358
+ const [n, o] = L(/* @__PURE__ */ new Date());
359
+ return {
360
+ month: F(() => {
361
+ const c = Z(t, e);
362
+ if (!c) return n;
363
+ if (e === "single" && c instanceof Date)
364
+ return c;
365
+ if (e === "range" && typeof c == "object" && "from" in c) {
366
+ const d = c;
367
+ if (d.from)
368
+ return d.from;
369
+ if (d.to)
370
+ return d.to;
371
+ }
372
+ return n;
373
+ }, [t, e, n]),
374
+ setMonth: (c) => {
375
+ o(c);
376
+ }
377
+ };
378
+ }, Ge = "_container_15bt3_1", He = "_label_15bt3_7", Ye = "_select_15bt3_14", Je = "_trigger_15bt3_19", Ke = "_triggerOpen_15bt3_46", Qe = "_placeholder_15bt3_67", Ue = "_selectedContent_15bt3_71", Xe = "_optionIcon_15bt3_81", Ze = "_arrow_15bt3_87", tn = "_open_15bt3_98", en = "_dropdown_15bt3_102", nn = "_option_15bt3_81", on = "_selected_15bt3_71", f = {
379
+ container: Ge,
380
+ label: He,
381
+ select: Ye,
382
+ trigger: Je,
383
+ triggerOpen: Ke,
384
+ placeholder: Qe,
385
+ selectedContent: Ue,
386
+ optionIcon: Xe,
387
+ arrow: Ze,
388
+ open: tn,
389
+ dropdown: en,
390
+ option: nn,
391
+ selected: on
392
+ }, an = (t) => {
393
+ const { className: e, disabled: n = !1, label: o, onChange: s, options: r, placeholder: c, value: d } = t, [p, m] = L(!1), h = U(null), y = r.find((_) => _.value === d), N = () => {
394
+ n || m(!p);
395
+ }, w = (_) => {
396
+ s?.(_), m(!1);
66
397
  };
67
- return q(() => {
68
- const t = (f) => {
69
- b.current && !b.current.contains(f.target) && u(!1);
398
+ return G(() => {
399
+ const _ = (C) => {
400
+ h.current && !h.current.contains(C.target) && m(!1);
70
401
  };
71
- return _ && document.addEventListener("mousedown", t), () => {
72
- document.removeEventListener("mousedown", t);
402
+ return p && document.addEventListener("mousedown", _), () => {
403
+ document.removeEventListener("mousedown", _);
73
404
  };
74
- }, [_]), /* @__PURE__ */ a("div", { className: i(n.container, r), children: [
75
- l && /* @__PURE__ */ e("label", { className: n.label, children: l }),
76
- /* @__PURE__ */ a("div", { className: n.select, ref: b, children: [
77
- /* @__PURE__ */ a(
405
+ }, [p]), /* @__PURE__ */ i("div", { className: u(f.container, e), children: [
406
+ o && /* @__PURE__ */ a("label", { className: f.label, children: o }),
407
+ /* @__PURE__ */ i("div", { className: f.select, ref: h, children: [
408
+ /* @__PURE__ */ i(
78
409
  "button",
79
410
  {
80
- className: i(n.trigger, _ && n.triggerOpen),
81
- disabled: c,
82
- onClick: k,
411
+ className: u(f.trigger, p && f.triggerOpen),
412
+ disabled: n,
413
+ onClick: N,
83
414
  type: "button",
84
415
  "aria-haspopup": "listbox",
85
- "aria-expanded": _,
416
+ "aria-expanded": p,
86
417
  children: [
87
- /* @__PURE__ */ a("span", { className: h ? n.selectedContent : n.placeholder, children: [
88
- h?.icon && /* @__PURE__ */ e("span", { className: n.optionIcon, children: h.icon }),
89
- h ? h.label : d || "Select an option"
418
+ /* @__PURE__ */ i("span", { className: y ? f.selectedContent : f.placeholder, children: [
419
+ y?.icon && /* @__PURE__ */ a("span", { className: f.optionIcon, children: y.icon }),
420
+ y ? y.label : c || "Select an option"
90
421
  ] }),
91
- /* @__PURE__ */ e("span", { className: i(n.arrow, _ && n.open), children: /* @__PURE__ */ e(C, {}) })
422
+ /* @__PURE__ */ a("span", { className: u(f.arrow, p && f.open), children: /* @__PURE__ */ a(rt, {}) })
92
423
  ]
93
424
  }
94
425
  ),
95
- _ && /* @__PURE__ */ e(v, { className: n.dropdown, role: "listbox", style: { maxHeight: 191 }, children: p.map((t) => /* @__PURE__ */ a(
426
+ p && /* @__PURE__ */ a(nt, { className: f.dropdown, role: "listbox", style: { maxHeight: 191 }, children: r.map((_) => /* @__PURE__ */ i(
96
427
  "button",
97
428
  {
98
- className: i(n.option, t.value === m && n.selected),
99
- onClick: () => y(t.value),
429
+ className: u(f.option, _.value === d && f.selected),
430
+ onClick: () => w(_.value),
100
431
  type: "button",
101
432
  role: "option",
102
- "aria-selected": t.value === m,
433
+ "aria-selected": _.value === d,
103
434
  children: [
104
- t.icon && /* @__PURE__ */ e("span", { className: n.optionIcon, children: t.icon }),
105
- t.label
435
+ _.icon && /* @__PURE__ */ a("span", { className: f.optionIcon, children: _.icon }),
436
+ _.label
106
437
  ]
107
438
  },
108
- t.value
439
+ _.value
109
440
  )) })
110
441
  ] })
111
442
  ] });
112
- }, ne = "_typography_11tbz_1", oe = "_icon_11tbz_8", se = "_large_11tbz_14", ce = "_h1_11tbz_20", le = "_h2_11tbz_26", ae = "_h3_11tbz_32", re = "_small_11tbz_68", _e = "_link_11tbz_80", N = {
113
- typography: ne,
114
- icon: oe,
115
- large: se,
116
- h1: ce,
117
- h2: le,
118
- h3: ae,
119
- "text-16": "_text-16_11tbz_38",
120
- "text-16-bold": "_text-16-bold_11tbz_44",
121
- "text-14": "_text-14_11tbz_50",
122
- "text-14-bold": "_text-14-bold_11tbz_56",
123
- "text-14-medium": "_text-14-medium_11tbz_62",
124
- small: re,
125
- "small-semibold": "_small-semibold_11tbz_74",
126
- link: _e,
127
- "small-link": "_small-link_11tbz_89"
128
- }, xe = (s) => {
129
- const { as: r = "span", children: c, className: l, icon: o, variant: p, ...d } = s;
130
- return /* @__PURE__ */ a(r, { className: i(N.typography, N[p], l), ...d, children: [
131
- o && /* @__PURE__ */ e("span", { className: N.icon, children: o }),
132
- c
443
+ }, tt = (t) => {
444
+ const e = (o) => {
445
+ if (t.onChange) {
446
+ const s = {
447
+ target: {
448
+ value: o
449
+ }
450
+ };
451
+ t.onChange(s);
452
+ }
453
+ }, n = t.options?.map((o) => ({
454
+ value: o.value.toString(),
455
+ label: o.label
456
+ })) || [];
457
+ return /* @__PURE__ */ a(
458
+ an,
459
+ {
460
+ className: t.className,
461
+ options: n,
462
+ value: t.value?.toString() || "",
463
+ onChange: e
464
+ }
465
+ );
466
+ };
467
+ tt.displayName = "DatePickerDropdown";
468
+ const sn = {
469
+ month_caption: l.monthsCaption,
470
+ button_previous: l.navButtonPrevious,
471
+ button_next: l.navButtonNext,
472
+ chevron: l.navIcon,
473
+ caption_label: l.captionLabel,
474
+ dropdowns: l.dropdowns,
475
+ dropdown_root: l.dropdown_root,
476
+ dropdown: l.dropdown,
477
+ dropdown_select_option: l.option,
478
+ months_dropdown: l.monthsDropdown,
479
+ years_dropdown: l.yearsDropdown,
480
+ month_grid: l.monthGrid,
481
+ weekday: l.weekday,
482
+ day_button: l.dayButton,
483
+ day: l.day,
484
+ outside: l.dayOutside,
485
+ selected: l.daySelected,
486
+ range_start: l.dayRangeStart,
487
+ range_middle: l.dayRangeMiddle,
488
+ range_end: l.dayRangeEnd,
489
+ today: l.dayToday
490
+ }, rn = {
491
+ Dropdown: tt
492
+ }, cn = {
493
+ weekStartsOn: 1,
494
+ showOutsideDays: !0,
495
+ reverseYears: !0,
496
+ captionLayout: "dropdown"
497
+ }, ln = {
498
+ components: rn,
499
+ ...cn
500
+ }, dn = (t) => ({
501
+ ...ln,
502
+ classNames: {
503
+ root: D(l.calendar, t && l.open),
504
+ ...sn
505
+ }
506
+ }), T = "dd.MM.yyyy", _n = (t) => t ? R(t, T) : "", pn = (t) => !t || !t.from ? "" : t.to && t.from.getTime() !== t.to.getTime() ? `${R(t.from, T)} - ${R(t.to, T)}` : R(t.from, T), Y = (t, e) => t ? e === "single" && t instanceof Date ? _n(t) : e === "range" && typeof t == "object" && "from" in t ? pn(t) : "" : "", un = ({
507
+ value: t,
508
+ mode: e,
509
+ onChange: n,
510
+ setMonth: o,
511
+ setIsOpen: s
512
+ }) => {
513
+ if (!t) {
514
+ n("");
515
+ return;
516
+ }
517
+ if (e === "single") {
518
+ t instanceof Date && (o(t), n(Y(t, "single")), s(!1));
519
+ return;
520
+ }
521
+ if (e === "range" && typeof t == "object" && "from" in t) {
522
+ const r = t;
523
+ r.from ? o(r.from) : r.to && o(r.to);
524
+ const c = Y(r, "range");
525
+ n(c), r.from && r.to && r.from.getTime() !== r.to.getTime() && s(!1);
526
+ }
527
+ }, mn = (t, e, n) => {
528
+ if (t) {
529
+ if (e === "single" && t instanceof Date) {
530
+ n(t);
531
+ return;
532
+ }
533
+ if (e === "range" && typeof t == "object" && "from" in t) {
534
+ const o = t;
535
+ o.from ? n(o.from) : o.to && n(o.to);
536
+ }
537
+ }
538
+ }, Bn = ({
539
+ mode: t,
540
+ value: e,
541
+ onChange: n,
542
+ disabled: o,
543
+ label: s,
544
+ error: r,
545
+ placeholder: c,
546
+ ...d
547
+ }) => {
548
+ const [p, m] = L(!1), h = U(null), { month: y, setMonth: N } = Ve(e, t), w = F(() => Z(e, t), [e, t]);
549
+ G(() => {
550
+ mn(w, t, N);
551
+ }, [w, t, N]), Ae({ ref: h, isOpen: p, onDismiss: () => {
552
+ m(!1);
553
+ } });
554
+ const C = (v) => {
555
+ v.stopPropagation(), x(void 0);
556
+ }, S = () => {
557
+ o || m((v) => !v);
558
+ }, I = (v) => {
559
+ const et = v.currentTarget.value;
560
+ n(et);
561
+ }, x = (v) => {
562
+ un({
563
+ value: v,
564
+ mode: t,
565
+ onChange: n,
566
+ setMonth: N,
567
+ setIsOpen: m
568
+ });
569
+ }, E = F(() => dn(p), [p]);
570
+ return /* @__PURE__ */ i("div", { ref: h, className: l.wrapper, children: [
571
+ /* @__PURE__ */ i("div", { className: l.inputContainer, children: [
572
+ s && /* @__PURE__ */ a("span", { className: o ? l.disabledLabel : l.label, children: /* @__PURE__ */ a(V, { variant: "text-14", children: s }) }),
573
+ /* @__PURE__ */ i("div", { className: l.inputWrapper, children: [
574
+ /* @__PURE__ */ a(
575
+ "input",
576
+ {
577
+ type: "text",
578
+ className: D(l.trigger, r && l.error),
579
+ onClick: S,
580
+ value: e,
581
+ onChange: I,
582
+ placeholder: c,
583
+ disabled: o,
584
+ "aria-label": s || "Select date",
585
+ "aria-expanded": p,
586
+ "aria-haspopup": "dialog",
587
+ "aria-invalid": r ? "true" : "false",
588
+ ...d
589
+ }
590
+ ),
591
+ e && !o && /* @__PURE__ */ a(
592
+ "button",
593
+ {
594
+ type: "button",
595
+ className: l.clearButton,
596
+ onClick: C,
597
+ "aria-label": "Clear date",
598
+ children: /* @__PURE__ */ a(J, { className: l.clearIcon })
599
+ }
600
+ ),
601
+ /* @__PURE__ */ a(ct, { className: D(l.icon, !e && l.placeholder) })
602
+ ] }),
603
+ r && /* @__PURE__ */ a(V, { variant: "small", className: l.error, children: r })
604
+ ] }),
605
+ t === "single" ? /* @__PURE__ */ a(
606
+ H,
607
+ {
608
+ ...E,
609
+ month: y,
610
+ onMonthChange: N,
611
+ mode: "single",
612
+ selected: w instanceof Date ? w : void 0,
613
+ onSelect: x
614
+ }
615
+ ) : /* @__PURE__ */ a(
616
+ H,
617
+ {
618
+ ...E,
619
+ month: y,
620
+ onMonthChange: N,
621
+ mode: "range",
622
+ selected: w && typeof w == "object" && "from" in w ? w : void 0,
623
+ onSelect: x
624
+ }
625
+ )
133
626
  ] });
134
627
  };
135
628
  export {
136
- be as Button,
137
- he as Checkbox,
138
- ge as Radio,
139
- ze as Select,
140
- ve as SimpleBar,
141
- xe as Typography,
142
- ye as clsx
629
+ X as Alert,
630
+ xn as Button,
631
+ In as Card,
632
+ Sn as Checkbox,
633
+ Bn as DatePicker,
634
+ It as Input,
635
+ Dn as Label,
636
+ $n as Radio,
637
+ an as Select,
638
+ zn as SimpleBar,
639
+ En as Tab,
640
+ Pt as Textarea,
641
+ V as Typography,
642
+ Pn as clsx,
643
+ Cn as toastError,
644
+ kn as toastSuccess
143
645
  };
144
646
  //# sourceMappingURL=index.js.map