@companix/uikit 0.0.3 → 0.0.5

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 (165) hide show
  1. package/dist/Button/Button.scss +128 -0
  2. package/dist/ButtonGroup/ButtonGroup.scss +18 -0
  3. package/dist/Checkbox/Checkbox.scss +115 -0
  4. package/dist/DateInput/DateInput.scss +11 -0
  5. package/dist/DatePicker/Calendar.scss +125 -0
  6. package/dist/DatePicker/DatePicker.scss +0 -0
  7. package/dist/Dialog/Dialog.scss +25 -0
  8. package/dist/Dialog/Popup.scss +55 -0
  9. package/dist/DialogAlert/Alert.scss +52 -0
  10. package/dist/Drawer/Drawer.scss +112 -0
  11. package/dist/Form/Form.scss +70 -0
  12. package/dist/Form/Input.scss +24 -0
  13. package/dist/Icon/icon.scss +18 -0
  14. package/dist/OptionItem/Option.scss +89 -0
  15. package/dist/Popover/Popover.scss +80 -0
  16. package/dist/Radio/Radio.scss +148 -0
  17. package/dist/Scrollable/Scrollable.scss +50 -0
  18. package/dist/Select/Select.scss +80 -0
  19. package/dist/SelectTags/SelectTags.scss +66 -0
  20. package/dist/Spinner/Spinner.scss +14 -0
  21. package/dist/Stepper/StepperInput.scss +35 -0
  22. package/dist/Switch/Switch.scss +102 -0
  23. package/dist/Tabs/Tabs.scss +58 -0
  24. package/dist/TextArea/TextArea.scss +34 -0
  25. package/dist/Toaster/Toaster.scss +151 -0
  26. package/dist/Tooltip/Tooltip.scss +28 -0
  27. package/dist/bundle.es.js +56 -59
  28. package/dist/bundle.es10.js +35 -84
  29. package/dist/bundle.es11.js +30 -72
  30. package/dist/bundle.es12.js +14 -34
  31. package/dist/bundle.es13.js +7 -30
  32. package/dist/bundle.es14.js +33 -16
  33. package/dist/bundle.es15.js +24 -8
  34. package/dist/bundle.es16.js +15 -27
  35. package/dist/bundle.es17.js +22 -25
  36. package/dist/bundle.es18.js +13 -21
  37. package/dist/bundle.es19.js +38 -22
  38. package/dist/bundle.es2.js +45 -0
  39. package/dist/bundle.es20.js +16 -13
  40. package/dist/bundle.es21.js +34 -39
  41. package/dist/bundle.es22.js +20 -15
  42. package/dist/bundle.es23.js +38 -32
  43. package/dist/bundle.es24.js +110 -20
  44. package/dist/bundle.es25.js +106 -34
  45. package/dist/bundle.es26.js +34 -110
  46. package/dist/bundle.es27.js +11 -113
  47. package/dist/bundle.es28.js +23 -34
  48. package/dist/bundle.es29.js +35 -10
  49. package/dist/bundle.es3.js +10 -42
  50. package/dist/bundle.es30.js +20 -21
  51. package/dist/bundle.es31.js +81 -36
  52. package/dist/bundle.es32.js +20 -0
  53. package/dist/bundle.es33.js +16 -0
  54. package/dist/bundle.es34.js +24 -0
  55. package/dist/bundle.es35.js +5 -41
  56. package/dist/bundle.es36.js +18 -437
  57. package/dist/bundle.es37.js +14 -22
  58. package/dist/bundle.es38.js +68 -22
  59. package/dist/bundle.es39.js +68 -81
  60. package/dist/bundle.es4.js +85 -12
  61. package/dist/bundle.es40.js +31 -17
  62. package/dist/bundle.es41.js +67 -13
  63. package/dist/{bundle.es53.js → bundle.es42.js} +1 -1
  64. package/dist/bundle.es43.js +31 -5
  65. package/dist/bundle.es44.js +74 -20
  66. package/dist/bundle.es45.js +47 -12
  67. package/dist/bundle.es5.js +82 -83
  68. package/dist/bundle.es6.js +74 -81
  69. package/dist/bundle.es7.js +26 -78
  70. package/dist/bundle.es8.js +80 -22
  71. package/dist/bundle.es9.js +71 -43
  72. package/dist/css-properties.scss +120 -0
  73. package/dist/{types/index.d.ts → index.d.ts} +0 -1
  74. package/dist/index.scss +25 -0
  75. package/dist/mixins.scss +100 -0
  76. package/dist/theme.scss +101 -0
  77. package/package.json +3 -3
  78. package/dist/bundle.es46.js +0 -72
  79. package/dist/bundle.es47.js +0 -70
  80. package/dist/bundle.es48.js +0 -34
  81. package/dist/bundle.es49.js +0 -70
  82. package/dist/bundle.es50.js +0 -33
  83. package/dist/bundle.es51.js +0 -78
  84. package/dist/bundle.es52.js +0 -51
  85. package/dist/bundle.es54.js +0 -40
  86. package/dist/bundle.es55.js +0 -36
  87. package/dist/bundle.es56.js +0 -9
  88. package/dist/bundle.es57.js +0 -9
  89. package/dist/bundle.es58.js +0 -7
  90. package/dist/bundle.es59.js +0 -9
  91. package/dist/bundle.es60.js +0 -8
  92. package/dist/bundle.es61.js +0 -19
  93. package/dist/bundle.es62.js +0 -15
  94. package/dist/bundle.es63.js +0 -22
  95. package/dist/bundle.es64.js +0 -45
  96. package/dist/bundle.es65.js +0 -28
  97. package/dist/bundle.es66.js +0 -34
  98. package/dist/bundle.es67.js +0 -6
  99. package/dist/bundle.es68.js +0 -12
  100. package/dist/bundle.es69.js +0 -47
  101. package/dist/bundle.es70.js +0 -11
  102. package/dist/bundle.es71.js +0 -18
  103. package/dist/bundle.es72.js +0 -32
  104. package/dist/bundle.es73.js +0 -35
  105. package/dist/bundle.es74.js +0 -6
  106. package/dist/bundle.es75.js +0 -7
  107. package/dist/bundle.es76.js +0 -7
  108. package/dist/bundle.es77.js +0 -11
  109. package/dist/bundle.es78.js +0 -17
  110. package/dist/bundle.es79.js +0 -7
  111. package/dist/bundle.es80.js +0 -17
  112. package/dist/bundle.es81.js +0 -25
  113. package/dist/uikit.css +0 -1
  114. /package/dist/{types/Button → Button}/index.d.ts +0 -0
  115. /package/dist/{types/ButtonGroup → ButtonGroup}/index.d.ts +0 -0
  116. /package/dist/{types/Checkbox → Checkbox}/index.d.ts +0 -0
  117. /package/dist/{types/Countdown → Countdown}/index.d.ts +0 -0
  118. /package/dist/{types/DateInput → DateInput}/index.d.ts +0 -0
  119. /package/dist/{types/DatePicker → DatePicker}/Calendar.d.ts +0 -0
  120. /package/dist/{types/DatePicker → DatePicker}/CalendarHeader.d.ts +0 -0
  121. /package/dist/{types/DatePicker → DatePicker}/index.d.ts +0 -0
  122. /package/dist/{types/Dialog → Dialog}/index.d.ts +0 -0
  123. /package/dist/{types/DialogAlert → DialogAlert}/Alert.d.ts +0 -0
  124. /package/dist/{types/DialogAlert → DialogAlert}/Viewport.d.ts +0 -0
  125. /package/dist/{types/DialogAlert → DialogAlert}/index.d.ts +0 -0
  126. /package/dist/{types/Drawer → Drawer}/index.d.ts +0 -0
  127. /package/dist/{types/File → File}/index.d.ts +0 -0
  128. /package/dist/{types/Form → Form}/index.d.ts +0 -0
  129. /package/dist/{types/Icon → Icon}/index.d.ts +0 -0
  130. /package/dist/{types/LoadButton → LoadButton}/index.d.ts +0 -0
  131. /package/dist/{types/NumberInput → NumberInput}/index.d.ts +0 -0
  132. /package/dist/{types/OptionItem → OptionItem}/OptionItem.d.ts +0 -0
  133. /package/dist/{types/OptionItem → OptionItem}/OptionsList.d.ts +0 -0
  134. /package/dist/{types/Popover → Popover}/index.d.ts +0 -0
  135. /package/dist/{types/Radio → Radio}/index.d.ts +0 -0
  136. /package/dist/{types/Scrollable → Scrollable}/ImitateScroll.d.ts +0 -0
  137. /package/dist/{types/Scrollable → Scrollable}/index.d.ts +0 -0
  138. /package/dist/{types/Select → Select}/SelectInput.d.ts +0 -0
  139. /package/dist/{types/Select → Select}/index.d.ts +0 -0
  140. /package/dist/{types/SelectTags → SelectTags}/index.d.ts +0 -0
  141. /package/dist/{types/Spinner → Spinner}/index.d.ts +0 -0
  142. /package/dist/{types/Stepper → Stepper}/index.d.ts +0 -0
  143. /package/dist/{types/Switch → Switch}/index.d.ts +0 -0
  144. /package/dist/{types/Tabs → Tabs}/index.d.ts +0 -0
  145. /package/dist/{types/TextArea → TextArea}/index.d.ts +0 -0
  146. /package/dist/{types/Toaster → Toaster}/RemoveListener.d.ts +0 -0
  147. /package/dist/{types/Toaster → Toaster}/Toast.d.ts +0 -0
  148. /package/dist/{types/Toaster → Toaster}/Viewport.d.ts +0 -0
  149. /package/dist/{types/Toaster → Toaster}/index.d.ts +0 -0
  150. /package/dist/{types/Tooltip → Tooltip}/index.d.ts +0 -0
  151. /package/dist/{types/__hooks → __hooks}/use-frooze-closing.d.ts +0 -0
  152. /package/dist/{types/__hooks → __hooks}/use-loading.d.ts +0 -0
  153. /package/dist/{types/__hooks → __hooks}/use-local-storage.d.ts +0 -0
  154. /package/dist/{types/__hooks → __hooks}/use-popover-position.d.ts +0 -0
  155. /package/dist/{types/__hooks → __hooks}/use-previos.d.ts +0 -0
  156. /package/dist/{types/__hooks → __hooks}/use-resize.d.ts +0 -0
  157. /package/dist/{types/__hooks → __hooks}/use-scrollbox.d.ts +0 -0
  158. /package/dist/{types/__hooks → __hooks}/use-stepper-input.d.ts +0 -0
  159. /package/dist/{types/__hooks → __hooks}/use-update.d.ts +0 -0
  160. /package/dist/{types/__hooks → __hooks}/useCalendar.d.ts +0 -0
  161. /package/dist/{types/__hooks → __hooks}/useCalendarOptions-copy.d.ts +0 -0
  162. /package/dist/{types/__hooks → __hooks}/useCalendarOptions.d.ts +0 -0
  163. /package/dist/{types/__libs → __libs}/calendar.d.ts +0 -0
  164. /package/dist/{types/__utils → __utils}/utils.d.ts +0 -0
  165. /package/dist/{types/types.d.ts → types.d.ts} +0 -0
