@companix/uikit 0.0.2 → 0.0.4

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 (222) hide show
  1. package/dist/Button/index.d.ts +20 -0
  2. package/dist/ButtonGroup/index.d.ts +7 -0
  3. package/dist/Checkbox/index.d.ts +10 -0
  4. package/dist/Countdown/index.d.ts +7 -0
  5. package/dist/DateInput/index.d.ts +13 -0
  6. package/dist/DatePicker/Calendar.d.ts +14 -0
  7. package/dist/DatePicker/CalendarHeader.d.ts +10 -0
  8. package/dist/DatePicker/index.d.ts +12 -0
  9. package/dist/Dialog/index.d.ts +12 -0
  10. package/dist/DialogAlert/Alert.d.ts +19 -0
  11. package/dist/DialogAlert/Viewport.d.ts +8 -0
  12. package/dist/DialogAlert/index.d.ts +11 -0
  13. package/dist/Drawer/index.d.ts +13 -0
  14. package/dist/File/index.d.ts +10 -0
  15. package/dist/Form/index.d.ts +17 -0
  16. package/dist/Icon/index.d.ts +7 -0
  17. package/dist/LoadButton/index.d.ts +5 -0
  18. package/dist/NumberInput/index.d.ts +6 -0
  19. package/dist/OptionItem/OptionItem.d.ts +7 -0
  20. package/dist/OptionItem/OptionsList.d.ts +8 -0
  21. package/dist/Popover/index.d.ts +26 -0
  22. package/dist/Radio/index.d.ts +20 -0
  23. package/dist/Scrollable/ImitateScroll.d.ts +10 -0
  24. package/dist/Scrollable/index.d.ts +33 -0
  25. package/dist/Select/SelectInput.d.ts +14 -0
  26. package/dist/Select/index.d.ts +15 -0
  27. package/dist/SelectTags/index.d.ts +15 -0
  28. package/dist/Spinner/index.d.ts +8 -0
  29. package/dist/Stepper/index.d.ts +8 -0
  30. package/dist/Switch/index.d.ts +10 -0
  31. package/dist/Tabs/index.d.ts +13 -0
  32. package/dist/TextArea/index.d.ts +7 -0
  33. package/dist/Toaster/RemoveListener.d.ts +3 -0
  34. package/dist/Toaster/Toast.d.ts +9 -0
  35. package/dist/Toaster/Viewport.d.ts +13 -0
  36. package/dist/Toaster/index.d.ts +15 -0
  37. package/dist/Tooltip/index.d.ts +8 -0
  38. package/dist/__hooks/use-frooze-closing.d.ts +5 -0
  39. package/dist/__hooks/use-loading.d.ts +8 -0
  40. package/dist/__hooks/use-local-storage.d.ts +1 -0
  41. package/dist/__hooks/use-popover-position.d.ts +8 -0
  42. package/dist/__hooks/use-previos.d.ts +2 -0
  43. package/dist/__hooks/use-resize.d.ts +3 -0
  44. package/dist/__hooks/use-scrollbox.d.ts +7 -0
  45. package/dist/__hooks/use-stepper-input.d.ts +13 -0
  46. package/dist/__hooks/use-update.d.ts +1 -0
  47. package/dist/__hooks/useCalendar.d.ts +17 -0
  48. package/dist/__hooks/useCalendarOptions-copy.d.ts +22 -0
  49. package/dist/__hooks/useCalendarOptions.d.ts +31 -0
  50. package/dist/__libs/calendar.d.ts +25 -0
  51. package/dist/__utils/utils.d.ts +25 -0
  52. package/dist/bundle.es.js +58 -0
  53. package/dist/bundle.es10.js +38 -0
  54. package/dist/bundle.es11.js +33 -0
  55. package/dist/bundle.es12.js +18 -0
  56. package/dist/bundle.es13.js +10 -0
  57. package/dist/bundle.es14.js +35 -0
  58. package/dist/bundle.es15.js +27 -0
  59. package/dist/bundle.es16.js +23 -0
  60. package/dist/bundle.es17.js +24 -0
  61. package/dist/bundle.es18.js +15 -0
  62. package/dist/bundle.es19.js +40 -0
  63. package/dist/bundle.es2.js +45 -0
  64. package/dist/bundle.es20.js +18 -0
  65. package/dist/bundle.es21.js +36 -0
  66. package/dist/bundle.es22.js +23 -0
  67. package/dist/bundle.es23.js +42 -0
  68. package/dist/bundle.es24.js +113 -0
  69. package/dist/bundle.es25.js +114 -0
  70. package/dist/bundle.es26.js +38 -0
  71. package/dist/bundle.es27.js +13 -0
  72. package/dist/bundle.es28.js +27 -0
  73. package/dist/bundle.es29.js +38 -0
  74. package/dist/bundle.es3.js +13 -0
  75. package/dist/bundle.es30.js +26 -0
  76. package/dist/bundle.es31.js +83 -0
  77. package/dist/bundle.es32.js +20 -0
  78. package/dist/bundle.es33.js +16 -0
  79. package/dist/bundle.es34.js +24 -0
  80. package/dist/bundle.es35.js +7 -0
  81. package/dist/bundle.es36.js +23 -0
  82. package/dist/bundle.es37.js +16 -0
  83. package/dist/bundle.es38.js +72 -0
  84. package/dist/bundle.es39.js +70 -0
  85. package/dist/bundle.es4.js +87 -0
  86. package/dist/bundle.es40.js +34 -0
  87. package/dist/bundle.es41.js +70 -0
  88. package/dist/bundle.es42.js +33 -0
  89. package/dist/bundle.es43.js +77 -0
  90. package/dist/bundle.es44.js +51 -0
  91. package/dist/bundle.es45.js +45 -0
  92. package/dist/bundle.es5.js +87 -0
  93. package/dist/bundle.es6.js +80 -0
  94. package/dist/bundle.es7.js +28 -0
  95. package/dist/bundle.es8.js +87 -0
  96. package/dist/bundle.es9.js +75 -0
  97. package/dist/index.d.ts +30 -0
  98. package/{src → dist}/index.scss +3 -0
  99. package/{src → dist}/mixins.scss +4 -3
  100. package/{src → dist}/theme.scss +0 -2
  101. package/dist/types.d.ts +13 -0
  102. package/package.json +10 -6
  103. package/.eslintrc +0 -54
  104. package/declaration.d.ts +0 -4
  105. package/index.html +0 -12
  106. package/playground/App.tsx +0 -166
  107. package/playground/Example.tsx +0 -14
  108. package/playground/Test.tsx +0 -44
  109. package/playground/animation-test-1/index.scss +0 -20
  110. package/playground/animation-test-1/index.tsx +0 -17
  111. package/playground/animation-test-2/index.scss +0 -62
  112. package/playground/animation-test-2/index.tsx +0 -32
  113. package/playground/bootstrap.tsx +0 -19
  114. package/playground/buttons/index.tsx +0 -132
  115. package/playground/checkbox/index.tsx +0 -64
  116. package/playground/date-input/index.tsx +0 -45
  117. package/playground/date-picker/index.tsx +0 -41
  118. package/playground/dialog/index.tsx +0 -92
  119. package/playground/dialog-alert/index.tsx +0 -47
  120. package/playground/drawer/index.tsx +0 -55
  121. package/playground/index.css +0 -33
  122. package/playground/index.scss +0 -270
  123. package/playground/input/index.tsx +0 -112
  124. package/playground/number-inputs/index.tsx +0 -50
  125. package/playground/popovers/index.tsx +0 -70
  126. package/playground/radio-group/index.tsx +0 -69
  127. package/playground/select/index.tsx +0 -72
  128. package/playground/select-tags/index.tsx +0 -36
  129. package/playground/styles.scss +0 -2
  130. package/playground/switch/index.tsx +0 -44
  131. package/playground/tabs/index.tsx +0 -16
  132. package/playground/test.scss +0 -0
  133. package/playground/text-area/index.tsx +0 -17
  134. package/playground/text-input/index.tsx +0 -12
  135. package/playground/toaster/index.tsx +0 -156
  136. package/playground/tooltip/index.tsx +0 -26
  137. package/src/Button/index.tsx +0 -72
  138. package/src/ButtonGroup/index.tsx +0 -20
  139. package/src/Checkbox/index.tsx +0 -46
  140. package/src/Countdown/index.tsx +0 -54
  141. package/src/DateInput/index.tsx +0 -96
  142. package/src/DatePicker/Calendar.tsx +0 -157
  143. package/src/DatePicker/CalendarHeader.tsx +0 -139
  144. package/src/DatePicker/index.tsx +0 -177
  145. package/src/Dialog/index.tsx +0 -31
  146. package/src/DialogAlert/Alert.tsx +0 -78
  147. package/src/DialogAlert/Viewport.tsx +0 -52
  148. package/src/DialogAlert/index.tsx +0 -37
  149. package/src/Drawer/index.tsx +0 -46
  150. package/src/File/index.tsx +0 -60
  151. package/src/Form/index.tsx +0 -131
  152. package/src/Icon/index.tsx +0 -43
  153. package/src/LoadButton/index.tsx +0 -17
  154. package/src/NumberInput/index.tsx +0 -74
  155. package/src/OptionItem/OptionItem.tsx +0 -49
  156. package/src/OptionItem/OptionsList.tsx +0 -26
  157. package/src/Popover/index.tsx +0 -117
  158. package/src/Radio/index.tsx +0 -68
  159. package/src/Scrollable/ImitateScroll.tsx +0 -141
  160. package/src/Scrollable/index.tsx +0 -141
  161. package/src/Select/SelectInput.tsx +0 -131
  162. package/src/Select/index.tsx +0 -134
  163. package/src/SelectTags/index.tsx +0 -192
  164. package/src/Spinner/index.tsx +0 -19
  165. package/src/Stepper/index.tsx +0 -76
  166. package/src/Switch/index.tsx +0 -49
  167. package/src/Tabs/index.tsx +0 -89
  168. package/src/TextArea/index.tsx +0 -51
  169. package/src/Toaster/RemoveListener.tsx +0 -11
  170. package/src/Toaster/Toast.tsx +0 -69
  171. package/src/Toaster/Viewport.tsx +0 -117
  172. package/src/Toaster/index.tsx +0 -52
  173. package/src/Tooltip/index.tsx +0 -33
  174. package/src/__hooks/use-frooze-closing.ts +0 -51
  175. package/src/__hooks/use-loading.ts +0 -34
  176. package/src/__hooks/use-local-storage.ts +0 -19
  177. package/src/__hooks/use-popover-position.ts +0 -24
  178. package/src/__hooks/use-previos.ts +0 -25
  179. package/src/__hooks/use-resize.ts +0 -41
  180. package/src/__hooks/use-scrollbox.ts +0 -45
  181. package/src/__hooks/use-stepper-input.ts +0 -82
  182. package/src/__hooks/use-update.ts +0 -19
  183. package/src/__hooks/useCalendar.ts +0 -104
  184. package/src/__hooks/useCalendarOptions-copy.ts +0 -87
  185. package/src/__hooks/useCalendarOptions.ts +0 -68
  186. package/src/__libs/calendar.ts +0 -175
  187. package/src/__utils/utils.ts +0 -137
  188. package/src/index.ts +0 -36
  189. package/src/types.ts +0 -14
  190. package/tailwind.config.js +0 -91
  191. package/themes/classic/animations.scss +0 -179
  192. package/themes/classic/classic.scss +0 -493
  193. package/tsconfig.json +0 -27
  194. package/vite.build.ts +0 -35
  195. package/vite.config.ts +0 -33
  196. /package/{src → dist}/Button/Button.scss +0 -0
  197. /package/{src → dist}/ButtonGroup/ButtonGroup.scss +0 -0
  198. /package/{src → dist}/Checkbox/Checkbox.scss +0 -0
  199. /package/{src → dist}/DateInput/DateInput.scss +0 -0
  200. /package/{src → dist}/DatePicker/Calendar.scss +0 -0
  201. /package/{src → dist}/DatePicker/DatePicker.scss +0 -0
  202. /package/{src → dist}/Dialog/Dialog.scss +0 -0
  203. /package/{src → dist}/Dialog/Popup.scss +0 -0
  204. /package/{src → dist}/DialogAlert/Alert.scss +0 -0
  205. /package/{src → dist}/Drawer/Drawer.scss +0 -0
  206. /package/{src → dist}/Form/Form.scss +0 -0
  207. /package/{src → dist}/Form/Input.scss +0 -0
  208. /package/{src → dist}/Icon/icon.scss +0 -0
  209. /package/{src → dist}/OptionItem/Option.scss +0 -0
  210. /package/{src → dist}/Popover/Popover.scss +0 -0
  211. /package/{src → dist}/Radio/Radio.scss +0 -0
  212. /package/{src → dist}/Scrollable/Scrollable.scss +0 -0
  213. /package/{src → dist}/Select/Select.scss +0 -0
  214. /package/{src → dist}/SelectTags/SelectTags.scss +0 -0
  215. /package/{src → dist}/Spinner/Spinner.scss +0 -0
  216. /package/{src → dist}/Stepper/StepperInput.scss +0 -0
  217. /package/{src → dist}/Switch/Switch.scss +0 -0
  218. /package/{src → dist}/Tabs/Tabs.scss +0 -0
  219. /package/{src → dist}/TextArea/TextArea.scss +0 -0
  220. /package/{src → dist}/Toaster/Toaster.scss +0 -0
  221. /package/{src → dist}/Tooltip/Tooltip.scss +0 -0
  222. /package/{src/css.scss → dist/css-properties.scss} +0 -0
