@companix/uikit 0.1.10 → 0.1.12
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/WriteBar/Editor.d.ts +34 -0
- package/dist/WriteBar/Input.d.ts +14 -0
- package/dist/WriteBar/WireBar.scss +44 -46
- package/dist/WriteBar/index.d.ts +6 -6
- package/dist/WriteBar/keyboard.d.ts +16 -0
- package/dist/WriteBar/utils.d.ts +14 -0
- package/dist/bundle.es.js +59 -57
- package/dist/bundle.es10.js +1 -1
- package/dist/bundle.es13.js +4 -4
- package/dist/bundle.es14.js +3 -3
- package/dist/bundle.es15.js +2 -2
- package/dist/bundle.es17.js +1 -1
- package/dist/bundle.es24.js +1 -1
- package/dist/bundle.es25.js +1 -1
- package/dist/bundle.es26.js +1 -1
- package/dist/bundle.es27.js +1 -1
- package/dist/bundle.es29.js +1 -1
- package/dist/bundle.es30.js +4 -4
- package/dist/bundle.es31.js +2 -2
- package/dist/bundle.es34.js +2 -2
- package/dist/bundle.es40.js +48 -92
- package/dist/bundle.es41.js +152 -79
- package/dist/bundle.es42.js +81 -7
- package/dist/bundle.es43.js +7 -35
- package/dist/bundle.es44.js +33 -20
- package/dist/bundle.es45.js +21 -10
- package/dist/bundle.es46.js +10 -11
- package/dist/bundle.es47.js +11 -13
- package/dist/bundle.es48.js +13 -13
- package/dist/bundle.es49.js +13 -30
- package/dist/bundle.es50.js +29 -25
- package/dist/bundle.es51.js +17 -29
- package/dist/bundle.es52.js +36 -48
- package/dist/bundle.es53.js +49 -50
- package/dist/bundle.es54.js +51 -8
- package/dist/bundle.es55.js +8 -26
- package/dist/bundle.es56.js +27 -5
- package/dist/bundle.es57.js +5 -66
- package/dist/bundle.es58.js +66 -23
- package/dist/bundle.es59.js +22 -23
- package/dist/bundle.es60.js +24 -88
- package/dist/bundle.es61.js +88 -18
- package/dist/bundle.es62.js +17 -92
- package/dist/bundle.es63.js +92 -73
- package/dist/bundle.es64.js +73 -23
- package/dist/bundle.es65.js +20 -35
- package/dist/bundle.es66.js +37 -68
- package/dist/bundle.es67.js +68 -9
- package/dist/bundle.es68.js +10 -42
- package/dist/bundle.es69.js +42 -14
- package/dist/bundle.es70.js +32 -31
- package/dist/bundle.es71.js +65 -69
- package/dist/bundle.es72.js +42 -14
- package/dist/bundle.es73.js +14 -74
- package/dist/bundle.es74.js +30 -47
- package/dist/bundle.es75.js +69 -13
- package/dist/bundle.es76.js +77 -0
- package/dist/bundle.es77.js +51 -0
- package/dist/bundle.es78.js +16 -0
- package/dist/bundle.es79.js +16 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/bundle.es64.js
CHANGED
|
@@ -1,26 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
mask: r,
|
|
17
|
-
maskChar: f,
|
|
18
|
-
onChange: p,
|
|
19
|
-
...a
|
|
20
|
-
}
|
|
21
|
-
) : /* @__PURE__ */ u("input", { ref: e, ...a, onChange: p });
|
|
1
|
+
import { clamp as m } from "@companix/utils-browser";
|
|
2
|
+
import { formatTime as i } from "@companix/utils-js";
|
|
3
|
+
const d = (n, r) => new Date(r, n, 0).getDate(), u = (n, r) => new Date(r, n - 1, 1).getDay(), g = (n) => n === 0 ? 6 : n - 1, D = (n) => new Array(n).fill(0), T = {
|
|
4
|
+
add: (n, r) => n.includes(r) ? [...n] : [...n, r],
|
|
5
|
+
remove: (n, r) => n.filter((t) => r !== t)
|
|
6
|
+
}, p = (n) => ({
|
|
7
|
+
day: n.getDate(),
|
|
8
|
+
month: n.getMonth() + 1,
|
|
9
|
+
year: n.getFullYear()
|
|
10
|
+
}), A = ({ min: n, max: r }) => (t) => {
|
|
11
|
+
if (n.year === t.year) {
|
|
12
|
+
if (t.month !== 0 && t.month < n.month)
|
|
13
|
+
return t.month = 0, t.day = 0, t;
|
|
14
|
+
if (t.month === n.month && t.day < n.day && t.day !== 0)
|
|
15
|
+
return t.day = 0, t;
|
|
22
16
|
}
|
|
23
|
-
)
|
|
17
|
+
if (r.year === t.year) {
|
|
18
|
+
if (t.month !== 0 && t.month > r.month)
|
|
19
|
+
return t.month = 0, t.day = 0, t;
|
|
20
|
+
if (t.month === r.month && t.day > r.day && t.day !== 0)
|
|
21
|
+
return t.day = 0, t;
|
|
22
|
+
}
|
|
23
|
+
}, M = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], w = [
|
|
24
|
+
"Январь",
|
|
25
|
+
"Февраль",
|
|
26
|
+
"Март",
|
|
27
|
+
"Апрель",
|
|
28
|
+
"Май",
|
|
29
|
+
"Июнь",
|
|
30
|
+
"Июль",
|
|
31
|
+
"Август",
|
|
32
|
+
"Сентябрь",
|
|
33
|
+
"Октябрь",
|
|
34
|
+
"Ноябрь",
|
|
35
|
+
"Декабрь"
|
|
36
|
+
], c = 9999, a = 100, F = (n, r) => {
|
|
37
|
+
const t = [], o = m(n - r, a, c), e = m(n + r, a, c);
|
|
38
|
+
for (let s = o; s <= e; s++)
|
|
39
|
+
t.push({ title: String(s).padStart(4, "0"), value: s });
|
|
40
|
+
return t;
|
|
41
|
+
}, Y = (n) => {
|
|
42
|
+
const r = [], t = new Intl.DateTimeFormat(n, {
|
|
43
|
+
month: "long"
|
|
44
|
+
});
|
|
45
|
+
for (let o = 0; o < 12; o++)
|
|
46
|
+
r.push({
|
|
47
|
+
title: t.format(new Date(2023, o, 15)),
|
|
48
|
+
value: o
|
|
49
|
+
});
|
|
50
|
+
return r;
|
|
51
|
+
}, E = (n, r) => r.reduce((t, o) => t.replaceAll(o, ""), n.trim()), _ = ({ hours: n, minutes: r }, t = ":") => [i(n), i(r)].join(t), h = (n, r = ":") => {
|
|
52
|
+
const [t, o] = [i(n.hours), i(n.minutes)], e = [t, o].join(r);
|
|
53
|
+
return { title: e, value: e, hours: t, minutes: o };
|
|
54
|
+
}, I = (n, r = ":") => {
|
|
55
|
+
const t = { minutes: -n, hours: 0 };
|
|
56
|
+
return Array.from({ length: 1440 / n }).map(() => (t.minutes += n, t.minutes === 60 && (t.minutes = 0, t.hours++), h(t, r)));
|
|
57
|
+
};
|
|
24
58
|
export {
|
|
25
|
-
|
|
59
|
+
c as DEFAULT_MAX_YEAR,
|
|
60
|
+
a as DEFAULT_MIN_YEAR,
|
|
61
|
+
w as DefaultMonths,
|
|
62
|
+
T as arrays,
|
|
63
|
+
_ as convertTimeToOption,
|
|
64
|
+
A as createDateValidation,
|
|
65
|
+
D as createVoids,
|
|
66
|
+
p as dateToFormat,
|
|
67
|
+
g as getDayIndex,
|
|
68
|
+
u as getFirstDay,
|
|
69
|
+
d as getMonthMaxDay,
|
|
70
|
+
Y as getMonths,
|
|
71
|
+
h as getTimeValue,
|
|
72
|
+
I as getTimesOptions,
|
|
73
|
+
F as getYears,
|
|
74
|
+
E as removeDigits,
|
|
75
|
+
M as weeks
|
|
26
76
|
};
|
package/dist/bundle.es65.js
CHANGED
|
@@ -1,41 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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",
|
|
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,
|
|
22
14
|
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
]
|
|
15
|
+
inputRef: e,
|
|
16
|
+
mask: r,
|
|
17
|
+
maskChar: f,
|
|
18
|
+
onChange: p,
|
|
19
|
+
...a
|
|
35
20
|
}
|
|
36
|
-
);
|
|
21
|
+
) : /* @__PURE__ */ u("input", { ref: e, ...a, onChange: p });
|
|
37
22
|
}
|
|
38
23
|
);
|
|
39
24
|
export {
|
|
40
|
-
|
|
25
|
+
I as InputElement
|
|
41
26
|
};
|
package/dist/bundle.es66.js
CHANGED
|
@@ -1,72 +1,41 @@
|
|
|
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
|
-
return /* @__PURE__ */ D("div", { className: "calendar", children: [
|
|
23
|
-
/* @__PURE__ */ t(
|
|
24
|
-
F,
|
|
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.es78.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",
|
|
25
22
|
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
+
]
|
|
33
35
|
}
|
|
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
|
-
};
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
70
39
|
export {
|
|
71
|
-
|
|
40
|
+
v as InputContainer
|
|
72
41
|
};
|
package/dist/bundle.es67.js
CHANGED
|
@@ -1,13 +1,72 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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.es64.js";
|
|
3
|
+
import { CalendarHeader as F } from "./bundle.es76.js";
|
|
4
|
+
import { useCalendar as j } from "./bundle.es77.js";
|
|
5
|
+
import { attr as m } from "@companix/utils-browser";
|
|
6
|
+
import { isSameDate as f } from "./bundle.es58.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
|
+
] })
|
|
9
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
|
+
);
|
|
10
69
|
};
|
|
11
70
|
export {
|
|
12
|
-
|
|
71
|
+
T as Calendar
|
|
13
72
|
};
|
package/dist/bundle.es68.js
CHANGED
|
@@ -1,45 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
title: o,
|
|
11
|
-
value: a + 1
|
|
12
|
-
}));
|
|
13
|
-
if (t.month && r.year === t.year) {
|
|
14
|
-
const o = n.findIndex(({ value: a }) => a === t.month);
|
|
15
|
-
n.splice(0, o);
|
|
16
|
-
}
|
|
17
|
-
if (e.month && r.year === e.year) {
|
|
18
|
-
const o = n.findIndex(({ value: a }) => a === e.month);
|
|
19
|
-
n.splice(o + 1, n.length);
|
|
20
|
-
}
|
|
21
|
-
return n;
|
|
22
|
-
}, [r.year, t.year, t.month, e.year, e.month]), c = s(() => {
|
|
23
|
-
if (r.month === 0)
|
|
24
|
-
return [];
|
|
25
|
-
const n = i(r.month, r.year), o = Array.from({ length: n }, (a, y) => ({
|
|
26
|
-
title: `${y + 1}`,
|
|
27
|
-
value: y + 1
|
|
28
|
-
}));
|
|
29
|
-
if (t.day && r.month === t.month && r.year === t.year) {
|
|
30
|
-
const a = o.findIndex(({ value: y }) => y === t.day);
|
|
31
|
-
o.splice(0, a);
|
|
32
|
-
}
|
|
33
|
-
if (e.day && r.month === e.month && r.year === e.year) {
|
|
34
|
-
const a = o.findIndex(({ value: y }) => y === e.day);
|
|
35
|
-
o.splice(a + 1, o.length);
|
|
36
|
-
}
|
|
37
|
-
return o;
|
|
38
|
-
}, [r.month, r.year, t, e]);
|
|
39
|
-
return { years: h, months: d, days: c };
|
|
1
|
+
import { jsxs as r, Fragment as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { faXmark as i, faChevronDown as m } from "@companix/icons-solid";
|
|
3
|
+
import { Icon as o } from "./bundle.es35.js";
|
|
4
|
+
const f = (n) => {
|
|
5
|
+
const { clearButton: c, clearButtonIcon: t, value: s, onClear: l } = n;
|
|
6
|
+
return /* @__PURE__ */ r(a, { children: [
|
|
7
|
+
c && s && /* @__PURE__ */ e("button", { className: "select-close-button", onClick: l, children: t ?? /* @__PURE__ */ e(o, { className: "select-close-icon", icon: i, size: "xxxs" }) }),
|
|
8
|
+
/* @__PURE__ */ e(o, { className: "expand-icon select-expand", icon: m, size: "xxxs" })
|
|
9
|
+
] });
|
|
40
10
|
};
|
|
41
11
|
export {
|
|
42
|
-
|
|
43
|
-
u as defaultMin,
|
|
44
|
-
I as useCalendarOptions
|
|
12
|
+
f as SelectRightElements
|
|
45
13
|
};
|
package/dist/bundle.es69.js
CHANGED
|
@@ -1,17 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { DefaultMonths as f, getMonthMaxDay as i } from "./bundle.es64.js";
|
|
2
|
+
import { useMemo as s } from "react";
|
|
3
|
+
import { range as l } from "@companix/utils-js";
|
|
4
|
+
const p = { day: 31, month: 12, year: 2050 }, u = { day: 1, month: 1, year: 1900 }, I = ({ min: t = u, max: e = p, now: r }) => {
|
|
5
|
+
const h = s(() => l(e.year, t.year).map((n) => ({
|
|
6
|
+
title: n.toString(),
|
|
7
|
+
value: n
|
|
8
|
+
})), [e.year, t.year]), d = s(() => {
|
|
9
|
+
const n = f.map((o, a) => ({
|
|
10
|
+
title: o,
|
|
11
|
+
value: a + 1
|
|
12
|
+
}));
|
|
13
|
+
if (t.month && r.year === t.year) {
|
|
14
|
+
const o = n.findIndex(({ value: a }) => a === t.month);
|
|
15
|
+
n.splice(0, o);
|
|
16
|
+
}
|
|
17
|
+
if (e.month && r.year === e.year) {
|
|
18
|
+
const o = n.findIndex(({ value: a }) => a === e.month);
|
|
19
|
+
n.splice(o + 1, n.length);
|
|
20
|
+
}
|
|
21
|
+
return n;
|
|
22
|
+
}, [r.year, t.year, t.month, e.year, e.month]), c = s(() => {
|
|
23
|
+
if (r.month === 0)
|
|
24
|
+
return [];
|
|
25
|
+
const n = i(r.month, r.year), o = Array.from({ length: n }, (a, y) => ({
|
|
26
|
+
title: `${y + 1}`,
|
|
27
|
+
value: y + 1
|
|
28
|
+
}));
|
|
29
|
+
if (t.day && r.month === t.month && r.year === t.year) {
|
|
30
|
+
const a = o.findIndex(({ value: y }) => y === t.day);
|
|
31
|
+
o.splice(0, a);
|
|
32
|
+
}
|
|
33
|
+
if (e.day && r.month === e.month && r.year === e.year) {
|
|
34
|
+
const a = o.findIndex(({ value: y }) => y === e.day);
|
|
35
|
+
o.splice(a + 1, o.length);
|
|
36
|
+
}
|
|
37
|
+
return o;
|
|
38
|
+
}, [r.month, r.year, t, e]);
|
|
39
|
+
return { years: h, months: d, days: c };
|
|
12
40
|
};
|
|
13
41
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
42
|
+
p as defaultMax,
|
|
43
|
+
u as defaultMin,
|
|
44
|
+
I as useCalendarOptions
|
|
17
45
|
};
|
package/dist/bundle.es70.js
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { jsxs as E, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useState as v, useLayoutEffect as N, useEffect as y } from "react";
|
|
3
|
+
import { Editor as R } from "./bundle.es41.js";
|
|
4
|
+
const k = (d) => {
|
|
5
|
+
const {
|
|
6
|
+
id: e,
|
|
7
|
+
className: f,
|
|
8
|
+
inputClassName: i,
|
|
9
|
+
placeholderClassName: m,
|
|
10
|
+
placeholder: r,
|
|
11
|
+
value: s,
|
|
12
|
+
inputMode: n,
|
|
13
|
+
onCreate: b,
|
|
14
|
+
onClick: A
|
|
15
|
+
} = d, u = p(null), o = p(null), [h, a] = v(!0);
|
|
16
|
+
return N(() => {
|
|
17
|
+
const t = document.createElement("span");
|
|
18
|
+
t.setAttribute("contenteditable", "true"), t.setAttribute("class", i), t.dataset.placeholder = r, e && t.setAttribute("id", e), n && t.setAttribute("inputmode", n), u.current && u.current.appendChild(t);
|
|
19
|
+
const l = new R(t), C = l.onContentChange((x) => {
|
|
20
|
+
a(x.length === 0);
|
|
19
21
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
22
|
+
return b(l), o.current = t, () => {
|
|
23
|
+
C(), o.current = null, t.remove();
|
|
24
|
+
};
|
|
25
|
+
}, []), y(() => {
|
|
26
|
+
const t = o.current;
|
|
27
|
+
t && (e && t.setAttribute("id", e), n && t.setAttribute("inputmode", n), s && (t.textContent = s, a(!1)), t.setAttribute("class", i), t.setAttribute("role", "textbox"), t.setAttribute("aria-multiline", "true"), r && t.setAttribute("aria-label", r));
|
|
28
|
+
}, [e, i, n, r, s]), /* @__PURE__ */ E("div", { role: "presentation", className: f, children: [
|
|
29
|
+
h && /* @__PURE__ */ c("span", { "aria-hidden": "true", className: m, children: r }),
|
|
30
|
+
/* @__PURE__ */ c("div", { role: "presentation", ref: u, onClick: A })
|
|
31
|
+
] });
|
|
32
|
+
};
|
|
32
33
|
export {
|
|
33
|
-
|
|
34
|
+
k as WriteBarInput
|
|
34
35
|
};
|