@companix/uikit 0.0.16 → 0.0.18

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 (60) hide show
  1. package/dist/DatePicker/index.d.ts +2 -3
  2. package/dist/Input/Form.scss +1 -4
  3. package/dist/Input/InlineInput.d.ts +0 -0
  4. package/dist/Input/{index.d.ts → Input.d.ts} +4 -8
  5. package/dist/Input/Input.scss +23 -0
  6. package/dist/Input/InputContainer.d.ts +11 -0
  7. package/dist/Input/InputElement.d.ts +7 -0
  8. package/dist/NumberInput/index.d.ts +2 -2
  9. package/dist/Select/SelectOptions.d.ts +12 -0
  10. package/dist/Select/SelectRight.d.ts +8 -0
  11. package/dist/Select/index.d.ts +4 -0
  12. package/dist/TimePicker/index.d.ts +10 -0
  13. package/dist/__hooks/use-input-padding.d.ts +5 -0
  14. package/dist/__hooks/use-scrollbox.d.ts +1 -1
  15. package/dist/__hooks/use-update.d.ts +1 -1
  16. package/dist/__utils/utils.d.ts +15 -1
  17. package/dist/bundle.es.js +51 -46
  18. package/dist/bundle.es10.js +1 -1
  19. package/dist/bundle.es14.js +1 -1
  20. package/dist/bundle.es16.js +37 -13
  21. package/dist/bundle.es19.js +1 -1
  22. package/dist/bundle.es20.js +1 -1
  23. package/dist/bundle.es23.js +1 -1
  24. package/dist/bundle.es24.js +2 -2
  25. package/dist/bundle.es25.js +93 -85
  26. package/dist/bundle.es26.js +67 -29
  27. package/dist/bundle.es27.js +34 -10
  28. package/dist/bundle.es28.js +11 -10
  29. package/dist/bundle.es29.js +82 -21
  30. package/dist/bundle.es30.js +10 -35
  31. package/dist/bundle.es31.js +21 -20
  32. package/dist/bundle.es32.js +36 -83
  33. package/dist/bundle.es33.js +23 -17
  34. package/dist/bundle.es34.js +87 -14
  35. package/dist/bundle.es35.js +18 -22
  36. package/dist/bundle.es36.js +20 -5
  37. package/dist/bundle.es37.js +24 -14
  38. package/dist/bundle.es38.js +39 -14
  39. package/dist/bundle.es39.js +20 -68
  40. package/dist/bundle.es40.js +5 -68
  41. package/dist/bundle.es41.js +13 -31
  42. package/dist/bundle.es42.js +14 -68
  43. package/dist/bundle.es43.js +66 -39
  44. package/dist/bundle.es44.js +67 -30
  45. package/dist/bundle.es45.js +69 -74
  46. package/dist/bundle.es46.js +10 -48
  47. package/dist/bundle.es47.js +45 -0
  48. package/dist/bundle.es48.js +34 -0
  49. package/dist/bundle.es49.js +70 -0
  50. package/dist/bundle.es50.js +77 -0
  51. package/dist/bundle.es51.js +51 -0
  52. package/dist/bundle.es52.js +16 -0
  53. package/dist/bundle.es53.js +45 -0
  54. package/dist/bundle.es54.js +16 -0
  55. package/dist/bundle.es8.js +54 -62
  56. package/dist/bundle.es9.js +35 -70
  57. package/dist/index.d.ts +4 -2
  58. package/dist/index.scss +2 -2
  59. package/dist/types.d.ts +4 -0
  60. package/package.json +2 -3
