@companix/uikit 0.0.15 → 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.
Files changed (61) 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 +5 -1
  12. package/dist/SelectTags/SelectTags.scss +1 -0
  13. package/dist/SelectTags/index.d.ts +1 -0
  14. package/dist/TimePicker/index.d.ts +10 -0
  15. package/dist/__hooks/use-input-padding.d.ts +5 -0
  16. package/dist/__hooks/use-scrollbox.d.ts +1 -1
  17. package/dist/__hooks/use-update.d.ts +1 -1
  18. package/dist/__utils/utils.d.ts +15 -1
  19. package/dist/bundle.es.js +30 -26
  20. package/dist/bundle.es10.js +1 -1
  21. package/dist/bundle.es14.js +1 -1
  22. package/dist/bundle.es19.js +1 -1
  23. package/dist/bundle.es20.js +1 -1
  24. package/dist/bundle.es23.js +1 -1
  25. package/dist/bundle.es24.js +48 -46
  26. package/dist/bundle.es25.js +93 -85
  27. package/dist/bundle.es26.js +67 -29
  28. package/dist/bundle.es27.js +34 -10
  29. package/dist/bundle.es28.js +11 -10
  30. package/dist/bundle.es29.js +82 -21
  31. package/dist/bundle.es30.js +10 -35
  32. package/dist/bundle.es31.js +21 -20
  33. package/dist/bundle.es32.js +36 -83
  34. package/dist/bundle.es33.js +23 -17
  35. package/dist/bundle.es34.js +87 -14
  36. package/dist/bundle.es35.js +18 -22
  37. package/dist/bundle.es36.js +20 -5
  38. package/dist/bundle.es37.js +24 -14
  39. package/dist/bundle.es38.js +39 -14
  40. package/dist/bundle.es39.js +20 -68
  41. package/dist/bundle.es40.js +5 -68
  42. package/dist/bundle.es41.js +13 -31
  43. package/dist/bundle.es42.js +14 -68
  44. package/dist/bundle.es43.js +66 -39
  45. package/dist/bundle.es44.js +67 -30
  46. package/dist/bundle.es45.js +69 -74
  47. package/dist/bundle.es46.js +10 -48
  48. package/dist/bundle.es47.js +45 -0
  49. package/dist/bundle.es48.js +34 -0
  50. package/dist/bundle.es49.js +70 -0
  51. package/dist/bundle.es50.js +16 -0
  52. package/dist/bundle.es51.js +45 -0
  53. package/dist/bundle.es52.js +77 -0
  54. package/dist/bundle.es53.js +51 -0
  55. package/dist/bundle.es54.js +16 -0
  56. package/dist/bundle.es8.js +54 -62
  57. package/dist/bundle.es9.js +35 -70
  58. package/dist/index.d.ts +3 -1
  59. package/dist/index.scss +2 -2
  60. package/dist/types.d.ts +4 -0
  61. package/package.json +2 -3
