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

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 (83) hide show
  1. package/Notification-additional-information.jpeg +0 -0
  2. package/Notification-confirm-error.jpg +0 -0
  3. package/Notification-confirm-warn.jpeg +0 -0
  4. package/Notification-overview.jpeg +0 -0
  5. package/Notification-success.jpeg +0 -0
  6. package/{arialiveregions.BvZhV6hb.js → arialiveregions.BK4T7Vhk.js} +1 -1
  7. package/assets/Dialog.DdLMmOLt.css +1 -0
  8. package/assets/Drawer.BqBgbSuP.css +1 -0
  9. package/assets/Toast.ChT0hchk.css +1 -0
  10. package/assets/button.3UhhGy87.css +1 -0
  11. package/assets/buttonround.DXDlPKwD.css +1 -0
  12. package/assets/link.BJHmVrew.css +1 -0
  13. package/assets/logo.pETQEsvZ.css +1 -0
  14. package/button.DPrDynn_.js +135 -0
  15. package/buttonround.ix_-O4l1.js +118 -0
  16. package/{checkbox.DNHdo6_n.js → checkbox.hoVQ37RP.js} +31 -32
  17. package/{checkboxgroup.DqWlzAeR.js → checkboxgroup.C9VX3c5W.js} +1 -1
  18. package/chunks/AriaLiveRegions.utils.D2ni4Yrf.js +34 -0
  19. package/chunks/{CheckboxGroup.DsQ6lI5a.js → CheckboxGroup.kG1WWhe_.js} +1 -1
  20. package/chunks/{CustomReactSelect.5dHi6PEO.js → CustomReactSelect.BVv0Zcvc.js} +4 -6
  21. package/chunks/Dialog.o7bcfCBf.js +148 -0
  22. package/chunks/Drawer.VbG4cfgJ.js +154 -0
  23. package/chunks/{Input.utils.AKWCNkpA.js → Input.utils.BGUhXCNP.js} +14 -13
  24. package/chunks/{InputPassword.a7zHKrmM.js → InputPassword.TlusvIds.js} +1 -1
  25. package/chunks/{InputSearch.DITRiB92.js → InputSearch.BbCdCCax.js} +1 -1
  26. package/chunks/{InputStepper.BkncCNwJ.js → InputStepper.DR3NR_II.js} +2 -2
  27. package/chunks/{Notification.DVVuSOqG.js → Notification.B6a6FOlS.js} +4 -4
  28. package/chunks/Toast.BpyBIPFW.js +89 -0
  29. package/chunks/has-document.r9i9TxKV.js +5 -0
  30. package/{combobox.CRlhqmuO.js → combobox.Dgp3kvFR.js} +1 -1
  31. package/components/Button/Button.d.ts +1 -1
  32. package/components/Checkbox/Checkbox.d.ts +1 -1
  33. package/components/CustomReactSelect/CustomReactSelect.d.ts +2 -2
  34. package/components/Dialog/Dialog.d.ts +22 -3
  35. package/components/Dialog/Dialog.test.d.ts +1 -0
  36. package/components/Dialog/Dialog.utils.d.ts +12 -0
  37. package/components/Dialog/Dialog.utils.test.d.ts +1 -0
  38. package/components/Drawer/Drawer.d.ts +31 -0
  39. package/components/Drawer/Drawer.test.d.ts +1 -0
  40. package/components/Drawer/Drawer.utils.d.ts +14 -0
  41. package/components/Drawer/Drawer.utils.test.d.ts +1 -0
  42. package/components/Input/Input.d.ts +1 -1
  43. package/components/InputSearch/InputSearch.d.ts +1 -1
  44. package/components/LinkStandalone/LinkStandalone.d.ts +1 -1
  45. package/components/Notification/Notification.d.ts +3 -1
  46. package/components/Radio/Radio.d.ts +1 -1
  47. package/components/RadioGroup/RadioGroup.d.ts +1 -1
  48. package/components/SkipToContent/SkipToContent.d.ts +1 -1
  49. package/components/Switch/Switch.d.ts +1 -1
  50. package/components/Toast/Toast.d.ts +3 -0
  51. package/components/Toast/ToastManager.d.ts +7 -3
  52. package/{customreactselect.CD58gwtp.js → customreactselect.BxkJi_UE.js} +1 -1
  53. package/dialog.CVFl9IVY.js +9 -0
  54. package/drawer.BheN3lap.js +9 -0
  55. package/drawer.d.ts +1 -0
  56. package/index.d.ts +5 -0
  57. package/index.es.js +96 -86
  58. package/{input.ChVISFEX.js → input.CfO9lL_o.js} +2 -2
  59. package/{inputpassword.Ba9SUUIK.js → inputpassword.CvnUeLTq.js} +2 -2
  60. package/{inputsearch.BK-0OTwA.js → inputsearch.ClX9PlYG.js} +2 -2
  61. package/{inputstepper.CTpTeXL9.js → inputstepper.Dd76qaQT.js} +3 -3
  62. package/link.CIY7SOpm.js +115 -0
  63. package/{logo.BR_CUXFl.js → logo.CqukakYv.js} +32 -36
  64. package/{notification.Csn5QCR2.js → notification.BGRev3jC.js} +2 -2
  65. package/package.json +3 -3
  66. package/{skiptocontent._YZRKxnc.js → skiptocontent.ALhHiH8t.js} +15 -13
  67. package/{toast.r_yhGYEe.js → toast.CtgjrtBC.js} +2 -2
  68. package/toastmanager.6mUZ8eCN.js +119 -0
  69. package/utils/render-in-iframe.d.ts +15 -0
  70. package/utils/vitest.setup.d.ts +2 -0
  71. package/assets/Toast.BzVaebc0.css +0 -1
  72. package/assets/button.BdxtFZKx.css +0 -1
  73. package/assets/buttonround.pR4StXA7.css +0 -1
  74. package/assets/dialog.CKwM2EBH.css +0 -1
  75. package/assets/link.D61tKkSK.css +0 -1
  76. package/assets/logo.C05WqGId.css +0 -1
  77. package/button.L1lgCuM9.js +0 -135
  78. package/buttonround.ddSqXjYf.js +0 -118
  79. package/chunks/AriaLiveRegions.utils.DzWI5KCU.js +0 -31
  80. package/chunks/Toast.RON4bFPY.js +0 -89
  81. package/dialog.0qPUVJha.js +0 -45
  82. package/link.SAcKvzJ3.js +0 -115
  83. package/toastmanager.D-uIi-TS.js +0 -96
