@stihl-design-system/components 1.0.0-RC.6 → 1.0.0-RC.7

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.
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { j as s } from "./chunks/jsx-runtime.C115EyI4.js";
3
- import { v as r, A as n, a } from "./chunks/AriaLiveRegions.utils.DzWI5KCU.js";
3
+ import { v as r, A as n, a } from "./chunks/AriaLiveRegions.utils.D2ni4Yrf.js";
4
4
  import './assets/arialiveregions.GsGx2USO.css';const l = "_sr-only_echuy_76", e = {
5
5
  "sr-only": "_sr-only_echuy_76",
6
6
  srOnly: l
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { g as i } from "./helpers.B1JT5ShS.js";
3
+ import "react";
4
+ import { h as s } from "./has-document.r9i9TxKV.js";
5
+ const e = "ds-alert-live-region", t = "ds-status-live-region", g = () => document.getElementById(e), c = () => document.getElementById(t), m = () => {
6
+ if (!s)
7
+ return;
8
+ const n = document.querySelectorAll(
9
+ `#${e}`
10
+ ), o = document.querySelectorAll(
11
+ `#${t}`
12
+ );
13
+ if (n.length > 1)
14
+ throw new Error(
15
+ i(
16
+ "DSAriaLiveRegions",
17
+ `The DSAriaLiveRegions component with id="${e}" should only be present once on the page. Found ${n.length} instances.`
18
+ )
19
+ );
20
+ if (o.length > 1)
21
+ throw new Error(
22
+ i(
23
+ "DSAriaLiveRegions",
24
+ `The DSAriaLiveRegions component with id="${t}" should only be present once on the page. Found ${o.length} instances.`
25
+ )
26
+ );
27
+ };
28
+ export {
29
+ e as A,
30
+ t as a,
31
+ c as b,
32
+ g,
33
+ m as v
34
+ };
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { g as t } from "./helpers.B1JT5ShS.js";
3
3
  import "react";
4
- const p = typeof document < "u", a = 8, i = 5, I = ["medium", "small"], u = [
4
+ import { h as p } from "./has-document.r9i9TxKV.js";
5
+ const a = 8, i = 5, T = ["medium", "small"], u = [
5
6
  "color",
6
7
  "date",
7
8
  "datetime-local",
@@ -26,15 +27,15 @@ const p = typeof document < "u", a = 8, i = 5, I = ["medium", "small"], u = [
26
27
  "submit",
27
28
  "image",
28
29
  "datetime"
29
- ], T = ({
30
+ ], b = ({
30
31
  id: e,
31
32
  label: n,
32
33
  prefix: o,
33
34
  suffix: s,
34
35
  leadingIconName: r,
35
36
  leadingIconSource: d,
36
- actionButtonIconName: c,
37
- actionButtonIconSource: m
37
+ actionButtonIconName: m,
38
+ actionButtonIconSource: c
38
39
  }) => {
39
40
  if (!e)
40
41
  throw new Error(
@@ -65,13 +66,13 @@ const p = typeof document < "u", a = 8, i = 5, I = ["medium", "small"], u = [
65
66
  "DSInput",
66
67
  "Prefix and a leading Icon cannot be used at the same time."
67
68
  )
68
- ), s && (c || m) && console.warn(
69
+ ), s && (m || c) && console.warn(
69
70
  t(
70
71
  "DSInput",
71
72
  "Suffix and an action button cannot be used at the same time."
72
73
  )
73
74
  );
74
- }, b = (e) => {
75
+ }, D = (e) => {
75
76
  if (!u.includes(e) && !l.includes(e))
76
77
  throw new Error(
77
78
  t(
@@ -94,17 +95,17 @@ const p = typeof document < "u", a = 8, i = 5, I = ["medium", "small"], u = [
94
95
  hidden: 'Type hidden is not supported by DSInput component. Use a default <input type="hidden" /> element instead.'
95
96
  };
96
97
  n[e] && console.warn(t("DSInput", n[e]));
97
- }, h = () => p && "showPicker" in HTMLInputElement.prototype && !!window.navigator.userAgent.match(/chrome|chromium|crios|edg/i), D = (e, n) => h() && (e || n), y = (e) => e === "date" || e === "datetime-local" || e === "month", U = (e) => e === "time";
98
+ }, h = () => p && "showPicker" in HTMLInputElement.prototype && !!window.navigator.userAgent.match(/chrome|chromium|crios|edg/i), y = (e, n) => h() && (e || n), U = (e) => e === "date" || e === "datetime-local" || e === "month", P = (e) => e === "time";
98
99
  export {
99
- I,
100
+ T as I,
100
101
  a as M,
101
102
  u as S,
102
103
  l as U,
103
104
  i as a,
104
- b,
105
- U as c,
105
+ D as b,
106
+ P as c,
106
107
  h,
107
- y as i,
108
- D as s,
109
- T as v
108
+ U as i,
109
+ y as s,
110
+ b as v
110
111
  };
@@ -5,7 +5,7 @@ import { useState as _, useRef as N, useEffect as w, useLayoutEffect as M } from
5
5
  import { u as _t } from "./useBreakpoint.5xBNDiCf.js";
6
6
  import { Asterisk as ft } from "../asterisk.Cjbk-xZi.js";
7
7
  import { DSButton as X } from "../button.L1lgCuM9.js";
8
- import { M as E, a as H } from "./Input.utils.AKWCNkpA.js";
8
+ import { M as E, a as H } from "./Input.utils.BGUhXCNP.js";
9
9
  import { DSSystemFeedback as ht } from "../systemfeedback.CUWch42u.js";
10
10
  import { g as y } from "./helpers.B1JT5ShS.js";
11
11
  import '../assets/InputStepper.BKjqNi-i.css';const mt = "_input_xdphx_226", bt = "_input--invalid_xdphx_336", St = "_input--small_xdphx_343", yt = "_input--has-leading-icon_xdphx_395", vt = "_input--has-action-button_xdphx_398", It = "_input--has-second-action-button_xdphx_401", gt = "_input--has-affix_xdphx_413", At = "_input--is-ready_xdphx_427", Bt = "_root_xdphx_437", Dt = "_hint_xdphx_445", Nt = "_label_xdphx_445", wt = "_wrapper_xdphx_449", Et = "_affix_xdphx_455", Ht = "_affix--small_xdphx_475", Lt = "_affix--disabled_xdphx_487", jt = "_prefix_xdphx_490", Rt = "_affix--readonly_xdphx_493", kt = "_suffix_xdphx_503", Ct = "_action-button_xdphx_510", $t = "_label--hidden_xdphx_527", Ft = "_feedback_xdphx_554", Vt = "_second-action-button_xdphx_568", Pt = "_value-announcer_xdphx_572", n = {
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ const e = typeof document < "u";
3
+ export {
4
+ e as h
5
+ };
@@ -1,6 +1,10 @@
1
1
  import { ToastOptions } from './Toast.utils';
2
2
 
3
- export declare const useToast: () => {
4
- toast: import("react/jsx-runtime").JSX.Element | undefined;
5
- queueToastMessage: (message: string, options?: ToastOptions) => void;
3
+ type ToastContextType = {
4
+ queueDSToastMessage: (message: string, options?: ToastOptions) => void;
6
5
  };
6
+ export declare const useDSToast: () => ToastContextType;
7
+ export declare const DSToastProvider: ({ children, }: {
8
+ children: React.ReactNode;
9
+ }) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
package/index.d.ts CHANGED
@@ -46,3 +46,4 @@ export * from './components/Textarea/Textarea';
46
46
  export * from './components/Textarea/Textarea.utils';
47
47
  export * from './components/Title/Title';
48
48
  export * from './components/Title/Title.utils';
49
+ export * from './components/Toast/ToastManager';
package/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { DSAriaLiveRegions as x } from "./arialiveregions.BvZhV6hb.js";
3
- import { DSButton as N } from "./button.L1lgCuM9.js";
4
- import { DSButtonRound as u } from "./buttonround.ddSqXjYf.js";
2
+ import { DSAriaLiveRegions as x } from "./arialiveregions.BK4T7Vhk.js";
3
+ import { DSButton as u } from "./button.L1lgCuM9.js";
4
+ import { DSButtonRound as c } from "./buttonround.ddSqXjYf.js";
5
5
  import { DSCheckbox as f } from "./checkbox.DNHdo6_n.js";
6
6
  import { D as E, v as A } from "./chunks/CheckboxGroup.DsQ6lI5a.js";
7
7
  import { DSCombobox as g } from "./combobox.CRlhqmuO.js";
@@ -10,13 +10,13 @@ import { D as X, v as b } from "./chunks/Fieldset.B1vsrHNv.js";
10
10
  import { DSFloatingActionButton as Z } from "./floatingactionbutton.D_e4vz2G.js";
11
11
  import { DSHeading as H } from "./heading.BTNroD1E.js";
12
12
  import { D as M, I as w, u as V } from "./chunks/Icon.n4XZrQ4N.js";
13
- import { DSInput as y } from "./input.ChVISFEX.js";
14
- import { I as Y, M as q, a as j, S as z, U as J, h as Q, i as $, c as oo, s as ao, v as eo, b as to } from "./chunks/Input.utils.AKWCNkpA.js";
13
+ import { DSInput as y } from "./input.DqSOhSMX.js";
14
+ import { I as Y, M as q, a as j, S as z, U as J, h as Q, i as $, c as oo, s as eo, v as ao, b as to } from "./chunks/Input.utils.BGUhXCNP.js";
15
15
  import { D as so, v as po } from "./chunks/InputPassword.a7zHKrmM.js";
16
16
  import { D as So, i as lo, v as mo } from "./chunks/InputSearch.DITRiB92.js";
17
- import { D as Io, v as To } from "./chunks/InputStepper.BkncCNwJ.js";
17
+ import { D as Io, v as To } from "./chunks/InputStepper.Bf8NZ9pb.js";
18
18
  import { DSLink as xo } from "./link.SAcKvzJ3.js";
19
- import { DSLinkStandalone as co } from "./linkstandalone.DNe0Nydm.js";
19
+ import { DSLinkStandalone as No } from "./linkstandalone.DNe0Nydm.js";
20
20
  import { DSLogo as _o } from "./logo.BR_CUXFl.js";
21
21
  import { D as ho, a as Eo, N as Ao } from "./chunks/Notification.DVVuSOqG.js";
22
22
  import { D as go, a as vo, o as Po, v as Co } from "./chunks/RadioGroup.BO4pbAJw.js";
@@ -27,12 +27,13 @@ import { DSSwitch as ko } from "./switch.rd7PdLc9.js";
27
27
  import { DSText as wo } from "./text.CrYUewrP.js";
28
28
  import { D as Ko, T as yo, v as Wo } from "./chunks/Textarea.oqCrSopu.js";
29
29
  import { DSTitle as qo } from "./title.Dvp8LKJt.js";
30
- const o = ["medium", "small"], a = [
30
+ import { DSToastProvider as zo, useDSToast as Jo } from "./toastmanager.BncH_rUP.js";
31
+ const o = ["medium", "small"], e = [
31
32
  "filled",
32
33
  "highlight",
33
34
  "outline",
34
35
  "ghost"
35
- ], e = ["filled", "highlight"], t = [
36
+ ], a = ["filled", "highlight"], t = [
36
37
  "x-large",
37
38
  "x-large-uppercase",
38
39
  "large",
@@ -70,13 +71,13 @@ const o = ["medium", "small"], a = [
70
71
  "xx-small"
71
72
  ], n = ["bold", "normal"], I = ["x-large", "large"];
72
73
  export {
73
- e as BUTTON_ROUND_VARIANT,
74
+ a as BUTTON_ROUND_VARIANT,
74
75
  o as BUTTON_SIZE,
75
- a as BUTTON_VARIANT,
76
+ e as BUTTON_VARIANT,
76
77
  P as COMBOBOX_SIZE,
77
78
  x as DSAriaLiveRegions,
78
- N as DSButton,
79
- u as DSButtonRound,
79
+ u as DSButton,
80
+ c as DSButtonRound,
80
81
  f as DSCheckbox,
81
82
  E as DSCheckboxGroup,
82
83
  g as DSCombobox,
@@ -89,7 +90,7 @@ export {
89
90
  So as DSInputSearch,
90
91
  Io as DSInputStepper,
91
92
  xo as DSLink,
92
- co as DSLinkStandalone,
93
+ No as DSLinkStandalone,
93
94
  _o as DSLogo,
94
95
  ho as DSNotification,
95
96
  go as DSRadioGroup,
@@ -100,6 +101,7 @@ export {
100
101
  wo as DSText,
101
102
  Ko as DSTextarea,
102
103
  qo as DSTitle,
104
+ zo as DSToastProvider,
103
105
  C as DS_COMBOBOX_TRANSLATIONS,
104
106
  R as DS_COMBOBOX_TRANSLATIONS_DE,
105
107
  L as DS_COMBOBOX_TRANSLATIONS_EN,
@@ -130,13 +132,14 @@ export {
130
132
  lo as isWithinForm,
131
133
  vo as optionsHaveCustomArea,
132
134
  Po as optionsHaveHint,
133
- ao as showCustomCalendarOrTimeIndicator,
135
+ eo as showCustomCalendarOrTimeIndicator,
136
+ Jo as useDSToast,
134
137
  V as useDynamicSvgImport,
135
138
  A as validateCheckboxGroupProps,
136
139
  B as validateComboboxProps,
137
140
  b as validateFieldsetProps,
138
141
  po as validateInputPasswordProps,
139
- eo as validateInputProps,
142
+ ao as validateInputProps,
140
143
  mo as validateInputSearchProps,
141
144
  To as validateInputStepperProps,
142
145
  Co as validateRadioGroupProps,
@@ -7,7 +7,7 @@ import { Asterisk as ea } from "./asterisk.Cjbk-xZi.js";
7
7
  import { DSButton as E } from "./button.L1lgCuM9.js";
8
8
  import { D as la } from "./chunks/Icon.n4XZrQ4N.js";
9
9
  import { DSSystemFeedback as oa } from "./systemfeedback.CUWch42u.js";
10
- import { v as da, b as ca, M as _a, a as ua, s as fa, c as ra, i as v } from "./chunks/Input.utils.AKWCNkpA.js";
10
+ import { v as da, b as ca, M as _a, a as ua, s as fa, c as ra, i as v } from "./chunks/Input.utils.BGUhXCNP.js";
11
11
  import './assets/input.71tOIrpp.css';const pa = "_input_1jdyx_226", xa = "_input--invalid_1jdyx_336", ma = "_input--small_1jdyx_343", ya = "_input--has-leading-icon_1jdyx_395", ja = "_input--has-action-button_1jdyx_398", ha = "_input--has-second-action-button_1jdyx_401", ba = "_input--has-affix_1jdyx_413", ga = "_input--is-ready_1jdyx_427", Ia = "_root_1jdyx_434", Sa = "_hint_1jdyx_442", Ha = "_label_1jdyx_442", ka = "_wrapper_1jdyx_446", va = "_affix_1jdyx_452", Ca = "_affix--small_1jdyx_472", Ra = "_affix--disabled_1jdyx_484", Da = "_prefix_1jdyx_487", La = "_affix--readonly_1jdyx_490", Aa = "_suffix_1jdyx_500", Na = "_leading-icon_1jdyx_507", Ba = "_leading-icon--small_1jdyx_519", wa = "_leading-icon--disabled_1jdyx_522", Ea = "_action-button_1jdyx_531", Ta = "_label--hidden_1jdyx_548", Fa = "_feedback_1jdyx_575", a = {
12
12
  input: pa,
13
13
  "input--invalid": "_input--invalid_1jdyx_336",
@@ -5,9 +5,9 @@ import "react";
5
5
  import "./chunks/useBreakpoint.5xBNDiCf.js";
6
6
  import "./asterisk.Cjbk-xZi.js";
7
7
  import "./button.L1lgCuM9.js";
8
- import "./chunks/Input.utils.AKWCNkpA.js";
8
+ import "./chunks/Input.utils.BGUhXCNP.js";
9
9
  import "./systemfeedback.CUWch42u.js";
10
- import { D } from "./chunks/InputStepper.BkncCNwJ.js";
10
+ import { D } from "./chunks/InputStepper.Bf8NZ9pb.js";
11
11
  export {
12
12
  D as DSInputStepper
13
13
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stihl-design-system/components",
3
3
  "private": false,
4
- "version": "1.0.0-RC.6",
4
+ "version": "1.0.0-RC.7",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://main--63440bbb95889041542a5ba3.chromatic.com",
7
7
  "keywords": [
@@ -0,0 +1,117 @@
1
+ "use client";
2
+ import { j as h } from "./chunks/jsx-runtime.C115EyI4.js";
3
+ import { createContext as C, useContext as P, useState as S, useRef as O, useEffect as A, useMemo as j } from "react";
4
+ import { g as a } from "./chunks/helpers.B1JT5ShS.js";
5
+ import { g as E, b as x } from "./chunks/AriaLiveRegions.utils.D2ni4Yrf.js";
6
+ import { D as _, s as U } from "./chunks/Toast.RON4bFPY.js";
7
+ import { h as q } from "./chunks/has-document.r9i9TxKV.js";
8
+ const Q = () => {
9
+ if (!E() || !x())
10
+ throw new Error(
11
+ a(
12
+ "DSToast",
13
+ 'The DSAriaLiveRegions component has to be placed at the root of your application, as close to the "body" as possible, e.g. in your "App.tsx" or "layout.tsx".'
14
+ )
15
+ );
16
+ }, k = () => {
17
+ if (!q)
18
+ return;
19
+ if (document.querySelectorAll("[data-ds-toast]").length > 1)
20
+ throw new Error(
21
+ a(
22
+ "DSToast",
23
+ 'The destructured "toast" element should only be used once in the DOM.'
24
+ )
25
+ );
26
+ }, i = "data-ds-toast-timeout-id", D = "closing", B = 1e4, w = C(void 0), J = () => {
27
+ const n = P(w);
28
+ if (!n)
29
+ throw new Error(
30
+ a(
31
+ "DSToastProvider",
32
+ "useDSToast must be used within a <DSToastProvider />, which wraps around your root component."
33
+ )
34
+ );
35
+ return n;
36
+ }, K = ({
37
+ children: n
38
+ }) => {
39
+ const [u, c] = S([]), [s, l] = S(null), o = O(null);
40
+ A(() => {
41
+ !s && u.length > 0 && setTimeout(() => {
42
+ l(u[0]);
43
+ });
44
+ }, [u]), A(() => {
45
+ s && (M(s.message, s.variant), I());
46
+ }, [s]);
47
+ const m = () => {
48
+ var e;
49
+ return ((e = o.current) == null ? void 0 : e.getAttribute(i)) || null;
50
+ }, T = (e) => {
51
+ var t;
52
+ (t = o.current) == null || t.setAttribute(i, e);
53
+ }, L = () => {
54
+ var e;
55
+ return (e = o.current) == null ? void 0 : e.removeAttribute(i);
56
+ }, M = (e, t) => {
57
+ if (t === "warning") {
58
+ const r = E();
59
+ r && (r.innerText = e);
60
+ } else if (t === "success" || t === "info") {
61
+ const r = x();
62
+ r && (r.innerText = e);
63
+ }
64
+ }, d = (e, t) => {
65
+ Q();
66
+ const r = {
67
+ message: e,
68
+ hideIcon: t == null ? void 0 : t.hideIcon,
69
+ variant: (t == null ? void 0 : t.variant) || "info",
70
+ onClick: () => {
71
+ g();
72
+ },
73
+ onMouseEnter: R,
74
+ onMouseLeave: p
75
+ };
76
+ c((y) => [...y, r]);
77
+ }, R = () => {
78
+ f();
79
+ }, f = () => {
80
+ var t;
81
+ const e = m();
82
+ e && (clearTimeout(e), (t = o.current) == null || t.removeAttribute(i));
83
+ }, v = () => {
84
+ const e = setTimeout(() => {
85
+ g();
86
+ }, B);
87
+ T(String(e));
88
+ }, p = () => {
89
+ m() !== D && o.current && v();
90
+ }, I = () => {
91
+ k(), o.current && s && (o.current.showPopover(), v());
92
+ }, g = () => {
93
+ f(), T(D), o.current && (o.current.addEventListener(
94
+ "animationend",
95
+ () => {
96
+ o.current && (o.current.hidePopover(), L(), o.current = null, c((e) => e.slice(1)), l(null));
97
+ },
98
+ {
99
+ once: !0
100
+ // removes event listener after being called once
101
+ }
102
+ ), o.current.classList.add(U.rootClosing));
103
+ }, b = j(
104
+ () => ({
105
+ queueDSToastMessage: d
106
+ }),
107
+ [d]
108
+ );
109
+ return /* @__PURE__ */ h.jsxs(w.Provider, { value: b, children: [
110
+ s ? /* @__PURE__ */ h.jsx(_, { ...s, ref: o }) : void 0,
111
+ n
112
+ ] });
113
+ };
114
+ export {
115
+ K as DSToastProvider,
116
+ J as useDSToast
117
+ };
@@ -1,31 +0,0 @@
1
- "use client";
2
- import { g as i } from "./helpers.B1JT5ShS.js";
3
- import "react";
4
- const e = "ds-alert-live-region", n = "ds-status-live-region", r = () => document.getElementById(e), a = () => document.getElementById(n), g = () => {
5
- const t = document.querySelectorAll(
6
- `#${e}`
7
- ), o = document.querySelectorAll(
8
- `#${n}`
9
- );
10
- if (t.length > 1)
11
- throw new Error(
12
- i(
13
- "DSAriaLiveRegions",
14
- `The DSAriaLiveRegions component with id="${e}" should only be present once on the page. Found ${t.length} instances.`
15
- )
16
- );
17
- if (o.length > 1)
18
- throw new Error(
19
- i(
20
- "DSAriaLiveRegions",
21
- `The DSAriaLiveRegions component with id="${n}" should only be present once on the page. Found ${o.length} instances.`
22
- )
23
- );
24
- };
25
- export {
26
- e as A,
27
- n as a,
28
- a as b,
29
- r as g,
30
- g as v
31
- };
@@ -1,96 +0,0 @@
1
- "use client";
2
- import { j as w } from "./chunks/jsx-runtime.C115EyI4.js";
3
- import { useState as f, useRef as x, useEffect as g } from "react";
4
- import { g as h, b as A } from "./chunks/AriaLiveRegions.utils.DzWI5KCU.js";
5
- import { D, s as y } from "./chunks/Toast.RON4bFPY.js";
6
- import { g as E } from "./chunks/helpers.B1JT5ShS.js";
7
- const O = () => {
8
- if (!h() || !A())
9
- throw new Error(
10
- E(
11
- "DSToast",
12
- 'The DSAriaLiveRegions component has to be placed at the root of your application, as close to the "body" as possible, e.g. in your "App.tsx" or "layout.tsx".'
13
- )
14
- );
15
- }, C = () => {
16
- if (document.querySelectorAll("[data-ds-toast]").length > 1)
17
- throw new Error(
18
- E(
19
- "DSToast",
20
- 'The destructured "toast" element should only be used once in the DOM.'
21
- )
22
- );
23
- }, i = "data-ds-toast-timeout-id", v = "closing", P = 1e4, k = () => {
24
- const [r, u] = f([]), [s, a] = f(null), o = x(null);
25
- g(() => {
26
- !s && r.length > 0 && setTimeout(() => {
27
- a(r[0]);
28
- });
29
- }, [r]), g(() => {
30
- s && (R(s.message, s.variant), b());
31
- }, [s]);
32
- const c = () => {
33
- var e;
34
- return ((e = o.current) == null ? void 0 : e.getAttribute(i)) || null;
35
- }, l = (e) => {
36
- var t;
37
- (t = o.current) == null || t.setAttribute(i, e);
38
- }, L = () => {
39
- var e;
40
- return (e = o.current) == null ? void 0 : e.removeAttribute(i);
41
- }, R = (e, t) => {
42
- if (t === "warning") {
43
- const n = h();
44
- n && (n.innerText = e);
45
- } else if (t === "success" || t === "info") {
46
- const n = A();
47
- n && (n.innerText = e);
48
- }
49
- }, S = (e, t) => {
50
- O();
51
- const n = {
52
- message: e,
53
- hideIcon: t == null ? void 0 : t.hideIcon,
54
- variant: (t == null ? void 0 : t.variant) || "info",
55
- onClick: () => {
56
- d();
57
- },
58
- onMouseEnter: I,
59
- onMouseLeave: M
60
- };
61
- u((p) => [...p, n]);
62
- }, I = () => {
63
- T();
64
- }, T = () => {
65
- var t;
66
- const e = c();
67
- e && (clearTimeout(e), (t = o.current) == null || t.removeAttribute(i));
68
- }, m = () => {
69
- const e = setTimeout(() => {
70
- d();
71
- }, P);
72
- l(String(e));
73
- }, M = () => {
74
- c() !== v && o.current && m();
75
- }, b = () => {
76
- C(), o.current && s && (o.current.showPopover(), m());
77
- }, d = () => {
78
- T(), l(v), o.current && (o.current.addEventListener(
79
- "animationend",
80
- () => {
81
- o.current && (o.current.hidePopover(), L(), o.current = null, u((e) => e.slice(1)), a(null));
82
- },
83
- {
84
- once: !0
85
- // removes event listener after being called once
86
- }
87
- ), o.current.classList.add(y.rootClosing));
88
- };
89
- return {
90
- toast: s ? /* @__PURE__ */ w.jsx(D, { ...s, ref: o }) : void 0,
91
- queueToastMessage: S
92
- };
93
- };
94
- export {
95
- k as useToast
96
- };