boottent-design 0.1.183 → 0.1.185

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.
package/dist/hooks.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./use-metadata-CZiZDN9j.cjs");require("react/jsx-runtime");const n=require("react"),o=require("./portal-manager-CfN0m-a6.cjs");require("./index-BoeM4gLz.cjs");const l=require("./use-toast-CMqCb_5N.cjs"),P=()=>{const[c,a]=n.useState([]);return n.useEffect(()=>{const t=(s,u)=>{a(u?r=>r.includes(s.id)?r:[...r,s.id]:r=>r.filter(i=>i!==s.id))},e=o.portalManager.subscribe(t);return a(o.portalManager.getOpenPortals()),()=>{e()}},[]),{modal:t=>{const{onClose:e=()=>{}}=t;return o.portalManager.showPortal("modal",{...t,onClose:e})},toast:t=>{let e;return typeof t=="string"?e={description:t}:e=t,o.portalManager.showPortal("toast",e)},alert:t=>{let e;return typeof t=="string"?e={description:t,onClose:()=>{}}:e={...t,onClose:t.onClose||(()=>{})},o.portalManager.showPortal("alert",e)},dialog:t=>{const{onClose:e=()=>{}}=t;return o.portalManager.showPortal("dialog",{...t,onClose:e})},custom:t=>{const{onClose:e=()=>{}}=t;return o.portalManager.showPortal("custom",{...t,onClose:e})},getIsOpen:t=>o.portalManager.getIsPortalOpen(t),closePortal:t=>{o.portalManager.closePortal(t)},closeAllPortals:()=>{o.portalManager.closeAllPortals()},openPortals:c}};exports.useMetadata=g.useMetadata;exports.reducer=l.reducer;exports.toast=l.toast;exports.toaster=l.toaster;exports.usePortal=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./use-metadata-CZiZDN9j.cjs");require("react/jsx-runtime");const l=require("react"),e=require("./use-toastmodal-BiqEXQyI.cjs");require("./index-BoeM4gLz.cjs");const d=()=>{const[n,s]=l.useState([]);return l.useEffect(()=>{const t=(r,c)=>{s(c?a=>a.includes(r.id)?a:[...a,r.id]:a=>a.filter(u=>u!==r.id))},o=e.portalManager.subscribe(t);return s(e.portalManager.getOpenPortals()),()=>{o()}},[]),{modal:t=>{const{onClose:o=()=>{}}=t;return e.portalManager.showPortal("modal",{...t,onClose:o})},toast:t=>{let o;return typeof t=="string"?o={description:t}:o=t,e.portalManager.showPortal("toast",o)},alert:t=>{let o;return typeof t=="string"?o={description:t,onClose:()=>{}}:o={...t,onClose:t.onClose||(()=>{})},e.portalManager.showPortal("alert",o)},dialog:t=>{const{onClose:o=()=>{}}=t;return e.portalManager.showPortal("dialog",{...t,onClose:o})},custom:t=>{const{onClose:o=()=>{}}=t;return e.portalManager.showPortal("custom",{...t,onClose:o})},getIsOpen:t=>e.portalManager.getIsPortalOpen(t),closePortal:t=>{e.portalManager.closePortal(t)},closeAllPortals:()=>{e.portalManager.closeAllPortals()},openPortals:n}};exports.useMetadata=i.useMetadata;exports.modalReducer=e.modalReducer;exports.toast=e.toast;exports.toastModal=e.toastModal;exports.toastReducer=e.toastReducer;exports.useToast=e.useToast;exports.useToastModal=e.useToastModal;exports.usePortal=d;
package/dist/hooks.es.js CHANGED
@@ -1,48 +1,51 @@
1
- import { u as p } from "./use-metadata-BrY8rtWx.js";
1
+ import { u as R } from "./use-metadata-BrY8rtWx.js";
2
2
  import "react/jsx-runtime";
3
- import { useState as i, useEffect as u } from "react";
4
- import { p as e } from "./portal-manager-CHYJ8sxF.js";
3
+ import { useState as u, useEffect as i } from "react";
4
+ import { p as s } from "./use-toastmodal-BhR-ysRN.js";
5
+ import { m as p, a as E, b as S, t as j, u as k, c as q } from "./use-toastmodal-BhR-ysRN.js";
5
6
  import "./index-haM7BOE0.js";
6
- import { r as S, t as j, a as k } from "./use-toast-C2k0XaPV.js";
7
- const I = () => {
8
- const [n, r] = i([]);
9
- return u(() => {
10
- const t = (l, a) => {
11
- r(a ? (s) => s.includes(l.id) ? s : [...s, l.id] : (s) => s.filter((c) => c !== l.id));
12
- }, o = e.subscribe(t);
13
- return r(e.getOpenPortals()), () => {
7
+ const A = () => {
8
+ const [a, r] = u([]);
9
+ return i(() => {
10
+ const t = (l, n) => {
11
+ r(n ? (e) => e.includes(l.id) ? e : [...e, l.id] : (e) => e.filter((c) => c !== l.id));
12
+ }, o = s.subscribe(t);
13
+ return r(s.getOpenPortals()), () => {
14
14
  o();
15
15
  };
16
16
  }, []), { modal: (t) => {
17
17
  const { onClose: o = () => {
18
18
  } } = t;
19
- return e.showPortal("modal", { ...t, onClose: o });
19
+ return s.showPortal("modal", { ...t, onClose: o });
20
20
  }, toast: (t) => {
21
21
  let o;
22
- return typeof t == "string" ? o = { description: t } : o = t, e.showPortal("toast", o);
22
+ return typeof t == "string" ? o = { description: t } : o = t, s.showPortal("toast", o);
23
23
  }, alert: (t) => {
24
24
  let o;
25
25
  return typeof t == "string" ? o = { description: t, onClose: () => {
26
26
  } } : o = { ...t, onClose: t.onClose || (() => {
27
- }) }, e.showPortal("alert", o);
27
+ }) }, s.showPortal("alert", o);
28
28
  }, dialog: (t) => {
29
29
  const { onClose: o = () => {
30
30
  } } = t;
31
- return e.showPortal("dialog", { ...t, onClose: o });
31
+ return s.showPortal("dialog", { ...t, onClose: o });
32
32
  }, custom: (t) => {
33
33
  const { onClose: o = () => {
34
34
  } } = t;
35
- return e.showPortal("custom", { ...t, onClose: o });
36
- }, getIsOpen: (t) => e.getIsPortalOpen(t), closePortal: (t) => {
37
- e.closePortal(t);
35
+ return s.showPortal("custom", { ...t, onClose: o });
36
+ }, getIsOpen: (t) => s.getIsPortalOpen(t), closePortal: (t) => {
37
+ s.closePortal(t);
38
38
  }, closeAllPortals: () => {
39
- e.closeAllPortals();
40
- }, openPortals: n };
39
+ s.closeAllPortals();
40
+ }, openPortals: a };
41
41
  };
42
42
  export {
43
- S as reducer,
44
- j as toast,
45
- k as toaster,
46
- p as useMetadata,
47
- I as usePortal
43
+ p as modalReducer,
44
+ E as toast,
45
+ S as toastModal,
46
+ j as toastReducer,
47
+ R as useMetadata,
48
+ A as usePortal,
49
+ k as useToast,
50
+ q as useToastModal
48
51
  };