@@ -1,70 +1,16 @@
1
- import { jsxs as T, jsx as $ } from "react/jsx-runtime";
2
- import { forwardRef as b, useState as I, useMemo as P, useImperativeHandle as R, useCallback as j, createElement as k } from "react";
3
- import * as c from "@radix-ui/react-toast";
4
- import { varToStyle as w } from "@companix/utils-browser";
5
- import { Toast as C } from "./bundle.es43.js";
6
- var g = /* @__PURE__ */ ((e) => (e["top-center"] = "up", e["top-left"] = "left", e["top-right"] = "right", e["bottom-center"] = "down", e["bottom-left"] = "left", e["bottom-right"] = "right", e))(g || {});
7
- const M = b((e, h) => {
8
- const { side: f = "top", align: i = "center", gap: m = 14, duration: u, swipeThreshold: v, closeIcon: x } = e, [l, p] = I([]), o = P(() => ({}), []);
9
- R(
10
- h,
11
- () => ({
12
- addToast: (t) => {
13
- p((r) => [...r, t]);
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
- M as Viewport
15
+ f as useResizeTextarea
70
16
  };
@@ -1,45 +1,72 @@
1
- import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
- import * as t from "@radix-ui/react-toast";
3
- import { attr as C } from "@companix/utils-browser";
4
- import { useState as h, useRef as v, useEffect as N, useLayoutEffect as x } from "react";
5
- import { RemoveListener as R } from "./bundle.es36.js";
6
- const E = (i) => {
7
- const [c, l] = h(!1), o = v(null), {
8
- appearance: d = "neutral",
9
- icon: r,
10
- title: a,
11
- description: s,
12
- duration: m,
13
- closeIcon: u,
14
- onRemoving: p,
15
- onRemoved: f,
16
- onInitialized: L
17
- } = i;
18
- return N(() => {
19
- l(!0);
20
- }, []), x(() => {
21
- o.current && L(o.current);
22
- }, []), /* @__PURE__ */ n(
23
- t.Root,
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
- ref: o,
26
- "data-expanded": !0,
27
- "data-appearance": d,
28
- "data-mounted": C(c),
29
- className: "toaster",
30
- duration: m,
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
- E as Toast
71
+ T as Calendar
45
72
  };
@@ -1,33 +1,70 @@
1
- import { clamp as a } from "@companix/utils-browser";
2
- const D = (t, e) => new Date(e, t, 0).getDate(), g = (t, e) => new Date(e, t - 1, 1).getDay(), i = (t) => t === 0 ? 6 : t - 1, u = (t) => new Array(t).fill(0), h = (t) => ({
3
- day: t.getDate(),
4
- month: t.getMonth() + 1,
5
- year: t.getFullYear()
6
- }), y = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], s = 9999, c = 100, f = (t, e) => {
7
- const o = [], n = a(t - e, c, s), l = a(t + e, c, s);
8
- for (let r = n; r <= l; r++)
9
- o.push({ title: String(r).padStart(4, "0"), value: r });
10
- return o;
11
- }, p = (t) => {
12
- const e = [], o = new Intl.DateTimeFormat(t, {
13
- month: "long"
14
- });
15
- for (let n = 0; n < 12; n++)
16
- e.push({
17
- title: o.format(new Date(2023, n, 15)),
18
- value: n
19
- });
20
- return e;
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]);
21
58
  };
22
59
  export {
23
- s as DEFAULT_MAX_YEAR,
24
- c as DEFAULT_MIN_YEAR,
25
- u as createVoids,
26
- h as dateToFormat,
27
- i as getDayIndex,
28
- g as getFirstDay,
29
- D as getMonthMaxDay,
30
- p as getMonths,
31
- f as getYears,
32
- y as weeks
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
33
70
  };
@@ -1,77 +1,72 @@
1
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
- import { useCallback as u, useMemo as h } from "react";
3
- import { Select as p } from "./bundle.es8.js";
4
- import { getMonths as k, getYears as z, DEFAULT_MAX_YEAR as f, DEFAULT_MIN_YEAR as g } from "./bundle.es44.js";
5
- import { Icon as C } from "./bundle.es35.js";
6
- import { faChevronLeft as E, faChevronRight as T } from "@fortawesome/free-solid-svg-icons";
7
- import { setMonth as _, setYear as F } from "./bundle.es40.js";
8
- const y = ({
9
- viewDate: n,
10
- onChange: c,
11
- isMonthDisabled: a,
12
- isYearDisabled: m,
13
- onNextMonth: N,
14
- onPrevMonth: v
15
- }) => {
16
- const e = n.getFullYear(), r = n.getMonth(), s = "ru", M = u(
17
- (t) => {
18
- c(_(n, t));
19
- },
20
- [c, n]
21
- ), x = u(
22
- (t) => {
23
- c(F(n, t));
24
- },
25
- [c, n]
26
- ), A = h(() => k(s).map((t) => ({
27
- ...t,
28
- className: "capitalize",
29
- disabled: a && a(t.value)
30
- })), [s, a]), Y = h(() => z(e, 100).map((t) => ({
31
- ...t,
32
- disabled: m && m(t.value)
33
- })), [e, m]);
34
- let l = r === 11 && e === f;
35
- a && !l && (l = a(
36
- r === 11 ? 0 : r + 1,
37
- r === 11 ? Math.min(e + 1, f) : e
38
- ));
39
- let i = r === 0 && e === g;
40
- return a && !i && (i = a(
41
- r === 0 ? 11 : r - 1,
42
- r === 0 ? Math.max(e - 1, g) : e
43
- )), /* @__PURE__ */ d("div", { className: "calendar-header", children: [
44
- !i && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "left", onClick: v, children: /* @__PURE__ */ o(C, { icon: E }) }),
45
- /* @__PURE__ */ d("div", { className: "calendar-pickers", children: [
46
- /* @__PURE__ */ o(
47
- p,
48
- {
49
- fill: !0,
50
- options: Y,
51
- size: "sm",
52
- value: e,
53
- minimalOptions: !0,
54
- matchTarget: "min-width",
55
- onChange: (t) => x(t)
56
- }
57
- ),
58
- /* @__PURE__ */ o(
59
- p,
60
- {
61
- fill: !0,
62
- options: A,
63
- size: "sm",
64
- className: "capitalize",
65
- value: r,
66
- minimalOptions: !0,
67
- matchTarget: "min-width",
68
- onChange: (t) => M(t)
69
- }
70
- )
71
- ] }),
72
- !l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: N, children: /* @__PURE__ */ o(C, { icon: T }) })
73
- ] });
1
+ import { clamp as m } from "@companix/utils-browser";
2
+ import { formatTime as i } from "@companix/utils-js";
3
+ const g = (n, r) => new Date(r, n, 0).getDate(), u = (n, r) => new Date(r, n - 1, 1).getDay(), D = (n) => n === 0 ? 6 : n - 1, d = (n) => new Array(n).fill(0), T = (n) => ({
4
+ day: n.getDate(),
5
+ month: n.getMonth() + 1,
6
+ year: n.getFullYear()
7
+ }), p = ({ min: n, max: r }) => (t) => {
8
+ if (n.year === t.year) {
9
+ if (t.month !== 0 && t.month < n.month)
10
+ return t.month = 0, t.day = 0, t;
11
+ if (t.month === n.month && t.day < n.day && t.day !== 0)
12
+ return t.day = 0, t;
13
+ }
14
+ if (r.year === t.year) {
15
+ if (t.month !== 0 && t.month > r.month)
16
+ return t.month = 0, t.day = 0, t;
17
+ if (t.month === r.month && t.day > r.day && t.day !== 0)
18
+ return t.day = 0, t;
19
+ }
20
+ }, A = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], M = [
21
+ "Январь",
22
+ "Февраль",
23
+ "Март",
24
+ "Апрель",
25
+ "Май",
26
+ "Июнь",
27
+ "Июль",
28
+ "Август",
29
+ "Сентябрь",
30
+ "Октябрь",
31
+ "Ноябрь",
32
+ "Декабрь"
33
+ ], c = 9999, a = 100, w = (n, r) => {
34
+ const t = [], o = m(n - r, a, c), e = m(n + r, a, c);
35
+ for (let s = o; s <= e; s++)
36
+ t.push({ title: String(s).padStart(4, "0"), value: s });
37
+ return t;
38
+ }, F = (n) => {
39
+ const r = [], t = new Intl.DateTimeFormat(n, {
40
+ month: "long"
41
+ });
42
+ for (let o = 0; o < 12; o++)
43
+ r.push({
44
+ title: t.format(new Date(2023, o, 15)),
45
+ value: o
46
+ });
47
+ return r;
48
+ }, Y = (n, r) => r.reduce((t, o) => t.replaceAll(o, ""), n.trim()), E = ({ hours: n, minutes: r }, t = ":") => [i(n), i(r)].join(t), h = (n, r = ":") => {
49
+ const [t, o] = [i(n.hours), i(n.minutes)], e = [t, o].join(r);
50
+ return { title: e, value: e, hours: t, minutes: o };
51
+ }, _ = (n, r = ":") => {
52
+ const t = { minutes: -n, hours: 0 };
53
+ return Array.from({ length: 1440 / n }).map(() => (t.minutes += n, t.minutes === 60 && (t.minutes = 0, t.hours++), h(t, r)));
74
54
  };
