snapflow-ui-kit 0.0.5 → 1.0.1

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