@companix/uikit 0.1.42 → 0.1.44
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.
- package/dist/CounterInput/CounterInput.scss +29 -0
- package/dist/CounterInput/index.d.ts +14 -0
- package/dist/Select/index.d.ts +9 -1
- package/dist/bundle.es.js +122 -120
- package/dist/bundle.es10.js +1 -1
- package/dist/bundle.es13.js +82 -76
- package/dist/bundle.es14.js +4 -4
- package/dist/bundle.es15.js +2 -2
- package/dist/bundle.es16.js +1 -1
- package/dist/bundle.es17.js +1 -1
- package/dist/bundle.es18.js +105 -19
- package/dist/bundle.es19.js +21 -34
- package/dist/bundle.es20.js +33 -24
- package/dist/bundle.es21.js +24 -45
- package/dist/bundle.es22.js +46 -26
- package/dist/bundle.es23.js +24 -259
- package/dist/bundle.es24.js +260 -13
- package/dist/bundle.es25.js +14 -21
- package/dist/bundle.es26.js +20 -37
- package/dist/bundle.es27.js +38 -21
- package/dist/bundle.es28.js +20 -18
- package/dist/bundle.es29.js +18 -21
- package/dist/bundle.es30.js +21 -43
- package/dist/bundle.es31.js +37 -114
- package/dist/bundle.es32.js +119 -72
- package/dist/bundle.es33.js +68 -38
- package/dist/bundle.es34.js +42 -10
- package/dist/bundle.es35.js +11 -85
- package/dist/bundle.es36.js +85 -19
- package/dist/bundle.es37.js +20 -7
- package/dist/bundle.es38.js +7 -3
- package/dist/bundle.es39.js +3 -23
- package/dist/bundle.es40.js +16 -45
- package/dist/bundle.es41.js +51 -56
- package/dist/bundle.es42.js +57 -162
- package/dist/bundle.es43.js +160 -79
- package/dist/bundle.es44.js +81 -7
- package/dist/bundle.es45.js +7 -59
- package/dist/bundle.es46.js +58 -33
- package/dist/bundle.es47.js +33 -20
- package/dist/bundle.es48.js +19 -47
- package/dist/bundle.es49.js +49 -11
- package/dist/bundle.es50.js +11 -13
- package/dist/bundle.es51.js +13 -13
- package/dist/bundle.es52.js +13 -30
- package/dist/bundle.es53.js +30 -11
- package/dist/bundle.es54.js +10 -25
- package/dist/bundle.es55.js +17 -29
- package/dist/bundle.es56.js +36 -48
- package/dist/bundle.es57.js +49 -55
- package/dist/bundle.es58.js +56 -8
- package/dist/bundle.es59.js +8 -26
- package/dist/bundle.es60.js +27 -5
- package/dist/bundle.es61.js +5 -66
- package/dist/bundle.es62.js +66 -23
- package/dist/bundle.es63.js +22 -23
- package/dist/bundle.es64.js +24 -90
- package/dist/bundle.es65.js +90 -18
- package/dist/bundle.es66.js +17 -93
- package/dist/bundle.es67.js +93 -73
- package/dist/bundle.es68.js +73 -23
- package/dist/bundle.es69.js +20 -35
- package/dist/bundle.es70.js +39 -24
- package/dist/bundle.es71.js +24 -79
- package/dist/bundle.es72.js +71 -85
- package/dist/bundle.es73.js +93 -10
- package/dist/bundle.es74.js +10 -6
- package/dist/bundle.es75.js +5 -69
- package/dist/bundle.es76.js +68 -10
- package/dist/bundle.es77.js +11 -42
- package/dist/bundle.es78.js +42 -32
- package/dist/bundle.es79.js +31 -64
- package/dist/bundle.es80.js +65 -40
- package/dist/bundle.es81.js +40 -14
- package/dist/bundle.es82.js +15 -32
- package/dist/bundle.es83.js +23 -61
- package/dist/bundle.es84.js +69 -13
- package/dist/bundle.es85.js +13 -74
- package/dist/bundle.es86.js +71 -45
- package/dist/bundle.es87.js +48 -13
- package/dist/bundle.es88.js +16 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.scss +1 -0
- package/package.json +1 -1
package/dist/bundle.es27.js
CHANGED
|
@@ -1,23 +1,40 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
-
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "@radix-ui/react-alert-dialog";
|
|
3
|
+
import { Button as c } from "./bundle.es5.js";
|
|
4
|
+
import { RemoveListener as N } from "./bundle.es61.js";
|
|
5
|
+
import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
|
|
6
|
+
const C = ({
|
|
7
|
+
open: d,
|
|
8
|
+
defaultOpen: m,
|
|
9
|
+
onOpenChange: p,
|
|
10
|
+
onClosed: h,
|
|
11
|
+
icon: i,
|
|
12
|
+
title: l,
|
|
13
|
+
description: o,
|
|
14
|
+
cancelDefaultText: s,
|
|
15
|
+
cancel: t,
|
|
16
|
+
disableCancel: v,
|
|
17
|
+
confirm: n
|
|
18
|
+
}) => /* @__PURE__ */ e(r.Root, { open: d, defaultOpen: m, onOpenChange: p, children: /* @__PURE__ */ a(r.Portal, { children: [
|
|
19
|
+
/* @__PURE__ */ e(r.Overlay, { className: "popup-overlay dialog-overlay" }),
|
|
20
|
+
/* @__PURE__ */ a(r.Content, { className: "dialog-container", children: [
|
|
21
|
+
/* @__PURE__ */ e(N, { callback: h }),
|
|
22
|
+
/* @__PURE__ */ a("div", { className: "popup dialog alert", children: [
|
|
23
|
+
/* @__PURE__ */ a("div", { className: "alert-body", children: [
|
|
24
|
+
i && /* @__PURE__ */ e("span", { className: "alert-icon", children: i }),
|
|
25
|
+
/* @__PURE__ */ a("div", { className: "alert-content", children: [
|
|
26
|
+
l && /* @__PURE__ */ e(r.Title, { className: "alert-title", children: l }),
|
|
27
|
+
!l && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(r.Title, {}) }),
|
|
28
|
+
o && /* @__PURE__ */ e(r.Description, { className: "alert-description", children: o })
|
|
29
|
+
] })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ a("div", { className: "alert-footer", children: [
|
|
32
|
+
!v && (t?.text || s) && /* @__PURE__ */ e(r.Cancel, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "neutral", ...t, text: t?.text ?? s }) }),
|
|
33
|
+
n?.text && /* @__PURE__ */ e(r.Action, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "negative", ...n }) })
|
|
34
|
+
] })
|
|
35
|
+
] })
|
|
36
|
+
] })
|
|
37
|
+
] }) });
|
|
21
38
|
export {
|
|
22
|
-
|
|
39
|
+
C as AlertDialog
|
|
23
40
|
};
|
package/dist/bundle.es28.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { Button as p } from "./bundle.es5.js";
|
|
3
|
+
import { useLoading as s } from "./bundle.es52.js";
|
|
4
|
+
const l = ({
|
|
5
|
+
onClick: o,
|
|
6
|
+
appearance: r = "primary",
|
|
7
|
+
loading: i,
|
|
8
|
+
...n
|
|
9
|
+
}) => {
|
|
10
|
+
const { isLoading: t, isError: a, handleClick: e } = s({ onClick: o });
|
|
11
|
+
return /* @__PURE__ */ m(
|
|
12
|
+
p,
|
|
13
|
+
{
|
|
14
|
+
appearance: a ? "negative" : r,
|
|
15
|
+
...n,
|
|
16
|
+
loading: t || i,
|
|
17
|
+
onClick: e
|
|
18
|
+
}
|
|
19
|
+
);
|
|
17
20
|
};
|
|
18
|
-
x.Tab = p;
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
l as LoadingButton
|
|
21
23
|
};
|
package/dist/bundle.es29.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { useRef as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const r = t - Date.now(), { hours: u, minutes: a, seconds: l } = g(r);
|
|
18
|
-
return s(() => {
|
|
19
|
-
r <= 0 && (i?.(), e.current && clearInterval(e.current));
|
|
20
|
-
}, [r <= 0]), /* @__PURE__ */ d(p, { children: [n(u), n(a), n(l)].join(m) });
|
|
1
|
+
import { jsx as a, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { useTabSlider as l, makeTabId as m } from "./bundle.es63.js";
|
|
3
|
+
import * as n from "@radix-ui/react-tabs";
|
|
4
|
+
import { useRef as f, useId as T, createContext as u, useContext as c } from "react";
|
|
5
|
+
const o = u({ baseId: "", containerRef: {} }), x = ({ children: s, value: e, onChange: r }) => {
|
|
6
|
+
const t = f(null), i = T().replaceAll(":", "");
|
|
7
|
+
return /* @__PURE__ */ a(n.Root, { value: e, onValueChange: (d) => r(d), children: /* @__PURE__ */ a(o.Provider, { value: { baseId: i, containerRef: t }, children: /* @__PURE__ */ b(n.List, { className: "tabs", ref: t, children: [
|
|
8
|
+
/* @__PURE__ */ a(I, { value: e }),
|
|
9
|
+
s
|
|
10
|
+
] }) }) });
|
|
11
|
+
}, I = ({ value: s }) => {
|
|
12
|
+
const { baseId: e, containerRef: r } = c(o), t = l({ baseId: e, value: s, containerRef: r });
|
|
13
|
+
return /* @__PURE__ */ a("div", { className: "tab-indicator-container", style: t, children: /* @__PURE__ */ a("div", { className: "tab-indicator" }) });
|
|
14
|
+
}, p = ({ children: s, value: e, ...r }) => {
|
|
15
|
+
const { baseId: t } = c(o);
|
|
16
|
+
return /* @__PURE__ */ a(n.Trigger, { ...r, id: m(t, e), className: "tab", value: e, children: s });
|
|
21
17
|
};
|
|
18
|
+
x.Tab = p;
|
|
22
19
|
export {
|
|
23
|
-
|
|
20
|
+
x as Tabs
|
|
24
21
|
};
|
package/dist/bundle.es30.js
CHANGED
|
@@ -1,46 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return T(r, [r, a]), /* @__PURE__ */ m(
|
|
22
|
-
"div",
|
|
23
|
-
{
|
|
24
|
-
className: "form form-textarea",
|
|
25
|
-
"data-required": e(s),
|
|
26
|
-
"data-disabled": e(o),
|
|
27
|
-
"data-fill": e(p),
|
|
28
|
-
children: /* @__PURE__ */ m(
|
|
29
|
-
"textarea",
|
|
30
|
-
{
|
|
31
|
-
className: u("form-input", n),
|
|
32
|
-
"data-grow": e(t),
|
|
33
|
-
value: a,
|
|
34
|
-
ref: g([c, x]),
|
|
35
|
-
rows: l,
|
|
36
|
-
disabled: o,
|
|
37
|
-
onChange: R(i, r),
|
|
38
|
-
...d
|
|
39
|
-
}
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
);
|
|
1
|
+
import { jsx as d, Fragment as p } from "react/jsx-runtime";
|
|
2
|
+
import { useRerender as T } from "./bundle.es75.js";
|
|
3
|
+
import { getNextCandleTime as x, sleep as S, getTimes as g } from "@companix/utils-js";
|
|
4
|
+
import { useRef as v, useEffect as s } from "react";
|
|
5
|
+
const n = (t) => String(t).padStart(2, "0"), C = ({ expiration: t, separator: m = ":", onExpired: i }) => {
|
|
6
|
+
const e = v(null), o = T();
|
|
7
|
+
s(() => {
|
|
8
|
+
const c = Date.now(), f = x(c, "1s") - c;
|
|
9
|
+
return e.current && clearInterval(e.current), S(f).then(() => {
|
|
10
|
+
o(), e.current = setInterval(() => {
|
|
11
|
+
o();
|
|
12
|
+
}, 1e3);
|
|
13
|
+
}), () => {
|
|
14
|
+
e.current && clearInterval(e.current);
|
|
15
|
+
};
|
|
16
|
+
}, [t]);
|
|
17
|
+
const r = t - Date.now(), { hours: u, minutes: a, seconds: l } = g(r);
|
|
18
|
+
return s(() => {
|
|
19
|
+
r <= 0 && (i?.(), e.current && clearInterval(e.current));
|
|
20
|
+
}, [r <= 0]), /* @__PURE__ */ d(p, { children: [n(u), n(a), n(l)].join(m) });
|
|
43
21
|
};
|
|
44
22
|
export {
|
|
45
|
-
|
|
23
|
+
C as Countdown
|
|
46
24
|
};
|
package/dist/bundle.es31.js
CHANGED
|
@@ -1,123 +1,46 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (r && l && a) {
|
|
24
|
-
const o = new Date(a, l - 1, r);
|
|
25
|
-
if (o.getFullYear() === a && o.getDate() === r && o.getMonth() === l - 1)
|
|
26
|
-
return o;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
}, U = (e) => {
|
|
32
|
-
const {
|
|
33
|
-
clearButton: n,
|
|
34
|
-
clearButtonIcon: r,
|
|
35
|
-
children: l,
|
|
36
|
-
disabled: a,
|
|
37
|
-
// calendar props
|
|
38
|
-
value: o,
|
|
39
|
-
enableTime: y,
|
|
40
|
-
disablePickers: I,
|
|
41
|
-
showNeighboringMonth: P,
|
|
42
|
-
onChange: c,
|
|
43
|
-
shouldDisableDate: g,
|
|
44
|
-
viewDate: S,
|
|
45
|
-
disablePast: d,
|
|
46
|
-
disableFuture: D,
|
|
47
|
-
minDateTime: C,
|
|
48
|
-
maxDateTime: b,
|
|
49
|
-
// input props
|
|
50
|
-
...V
|
|
51
|
-
} = e, [m, s] = A(() => i.toString(o ?? null)), p = j(null), k = N({
|
|
52
|
-
disableFuture: D,
|
|
53
|
-
disablePast: d,
|
|
54
|
-
shouldDisableDate: g,
|
|
55
|
-
minDateTime: C,
|
|
56
|
-
maxDateTime: b
|
|
57
|
-
}), B = (t) => {
|
|
58
|
-
a || p.current && p.current.getAttribute("data-state") === "open" && t.preventDefault();
|
|
59
|
-
}, F = (t) => {
|
|
60
|
-
t.stopPropagation(), s(""), c?.(null);
|
|
61
|
-
}, x = (t) => {
|
|
62
|
-
s(t);
|
|
63
|
-
const f = i.toValue(t);
|
|
64
|
-
f && !k(f) && c?.(f);
|
|
65
|
-
}, M = () => {
|
|
66
|
-
const t = i.toValue(m);
|
|
67
|
-
(!t || k(t)) && s(i.toString(o ?? null));
|
|
68
|
-
}, R = (t) => {
|
|
69
|
-
c?.(t), s(i.toString(t));
|
|
70
|
-
};
|
|
71
|
-
return /* @__PURE__ */ u(
|
|
72
|
-
T,
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import u from "classnames";
|
|
3
|
+
import { useResizeTextarea as z } from "./bundle.es51.js";
|
|
4
|
+
import { attr as e, callMultiple as R } from "@companix/utils-browser";
|
|
5
|
+
import { useEffect as T } from "react";
|
|
6
|
+
import { mergeRefs as g } from "react-merge-refs";
|
|
7
|
+
const E = ({
|
|
8
|
+
onResize: f,
|
|
9
|
+
grow: t = !1,
|
|
10
|
+
value: a,
|
|
11
|
+
onChange: i,
|
|
12
|
+
disabled: o,
|
|
13
|
+
required: s,
|
|
14
|
+
rows: l = 2,
|
|
15
|
+
fill: p = !1,
|
|
16
|
+
textAreaRef: c,
|
|
17
|
+
className: n,
|
|
18
|
+
...d
|
|
19
|
+
}) => {
|
|
20
|
+
const [x, r] = z(f, t);
|
|
21
|
+
return T(r, [r, a]), /* @__PURE__ */ m(
|
|
22
|
+
"div",
|
|
73
23
|
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
fitMaxHeight: !1,
|
|
81
|
-
content: () => /* @__PURE__ */ u(
|
|
82
|
-
E,
|
|
83
|
-
{
|
|
84
|
-
value: o,
|
|
85
|
-
disablePast: d,
|
|
86
|
-
disableFuture: D,
|
|
87
|
-
enableTime: y,
|
|
88
|
-
disablePickers: I,
|
|
89
|
-
showNeighboringMonth: P,
|
|
90
|
-
onChange: R,
|
|
91
|
-
shouldDisableDate: g,
|
|
92
|
-
viewDate: S,
|
|
93
|
-
minDateTime: C,
|
|
94
|
-
maxDateTime: b
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
children: /* @__PURE__ */ u(
|
|
98
|
-
w,
|
|
24
|
+
className: "form form-textarea",
|
|
25
|
+
"data-required": e(s),
|
|
26
|
+
"data-disabled": e(o),
|
|
27
|
+
"data-fill": e(p),
|
|
28
|
+
children: /* @__PURE__ */ m(
|
|
29
|
+
"textarea",
|
|
99
30
|
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Y,
|
|
109
|
-
{
|
|
110
|
-
clearButton: n,
|
|
111
|
-
clearButtonIcon: r,
|
|
112
|
-
value: !!O(m, ["-", "_"]),
|
|
113
|
-
onClear: F
|
|
114
|
-
}
|
|
115
|
-
)
|
|
31
|
+
className: u("form-input", n),
|
|
32
|
+
"data-grow": e(t),
|
|
33
|
+
value: a,
|
|
34
|
+
ref: g([c, x]),
|
|
35
|
+
rows: l,
|
|
36
|
+
disabled: o,
|
|
37
|
+
onChange: R(i, r),
|
|
38
|
+
...d
|
|
116
39
|
}
|
|
117
40
|
)
|
|
118
41
|
}
|
|
119
42
|
);
|
|
120
43
|
};
|
|
121
44
|
export {
|
|
122
|
-
|
|
45
|
+
E as TextArea
|
|
123
46
|
};
|
package/dist/bundle.es32.js
CHANGED
|
@@ -1,76 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
return /* @__PURE__ */ D("div", { className: "data-input", children: [
|
|
29
|
-
!u && p.length > 0 && /* @__PURE__ */ h(
|
|
30
|
-
c,
|
|
31
|
-
{
|
|
32
|
-
placeholder: "Год",
|
|
33
|
-
options: p,
|
|
34
|
-
onChange: (t) => s("year", t),
|
|
35
|
-
value: a.year,
|
|
36
|
-
required: m,
|
|
37
|
-
disabled: r,
|
|
38
|
-
size: i,
|
|
39
|
-
minimalOptions: !0,
|
|
40
|
-
matchTarget: "min-width"
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
/* @__PURE__ */ h(
|
|
44
|
-
c,
|
|
45
|
-
{
|
|
46
|
-
placeholder: "Месяц",
|
|
47
|
-
className: "w-full",
|
|
48
|
-
options: w,
|
|
49
|
-
onChange: (t) => s("month", t),
|
|
50
|
-
value: a.month,
|
|
51
|
-
disabled: r,
|
|
52
|
-
required: m,
|
|
53
|
-
size: i,
|
|
54
|
-
minimalOptions: !0,
|
|
55
|
-
matchTarget: "min-width"
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { Popover as T } from "./bundle.es11.js";
|
|
3
|
+
import { Input as w } from "./bundle.es15.js";
|
|
4
|
+
import { useState as A, useRef as j } from "react";
|
|
5
|
+
import { Calendar as E } from "./bundle.es76.js";
|
|
6
|
+
import { useDayDisableCheker as N } from "./bundle.es62.js";
|
|
7
|
+
import { getNum as h, formatTime as v } from "@companix/utils-js";
|
|
8
|
+
import { removeDigits as O } from "./bundle.es68.js";
|
|
9
|
+
import { SelectRightElements as Y } from "./bundle.es77.js";
|
|
10
|
+
const i = {
|
|
11
|
+
char: "-",
|
|
12
|
+
toString: (e) => {
|
|
13
|
+
if (e) {
|
|
14
|
+
const n = v(e.getDate()), r = v(e.getMonth() + 1), l = e.getFullYear();
|
|
15
|
+
return [n, r, l].join(i.char);
|
|
16
|
+
}
|
|
17
|
+
return "";
|
|
18
|
+
},
|
|
19
|
+
toValue: (e) => {
|
|
20
|
+
const n = e.split(i.char);
|
|
21
|
+
if (n.length === 3) {
|
|
22
|
+
const [r, l, a] = [h(n[0]), h(n[1]), h(n[2])];
|
|
23
|
+
if (r && l && a) {
|
|
24
|
+
const o = new Date(a, l - 1, r);
|
|
25
|
+
if (o.getFullYear() === a && o.getDate() === r && o.getMonth() === l - 1)
|
|
26
|
+
return o;
|
|
56
27
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}, U = (e) => {
|
|
32
|
+
const {
|
|
33
|
+
clearButton: n,
|
|
34
|
+
clearButtonIcon: r,
|
|
35
|
+
children: l,
|
|
36
|
+
disabled: a,
|
|
37
|
+
// calendar props
|
|
38
|
+
value: o,
|
|
39
|
+
enableTime: y,
|
|
40
|
+
disablePickers: I,
|
|
41
|
+
showNeighboringMonth: P,
|
|
42
|
+
onChange: c,
|
|
43
|
+
shouldDisableDate: g,
|
|
44
|
+
viewDate: S,
|
|
45
|
+
disablePast: d,
|
|
46
|
+
disableFuture: D,
|
|
47
|
+
minDateTime: C,
|
|
48
|
+
maxDateTime: b,
|
|
49
|
+
// input props
|
|
50
|
+
...V
|
|
51
|
+
} = e, [m, s] = A(() => i.toString(o ?? null)), p = j(null), k = N({
|
|
52
|
+
disableFuture: D,
|
|
53
|
+
disablePast: d,
|
|
54
|
+
shouldDisableDate: g,
|
|
55
|
+
minDateTime: C,
|
|
56
|
+
maxDateTime: b
|
|
57
|
+
}), B = (t) => {
|
|
58
|
+
a || p.current && p.current.getAttribute("data-state") === "open" && t.preventDefault();
|
|
59
|
+
}, F = (t) => {
|
|
60
|
+
t.stopPropagation(), s(""), c?.(null);
|
|
61
|
+
}, x = (t) => {
|
|
62
|
+
s(t);
|
|
63
|
+
const f = i.toValue(t);
|
|
64
|
+
f && !k(f) && c?.(f);
|
|
65
|
+
}, M = () => {
|
|
66
|
+
const t = i.toValue(m);
|
|
67
|
+
(!t || k(t)) && s(i.toString(o ?? null));
|
|
68
|
+
}, R = (t) => {
|
|
69
|
+
c?.(t), s(i.toString(t));
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ u(
|
|
72
|
+
T,
|
|
73
|
+
{
|
|
74
|
+
minimal: !0,
|
|
75
|
+
ref: p,
|
|
76
|
+
sideOffset: 0,
|
|
77
|
+
onOpenAutoFocus: (t) => t.preventDefault(),
|
|
78
|
+
onCloseAutoFocus: (t) => t.preventDefault(),
|
|
79
|
+
disabled: a,
|
|
80
|
+
fitMaxHeight: !1,
|
|
81
|
+
content: () => /* @__PURE__ */ u(
|
|
82
|
+
E,
|
|
83
|
+
{
|
|
84
|
+
value: o,
|
|
85
|
+
disablePast: d,
|
|
86
|
+
disableFuture: D,
|
|
87
|
+
enableTime: y,
|
|
88
|
+
disablePickers: I,
|
|
89
|
+
showNeighboringMonth: P,
|
|
90
|
+
onChange: R,
|
|
91
|
+
shouldDisableDate: g,
|
|
92
|
+
viewDate: S,
|
|
93
|
+
minDateTime: C,
|
|
94
|
+
maxDateTime: b
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
children: /* @__PURE__ */ u(
|
|
98
|
+
w,
|
|
99
|
+
{
|
|
100
|
+
...V,
|
|
101
|
+
value: m,
|
|
102
|
+
disabled: a,
|
|
103
|
+
onClick: B,
|
|
104
|
+
onValueChange: x,
|
|
105
|
+
onBlur: M,
|
|
106
|
+
mask: "99-99-9999",
|
|
107
|
+
rightElement: /* @__PURE__ */ u(
|
|
108
|
+
Y,
|
|
109
|
+
{
|
|
110
|
+
clearButton: n,
|
|
111
|
+
clearButtonIcon: r,
|
|
112
|
+
value: !!O(m, ["-", "_"]),
|
|
113
|
+
onClear: F
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
);
|
|
73
120
|
};
|
|
74
121
|
export {
|
|
75
|
-
|
|
122
|
+
U as DatePicker
|
|
76
123
|
};
|