@@ -1,23 +1,113 @@
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) });
1
+ import { jsx as o, jsxs as c } from "react/jsx-runtime";
2
+ import { useFroozeClosing as F } from "./bundle.es30.js";
3
+ import { Popover as I } from "./bundle.es6.js";
4
+ import { OptionItem as L } from "./bundle.es10.js";
5
+ import { OptionsList as M } from "./bundle.es12.js";
6
+ import { useState as j, useRef as d, useMemo as h } from "react";
7
+ import { Icon as g } from "./bundle.es34.js";
8
+ import { faClose as V, faChevronDown as B } from "@fortawesome/free-solid-svg-icons";
9
+ import { attr as H, getActiveElementByAnotherElement as Q, contains as q } from "@companix/utils-browser";
10
+ const ee = (v) => {
11
+ const {
12
+ options: r,
13
+ closeAfterSelect: x,
14
+ placeholder: C,
15
+ onChange: l,
16
+ emptyText: N = "Ничего не найдено",
17
+ readOnly: m,
18
+ size: z = "md",
19
+ value: n,
20
+ disabled: f
21
+ } = v, [a, A] = j(""), i = d(null), y = d(null), { popoverRef: u, froozePopoverPosition: D, handleAnimationEnd: R } = F(), b = h(() => {
22
+ const e = {};
23
+ return r.forEach((t) => {
24
+ e[t.value] = t;
25
+ }), e;
26
+ }, [r]), w = (e) => n.includes(e) ? [...n] : [...n, e], E = (e) => n.filter((t) => e !== t), O = (e, t) => {
27
+ x ? (D(), l(e), t()) : l(e);
28
+ }, p = h(() => a.trim() ? r.filter(({ title: e }) => {
29
+ const t = e.toLowerCase(), s = a.trim().toLowerCase();
30
+ return t.indexOf(s) >= 0;
31
+ }) : r, [a, r]), P = (e) => {
32
+ if (f) return;
33
+ u.current && u.current.getAttribute("data-state") === "open" && e.preventDefault();
34
+ const t = Q(e.currentTarget);
35
+ e.defaultPrevented || q(e.currentTarget, t) || i.current && i.current.focus();
36
+ }, T = (e) => {
37
+ e.target !== i.current && e.preventDefault();
38
+ }, k = (e, t) => {
39
+ e.stopPropagation(), l(E(t));
40
+ };
41
+ return /* @__PURE__ */ o(
42
+ I,
43
+ {
44
+ minimal: !0,
45
+ ref: u,
46
+ sideOffset: 0,
47
+ matchTarget: "width",
48
+ onAnimationEnd: R,
49
+ onOpenAutoFocus: (e) => e.preventDefault(),
50
+ onCloseAutoFocus: (e) => e.preventDefault(),
51
+ content: ({ close: e }) => /* @__PURE__ */ c(M, { maxHeight: 300, children: [
52
+ p.length === 0 && /* @__PURE__ */ o("div", { className: "select-tags-empty", children: N }),
53
+ p.map(({ value: t, title: s, icon: S }, $) => /* @__PURE__ */ o(
54
+ L,
55
+ {
56
+ active: n.includes(t),
57
+ onClick: () => O(w(t), e),
58
+ title: s,
59
+ icon: S
60
+ },
61
+ `option-item-${t}-${$}`
62
+ ))
63
+ ] }),
64
+ children: /* @__PURE__ */ o(
65
+ "div",
66
+ {
67
+ className: "form",
68
+ onClick: P,
69
+ onMouseDown: T,
70
+ "data-size": z,
71
+ children: /* @__PURE__ */ c("div", { className: "select-tags-container", children: [
72
+ /* @__PURE__ */ c("div", { className: "select-tags", children: [
73
+ n.length > 0 && /* @__PURE__ */ o(
74
+ "div",
75
+ {
76
+ className: "tag-container",
77
+ ref: y,
78
+ role: "listbox",
79
+ "data-readonly": H(m),
80
+ children: n.map((e, t) => /* @__PURE__ */ c("div", { className: "tag", children: [
81
+ /* @__PURE__ */ o("span", { className: "tag-name", children: b[e].title }),
82
+ /* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (s) => k(s, e), children: /* @__PURE__ */ o(g, { className: "tag-close-icon", icon: V, size: "xxxs" }) })
83
+ ] }, `tag-option-${e}-${t}`))
84
+ }
85
+ ),
86
+ (!m || n.length === 0) && /* @__PURE__ */ o(
87
+ "input",
88
+ {
89
+ ref: i,
90
+ type: "text",
91
+ autoCapitalize: "none",
92
+ autoComplete: "off",
93
+ autoCorrect: "off",
94
+ className: "form-input",
95
+ spellCheck: !1,
96
+ value: a,
97
+ disabled: f,
98
+ readOnly: m,
99
+ placeholder: C,
100
+ onChange: ({ target: e }) => A(e.value)
101
+ }
102
+ )
103
+ ] }),
104
+ /* @__PURE__ */ o(g, { className: "expand-icon", icon: B, size: "xxxs" })
105
+ ] })
106
+ }
107
+ )
108
+ }
109
+ );
20
110
  };
