@companix/uikit 0.0.24 → 0.0.26

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.
@@ -14,6 +14,7 @@ export interface InternButtonProps {
14
14
  text?: React.ReactNode;
15
15
  children?: React.ReactNode;
16
16
  className?: string;
17
+ Component?: React.ElementType;
17
18
  }
18
19
  export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, InternButtonProps {
19
20
  }
@@ -2,9 +2,9 @@ export interface FileOverlayProps {
2
2
  multiple?: true;
3
3
  onChange?: (file: File[]) => void;
4
4
  children: React.ReactNode;
5
- mimes?: string[];
6
5
  disabled?: boolean;
7
6
  className?: string;
7
+ mimes?: ('image' | 'video' | 'audio' | 'text' | 'application')[];
8
8
  }
9
- declare const FileOverlay: ({ onChange, disabled, mimes, children, multiple, className }: FileOverlayProps) => import("react/jsx-runtime").JSX.Element;
9
+ declare const FileOverlay: ({ onChange, disabled, children, multiple, mimes, className }: FileOverlayProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export { FileOverlay };
@@ -8,7 +8,6 @@ export interface ViewportProps {
8
8
  closeIcon?: React.ReactNode;
9
9
  }
10
10
  export interface ViewportRef {
11
- addToast: (toast: InnerToast) => void;
12
- updateToast: (toast: InnerToast) => void;
11
+ showToast: (toast: InnerToast) => void;
13
12
  }
14
13
  export declare const Viewport: import('react').ForwardRefExoticComponent<ViewportProps & import('react').RefAttributes<ViewportRef>>;
@@ -14,8 +14,7 @@ export interface InnerToast extends ToastOptions {
14
14
  }
15
15
  export declare const createToaster: (rootProps?: ViewportProps) => {
16
16
  api: {
17
- add: (toast: ToastOptions) => string;
18
- update: (toast: InnerToast) => void;
17
+ show: (toast: ToastOptions) => string;
19
18
  };
20
19
  Viewport: (props?: ViewportProps) => import("react/jsx-runtime").JSX.Element;
21
20
  };
@@ -1,41 +1,43 @@
1
- import { jsx as e, jsxs as b, Fragment as h } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as x, Fragment as h } from "react/jsx-runtime";
2
2
  import j from "classnames";
3
3
  import { Spinner as k } from "./bundle.es3.js";
4
- import { forwardRef as v } from "react";
4
+ import { forwardRef as w } from "react";
5
5
  import { attr as r } from "@companix/utils-browser";
