@companix/uikit 0.0.11 → 0.0.14

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 (42) hide show
  1. package/dist/DatePicker/index.d.ts +0 -1
  2. package/dist/Input/index.d.ts +1 -1
  3. package/dist/Select/SelectInput.d.ts +1 -0
  4. package/dist/Select/index.d.ts +2 -5
  5. package/dist/SelectTags/index.d.ts +1 -0
  6. package/dist/TextArea/index.d.ts +2 -1
  7. package/dist/__hooks/use-loading.d.ts +2 -2
  8. package/dist/bundle.es.js +12 -10
  9. package/dist/bundle.es10.js +1 -1
  10. package/dist/bundle.es14.js +1 -1
  11. package/dist/bundle.es19.js +1 -1
  12. package/dist/bundle.es20.js +1 -1
  13. package/dist/bundle.es23.js +17 -15
  14. package/dist/bundle.es24.js +38 -36
  15. package/dist/bundle.es25.js +3 -3
  16. package/dist/bundle.es27.js +11 -10
  17. package/dist/bundle.es28.js +10 -24
  18. package/dist/bundle.es29.js +17 -28
  19. package/dist/bundle.es30.js +32 -20
  20. package/dist/bundle.es31.js +24 -81
  21. package/dist/bundle.es32.js +83 -18
  22. package/dist/bundle.es33.js +17 -13
  23. package/dist/bundle.es34.js +14 -22
  24. package/dist/bundle.es35.js +22 -5
  25. package/dist/bundle.es36.js +5 -21
  26. package/dist/bundle.es37.js +13 -13
  27. package/dist/bundle.es38.js +13 -69
  28. package/dist/bundle.es39.js +68 -66
  29. package/dist/bundle.es40.js +67 -31
  30. package/dist/bundle.es41.js +23 -59
  31. package/dist/bundle.es42.js +67 -30
  32. package/dist/bundle.es43.js +30 -74
  33. package/dist/bundle.es44.js +71 -45
  34. package/dist/bundle.es45.js +47 -41
  35. package/dist/bundle.es46.js +45 -0
  36. package/dist/bundle.es8.js +50 -54
  37. package/dist/bundle.es9.js +1 -1
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.scss +1 -1
  40. package/package.json +1 -1
  41. /package/dist/{FormLabel/FormLabel.scss → FormGroup/FormGroup.scss} +0 -0
  42. /package/dist/{FormLabel → FormGroup}/index.d.ts +0 -0
@@ -2,7 +2,6 @@ import { FormProps } from '../Input';
2
2
  import { CalendarProps } from './Calendar';