21
111
  export {
22
- j as Countdown
112
+ ee as SelectTags
23
113
  };
@@ -1,42 +1,114 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { useResizeTextarea as p } from "./bundle.es45.js";
3
- import { attr as e, callMultiple as x } from "@companix/utils-browser";
4
- import { useEffect as u } from "react";
5
- const R = ({
6
- onResize: s,
7
- grow: a = !1,
8
- value: t,
9
- onChange: i,
10
- disabled: o,
11
- required: m,
12
- rows: l = 2,
13
- fill: c = !1,
14
- ...d
15
- }) => {
16
- const [n, r] = p(s, a);
17
- return u(r, [r, t]), /* @__PURE__ */ f(
18
- "div",
1
+ import { jsx as l, jsxs as O, Fragment as R } from "react/jsx-runtime";
2
+ import { Popover as z } from "./bundle.es6.js";
3
+ import { Form as Y } from "./bundle.es9.js";
4
+ import { faClose as E, faChevronDown as S } from "@fortawesome/free-solid-svg-icons";
5
+ import { Icon as F } from "./bundle.es34.js";
6
+ import { useState as _, useRef as q } from "react";
7
+ import { Calendar as G } from "./bundle.es38.js";
8
+ import { useDayDisableCheker as H } from "./bundle.es39.js";
9
+ import { formatTime as I, getNum as d } from "@companix/utils-js";
10
+ const h = (t, i = "-") => {
11
+ if (t) {
12
+ const n = I(t.getDate()), r = I(t.getMonth() + 1), s = t.getFullYear();
13
+ return [n, r, s].join(i);
14
+ }
15
+ return "";
16
+ }, y = (t, i = "-") => {
17
+ const n = t.split(i);
18
+ if (n.length === 3) {
19
+ const [r, s, a] = [d(n[0]), d(n[1]), d(n[2])];
20
+ if (r && s && a) {
21
+ const o = new Date(a, s - 1, r);
22
+ if (o.getFullYear() === a && o.getDate() === r && o.getMonth() === s - 1)
23
+ return o;
24
+ }
25
+ }
26
+ return null;
27
+ }, te = (t) => {
28
+ const {
29
+ minimalOptions: i,
30
+ clearButton: n,
31
+ clearButtonIcon: r,
32
+ children: s,
33
+ disabled: a,
34
+ // calendar props
35
+ value: o,
36
+ enableTime: P,
37
+ disablePickers: v,
38
+ showNeighboringMonth: A,
39
+ onChange: u,
40
+ shouldDisableDate: g,
41
+ viewDate: N,
42
+ disablePast: D,
43
+ disableFuture: C,
44
+ minDateTime: b,
45
+ maxDateTime: x,
46
+ // input props
47
+ ...T
48
+ } = t, [m, c] = _(() => h(o ?? null)), p = q(null), k = H({
49
+ disableFuture: C,
50
+ disablePast: D,
51
+ shouldDisableDate: g,
52
+ minDateTime: b,
53
+ maxDateTime: x
54
+ }), w = (e) => {
55
+ a || p.current && p.current.getAttribute("data-state") === "open" && e.preventDefault();
56
+ }, B = (e) => {
57
+ e.stopPropagation(), c(""), u?.(null);
58
+ }, V = (e) => {
59
+ c(e);
60
+ const f = y(e);
61
+ f && !k(f) && u?.(f);
62
+ }, j = () => {
63
+ const e = y(m);
64
+ (!e || k(e)) && c(h(o ?? null));
65
+ }, M = (e) => {
66
+ u?.(e), c(h(e));
67
+ };
68
+ return /* @__PURE__ */ l(
69
+ z,
19
70
  {
20
- className: "form form-textarea",
21
- "data-required": e(m),
22
- "data-disabled": e(o),
23
- "data-fill": e(c),
24
- children: /* @__PURE__ */ f(
25
- "textarea",
71
+ minimal: !0,
72
+ ref: p,
73
+ sideOffset: 0,
74
+ onOpenAutoFocus: (e) => e.preventDefault(),
75
+ onCloseAutoFocus: (e) => e.preventDefault(),
76
+ disabled: a,
77
+ content: () => /* @__PURE__ */ l(
78
+ G,
79
+ {
80
+ value: o,
81
+ disablePast: D,
82
+ disableFuture: C,
83
+ enableTime: P,
84
+ disablePickers: v,
85
+ showNeighboringMonth: A,
86
+ onChange: M,
87
+ shouldDisableDate: g,
88
+ viewDate: N,
89
+ minDateTime: b,
90
+ maxDateTime: x
91
+ }
92
+ ),
93
+ children: /* @__PURE__ */ l(
94
+ Y,
26
95
  {
27
- className: "form-input",
28
- "data-grow": e(a),
29
- value: t,
30
- ref: n,
31
- rows: l,
32
- disabled: o,
33
- onChange: x(i, r),
34
- ...d
96
+ ...T,
97
+ value: m,
98
+ disabled: a,
99
+ onClick: w,
100
+ onValueChange: V,
101
+ onBlur: j,
102
+ mask: "99-99-9999",
103
+ rightElement: /* @__PURE__ */ O(R, { children: [
104
+ n && J(m) && /* @__PURE__ */ l("button", { className: "select-close-button", onClick: B, children: r ?? /* @__PURE__ */ l(F, { className: "select-close-icon", icon: E, size: "xxxs" }) }),
105
+ /* @__PURE__ */ l(F, { className: "expand-icon select-expand", icon: S, size: "xxxs" })
106
+ ] })
35
107
  }
36
108
  )
37
109
  }
38
110
  );
39
- };
111
+ }, J = (t) => t.trim().replaceAll("-", "").replaceAll("_", "");
40
112
  export {
41
- R as TextArea
113
+ te as DatePicker
42
114
  };
@@ -1,114 +1,38 @@
1
- import { jsx as o, jsxs as c } from "react/jsx-runtime";
2
- import { useFroozeClosing as F } from "./bundle.es38.js";
3
- /* empty css */
4
- import { Popover as I } from "./bundle.es7.js";
5
- import { OptionItem as L } from "./bundle.es12.js";
6
- import { OptionsList as M } from "./bundle.es14.js";
7
- import { useState as j, useRef as d, useMemo as h } from "react";
8
- import { Icon as g } from "./bundle.es37.js";
9
- import { faClose as V, faChevronDown as B } from "@fortawesome/free-solid-svg-icons";
10
- import { attr as H, getActiveElementByAnotherElement as Q, contains as q } from "@companix/utils-browser";
11
- const te = (v) => {
12
- const {
13
- options: r,
14
- closeAfterSelect: x,
15
- placeholder: C,
16
- onChange: l,
17
- emptyText: N = "Ничего не найдено",
18
- readOnly: m,
19
- size: z = "md",
20
- value: n,
21
- disabled: f
22
- } = v, [i, A] = j(""), a = d(null), y = d(null), { popoverRef: u, froozePopoverPosition: D, handleAnimationEnd: R } = F(), b = h(() => {
23
- const e = {};
24
- return r.forEach((t) => {
25
- e[t.value] = t;
26
- }), e;
27
- }, [r]), w = (e) => n.includes(e) ? [...n] : [...n, e], E = (e) => n.filter((t) => e !== t), O = (e, t) => {
28
- x ? (D(), l(e), t()) : l(e);
29
- }, p = h(() => i.trim() ? r.filter(({ title: e }) => {
30
- const t = e.toLowerCase(), s = i.trim().toLowerCase();
31
- return t.indexOf(s) >= 0;
32
- }) : r, [i, r]), P = (e) => {
33
- if (f) return;
34
- u.current && u.current.getAttribute("data-state") === "open" && e.preventDefault();
35
- const t = Q(e.currentTarget);
36
- e.defaultPrevented || q(e.currentTarget, t) || a.current && a.current.focus();
37
- }, T = (e) => {
38
- e.target !== a.current && e.preventDefault();
39
- }, k = (e, t) => {
40
- e.stopPropagation(), l(E(t));
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
11
+ }) => {
12
+ const e = p(null), u = (t) => {
13
+ r || (t.target.files && n?.(Array.from(t.target.files)), e.current && (e.current.value = ""));
41
14
  };
42
- return /* @__PURE__ */ o(
43
- I,
44
- {
45
- minimal: !0,
46
- ref: u,
47
- sideOffset: 0,
48
- matchTarget: "width",
49
- onAnimationEnd: R,
50
- onOpenAutoFocus: (e) => e.preventDefault(),
51
- onCloseAutoFocus: (e) => e.preventDefault(),
52
- content: ({ close: e }) => /* @__PURE__ */ c(M, { maxHeight: 300, children: [
53
- p.length === 0 && /* @__PURE__ */ o("div", { className: "select-tags-empty", children: N }),
54
- p.map(({ value: t, title: s, icon: S }, $) => /* @__PURE__ */ o(
55
- L,
56
- {
57
- active: n.includes(t),
58
- onClick: () => O(w(t), e),
59
- title: s,
60
- icon: S
61
- },
62
- `option-item-${t}-${$}`
63
- ))
64
- ] }),
65
- children: /* @__PURE__ */ o(
66
- "div",
67
- {
68
- className: "form",
69
- onClick: P,
70
- onMouseDown: T,
71
- "data-size": z,
72
- children: /* @__PURE__ */ c("div", { className: "select-tags-container", children: [
73
- /* @__PURE__ */ c("div", { className: "select-tags", children: [
74
- n.length > 0 && /* @__PURE__ */ o(
75
- "div",
76
- {
77
- className: "tag-container",
78
- ref: y,
79
- role: "listbox",
80
- "data-readonly": H(m),
81
- children: n.map((e, t) => /* @__PURE__ */ c("div", { className: "tag", children: [
82
- /* @__PURE__ */ o("span", { className: "tag-name", children: b[e].title }),
83
- /* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (s) => k(s, e), children: /* @__PURE__ */ o(g, { className: "tag-close-icon", icon: V, size: "xxxs" }) })
84
- ] }, `tag-option-${e}-${t}`))
85
- }
86
- ),
87
- (!m || n.length === 0) && /* @__PURE__ */ o(
88
- "input",
89
- {
90
- ref: a,
91
- type: "text",
92
- autoCapitalize: "none",
93
- autoComplete: "off",
94
- autoCorrect: "off",
95
- className: "form-input",
96
- spellCheck: !1,
97
- value: i,
98
- disabled: f,
99
- readOnly: m,
100
- placeholder: C,
101
- onChange: ({ target: e }) => A(e.value)
102
- }
103
- )
104
- ] }),
105
- /* @__PURE__ */ o(g, { className: "expand-icon", icon: B, size: "xxxs" })
106
- ] })
107
- }
108
- )
109
- }
110
- );
15
+ return /* @__PURE__ */ c("label", { className: f, children: [
16
+ a,
17
+ /* @__PURE__ */ o(s, { asChild: !0, children: /* @__PURE__ */ o(
18
+ "input",
19
+ {
20
+ ref: e,
21
+ hidden: !0,
22
+ 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(", "),
30
+ onChange: u,
31
+ disabled: r
32
+ }
33
+ ) })
34
+ ] });
111
35
  };