6
- const F = v(
6
+ const F = w(
7
7
  ({
8
8
  children: d,
9
- fill: o,
10
- text: m,
11
- active: l,
12
- mode: c = "default",
13
- appearance: f = "neutral",
14
- size: s = "md",
15
- align: p,
16
- icon: n,
17
- loading: a,
18
- className: u,
19
- iconRight: i,
20
- ...t
21
- }, x) => /* @__PURE__ */ e(
22
- "button",
9
+ fill: l,
10
+ text: i,
11
+ active: c,
12
+ mode: f = "default",
13
+ appearance: s = "neutral",
14
+ size: p = "md",
15
+ align: u,
16
+ icon: m,
17
+ loading: t,
18
+ className: b,
19
+ iconRight: n,
20
+ Component: o = "button",
21
+ ...a
22
+ }, v) => /* @__PURE__ */ e(
23
+ o,
23
24
  {
24
- ref: x,
25
- className: j("button", u),
26
- "data-size": s,
27
- "data-loading": r(a),
28
- "data-align": a ? "center" : p ?? (n && i ? "left" : "center"),
29
- "data-appearance": f,
30
- "data-mode": c,
31
- "data-fill": r(o),
32
- "data-active": r(l),
33
- ...t,
34
- onClick: a ?? t.disabled ? void 0 : t.onClick,
35
- children: a ? /* @__PURE__ */ e(k, { size: 14, width: 2 }) : /* @__PURE__ */ b(h, { children: [
36
- n,
37
- (d ?? m) && /* @__PURE__ */ e("span", { className: "button-text", children: m ?? d }),
38
- i
25
+ ref: v,
26
+ className: j("button", b),
27
+ "data-size": p,
28
+ "data-loading": r(t),
29
+ "data-align": t ? "center" : u ?? (m && n ? "left" : "center"),
30
+ "data-appearance": s,
31
+ "data-mode": f,
32
+ "data-fill": r(l),
33
+ "data-active": r(c),
34
+ type: o === "button" ? "button" : void 0,
35
+ ...a,
36
+ onClick: t ?? a.disabled ? void 0 : a.onClick,
37
+ children: t ? /* @__PURE__ */ e(k, { size: 14, width: 2 }) : /* @__PURE__ */ x(h, { children: [
38
+ m,
39
+ (d ?? i) && /* @__PURE__ */ e("span", { className: "button-text", children: i ?? d }),
40
+ n
39
41
  ] })
40
42
  }
41
43
  )
@@ -1,38 +1,35 @@
1
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
- import { VisuallyHidden as s } from "@radix-ui/react-visually-hidden";
3
- import { useRef as p } from "react";
4
- const d = ({
5
- onChange: n,
6
- disabled: r,
7
- mimes: l,
8
- children: a,
9
- multiple: i,
10
- className: f
1
+ import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
+ import { VisuallyHidden as p } from "@radix-ui/react-visually-hidden";
3
+ import { useRef as h, useMemo as m } from "react";
4
+ const j = ({
5
+ onChange: l,
6
+ disabled: n,
7
+ children: o,
8
+ multiple: f,
9
+ mimes: e,
10
+ className: a
11
11
  }) => {
12
- const e = p(null), u = (t) => {
13
- r || (t.target.files && n?.(Array.from(t.target.files)), e.current && (e.current.value = ""));
14
- };
15
- return /* @__PURE__ */ c("label", { className: f, children: [
16
- a,
17
- /* @__PURE__ */ o(s, { asChild: !0, children: /* @__PURE__ */ o(
12
+ const t = h(null), u = (r) => {
13
+ n || (r.target.files && l?.(Array.from(r.target.files)), t.current && (t.current.value = ""));
14
+ }, c = m(() => {
15
+ if (e)
16
+ return e.map((r) => `${r}/*`).join(",");
17
+ }, [e]);
18
+ return /* @__PURE__ */ s("label", { className: a, children: [
19
+ o,
20
+ /* @__PURE__ */ i(p, { asChild: !0, children: /* @__PURE__ */ i(
18
21
  "input",
19
22
  {
20
- ref: e,
21
- hidden: !0,
23
+ ref: t,
22
24
  type: "file",
23
- autoComplete: "off",
24
- autoCapitalize: "none",
25
- autoCorrect: "off",
26
- spellCheck: "false",
27
- "aria-autocomplete": "none",
28
- multiple: i,
29
- accept: (l ?? []).join(", "),
25
+ multiple: f,
26
+ accept: c,
30
27
  onChange: u,
31
- disabled: r
28
+ disabled: n
32
29
  }
33
30
  ) })
34
31
  ] });
35
32
  };
36
33
  export {
37
- d as FileOverlay
34
+ j as FileOverlay
38
35
  };
@@ -1,49 +1,41 @@
1
- import { jsx as n } from "react/jsx-runtime";
1
+ import { jsx as t } from "react/jsx-runtime";
2
2
  import { hash as r } from "@companix/utils-js";
3
- import { Viewport as o } from "./bundle.es54.js";
4
- import { useRef as s, useMemo as u } from "react";
5
- const f = (t = {}) => {
6
- const i = {
7
- addToast: (e) => {
8
- console.error("uninitialized", e);
9
- },
10
- updateToast: (e) => {
3
+ import { Viewport as a } from "./bundle.es54.js";
4
+ import { useRef as c, useMemo as h } from "react";
5
+ const m = (i = {}) => {
6
+ const o = {
7
+ showToast: (e) => {
11
8
  console.error("uninitialized", e);
12
9
  }
13
10
  };
14
11
  return {
15
12
  api: {
16
- add: (e) => {
17
- const a = e.id ?? r();
18
- return i.addToast({ ...e, id: a }), a;
19
- },
20
- update: (e) => {
21
- i.updateToast(e);
13
+ show: (e) => {
14
+ const n = e.id ?? r();
15
+ return o.showToast({ ...e, id: n }), n;
22
16
  }
23
17
  },
24
18
  Viewport: (e = {}) => {
25
- const a = s(null);
26
- return u(() => {
27
- i.addToast = (d) => {
28
- a.current && a.current.addToast(d);
29
- }, i.updateToast = (d) => {
30
- a.current && a.current.updateToast(d);
19
+ const n = c(null);
20
+ return h(() => {
21
+ o.showToast = (s) => {
22
+ n.current && n.current.showToast(s);
31
23
  };
32
- }, []), /* @__PURE__ */ n(
33
- o,
24
+ }, []), /* @__PURE__ */ t(
25
+ a,
34
26
  {
35
- ref: a,
36
- align: e.align ?? t.align,
37
- closeIcon: e.closeIcon ?? t.closeIcon,
38
- duration: e.duration ?? t.duration,
39
- gap: e.gap ?? t.gap,
40
- side: e.side ?? t.side,
41
- swipeThreshold: e.swipeThreshold ?? t.swipeThreshold
27
+ ref: n,
28
+ align: e.align ?? i.align,
29
+ closeIcon: e.closeIcon ?? i.closeIcon,
30
+ duration: e.duration ?? i.duration,
31
+ gap: e.gap ?? i.gap,
32
+ side: e.side ?? i.side,
33
+ swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
42
34
  }
43
35
  );
44
36
  }
45
37
  };
46
38
  };
47
39
  export {
48
- f as createToaster
40
+ m as createToaster
49
41
  };
@@ -2,7 +2,7 @@ import { jsxs as b, jsx as o } from "react/jsx-runtime";
2
2
  import h from "classnames";
3
3
  import { attr as e } from "@companix/utils-browser";
4
4
  import { forwardRef as x } from "react";
5
- import { useInputPadding as N } from "./bundle.es55.js";
5
+ import { useInputPadding as N } from "./bundle.es59.js";
6
6
  const v = x(
7
7
  ({
8
8
  required: s,
@@ -1,4 +1,4 @@
1
- import { __require as r } from "./bundle.es56.js";
1
+ import { __require as r } from "./bundle.es57.js";
2
2
  var a = /* @__PURE__ */ r();
3
3
  export {
4
4
  a as f
@@ -1,7 +1,7 @@
1
1
  import { jsxs as D, jsx as t } from "react/jsx-runtime";
2
2
  import { dateToFormat as $, weeks as g, createVoids as p, getDayIndex as b, getFirstDay as u, getMonthMaxDay as k } from "./bundle.es50.js";
3
- import { CalendarHeader as F } from "./bundle.es58.js";
4
- import { useCalendar as j } from "./bundle.es59.js";
3
+ import { CalendarHeader as F } from "./bundle.es55.js";
4
+ import { useCalendar as j } from "./bundle.es56.js";
5
5
  import { attr as m } from "@companix/utils-browser";
6
6
  import { isSameDate as f } from "./bundle.es49.js";
7
7
  import { useLayoutEffect as I } from "react";
@@ -1,58 +1,55 @@
1
1
  import { jsxs as y, jsx as I } from "react/jsx-runtime";
2
- import { forwardRef as $, useState as b, useMemo as C, useImperativeHandle as P, useCallback as j, createElement as k } from "react";
2
+ import { forwardRef as $, useState as b, useMemo as w, useImperativeHandle as C, useCallback as P, createElement as j } from "react";
3
3
  import * as c from "@radix-ui/react-toast";
4
- import { varToStyle as w } from "@companix/utils-browser";
4
+ import { varToStyle as k } from "@companix/utils-browser";
5
5
  import { Toast as E } from "./bundle.es35.js";
6
6
  var u = /* @__PURE__ */ ((r) => (r["top-center"] = "up", r["top-left"] = "left", r["top-right"] = "right", r["bottom-center"] = "down", r["bottom-left"] = "left", r["bottom-right"] = "right", r))(u || {});
7
- const M = $((r, g) => {
8
- const { side: d = "top", align: f = "center", gap: p = 14, duration: x, swipeThreshold: h, closeIcon: T } = r, [i, l] = b([]), s = C(() => ({}), []);
9
- P(
10
- g,
7
+ const M = $((r, h) => {
8
+ const { side: l = "top", align: f = "center", gap: d = 14, duration: g, swipeThreshold: x, closeIcon: T } = r, [i, p] = b([]), a = w(() => ({}), []);
9
+ C(
10
+ h,
11
11
  () => ({
12
- addToast: (t) => {
13
- l((e) => [...e, t]);
14
- },
15
- updateToast: (t) => {
16
- l((e) => {
17
- const o = [...e], n = e.findIndex((a) => a.id === t.id);
18
- return n !== -1 && (o[n] = t), o;
12
+ showToast: (t) => {
13
+ p((o) => {
14
+ const e = [...o], n = o.findIndex((s) => s.id === t.id);
15
+ return n === -1 ? e.push(t) : e[n] = t, e;
19
16
  });
20
17
  }
21
18
  }),
22
19
  []
23
20
  );
24
- const m = j((t) => {
25
- t.forEach(({ id: e }, o) => {
21
+ const m = P((t) => {
22
+ t.forEach(({ id: o }, e) => {
26
23
  let n = 0;
27
- for (let a = o + 1; a < t.length; a++)
28
- s[t[a].id] && (n += s[t[a].id].clientHeight + p);
29
- s[e] && s[e].style.setProperty("--offset", `${n}px`);
24
+ for (let s = e + 1; s < t.length; s++)
25
+ a[t[s].id] && (n += a[t[s].id].clientHeight + d);
26
+ a[o] && a[o].style.setProperty("--offset", `${n}px`);
30
27
  });
31
28
  }, []), v = (t) => {
32
- l((e) => {
33
- const o = [...e], n = o.findIndex((a) => a.id === t);
34
- return n !== -1 && o.splice(n, 1), o;
29
+ p((o) => {
30
+ const e = [...o], n = e.findIndex((s) => s.id === t);
31
+ return n !== -1 && e.splice(n, 1), e;
35
32
  });
36
33
  };
37
34
  return /* @__PURE__ */ y(
38
35
  c.Provider,
39
36
  {
40
- swipeThreshold: h,
41
- swipeDirection: u[`${d}-${f}`],
37
+ swipeThreshold: x,
38
+ swipeDirection: u[`${l}-${f}`],
42
39
  children: [
43
- i.map(({ id: t, ...e }) => /* @__PURE__ */ k(
40
+ i.map(({ id: t, ...o }) => /* @__PURE__ */ j(
44
41
  E,
45
42
  {
46
- ...e,
43
+ ...o,
47
44
  id: t,
48
45
  key: `toaster-${t}`,
49
- duration: e.duration ?? x,
46
+ duration: o.duration ?? g,
50
47
  closeIcon: T,
51
- onInitialized: (o) => {
52
- s[t] = o, m(i);
48
+ onInitialized: (e) => {
49
+ a[t] = e, m(i);
53
50
  },
54
51
  onClosing: () => {
55
- delete s[t], m(i);
52
+ delete a[t], m(i);
56
53
  },
57
54
  onClosed: () => v(t)
58
55
  }
@@ -60,10 +57,10 @@ const M = $((r, g) => {
60
57
  /* @__PURE__ */ I(
61
58
  c.Viewport,
62
59
  {
63
- "data-side": d,
60
+ "data-side": l,
64
61
  "data-align": f,
65
62
  className: "toaster-viewport",
66
- style: w({ "--toasters-gap": `${p}px` })
63
+ style: k({ "--toasters-gap": `${d}px` })
67
64
  }
68
65
  )
69
66
  ]
@@ -1,16 +1,78 @@
1
- import { useRef as l, useCallback as p } from "react";
2
- import { useEffectWithLayout as d } from "./bundle.es66.js";
3
- const g = (r, f) => {
4
- const c = l(null), i = l(null), o = { Right: c, Left: i }, u = p((t) => {
5
- if (r.current) {
6
- const n = r.current.style, e = o[t];
7
- e.current && e.current.clientWidth ? n[`padding${t}`] !== `${e.current.clientWidth}px` && (n[`padding${t}`] = `${e.current.clientWidth}px`) : n[`padding${t}`] && (n[`padding${t}`] = "");
8
- }
9
- }, []);
10
- return d(() => {
11
- u("Left"), u("Right");
12
- }, f), { rightRef: c, leftRef: i };
1
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
+ import { useCallback as h, useMemo as d } from "react";
3
+ import { Select as p } from "./bundle.es8.js";
4
+ import { getMonths as Y, getYears as k, DEFAULT_MAX_YEAR as u, DEFAULT_MIN_YEAR as g } from "./bundle.es50.js";
5
+ import { Icon as C } from "./bundle.es30.js";
6
+ import { f as z } from "./bundle.es66.js";
7
+ import { f as L } from "./bundle.es67.js";
8
+ import { setMonth as R, setYear as T } from "./bundle.es49.js";
9
+ const S = ({
10
+ viewDate: n,
11
+ onChange: m,
12
+ isMonthDisabled: a,
13
+ isYearDisabled: c,
14
+ onNextMonth: v,
15
+ onPrevMonth: x
16
+ }) => {
17
+ const r = n.getFullYear(), e = n.getMonth(), i = "ru", N = h(
18
+ (t) => {
19
+ m(R(n, t));
20
+ },
21
+ [m, n]
22
+ ), E = h(
23
+ (t) => {
24
+ m(T(n, t));
25
+ },
26
+ [m, n]
27
+ ), M = d(() => Y(i).map((t) => ({
28
+ ...t,
29
+ className: "capitalize",
30
+ disabled: a && a(t.value)
31
+ })), [i, a]), A = d(() => k(r, 100).map((t) => ({
32
+ ...t,
33
+ disabled: c && c(t.value)
34
+ })), [r, c]);
35
+ let l = e === 11 && r === u;
36
+ a && !l && (l = a(
37
+ e === 11 ? 0 : e + 1,
38
+ e === 11 ? Math.min(r + 1, u) : r
39
+ ));
40
+ let s = e === 0 && r === g;
41
+ return a && !s && (s = a(
42
+ e === 0 ? 11 : e - 1,
43
+ e === 0 ? Math.max(r - 1, g) : r
44
+ )), /* @__PURE__ */ f("div", { className: "calendar-header", children: [
45
+ !s && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "left", onClick: x, children: /* @__PURE__ */ o(C, { icon: L.faChevronLeft }) }),
46
+ /* @__PURE__ */ f("div", { className: "calendar-pickers", children: [
47
+ /* @__PURE__ */ o(
48
+ p,
49
+ {
50
+ fill: !0,
51
+ options: A,
52
+ size: "sm",
53
+ value: r,
54
+ minimalOptions: !0,
55
+ matchTarget: "min-width",
56
+ onChange: (t) => E(t)
57
+ }
58
+ ),
59
+ /* @__PURE__ */ o(
60
+ p,
61
+ {
62
+ fill: !0,
63
+ options: M,
64
+ size: "sm",
65
+ className: "capitalize",
66
+ value: e,
67
+ minimalOptions: !0,
68
+ matchTarget: "min-width",
69
+ onChange: (t) => N(t)
70
+ }
71
+ )
72
+ ] }),
73
+ !l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: v, children: /* @__PURE__ */ o(C, { icon: z.faChevronRight }) })
74
+ ] });
13
75
  };
14
76
  export {
15
- g as useInputPadding
77
+ S as CalendarHeader
16
78
  };
@@ -1,22 +1,51 @@
1
- import { __exports as e } from "./bundle.es57.js";
2
- var v;
3
- function d() {
4
- return v ? e : (v = 1, (function(a) {
5
- Object.defineProperty(a, "__esModule", { value: !0 });
6
- var c = "fas", n = "check", r = 448, f = 512, i = [10003, 10004], h = "f00c", u = "M434.8 70.1c14.3 10.4 17.5 30.4 7.1 44.7l-256 352c-5.5 7.6-14 12.3-23.4 13.1s-18.5-2.7-25.1-9.3l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l101.5 101.5 234-321.7c10.4-14.3 30.4-17.5 44.7-7.1z";
7
- a.definition = {
8
- prefix: c,
9
- iconName: n,
10
- icon: [
11
- r,
12
- f,
13
- i,
14
- h,
15
- u
16
- ]
17
- }, a.faCheck = a.definition, a.prefix = c, a.iconName = n, a.width = r, a.height = f, a.ligatures = i, a.unicode = h, a.svgPathData = u, a.aliases = i;
18
- })(e), e);
19
- }
1
+ import { subMonths as L, addMonths as N, useDayDisableCheker as R } from "./bundle.es49.js";
2
+ import { DEFAULT_MIN_YEAR as w, DEFAULT_MAX_YEAR as A } from "./bundle.es50.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
+ };
48
+ };
20
49
  export {
21
- d as __require
50
+ X as useCalendar
22
51
  };
@@ -1,4 +1,22 @@
1
- var a = {};
1
+ import { __exports as e } from "./bundle.es58.js";
2
+ var v;
3
+ function d() {
4
+ return v ? e : (v = 1, (function(a) {
5
+ Object.defineProperty(a, "__esModule", { value: !0 });
6
+ var c = "fas", n = "check", r = 448, f = 512, i = [10003, 10004], h = "f00c", u = "M434.8 70.1c14.3 10.4 17.5 30.4 7.1 44.7l-256 352c-5.5 7.6-14 12.3-23.4 13.1s-18.5-2.7-25.1-9.3l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l101.5 101.5 234-321.7c10.4-14.3 30.4-17.5 44.7-7.1z";
7
+ a.definition = {
8
+ prefix: c,
9
+ iconName: n,
10
+ icon: [
11
+ r,
12
+ f,
13
+ i,
14
+ h,
15
+ u
16
+ ]
17
+ }, a.faCheck = a.definition, a.prefix = c, a.iconName = n, a.width = r, a.height = f, a.ligatures = i, a.unicode = h, a.svgPathData = u, a.aliases = i;
18
+ })(e), e);
19
+ }
2
20
  export {
3
- a as __exports
21
+ d as __require
4
22
  };
@@ -1,78 +1,4 @@
1
- import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
- import { useCallback as h, useMemo as d } from "react";
3
- import { Select as p } from "./bundle.es8.js";
4
- import { getMonths as Y, getYears as k, DEFAULT_MAX_YEAR as u, DEFAULT_MIN_YEAR as g } from "./bundle.es50.js";
5
- import { Icon as C } from "./bundle.es30.js";
6
- import { f as z } from "./bundle.es67.js";
7
- import { f as L } from "./bundle.es68.js";
8
- import { setMonth as R, setYear as T } from "./bundle.es49.js";
9
- const S = ({
10
- viewDate: n,
11
- onChange: m,
12
- isMonthDisabled: a,
13
- isYearDisabled: c,
14
- onNextMonth: v,
15
- onPrevMonth: x
16
- }) => {
17
- const r = n.getFullYear(), e = n.getMonth(), i = "ru", N = h(
18
- (t) => {
19
- m(R(n, t));
20
- },
21
- [m, n]
22
- ), E = h(
23
- (t) => {
24
- m(T(n, t));
25
- },
26
- [m, n]
27
- ), M = d(() => Y(i).map((t) => ({
28
- ...t,
29
- className: "capitalize",
30
- disabled: a && a(t.value)
31
- })), [i, a]), A = d(() => k(r, 100).map((t) => ({
32
- ...t,
33
- disabled: c && c(t.value)
34
- })), [r, c]);
35
- let l = e === 11 && r === u;
36
- a && !l && (l = a(
37
- e === 11 ? 0 : e + 1,
38
- e === 11 ? Math.min(r + 1, u) : r
39
- ));
40
- let s = e === 0 && r === g;
41
- return a && !s && (s = a(
42
- e === 0 ? 11 : e - 1,
43
- e === 0 ? Math.max(r - 1, g) : r
44
- )), /* @__PURE__ */ f("div", { className: "calendar-header", children: [
45
- !s && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "left", onClick: x, children: /* @__PURE__ */ o(C, { icon: L.faChevronLeft }) }),
46
- /* @__PURE__ */ f("div", { className: "calendar-pickers", children: [
47
- /* @__PURE__ */ o(
48
- p,
49
- {
50
- fill: !0,
51
- options: A,
52
- size: "sm",
53
- value: r,
54
- minimalOptions: !0,
55
- matchTarget: "min-width",
56
- onChange: (t) => E(t)
57
- }
58
- ),
59
- /* @__PURE__ */ o(
60
- p,
61
- {
62
- fill: !0,
63
- options: M,
64
- size: "sm",
65
- className: "capitalize",
66
- value: e,
67
- minimalOptions: !0,
68
- matchTarget: "min-width",
69
- onChange: (t) => N(t)
70
- }
71
- )
72
- ] }),
73
- !l && /* @__PURE__ */ o("button", { className: "calendar-navigation", "data-side": "right", onClick: v, children: /* @__PURE__ */ o(C, { icon: z.faChevronRight }) })
74
- ] });
75
- };
1
+ var a = {};
76
2
  export {
77
- S as CalendarHeader
3
+ a as __exports
78
4
  };
@@ -1,51 +1,16 @@
1
- import { subMonths as L, addMonths as N, useDayDisableCheker as R } from "./bundle.es49.js";
2
- import { DEFAULT_MIN_YEAR as w, DEFAULT_MAX_YEAR as A } from "./bundle.es50.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 { useRef as l, useCallback as p } from "react";
2
+ import { useEffectWithLayout as d } from "./bundle.es68.js";
3
+ const g = (r, f) => {
4
+ const c = l(null), i = l(null), o = { Right: c, Left: i }, u = p((t) => {
5
+ if (r.current) {
6
+ const n = r.current.style, e = o[t];
7
+ e.current && e.current.clientWidth ? n[`padding${t}`] !== `${e.current.clientWidth}px` && (n[`padding${t}`] = `${e.current.clientWidth}px`) : n[`padding${t}`] && (n[`padding${t}`] = "");
8
+ }
9
+ }, []);
10
+ return d(() => {
11
+ u("Left"), u("Right");
12
+ }, f), { rightRef: c, leftRef: i };
48
13
  };
49
14
  export {
50
- X as useCalendar
15
+ g as useInputPadding
51
16
  };
@@ -1,16 +1,5 @@
1
- import { useRef as f, useLayoutEffect as u, useEffect as s } from "react";
2
- const o = (t, r) => {
3
- const e = f(!1);
4
- u(() => {
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 { __require as r } from "./bundle.es69.js";
2
+ var o = /* @__PURE__ */ r();
14
3
  export {
15
- o as useEffectWithLayout
4
+ o as f
16
5
  };
@@ -1,4 +1,4 @@
1
- import { __require as r } from "./bundle.es69.js";
1
+ import { __require as r } from "./bundle.es71.js";
2
2
  var o = /* @__PURE__ */ r();
3
3
  export {
4
4
  o as f
@@ -1,5 +1,16 @@
1
- import { __require as r } from "./bundle.es71.js";
2
- var o = /* @__PURE__ */ r();
1
+ import { useRef as f, useLayoutEffect as u, useEffect as s } from "react";
2
+ const o = (t, r) => {
3
+ const e = f(!1);
4
+ u(() => {
5
+ e.current = !0, t();
6
+ }, []), s(() => {
7
+ if (e.current) {
8
+ e.current = !1;
9
+ return;
10
+ }
11
+ t();
12
+ }, r);
13
+ };
3
14
  export {
4
- o as f
15
+ o as useEffectWithLayout
5
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companix/uikit",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "module": "./dist/bundle.es.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",