@companix/uikit 0.0.16 → 0.0.18

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 (60) hide show
  1. package/dist/DatePicker/index.d.ts +2 -3
  2. package/dist/Input/Form.scss +1 -4
  3. package/dist/Input/InlineInput.d.ts +0 -0
  4. package/dist/Input/{index.d.ts → Input.d.ts} +4 -8
  5. package/dist/Input/Input.scss +23 -0
  6. package/dist/Input/InputContainer.d.ts +11 -0
  7. package/dist/Input/InputElement.d.ts +7 -0
  8. package/dist/NumberInput/index.d.ts +2 -2
  9. package/dist/Select/SelectOptions.d.ts +12 -0
  10. package/dist/Select/SelectRight.d.ts +8 -0
  11. package/dist/Select/index.d.ts +4 -0
  12. package/dist/TimePicker/index.d.ts +10 -0
  13. package/dist/__hooks/use-input-padding.d.ts +5 -0
  14. package/dist/__hooks/use-scrollbox.d.ts +1 -1
  15. package/dist/__hooks/use-update.d.ts +1 -1
  16. package/dist/__utils/utils.d.ts +15 -1
  17. package/dist/bundle.es.js +51 -46
  18. package/dist/bundle.es10.js +1 -1
  19. package/dist/bundle.es14.js +1 -1
  20. package/dist/bundle.es16.js +37 -13
  21. package/dist/bundle.es19.js +1 -1
  22. package/dist/bundle.es20.js +1 -1
  23. package/dist/bundle.es23.js +1 -1
  24. package/dist/bundle.es24.js +2 -2
  25. package/dist/bundle.es25.js +93 -85
  26. package/dist/bundle.es26.js +67 -29
  27. package/dist/bundle.es27.js +34 -10
  28. package/dist/bundle.es28.js +11 -10
  29. package/dist/bundle.es29.js +82 -21
  30. package/dist/bundle.es30.js +10 -35
  31. package/dist/bundle.es31.js +21 -20
  32. package/dist/bundle.es32.js +36 -83
  33. package/dist/bundle.es33.js +23 -17
  34. package/dist/bundle.es34.js +87 -14
  35. package/dist/bundle.es35.js +18 -22
  36. package/dist/bundle.es36.js +20 -5
  37. package/dist/bundle.es37.js +24 -14
  38. package/dist/bundle.es38.js +39 -14
  39. package/dist/bundle.es39.js +20 -68
  40. package/dist/bundle.es40.js +5 -68
  41. package/dist/bundle.es41.js +13 -31
  42. package/dist/bundle.es42.js +14 -68
  43. package/dist/bundle.es43.js +66 -39
  44. package/dist/bundle.es44.js +67 -30
  45. package/dist/bundle.es45.js +69 -74
  46. package/dist/bundle.es46.js +10 -48
  47. package/dist/bundle.es47.js +45 -0
  48. package/dist/bundle.es48.js +34 -0
  49. package/dist/bundle.es49.js +70 -0
  50. package/dist/bundle.es50.js +77 -0
  51. package/dist/bundle.es51.js +51 -0
  52. package/dist/bundle.es52.js +16 -0
  53. package/dist/bundle.es53.js +45 -0
  54. package/dist/bundle.es54.js +16 -0
  55. package/dist/bundle.es8.js +54 -62
  56. package/dist/bundle.es9.js +35 -70
  57. package/dist/index.d.ts +4 -2
  58. package/dist/index.scss +2 -2
  59. package/dist/types.d.ts +4 -0
  60. package/package.json +2 -3
