@companix/uikit 0.1.14 → 0.1.16

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 (85) hide show
  1. package/dist/DrawerMobile/MobileDrawer.scss +71 -0
  2. package/dist/DrawerMobile/constants.d.ts +9 -0
  3. package/dist/DrawerMobile/context.d.ts +18 -0
  4. package/dist/DrawerMobile/helpers.d.ts +13 -0
  5. package/dist/DrawerMobile/index.d.ts +17 -0
  6. package/dist/DrawerMobile/types.d.ts +5 -0
  7. package/dist/DrawerMobile/use-prevent-scroll.d.ts +5 -0
  8. package/dist/Popup/index.d.ts +4 -2
  9. package/dist/Scrollable/Scrollable.scss +0 -5
  10. package/dist/__helpers/createPopupRegistry.d.ts +4 -0
  11. package/dist/bundle.es.js +112 -109
  12. package/dist/bundle.es10.js +1 -1
  13. package/dist/bundle.es13.js +4 -4
  14. package/dist/bundle.es14.js +4 -4
  15. package/dist/bundle.es15.js +2 -2
  16. package/dist/bundle.es16.js +1 -1
  17. package/dist/bundle.es17.js +1 -1
  18. package/dist/bundle.es19.js +1 -1
  19. package/dist/bundle.es22.js +1 -1
  20. package/dist/bundle.es23.js +260 -13
  21. package/dist/bundle.es24.js +14 -21
  22. package/dist/bundle.es25.js +20 -37
  23. package/dist/bundle.es26.js +38 -21
  24. package/dist/bundle.es27.js +20 -18
  25. package/dist/bundle.es28.js +18 -20
  26. package/dist/bundle.es29.js +20 -43
  27. package/dist/bundle.es30.js +37 -114
  28. package/dist/bundle.es31.js +119 -72
  29. package/dist/bundle.es32.js +68 -38
  30. package/dist/bundle.es33.js +42 -10
  31. package/dist/bundle.es34.js +11 -85
  32. package/dist/bundle.es35.js +85 -19
  33. package/dist/bundle.es36.js +20 -7
  34. package/dist/bundle.es37.js +7 -3
  35. package/dist/bundle.es38.js +3 -23
  36. package/dist/bundle.es39.js +16 -45
  37. package/dist/bundle.es40.js +51 -56
  38. package/dist/bundle.es41.js +57 -162
  39. package/dist/bundle.es42.js +160 -79
  40. package/dist/bundle.es43.js +81 -7
  41. package/dist/bundle.es44.js +7 -35
  42. package/dist/bundle.es45.js +33 -20
  43. package/dist/bundle.es46.js +19 -47
  44. package/dist/bundle.es47.js +49 -11
  45. package/dist/bundle.es48.js +11 -13
  46. package/dist/bundle.es49.js +13 -13
  47. package/dist/bundle.es50.js +13 -30
  48. package/dist/bundle.es51.js +29 -25
  49. package/dist/bundle.es52.js +17 -29
  50. package/dist/bundle.es53.js +36 -48
  51. package/dist/bundle.es54.js +49 -50
  52. package/dist/bundle.es55.js +56 -8
  53. package/dist/bundle.es56.js +8 -26
  54. package/dist/bundle.es57.js +27 -5
  55. package/dist/bundle.es58.js +5 -66
  56. package/dist/bundle.es59.js +66 -23
  57. package/dist/bundle.es60.js +22 -23
  58. package/dist/bundle.es61.js +24 -88
  59. package/dist/bundle.es62.js +88 -18
  60. package/dist/bundle.es63.js +17 -92
  61. package/dist/bundle.es64.js +92 -73
  62. package/dist/bundle.es65.js +73 -23
  63. package/dist/bundle.es66.js +20 -35
  64. package/dist/bundle.es67.js +37 -68
  65. package/dist/bundle.es68.js +23 -10
  66. package/dist/bundle.es69.js +78 -42
  67. package/dist/bundle.es70.js +93 -33
  68. package/dist/bundle.es71.js +10 -66
  69. package/dist/bundle.es72.js +69 -40
  70. package/dist/bundle.es73.js +10 -14
  71. package/dist/bundle.es74.js +43 -32
  72. package/dist/bundle.es75.js +32 -69
  73. package/dist/bundle.es76.js +64 -12
  74. package/dist/bundle.es77.js +41 -75
  75. package/dist/bundle.es78.js +14 -48
  76. package/dist/bundle.es79.js +32 -14
  77. package/dist/bundle.es80.js +72 -0
  78. package/dist/bundle.es81.js +77 -0
  79. package/dist/bundle.es82.js +51 -0
  80. package/dist/bundle.es83.js +16 -0
  81. package/dist/bundle.es84.js +16 -0
  82. package/dist/bundle.es9.js +1 -1
  83. package/dist/index.d.ts +3 -1
  84. package/dist/index.scss +1 -0
  85. package/package.json +1 -1