112
36
  export {
113
- te as SelectTags
37
+ d as FileOverlay
114
38
  };
@@ -1,115 +1,13 @@
1
- import { jsx as l, jsxs as O, Fragment as R } from "react/jsx-runtime";
2
- /* empty css */
3
- import { Popover as z } from "./bundle.es7.js";
4
- import { Form as Y } from "./bundle.es11.js";
5
- import { faClose as E, faChevronDown as S } from "@fortawesome/free-solid-svg-icons";
6
- import { Icon as F } from "./bundle.es37.js";
7
- import { useState as _, useRef as q } from "react";
8
- import { Calendar as G } from "./bundle.es46.js";
9
- import { useDayDisableCheker as H } from "./bundle.es47.js";
10
- import { formatTime as I, getNum as d } from "@companix/utils-js";
11
- const h = (t, i = "-") => {
12
- if (t) {
13
- const n = I(t.getDate()), r = I(t.getMonth() + 1), s = t.getFullYear();
14
- return [n, r, s].join(i);
15
- }
16
- return "";
17
- }, y = (t, i = "-") => {
18
- const n = t.split(i);
19
- if (n.length === 3) {
20
- const [r, s, a] = [d(n[0]), d(n[1]), d(n[2])];
21
- if (r && s && a) {
22
- const o = new Date(a, s - 1, r);
23
- if (o.getFullYear() === a && o.getDate() === r && o.getMonth() === s - 1)
24
- return o;
25
- }
26
- }
27
- return null;
28
- }, ne = (t) => {
29
- const {
30
- minimalOptions: i,
31
- clearButton: n,
32
- clearButtonIcon: r,
33
- children: s,
34
- disabled: a,
35
- // calendar props
36
- value: o,
37
- enableTime: P,
38
- disablePickers: v,
39
- showNeighboringMonth: A,
40
- onChange: u,
41
- shouldDisableDate: g,
42
- viewDate: N,
43
- disablePast: D,
44
- disableFuture: C,
45
- minDateTime: b,
46
- maxDateTime: x,
47
- // input props
48
- ...T
49
- } = t, [m, c] = _(() => h(o ?? null)), p = q(null), k = H({
50
- disableFuture: C,
51
- disablePast: D,
52
- shouldDisableDate: g,
53
- minDateTime: b,
54
- maxDateTime: x
55
- }), w = (e) => {
56
- a || p.current && p.current.getAttribute("data-state") === "open" && e.preventDefault();
57
- }, B = (e) => {
58
- e.stopPropagation(), c(""), u?.(null);
59
- }, V = (e) => {
60
- c(e);
61
- const f = y(e);
62
- f && !k(f) && u?.(f);
63
- }, j = () => {
64
- const e = y(m);
65
- (!e || k(e)) && c(h(o ?? null));
66
- }, M = (e) => {
67
- u?.(e), c(h(e));
68
- };
69
- return /* @__PURE__ */ l(
70
- z,
71
- {
72
- minimal: !0,
73
- ref: p,
74
- sideOffset: 0,
75
- onOpenAutoFocus: (e) => e.preventDefault(),
76
- onCloseAutoFocus: (e) => e.preventDefault(),
77
- disabled: a,
78
- content: () => /* @__PURE__ */ l(
79
- G,
80
- {
81
- value: o,
82
- disablePast: D,
83
- disableFuture: C,
84
- enableTime: P,
85
- disablePickers: v,
86
- showNeighboringMonth: A,
87
- onChange: M,
88
- shouldDisableDate: g,
89
- viewDate: N,
90
- minDateTime: b,
91
- maxDateTime: x
92
- }
93
- ),
94
- children: /* @__PURE__ */ l(
95
- Y,
96
- {
97
- ...T,
98
- value: m,
99
- disabled: a,
100
- onClick: w,
101
- onValueChange: V,
102
- onBlur: j,
103
- mask: "99-99-9999",
104
- rightElement: /* @__PURE__ */ O(R, { children: [
105
- n && J(m) && /* @__PURE__ */ l("button", { className: "select-close-button", onClick: B, children: r ?? /* @__PURE__ */ l(F, { className: "select-close-icon", icon: E, size: "xxxs" }) }),
106
- /* @__PURE__ */ l(F, { className: "expand-icon select-expand", icon: S, size: "xxxs" })
107
- ] })
108
- }
109
- )
110
- }
111
- );
112
- }, J = (t) => t.trim().replaceAll("-", "").replaceAll("_", "");
1
+ import { useState as s, useEffect as c } from "react";
2
+ const l = (e, a) => {
3
+ const [t, o] = s(() => {
4
+ const r = localStorage.getItem(e);
5
+ return r ? JSON.parse(r) : a;
6
+ });
7
+ return c(() => {
8
+ localStorage.setItem(e, JSON.stringify(t));
9
+ }, [t]), [t, o];
10
+ };
113
11
  export {
114
- ne as DatePicker
12
+ l as useLocalStorage
115
13
  };