3
3
  interface DatePickerProps extends Omit<CalendarProps, 'onChange'>, Omit<FormProps, 'value' | 'onChange' | 'rightElement'> {
4
4
  onChange?: (value: Date | null) => void;
5
- placeholder?: string;
6
5
  clearButton?: boolean;
7
6
  clearButtonIcon?: boolean;
8
7
  children?: React.ReactNode;
@@ -8,7 +8,7 @@ export interface FormProps extends React.HTMLAttributes<HTMLDivElement> {
8
8
  readOnly?: boolean;
9
9
  onValueChange?: (value: string, targetElement: HTMLInputElement) => void;
10
10
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
11
- inputRef?: React.RefObject<HTMLInputElement>;
11
+ inputRef?: React.Ref<HTMLInputElement>;
12
12
  size?: 'sm' | 'md' | 'lg';
13
13
  fill?: boolean;
14
14
  mask?: string;
@@ -9,6 +9,7 @@ export interface SelectFormProps extends React.HTMLAttributes<HTMLDivElement> {
9
9
  fill?: boolean;
10
10
  clearButton?: boolean;
11
11
  clearButtonIcon?: boolean;
12
+ inputRef?: React.Ref<HTMLInputElement>;
12
13
  onClear?: (event: React.MouseEvent<HTMLButtonElement>) => void;
13
14
  }
14
15
  export declare const SelectInput: import('react').ForwardRefExoticComponent<SelectFormProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,11 +1,8 @@
1
- import { FormProps } from '../Input';
2
1
  import { Option } from '../types';
3
- interface SelectProps<T> extends Omit<FormProps, 'value' | 'onChange' | 'rightElement'> {
2
+ import { SelectFormProps } from './SelectInput';
3
+ interface SelectProps<T> extends Omit<SelectFormProps, 'value' | 'onChange'> {
4
4
  options: Option<T>[];
5
5
  onChange: (event: T | null) => void;
6
- placeholder?: string;
7
- clearButton?: boolean;
8
- clearButtonIcon?: boolean;
9
6
  value: T | null;
10
7
  children?: React.ReactNode;
11
8
  minimalOptions?: boolean;
@@ -11,5 +11,6 @@ export interface SelectTagsProps<T> {
11
11
  emptyText?: string;
12
12
  size?: 'sm' | 'md' | 'lg';
13
13
  fill?: boolean;
14
+ inputRef?: React.Ref<HTMLInputElement>;
14
15
  }
15
16
  export declare const SelectTags: <T extends string | number>(props: SelectTagsProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,7 @@ interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement
2
2
  grow?: boolean;
3
3
  onResize?: (el: HTMLTextAreaElement) => void;
4
4
  fill?: boolean;
5
+ textAreaRef?: React.Ref<HTMLTextAreaElement>;
5
6
  }
6
- export declare const TextArea: ({ onResize, grow, value, onChange, disabled, required, rows, fill, ...textAreaProps }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const TextArea: ({ onResize, grow, value, onChange, disabled, required, rows, fill, textAreaRef, ...textAreaProps }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -1,8 +1,8 @@
1
1
  export interface UseLoadingProps<T = unknown> {
2
- onClick: (startLoad: () => void, param: T) => Promise<any>;
2
+ onClick: (startLoad: () => void, value: T) => Promise<any>;
3
3
  }
4
4
  export declare const useLoading: <T = unknown>({ onClick }: UseLoadingProps<T>) => {
5
- handleClick: (param: T) => void;
5
+ handleClick: (value: T) => void;
6
6
  isLoading: boolean;
7
7
  isError: boolean;
8
8
  };
package/dist/bundle.es.js CHANGED
@@ -13,8 +13,8 @@ import { ButtonGroup as B } from "./bundle.es13.js";
13
13
  import { Checkbox as O } from "./bundle.es14.js";
14
14
  import { Switch as k } from "./bundle.es15.js";
15
15
  import { Radio as C } from "./bundle.es16.js";
16
- import { Drawer as y } from "./bundle.es17.js";
17
- import { Dialog as G } from "./bundle.es18.js";
16
+ import { Drawer as G } from "./bundle.es17.js";
17
+ import { Dialog as y } from "./bundle.es18.js";
18
18
  import { AlertDialog as R } from "./bundle.es19.js";
19
19
  import { LoadButton as q } from "./bundle.es20.js";
20
20
  import { Tabs as E } from "./bundle.es21.js";
@@ -23,9 +23,10 @@ import { TextArea as M } from "./bundle.es23.js";
23
23
  import { SelectTags as U } from "./bundle.es24.js";
24
24
  import { DatePicker as W } from "./bundle.es25.js";
25
25
  import { FileOverlay as Y } from "./bundle.es26.js";
26
- import { useLocalStorage as _ } from "./bundle.es27.js";
27
- import { createAlertAgent as oo } from "./bundle.es28.js";
28
- import { createToaster as eo } from "./bundle.es29.js";
26
+ import { FormGroup as _ } from "./bundle.es27.js";
27
+ import { useLocalStorage as oo } from "./bundle.es28.js";
28
+ import { createAlertAgent as eo } from "./bundle.es29.js";
29
+ import { createToaster as po } from "./bundle.es30.js";
29
30
  export {
30
31
  R as AlertDialog,
31
32
  e as Button,
@@ -33,9 +34,10 @@ export {
33
34
  O as Checkbox,
34
35
  J as Countdown,
35
36
  W as DatePicker,
36
- G as Dialog,
37
- y as Drawer,
37
+ y as Dialog,
38
+ G as Drawer,
38
39
  Y as FileOverlay,
40
+ _ as FormGroup,
39
41
  a as ImitateScroll,
40
42
  g as Input,
41
43
  q as LoadButton,
@@ -52,7 +54,7 @@ export {
52
54
  E as Tabs,
53
55
  M as TextArea,
54
56
  c as Tooltip,
55
- oo as createAlertAgent,
56
- eo as createToaster,
57
- _ as useLocalStorage
57
+ eo as createAlertAgent,
58
+ po as createToaster,
59
+ oo as useLocalStorage
58
60
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
2
  import N from "classnames";
3
- import { Icon as v } from "./bundle.es34.js";
3
+ import { Icon as v } from "./bundle.es35.js";
4
4
  import { attr as t } from "@companix/utils-browser";
5
5
  import { forwardRef as k } from "react";
6
6
  import { faCheck as x } from "@fortawesome/free-solid-svg-icons";
@@ -1,6 +1,6 @@
1
1
  import { jsxs as x, jsx as o } from "react/jsx-runtime";
2
2
  import * as t from "@radix-ui/react-checkbox";
3
- import { Icon as h } from "./bundle.es34.js";
3
+ import { Icon as h } from "./bundle.es35.js";
4
4
  import { faCheck as l } from "@fortawesome/free-solid-svg-icons";
5
5
  import { useId as n } from "react";
6
6
  import { attr as c } from "@companix/utils-browser";
@@ -1,7 +1,7 @@
1
1
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
2
  import * as r from "@radix-ui/react-alert-dialog";
3
3
  import { Button as c } from "./bundle.es2.js";
4
- import { RemoveListener as N } from "./bundle.es35.js";
4
+ import { RemoveListener as N } from "./bundle.es36.js";
5
5
  import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
6
6
  const C = ({
7
7
  open: d,
@@ -1,6 +1,6 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { Button as m } from "./bundle.es2.js";
3
- import { useLoading as p } from "./bundle.es36.js";
3
+ import { useLoading as p } from "./bundle.es37.js";
4
4
  const g = ({ onClick: o, appearance: r = "primary", ...i }) => {
5
5
  const { isLoading: n, isError: t, handleClick: a } = p({ onClick: o });
6
6
  return /* @__PURE__ */ e(
@@ -1,36 +1,38 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { useResizeTextarea as p } from "./bundle.es37.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,
2
+ import { useResizeTextarea as x } from "./bundle.es38.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,
7
8
  grow: a = !1,
8
9
  value: t,
9
- onChange: i,
10
+ onChange: s,
10
11
  disabled: o,
11
- required: m,
12
+ required: i,
12
13
  rows: l = 2,
13
- fill: c = !1,
14
+ fill: p = !1,
15
+ textAreaRef: c,
14
16
  ...d
15
17
  }) => {
16
- const [n, r] = p(s, a);
17
- return u(r, [r, t]), /* @__PURE__ */ f(
18
+ const [n, r] = x(m, a);
19
+ return z(r, [r, t]), /* @__PURE__ */ f(
18
20
  "div",
19
21
  {
20
22
  className: "form form-textarea",
21
- "data-required": e(m),
23
+ "data-required": e(i),
22
24
  "data-disabled": e(o),
23
- "data-fill": e(c),
25
+ "data-fill": e(p),
24
26
  children: /* @__PURE__ */ f(
25
27
  "textarea",
26
28
  {
27
29
  className: "form-input",
28
30
  "data-grow": e(a),
29
31
  value: t,
30
- ref: n,
32
+ ref: R([c, n]),
31
33
  rows: l,
32
34
  disabled: o,
33
- onChange: x(i, r),
35
+ onChange: u(s, r),
34
36
  ...d
35
37
  }
36
38
  )
@@ -38,5 +40,5 @@ const R = ({
38
40
  );
39
41
  };
40
42
  export {
41
- R as TextArea
43
+ q as TextArea
42
44
  };
@@ -1,13 +1,14 @@
1
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) => {
2
+ import { useFroozeClosing as F } from "./bundle.es31.js";
3
+ import { Popover as L } from "./bundle.es6.js";
4
+ import { OptionItem as M } from "./bundle.es10.js";
5
+ import { OptionsList as j } from "./bundle.es12.js";
6
+ import { useState as V, useRef as d, useMemo as h } from "react";
7
+ import { Icon as g } from "./bundle.es35.js";
8
+ import { faClose as B, faChevronDown as H } from "@fortawesome/free-solid-svg-icons";
9
+ import { attr as Q, getActiveElementByAnotherElement as q, contains as G } from "@companix/utils-browser";
10
+ import { mergeRefs as J } from "react-merge-refs";
11
+ const ne = (v) => {
11
12
  const {
12
13
  options: r,
13
14
  closeAfterSelect: x,
@@ -15,46 +16,47 @@ const ee = (v) => {
15
16
  onChange: l,
16
17
  emptyText: N = "Ничего не найдено",
17
18
  readOnly: m,
18
- size: z = "md",
19
+ size: R = "md",
19
20
  value: n,
21
+ inputRef: z,
20
22
  disabled: f
21
- } = v, [a, A] = j(""), i = d(null), y = d(null), { popoverRef: u, froozePopoverPosition: D, handleAnimationEnd: R } = F(), b = h(() => {
23
+ } = v, [i, A] = V(""), a = d(null), y = d(null), { popoverRef: u, froozePopoverPosition: D, handleAnimationEnd: b } = F(), w = h(() => {
22
24
  const e = {};
23
25
  return r.forEach((t) => {
24
26
  e[t.value] = t;
25
27
  }), e;
26
- }, [r]), w = (e) => n.includes(e) ? [...n] : [...n, e], E = (e) => n.filter((t) => e !== t), O = (e, t) => {
28
+ }, [r]), E = (e) => n.includes(e) ? [...n] : [...n, e], O = (e) => n.filter((t) => e !== t), P = (e, t) => {
27
29
  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
+ }, p = h(() => i.trim() ? r.filter(({ title: e }) => {
31
+ const t = e.toLowerCase(), s = i.trim().toLowerCase();
30
32
  return t.indexOf(s) >= 0;
31
- }) : r, [a, r]), P = (e) => {
33
+ }) : r, [i, r]), T = (e) => {
32
34
  if (f) return;
33
35
  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));
36
+ const t = q(e.currentTarget);
37
+ e.defaultPrevented || G(e.currentTarget, t) || a.current && a.current.focus();
38
+ }, k = (e) => {
39
+ e.target !== a.current && e.preventDefault();
40
+ }, I = (e, t) => {
41
+ e.stopPropagation(), l(O(t));
40
42
  };
41
43
  return /* @__PURE__ */ o(
42
- I,
44
+ L,
43
45
  {
44
46
  minimal: !0,
45
47
  ref: u,
46
48
  sideOffset: 0,
47
49
  matchTarget: "width",
48
- onAnimationEnd: R,
50
+ onAnimationEnd: b,
49
51
  onOpenAutoFocus: (e) => e.preventDefault(),
50
52
  onCloseAutoFocus: (e) => e.preventDefault(),
51
- content: ({ close: e }) => /* @__PURE__ */ c(M, { maxHeight: 300, children: [
53
+ content: ({ close: e }) => /* @__PURE__ */ c(j, { maxHeight: 300, children: [
52
54
  p.length === 0 && /* @__PURE__ */ o("div", { className: "select-tags-empty", children: N }),
53
55
  p.map(({ value: t, title: s, icon: S }, $) => /* @__PURE__ */ o(
54
- L,
56
+ M,
55
57
  {
56
58
  active: n.includes(t),
57
- onClick: () => O(w(t), e),
59
+ onClick: () => P(E(t), e),
58
60
  title: s,
59
61
  icon: S
60
62
  },
@@ -65,9 +67,9 @@ const ee = (v) => {
65
67
  "div",
66
68
  {
67
69
  className: "form",
68
- onClick: P,
69
- onMouseDown: T,
70
- "data-size": z,
70
+ onClick: T,
71
+ onMouseDown: k,
72
+ "data-size": R,
71
73
  children: /* @__PURE__ */ c("div", { className: "select-tags-container", children: [
72
74
  /* @__PURE__ */ c("div", { className: "select-tags", children: [
73
75
  n.length > 0 && /* @__PURE__ */ o(
@@ -76,24 +78,24 @@ const ee = (v) => {
76
78
  className: "tag-container",
77
79
  ref: y,
78
80
  role: "listbox",
79
- "data-readonly": H(m),
81
+ "data-readonly": Q(m),
80
82
  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
+ /* @__PURE__ */ o("span", { className: "tag-name", children: w[e].title }),
84
+ /* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (s) => I(s, e), children: /* @__PURE__ */ o(g, { className: "tag-close-icon", icon: B, size: "xxxs" }) })
83
85
  ] }, `tag-option-${e}-${t}`))
84
86
  }
85
87
  ),
86
88
  (!m || n.length === 0) && /* @__PURE__ */ o(
87
89
  "input",
88
90
  {
89
- ref: i,
91
+ ref: J([z, a]),
90
92
  type: "text",
91
93
  autoCapitalize: "none",
92
94
  autoComplete: "off",
93
95
  autoCorrect: "off",
94
96
  className: "form-input",
95
97
  spellCheck: !1,
96
- value: a,
98
+ value: i,
97
99
  disabled: f,
98
100
  readOnly: m,
99
101
  placeholder: C,
@@ -101,7 +103,7 @@ const ee = (v) => {
101
103
  }
102
104
  )
103
105
  ] }),
104
- /* @__PURE__ */ o(g, { className: "expand-icon", icon: B, size: "xxxs" })
106
+ /* @__PURE__ */ o(g, { className: "expand-icon", icon: H, size: "xxxs" })
105
107
  ] })
106
108
  }
107
109
  )
@@ -109,5 +111,5 @@ const ee = (v) => {
109
111
  );
110
112
  };
111
113
  export {
112
- ee as SelectTags
114
+ ne as SelectTags
113
115
  };
@@ -2,10 +2,10 @@ import { jsx as l, jsxs as O, Fragment as R } from "react/jsx-runtime";
2
2
  import { Popover as z } from "./bundle.es6.js";
3
3
  import { Input as Y } from "./bundle.es9.js";
4
4
  import { faClose as E, faChevronDown as S } from "@fortawesome/free-solid-svg-icons";
5
- import { Icon as k } from "./bundle.es34.js";
5
+ import { Icon as k } from "./bundle.es35.js";
6
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";
7
+ import { Calendar as G } from "./bundle.es39.js";
8
+ import { useDayDisableCheker as H } from "./bundle.es40.js";
9
9
  import { formatTime as y, getNum as d } from "@companix/utils-js";
10
10
  const h = (t, i = "-") => {
11
11
  if (t) {
@@ -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,13 @@
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
- }
23
- };
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];
24
10
  };
25
11
  export {
26
- h as createAlertAgent
12
+ l as useLocalStorage
27
13
  };
@@ -1,38 +1,27 @@
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);
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);
9
9
  }
10
10
  };
11
11
  return {
12
- send: (e) => {
13
- t.emit({ ...e, id: d() });
12
+ show: (r) => {
13
+ e.emit({ ...r, id: m() });
14
14
  },
15
- Viewport: (e = {}) => {
16
- const n = c(null);
17
- return l(() => {
18
- t.emit = (r) => {
19
- n.current && n.current.addToast(r);
15
+ Viewport: () => {
16
+ const r = n(null);
17
+ return s(() => {
18
+ e.emit = (o) => {
19
+ r.current && r.current.showAlert(o);
20
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
- );
21
+ }, []), /* @__PURE__ */ i(u, { ref: r, ...t });
33
22
  }
34
23
  };
35
24
  };
36
25
  export {
37
- f as createToaster
26
+ h as createAlertAgent
38
27
  };
@@ -1,26 +1,38 @@
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 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);
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
+ 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
+ }
22
34
  };
23
35
  };
24
36
  export {
25
- p as useFroozeClosing
37
+ f as createToaster
26
38
  };