@companix/uikit 0.0.54 → 0.0.56

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 (55) hide show
  1. package/dist/Skeleton/Skeleton.scss +29 -0
  2. package/dist/Skeleton/index.d.ts +3 -0
  3. package/dist/__hooks/use-boolean-state.d.ts +5 -0
  4. package/dist/bundle.es.js +27 -23
  5. package/dist/bundle.es12.js +5 -5
  6. package/dist/bundle.es13.js +2 -2
  7. package/dist/bundle.es15.js +1 -1
  8. package/dist/bundle.es2.js +1 -1
  9. package/dist/bundle.es21.js +1 -1
  10. package/dist/bundle.es22.js +1 -1
  11. package/dist/bundle.es23.js +1 -1
  12. package/dist/bundle.es24.js +1 -1
  13. package/dist/bundle.es26.js +1 -1
  14. package/dist/bundle.es27.js +3 -3
  15. package/dist/bundle.es28.js +4 -4
  16. package/dist/bundle.es29.js +2 -2
  17. package/dist/bundle.es32.js +2 -2
  18. package/dist/bundle.es35.js +3 -35
  19. package/dist/bundle.es36.js +33 -20
  20. package/dist/bundle.es37.js +21 -10
  21. package/dist/bundle.es38.js +10 -26
  22. package/dist/bundle.es39.js +11 -38
  23. package/dist/bundle.es40.js +24 -48
  24. package/dist/bundle.es41.js +36 -40
  25. package/dist/bundle.es42.js +50 -8
  26. package/dist/bundle.es43.js +42 -24
  27. package/dist/bundle.es44.js +9 -23
  28. package/dist/bundle.es45.js +24 -23
  29. package/dist/bundle.es46.js +22 -86
  30. package/dist/bundle.es47.js +23 -17
  31. package/dist/bundle.es48.js +85 -42
  32. package/dist/bundle.es49.js +18 -4
  33. package/dist/bundle.es50.js +42 -22
  34. package/dist/bundle.es51.js +4 -39
  35. package/dist/bundle.es52.js +24 -5
  36. package/dist/bundle.es53.js +39 -14
  37. package/dist/bundle.es54.js +5 -14
  38. package/dist/bundle.es55.js +13 -69
  39. package/dist/bundle.es56.js +13 -67
  40. package/dist/bundle.es57.js +69 -69
  41. package/dist/bundle.es58.js +67 -10
  42. package/dist/bundle.es59.js +69 -42
  43. package/dist/bundle.es60.js +10 -14
  44. package/dist/bundle.es61.js +43 -32
  45. package/dist/bundle.es62.js +15 -70
  46. package/dist/bundle.es63.js +32 -14
  47. package/dist/bundle.es64.js +70 -75
  48. package/dist/bundle.es65.js +13 -48
  49. package/dist/bundle.es66.js +74 -13
  50. package/dist/bundle.es67.js +51 -0
  51. package/dist/bundle.es68.js +16 -0
  52. package/dist/bundle.es9.js +1 -1
  53. package/dist/index.d.ts +3 -0
  54. package/dist/index.scss +1 -0
  55. package/package.json +1 -1