@@ -0,0 +1,70 @@
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]);
58
+ };
59
+ export {
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
70
+ };
@@ -0,0 +1,87 @@
1
+ import { jsx as v } from "react/jsx-runtime";
2
+ import I from "classnames";
3
+ import { forwardRef as S } from "react";
4
+ import { varToStyle as r, px as i } from "@companix/utils-browser";
5
+ const $ = S((t, c) => {
6
+ let {
7
+ interactionKind: m = "static",
8
+ thumbPos: g = "center",
9
+ thumbPadding: l = 4,
10
+ heightAuto: s,
11
+ scrollX: h,
12
+ className: b,
13
+ scrollY: n,
14
+ onWheel: f,
15
+ maxHeight: d,
16
+ onScroll: p,
17
+ thumbColor: u,
18
+ children: w
19
+ } = t;
20
+ const x = (() => {
21
+ if (t.implementation === "edge") {
22
+ l = 0;
23
+ const { padding: o, scrollbarWidth: e } = t;
24
+ return {
25
+ ...r({ "--scrollbar-width": i(e) }),
26
+ padding: `0px ${o - e}px 0px ${o}px`
27
+ };
28
+ }
29
+ if (t.implementation === "outer") {
30
+ const { shadowPadding: o = 0, noneCorrect: e, scrollbarWidth: a } = t;
31
+ return window.IS_MOBILE ? {
32
+ padding: o,
33
+ margin: -o
34
+ } : {
35
+ ...r({ "--scrollbar-width": i(a) }),
36
+ padding: o,
37
+ margin: -o,
38
+ marginRight: e ? void 0 : `calc(-${a}px - ${o}px)`,
39
+ marginBottom: 0
40
+ };
41
+ }
42
+ if (t.implementation === "inner") {
43
+ const { padding: o } = t;
44
+ return window.IS_MOBILE ? {
45
+ [n ? "paddingLeft" : "paddingTop"]: o,
46
+ [n ? "paddingRight" : "paddingBottom"]: o
47
+ } : {
48
+ [n ? "paddingLeft" : "paddingTop"]: o,
49
+ ...r({ "--scrollbar-width": i(o) })
50
+ };
51
+ }
52
+ return {};
53
+ })();
54
+ return /* @__PURE__ */ v(
55
+ "div",
56
+ {
57
+ ref: c,
58
+ onWheel: f,
59
+ onScroll: p,
60
+ onMouseDown: (o) => {
61
+ o.preventDefault();
62
+ },
63
+ style: {
64
+ ...x,
65
+ ...t.style,
66
+ maxHeight: d ? i(d) : void 0,
67
+ ...r({ "--thumb-padding": i(l) }),
68
+ ...r({ "--thumb-color": u ?? "#c1c2c8bd" })
69
+ },
70
+ className: I(
71
+ !window.IS_MOBILE && "scrollable",
72
+ b,
73
+ s ? "" : "h-full",
74
+ {
75
+ "overflow-y-scroll": n,
76
+ "overflow-x-scroll": h,
77
+ "scrollable-hover-interaction": m === "hover",
78
+ "scrollable-border-position": g === "border"
79
+ }
80
+ ),
81
+ children: w
82
+ }
83
+ );
84
+ });
85
+ export {
86
+ $ as Scrollable
87
+ };
@@ -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.es45.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
+ };
@@ -0,0 +1,33 @@
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;
21
+ };
22
+ 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
33
+ };
@@ -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.es8.js";
4
+ import { getMonths as k, getYears as z, DEFAULT_MAX_YEAR as f, DEFAULT_MIN_YEAR as g } from "./bundle.es42.js";
5
+ import { Icon as C } from "./bundle.es34.js";
6
+ import { faChevronLeft as E, faChevronRight as T } from "@fortawesome/free-solid-svg-icons";
7
+ import { setMonth as _, setYear as F } from "./bundle.es39.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 || 0)
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 || 0)
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.es39.js";
2
+ import { DEFAULT_MIN_YEAR as w, DEFAULT_MAX_YEAR as A } from "./bundle.es42.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
+ };
49
+ export {
50
+ X as useCalendar
51
+ };
@@ -0,0 +1,45 @@
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.es35.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,
24
+ {
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
+ ]
40
+ }
41
+ );
42
+ };
43
+ export {
44
+ E as Toast
45
+ };
@@ -0,0 +1,87 @@
1
+ import { jsxs as x, jsx as c } from "react/jsx-runtime";
2
+ import L from "classnames";
3
+ import { useRef as d, useMemo as f, useCallback as n, useEffect as T, useLayoutEffect as H } from "react";
4
+ import { getContainers as p, pc as h, px as v } from "@companix/utils-browser";
5
+ const C = ({
6
+ children: b,
7
+ thumbClassName: y,
8
+ scrollableClassName: g,
9
+ thumbMargin: R = 0,
10
+ trackWidth: w = 20
11
+ }) => {
12
+ const l = d(null), t = d(null), r = f(() => ({ positons: { top: 0, y: 0 }, scrollRatio: 0 }), []), i = f(() => ({
13
+ start() {
14
+ document.addEventListener("mousemove", a), document.addEventListener("mouseup", m);
15
+ },
16
+ clear() {
17
+ document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", m);
18
+ }
19
+ }), []);
20
+ T(() => {
21
+ const o = new ResizeObserver(u);
22
+ return t.current && p(t.current, (e) => {
23
+ o.observe(e);
24
+ }), () => {
25
+ t.current && p(t.current, (e) => {
26
+ o.unobserve(e);
27
+ });
28
+ };
29
+ }, []), H(() => {
30
+ u();
31
+ }, []);
32
+ const u = n(() => {
33
+ const { current: o } = t, { current: e } = l;
34
+ if (e && o) {
35
+ const s = o.clientHeight / o.scrollHeight;
36
+ e.style.height = h(s * 100), e.style.display = s === 1 ? "none" : "block", r.scrollRatio = s;
37
+ }
38
+ }, []), a = n(({ clientY: o }) => {
39
+ const { current: e } = t;
40
+ if (e) {
41
+ const s = o - r.positons.y;
42
+ e.scrollTop = r.positons.top + s / r.scrollRatio;
43
+ }
44
+ }, []), m = n(() => {
45
+ i.clear();
46
+ }, []), E = n(({ clientY: o }) => {
47
+ const { current: e } = t;
48
+ e && (r.positons = {
49
+ top: e.scrollTop,
50
+ y: o
51
+ }), i.start();
52
+ }, []), M = () => {
53
+ requestAnimationFrame(() => {
54
+ const { current: o } = t, { current: e } = l;
55
+ e && o && (e.style.top = h(o.scrollTop * 100 / o.scrollHeight));
56
+ });
57
+ };
58
+ return /* @__PURE__ */ x("div", { className: "relative h-full overflow-hidden", children: [
59
+ /* @__PURE__ */ c(
60
+ "div",
61
+ {
62
+ className: L("hidden-scroll h-full overflow-y-scroll", g),
63
+ onScroll: M,
64
+ ref: t,
65
+ children: b
66
+ }
67
+ ),
68
+ /* @__PURE__ */ c(
69
+ "div",
70
+ {
71
+ className: "absolute right-0 top-0 box-border h-full",
72
+ style: { width: v(w), padding: v(R) },
73
+ children: /* @__PURE__ */ c(
74
+ "div",
75
+ {
76
+ onMouseDown: E,
77
+ className: `${y} relative w-full rounded-full`,
78
+ ref: l
79
+ }
80
+ )
81
+ }
82
+ )
83
+ ] });
84
+ };
85
+ export {
86
+ C as ImitateScroll
87
+ };
@@ -0,0 +1,80 @@
1
+ import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
+ import * as o from "@radix-ui/react-popover";
3
+ import { attr as y } from "@companix/utils-browser";
4
+ import B from "classnames";
5
+ import { forwardRef as M, useRef as j } from "react";
6
+ const D = M((a, i) => {
7
+ const {
8
+ children: n,
9
+ sideOffset: s,
10
+ matchTarget: l,
11
+ onAnimationEnd: c,
12
+ onAnimationStart: m,
13
+ onOpenAutoFocus: d,
14
+ onCloseAutoFocus: f,
15
+ triggerRef: p,
16
+ triggerProps: h,
17
+ open: g,
18
+ content: u,
19
+ onOpenChange: v,
20
+ align: C,
21
+ disabled: w,
22
+ minimal: x,
23
+ className: L,
24
+ fitMaxHeight: N = !0,
25
+ side: O,
26
+ showArrows: A
27
+ } = a, e = j(null), P = () => {
28
+ e.current && e.current.click();
29
+ }, b = (R) => {
30
+ w && R.preventDefault();
31
+ };
32
+ return /* @__PURE__ */ t(o.Root, { open: g, onOpenChange: v, children: [
33
+ /* @__PURE__ */ r(o.Trigger, { ref: p, ...h, onClick: b, asChild: !0, children: n }),
34
+ /* @__PURE__ */ r(o.Portal, { children: /* @__PURE__ */ t(
35
+ o.Content,
36
+ {
37
+ ref: i,
38
+ className: B("popover", L),
39
+ side: O,
40
+ align: C,
41
+ "data-appearance": x ? "minimal" : "default",
42
+ "data-match-target": l,
43
+ sideOffset: s ?? 6,
44
+ avoidCollisions: !0,
45
+ arrowPadding: 10,
46
+ onAnimationStart: m,
47
+ onAnimationEnd: c,
48
+ onOpenAutoFocus: d,
49
+ onCloseAutoFocus: f,
50
+ children: [
51
+ /* @__PURE__ */ r(o.Close, { ref: e, style: { display: "none" } }),
52
+ A && /* @__PURE__ */ r(o.Arrow, { width: 30, height: 11, asChild: !0, children: /* @__PURE__ */ r("div", { className: "popover-arrow", children: /* @__PURE__ */ t("svg", { className: "popover-arrow-icon", viewBox: "0 0 30 11", width: 30, height: 11, children: [
53
+ /* @__PURE__ */ r(
54
+ "path",
55
+ {
56
+ className: "popover-arrow-border",
57
+ d: "M 18.112 -2.704 C 19.127 -3.64 19.999 -5.626 19.999 -7.001 L 19.999 18.999 C 19.999 17.621 19.131 15.642 18.111 14.702 L 10.927 8.084 C 9.69 6.944 9.694 5.05 10.927 3.914 L 18.112 -2.704 Z",
58
+ style: { transformBox: "fill-box", transformOrigin: "50% 50%" },
59
+ transform: "matrix(0, -1, 1, 0, 0.000001, 0)"
60
+ }
61
+ ),
62
+ /* @__PURE__ */ r(
63
+ "path",
64
+ {
65
+ className: "popover-arrow-fill",
66
+ d: "M 17.789 -2.965 C 19.009 -4.09 19.999 -6.341 19.999 -7.995 L 19.999 -10.001 L 19.999 19.999 L 19.999 17.994 C 19.999 16.34 19.016 14.094 17.789 12.964 L 10.606 6.348 C 9.796 5.602 9.804 4.388 10.606 3.648 L 17.789 -2.966 L 17.789 -2.965 Z",
67
+ style: { transformBox: "fill-box", transformOrigin: "50% 50%" },
68
+ transform: "matrix(0, -1, 1, 0, 0, 0)"
69
+ }
70
+ )
71
+ ] }) }) }),
72
+ /* @__PURE__ */ r("div", { className: "popover-content", "data-fit-max-height": y(N), children: u({ close: P }) })
73
+ ]
74
+ }
75
+ ) })
76
+ ] });
77
+ });
78
+ export {
79
+ D as Popover
80
+ };
@@ -0,0 +1,28 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useState as p } from "react";
3
+ import { Popover as m } from "./bundle.es6.js";
4
+ const f = ({ children: e, content: t, side: r }) => {
5
+ const [s, o] = p(!1);
6
+ return /* @__PURE__ */ n(
7
+ m,
8
+ {
9
+ showArrows: !0,
10
+ className: "tooltip",
11
+ open: s,
12
+ side: r,
13
+ content: () => t,
14
+ triggerProps: {
15
+ onMouseEnter: () => {
16
+ o(!0);
17
+ },
18
+ onMouseLeave: () => {
19
+ o(!1);
20
+ }
21
+ },
22
+ children: e
23
+ }
24
+ );
25
+ };
26
+ export {
27
+ f as Tooltip
28
+ };