@companix/uikit 0.0.84 → 0.0.85

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 (43) hide show
  1. package/dist/TextArea/index.d.ts +1 -1
  2. package/dist/bundle.es.js +43 -39
  3. package/dist/bundle.es12.js +4 -4
  4. package/dist/bundle.es13.js +3 -3
  5. package/dist/bundle.es14.js +2 -2
  6. package/dist/bundle.es16.js +1 -1
  7. package/dist/bundle.es2.js +1 -1
  8. package/dist/bundle.es21.js +1 -1
  9. package/dist/bundle.es22.js +1 -1
  10. package/dist/bundle.es23.js +1 -1
  11. package/dist/bundle.es24.js +1 -1
  12. package/dist/bundle.es25.js +1 -1
  13. package/dist/bundle.es27.js +23 -21
  14. package/dist/bundle.es28.js +1 -1
  15. package/dist/bundle.es29.js +1 -1
  16. package/dist/bundle.es32.js +1 -1
  17. package/dist/bundle.es37.js +1 -1
  18. package/dist/bundle.es42.js +12 -25
  19. package/dist/bundle.es43.js +13 -38
  20. package/dist/bundle.es44.js +24 -48
  21. package/dist/bundle.es45.js +36 -45
  22. package/dist/bundle.es46.js +50 -8
  23. package/dist/bundle.es47.js +47 -26
  24. package/dist/bundle.es48.js +9 -5
  25. package/dist/bundle.es49.js +26 -24
  26. package/dist/bundle.es50.js +5 -23
  27. package/dist/bundle.es51.js +24 -23
  28. package/dist/bundle.es52.js +22 -87
  29. package/dist/bundle.es53.js +23 -17
  30. package/dist/bundle.es54.js +87 -92
  31. package/dist/bundle.es55.js +17 -73
  32. package/dist/bundle.es56.js +92 -23
  33. package/dist/bundle.es57.js +73 -38
  34. package/dist/bundle.es58.js +24 -14
  35. package/dist/bundle.es59.js +39 -14
  36. package/dist/bundle.es60.js +1 -1
  37. package/dist/bundle.es63.js +1 -1
  38. package/dist/bundle.es66.js +1 -1
  39. package/dist/bundle.es67.js +1 -1
  40. package/dist/bundle.es68.js +1 -1
  41. package/dist/bundle.es9.js +1 -1
  42. package/dist/index.d.ts +3 -0
  43. package/package.json +1 -1
@@ -4,4 +4,4 @@ export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextArea
4
4
  fill?: boolean;
5
5
  textAreaRef?: React.Ref<HTMLTextAreaElement>;
6
6
  }