@@ -1,85 +1,38 @@
1
- import { jsxs as n, jsx as c } from "react/jsx-runtime";
2
- import R from "classnames";
3
- import { attr as r } from "@companix/utils-browser";
4
- import { forwardRef as b, useRef as w, useCallback as y } from "react";
5
- import { Icon as a } from "./bundle.es35.js";
6
- import { faClose as D, faChevronDown as T } from "@fortawesome/free-solid-svg-icons";
7
- import { VisuallyHidden as j } from "@radix-ui/react-visually-hidden";
8
- import { mergeRefs as O } from "react-merge-refs";
9
- const J = b(
10
- ({
11
- required: u,
12
- size: d,
13
- fill: m,
14
- leftElement: l,
15
- className: f,
16
- value: o,
17
- clearButton: p,
18
- placeholder: C,
19
- clearButtonIcon: h,
20
- disabled: s,
21
- onClear: I,
22
- inputRef: N,
23
- ...i
24
- }, k) => {
25
- const e = w(null), x = y(
26
- (t) => {
27
- if (!e.current || !document)
28
- return;
29
- t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
30
- },
31
- [e]
32
- ), v = (t) => {
33
- document && document.activeElement === e.current && t.preventDefault();
34
- }, F = (t) => {
35
- s || x(t);
36
- }, g = (t) => {
37
- v(t);
38
- }, z = (t) => {
39
- e.current && e.current.focus(), I?.(t);
40
- };
41
- return /* @__PURE__ */ n(
42
- "div",
43
- {
44
- ref: k,
45
- className: R("form select", f),
46
- "data-size": d ?? "md",
47
- "data-fill": r(m),
48
- "data-required": r(u),
49
- "data-disabled": r(s),
50
- onMouseDown: g,
51
- ...i,
52
- onClick: F,
53
- children: [
54
- /* @__PURE__ */ n("div", { className: "select-layout form-input", children: [
55
- l && /* @__PURE__ */ c("div", { className: "select-element", children: l }),
56
- /* @__PURE__ */ c("div", { className: "select-content", children: /* @__PURE__ */ n("div", { className: "select-content-text", "aria-disabled": s, children: [
57
- !o && /* @__PURE__ */ c("span", { className: "select-placeholder", children: C }),
58
- o
59
- ] }) }),
60
- /* @__PURE__ */ n("div", { className: "select-element", children: [
61
- p && o && /* @__PURE__ */ c("button", { className: "select-close-button", onClick: z, children: h ?? /* @__PURE__ */ c(a, { className: "select-close-icon", icon: D, size: "xxxs" }) }),
62
- /* @__PURE__ */ c(a, { className: "expand-icon select-expand", icon: T, size: "xxxs" })
63
- ] })
64
- ] }),
65
- /* @__PURE__ */ c(j, { asChild: !0, children: /* @__PURE__ */ c(
66
- "input",
67
- {
68
- ref: O([N, e]),
69
- autoComplete: "off",
70
- autoCapitalize: "none",
71
- autoCorrect: "off",
72
- spellCheck: "false",
73
- "aria-autocomplete": "none",
74
- onClick: i.onClick,
75
- readOnly: !0
76
- }
77
- ) })
78
- ]
79
- }
80
- );
81
- }
82
- );
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { hash as d } from "@companix/utils-js";
3
+ import { Viewport as s } from "./bundle.es49.js";
4
+ import { useRef as c, useMemo as l } from "react";
5
+ const f = (i = {}) => {
6
+ const t = {
7
+ emit: (e) => {
8
+ console.error("uninitialized", e);
9
+ }
10
+ };
11
+ return {
12
+ send: (e) => {
13
+ t.emit({ ...e, id: d() });
14
+ },
15
+ Viewport: (e = {}) => {
16
+ const n = c(null);
17
+ return l(() => {
18
+ t.emit = (r) => {
19
+ n.current && n.current.addToast(r);
20
+ };
21
+ }, []), /* @__PURE__ */ a(
22
+ s,
23
+ {
24
+ ref: n,
25
+ align: e.align ?? i.align,
26
+ closeIcon: e.closeIcon ?? i.closeIcon,
27
+ duration: e.duration ?? i.duration,
28
+ gap: e.gap ?? i.gap,
29
+ side: e.side ?? i.side,
30
+ swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
31
+ }
32
+ );
33
+ }
34
+ };
35
+ };
83
36
  export {
84
- J as SelectInput
37
+ f as createToaster
85
38
  };
