@companix/uikit 0.0.16 → 0.0.17
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/DatePicker/index.d.ts +2 -3
- package/dist/Input/Form.scss +1 -4
- package/dist/Input/InlineInput.d.ts +0 -0
- package/dist/Input/{index.d.ts → Input.d.ts} +4 -8
- package/dist/Input/Input.scss +23 -0
- package/dist/Input/InputContainer.d.ts +11 -0
- package/dist/Input/InputElement.d.ts +7 -0
- package/dist/NumberInput/index.d.ts +2 -2
- package/dist/Select/SelectOptions.d.ts +12 -0
- package/dist/Select/SelectRight.d.ts +8 -0
- package/dist/Select/index.d.ts +5 -1
- package/dist/TimePicker/index.d.ts +10 -0
- package/dist/__hooks/use-input-padding.d.ts +5 -0
- package/dist/__hooks/use-scrollbox.d.ts +1 -1
- package/dist/__hooks/use-update.d.ts +1 -1
- package/dist/__utils/utils.d.ts +15 -1
- package/dist/bundle.es.js +30 -26
- package/dist/bundle.es10.js +1 -1
- package/dist/bundle.es14.js +1 -1
- package/dist/bundle.es19.js +1 -1
- package/dist/bundle.es20.js +1 -1
- package/dist/bundle.es23.js +1 -1
- package/dist/bundle.es24.js +2 -2
- package/dist/bundle.es25.js +93 -85
- package/dist/bundle.es26.js +67 -29
- package/dist/bundle.es27.js +34 -10
- package/dist/bundle.es28.js +11 -10
- package/dist/bundle.es29.js +82 -21
- package/dist/bundle.es30.js +10 -35
- package/dist/bundle.es31.js +21 -20
- package/dist/bundle.es32.js +36 -83
- package/dist/bundle.es33.js +23 -17
- package/dist/bundle.es34.js +87 -14
- package/dist/bundle.es35.js +18 -22
- package/dist/bundle.es36.js +20 -5
- package/dist/bundle.es37.js +24 -14
- package/dist/bundle.es38.js +39 -14
- package/dist/bundle.es39.js +20 -68
- package/dist/bundle.es40.js +5 -68
- package/dist/bundle.es41.js +13 -31
- package/dist/bundle.es42.js +14 -68
- package/dist/bundle.es43.js +66 -39
- package/dist/bundle.es44.js +67 -30
- package/dist/bundle.es45.js +69 -74
- package/dist/bundle.es46.js +10 -48
- package/dist/bundle.es47.js +45 -0
- package/dist/bundle.es48.js +34 -0
- package/dist/bundle.es49.js +70 -0
- package/dist/bundle.es50.js +16 -0
- package/dist/bundle.es51.js +45 -0
- package/dist/bundle.es52.js +77 -0
- package/dist/bundle.es53.js +51 -0
- package/dist/bundle.es54.js +16 -0
- package/dist/bundle.es8.js +54 -62
- package/dist/bundle.es9.js +35 -70
- package/dist/index.d.ts +3 -1
- package/dist/index.scss +2 -2
- package/dist/types.d.ts +4 -0
- package/package.json +2 -3
package/dist/bundle.es35.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
19
|
+
g as useScrollListController
|
|
24
20
|
};
|
package/dist/bundle.es36.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
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
|
-
|
|
21
|
+
h as SelectOptions
|
|
7
22
|
};
|
package/dist/bundle.es37.js
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
25
|
+
I as InputElement
|
|
16
26
|
};
|
package/dist/bundle.es38.js
CHANGED
|
@@ -1,16 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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.es50.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
|
-
|
|
40
|
+
v as InputContainer
|
|
16
41
|
};
|
package/dist/bundle.es39.js
CHANGED
|
@@ -1,72 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
36
|
-
|
|
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
|
-
|
|
23
|
+
g as Icon
|
|
72
24
|
};
|
package/dist/bundle.es40.js
CHANGED
|
@@ -1,70 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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
|
};
|
package/dist/bundle.es41.js
CHANGED
|
@@ -1,34 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
15
|
+
d as useLoading
|
|
34
16
|
};
|
package/dist/bundle.es42.js
CHANGED
|
@@ -1,70 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
}),
|
|
16
|
-
[]
|
|
17
|
-
);
|
|
18
|
-
const d = j((t) => {
|
|
19
|
-
t.forEach(({ id: r }, a) => {
|
|
20
|
-
let s = 0;
|
|
21
|
-
for (let n = a + 1; n < t.length; n++)
|
|
22
|
-
o[t[n].id] && (s += o[t[n].id].clientHeight + m);
|
|
23
|
-
o[r] && o[r].style.setProperty("--offset", `${s}px`);
|
|
24
|
-
});
|
|
25
|
-
}, []), y = (t) => {
|
|
26
|
-
p((r) => {
|
|
27
|
-
const a = [...r], s = a.findIndex((n) => n.id === t);
|
|
28
|
-
return s !== -1 && a.splice(s, 1), a;
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
return /* @__PURE__ */ T(
|
|
32
|
-
c.Provider,
|
|
33
|
-
{
|
|
34
|
-
duration: u,
|
|
35
|
-
swipeThreshold: v,
|
|
36
|
-
swipeDirection: g[`${f}-${i}`],
|
|
37
|
-
children: [
|
|
38
|
-
l.map(({ id: t, ...r }) => /* @__PURE__ */ k(
|
|
39
|
-
C,
|
|
40
|
-
{
|
|
41
|
-
...r,
|
|
42
|
-
key: `toaster-${t}`,
|
|
43
|
-
closeIcon: x,
|
|
44
|
-
onInitialized: (a) => {
|
|
45
|
-
o[t] = a, d(l);
|
|
46
|
-
},
|
|
47
|
-
onRemoving: () => {
|
|
48
|
-
delete o[t], d(l);
|
|
49
|
-
},
|
|
50
|
-
onRemoved: () => {
|
|
51
|
-
o[t] && delete o[t], y(t);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
)),
|
|
55
|
-
/* @__PURE__ */ $(
|
|
56
|
-
c.Viewport,
|
|
57
|
-
{
|
|
58
|
-
"data-side": f,
|
|
59
|
-
"data-align": i,
|
|
60
|
-
className: "toaster-viewport",
|
|
61
|
-
style: w({ "--toasters-gap": `${m}px` })
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
});
|
|
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
|
+
};
|
|
68
14
|
export {
|
|
69
|
-
|
|
15
|
+
f as useResizeTextarea
|
|
70
16
|
};
|
package/dist/bundle.es43.js
CHANGED
|
@@ -1,45 +1,72 @@
|
|
|
1
|
-
import { jsxs as
|
|
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
|
-
t
|
|
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.es45.js";
|
|
3
|
+
import { CalendarHeader as F } from "./bundle.es52.js";
|
|
4
|
+
import { useCalendar as j } from "./bundle.es53.js";
|
|
5
|
+
import { attr as m } from "@companix/utils-browser";
|
|
6
|
+
import { isSameDate as f } from "./bundle.es44.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,
|
|
25
|
+
{
|
|
26
|
+
viewDate: n,
|
|
27
|
+
onChange: r,
|
|
28
|
+
onNextMonth: N,
|
|
29
|
+
onPrevMonth: x,
|
|
30
|
+
disablePickers: c,
|
|
31
|
+
isMonthDisabled: M,
|
|
32
|
+
isYearDisabled: v
|
|
33
|
+
}
|
|
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",
|
|
24
60
|
{
|
|
25
|
-
|
|
26
|
-
"data-
|
|
27
|
-
"data-
|
|
28
|
-
"data-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
children: [
|
|
32
|
-
/* @__PURE__ */ e(R, { callback: f }),
|
|
33
|
-
r && /* @__PURE__ */ e("div", { className: "toaster-icon", children: r }),
|
|
34
|
-
/* @__PURE__ */ n("div", { className: "toaster-content", children: [
|
|
35
|
-
a && /* @__PURE__ */ e(t.Title, { className: "toaster-title", children: a }),
|
|
36
|
-
s && /* @__PURE__ */ e(t.Description, { className: "toaster-description", children: s })
|
|
37
|
-
] }),
|
|
38
|
-
/* @__PURE__ */ e(t.Close, { className: "toaster-close", onClick: p, children: u ?? /* @__PURE__ */ e("svg", { viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M2.96967 2.96967C3.26256 2.67678 3.73744 2.67678 4.03033 2.96967L8 6.939L11.9697 2.96967C12.2626 2.67678 12.7374 2.67678 13.0303 2.96967C13.3232 3.26256 13.3232 3.73744 13.0303 4.03033L9.061 8L13.0303 11.9697C13.2966 12.2359 13.3208 12.6526 13.1029 12.9462L13.0303 13.0303C12.7374 13.3232 12.2626 13.3232 11.9697 13.0303L8 9.061L4.03033 13.0303C3.73744 13.3232 3.26256 13.3232 2.96967 13.0303C2.67678 12.7374 2.67678 12.2626 2.96967 11.9697L6.939 8L2.96967 4.03033C2.7034 3.76406 2.6792 3.3474 2.89705 3.05379L2.96967 2.96967Z" }) }) })
|
|
39
|
-
]
|
|
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 })
|
|
40
67
|
}
|
|
41
68
|
);
|
|
42
69
|
};
|
|
43
70
|
export {
|
|
44
|
-
|
|
71
|
+
T as Calendar
|
|
45
72
|
};
|