@companix/uikit 0.0.36 → 0.0.38

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 (167) hide show
  1. package/dist/Avatar/Avatar.scss +64 -0
  2. package/dist/Avatar/helpers.d.ts +10 -0
  3. package/dist/Avatar/index.d.ts +8 -0
  4. package/dist/Avatar/types.d.ts +2 -0
  5. package/dist/Button/Button.scss +128 -0
  6. package/dist/Button/index.d.ts +21 -0
  7. package/dist/ButtonGroup/ButtonGroup.scss +18 -0
  8. package/dist/ButtonGroup/index.d.ts +6 -0
  9. package/dist/Calendar/Calendar.d.ts +14 -0
  10. package/dist/Calendar/Calendar.scss +125 -0
  11. package/dist/Calendar/CalendarHeader.d.ts +10 -0
  12. package/dist/Checkbox/Checkbox.scss +115 -0
  13. package/dist/Checkbox/index.d.ts +10 -0
  14. package/dist/Countdown/index.d.ts +6 -0
  15. package/dist/DateInput/DateInput.scss +11 -0
  16. package/dist/DateInput/index.d.ts +13 -0
  17. package/dist/DatePicker/index.d.ts +9 -0
  18. package/dist/Dialog/Dialog.scss +25 -0
  19. package/dist/Dialog/Popup.scss +55 -0
  20. package/dist/Dialog/index.d.ts +16 -0
  21. package/dist/DialogAlert/Alert.d.ts +19 -0
  22. package/dist/DialogAlert/Alert.scss +52 -0
  23. package/dist/DialogAlert/Viewport.d.ts +8 -0
  24. package/dist/DialogAlert/index.d.ts +11 -0
  25. package/dist/Drawer/Drawer.scss +112 -0
  26. package/dist/Drawer/index.d.ts +13 -0
  27. package/dist/File/index.d.ts +10 -0
  28. package/dist/FormGroup/FormGroup.scss +32 -0
  29. package/dist/FormGroup/index.d.ts +9 -0
  30. package/dist/Icon/icon.scss +18 -0
  31. package/dist/Icon/index.d.ts +7 -0
  32. package/dist/Input/Form.scss +67 -0
  33. package/dist/Input/InlineInput.d.ts +0 -0
  34. package/dist/Input/Input.d.ts +14 -0
  35. package/dist/Input/Input.scss +47 -0
  36. package/dist/Input/InputContainer.d.ts +11 -0
  37. package/dist/Input/InputElement.d.ts +9 -0
  38. package/dist/LoadingButton/index.d.ts +5 -0
  39. package/dist/NumberInput/index.d.ts +23 -0
  40. package/dist/OptionItem/Option.scss +89 -0
  41. package/dist/OptionItem/OptionItem.d.ts +6 -0
  42. package/dist/OptionItem/OptionsList.d.ts +7 -0
  43. package/dist/Popover/Popover.scss +80 -0
  44. package/dist/Popover/index.d.ts +27 -0
  45. package/dist/Progress/Progress.scss +47 -0
  46. package/dist/Progress/index.d.ts +5 -0
  47. package/dist/Radio/Radio.scss +148 -0
  48. package/dist/Radio/index.d.ts +20 -0
  49. package/dist/Scrollable/ImitateScroll.d.ts +10 -0
  50. package/dist/Scrollable/Scrollable.scss +50 -0
  51. package/dist/Scrollable/index.d.ts +33 -0
  52. package/dist/Segments/Segments.scss +57 -0
  53. package/dist/Segments/index.d.ts +11 -0
  54. package/dist/Select/Select.scss +80 -0
  55. package/dist/Select/SelectInput.d.ts +15 -0
  56. package/dist/Select/SelectOptions.d.ts +12 -0
  57. package/dist/Select/SelectRight.d.ts +8 -0
  58. package/dist/Select/index.d.ts +24 -0
  59. package/dist/SelectTags/SelectTags.scss +67 -0
  60. package/dist/SelectTags/index.d.ts +17 -0
  61. package/dist/Spinner/Spinner.scss +14 -0
  62. package/dist/Spinner/index.d.ts +7 -0
  63. package/dist/Switch/Switch.scss +102 -0
  64. package/dist/Switch/index.d.ts +10 -0
  65. package/dist/Tabs/Tabs.scss +58 -0
  66. package/dist/Tabs/index.d.ts +13 -0
  67. package/dist/TextArea/TextArea.scss +34 -0
  68. package/dist/TextArea/index.d.ts +7 -0
  69. package/dist/ThemeProvider/helpers.d.ts +4 -0
  70. package/dist/ThemeProvider/index.d.ts +12 -0
  71. package/dist/ThemeProvider/script.d.ts +8 -0
  72. package/dist/ThemeProvider/types.d.ts +2 -0
  73. package/dist/TimePicker/index.d.ts +10 -0
  74. package/dist/Toaster/Toast.d.ts +15 -0
  75. package/dist/Toaster/Toaster.scss +155 -0
  76. package/dist/Toaster/Viewport.d.ts +13 -0
  77. package/dist/Toaster/index.d.ts +20 -0
  78. package/dist/Tooltip/Tooltip.scss +28 -0
  79. package/dist/Tooltip/index.d.ts +7 -0
  80. package/dist/__helpers/createDialogRegistry.d.ts +26 -0
  81. package/dist/__helpers/createPopoversRegistry.d.ts +19 -0
  82. package/dist/__hooks/use-frooze-closing.d.ts +5 -0
  83. package/dist/__hooks/use-input-padding.d.ts +5 -0
  84. package/dist/__hooks/use-loading.d.ts +8 -0
  85. package/dist/__hooks/use-local-storage.d.ts +1 -0
  86. package/dist/__hooks/use-popover-position.d.ts +8 -0
  87. package/dist/__hooks/use-previos.d.ts +2 -0
  88. package/dist/__hooks/use-resize.d.ts +3 -0
  89. package/dist/__hooks/use-scrollbox.d.ts +7 -0
  90. package/dist/__hooks/use-update.d.ts +1 -0
  91. package/dist/__hooks/useCalendar.d.ts +17 -0
  92. package/dist/__hooks/useCalendarOptions-copy.d.ts +22 -0
  93. package/dist/__hooks/useCalendarOptions.d.ts +31 -0
  94. package/dist/__libs/calendar.d.ts +25 -0
  95. package/dist/__utils/RemoveListener.d.ts +3 -0
  96. package/dist/__utils/utils.d.ts +39 -0
  97. package/dist/bundle.es.js +88 -0
  98. package/dist/bundle.es10.js +82 -0
  99. package/dist/bundle.es11.js +28 -0
  100. package/dist/bundle.es12.js +77 -0
  101. package/dist/bundle.es13.js +43 -0
  102. package/dist/bundle.es14.js +38 -0
  103. package/dist/bundle.es15.js +58 -0
  104. package/dist/bundle.es16.js +23 -0
  105. package/dist/bundle.es17.js +35 -0
  106. package/dist/bundle.es18.js +27 -0
  107. package/dist/bundle.es19.js +47 -0
  108. package/dist/bundle.es2.js +44 -0
  109. package/dist/bundle.es20.js +25 -0
  110. package/dist/bundle.es21.js +31 -0
  111. package/dist/bundle.es22.js +40 -0
  112. package/dist/bundle.es23.js +18 -0
  113. package/dist/bundle.es24.js +36 -0
  114. package/dist/bundle.es25.js +23 -0
  115. package/dist/bundle.es26.js +44 -0
  116. package/dist/bundle.es27.js +117 -0
  117. package/dist/bundle.es28.js +123 -0
  118. package/dist/bundle.es29.js +76 -0
  119. package/dist/bundle.es3.js +4 -0
  120. package/dist/bundle.es30.js +35 -0
  121. package/dist/bundle.es31.js +14 -0
  122. package/dist/bundle.es32.js +88 -0
  123. package/dist/bundle.es33.js +22 -0
  124. package/dist/bundle.es34.js +9 -0
  125. package/dist/bundle.es35.js +37 -0
  126. package/dist/bundle.es36.js +24 -0
  127. package/dist/bundle.es37.js +13 -0
  128. package/dist/bundle.es38.js +27 -0
  129. package/dist/bundle.es39.js +41 -0
  130. package/dist/bundle.es4.js +47 -0
  131. package/dist/bundle.es40.js +53 -0
  132. package/dist/bundle.es41.js +45 -0
  133. package/dist/bundle.es42.js +11 -0
  134. package/dist/bundle.es43.js +27 -0
  135. package/dist/bundle.es44.js +26 -0
  136. package/dist/bundle.es45.js +89 -0
  137. package/dist/bundle.es46.js +20 -0
  138. package/dist/bundle.es47.js +22 -0
  139. package/dist/bundle.es48.js +26 -0
  140. package/dist/bundle.es49.js +41 -0
  141. package/dist/bundle.es5.js +10 -0
  142. package/dist/bundle.es50.js +7 -0
  143. package/dist/bundle.es51.js +16 -0
  144. package/dist/bundle.es52.js +16 -0
  145. package/dist/bundle.es53.js +72 -0
  146. package/dist/bundle.es54.js +70 -0
  147. package/dist/bundle.es55.js +72 -0
  148. package/dist/bundle.es56.js +13 -0
  149. package/dist/bundle.es57.js +45 -0
  150. package/dist/bundle.es58.js +17 -0
  151. package/dist/bundle.es59.js +34 -0
  152. package/dist/bundle.es6.js +13 -0
  153. package/dist/bundle.es60.js +72 -0
  154. package/dist/bundle.es61.js +16 -0
  155. package/dist/bundle.es62.js +77 -0
  156. package/dist/bundle.es63.js +51 -0
  157. package/dist/bundle.es64.js +16 -0
  158. package/dist/bundle.es7.js +87 -0
  159. package/dist/bundle.es8.js +87 -0
  160. package/dist/bundle.es9.js +24 -0
  161. package/dist/css-properties.scss +120 -0
  162. package/dist/index.d.ts +77 -0
  163. package/dist/index.scss +28 -0
  164. package/dist/mixins.scss +102 -0
  165. package/dist/theme.scss +101 -0
  166. package/dist/types.d.ts +17 -0
  167. package/package.json +6 -6