@@ -1,20 +1,26 @@
1
- import { useRef as i, useCallback as T } from "react";
2
- const a = () => {
3
- const t = i(null), l = i(null);
4
- return { scrollToElement: T(
5
- (r, u = !1) => {
6
- const o = t.current, s = l.current;
7
- if (!o || !s || r < 0 || r > s.children.length)
8
- return;
9
- const n = s.children[r];
10
- if (!n)
11
- return;
12
- const c = o.offsetHeight, f = o.scrollTop, e = n.offsetTop, p = n.offsetHeight;
13
- u ? o.scrollTop = e - c / 2 + p / 2 : e + p > c + f ? o.scrollTop = e - c + p : e < f && (o.scrollTop = e);
14
- },
15
- [l, t]
16
- ), scrollBoxRef: t, optionsWrapperRef: l };
1
+ import { useRef as s, useCallback as c } from "react";
2
+ const p = () => {
3
+ const t = s(null), r = s({ cb: null }), i = c(() => {
4
+ if (t.current && t.current.parentElement) {
5
+ const e = t.current.parentElement, u = e.style.getPropertyValue("--radix-popper-anchor-width"), n = e.style.getPropertyValue("transform"), o = new MutationObserver(() => {
6
+ e.style.transform !== n && e.style.setProperty("transform", n);
7
+ });
8
+ o.observe(e, {
9
+ attributes: !0,
10
+ attributeFilter: ["style"]
11
+ }), r.current.cb = () => {
12
+ o.disconnect();
13
+ }, t.current.style.setProperty("--radix-popover-trigger-width", u);
14
+ }
15
+ }, []), l = c(() => {
16
+ r.current.cb && (r.current.cb(), r.current.cb = null);
17
+ }, []);
18
+ return {
19
+ popoverRef: t,
20
+ handleAnimationEnd: l,
21
+ froozePopoverPosition: i
22
+ };
17
23
  };
18
24
  export {
19
- a as useScrollListController
25
+ p as useFroozeClosing
20
26
  };
@@ -1,16 +1,89 @@
1
- import { useRef as u, useLayoutEffect as f, useEffect as s } from "react";
2
- const o = (t, r) => {
3
- const e = u(!1);
4
- f(() => {
5
- e.current = !0, t();
6
- }, []), s(() => {
7
- if (e.current) {
8
- e.current = !1;
9
- return;
10
- }
11
- t();
12
- }, r);
13
- };
1
+ import { jsxs as o, jsx as c } from "react/jsx-runtime";
2
+ import A from "classnames";
3
+ import { attr as l } from "@companix/utils-browser";
4
+ import { forwardRef as y, useRef as S, useCallback as T } from "react";
5
+ import { VisuallyHidden as j } from "@radix-ui/react-visually-hidden";
6
+ import { mergeRefs as w } from "react-merge-refs";
7
+ import { SelectRightElements as z } from "./bundle.es46.js";
8
+ const V = y(
9
+ ({
10
+ required: a,
11
+ size: u,
12
+ fill: d,
13
+ leftElement: s,
14
+ className: m,
15
+ value: n,
16
+ clearButton: f,
17
+ placeholder: p,
18
+ clearButtonIcon: h,
19
+ disabled: r,
20
+ onClear: C,
21
+ inputRef: I,
22
+ ...i
23
+ }, k) => {
24
+ const e = S(null), N = T(
25
+ (t) => {
26
+ if (!e.current || !document)
27
+ return;
28
+ t.target !== e.current && (e.current.click(), document.activeElement !== e.current && e.current.focus());
29
+ },
30
+ [e]
31
+ ), v = (t) => {
32
+ document && document.activeElement === e.current && t.preventDefault();
33
+ }, F = (t) => {
34
+ r || N(t);
35
+ }, g = (t) => {
36
+ v(t);
37
+ }, R = (t) => {
38
+ e.current && e.current.focus(), C?.(t);
39
+ };
40
+ return /* @__PURE__ */ o(
41
+ "div",
42
+ {
43
+ ref: k,
44
+ className: A("form select", m),
45
+ "data-size": u ?? "md",
46
+ "data-fill": l(d),
47
+ "data-required": l(a),
48
+ "data-disabled": l(r),
49
+ onMouseDown: g,
50
+ ...i,
51
+ onClick: F,
52
+ children: [
53
+ /* @__PURE__ */ o("div", { className: "select-layout form-input", children: [
54
+ s && /* @__PURE__ */ c("div", { className: "select-element", children: s }),
55
+ /* @__PURE__ */ c("div", { className: "select-content", children: /* @__PURE__ */ o("div", { className: "select-content-text", "aria-disabled": r, children: [
56
+ !n && /* @__PURE__ */ c("span", { className: "select-placeholder", children: p }),
57
+ n
58
+ ] }) }),
59
+ /* @__PURE__ */ c("div", { className: "select-element", children: /* @__PURE__ */ c(
60
+ z,
61
+ {
62
+ clearButton: f,
63
+ value: !!n,
64
+ clearButtonIcon: h,
65
+ onClear: R
66
+ }
67
+ ) })
68
+ ] }),
69
+ /* @__PURE__ */ c(j, { asChild: !0, children: /* @__PURE__ */ c(
70
+ "input",
71
+ {
72
+ ref: w([I, e]),
73
+ autoComplete: "off",
74
+ autoCapitalize: "none",
75
+ autoCorrect: "off",
76
+ spellCheck: "false",
77
+ "aria-autocomplete": "none",
78
+ onClick: i.onClick,
79
+ readOnly: !0
80
+ }
81
+ ) })
82
+ ]
83
+ }
84
+ );
85
+ }
86
+ );
14
87
  export {
15
- o as useLayoutAndUpdate
88
+ V as SelectInput
16
89
  };
@@ -1,24 +1,20 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import f from "classnames";
3
- import { forwardRef as l } from "react";
4
- const g = l(
5
- ({ icon: r, className: t, size: i = "m", ...e }, a) => {
6
- const [n, c, , , m] = r.icon;
7
- return /* @__PURE__ */ o(
8
- "svg",
9
- {
10
- ref: a,
11
- "data-prefix": r.prefix,
12
- "data-icon": r.iconName,
13
- viewBox: `0 0 ${n} ${c}`,
14
- className: f(`icon icon-size-${i}`, t),
15
- ...e,
16
- role: "img",
17
- children: /* @__PURE__ */ o(s, { paths: m })
18
- }
19
- );
20
- }
21
- ), s = ({ paths: r }) => Array.isArray(r) ? /* @__PURE__ */ o("g", { children: r.map((t, i) => /* @__PURE__ */ o("path", { fill: "currentColor", d: t }, `-d-${i}`)) }) : /* @__PURE__ */ o("path", { fill: "currentColor", d: r });
1
+ import { useRef as u, useCallback as T } from "react";
2
+ const g = () => {
3
+ const l = u(null), t = u(null);
4
+ return { scrollToElement: T(
5
+ (r, f) => {
6
+ const o = l.current, s = t.current;
7
+ if (!o || !s || r < 0 || r > s.children.length)
8
+ return;
9
+ const c = s.children[r];
10
+ if (!c)
11
+ return;
12
+ const n = o.offsetHeight, i = o.scrollTop, e = c.offsetTop, p = c.offsetHeight;
13
+ f === "center" ? o.scrollTop = e - n / 2 + p / 2 : f === "top" ? o.scrollTop = e : e + p > n + i ? o.scrollTop = e - n + p : e < i && (o.scrollTop = e);
14
+ },
15
+ [t, l]
16
+ ), scrollBoxRef: l, optionsWrapperRef: t };
17
+ };
22
18
  export {
23
- g as Icon
19
+ g as useScrollListController
24
20
  };
@@ -1,7 +1,22 @@
1
- import { useEffect as r } from "react";
2
- const n = ({ callback: e }) => (r(() => () => {
3
- e?.();
4
- }, []), null);
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useEffect as a } from "react";
3
+ import { OptionItem as f } from "./bundle.es10.js";
4
+ import { OptionsList as O } from "./bundle.es12.js";
5
+ const h = (t) => {
6
+ const { active: i, onOpened: m, scrollboxRef: n, optionsWrapperRef: r, options: p, onSelect: s, minimalOptions: c } = t;
7
+ return a(() => {
8
+ m?.();
9
+ }, []), /* @__PURE__ */ o(O, { scrollboxRef: n, optionsWrapperRef: r, maxHeight: 300, children: p.map((e, l) => /* @__PURE__ */ o(
10
+ f,
11
+ {
12
+ active: i === e.value,
13
+ onClick: () => s?.(e.value),
14
+ minimal: c,
15
+ ...e
16
+ },
17
+ `select-option-${l}`
18
+ )) });
19
+ };
5
20
  export {
6
- n as RemoveListener
21
+ h as SelectOptions
7
22
  };