@@ -0,0 +1,72 @@
1
+ import { jsxs as y, jsx as I } from "react/jsx-runtime";
2
+ import { forwardRef as $, useState as b, useMemo as C, useImperativeHandle as w, useCallback as P, createElement as j } from "react";
3
+ import * as c from "@radix-ui/react-toast";
4
+ import { customCSS as k } from "@companix/utils-browser";
5
+ import { Toast as E } from "./bundle.es54.js";
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, h) => {
8
+ const { side: l = "top", align: f = "center", gap: d = 14, duration: g, swipeThreshold: x, closeIcon: T } = r, [i, p] = b([]), a = C(() => ({}), []);
9
+ w(
10
+ h,
11
+ () => ({
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;
16
+ });
17
+ }
18
+ }),
19
+ []
20
+ );
21
+ const m = P((t) => {
22
+ t.forEach(({ id: o }, e) => {
23
+ let n = 0;
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`);
27
+ });
28
+ }, []), v = (t) => {
29
+ p((o) => {
30
+ const e = [...o], n = e.findIndex((s) => s.id === t);
31
+ return n !== -1 && e.splice(n, 1), e;
32
+ });
33
+ };
34
+ return /* @__PURE__ */ y(
35
+ c.Provider,
36
+ {
37
+ swipeThreshold: x,
38
+ swipeDirection: u[`${l}-${f}`],
39
+ children: [
40
+ i.map(({ id: t, ...o }) => /* @__PURE__ */ j(
41
+ E,
42
+ {
43
+ ...o,
44
+ id: t,
45
+ key: `toaster-${t}`,
46
+ duration: o.duration ?? g,
47
+ closeIcon: T,
48
+ onInitialized: (e) => {
49
+ a[t] = e, m(i);
50
+ },
51
+ onClosing: () => {
52
+ delete a[t], m(i);
53
+ },
54
+ onClosed: () => v(t)
55
+ }
56
+ )),
57
+ /* @__PURE__ */ I(
58
+ c.Viewport,
59
+ {
60
+ "data-side": l,
61
+ "data-align": f,
62
+ className: "toaster-viewport",
63
+ style: k({ "--toasters-gap": `${d}px` })
64
+ }
65
+ )
66
+ ]
67
+ }
68
+ );
69
+ });
70
+ export {
71
+ M as Viewport
72
+ };
@@ -0,0 +1,77 @@
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.es13.js";
4
+ import { getMonths as k, getYears as z, DEFAULT_MAX_YEAR as f, DEFAULT_MIN_YEAR as g } from "./bundle.es65.js";
5
+ import { Icon as C } from "./bundle.es36.js";
6
+ import { faChevronLeft as E, faChevronRight as T } from "@companix/icons-solid";
7
+ import { setMonth as _, setYear as F } from "./bundle.es59.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
+ ] });
74
+ };
75
+ export {
76
+ y as CalendarHeader
77
+ };
@@ -0,0 +1,51 @@
1
+ import { subMonths as L, addMonths as N, useDayDisableCheker as R } from "./bundle.es59.js";
2
+ import { DEFAULT_MIN_YEAR as w, DEFAULT_MAX_YEAR as A } from "./bundle.es65.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, 1));
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
+ };
49
+ export {
50
+ X as useCalendar
51
+ };
@@ -0,0 +1,16 @@
1
+ import { useRef as l, useCallback as p } from "react";
2
+ import { useEffectWithLayout as d } from "./bundle.es84.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 };
13
+ };
14
+ export {
15
+ g as useInputPadding
16
+ };
@@ -0,0 +1,16 @@
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
+ };
14
+ export {
15
+ o as useEffectWithLayout
16
+ };
@@ -59,7 +59,7 @@ const C = ({
59
59
  /* @__PURE__ */ c(
60
60
  "div",
61
61
  {
62
- className: L("hidden-scroll", g),
62
+ className: L("hidden-scroll overflow-y-scroll h-full", g),
63
63
  onScroll: M,
64
64
  ref: t,
65
65
  children: b
package/dist/index.d.ts CHANGED
@@ -38,6 +38,8 @@ export { Radio, RadioGroup } from './Radio';
38
38
  export type { RadioOption, RadioGroupProps } from './Radio';
39
39
  export { Drawer } from './Drawer';
40
40
  export type { DrawerProps } from './Drawer';
41
+ export { MobileDrawer } from './DrawerMobile';
42
+ export type { MobileDrawerProps } from './DrawerMobile';
41
43
  export { Dialog } from './Dialog';
42
44
  export type { DialogProps, DialogSize } from './Dialog';
43
45
  export { PopupLayout } from './Popup';
@@ -93,7 +95,7 @@ export { Toast } from './Toaster/Toast';
93
95
  export * from './types';
94
96
  export type { CalendarProps } from './Calendar/Calendar';
95
97
  export type { OptionsSource, UseOptionsResponse } from './Select/OptionsPopover';
96
- export { createPopupRegistry, DialogShell, DrawerShell, usePopup } from './__helpers/createPopupRegistry';
98
+ export { createPopupRegistry, DialogShell, DrawerShell, MobileDrawerShell, usePopup } from './__helpers/createPopupRegistry';
97
99
  export { createPopoversRegistry } from './__helpers/createPopoversRegistry';
98
100
  export { createScope, createStaticScope } from './__helpers/createScope';
99
101
  export type { PopupProps } from './__helpers/createPopupRegistry';
package/dist/index.scss CHANGED
@@ -11,6 +11,7 @@
11
11
  @use './Dialog/Dialog.scss';
12
12
  @use './DialogAlert/Alert.scss';
13
13
  @use './Drawer/Drawer.scss';
14
+ @use './DrawerMobile/MobileDrawer.scss';
14
15
  @use './Select/Select.scss';
15
16
  @use './TextArea/TextArea.scss';
16
17
  @use './SelectTags/SelectTags.scss';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companix/uikit",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "main": "./dist/bundle.es.js",
5
5
  "module": "./dist/bundle.es.js",
6
6
  "types": "./dist/index.d.ts",