@@ -1,118 +0,0 @@
1
- "use client";
2
- import { j as r } from "./chunks/jsx-runtime.C115EyI4.js";
3
- import { c as h } from "./chunks/index.CvOaL64Y.js";
4
- import { D as H } from "./chunks/Icon.n4XZrQ4N.js";
5
- import { DSSpinner as p } from "./spinner.DVa112nj.js";
6
- import './assets/buttonround.pR4StXA7.css';const F = "_root_lfeh_151", O = "_root--highlight_lfeh_219", G = "_root--dark-highlight_lfeh_219", I = "_root--filled_lfeh_297", S = "_root--outline_lfeh_325", x = "_root--ghost_lfeh_352", j = "_root--ghost-flush_lfeh_377", L = "_root--small_lfeh_383", C = "_root--dark-filled_lfeh_460", N = "_root--dark-outline_lfeh_519", R = "_root--dark-ghost_lfeh_577", B = "_root--dark-ghost-flush_lfeh_633", E = "_root--icon-left_lfeh_692", T = "_root--icon-only_lfeh_708", q = "_root--icon-only-small_lfeh_717", w = "_loader_lfeh_734", z = "_icon--hidden_lfeh_746", A = "_label--hidden_lfeh_750", J = "_label--loading_lfeh_762", o = {
7
- root: F,
8
- "root--highlight": "_root--highlight_lfeh_219",
9
- rootHighlight: O,
10
- "root--dark-highlight": "_root--dark-highlight_lfeh_219",
11
- rootDarkHighlight: G,
12
- "root--filled": "_root--filled_lfeh_297",
13
- rootFilled: I,
14
- "root--outline": "_root--outline_lfeh_325",
15
- rootOutline: S,
16
- "root--ghost": "_root--ghost_lfeh_352",
17
- rootGhost: x,
18
- "root--ghost-flush": "_root--ghost-flush_lfeh_377",
19
- rootGhostFlush: j,
20
- "root--small": "_root--small_lfeh_383",
21
- rootSmall: L,
22
- "root--dark-filled": "_root--dark-filled_lfeh_460",
23
- rootDarkFilled: C,
24
- "root--dark-outline": "_root--dark-outline_lfeh_519",
25
- rootDarkOutline: N,
26
- "root--dark-ghost": "_root--dark-ghost_lfeh_577",
27
- rootDarkGhost: R,
28
- "root--dark-ghost-flush": "_root--dark-ghost-flush_lfeh_633",
29
- rootDarkGhostFlush: B,
30
- "root--icon-left": "_root--icon-left_lfeh_692",
31
- rootIconLeft: E,
32
- "root--icon-only": "_root--icon-only_lfeh_708",
33
- rootIconOnly: T,
34
- "root--icon-only-small": "_root--icon-only-small_lfeh_717",
35
- rootIconOnlySmall: q,
36
- loader: w,
37
- "icon--hidden": "_icon--hidden_lfeh_746",
38
- iconHidden: z,
39
- "label--hidden": "_label--hidden_lfeh_750",
40
- labelHidden: A,
41
- "label--loading": "_label--loading_lfeh_762",
42
- labelLoading: J
43
- }, U = ({
44
- children: d,
45
- aria: f,
46
- className: c,
47
- dataTrackingid: g,
48
- disabled: _ = !1,
49
- iconName: i = "placeholder",
50
- iconSource: n,
51
- loading: l = !1,
52
- theme: e = "light",
53
- variant: t = "filled",
54
- onClick: s,
55
- ...k
56
- }) => {
57
- const u = h(
58
- o.root,
59
- o.rootIconOnlySmall,
60
- c,
61
- {
62
- // variant
63
- [o.rootFilled]: t === "filled",
64
- [o.rootHighlight]: t === "highlight",
65
- // dark theme
66
- [o.rootDarkFilled]: e === "dark" && t === "filled",
67
- [o.rootDarkHighlight]: e === "dark" && t === "highlight"
68
- }
69
- ), m = h(o.label, o.labelHidden, {
70
- // set label opacity to 0 when loading to prevent button size from changing
71
- [o.labelLoading]: l
72
- }), b = h(o.icon, {
73
- // set icon opacity to 0 when loading to prevent button size from changing
74
- [o.iconHidden]: l
75
- }), D = e === "light" && t === "filled" ? "dark" : "light", y = (a) => {
76
- if (_ || l) {
77
- a.preventDefault();
78
- return;
79
- }
80
- s && s(a);
81
- };
82
- return /* @__PURE__ */ r.jsxs(
83
- "button",
84
- {
85
- className: u,
86
- "data-trackingid": g,
87
- type: "button",
88
- onClick: y,
89
- ...f,
90
- ...k,
91
- "aria-disabled": _ || l,
92
- "aria-busy": l,
93
- children: [
94
- l && /* @__PURE__ */ r.jsx(
95
- p,
96
- {
97
- className: o.loader,
98
- aria: { "aria-label": "Loading state" }
99
- }
100
- ),
101
- /* @__PURE__ */ r.jsx("span", { className: m, children: d }),
102
- (i || n) && /* @__PURE__ */ r.jsx(
103
- H,
104
- {
105
- name: i,
106
- theme: D,
107
- source: n,
108
- className: b,
109
- "aria-hidden": "true"
110
- }
111
- )
112
- ]
113
- }
114
- );
115
- };
116
- export {
117
- U as DSButtonRound
118
- };
@@ -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,89 +0,0 @@
1
- "use client";
2
- import { j as n } from "./jsx-runtime.C115EyI4.js";
3
- import { c } from "./index.CvOaL64Y.js";
4
- import { forwardRef as u } from "react";
5
- import { DSButton as g } from "../button.L1lgCuM9.js";
6
- import { D as h } from "./Icon.n4XZrQ4N.js";
7
- import '../assets/Toast.BzVaebc0.css';const p = "_root_127fr_80", x = "_root--closing_127fr_89", I = "_fade-out_127fr_1", S = "_move-in_127fr_1", N = "_root--success_127fr_124", j = "_root--info_127fr_128", v = "_root--warning_127fr_132", w = "_content_127fr_137", C = "_content--hide-icon_127fr_144", D = "_icon_127fr_148", O = "_message_127fr_152", o = {
8
- root: p,
9
- "root--closing": "_root--closing_127fr_89",
10
- rootClosing: x,
11
- "fade-out": "_fade-out_127fr_1",
12
- fadeOut: I,
13
- "move-in": "_move-in_127fr_1",
14
- moveIn: S,
15
- "root--success": "_root--success_127fr_124",
16
- rootSuccess: N,
17
- "root--info": "_root--info_127fr_128",
18
- rootInfo: j,
19
- "root--warning": "_root--warning_127fr_132",
20
- rootWarning: v,
21
- content: w,
22
- "content--hide-icon": "_content--hide-icon_127fr_144",
23
- contentHideIcon: C,
24
- icon: D,
25
- message: O
26
- }, T = {
27
- success: "circle-check-colored",
28
- warning: "triangle-exclamationmark-colored",
29
- info: "circle-info-colored"
30
- }, H = u(
31
- ({
32
- message: s,
33
- className: e,
34
- hideIcon: r = !1,
35
- variant: t = "info",
36
- onClick: i,
37
- onMouseEnter: a,
38
- onMouseLeave: _,
39
- ...f
40
- }, l) => {
41
- const m = c(o.root, e, {
42
- [o.rootSuccess]: t === "success",
43
- [o.rootWarning]: t === "warning",
44
- [o.rootInfo]: t === "info"
45
- }), d = c(o.content, {
46
- [o.contentHideIcon]: r
47
- });
48
- return /* @__PURE__ */ n.jsx(
49
- "aside",
50
- {
51
- className: m,
52
- ref: l,
53
- popover: "manual",
54
- "data-ds-toast": !0,
55
- onMouseEnter: a,
56
- onMouseLeave: _,
57
- "aria-label": s,
58
- ...f,
59
- children: /* @__PURE__ */ n.jsxs("div", { className: d, children: [
60
- !r && /* @__PURE__ */ n.jsx(
61
- h,
62
- {
63
- name: T[t],
64
- className: o.icon,
65
- "aria-hidden": "true"
66
- }
67
- ),
68
- /* @__PURE__ */ n.jsx("div", { className: o.message, children: s }),
69
- /* @__PURE__ */ n.jsx(
70
- g,
71
- {
72
- hideLabel: !0,
73
- iconName: "cross",
74
- size: "small",
75
- variant: "ghost",
76
- onClick: i,
77
- children: "Close toast"
78
- }
79
- )
80
- ] })
81
- }
82
- );
83
- }
84
- );
85
- H.displayName = "DSToast";
86
- export {
87
- H as D,
88
- o as s
89
- };
@@ -1,45 +0,0 @@
1
- "use client";
2
- import { j as e } from "./chunks/jsx-runtime.C115EyI4.js";
3
- import { c as u } from "./chunks/index.CvOaL64Y.js";
4
- import { useRef as f, useEffect as l } from "react";
5
- import { DSButton as m } from "./button.L1lgCuM9.js";
6
- import './assets/dialog.CKwM2EBH.css';const _ = "_root_4piiz_76", p = "_success_4piiz_80", d = "_info_4piiz_84", g = "_warning_4piiz_88", h = {
7
- root: _,
8
- success: p,
9
- info: d,
10
- warning: g
11
- }, z = ({
12
- children: r,
13
- className: c,
14
- footer: n,
15
- header: a,
16
- isOpen: t,
17
- onClose: s
18
- }) => {
19
- const i = f(null);
20
- return l(() => {
21
- const o = i.current;
22
- return o && (t ? o.showModal() : o.close(), s && o.addEventListener("close", s)), () => {
23
- o && s && o.removeEventListener("close", s);
24
- };
25
- }, [t, s]), /* @__PURE__ */ e.jsxs("dialog", { ref: i, className: u(h.root, c), children: [
26
- /* @__PURE__ */ e.jsx(
27
- m,
28
- {
29
- type: "button",
30
- iconName: "cross",
31
- variant: "ghost",
32
- hideLabel: !0,
33
- onClick: s,
34
- autoFocus: !0,
35
- children: "Close Dialog"
36
- }
37
- ),
38
- a,
39
- r,
40
- n
41
- ] });
42
- };
43
- export {
44
- z as DSDialog
45
- };
package/link.SAcKvzJ3.js DELETED
@@ -1,115 +0,0 @@
1
- "use client";
2
- import { j as d } from "./chunks/jsx-runtime.C115EyI4.js";
3
- import { c as g } from "./chunks/index.CvOaL64Y.js";
4
- import { u as h } from "./chunks/useBreakpoint.5xBNDiCf.js";
5
- import { D as H } from "./chunks/Icon.n4XZrQ4N.js";
6
- import './assets/link.D61tKkSK.css';const S = "_root_rd44x_151", b = "_root--highlight_rd44x_219", j = "_root--dark-highlight_rd44x_219", L = "_root--filled_rd44x_297", C = "_root--outline_rd44x_325", N = "_root--ghost_rd44x_352", T = "_root--ghost-flush_rd44x_377", B = "_root--small_rd44x_383", E = "_root--dark-filled_rd44x_460", R = "_root--dark-outline_rd44x_519", V = "_root--dark-ghost_rd44x_577", q = "_root--dark-ghost-flush_rd44x_633", w = "_root--icon-left_rd44x_692", A = "_root--icon-only_rd44x_708", J = "_root--icon-only-small_rd44x_717", K = "_label--hidden_rd44x_728", o = {
7
- root: S,
8
- "root--highlight": "_root--highlight_rd44x_219",
9
- rootHighlight: b,
10
- "root--dark-highlight": "_root--dark-highlight_rd44x_219",
11
- rootDarkHighlight: j,
12
- "root--filled": "_root--filled_rd44x_297",
13
- rootFilled: L,
14
- "root--outline": "_root--outline_rd44x_325",
15
- rootOutline: C,
16
- "root--ghost": "_root--ghost_rd44x_352",
17
- rootGhost: N,
18
- "root--ghost-flush": "_root--ghost-flush_rd44x_377",
19
- rootGhostFlush: T,
20
- "root--small": "_root--small_rd44x_383",
21
- rootSmall: B,
22
- "root--dark-filled": "_root--dark-filled_rd44x_460",
23
- rootDarkFilled: E,
24
- "root--dark-outline": "_root--dark-outline_rd44x_519",
25
- rootDarkOutline: R,
26
- "root--dark-ghost": "_root--dark-ghost_rd44x_577",
27
- rootDarkGhost: V,
28
- "root--dark-ghost-flush": "_root--dark-ghost-flush_rd44x_633",
29
- rootDarkGhostFlush: q,
30
- "root--icon-left": "_root--icon-left_rd44x_692",
31
- rootIconLeft: w,
32
- "root--icon-only": "_root--icon-only_rd44x_708",
33
- rootIconOnly: A,
34
- "root--icon-only-small": "_root--icon-only-small_rd44x_717",
35
- rootIconOnlySmall: J,
36
- "label--hidden": "_label--hidden_rd44x_728",
37
- labelHidden: K
38
- }, W = ({
39
- children: c,
40
- aria: k,
41
- className: u,
42
- dataTrackingid: x,
43
- download: f,
44
- hideLabel: s = !1,
45
- href: i,
46
- iconName: n,
47
- iconPosition: m = "left",
48
- iconSource: a,
49
- isFlush: l = !1,
50
- referrerPolicy: D,
51
- rel: y,
52
- size: _ = "medium",
53
- target: G = "_self",
54
- theme: r = "light",
55
- variant: t = "filled",
56
- ...O
57
- }) => {
58
- const I = g(o.root, u, {
59
- // variant
60
- [o.rootFilled]: t === "filled",
61
- [o.rootHighlight]: t === "highlight",
62
- [o.rootOutline]: t === "outline",
63
- [o.rootGhost]: t === "ghost" && l !== !0,
64
- // isFlush
65
- [o.rootGhostFlush]: t === "ghost" && l === !0,
66
- // dark theme
67
- [o.rootDarkFilled]: r === "dark" && t === "filled",
68
- [o.rootDarkHighlight]: r === "dark" && t === "highlight",
69
- [o.rootDarkOutline]: r === "dark" && t === "outline",
70
- [o.rootDarkGhost]: r === "dark" && t === "ghost" && l !== !0,
71
- // dark isFlush
72
- [o.rootDarkGhostFlush]: r === "dark" && t === "ghost" && l === !0,
73
- // size
74
- [o.rootSmall]: _ === "small",
75
- // icon position
76
- [o.rootIconLeft]: m === "left",
77
- // icon only
78
- [o.rootIconOnly]: h(s) && _ === "medium",
79
- [o.rootIconOnlySmall]: h(s) && _ === "small"
80
- }), p = g({
81
- // hide label only visually to keep them available for assistive technologies
82
- [o.labelHidden]: h(s)
83
- }), F = r === "light" && t === "filled" || r === "dark" && t === "outline" || r === "dark" && t === "ghost" ? "dark" : "light", e = i === void 0 ? "span" : "a";
84
- return /* @__PURE__ */ d.jsxs(
85
- e,
86
- {
87
- className: I,
88
- "data-trackingid": x,
89
- ...e === "a" && {
90
- href: i,
91
- target: G,
92
- rel: y,
93
- referrerPolicy: D,
94
- download: f
95
- },
96
- ...k,
97
- ...O,
98
- children: [
99
- /* @__PURE__ */ d.jsx("span", { className: p, children: c }),
100
- (n || a) && /* @__PURE__ */ d.jsx(
101
- H,
102
- {
103
- name: n,
104
- theme: F,
105
- source: a,
106
- "aria-hidden": "true"
107
- }
108
- )
109
- ]
110
- }
111
- );
112
- };
113
- export {
114
- W as DSLink
115
- };
@@ -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
- };