@@ -1,16 +1,26 @@
1
- import { useState as e } from "react";
2
- const d = ({ onClick: t }) => {
3
- const [a, s] = e({ isLoading: !1, isError: !1 });
4
- return { ...a, handleClick: (r) => {
5
- a.isLoading || t(() => {
6
- s({ isLoading: !0, isError: !1 });
7
- }, r).then(() => {
8
- s({ isLoading: !1, isError: !1 });
9
- }).catch(() => {
10
- s({ isLoading: !1, isError: !0 });
11
- });
12
- } };
13
- };
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { forwardRef as m, useCallback as i } from "react";
3
+ import c from "react-input-mask";
4
+ const I = m(
5
+ ({ mask: r, maskChar: f, onChange: n, onValueChange: o, ...a }, e) => {
6
+ const p = i(
7
+ (t) => {
8
+ n?.(t), o?.(t.target.value, t.target);
9
+ },
10
+ [n, o]
11
+ );
12
+ return r ? /* @__PURE__ */ u(
13
+ c,
14
+ {
15
+ inputRef: e,
16
+ mask: r,
17
+ maskChar: f,
18
+ onChange: p,
19
+ ...a
20
+ }
21
+ ) : /* @__PURE__ */ u("input", { ref: e, ...a, onChange: p });
22
+ }
23
+ );
14
24
  export {
15
- d as useLoading
25
+ I as InputElement
16
26
  };