7
- export declare const TextArea: ({ onResize, grow, value, onChange, disabled, required, rows, fill, textAreaRef, ...textAreaProps }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const TextArea: ({ onResize, grow, value, onChange, disabled, required, rows, fill, textAreaRef, className, ...textAreaProps }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
package/dist/bundle.es.js CHANGED
@@ -4,18 +4,18 @@ import { Button as x } from "./bundle.es4.js";
4
4
  import { ButtonGroup as a } from "./bundle.es5.js";
5
5
  import { Spinner as l } from "./bundle.es6.js";
6
6
  import { Scrollable as n } from "./bundle.es7.js";
7
- import { ImitateScroll as s } from "./bundle.es8.js";
7
+ import { ImitateScroll as S } from "./bundle.es8.js";
8
8
  import { Segments as g } from "./bundle.es9.js";
9
9
  import { Popover as h } from "./bundle.es10.js";
10
10
  import { Tooltip as v } from "./bundle.es11.js";
11
- import { Select as B } from "./bundle.es12.js";
12
- import { SelectTags as R } from "./bundle.es13.js";
11
+ import { Select as R } from "./bundle.es12.js";
12
+ import { SelectTags as B } from "./bundle.es13.js";
13
13
  import { Input as k } from "./bundle.es14.js";
14
- import { OptionItem as b } from "./bundle.es15.js";
15
- import { NumberInput as L } from "./bundle.es16.js";
14
+ import { OptionItem as L } from "./bundle.es15.js";
15
+ import { NumberInput as w } from "./bundle.es16.js";
16
16
  import { OptionsList as C } from "./bundle.es17.js";
17
17
  import { Checkbox as O } from "./bundle.es18.js";
18
- import { Switch as z } from "./bundle.es19.js";
18
+ import { Switch as F } from "./bundle.es19.js";
19
19
  import { Radio as j, RadioGroup as q } from "./bundle.es20.js";
20
20
  import { Drawer as H } from "./bundle.es21.js";
21
21
  import { Dialog as K } from "./bundle.es22.js";
@@ -30,21 +30,23 @@ import { FileOverlay as mo } from "./bundle.es30.js";
30
30
  import { FormGroup as fo } from "./bundle.es31.js";
31
31
  import { TimePicker as io } from "./bundle.es32.js";
32
32
  import { Icon as co } from "./bundle.es33.js";
33
- import { ProgressBar as So } from "./bundle.es34.js";
33
+ import { ProgressBar as so } from "./bundle.es34.js";
34
34
  import { Skeleton as uo } from "./bundle.es35.js";
35
35
  import { Blank as To } from "./bundle.es36.js";
36
36
  import { ProgressRing as Po } from "./bundle.es37.js";
37
- import { ThemeProvider as Do, useTheme as Bo } from "./bundle.es38.js";
38
- import { ColorSchemeScript as Ro, colorSchemeScript as ko } from "./bundle.es39.js";
39
- import { useLocalStorage as bo } from "./bundle.es40.js";
40
- import { useBooleanState as Lo } from "./bundle.es41.js";
41
- import { createAlertAgent as Co } from "./bundle.es42.js";
42
- import { createToaster as Oo } from "./bundle.es43.js";
43
- import { Toast as zo } from "./bundle.es44.js";
44
- import { DialogShell as jo, DrawerShell as qo, createPopupRegistry as Eo } from "./bundle.es45.js";
45
- import { createPopoversRegistry as Jo } from "./bundle.es46.js";
46
- import { createScope as Mo, createStaticScope as Qo } from "./bundle.es47.js";
47
- import { RemoveListener as Vo } from "./bundle.es48.js";
37
+ import { ThemeProvider as Do, useTheme as Ro } from "./bundle.es38.js";
38
+ import { ColorSchemeScript as Io, colorSchemeScript as ko } from "./bundle.es39.js";
39
+ import { useLocalStorage as Lo } from "./bundle.es40.js";
40
+ import { useBooleanState as wo } from "./bundle.es41.js";
41
+ import { useResizeTextarea as Co } from "./bundle.es42.js";
42
+ import { useLoading as Oo } from "./bundle.es43.js";
43
+ import { createAlertAgent as Fo } from "./bundle.es44.js";
44
+ import { createToaster as jo } from "./bundle.es45.js";
45
+ import { Toast as Eo } from "./bundle.es46.js";
46
+ import { DialogShell as Jo, DrawerShell as Ko, createPopupRegistry as Mo } from "./bundle.es47.js";
47
+ import { createPopoversRegistry as Uo } from "./bundle.es48.js";
48
+ import { createScope as Wo, createStaticScope as Xo } from "./bundle.es49.js";
49
+ import { RemoveListener as Zo } from "./bundle.es50.js";
48
50
  export {
49
51
  Q as AlertDialog,
50
52
  e as Avatar,
@@ -52,51 +54,53 @@ export {
52
54
  x as Button,
53
55
  a as ButtonGroup,
54
56
  O as Checkbox,
55
- Ro as ColorSchemeScript,
57
+ Io as ColorSchemeScript,
56
58
  Z as Countdown,
57
59
  to as DateInput,
58
60
  ro as DatePicker,
59
61
  K as Dialog,
60
- jo as DialogShell,
62
+ Jo as DialogShell,
61
63
  H as Drawer,
62
- qo as DrawerShell,
64
+ Ko as DrawerShell,
63
65
  mo as FileOverlay,
64
66
  fo as FormGroup,
65
67
  co as Icon,
66
- s as ImitateScroll,
68
+ S as ImitateScroll,
67
69
  k as Input,
68
70
  V as LoadingButton,
69
- L as NumberInput,
70
- b as OptionItem,
71
+ w as NumberInput,
72
+ L as OptionItem,
71
73
  C as OptionsList,
72
74
  h as Popover,
73
- So as ProgressBar,
75
+ so as ProgressBar,
74
76
  Po as ProgressRing,
75
77
  j as Radio,
76
78
  q as RadioGroup,
77
- Vo as RemoveListener,
79
+ Zo as RemoveListener,
78
80
  n as Scrollable,
79
81
  g as Segments,
80
- B as Select,
81
- R as SelectTags,
82
+ R as Select,
83
+ B as SelectTags,
82
84
  uo as Skeleton,
83
85
  l as Spinner,
84
- z as Switch,
86
+ F as Switch,
85
87
  X as Tabs,
86
88
  $ as TextArea,
87
89
  Do as ThemeProvider,
88
90
  io as TimePicker,
89
- zo as Toast,
91
+ Eo as Toast,
90
92
  v as Tooltip,
91
93
  p as avatarSizes,
92
94
  ko as colorSchemeScript,
93
- Co as createAlertAgent,
94
- Jo as createPopoversRegistry,
95
- Eo as createPopupRegistry,
96
- Mo as createScope,
97
- Qo as createStaticScope,
98
- Oo as createToaster,
99
- Lo as useBooleanState,
100
- bo as useLocalStorage,
101
- Bo as useTheme
95
+ Fo as createAlertAgent,
96
+ Uo as createPopoversRegistry,
97
+ Mo as createPopupRegistry,
98
+ Wo as createScope,
99
+ Xo as createStaticScope,
100
+ jo as createToaster,
101
+ wo as useBooleanState,
102
+ Oo as useLoading,
103
+ Lo as useLocalStorage,
104
+ Co as useResizeTextarea,
105
+ Ro as useTheme
102
106
  };
@@ -1,10 +1,10 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  import { useRef as L, useMemo as j, useImperativeHandle as k } from "react";
3
3
  import { Popover as q } from "./bundle.es10.js";
4
- import { useFroozeClosing as w } from "./bundle.es51.js";
5
- import { SelectInput as H } from "./bundle.es52.js";
6
- import { useScrollListController as M } from "./bundle.es53.js";
7
- import { OptionsPopover as N } from "./bundle.es54.js";
4
+ import { useFroozeClosing as w } from "./bundle.es53.js";
5
+ import { SelectInput as H } from "./bundle.es54.js";
6
+ import { useScrollListController as M } from "./bundle.es55.js";
7
+ import { OptionsPopover as N } from "./bundle.es56.js";
8
8
  import { mergeRefs as W } from "react-merge-refs";
9
9
  const Z = (t) => {
10
10
  const {
@@ -3,12 +3,12 @@ import { mergeRefs as T } from "react-merge-refs";
3
3
  import { useState as M, useRef as h, useMemo as j } from "react";
4
4
  import { matchPattern as q } from "@companix/utils-js";
5
5
  import { faXmark as V, faChevronDown as $ } from "@companix/icons-solid";
6
- import { useFroozeClosing as B } from "./bundle.es51.js";
6
+ import { useFroozeClosing as B } from "./bundle.es53.js";
7
7
  import { Popover as L } from "./bundle.es10.js";
8
8
  import { Icon as g } from "./bundle.es33.js";
9
9
  import { attr as l, getActiveElementByAnotherElement as X, contains as G } from "@companix/utils-browser";
10
- import { OptionsPopover as H } from "./bundle.es54.js";
11
- import { arrays as v } from "./bundle.es55.js";
10
+ import { OptionsPopover as H } from "./bundle.es56.js";
11
+ import { arrays as v } from "./bundle.es57.js";
12
12
  const ne = (r) => {
13
13
  const {
14
14
  closeAfterSelect: C,
@@ -1,8 +1,8 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { forwardRef as b, useRef as R } from "react";
3
3
  import { mergeRefs as c } from "react-merge-refs";
4
- import { InputElement as x } from "./bundle.es56.js";
5
- import { InputContainer as I } from "./bundle.es57.js";
4
+ import { InputElement as x } from "./bundle.es58.js";
5
+ import { InputContainer as I } from "./bundle.es59.js";
6
6
  import g from "classnames";
7
7
  const N = b(
8
8
  ({
@@ -2,7 +2,7 @@ import { jsx as t } from "react/jsx-runtime";
2
2
  import C from "classnames";
3
3
  import { forwardRef as j, useRef as w } from "react";
4
4
  import { mergeRefs as y } from "react-merge-refs";
5
- import { InputContainer as F } from "./bundle.es57.js";
5
+ import { InputContainer as F } from "./bundle.es59.js";
6
6
  import { NumericFormat as V } from "react-number-format";
7
7
  const D = j(
8
8
  ({
@@ -1,6 +1,6 @@
1
1
  import { jsxs as I, jsx as a } from "react/jsx-runtime";
2
2
  import { box as g } from "@companix/utils-browser";
3
- import { getInitialsFontSize as h } from "./bundle.es49.js";
3
+ import { getInitialsFontSize as h } from "./bundle.es51.js";
4
4
  const k = 24, y = ({
5
5
  alt: n,
6
6
  crossOrigin: i,
@@ -3,7 +3,7 @@ import d from "classnames";
3
3
  import * as e from "@radix-ui/react-dialog";
4
4
  import { VisuallyHidden as i } from "@radix-ui/react-visually-hidden";
5
5
  import { customCSS as p } from "@companix/utils-browser";
6
- import { RemoveListener as f } from "./bundle.es48.js";
6
+ import { RemoveListener as f } from "./bundle.es50.js";
7
7
  const h = ({
8
8
  open: t,
9
9
  onClosed: l,
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
2
  import f from "classnames";
3
3
  import * as o from "@radix-ui/react-dialog";
4
4
  import { VisuallyHidden as a } from "@radix-ui/react-visually-hidden";
5
- import { RemoveListener as v } from "./bundle.es48.js";
5
+ import { RemoveListener as v } from "./bundle.es50.js";
6
6
  const g = (l) => {
7
7
  const { size: n = "s", open: r, onOpenChange: s, children: c, onClosed: t, disableEsc: p, className: d } = l, m = (h) => {
8
8
  p && h.preventDefault();
@@ -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.es4.js";
4
- import { RemoveListener as N } from "./bundle.es48.js";
4
+ import { RemoveListener as N } from "./bundle.es50.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.es4.js";
3
- import { useLoading as p } from "./bundle.es58.js";
3
+ import { useLoading as p } from "./bundle.es43.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,5 +1,5 @@
1
1
  import { jsx as a, jsxs as d } from "react/jsx-runtime";
2
- import { useTabSlider as b, makeTabId as l } from "./bundle.es50.js";
2
+ import { useTabSlider as b, makeTabId as l } from "./bundle.es52.js";
3
3
  import * as n from "@radix-ui/react-tabs";
4
4
  import { useRef as m, useId as f, createContext as T, useContext as c } from "react";
5
5
  const o = T({ baseId: "", containerRef: {} }), u = ({ children: s, value: e, onChange: r }) => {
@@ -1,38 +1,40 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { useResizeTextarea as x } from "./bundle.es59.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,
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import u from "classnames";
3
+ import { useResizeTextarea as z } from "./bundle.es42.js";
4
+ import { attr as e, callMultiple as R } from "@companix/utils-browser";
5
+ import { useEffect as T } from "react";
6
+ import { mergeRefs as g } from "react-merge-refs";
7
+ const E = ({
8
+ onResize: f,
9
+ grow: t = !1,
10
+ value: a,
11
+ onChange: i,
11
12
  disabled: o,
12
- required: i,
13
+ required: s,
13
14
  rows: l = 2,
14
15
  fill: p = !1,
15
16
  textAreaRef: c,
17
+ className: n,
16
18
  ...d
17
19
  }) => {
18
- const [n, r] = x(m, a);
19
- return z(r, [r, t]), /* @__PURE__ */ f(
20
+ const [x, r] = z(f, t);
21
+ return T(r, [r, a]), /* @__PURE__ */ m(
20
22
  "div",
21
23
  {
22
24
  className: "form form-textarea",
23
- "data-required": e(i),
25
+ "data-required": e(s),
24
26
  "data-disabled": e(o),
25
27
  "data-fill": e(p),
26
- children: /* @__PURE__ */ f(
28
+ children: /* @__PURE__ */ m(
27
29
  "textarea",
28
30
  {
29
- className: "form-input",
30
- "data-grow": e(a),
31
- value: t,
32
- ref: R([c, n]),
31
+ className: u("form-input", n),
32
+ "data-grow": e(t),
33
+ value: a,
34
+ ref: g([c, x]),
33
35
  rows: l,
34
36
  disabled: o,
35
- onChange: u(s, r),
37
+ onChange: R(i, r),
36
38
  ...d
37
39
  }
38
40
  )
@@ -40,5 +42,5 @@ const q = ({
40
42
  );
41
43
  };
42
44
  export {
43
- q as TextArea
45
+ E as TextArea
44
46
  };
@@ -5,7 +5,7 @@ import { useState as A, useRef as j } from "react";
5
5
  import { Calendar as E } from "./bundle.es60.js";
6
6
  import { useDayDisableCheker as N } from "./bundle.es61.js";
7
7
  import { getNum as h, formatTime as v } from "@companix/utils-js";
8
- import { removeDigits as O } from "./bundle.es55.js";
8
+ import { removeDigits as O } from "./bundle.es57.js";
9
9
  import { SelectRightElements as Y } from "./bundle.es62.js";
10
10
  const i = {
11
11
  char: "-",
@@ -1,7 +1,7 @@
1
1
  import { jsxs as D, jsx as h } from "react/jsx-runtime";
2
2
  import { useMemo as M, useEffect as C } from "react";
3
3
  import { Select as c } from "./bundle.es12.js";
4
- import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es55.js";
4
+ import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es57.js";
5
5
  import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es63.js";
6
6
  const B = ({
7
7
  min: o = j,
@@ -1,7 +1,7 @@
1
1
  import { jsx as g } from "react/jsx-runtime";
2
2
  import { useRef as b, useMemo as I, useState as E, useCallback as A } from "react";
3
3
  import { getNum as S } from "@companix/utils-js";
4
- import { getTimesOptions as W, getTimeValue as q, removeDigits as w, convertTimeToOption as y } from "./bundle.es55.js";
4
+ import { getTimesOptions as W, getTimeValue as q, removeDigits as w, convertTimeToOption as y } from "./bundle.es57.js";
5
5
  import { SelectRightElements as z } from "./bundle.es62.js";
6
6
  import { Select as F } from "./bundle.es12.js";
7
7
  import { Input as G } from "./bundle.es14.js";
@@ -1,5 +1,5 @@
1
1
  import { jsxs as e, jsx as s } from "react/jsx-runtime";
2
- import { getInitialsFontSize as l } from "./bundle.es49.js";
2
+ import { getInitialsFontSize as l } from "./bundle.es51.js";
3
3
  import { clamp as i, customCSS as m, px as n } from "@companix/utils-browser";
4
4
  const u = ({
5
5
  appearance: o = "primary",
@@ -1,29 +1,16 @@
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 p } from "./bundle.es65.js";
5
- const a = (t = {}) => {
6
- const e = {
7
- emit: (r) => {
8
- console.error("uninitialized", r);
9
- }
10
- };
11
- return {
12
- api: {
13
- show: (r) => {
14
- e.emit({ ...r, id: m() });
15
- }
1
+ import { useRef as i, useCallback as o } from "react";
2
+ const f = (e, s) => {
3
+ const r = i(null), c = i(void 0), n = o(
4
+ (t) => {
5
+ s && t.offsetParent && (t.style.height = "", t.style.height = `${t.scrollHeight}px`, t.scrollHeight !== c.current && e && (e(t), c.current = t.scrollHeight));
16
6
  },
17
- Viewport: () => {
18
- const r = n(null);
19
- return s(() => {
20
- e.emit = (o) => {
21
- r.current && r.current.showAlert(o);
22
- };
23
- }, []), /* @__PURE__ */ i(p, { ref: r, ...t });
24
- }
25
- };
7
+ [s, e]
8
+ ), l = o(() => {
9
+ const t = r.current;
10
+ t && n(t);
11
+ }, [r, n]);
12
+ return [r, l];
26
13
  };
27
14
  export {
28
- a as createAlertAgent
15
+ f as useResizeTextarea
29
16
  };
@@ -1,41 +1,16 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { hash as r } from "@companix/utils-js";
3
- import { Viewport as a } from "./bundle.es66.js";
4
- import { useRef as c, useMemo as h } from "react";
5
- const m = (i = {}) => {
6
- const o = {
7
- showToast: (e) => {
8
- console.error("uninitialized", e);
9
- }
10
- };
11
- return {
12
- api: {
13
- show: (e) => {
14
- const n = e.id ?? r();
15
- return o.showToast({ ...e, id: n }), n;
16
- }
17
- },
18
- Viewport: (e = {}) => {
19
- const n = c(null);
20
- return h(() => {
21
- o.showToast = (s) => {
22
- n.current && n.current.showToast(s);
23
- };
24
- }, []), /* @__PURE__ */ t(
25
- a,
26
- {
27
- ref: n,
28
- align: e.align ?? i.align,
29
- closeIcon: e.closeIcon ?? i.closeIcon,
30
- duration: e.duration ?? i.duration,
31
- gap: e.gap ?? i.gap,
32
- side: e.side ?? i.side,
33
- swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
34
- }
35
- );
36
- }
37
- };
1
+ import { useState as e } from "react";
2
+ const d = ({ onClick: t }) => {
3
+ const [a, s] = e({ isLoading: !1, isError: !1 });
4
+ return { ...a, handleClick: (r) => {
5
+ a.isLoading || t(() => {
6
+ s({ isLoading: !0, isError: !1 });
7
+ }, r).then(() => {
8
+ s({ isLoading: !1, isError: !1 });
9
+ }).catch(() => {
10
+ s({ isLoading: !1, isError: !0 });
11
+ });
12
+ } };
38
13
  };
39
14
  export {
40
- m as createToaster
15
+ d as useLoading
41
16
  };
@@ -1,53 +1,29 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import * as t from "@radix-ui/react-toast";
3
- import { attr as T } from "@companix/utils-browser";
4
- import { useState as d, useRef as b, useEffect as j, useLayoutEffect as E } from "react";
5
- import { RemoveListener as I } from "./bundle.es48.js";
6
- const m = (o) => {
7
- const [r, u] = d(!0), [p, f] = d(!1), s = b(null), {
8
- appearance: C = "neutral",
9
- icon: a,
10
- title: n,
11
- description: c,
12
- duration: L,
13
- closeIcon: h,
14
- onClosing: v,
15
- onClosed: N,
16
- closable: x = !0,
17
- onInitialized: g
18
- } = o;
19
- j(() => {
20
- f(!0);
21
- }, []), E(() => {
22
- s.current && g(s.current);
23
- }, []);
24
- const R = (i) => {
25
- i || v(), u(i);
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 p } from "./bundle.es65.js";
5
+ const a = (t = {}) => {
6
+ const e = {
7
+ emit: (r) => {
8
+ console.error("uninitialized", r);
9
+ }
26
10
  };
27
- return /* @__PURE__ */ l(
28
- t.Root,
29
- {
30
- ref: s,
31
- "data-expanded": !0,
32
- "data-appearance": C,
33
- "data-mounted": T(p),
34
- className: "toaster",
35
- open: r,
36
- onOpenChange: R,
37
- duration: L,
38
- children: [
39
- /* @__PURE__ */ e(I, { callback: N }),
40
- a && /* @__PURE__ */ e("div", { className: "toaster-icon", children: a }),
41
- /* @__PURE__ */ l("div", { className: "toaster-content", children: [
42
- n && /* @__PURE__ */ e(t.Title, { className: "toaster-title", children: n }),
43
- c && /* @__PURE__ */ e(t.Description, { className: "toaster-description", children: c })
44
- ] }),
45
- x && /* @__PURE__ */ e(m.Close, { className: "toaster-close toaster-close-placement", closeIcon: h })
46
- ]
11
+ return {
12
+ api: {
13
+ show: (r) => {
14
+ e.emit({ ...r, id: m() });
15
+ }
16
+ },
17
+ Viewport: () => {
18
+ const r = n(null);
19
+ return s(() => {
20
+ e.emit = (o) => {
21
+ r.current && r.current.showAlert(o);
22
+ };
23
+ }, []), /* @__PURE__ */ i(p, { ref: r, ...t });
47
24
  }
48
- );
25
+ };
49
26
  };
50
- m.Close = ({ closeIcon: o, className: r } = {}) => /* @__PURE__ */ e(t.Close, { className: r, children: o ?? /* @__PURE__ */ e("svg", { viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M2.96967 2.96967C3.26256 2.67678 3.73744 2.67678 4.03033 2.96967L8 6.939L11.9697 2.96967C12.2626 2.67678 12.7374 2.67678 13.0303 2.96967C13.3232 3.26256 13.3232 3.73744 13.0303 4.03033L9.061 8L13.0303 11.9697C13.2966 12.2359 13.3208 12.6526 13.1029 12.9462L13.0303 13.0303C12.7374 13.3232 12.2626 13.3232 11.9697 13.0303L8 9.061L4.03033 13.0303C3.73744 13.3232 3.26256 13.3232 2.96967 13.0303C2.67678 12.7374 2.67678 12.2626 2.96967 11.9697L6.939 8L2.96967 4.03033C2.7034 3.76406 2.6792 3.3474 2.89705 3.05379L2.96967 2.96967Z" }) }) });
51
27
  export {
52
- m as Toast
28
+ a as createAlertAgent
53
29
  };
@@ -1,50 +1,41 @@
1
- import { jsx as r, Fragment as h } from "react/jsx-runtime";
2
- import { useContext as C, createContext as x, useState as P, useEffect as g, useCallback as u } from "react";
3
- import { hash as v } from "@companix/utils-js";
4
- import { Dialog as w } from "./bundle.es22.js";
5
- import { Drawer as D } from "./bundle.es21.js";
6
- const j = (o) => {
7
- const t = {}, e = {}, p = [], c = v();
8
- for (const n in o)
9
- t[n] = () => {
10
- }, e[n] = () => {
11
- }, p.push(() => /* @__PURE__ */ r(S, { Open: t, Close: e, name: n, Content: o[n] }));
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { hash as r } from "@companix/utils-js";
3
+ import { Viewport as a } from "./bundle.es66.js";
4
+ import { useRef as c, useMemo as h } from "react";
5
+ const m = (i = {}) => {
6
+ const o = {
7
+ showToast: (e) => {
8
+ console.error("uninitialized", e);
9
+ }
10
+ };
12
11
  return {
13
- Open: t,
14
- Close: e,
15
- Overlay: () => /* @__PURE__ */ r(h, { children: p.map((n, s) => /* @__PURE__ */ r(n, {}, `popup-${c}-${s}`)) })
12
+ api: {
13
+ show: (e) => {
14
+ const n = e.id ?? r();
15
+ return o.showToast({ ...e, id: n }), n;
16
+ }
17
+ },
18
+ Viewport: (e = {}) => {
19
+ const n = c(null);
20
+ return h(() => {
21
+ o.showToast = (s) => {
22
+ n.current && n.current.showToast(s);
23
+ };
24
+ }, []), /* @__PURE__ */ t(
25
+ a,
26
+ {
27
+ ref: n,
28
+ align: e.align ?? i.align,
29
+ closeIcon: e.closeIcon ?? i.closeIcon,
30
+ duration: e.duration ?? i.duration,
31
+ gap: e.gap ?? i.gap,
32
+ side: e.side ?? i.side,
33
+ swipeThreshold: e.swipeThreshold ?? i.swipeThreshold
34
+ }
35
+ );
36
+ }
16
37
  };
17
- }, S = ({ name: o, Open: t, Close: e, Content: p }) => {
18
- const [{ data: c, open: n }, s] = P({ data: null, open: !1 });
19
- g(() => {
20
- t[o] = (a) => {
21
- s({ data: a, open: !0 });
22
- }, e[o] = () => {
23
- n && l();
24
- };
25
- }, []);
26
- const l = u(() => {
27
- s(({ data: a }) => ({ data: a, open: !1 }));
28
- }, []), d = u(() => {
29
- s({ data: null, open: !1 });
30
- }, []), m = u((a) => {
31
- a || l();
32
- }, []);
33
- return c ? /* @__PURE__ */ r(i.Provider, { value: { open: n, onOpenChange: m, onClosed: d }, children: /* @__PURE__ */ r(p, { data: c, close: l }) }) : null;
34
- }, i = x(null), f = () => {
35
- const o = C(i);
36
- if (!o)
37
- throw new Error("Popup context not provided");
38
- return o;
39
- }, k = ({ children: o, ...t }) => {
40
- const e = f();
41
- return /* @__PURE__ */ r(w, { ...e, ...t, children: o });
42
- }, F = ({ children: o, ...t }) => {
43
- const e = f();
44
- return /* @__PURE__ */ r(D, { ...e, ...t, children: o });
45
38
  };
46
39
  export {
47
- k as DialogShell,
48
- F as DrawerShell,
49
- j as createPopupRegistry
40
+ m as createToaster
50
41
  };