@@ -0,0 +1,44 @@
1
+ import { jsxs as I, jsx as a } from "react/jsx-runtime";
2
+ import { box as g } from "@companix/utils-browser";
3
+ import { getInitialsFontSize as h } from "./bundle.es43.js";
4
+ const k = 24, y = ({
5
+ alt: n,
6
+ crossOrigin: i,
7
+ decoding: m,
8
+ loading: v,
9
+ referrerPolicy: d,
10
+ sizes: f,
11
+ size: t = k,
12
+ src: o,
13
+ srcSet: s,
14
+ useMap: N,
15
+ initials: c,
16
+ noBorder: b,
17
+ fallbackIcon: p,
18
+ children: l
19
+ }) => {
20
+ const r = o || s, x = c ? /* @__PURE__ */ a("div", { className: "avatar-initials", style: { fontSize: h(t) }, children: c }) : p, e = r ? null : x;
21
+ return /* @__PURE__ */ I("div", { className: "avatar", style: g(t), children: [
22
+ r && /* @__PURE__ */ a(
23
+ "img",
24
+ {
25
+ alt: n,
26
+ className: "avatar-image",
27
+ crossOrigin: i,
28
+ decoding: m,
29
+ loading: v,
30
+ referrerPolicy: d,
31
+ sizes: f,
32
+ src: o,
33
+ srcSet: s,
34
+ useMap: N
35
+ }
36
+ ),
37
+ e && /* @__PURE__ */ a("div", { className: "avatar-icon", children: e }),
38
+ l && /* @__PURE__ */ a("div", { className: "avatar-content", children: l }),
39
+ !b && /* @__PURE__ */ a("div", { className: "avatar-border" })
40
+ ] });
41
+ };
42
+ export {
43
+ y as Avatar
44
+ };
@@ -0,0 +1,25 @@
1
+ import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
+ import c from "classnames";
3
+ import * as r from "@radix-ui/react-dialog";
4
+ import { VisuallyHidden as i } from "@radix-ui/react-visually-hidden";
5
+ import { customCSS as d } from "@companix/utils-browser";
6
+ const p = ({ open: t, onOpenChange: l, children: a, size: s, direction: m, className: n }) => /* @__PURE__ */ e(r.Root, { open: t, onOpenChange: l, children: /* @__PURE__ */ o(r.Portal, { children: [
7
+ /* @__PURE__ */ e(r.Overlay, { className: "drawer-overlay" }),
8
+ /* @__PURE__ */ o(
9
+ r.Content,
10
+ {
11
+ style: d({ "--drawer-size": s ?? "50%" }),
12
+ className: c("drawer", n),
13
+ "data-direction": m,
14
+ children: [
15
+ /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(r.Title, {}) }),
16
+ /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(r.Description, {}) }),
17
+ a
18
+ ]
19
+ }
20
+ )
21
+ ] }) });
22
+ p.Close = r.Close;
23
+ export {
24
+ p as Drawer
25
+ };
@@ -0,0 +1,31 @@
1
+ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
+ import f from "classnames";
3
+ import * as o from "@radix-ui/react-dialog";
4
+ import { VisuallyHidden as a } from "@radix-ui/react-visually-hidden";
5
+ import { RemoveListener as v } from "./bundle.es50.js";
6
+ const g = (l) => {
7
+ const { size: n = "s", open: r, onOpenChange: s, children: c, onClosed: t, disableEsc: p, className: d } = l, m = (h) => {
8
+ p && h.preventDefault();
9
+ };
10
+ return /* @__PURE__ */ e(o.Root, { open: r, onOpenChange: s, children: /* @__PURE__ */ i(o.Portal, { children: [
11
+ /* @__PURE__ */ e(o.Overlay, { className: "popup-overlay dialog-overlay" }),
12
+ /* @__PURE__ */ e(
13
+ o.Content,
14
+ {
15
+ className: "popup-container dialog-container",
16
+ "data-size": n,
17
+ onEscapeKeyDown: m,
18
+ children: /* @__PURE__ */ i("div", { className: f("popup dialog", d), children: [
19
+ /* @__PURE__ */ e(v, { callback: t }),
20
+ /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(o.Title, {}) }),
21
+ /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(o.Description, {}) }),
22
+ c
23
+ ] })
24
+ }
25
+ )
26
+ ] }) });
27
+ };
28
+ g.Close = o.Close;
29
+ export {
30
+ g as Dialog
31
+ };
@@ -0,0 +1,40 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import * as r from "@radix-ui/react-alert-dialog";
3
+ import { Button as c } from "./bundle.es4.js";
4
+ import { RemoveListener as N } from "./bundle.es50.js";
5
+ import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
6
+ const C = ({
7
+ open: d,
8
+ defaultOpen: p,
9
+ onOpenChange: m,
10
+ onUnMounted: h,
11
+ icon: i,
12
+ title: l,
13
+ description: o,
14
+ cancelDefaultText: n,
15
+ cancel: t,
16
+ disableCancel: v,
17
+ confirm: s
18
+ }) => /* @__PURE__ */ a(r.Root, { open: d, defaultOpen: p, onOpenChange: m, children: [
19
+ /* @__PURE__ */ e(N, { callback: h }),
20
+ /* @__PURE__ */ a(r.Portal, { children: [
21
+ /* @__PURE__ */ e(r.Overlay, { className: "popup-overlay dialog-overlay" }),
22
+ /* @__PURE__ */ e(r.Content, { className: "popup-container dialog-container", children: /* @__PURE__ */ a("div", { className: "popup alert", children: [
23
+ /* @__PURE__ */ a("div", { className: "alert-body", children: [
24
+ i && /* @__PURE__ */ e("span", { className: "alert-icon", children: i }),
25
+ /* @__PURE__ */ a("div", { className: "alert-content", children: [
26
+ l && /* @__PURE__ */ e(r.Title, { className: "alert-title", children: l }),
27
+ !l && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(r.Title, {}) }),
28
+ o && /* @__PURE__ */ e(r.Description, { className: "alert-description", children: o })
29
+ ] })
30
+ ] }),
31
+ /* @__PURE__ */ a("div", { className: "alert-footer", children: [
32
+ !v && (t?.text || n) && /* @__PURE__ */ e(r.Cancel, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "neutral", ...t, text: t?.text ?? n }) }),
33
+ s?.text && /* @__PURE__ */ e(r.Action, { asChild: !0, children: /* @__PURE__ */ e(c, { appearance: "negative", ...s }) })
34
+ ] })
35
+ ] }) })
36
+ ] })
37
+ ] });
38
+ export {
39
+ C as AlertDialog
40
+ };
@@ -0,0 +1,18 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { Button as m } from "./bundle.es4.js";
3
+ import { useLoading as p } from "./bundle.es51.js";
4
+ const g = ({ onClick: o, appearance: r = "primary", ...i }) => {
5
+ const { isLoading: n, isError: t, handleClick: a } = p({ onClick: o });
6
+ return /* @__PURE__ */ e(
7
+ m,
8
+ {
9
+ appearance: t ? "negative" : r,
10
+ ...i,
11
+ loading: n,
12
+ onClick: a
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ g as LoadingButton
18
+ };
@@ -0,0 +1,36 @@
1
+ import { jsx as n, jsxs as T } from "react/jsx-runtime";
2
+ import * as c from "@radix-ui/react-tabs";
3
+ import { useRef as g, useId as p, createContext as v, useState as I, useContext as d, useEffect as R } from "react";
4
+ const l = v({ baseId: "", listRef: {} }), b = (t, e) => `radix-${t}-trigger-${e}`, y = ({ children: t, value: e, onChange: s }) => {
5
+ const r = g(null), o = p();
6
+ return /* @__PURE__ */ n(c.Root, { value: e, onValueChange: s, children: /* @__PURE__ */ n(l.Provider, { value: { baseId: o, listRef: r }, children: /* @__PURE__ */ T(c.List, { className: "tabs", ref: r, children: [
7
+ /* @__PURE__ */ n($, { value: e }),
8
+ t
9
+ ] }) }) });
10
+ }, $ = ({ value: t }) => {
11
+ const [e, s] = I({}), { baseId: r, listRef: o } = d(l);
12
+ return R(() => {
13
+ const a = { observer: null };
14
+ if (o.current) {
15
+ const f = `.tab[id="${b(r, t)}"]`, i = o.current.querySelector(f);
16
+ i != null ? (a.observer = new ResizeObserver(() => {
17
+ const { clientHeight: u, clientWidth: m, offsetLeft: h, offsetTop: x } = i;
18
+ s({
19
+ height: u,
20
+ transform: `translateX(${Math.floor(h)}px) translateY(${Math.floor(x)}px)`,
21
+ width: m
22
+ });
23
+ }), a.observer.observe(i)) : s({ display: "none" });
24
+ }
25
+ return () => {
26
+ a.observer && a.observer.disconnect();
27
+ };
28
+ }, [t]), /* @__PURE__ */ n("div", { className: "tab-indicator-container", style: e, children: /* @__PURE__ */ n("div", { className: "tab-indicator" }) });
29
+ }, C = ({ children: t, value: e, ...s }) => {
30
+ const { baseId: r } = d(l), o = b(r, e);
31
+ return /* @__PURE__ */ n(c.Trigger, { ...s, id: o, className: "tab", value: e, children: t });
32
+ };
33
+ y.Tab = C;
34
+ export {
35
+ y as Tabs
36
+ };
@@ -0,0 +1,23 @@
1
+ import { jsx as d, Fragment as p } from "react/jsx-runtime";
2
+ import { getNextCandleTime as T, sleep as S, getTimes as x } from "@companix/utils-js";
3
+ import { useRef as g, useState as v, useEffect as s } from "react";
4
+ const n = (t) => String(t).padStart(2, "0"), j = ({ expiration: t, separator: m = ":", onExpired: a }) => {
5
+ const e = g(null), [, o] = v([]);
6
+ s(() => {
7
+ const c = Date.now(), f = T(c, "1s") - c;
8
+ return e.current && clearInterval(e.current), S(f).then(() => {
9
+ o([]), e.current = setInterval(() => {
10
+ o([]);
11
+ }, 1e3);
12
+ }), () => {
13
+ e.current && clearInterval(e.current);
14
+ };
15
+ }, [t]);
16
+ const r = t - Date.now(), { hours: i, minutes: u, seconds: l } = x(r);
17
+ return s(() => {
18
+ r <= 0 && (a?.(), e.current && clearInterval(e.current));
19
+ }, [r <= 0]), /* @__PURE__ */ d(p, { children: [n(i), n(u), n(l)].join(m) });
20
+ };
21
+ export {
22
+ j as Countdown
23
+ };
@@ -0,0 +1,44 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { useResizeTextarea as x } from "./bundle.es52.js";
3
+ import { attr as e, callMultiple as u } from "@companix/utils-browser";
4
+ import { useEffect as z } from "react";
5
+ import { mergeRefs as R } from "react-merge-refs";
6
+ const q = ({
7
+ onResize: m,
8
+ grow: a = !1,
9
+ value: t,
10
+ onChange: s,
11
+ disabled: o,
12
+ required: i,
13
+ rows: l = 2,
14
+ fill: p = !1,
15
+ textAreaRef: c,
16
+ ...d
17
+ }) => {
18
+ const [n, r] = x(m, a);
19
+ return z(r, [r, t]), /* @__PURE__ */ f(
20
+ "div",
21
+ {
22
+ className: "form form-textarea",
23
+ "data-required": e(i),
24
+ "data-disabled": e(o),
25
+ "data-fill": e(p),
26
+ children: /* @__PURE__ */ f(
27
+ "textarea",
28
+ {
29
+ className: "form-input",
30
+ "data-grow": e(a),
31
+ value: t,
32
+ ref: R([c, n]),
33
+ rows: l,
34
+ disabled: o,
35
+ onChange: u(s, r),
36
+ ...d
37
+ }
38
+ )
39
+ }
40
+ );
41
+ };
42
+ export {
43
+ q as TextArea
44
+ };
@@ -0,0 +1,117 @@
1
+ import { jsx as o, jsxs as c } from "react/jsx-runtime";
2
+ import { useFroozeClosing as M } from "./bundle.es44.js";
3
+ import { Popover as j } from "./bundle.es10.js";
4
+ import { OptionItem as q } from "./bundle.es14.js";
5
+ import { OptionsList as V } from "./bundle.es16.js";
6
+ import { Icon as d } from "./bundle.es33.js";
7
+ import { useState as B, useRef as h, useMemo as g } from "react";
8
+ import { attr as v, getActiveElementByAnotherElement as H, contains as Q } from "@companix/utils-browser";
9
+ import { mergeRefs as X } from "react-merge-refs";
10
+ import { faXmark as G, faChevronDown as J } from "@companix/icons-solid";
11
+ const re = (x) => {
12
+ const {
13
+ options: r,
14
+ closeAfterSelect: C,
15
+ placeholder: N,
16
+ onChange: l,
17
+ emptyText: R = "Ничего не найдено",
18
+ readOnly: m,
19
+ size: z = "md",
20
+ value: n,
21
+ inputRef: A,
22
+ disabled: f,
23
+ required: y
24
+ } = x, [s, D] = B(""), a = h(null), b = h(null), { popoverRef: u, froozePopoverPosition: k, handleAnimationEnd: w } = M(), E = g(() => {
25
+ const e = {};
26
+ return r.forEach((t) => {
27
+ e[t.value] = t;
28
+ }), e;
29
+ }, [r]), O = (e) => n.includes(e) ? [...n] : [...n, e], P = (e) => n.filter((t) => e !== t), T = (e, t) => {
30
+ C ? (k(), l(e), t()) : l(e);
31
+ }, p = g(() => s.trim() ? r.filter(({ title: e }) => {
32
+ const t = e.toLowerCase(), i = s.trim().toLowerCase();
33
+ return t.indexOf(i) >= 0;
34
+ }) : r, [s, r]), I = (e) => {
35
+ if (f) return;
36
+ u.current && u.current.getAttribute("data-state") === "open" && e.preventDefault();
37
+ const t = H(e.currentTarget);
38
+ e.defaultPrevented || Q(e.currentTarget, t) || a.current && a.current.focus();
39
+ }, S = (e) => {
40
+ e.target !== a.current && e.preventDefault();
41
+ }, $ = (e, t) => {
42
+ e.stopPropagation(), l(P(t));
43
+ };
44
+ return /* @__PURE__ */ o(
45
+ j,
46
+ {
47
+ minimal: !0,
48
+ ref: u,
49
+ sideOffset: 0,
50
+ matchTarget: "width",
51
+ onAnimationEnd: w,
52
+ onOpenAutoFocus: (e) => e.preventDefault(),
53
+ onCloseAutoFocus: (e) => e.preventDefault(),
54
+ content: ({ close: e }) => /* @__PURE__ */ c(V, { maxHeight: 300, children: [
55
+ p.length === 0 && /* @__PURE__ */ o("div", { className: "select-tags-empty", children: R }),
56
+ p.map(({ value: t, title: i, icon: F }, L) => /* @__PURE__ */ o(
57
+ q,
58
+ {
59
+ active: n.includes(t),
60
+ onClick: () => T(O(t), e),
61
+ title: i,
62
+ icon: F
63
+ },
64
+ `option-item-${t}-${L}`
65
+ ))
66
+ ] }),
67
+ children: /* @__PURE__ */ o(
68
+ "div",
69
+ {
70
+ className: "form",
71
+ onClick: I,
72
+ onMouseDown: S,
73
+ "data-size": z,
74
+ "data-required": v(y),
75
+ children: /* @__PURE__ */ c("div", { className: "select-tags-container", children: [
76
+ /* @__PURE__ */ c("div", { className: "select-tags", children: [
77
+ n.length > 0 && /* @__PURE__ */ o(
78
+ "div",
79
+ {
80
+ className: "tag-container",
81
+ ref: b,
82
+ role: "listbox",
83
+ "data-readonly": v(m),
84
+ children: n.map((e, t) => /* @__PURE__ */ c("div", { className: "tag", children: [
85
+ /* @__PURE__ */ o("span", { className: "tag-name", children: E[e].title }),
86
+ /* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (i) => $(i, e), children: /* @__PURE__ */ o(d, { className: "tag-close-icon", icon: G, size: "xxxs" }) })
87
+ ] }, `tag-option-${e}-${t}`))
88
+ }
89
+ ),
90
+ (!m || n.length === 0) && /* @__PURE__ */ o(
91
+ "input",
92
+ {
93
+ ref: X([A, a]),
94
+ type: "text",
95
+ autoCapitalize: "none",
96
+ autoComplete: "off",
97
+ autoCorrect: "off",
98
+ className: "form-input",
99
+ spellCheck: !1,
100
+ value: s,
101
+ disabled: f,
102
+ readOnly: m,
103
+ placeholder: N,
104
+ onChange: ({ target: e }) => D(e.value)
105
+ }
106
+ )
107
+ ] }),
108
+ /* @__PURE__ */ o(d, { className: "expand-icon", icon: J, size: "xxxs" })
109
+ ] })
110
+ }
111
+ )
112
+ }
113
+ );
114
+ };
115
+ export {
116
+ re as SelectTags
117
+ };
@@ -0,0 +1,123 @@
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { Popover as T } from "./bundle.es10.js";
3
+ import { Input as w } from "./bundle.es13.js";
4
+ import { useState as A, useRef as j } from "react";
5
+ import { Calendar as E } from "./bundle.es53.js";
6
+ import { useDayDisableCheker as N } from "./bundle.es54.js";
7
+ import { getNum as h, formatTime as v } from "@companix/utils-js";
8
+ import { removeDigits as O } from "./bundle.es55.js";
9
+ import { SelectRightElements as Y } from "./bundle.es56.js";
10
+ const i = {
11
+ char: "-",
12
+ toString: (e) => {
13
+ if (e) {
14
+ const n = v(e.getDate()), r = v(e.getMonth() + 1), l = e.getFullYear();
15
+ return [n, r, l].join(i.char);
16
+ }
17
+ return "";
18
+ },
19
+ toValue: (e) => {
20
+ const n = e.split(i.char);
21
+ if (n.length === 3) {
22
+ const [r, l, a] = [h(n[0]), h(n[1]), h(n[2])];
23
+ if (r && l && a) {
24
+ const o = new Date(a, l - 1, r);
25
+ if (o.getFullYear() === a && o.getDate() === r && o.getMonth() === l - 1)
26
+ return o;
27
+ }
28
+ }
29
+ return null;
30
+ }
31
+ }, U = (e) => {
32
+ const {
33
+ clearButton: n,
34
+ clearButtonIcon: r,
35
+ children: l,
36
+ disabled: a,
37
+ // calendar props
38
+ value: o,
39
+ enableTime: y,
40
+ disablePickers: I,
41
+ showNeighboringMonth: P,
42
+ onChange: c,
43
+ shouldDisableDate: g,
44
+ viewDate: S,
45
+ disablePast: d,
46
+ disableFuture: D,
47
+ minDateTime: C,
48
+ maxDateTime: b,
49
+ // input props
50
+ ...V
51
+ } = e, [m, s] = A(() => i.toString(o ?? null)), p = j(null), k = N({
52
+ disableFuture: D,
53
+ disablePast: d,
54
+ shouldDisableDate: g,
55
+ minDateTime: C,
56
+ maxDateTime: b
57
+ }), B = (t) => {
58
+ a || p.current && p.current.getAttribute("data-state") === "open" && t.preventDefault();
59
+ }, F = (t) => {
60
+ t.stopPropagation(), s(""), c?.(null);
61
+ }, x = (t) => {
62
+ s(t);
63
+ const f = i.toValue(t);
64
+ f && !k(f) && c?.(f);
65
+ }, M = () => {
66
+ const t = i.toValue(m);
67
+ (!t || k(t)) && s(i.toString(o ?? null));
68
+ }, R = (t) => {
69
+ c?.(t), s(i.toString(t));
70
+ };
71
+ return /* @__PURE__ */ u(
72
+ T,
73
+ {
74
+ minimal: !0,
75
+ ref: p,
76
+ sideOffset: 0,
77
+ onOpenAutoFocus: (t) => t.preventDefault(),
78
+ onCloseAutoFocus: (t) => t.preventDefault(),
79
+ disabled: a,
80
+ fitMaxHeight: !1,
81
+ content: () => /* @__PURE__ */ u(
82
+ E,
83
+ {
84
+ value: o,
85
+ disablePast: d,
86
+ disableFuture: D,
87
+ enableTime: y,
88
+ disablePickers: I,
89
+ showNeighboringMonth: P,
90
+ onChange: R,
91
+ shouldDisableDate: g,
92
+ viewDate: S,
93
+ minDateTime: C,
94
+ maxDateTime: b
95
+ }
96
+ ),
97
+ children: /* @__PURE__ */ u(
98
+ w,
99
+ {
100
+ ...V,
101
+ value: m,
102
+ disabled: a,
103
+ onClick: B,
104
+ onValueChange: x,
105
+ onBlur: M,
106
+ mask: "99-99-9999",
107
+ rightElement: /* @__PURE__ */ u(
108
+ Y,
109
+ {
110
+ clearButton: n,
111
+ clearButtonIcon: r,
112
+ value: !!O(m, ["-", "_"]),
113
+ onClear: F
114
+ }
115
+ )
116
+ }
117
+ )
118
+ }
119
+ );
120
+ };
121
+ export {
122
+ U as DatePicker
123
+ };
@@ -0,0 +1,76 @@
1
+ import { jsxs as D, jsx as h } from "react/jsx-runtime";
2
+ import { useMemo as M, useEffect as C } from "react";
3
+ import { Select as c } from "./bundle.es12.js";
4
+ import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es55.js";
5
+ import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es57.js";
6
+ const B = ({
7
+ min: o = j,
8
+ max: e = N,
9
+ disabled: r,
10
+ value: a,
11
+ noDaySelect: g,
12
+ noYearSelect: u,
13
+ onChange: l,
14
+ required: m,
15
+ size: i
16
+ }) => {
17
+ const d = M(() => O({ min: o, max: e }), [o, e]);
18
+ C(() => {
19
+ const t = d(a);
20
+ t && l(t);
21
+ }, [d, a]);
22
+ const { years: p, months: w, days: f } = V({ min: o, max: e, now: a }), s = (t, x) => {
23
+ const n = { ...a };
24
+ n[t] = x;
25
+ const y = T(n.month, n.year);
26
+ n.day = n.day > y ? y : n.day, l(n);
27
+ };
28
+ return /* @__PURE__ */ D("div", { className: "data-input", children: [
29
+ !u && p.length > 0 && /* @__PURE__ */ h(
30
+ c,
31
+ {
32
+ placeholder: "Год",
33
+ options: p,
34
+ onChange: (t) => s("year", t),
35
+ value: a.year,
36
+ required: m,
37
+ disabled: r,
38
+ size: i,
39
+ minimalOptions: !0,
40
+ matchTarget: "min-width"
41
+ }
42
+ ),
43
+ /* @__PURE__ */ h(
44
+ c,
45
+ {
46
+ placeholder: "Месяц",
47
+ className: "w-full",
48
+ options: w,
49
+ onChange: (t) => s("month", t),
50
+ value: a.month,
51
+ disabled: r,
52
+ required: m,
53
+ size: i,
54
+ minimalOptions: !0,
55
+ matchTarget: "min-width"
56
+ }
57
+ ),
58
+ !g && /* @__PURE__ */ h(
59
+ c,
60
+ {
61
+ placeholder: "День",
62
+ options: f,
63
+ disabled: r || f.length === 0,
64
+ onChange: (t) => s("day", t),
65
+ value: a.day,
66
+ required: m,
67
+ size: i,
68
+ minimalOptions: !0,
69
+ matchTarget: "min-width"
70
+ }
71
+ )
72
+ ] });
73
+ };
74
+ export {
75
+ B as DateInput
76
+ };
@@ -0,0 +1,4 @@
1
+ const a = [16, 20, 24, 28, 32, 36, 40, 44, 48, 56, 64, 72, 80, 88, 96];
2
+ export {
3
+ a as avatarSizes
4
+ };
@@ -0,0 +1,35 @@
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
+ }) => {
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(
21
+ "input",
22
+ {
23
+ ref: t,
24
+ type: "file",
25
+ multiple: f,
26
+ accept: c,
27
+ onChange: u,
28
+ disabled: n
29
+ }
30
+ ) })
31
+ ] });
32
+ };
33
+ export {
34
+ j as FileOverlay
35
+ };
@@ -0,0 +1,14 @@
1
+ import { jsxs as p, jsx as a } from "react/jsx-runtime";
2
+ import t from "classnames";
3
+ import { attr as n } from "@companix/utils-browser";
4
+ const u = (o) => {
5
+ const { fill: e, className: l, label: c, children: i, caption: r, apperance: m = "neutral" } = o;
6
+ return /* @__PURE__ */ p("div", { className: t("form-group", l), "data-fill": n(e), children: [
7
+ /* @__PURE__ */ a("div", { className: "form-group-label", children: c }),
8
+ i,
9
+ r && /* @__PURE__ */ a("div", { className: "form-group-caption", "data-appearance": m, children: r })
10
+ ] });
11
+ };
12
+ export {
13
+ u as FormGroup
14
+ };