@@ -0,0 +1,29 @@
1
+ @use '../mixins.scss';
2
+
3
+ .skeleton {
4
+ position: relative;
5
+ display: inline-flex;
6
+ width: 100%;
7
+ max-width: 100%;
8
+ overflow: hidden;
9
+ line-height: 1;
10
+ border-radius: 6px;
11
+ background-clip: padding-box !important;
12
+
13
+ animation-name: skeleton-glow;
14
+ animation-timing-function: linear;
15
+ animation-iteration-count: infinite;
16
+ animation-direction: alternate;
17
+ animation-duration: 750ms;
18
+
19
+ @include mixins.use-styles(skeleton);
20
+ }
21
+
22
+ @keyframes skeleton-glow {
23
+ from {
24
+ @include mixins.use-styles(skeleton);
25
+ }
26
+ to {
27
+ @include mixins.use-styles(skeleton, to);
28
+ }
29
+ }
@@ -0,0 +1,3 @@
1
+ export interface SkeletonProps extends Pick<React.CSSProperties, 'width' | 'height' | 'inlineSize' | 'blockSize' | 'maxWidth' | 'maxInlineSize' | 'borderRadius' | 'margin'> {
2
+ }
3
+ export declare const Skeleton: ({ ...styles }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ type SetTrue = () => void;
2
+ type SetFalse = () => void;
3
+ type Toggle = () => void;
4
+ export declare const useBooleanState: (defaultValue?: boolean) => [boolean, SetTrue, SetFalse, Toggle];
5
+ export {};
package/dist/bundle.es.js CHANGED
@@ -10,8 +10,8 @@ import { Popover as h } from "./bundle.es10.js";
10
10
  import { Tooltip as v } from "./bundle.es11.js";
11
11
  import { Select as P } from "./bundle.es12.js";
12
12
  import { Input as A } from "./bundle.es13.js";
13
- import { OptionItem as B } from "./bundle.es14.js";
14
- import { NumberInput as k } from "./bundle.es15.js";
13
+ import { OptionItem as b } from "./bundle.es14.js";
14
+ import { NumberInput as R } from "./bundle.es15.js";
15
15
  import { OptionsList as y } from "./bundle.es16.js";
16
16
  import { Checkbox as G } from "./bundle.es17.js";
17
17
  import { Switch as O } from "./bundle.es18.js";
@@ -31,26 +31,28 @@ 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
33
  import { ProgressBar as so } from "./bundle.es34.js";
34
- import { ThemeProvider as uo, useTheme as go } from "./bundle.es35.js";
35
- import { ColorSchemeScript as ho, colorSchemeScript as Do } from "./bundle.es36.js";
36
- import { useLocalStorage as Io } from "./bundle.es37.js";
37
- import { createAlertAgent as Ao } from "./bundle.es38.js";
38
- import { createToaster as Bo } from "./bundle.es39.js";
39
- import { Toast as ko } from "./bundle.es40.js";
40
- import { DialogShell as yo, createDialogsRegistry as Co } from "./bundle.es41.js";
41
- import { createPopoversRegistry as Lo } from "./bundle.es42.js";
34
+ import { Skeleton as uo } from "./bundle.es35.js";
35
+ import { ThemeProvider as To, useTheme as ho } from "./bundle.es36.js";
36
+ import { ColorSchemeScript as vo, colorSchemeScript as Io } from "./bundle.es37.js";
37
+ import { useLocalStorage as Ao } from "./bundle.es38.js";
38
+ import { useBooleanState as bo } from "./bundle.es39.js";
39
+ import { createAlertAgent as Ro } from "./bundle.es40.js";
40
+ import { createToaster as yo } from "./bundle.es41.js";
41
+ import { Toast as Go } from "./bundle.es42.js";
42
+ import { DialogShell as Oo, createDialogsRegistry as Fo } from "./bundle.es43.js";
43
+ import { createPopoversRegistry as No } from "./bundle.es44.js";
42
44
  export {
43
45
  K as AlertDialog,
44
46
  e as Avatar,
45
47
  x as Button,
46
48
  a as ButtonGroup,
47
49
  G as Checkbox,
48
- ho as ColorSchemeScript,
50
+ vo as ColorSchemeScript,
49
51
  X as Countdown,
50
52
  to as DateInput,
51
53
  ro as DatePicker,
52
54
  H as Dialog,
53
- yo as DialogShell,
55
+ Oo as DialogShell,
54
56
  q as Drawer,
55
57
  mo as FileOverlay,
56
58
  fo as FormGroup,
@@ -58,8 +60,8 @@ export {
58
60
  S as ImitateScroll,
59
61
  A as Input,
60
62
  Q as LoadingButton,
61
- k as NumberInput,
62
- B as OptionItem,
63
+ R as NumberInput,
64
+ b as OptionItem,
63
65
  y as OptionsList,
64
66
  h as Popover,
65
67
  so as ProgressBar,
@@ -69,20 +71,22 @@ export {
69
71
  g as Segments,
70
72
  P as Select,
71
73
  $ as SelectTags,
74
+ uo as Skeleton,
72
75
  l as Spinner,
73
76
  O as Switch,
74
77
  V as Tabs,
75
78
  Z as TextArea,
76
- uo as ThemeProvider,
79
+ To as ThemeProvider,
77
80
  io as TimePicker,
78
- ko as Toast,
81
+ Go as Toast,
79
82
  v as Tooltip,
80
83
  p as avatarSizes,
81
- Do as colorSchemeScript,
82
- Ao as createAlertAgent,
83
- Co as createDialogsRegistry,
84
- Lo as createPopoversRegistry,
85
- Bo as createToaster,
86
- Io as useLocalStorage,
87
- go as useTheme
84
+ Io as colorSchemeScript,
85
+ Ro as createAlertAgent,
86
+ Fo as createDialogsRegistry,
87
+ No as createPopoversRegistry,
88
+ yo as createToaster,
89
+ bo as useBooleanState,
90
+ Ao as useLocalStorage,
91
+ ho as useTheme
88
92
  };
@@ -1,12 +1,12 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { useMemo as I, useImperativeHandle as b } from "react";
3
3
  import { Popover as z } from "./bundle.es10.js";
4
- import { useFroozeClosing as B } from "./bundle.es45.js";
5
- import { SelectInput as D } from "./bundle.es46.js";
6
- import { useScrollListController as j } from "./bundle.es47.js";
7
- import { SelectOptionsList as w } from "./bundle.es48.js";
4
+ import { useFroozeClosing as B } from "./bundle.es47.js";
5
+ import { SelectInput as D } from "./bundle.es48.js";
6
+ import { useScrollListController as j } from "./bundle.es49.js";
7
+ import { SelectOptionsList as w } from "./bundle.es50.js";
8
8
  import { mergeRefs as y } from "react-merge-refs";
9
- import { SelectLoader as H } from "./bundle.es49.js";
9
+ import { SelectLoader as H } from "./bundle.es51.js";
10
10
  const U = (a) => {
11
11
  const {
12
12
  options: t,
@@ -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.es50.js";
5
- import { InputContainer as I } from "./bundle.es51.js";
4
+ import { InputElement as x } from "./bundle.es52.js";
5
+ import { InputContainer as I } from "./bundle.es53.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.es51.js";
5
+ import { InputContainer as F } from "./bundle.es53.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.es43.js";
3
+ import { getInitialsFontSize as h } from "./bundle.es45.js";
4
4
  const k = 24, y = ({
5
5
  alt: n,
6
6
  crossOrigin: i,
@@ -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.es52.js";
5
+ import { RemoveListener as v } from "./bundle.es54.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.es52.js";
4
+ import { RemoveListener as N } from "./bundle.es54.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.es53.js";
3
+ import { useLoading as p } from "./bundle.es55.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.es44.js";
2
+ import { useTabSlider as b, makeTabId as l } from "./bundle.es46.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,5 +1,5 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { useResizeTextarea as x } from "./bundle.es54.js";
2
+ import { useResizeTextarea as x } from "./bundle.es56.js";
3
3
  import { attr as e, callMultiple as u } from "@companix/utils-browser";
4
4
  import { useEffect as z } from "react";
5
5
  import { mergeRefs as R } from "react-merge-refs";
@@ -1,5 +1,5 @@
1
1
  import { jsx as o, jsxs as u } from "react/jsx-runtime";
2
- import { useFroozeClosing as q } from "./bundle.es45.js";
2
+ import { useFroozeClosing as q } from "./bundle.es47.js";
3
3
  import { Popover as V } from "./bundle.es10.js";
4
4
  import { useState as $, useRef as f, useMemo as p } from "react";
5
5
  import { Icon as d } from "./bundle.es33.js";
@@ -7,8 +7,8 @@ import { attr as h, getActiveElementByAnotherElement as B, contains as X } from
7
7
  import { mergeRefs as G } from "react-merge-refs";
8
8
  import { faXmark as H, faChevronDown as J } from "@companix/icons-solid";
9
9
  import { matchPattern as K } from "@companix/utils-js";
10
- import { SelectOptionsList as Q } from "./bundle.es48.js";
11
- import { SelectLoader as U } from "./bundle.es49.js";
10
+ import { SelectOptionsList as Q } from "./bundle.es50.js";
11
+ import { SelectLoader as U } from "./bundle.es51.js";
12
12
  const se = (g) => {
13
13
  const {
14
14
  options: r,
@@ -2,11 +2,11 @@ import { jsx as u } from "react/jsx-runtime";
2
2
  import { Popover as T } from "./bundle.es10.js";
3
3
  import { Input as w } from "./bundle.es13.js";
4
4
  import { useState as A, useRef as j } from "react";
5
- import { Calendar as E } from "./bundle.es55.js";
6
- import { useDayDisableCheker as N } from "./bundle.es56.js";
5
+ import { Calendar as E } from "./bundle.es57.js";
6
+ import { useDayDisableCheker as N } from "./bundle.es58.js";
7
7
  import { getNum as h, formatTime as v } from "@companix/utils-js";
8
- import { removeDigits as O } from "./bundle.es57.js";
9
- import { SelectRightElements as Y } from "./bundle.es58.js";
8
+ import { removeDigits as O } from "./bundle.es59.js";
9
+ import { SelectRightElements as Y } from "./bundle.es60.js";
10
10
  const i = {
11
11
  char: "-",
12
12
  toString: (e) => {
@@ -1,8 +1,8 @@
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.es57.js";
5
- import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es59.js";
4
+ import { createDateValidation as O, getMonthMaxDay as T } from "./bundle.es59.js";
5
+ import { defaultMin as j, defaultMax as N, useCalendarOptions as V } from "./bundle.es61.js";
6
6
  const B = ({
7
7
  min: o = j,
8
8
  max: e = N,
@@ -1,8 +1,8 @@
1
1
  import { jsx as g } from "react/jsx-runtime";
2
2
  import { useRef as _, useMemo as b, useState as P, useEffect as j } from "react";
3
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.es57.js";
5
- import { SelectRightElements as w } from "./bundle.es58.js";
4
+ import { getTimesOptions as D, getTimeValue as A, removeDigits as W, convertTimeToOption as q } from "./bundle.es59.js";
5
+ import { SelectRightElements as w } from "./bundle.es60.js";
6
6
  import { Select as y } from "./bundle.es12.js";
7
7
  import { Input as z } from "./bundle.es13.js";
8
8
  const r = {
@@ -1,37 +1,5 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { useState as h, useEffect as c, createContext as f, useContext as w } from "react";
3
- import { getColorScheme as v, updateDOM as m } from "./bundle.es60.js";
4
- const i = f({
5
- setColorScheme: () => {
6
- }
7
- }), y = () => w(i), p = (d) => {
8
- const { defaultColorScheme: o = "system", storageKey: n = "theme", children: l } = d, [r, a] = h(() => v(n, o)), s = (e) => {
9
- a(e), localStorage.setItem(n, e);
10
- };
11
- return c(() => {
12
- const e = window ? window.matchMedia("(prefers-color-scheme: dark)") : void 0;
13
- if (!e)
14
- return;
15
- const t = () => {
16
- r === "system" && m("system");
17
- };
18
- return e.addEventListener?.("change", t), t(), () => {
19
- e.removeEventListener?.("change", t);
20
- };
21
- }, [r]), c(() => {
22
- if (!window)
23
- return;
24
- const e = (t) => {
25
- t.key === n && (t.newValue ? a(t.newValue) : s(o));
26
- };
27
- return window.addEventListener("storage", e), () => {
28
- window.removeEventListener("storage", e);
29
- };
30
- }, [s, o]), c(() => {
31
- m(r);
32
- }, [r]), /* @__PURE__ */ u(i.Provider, { value: { colorScheme: r, setColorScheme: s }, children: l });
33
- };
1
+ import { jsx as e, Fragment as r } from "react/jsx-runtime";
2
+ const s = ({ ...n }) => /* @__PURE__ */ e("span", { className: "skeleton", style: n, children: /* @__PURE__ */ e(r, { children: "" }) });
34
3
  export {
35
- p as ThemeProvider,
36
- y as useTheme
4
+ s as Skeleton
37
5
  };
@@ -1,24 +1,37 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { memo as n } from "react";
3
- const i = n(({ storageKey: t, defaultColorScheme: o }) => /* @__PURE__ */ l(
4
- "script",
5
- {
6
- suppressHydrationWarning: !0,
7
- dangerouslySetInnerHTML: {
8
- __html: `(${a.toString()})("${t}", "${o}")`
9
- }
10
- }
11
- )), a = (t, o) => {
12
- const [r, c] = ["theme-light", "theme-dark"];
13
- try {
14
- let e = localStorage.getItem(t) || o;
15
- e === "system" && (e = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
16
- const s = e === "dark" ? c : r;
17
- document.documentElement.classList.remove(r, c), document.documentElement.classList.add(s), document.documentElement.style.colorScheme = e;
18
- } catch {
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useState as h, useEffect as c, createContext as f, useContext as w } from "react";
3
+ import { getColorScheme as v, updateDOM as m } from "./bundle.es62.js";
4
+ const i = f({
5
+ setColorScheme: () => {
19
6
  }
7
+ }), y = () => w(i), p = (d) => {
8
+ const { defaultColorScheme: o = "system", storageKey: n = "theme", children: l } = d, [r, a] = h(() => v(n, o)), s = (e) => {
9
+ a(e), localStorage.setItem(n, e);
10
+ };
11
+ return c(() => {
12
+ const e = window ? window.matchMedia("(prefers-color-scheme: dark)") : void 0;
13
+ if (!e)
14
+ return;
15
+ const t = () => {
16
+ r === "system" && m("system");
17
+ };
18
+ return e.addEventListener?.("change", t), t(), () => {
19
+ e.removeEventListener?.("change", t);
20
+ };
21
+ }, [r]), c(() => {
22
+ if (!window)
23
+ return;
24
+ const e = (t) => {
25
+ t.key === n && (t.newValue ? a(t.newValue) : s(o));
26
+ };
27
+ return window.addEventListener("storage", e), () => {
28
+ window.removeEventListener("storage", e);
29
+ };
30
+ }, [s, o]), c(() => {
31
+ m(r);
32
+ }, [r]), /* @__PURE__ */ u(i.Provider, { value: { colorScheme: r, setColorScheme: s }, children: l });
20
33
  };
21
34
  export {
22
- i as ColorSchemeScript,
23
- a as colorSchemeScript
35
+ p as ThemeProvider,
36
+ y as useTheme
24
37
  };
@@ -1,13 +1,24 @@
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 l } from "react/jsx-runtime";
2
+ import { memo as n } from "react";
3
+ const i = n(({ storageKey: t, defaultColorScheme: o }) => /* @__PURE__ */ l(
4
+ "script",
5
+ {
6
+ suppressHydrationWarning: !0,
7
+ dangerouslySetInnerHTML: {
8
+ __html: `(${a.toString()})("${t}", "${o}")`
9
+ }
10
+ }
11
+ )), a = (t, o) => {
12
+ const [r, c] = ["theme-light", "theme-dark"];
13
+ try {
14
+ let e = localStorage.getItem(t) || o;
15
+ e === "system" && (e = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
16
+ const s = e === "dark" ? c : r;
17
+ document.documentElement.classList.remove(r, c), document.documentElement.classList.add(s), document.documentElement.style.colorScheme = e;
18
+ } catch {
19
+ }
10
20
  };
11
21
  export {
12
- l as useLocalStorage
22
+ i as ColorSchemeScript,
23
+ a as colorSchemeScript
13
24
  };
@@ -1,29 +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 p } from "./bundle.es61.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
- }
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 });
24
- }
25
- };
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];
26
10
  };
27
11
  export {
28
- a as createAlertAgent
12
+ l as useLocalStorage
29
13
  };
@@ -1,41 +1,14 @@
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.es62.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 r, useCallback as t } from "react";
2
+ const f = (s = !1) => {
3
+ const [o, e] = r(s), a = t(() => {
4
+ e(!0);
5
+ }, []), l = t(() => {
6
+ e(!1);
7
+ }, []), u = t(() => {
8
+ e((n) => !n);
9
+ }, []);
10
+ return [o, a, l, u];
38
11
  };
39
12
  export {
40
- m as createToaster
13
+ f as useBooleanState
41
14
  };
@@ -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.es52.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.es63.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
  };