@@ -1,114 +1,122 @@
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 { Input as Y } from "./bundle.es9.js";
4
- import { faClose as E, faChevronDown as S } from "@fortawesome/free-solid-svg-icons";
5
- import { Icon as k } from "./bundle.es35.js";
6
- import { useState as _, useRef as q } from "react";
7
- import { Calendar as G } from "./bundle.es39.js";
8
- import { useDayDisableCheker as H } from "./bundle.es40.js";
9
- import { formatTime as y, getNum as d } from "@companix/utils-js";
10
- const h = (t, i = "-") => {
11
- if (t) {
12
- const n = y(t.getDate()), r = y(t.getMonth() + 1), s = t.getFullYear();
13
- return [n, r, s].join(i);
14
- }
15
- return "";
16
- }, F = (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;
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { Popover as x } from "./bundle.es6.js";
3
+ import { Input as A } from "./bundle.es9.js";
4
+ import { useState as M, useRef as j } from "react";
5
+ import { Calendar as E } from "./bundle.es43.js";
6
+ import { useDayDisableCheker as N } from "./bundle.es44.js";
7
+ import { getNum as f, formatTime as v } from "@companix/utils-js";
8
+ import { removeDigits as O } from "./bundle.es45.js";
9
+ import { SelectRightElements as Y } from "./bundle.es46.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] = [f(n[0]), f(n[1]), f(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
+ }
24
28
  }
29
+ return null;
25
30
  }
26
- return null;
27
- }, te = (t) => {
31
+ }, U = (e) => {
28
32
  const {
29
- minimalOptions: i,
30
33
  clearButton: n,
31
34
  clearButtonIcon: r,
32
- children: s,
35
+ children: l,
33
36
  disabled: a,
34
37
  // calendar props
35
38
  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,
39
+ enableTime: y,
40
+ disablePickers: I,
41
+ showNeighboringMonth: P,
42
+ onChange: c,
43
+ shouldDisableDate: d,
44
+ viewDate: S,
45
+ disablePast: g,
46
+ disableFuture: D,
47
+ minDateTime: C,
48
+ maxDateTime: b,
46
49
  // input props
47
- ...T
48
- } = t, [m, c] = _(() => h(o ?? null)), p = q(null), I = 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 = F(e);
61
- f && !I(f) && u?.(f);
62
- }, j = () => {
63
- const e = F(m);
64
- (!e || I(e)) && c(h(o ?? null));
65
- }, M = (e) => {
66
- u?.(e), c(h(e));
50
+ ...V
51
+ } = e, [m, s] = M(() => i.toString(o ?? null)), p = j(null), k = N({
52
+ disableFuture: D,
53
+ disablePast: g,
54
+ shouldDisableDate: d,
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
+ }, R = (t) => {
62
+ s(t);
63
+ const h = i.toValue(t);
64
+ h && !k(h) && c?.(h);
65
+ }, T = () => {
66
+ const t = i.toValue(m);
67
+ (!t || k(t)) && s(i.toString(o ?? null));
68
+ }, w = (t) => {
69
+ c?.(t), s(i.toString(t));
67
70
  };
68
- return /* @__PURE__ */ l(
69
- z,
71
+ return /* @__PURE__ */ u(
72
+ x,
70
73
  {
71
74
  minimal: !0,
72
75
  ref: p,
73
76
  sideOffset: 0,
74
- onOpenAutoFocus: (e) => e.preventDefault(),
75
- onCloseAutoFocus: (e) => e.preventDefault(),
77
+ onOpenAutoFocus: (t) => t.preventDefault(),
78
+ onCloseAutoFocus: (t) => t.preventDefault(),
76
79
  disabled: a,
77
- content: () => /* @__PURE__ */ l(
78
- G,
80
+ content: () => /* @__PURE__ */ u(
81
+ E,
79
82
  {
80
83
  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
84
+ disablePast: g,
85
+ disableFuture: D,
86
+ enableTime: y,
87
+ disablePickers: I,
88
+ showNeighboringMonth: P,
89
+ onChange: w,
90
+ shouldDisableDate: d,
91
+ viewDate: S,
92
+ minDateTime: C,
93
+ maxDateTime: b
91
94
  }
92
95
  ),
93
- children: /* @__PURE__ */ l(
94
- Y,
96
+ children: /* @__PURE__ */ u(
97
+ A,
95
98
  {
96
- ...T,
99
+ ...V,
97
100
  value: m,
98
101
  disabled: a,
99
- onClick: w,
100
- onValueChange: V,
101
- onBlur: j,
102
+ onClick: B,
103
+ onValueChange: R,
104
+ onBlur: T,
102
105
  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(k, { className: "select-close-icon", icon: E, size: "xxxs" }) }),
105
- /* @__PURE__ */ l(k, { className: "expand-icon select-expand", icon: S, size: "xxxs" })
106
- ] })
106
+ rightElement: /* @__PURE__ */ u(
107
+ Y,
108
+ {
109
+ clearButton: n,
110
+ clearButtonIcon: r,
111
+ value: !!O(m, ["-", "_"]),
112
+ onClear: F
113
+ }
114
+ )
107
115
  }
108
116
  )
109
117
  }