@@ -1,38 +1,27 @@
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
11
- }) => {
12
- const e = p(null), u = (t) => {
13
- r || (t.target.files && n?.(Array.from(t.target.files)), e.current && (e.current.value = ""));
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { hash as m } from "@companix/utils-js";
3
+ import { useRef as n, useMemo as s } from "react";
4
+ import { Viewport as u } from "./bundle.es40.js";
5
+ const h = (t = {}) => {
6
+ const e = {
7
+ emit: (r) => {
8
+ console.error("uninitialized", r);
9
+ }
10
+ };
11
+ return {
12
+ show: (r) => {
13
+ e.emit({ ...r, id: m() });
14
+ },
15
+ Viewport: () => {
16
+ const r = n(null);
17
+ return s(() => {
18
+ e.emit = (o) => {
19
+ r.current && r.current.showAlert(o);
20
+ };
21
+ }, []), /* @__PURE__ */ i(u, { ref: r, ...t });
22
+ }
14
23
  };
15
- return /* @__PURE__ */ c("label", { className: f, children: [
16
- a,
17
- /* @__PURE__ */ o(s, { asChild: !0, children: /* @__PURE__ */ o(
18
- "input",
19
- {
20
- ref: e,
21
- hidden: !0,
22
- 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(", "),
30
- onChange: u,
31
- disabled: r
32
- }
33
- ) })
34
- ] });
35
24
  };
36
25
  export {
37
- d as FileOverlay
26
+ h as createAlertAgent
38
27
  };
@@ -1,13 +1,38 @@
1
- import { useState as s, useEffect as c } from "react";
2
- const l = (e, a) => {
3
- const [t, o] = s(() => {
4
- const r = localStorage.getItem(e);
5
- return r ? JSON.parse(r) : a;
6
- });
7
- return c(() => {
8
- localStorage.setItem(e, JSON.stringify(t));
9
- }, [t]), [t, o];
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { hash as d } from "@companix/utils-js";
3
+ import { Viewport as s } from "./bundle.es41.js";
4
+ import { useRef as c, useMemo as l } from "react";
5
+ const f = (i = {}) => {
6
+ const t = {
7
+ emit: (e) => {
8
+ console.error("uninitialized", e);
9
+ }
10
+ };
11
+ return {
12
+ send: (e) => {
13
+ t.emit({ ...e, id: d() });
14
+ },
15
+ Viewport: (e = {}) => {
16
+ const n = c(null);
17
+ return l(() => {
18
+ t.emit = (r) => {
19
+ n.current && n.current.addToast(r);
20
+ };
21
+ }, []), /* @__PURE__ */ a(
22
+ s,
23
+ {
24
+ ref: n,
25
+ align: e.align ?? i.align,
26
+ closeIcon: e.closeIcon ?? i.closeIcon,
27
+ duration: e.duration ?? i.duration,
28
+ gap: e.gap ?? i.gap,
29
+ side: e.side ?? i.side,
30
+ swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
31
+ }
32
+ );
33
+ }
34
+ };
10
35
  };
11
36
  export {
12
- l as useLocalStorage
37
+ f as createToaster
13
38
  };