75
55
  export {
76
- y as CalendarHeader
56
+ c as DEFAULT_MAX_YEAR,
57
+ a as DEFAULT_MIN_YEAR,
58
+ M as DefaultMonths,
59
+ E as convertTimeToOption,
60
+ p as createDateValidation,
61
+ d as createVoids,
62
+ T as dateToFormat,
63
+ D as getDayIndex,
64
+ u as getFirstDay,
65
+ g as getMonthMaxDay,
66
+ F as getMonths,
67
+ h as getTimeValue,
68
+ _ as getTimesOptions,
69
+ w as getYears,
70
+ Y as removeDigits,
71
+ A as weeks
77
72
  };
@@ -1,51 +1,13 @@
1
- import { subMonths as L, addMonths as N, useDayDisableCheker as R } from "./bundle.es40.js";
2
- import { DEFAULT_MIN_YEAR as w, DEFAULT_MAX_YEAR as A } from "./bundle.es44.js";
3
- import { useState as U, useCallback as M } from "react";
4
- const X = ({
5
- value: p,
6
- disablePast: r,
7
- disableFuture: c,
8
- shouldDisableDate: E,
9
- minDateTime: l,
10
- maxDateTime: s
11
- }) => {
12
- const [e, u] = U(p || /* @__PURE__ */ new Date()), _ = M(() => {
13
- u(L(e));
14
- }, [e]), C = M(() => {
15
- u(N(e, 1));
16
- }, [e]), D = R({
17
- disableFuture: c,
18
- disablePast: r,
19
- shouldDisableDate: E,
20
- minDateTime: l,
21
- maxDateTime: s
22
- }), k = M(
23
- (o, t) => {
24
- const n = /* @__PURE__ */ new Date();
25
- t = t || e.getFullYear();
26
- const h = l ? l.getMonth() : 0, Y = s ? s.getMonth() : 11, F = l?.getFullYear() || w, f = s?.getFullYear() || A;
27
- let g = t >= F && t <= f ? t === F && h > o || t === f && o > Y : !0;
28
- return c && (g = g || (t === n.getFullYear() ? o > n.getMonth() : t > n.getFullYear())), r && (g = g || (t === n.getFullYear() ? o < n.getMonth() : t < n.getFullYear())), g;
29
- },
30
- [c, r, e, l, s]
31
- ), v = M(
32
- (o) => {
33
- const t = /* @__PURE__ */ new Date(), n = l?.getFullYear() || w, h = s?.getFullYear() || A;
34
- let Y = n > o || o > h;
35
- return c && (Y = Y || o > t.getFullYear()), r && (Y = Y || o < t.getFullYear()), Y;
36
- },
37
- [c, r, l, s]
38
- );
39
- return {
40
- viewDate: e,
41
- setViewDate: u,
42
- setPrevMonth: _,
43
- setNextMonth: C,
44
- isDayDisabled: D,
45
- isMonthDisabled: k,
46
- isYearDisabled: v
47
- };
1
+ import { jsxs as r, Fragment as a, jsx as e } from "react/jsx-runtime";
2
+ import { faClose as i, faChevronDown as m } from "@fortawesome/free-solid-svg-icons";
3
+ import { Icon as o } from "./bundle.es39.js";
4
+ const f = (n) => {
5
+ const { clearButton: c, clearButtonIcon: s, value: t, onClear: l } = n;
6
+ return /* @__PURE__ */ r(a, { children: [
7
+ c && t && /* @__PURE__ */ e("button", { className: "select-close-button", onClick: l, children: s ?? /* @__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
+ ] });
48
10
  };
49
11
  export {
50
- X as useCalendar
12
+ f as SelectRightElements
51
13
  };
@@ -0,0 +1,45 @@
1
+ import { DefaultMonths as f, getMonthMaxDay as i } from "./bundle.es45.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 };
40
+ };
41
+ export {
42
+ p as defaultMax,
43
+ u as defaultMin,
44
+ I as useCalendarOptions
45
+ };
@@ -0,0 +1,34 @@
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;
19
+ });
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
+ });
32
+ export {
33
+ g as Viewport
34
+ };
@@ -0,0 +1,70 @@
1
+ import { jsxs as T, jsx as $ } from "react/jsx-runtime";
2
+ import { forwardRef as b, useState as I, useMemo as P, useImperativeHandle as R, useCallback as j, createElement as k } from "react";
3
+ import * as c from "@radix-ui/react-toast";
4
+ import { varToStyle as w } from "@companix/utils-browser";
5
+ import { Toast as C } from "./bundle.es51.js";
6
+ var g = /* @__PURE__ */ ((e) => (e["top-center"] = "up", e["top-left"] = "left", e["top-right"] = "right", e["bottom-center"] = "down", e["bottom-left"] = "left", e["bottom-right"] = "right", e))(g || {});
7
+ const M = b((e, h) => {
8
+ const { side: f = "top", align: i = "center", gap: m = 14, duration: u, swipeThreshold: v, closeIcon: x } = e, [l, p] = I([]), o = P(() => ({}), []);
9
+ R(
10
+ h,
11
+ () => ({
12
+ addToast: (t) => {
13
+ p((r) => [...r, t]);
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
+ });
68
+ export {
69
+ M as Viewport
70
+ };