110
118
  );
111
- }, J = (t) => t.trim().replaceAll("-", "").replaceAll("_", "");
119
+ };
112
120
  export {
113
- te as DatePicker
121
+ U as DatePicker
114
122
  };
@@ -1,38 +1,76 @@
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,
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.es8.js";
4
+ import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es45.js";
5
+ import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es47.js";
6
+ const B = ({
7
+ min: o = j,
8
+ max: e = N,
6
9
  disabled: r,
7
- mimes: l,
8
- children: a,
9
- multiple: i,
10
- className: f
10
+ value: a,
11
+ noDaySelect: g,
12
+ noYearSelect: u,
13
+ onChange: l,
14
+ required: m,
15
+ size: i
11
16
  }) => {
12
- const e = p(null), u = (t) => {
13
- r || (t.target.files && n?.(Array.from(t.target.files)), e.current && (e.current.value = ""));
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);
14
27
  };
15
- return /* @__PURE__ */ c("label", { className: f, children: [
16
- a,
17
- /* @__PURE__ */ o(s, { asChild: !0, children: /* @__PURE__ */ o(
18
- "input",
28
+ return /* @__PURE__ */ D("div", { className: "data-input", children: [
29
+ !u && p.length > 0 && /* @__PURE__ */ h(
30
+ c,
19
31
  {
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
+ 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"
32
41
  }
33
- ) })
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
+ )
34
72
  ] });
35
73
  };
36
74
  export {
37
- d as FileOverlay
75
+ B as DateInput
38
76
  };
@@ -1,14 +1,38 @@
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 })
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 = ""));
14
+ };
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
+ ) })
10
34
  ] });
11
35
  };
12
36
  export {
13
- u as FormGroup
37
+ d as FileOverlay
14
38
  };
@@ -1,13 +1,14 @@
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 { 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
+ ] });
10
11
  };
11
12
  export {
12
- l as useLocalStorage
13
+ u as FormGroup
13
14
  };