@@ -1,16 +1,41 @@
1
- import { useRef as i, useCallback as o } from "react";
2
- const f = (e, s) => {
3
- const r = i(null), c = i(void 0), n = o(
4
- (t) => {
5
- s && t.offsetParent && (t.style.height = "", t.style.height = `${t.scrollHeight}px`, t.scrollHeight !== c.current && e && (e(t), c.current = t.scrollHeight));
6
- },
7
- [s, e]
8
- ), l = o(() => {
9
- const t = r.current;
10
- t && n(t);
11
- }, [r, n]);
12
- return [r, l];
13
- };
1
+ import { jsxs as b, jsx as o } from "react/jsx-runtime";
2
+ import h from "classnames";
3
+ import { attr as e } from "@companix/utils-browser";
4
+ import { forwardRef as x } from "react";
5
+ import { useInputPadding as N } from "./bundle.es52.js";
6
+ const v = x(
7
+ ({
8
+ required: s,
9
+ disabled: t,
10
+ size: i,
11
+ fill: d,
12
+ leftElement: r,
13
+ rightElement: a,
14
+ className: f,
15
+ inputRef: m,
16
+ children: n,
17
+ ...p
18
+ }, c) => {
19
+ const { leftRef: l, rightRef: u } = N(m, [r, a]);
20
+ return /* @__PURE__ */ b(
21
+ "div",
22
+ {
23
+ ref: c,
24
+ className: h("form", f),
25
+ "data-size": i ?? "md",
26
+ "data-fill": e(d),
27
+ "data-required": e(s),
28
+ "data-disabled": e(t),
29
+ ...p,
30
+ children: [
31
+ r && /* @__PURE__ */ o("span", { ref: l, className: "form-input-base-left-element", children: r }),
32
+ n,
33
+ a && /* @__PURE__ */ o("span", { ref: u, className: "form-input-base-right-element", children: a })
34
+ ]
35
+ }
36
+ );
37
+ }
38
+ );
14
39
  export {
15
- f as useResizeTextarea
40
+ v as InputContainer
16
41
  };