@@ -1,27 +1,88 @@
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.es41.js";
5
- const h = (t = {}) => {
6
- const e = {
7
- emit: (r) => {
8
- console.error("uninitialized", r);
1
+ import { jsx as g } from "react/jsx-runtime";
2
+ import { useRef as _, useMemo as b, useState as P, useEffect as j } from "react";
3
+ import { getNum as v } from "@companix/utils-js";
4
+ import { getTimesOptions as D, getTimeValue as A, removeDigits as W, convertTimeToOption as q } from "./bundle.es45.js";
5
+ import { SelectRightElements as w } from "./bundle.es46.js";
6
+ import { Select as y } from "./bundle.es8.js";
7
+ import { Input as z } from "./bundle.es9.js";
8
+ const r = {
9
+ char: ":",
10
+ toString: (s) => s ? q(s, r.char) : "",
11
+ toValue: (s) => {
12
+ const n = s.split(r.char);
13
+ if (n.length === 2) {
14
+ const [e, i] = [v(n[0]), v(n[1])];
15
+ if (e !== null && i !== null && e < 24 && e >= 0 && i < 60 && i >= 0)
16
+ return { hours: e, minutes: i };
9
17
  }
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 });
18
+ return null;
19
+ }
20
+ }, U = (s) => {
21
+ const { value: n, onChange: e, clearButton: i, clearButtonIcon: I, disabled: a, ...T } = s, m = _(null), p = _(null), h = b(() => D(10), []), d = b(() => {
22
+ if (n && !n.minutes.toString().endsWith("0")) {
23
+ const t = n.hours * 6 + Math.trunc(n.minutes / 10), u = [...h];
24
+ return u.splice(t + 1, 0, A(n)), u;
22
25
  }
26
+ return h;
27
+ }, [h, n]), [o, l] = P(() => r.toString(n)), x = (t) => {
28
+ l(t);
29
+ const u = r.toValue(t);
30
+ u && e?.(u);
31
+ }, B = (t) => {
32
+ a || m.current && m.current.getAttribute("data-state") === "open" && t.preventDefault();
33
+ }, O = () => {
34
+ r.toValue(o) === null && l(r.toString(n ?? null));
35
+ }, R = (t) => {
36
+ e?.(r.toValue(t)), l(t);
37
+ }, k = (t) => {
38
+ t.stopPropagation(), l(""), e?.(null);
23
39
  };
40
+ return j(() => {
41
+ if (o && o !== "__:__") {
42
+ const [t, u] = o.split(":"), V = (c) => {
43
+ const [C, S] = c.split(""), [E, M] = [C === "_" ? "0" : C, S === "_" ? "0" : S];
44
+ return E + M;
45
+ }, N = [V(t), V(u)].join(":"), f = r.toValue(N);
46
+ if (f) {
47
+ const c = f.hours * 6 + Math.trunc(f.minutes / 10);
48
+ c !== -1 && p.current && p.current.scrollTo(c);
49
+ }
50
+ }
51
+ }, [d, o]), /* @__PURE__ */ g(
52
+ y,
53
+ {
54
+ minimalOptions: !0,
55
+ options: d,
56
+ onChange: R,
57
+ value: o,
58
+ popoverRef: m,
59
+ scrollRef: p,
60
+ disabled: a,
61
+ children: /* @__PURE__ */ g(
62
+ z,
63
+ {
64
+ ...T,
65
+ value: o,
66
+ disabled: a,
67
+ onClick: B,
68
+ onValueChange: x,
69
+ onBlur: O,
70
+ mask: "99:99",
71
+ placeholder: "00:00",
72
+ rightElement: /* @__PURE__ */ g(
73
+ w,
74
+ {
75
+ clearButton: i,
76
+ clearButtonIcon: I,
77
+ value: !!W(o, [":", "_"]),
78
+ onClear: k
79
+ }
80
+ )
81
+ }
82
+ )
83
+ }
84
+ );
24
85
  };
25
86
  export {
26
- h as createAlertAgent
87
+ U as TimePicker
27
88
  };
@@ -1,38 +1,13 @@
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.es42.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
- };
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];
35
10
  };
36
11
  export {
37
- f as createToaster
12
+ l as useLocalStorage
38
13
  };
@@ -1,26 +1,27 @@
1
- import { useRef as s, useCallback as c } from "react";
2
- const p = () => {
3
- const t = s(null), r = s({ cb: null }), i = c(() => {
4
- if (t.current && t.current.parentElement) {
5
- const e = t.current.parentElement, u = e.style.getPropertyValue("--radix-popper-anchor-width"), n = e.style.getPropertyValue("transform"), o = new MutationObserver(() => {
6
- e.style.transform !== n && e.style.setProperty("transform", n);
7
- });
8
- o.observe(e, {
9
- attributes: !0,
10
- attributeFilter: ["style"]
11
- }), r.current.cb = () => {
12
- o.disconnect();
13
- }, t.current.style.setProperty("--radix-popover-trigger-width", u);
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.es48.js";
5
+ const h = (t = {}) => {
6
+ const e = {
7
+ emit: (r) => {
8
+ console.error("uninitialized", r);
14
9
  }
15
- }, []), l = c(() => {
16
- r.current.cb && (r.current.cb(), r.current.cb = null);
17
- }, []);
10
+ };
18
11
  return {
19
- popoverRef: t,
20
- handleAnimationEnd: l,
21
- froozePopoverPosition: i
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
+ }
22
23
  };
23
24
  };
24
25
  export {
25
- p as useFroozeClosing
26
+ h as createAlertAgent
26
27
  };