@@ -1,72 +1,24 @@
1
- import { jsxs as D, jsx as t } from "react/jsx-runtime";
2
- import { dateToFormat as $, weeks as g, createVoids as p, getDayIndex as b, getFirstDay as u, getMonthMaxDay as k } from "./bundle.es44.js";
3
- import { CalendarHeader as F } from "./bundle.es45.js";
4
- import { useCalendar as j } from "./bundle.es46.js";
5
- import { attr as m } from "@companix/utils-browser";
6
- import { isSameDate as f } from "./bundle.es40.js";
7
- import { useLayoutEffect as I } from "react";
8
- const T = ({ disablePickers: c, value: e, onChange: i, ...l }) => {
9
- const {
10
- viewDate: n,
11
- setViewDate: r,
12
- setNextMonth: N,
13
- setPrevMonth: x,
14
- isMonthDisabled: M,
15
- isYearDisabled: v,
16
- isDayDisabled: w
17
- } = j(l);
18
- I(() => {
19
- e && r(e);
20
- }, [e]);
21
- const o = $(n), h = n.getMonth(), y = n.getFullYear(), C = /* @__PURE__ */ new Date();
22
- return /* @__PURE__ */ D("div", { className: "calendar", children: [
23
- /* @__PURE__ */ t(
24
- F,
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import f from "classnames";
3
+ import { forwardRef as l } from "react";
4
+ const g = l(
5
+ ({ icon: r, className: t, size: i = "m", ...e }, a) => {
6
+ const [n, c, , , m] = r.icon;
7
+ return /* @__PURE__ */ o(
8
+ "svg",
25
9
  {
26
- viewDate: n,
27
- onChange: r,
28
- onNextMonth: N,
29
- onPrevMonth: x,
30
- disablePickers: c,
31
- isMonthDisabled: M,
32
- isYearDisabled: v
10
+ ref: a,
11
+ "data-prefix": r.prefix,
12
+ "data-icon": r.iconName,
13
+ viewBox: `0 0 ${n} ${c}`,
14
+ className: f(`icon icon-size-${i}`, t),
15
+ ...e,
16
+ role: "img",
17
+ children: /* @__PURE__ */ o(s, { paths: m })
33
18
  }
34
- ),
35
- /* @__PURE__ */ t("div", { className: "calendar-names", children: g.map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-name", children: d }, `week-name-${a}`)) }),
36
- /* @__PURE__ */ D("div", { className: "calendar-days", children: [
37
- p(b(u(o.month, o.year))).map((d, a) => /* @__PURE__ */ t("div", { className: "calendar-day", "data-void": !0 }, `void-${d}-${a}`)),
38
- p(k(o.month, o.year)).map((d, a) => {
39
- const s = new Date(y, h, a + 1);
40
- return /* @__PURE__ */ t(
41
- P,
42
- {
43
- day: a + 1,
44
- disabled: w(s),
45
- selected: !!(e && f(e, s)),
46
- today: f(s, C),
47
- onSelect: () => i?.(s)
48
- },
49
- `date-${d}-${y}-${h}-${a}`
50
- );
51
- })
52
- ] })
53
- ] });
54
- }, P = ({ day: c, disabled: e, selected: i, today: l, onSelect: n }) => {
55
- const r = () => {
56
- e || n?.();
57
- };
58
- return /* @__PURE__ */ t(
59
- "div",
60
- {
61
- className: "calendar-day",
62
- "data-disabled": m(e),
63
- "data-selected": m(i),
64
- "data-today": m(l),
65
- onClick: r,
66
- children: /* @__PURE__ */ t("span", { className: "calendar-day-number", children: c })
67
- }
68
- );
69
- };
19
+ );
20
+ }
21
+ ), s = ({ paths: r }) => Array.isArray(r) ? /* @__PURE__ */ o("g", { children: r.map((t, i) => /* @__PURE__ */ o("path", { fill: "currentColor", d: t }, `-d-${i}`)) }) : /* @__PURE__ */ o("path", { fill: "currentColor", d: r });
70
22
  export {
71
- T as Calendar
23
+ g as Icon
72
24
  };
@@ -1,70 +1,7 @@
1
- import { useMemo as D, useCallback as c } from "react";
2
- function l(e, t) {
3
- return e.getDate() === t.getDate() && e.getMonth() === t.getMonth() && e.getFullYear() === t.getFullYear();
4
- }
5
- function f(e) {
6
- const t = new Date(e);
7
- return t.setHours(0, 0, 0, 0), t;
8
- }
9
- function h(e) {
10
- const t = new Date(e);
11
- return t.setHours(23, 59, 59, 999), t;
12
- }
13
- function M(e, t = {}) {
14
- const { min: n, max: r, withTime: s = !1 } = t;
15
- return !s && (n && l(e, n) || r && l(e, r)) ? !1 : !!(n && e < n || r && e > r);
16
- }
17
- function m(e, t) {
18
- const n = new Date(e);
19
- if (!t)
20
- return n;
21
- const r = n.getDate(), s = new Date(e);
22
- s.setMonth(n.getMonth() + t + 1, 0);
23
- const a = s.getDate();
24
- return r >= a ? s : (n.setFullYear(s.getFullYear(), s.getMonth(), r), n);
25
- }
26
- function F(e, t) {
27
- return m(e, -1);
28
- }
29
- function g(e) {
30
- const t = new Date(e), n = new Date(t);
31
- return n.setFullYear(t.getFullYear(), t.getMonth() + 1, 0), n.setHours(0, 0, 0, 0), n.getDate();
32
- }
33
- function Y(e, t) {
34
- const n = new Date(e);
35
- return n.setFullYear(t), n;
36
- }
37
- function y(e, t) {
38
- const n = new Date(e), r = n.getFullYear(), s = n.getDate(), a = new Date(e);
39
- a.setFullYear(r, t, 15), a.setHours(0, 0, 0, 0);
40
- const u = g(a);
41
- return n.setMonth(t, Math.min(s, u)), n;
42
- }
43
- const w = (e) => {
44
- const { disableFuture: t, disablePast: n, maxDateTime: r, minDateTime: s, shouldDisableDate: a } = e;
45
- return (u, i) => {
46
- const o = /* @__PURE__ */ new Date();
47
- return a ? a(u) : t ? f(u) > o : n ? h(u) < o : s || r ? M(u, { min: s, max: r, withTime: i }) : !1;
48
- };
49
- }, d = (e) => {
50
- const t = D(() => w(e), [
51
- e.disableFuture,
52
- e.disablePast,
53
- e.shouldDisableDate,
54
- e.minDateTime,
55
- e.maxDateTime
56
- ]);
57
- return c(t, [t]);
58
- };
1
+ import { useEffect as r } from "react";
2
+ const n = ({ callback: e }) => (r(() => () => {
3
+ e?.();
4
+ }, []), null);
59
5
  export {
60
- m as addMonths,
61
- w as createDayDisableChecker,
62
- h as endOfDay,
63
- M as isDayMinMaxRestricted,
64
- l as isSameDate,
65
- y as setMonth,
66
- Y as setYear,
67
- f as startOfDay,
68
- F as subMonths,
69
- d as useDayDisableCheker
6
+ n as RemoveListener
70
7
  };
@@ -1,34 +1,16 @@
1
- import { jsx as s, Fragment as p } from "react/jsx-runtime";
2
- import { forwardRef as f, useState as u, useImperativeHandle as c } from "react";
3
- import { AlertDialog as x } from "./bundle.es19.js";
4
- const g = f((a, l) => {
5
- const [i, n] = u([]);
6
- c(
7
- l,
8
- () => ({
9
- showAlert: (e) => {
10
- n((t) => [...t, e]);
11
- }
12
- }),
13
- []
14
- );
15
- const d = (e) => {
16
- n((t) => {
17
- const r = [...t], o = r.findIndex((m) => m.id === e);
18
- return o !== -1 && r.splice(o, 1), r;
1
+ import { useState as e } from "react";
2
+ const d = ({ onClick: t }) => {
3
+ const [a, s] = e({ isLoading: !1, isError: !1 });
4
+ return { ...a, handleClick: (r) => {
5
+ a.isLoading || t(() => {
6
+ s({ isLoading: !0, isError: !1 });
7
+ }, r).then(() => {
8
+ s({ isLoading: !1, isError: !1 });
9
+ }).catch(() => {
10
+ s({ isLoading: !1, isError: !0 });
19
11
  });
20
- };
21
- return /* @__PURE__ */ s(p, { children: i.map(({ id: e, ...t }) => /* @__PURE__ */ s(
22
- x,
23
- {
24
- defaultOpen: !0,
25
- onUnMounted: () => d(e),
26
- ...a,
27
- ...t
28
- },
29
- `alert-${e}`
30
- )) });
31
- });
12
+ } };
13
+ };
32
14
  export {
33
- g as Viewport
15
+ d as useLoading
34
16
  };