@pismo/marola 0.0.1-alpha.32 → 0.0.1-alpha.5

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 (170) hide show
  1. package/README.md +2 -13
  2. package/dist/{Button-2b1peDFT.js → Button-D--uN90N.js} +26 -25
  3. package/dist/Dialog.module-BKWFakxu.js +15 -0
  4. package/dist/ListContext-Dj2Va7Iv.js +18 -0
  5. package/dist/Tabs.module-BKlNuSPH.js +66 -0
  6. package/dist/assets/Button.css +1 -1
  7. package/dist/assets/Dialog.css +1 -1
  8. package/dist/assets/IconButton.css +1 -1
  9. package/dist/assets/PageHeader.css +1 -1
  10. package/dist/assets/Pagination.css +1 -1
  11. package/dist/assets/Tabs.css +1 -1
  12. package/dist/assets/Typography.css +1 -1
  13. package/dist/assets/main.css +1 -0
  14. package/dist/components/Button/Button.d.ts +2 -13
  15. package/dist/components/Button/Button.js +49 -60
  16. package/dist/components/Dialog/Actions.js +1 -1
  17. package/dist/components/Dialog/Backdrop.d.ts +1 -1
  18. package/dist/components/Dialog/Backdrop.js +1 -1
  19. package/dist/components/Dialog/CloseIconButton.js +124 -12
  20. package/dist/components/Dialog/Dialog.d.ts +3 -4
  21. package/dist/components/Dialog/Dialog.js +20098 -444
  22. package/dist/components/Dialog/{DialogTitle.d.ts → Title.d.ts} +3 -3
  23. package/dist/components/Dialog/Title.js +29 -0
  24. package/dist/components/IconButton/IconButton.d.ts +5 -21
  25. package/dist/components/IconButton/IconButton.js +76 -60
  26. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +0 -2
  27. package/dist/components/PageHeader/PageHeader.d.ts +16 -56
  28. package/dist/components/PageHeader/PageHeader.js +65 -83
  29. package/dist/components/Pagination/Pagination.d.ts +6 -25
  30. package/dist/components/Pagination/Pagination.js +113 -131
  31. package/dist/components/SortTooltip/SortTooltip.d.ts +0 -28
  32. package/dist/components/SortTooltip/SortTooltip.js +1 -93
  33. package/dist/components/Table/Table.d.ts +0 -56
  34. package/dist/components/Table/Table.js +1 -137
  35. package/dist/components/Table/TableContext.d.ts +0 -19
  36. package/dist/components/Table/TableContext.js +1 -21
  37. package/dist/components/Tabs/Tab.d.ts +1 -6
  38. package/dist/components/Tabs/Tab.js +173 -113
  39. package/dist/components/Tabs/TabPanel.d.ts +1 -5
  40. package/dist/components/Tabs/TabPanel.js +16 -15
  41. package/dist/components/Tabs/Tabs.d.ts +2 -8
  42. package/dist/components/Tabs/Tabs.js +664 -242
  43. package/dist/components/Tooltip/Tooltip.d.ts +0 -33
  44. package/dist/components/Tooltip/Tooltip.js +1 -141
  45. package/dist/components/Typography/Typography.d.ts +6 -17
  46. package/dist/components/Typography/Typography.js +58 -58
  47. package/dist/{index-CH45lKw7.js → index-BvA1HyDs.js} +300 -322
  48. package/dist/main.d.ts +8 -27
  49. package/dist/main.js +28 -75
  50. package/dist/objectWithoutPropertiesLoose-ClNcje2_.js +22 -0
  51. package/dist/types/helpers.d.ts +0 -8
  52. package/dist/useButton-abQpo0za.js +187 -0
  53. package/dist/useCompoundItem-wTwXbURC.js +41 -0
  54. package/package.json +9 -30
  55. package/dist/ClickAwayListener-BSW-Nd-y.js +0 -107
  56. package/dist/Dialog.module-DFEmFdYT.js +0 -30
  57. package/dist/Group-B3p31ftp.js +0 -26
  58. package/dist/Popup-B6ZSGIEI.js +0 -1248
  59. package/dist/Portal-DIeBsWdL.js +0 -73
  60. package/dist/SelectButton-C8JQKaf4.js +0 -61
  61. package/dist/Tabs.module-jkH1Qjn7.js +0 -22
  62. package/dist/Toggle-BCgIItCc.js +0 -142
  63. package/dist/assets/Advice.css +0 -1
  64. package/dist/assets/Checkbox.css +0 -1
  65. package/dist/assets/EllipsisTooltip.css +0 -1
  66. package/dist/assets/Group.css +0 -1
  67. package/dist/assets/Input.css +0 -1
  68. package/dist/assets/InputSearch.css +0 -1
  69. package/dist/assets/SelectButton.css +0 -1
  70. package/dist/assets/Skeleton.css +0 -1
  71. package/dist/assets/Snackbar.css +0 -1
  72. package/dist/assets/SortTooltip.css +0 -1
  73. package/dist/assets/Stepper.css +0 -1
  74. package/dist/assets/Table.css +0 -1
  75. package/dist/assets/TextDisplay.css +0 -1
  76. package/dist/assets/Toggle.css +0 -1
  77. package/dist/assets/Toggle2.css +0 -1
  78. package/dist/assets/Tooltip.css +0 -1
  79. package/dist/combineHooksSlotProps-DVjg9PRh.js +0 -80
  80. package/dist/components/Advice/Advice.d.ts +0 -30
  81. package/dist/components/Advice/Advice.js +0 -47
  82. package/dist/components/Advice/Advice.stories.d.ts +0 -18
  83. package/dist/components/Button/Button.stories.d.ts +0 -62
  84. package/dist/components/Checkbox/Checkbox.d.ts +0 -34
  85. package/dist/components/Checkbox/Checkbox.js +0 -71
  86. package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -31
  87. package/dist/components/Chip/Chip.d.ts +0 -39
  88. package/dist/components/Chip/Chip.js +0 -19
  89. package/dist/components/Chip/Chip.stories.d.ts +0 -42
  90. package/dist/components/Chip/chip.test.d.ts +0 -1
  91. package/dist/components/Dialog/Dialog.stories.d.ts +0 -343
  92. package/dist/components/Dialog/DialogTitle.js +0 -29
  93. package/dist/components/EllipsisTooltip/EllipsisTooltip.d.ts +0 -7
  94. package/dist/components/EllipsisTooltip/EllipsisTooltip.js +0 -23
  95. package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +0 -31
  96. package/dist/components/Icon/Icon.d.ts +0 -11
  97. package/dist/components/Icon/Icon.js +0 -127
  98. package/dist/components/Icon/Icon.stories.d.ts +0 -15
  99. package/dist/components/Icon/types.d.ts +0 -5
  100. package/dist/components/Icon/types.js +0 -1
  101. package/dist/components/IconButton/Icon.stories.d.ts +0 -15
  102. package/dist/components/Input/Input.d.ts +0 -44
  103. package/dist/components/Input/Input.js +0 -508
  104. package/dist/components/Input/Input.stories.d.ts +0 -43
  105. package/dist/components/InputSearch/InputSearch.d.ts +0 -9
  106. package/dist/components/InputSearch/InputSearch.js +0 -34
  107. package/dist/components/InputSearch/InputSearch.stories.d.ts +0 -39
  108. package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +0 -14
  109. package/dist/components/PageHeader/PageHeader.stories.d.ts +0 -14
  110. package/dist/components/Pagination/Pagination.stories.d.ts +0 -17
  111. package/dist/components/Select/Select.d.ts +0 -26
  112. package/dist/components/Select/Select.js +0 -857
  113. package/dist/components/Select/Select.stories.d.ts +0 -22
  114. package/dist/components/Select/SelectButton.d.ts +0 -12
  115. package/dist/components/Select/SelectButton.js +0 -8
  116. package/dist/components/Skeleton/Skeleton.d.ts +0 -25
  117. package/dist/components/Skeleton/Skeleton.js +0 -23
  118. package/dist/components/Skeleton/Skeleton.stories.d.ts +0 -14
  119. package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +0 -14
  120. package/dist/components/Skeleton/SkeletonTable.stories.d.ts +0 -16
  121. package/dist/components/Snackbar/Snackbar.d.ts +0 -27
  122. package/dist/components/Snackbar/Snackbar.js +0 -639
  123. package/dist/components/Snackbar/Snackbar.stories.d.ts +0 -319
  124. package/dist/components/Stepper/Stepper.d.ts +0 -26
  125. package/dist/components/Stepper/Stepper.js +0 -48
  126. package/dist/components/Stepper/Stepper.stories.d.ts +0 -16
  127. package/dist/components/Table/Table.stories.d.ts +0 -29
  128. package/dist/components/Table/_Table.TBody.stories.d.ts +0 -14
  129. package/dist/components/Table/_Table.THead.stories.d.ts +0 -14
  130. package/dist/components/Table/_Table.Td.stories.d.ts +0 -16
  131. package/dist/components/Table/_Table.Th.stories.d.ts +0 -15
  132. package/dist/components/Table/_Table.Tr.stories.d.ts +0 -15
  133. package/dist/components/Tabs/Tab.stories.d.ts +0 -15
  134. package/dist/components/Tabs/TabPanel.stories.d.ts +0 -14
  135. package/dist/components/Tabs/Tabs.stories.d.ts +0 -14
  136. package/dist/components/TextDisplay/TextDisplay.d.ts +0 -23
  137. package/dist/components/TextDisplay/TextDisplay.js +0 -37
  138. package/dist/components/TextDisplay/TextDisplay.stories.d.ts +0 -13
  139. package/dist/components/TextDisplay/textDisplay.test.d.ts +0 -1
  140. package/dist/components/Toggle/Toggle.d.ts +0 -11
  141. package/dist/components/Toggle/Toggle.js +0 -266
  142. package/dist/components/Toggle/Toggle.stories.d.ts +0 -21
  143. package/dist/components/ToggleGroup/Group.d.ts +0 -18
  144. package/dist/components/ToggleGroup/Group.js +0 -7
  145. package/dist/components/ToggleGroup/Group.test.d.ts +0 -1
  146. package/dist/components/ToggleGroup/Toggle.d.ts +0 -15
  147. package/dist/components/ToggleGroup/Toggle.js +0 -17
  148. package/dist/components/ToggleGroup/Toggle.test.d.ts +0 -1
  149. package/dist/components/ToggleGroup/ToggleGroup.d.ts +0 -2
  150. package/dist/components/ToggleGroup/ToggleGroup.js +0 -6
  151. package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +0 -25
  152. package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -35
  153. package/dist/components/Typography/Typography.stories.d.ts +0 -32
  154. package/dist/components/Typography/typography.test.d.ts +0 -1
  155. package/dist/contexts/SnackbarProvider/SnackbarProvider.d.ts +0 -11
  156. package/dist/contexts/SnackbarProvider/SnackbarProvider.js +0 -50
  157. package/dist/contexts/SnackbarProvider/SnackbarProvider.stories.d.ts +0 -21
  158. package/dist/index-CjW42-M-.js +0 -19584
  159. package/dist/marola.css +0 -1
  160. package/dist/test-utils/assertStyles.d.ts +0 -1
  161. package/dist/test-utils/assertStyles.js +0 -11
  162. package/dist/useButton-DNk3wrQp.js +0 -105
  163. package/dist/useCompoundItem-D1iRfg8D.js +0 -84
  164. package/dist/useEventCallback-xTG9piMa.js +0 -45
  165. package/dist/useIsFocusVisible-BH4IAdcw.js +0 -69
  166. package/dist/useList-B0hog_3-.js +0 -436
  167. package/dist/useTimeout-DxF9kiZL.js +0 -36
  168. package/dist/utils/styleStrings.d.ts +0 -6
  169. package/dist/utils/styleStrings.js +0 -10
  170. package/dist/utils/styleStrings.test.d.ts +0 -1
@@ -1,639 +0,0 @@
1
- import '../../assets/Snackbar.css';
2
- import { jsx as E, jsxs as Y } from "react/jsx-runtime";
3
- import * as S from "react";
4
- import C, { useState as V, useRef as X } from "react";
5
- import { c as N } from "../../clsx-DB4S2d7J.js";
6
- import { Icon as K } from "../Icon/Icon.js";
7
- import { g as $, a as z, b as R, f as H, _ as j, c as U, P as n, d as J, e as Q } from "../../index-CH45lKw7.js";
8
- import { u as Z } from "../../useTimeout-DxF9kiZL.js";
9
- import { u as I } from "../../useEventCallback-xTG9piMa.js";
10
- import { C as B } from "../../ClickAwayListener-BSW-Nd-y.js";
11
- import { R as P } from "../../index-CjW42-M-.js";
12
- const W = "Snackbar";
13
- function ee(u) {
14
- return $(W, u);
15
- }
16
- z(W, ["root"]);
17
- function te(u = {}) {
18
- const {
19
- autoHideDuration: s = null,
20
- disableWindowBlurListener: i = !1,
21
- onClose: r,
22
- open: t,
23
- resumeHideDuration: e
24
- } = u, o = Z();
25
- S.useEffect(() => {
26
- if (!t)
27
- return;
28
- function l(c) {
29
- c.defaultPrevented || (c.key === "Escape" || c.key === "Esc") && (r == null || r(c, "escapeKeyDown"));
30
- }
31
- return document.addEventListener("keydown", l), () => {
32
- document.removeEventListener("keydown", l);
33
- };
34
- }, [t, r]);
35
- const a = I((l, c) => {
36
- r == null || r(l, c);
37
- }), p = I((l) => {
38
- !r || l == null || o.start(l, () => {
39
- a(null, "timeout");
40
- });
41
- });
42
- S.useEffect(() => (t && p(s), o.clear), [t, s, p, o]);
43
- const h = (l) => {
44
- r == null || r(l, "clickaway");
45
- }, d = o.clear, m = S.useCallback(() => {
46
- s != null && p(e ?? s * 0.5);
47
- }, [s, e, p]), y = (l) => (c) => {
48
- const f = l.onBlur;
49
- f == null || f(c), m();
50
- }, T = (l) => (c) => {
51
- const f = l.onFocus;
52
- f == null || f(c), d();
53
- }, k = (l) => (c) => {
54
- const f = l.onMouseEnter;
55
- f == null || f(c), d();
56
- }, O = (l) => (c) => {
57
- const f = l.onMouseLeave;
58
- f == null || f(c), m();
59
- };
60
- return S.useEffect(() => {
61
- if (!i && t)
62
- return window.addEventListener("focus", m), window.addEventListener("blur", d), () => {
63
- window.removeEventListener("focus", m), window.removeEventListener("blur", d);
64
- };
65
- }, [i, t, m, d]), {
66
- getRootProps: (l = {}) => {
67
- const c = R({}, H(u), H(l));
68
- return R({
69
- // ClickAwayListener adds an `onClick` prop which results in the alert not being announced.
70
- // See https://github.com/mui/material-ui/issues/29080
71
- role: "presentation"
72
- }, l, c, {
73
- onBlur: y(c),
74
- onFocus: T(c),
75
- onMouseEnter: k(c),
76
- onMouseLeave: O(c)
77
- });
78
- },
79
- onClickAway: h
80
- };
81
- }
82
- const ne = ["autoHideDuration", "children", "disableWindowBlurListener", "exited", "onBlur", "onClose", "onFocus", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "slotProps", "slots"], oe = () => J({
83
- root: ["root"]
84
- }, Q(ee)), q = /* @__PURE__ */ S.forwardRef(function(s, i) {
85
- const {
86
- autoHideDuration: r = null,
87
- children: t,
88
- disableWindowBlurListener: e = !1,
89
- exited: o = !0,
90
- onClose: a,
91
- open: p,
92
- resumeHideDuration: h,
93
- slotProps: d = {},
94
- slots: m = {}
95
- } = s, y = j(s, ne), T = oe(), {
96
- getRootProps: k,
97
- onClickAway: O
98
- } = te(R({}, s, {
99
- autoHideDuration: r,
100
- disableWindowBlurListener: e,
101
- onClose: a,
102
- open: p,
103
- resumeHideDuration: h
104
- })), L = s, l = m.root || "div", c = U({
105
- elementType: l,
106
- getSlotProps: k,
107
- externalForwardedProps: y,
108
- externalSlotProps: d.root,
109
- additionalProps: {
110
- ref: i
111
- },
112
- ownerState: L,
113
- className: T.root
114
- }), f = U({
115
- elementType: B,
116
- externalSlotProps: d.clickAwayListener,
117
- additionalProps: {
118
- onClickAway: O
119
- },
120
- ownerState: L
121
- });
122
- return delete f.ownerState, !p && o ? null : /* @__PURE__ */ E(B, R({}, f, {
123
- children: /* @__PURE__ */ E(l, R({}, c, {
124
- children: t
125
- }))
126
- }));
127
- });
128
- process.env.NODE_ENV !== "production" && (q.propTypes = {
129
- // ┌────────────────────────────── Warning ──────────────────────────────┐
130
- // │ These PropTypes are generated from the TypeScript type definitions. │
131
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
132
- // └─────────────────────────────────────────────────────────────────────┘
133
- /**
134
- * The number of milliseconds to wait before automatically calling the
135
- * `onClose` function. `onClose` should then set the state of the `open`
136
- * prop to hide the Snackbar. This behavior is disabled by default with
137
- * the `null` value.
138
- * @default null
139
- */
140
- autoHideDuration: n.number,
141
- /**
142
- * @ignore
143
- */
144
- children: n.node,
145
- /**
146
- * If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
147
- * @default false
148
- */
149
- disableWindowBlurListener: n.bool,
150
- /**
151
- * The prop used to handle exited transition and unmount the component.
152
- * @default true
153
- */
154
- exited: n.bool,
155
- /**
156
- * Callback fired when the component requests to be closed.
157
- * Typically `onClose` is used to set state in the parent component,
158
- * which is used to control the `Snackbar` `open` prop.
159
- * The `reason` parameter can optionally be used to control the response to `onClose`,
160
- * for example ignoring `clickaway`.
161
- *
162
- * @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
163
- * @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
164
- */
165
- onClose: n.func,
166
- /**
167
- * If `true`, the component is shown.
168
- */
169
- open: n.bool,
170
- /**
171
- * The number of milliseconds to wait before dismissing after user interaction.
172
- * If `autoHideDuration` prop isn't specified, it does nothing.
173
- * If `autoHideDuration` prop is specified but `resumeHideDuration` isn't,
174
- * we default to `autoHideDuration / 2` ms.
175
- */
176
- resumeHideDuration: n.number,
177
- /**
178
- * The props used for each slot inside the Snackbar.
179
- * @default {}
180
- */
181
- slotProps: n.shape({
182
- clickAwayListener: n.oneOfType([n.func, n.shape({
183
- children: n.element.isRequired,
184
- disableReactTree: n.bool,
185
- mouseEvent: n.oneOf(["onClick", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", !1]),
186
- onClickAway: n.func,
187
- touchEvent: n.oneOf(["onTouchEnd", "onTouchStart", !1])
188
- })]),
189
- root: n.oneOfType([n.func, n.object])
190
- }),
191
- /**
192
- * The components used for each slot inside the Snackbar.
193
- * Either a string to use a HTML element or a component.
194
- * @default {}
195
- */
196
- slots: n.shape({
197
- root: n.elementType
198
- })
199
- });
200
- function M(u, s) {
201
- return M = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, t) {
202
- return r.__proto__ = t, r;
203
- }, M(u, s);
204
- }
205
- function re(u, s) {
206
- u.prototype = Object.create(s.prototype), u.prototype.constructor = u, M(u, s);
207
- }
208
- const F = {
209
- disabled: !1
210
- };
211
- var se = process.env.NODE_ENV !== "production" ? n.oneOfType([n.number, n.shape({
212
- enter: n.number,
213
- exit: n.number,
214
- appear: n.number
215
- }).isRequired]) : null;
216
- process.env.NODE_ENV !== "production" && n.oneOfType([n.string, n.shape({
217
- enter: n.string,
218
- exit: n.string,
219
- active: n.string
220
- }), n.shape({
221
- enter: n.string,
222
- enterDone: n.string,
223
- enterActive: n.string,
224
- exit: n.string,
225
- exitDone: n.string,
226
- exitActive: n.string
227
- })]);
228
- const G = C.createContext(null);
229
- var ae = function(s) {
230
- return s.scrollTop;
231
- }, D = "unmounted", g = "exited", x = "entering", w = "entered", A = "exiting", b = /* @__PURE__ */ function(u) {
232
- re(s, u);
233
- function s(r, t) {
234
- var e;
235
- e = u.call(this, r, t) || this;
236
- var o = t, a = o && !o.isMounting ? r.enter : r.appear, p;
237
- return e.appearStatus = null, r.in ? a ? (p = g, e.appearStatus = x) : p = w : r.unmountOnExit || r.mountOnEnter ? p = D : p = g, e.state = {
238
- status: p
239
- }, e.nextCallback = null, e;
240
- }
241
- s.getDerivedStateFromProps = function(t, e) {
242
- var o = t.in;
243
- return o && e.status === D ? {
244
- status: g
245
- } : null;
246
- };
247
- var i = s.prototype;
248
- return i.componentDidMount = function() {
249
- this.updateStatus(!0, this.appearStatus);
250
- }, i.componentDidUpdate = function(t) {
251
- var e = null;
252
- if (t !== this.props) {
253
- var o = this.state.status;
254
- this.props.in ? o !== x && o !== w && (e = x) : (o === x || o === w) && (e = A);
255
- }
256
- this.updateStatus(!1, e);
257
- }, i.componentWillUnmount = function() {
258
- this.cancelNextCallback();
259
- }, i.getTimeouts = function() {
260
- var t = this.props.timeout, e, o, a;
261
- return e = o = a = t, t != null && typeof t != "number" && (e = t.exit, o = t.enter, a = t.appear !== void 0 ? t.appear : o), {
262
- exit: e,
263
- enter: o,
264
- appear: a
265
- };
266
- }, i.updateStatus = function(t, e) {
267
- if (t === void 0 && (t = !1), e !== null)
268
- if (this.cancelNextCallback(), e === x) {
269
- if (this.props.unmountOnExit || this.props.mountOnEnter) {
270
- var o = this.props.nodeRef ? this.props.nodeRef.current : P.findDOMNode(this);
271
- o && ae(o);
272
- }
273
- this.performEnter(t);
274
- } else
275
- this.performExit();
276
- else
277
- this.props.unmountOnExit && this.state.status === g && this.setState({
278
- status: D
279
- });
280
- }, i.performEnter = function(t) {
281
- var e = this, o = this.props.enter, a = this.context ? this.context.isMounting : t, p = this.props.nodeRef ? [a] : [P.findDOMNode(this), a], h = p[0], d = p[1], m = this.getTimeouts(), y = a ? m.appear : m.enter;
282
- if (!t && !o || F.disabled) {
283
- this.safeSetState({
284
- status: w
285
- }, function() {
286
- e.props.onEntered(h);
287
- });
288
- return;
289
- }
290
- this.props.onEnter(h, d), this.safeSetState({
291
- status: x
292
- }, function() {
293
- e.props.onEntering(h, d), e.onTransitionEnd(y, function() {
294
- e.safeSetState({
295
- status: w
296
- }, function() {
297
- e.props.onEntered(h, d);
298
- });
299
- });
300
- });
301
- }, i.performExit = function() {
302
- var t = this, e = this.props.exit, o = this.getTimeouts(), a = this.props.nodeRef ? void 0 : P.findDOMNode(this);
303
- if (!e || F.disabled) {
304
- this.safeSetState({
305
- status: g
306
- }, function() {
307
- t.props.onExited(a);
308
- });
309
- return;
310
- }
311
- this.props.onExit(a), this.safeSetState({
312
- status: A
313
- }, function() {
314
- t.props.onExiting(a), t.onTransitionEnd(o.exit, function() {
315
- t.safeSetState({
316
- status: g
317
- }, function() {
318
- t.props.onExited(a);
319
- });
320
- });
321
- });
322
- }, i.cancelNextCallback = function() {
323
- this.nextCallback !== null && (this.nextCallback.cancel(), this.nextCallback = null);
324
- }, i.safeSetState = function(t, e) {
325
- e = this.setNextCallback(e), this.setState(t, e);
326
- }, i.setNextCallback = function(t) {
327
- var e = this, o = !0;
328
- return this.nextCallback = function(a) {
329
- o && (o = !1, e.nextCallback = null, t(a));
330
- }, this.nextCallback.cancel = function() {
331
- o = !1;
332
- }, this.nextCallback;
333
- }, i.onTransitionEnd = function(t, e) {
334
- this.setNextCallback(e);
335
- var o = this.props.nodeRef ? this.props.nodeRef.current : P.findDOMNode(this), a = t == null && !this.props.addEndListener;
336
- if (!o || a) {
337
- setTimeout(this.nextCallback, 0);
338
- return;
339
- }
340
- if (this.props.addEndListener) {
341
- var p = this.props.nodeRef ? [this.nextCallback] : [o, this.nextCallback], h = p[0], d = p[1];
342
- this.props.addEndListener(h, d);
343
- }
344
- t != null && setTimeout(this.nextCallback, t);
345
- }, i.render = function() {
346
- var t = this.state.status;
347
- if (t === D)
348
- return null;
349
- var e = this.props, o = e.children;
350
- e.in, e.mountOnEnter, e.unmountOnExit, e.appear, e.enter, e.exit, e.timeout, e.addEndListener, e.onEnter, e.onEntering, e.onEntered, e.onExit, e.onExiting, e.onExited, e.nodeRef;
351
- var a = j(e, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
352
- return (
353
- // allows for nested Transitions
354
- /* @__PURE__ */ C.createElement(G.Provider, {
355
- value: null
356
- }, typeof o == "function" ? o(t, a) : C.cloneElement(C.Children.only(o), a))
357
- );
358
- }, s;
359
- }(C.Component);
360
- b.contextType = G;
361
- b.propTypes = process.env.NODE_ENV !== "production" ? {
362
- /**
363
- * A React reference to DOM element that need to transition:
364
- * https://stackoverflow.com/a/51127130/4671932
365
- *
366
- * - When `nodeRef` prop is used, `node` is not passed to callback functions
367
- * (e.g. `onEnter`) because user already has direct access to the node.
368
- * - When changing `key` prop of `Transition` in a `TransitionGroup` a new
369
- * `nodeRef` need to be provided to `Transition` with changed `key` prop
370
- * (see
371
- * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
372
- */
373
- nodeRef: n.shape({
374
- current: typeof Element > "u" ? n.any : function(u, s, i, r, t, e) {
375
- var o = u[s];
376
- return n.instanceOf(o && "ownerDocument" in o ? o.ownerDocument.defaultView.Element : Element)(u, s, i, r, t, e);
377
- }
378
- }),
379
- /**
380
- * A `function` child can be used instead of a React element. This function is
381
- * called with the current transition status (`'entering'`, `'entered'`,
382
- * `'exiting'`, `'exited'`), which can be used to apply context
383
- * specific props to a component.
384
- *
385
- * ```jsx
386
- * <Transition in={this.state.in} timeout={150}>
387
- * {state => (
388
- * <MyComponent className={`fade fade-${state}`} />
389
- * )}
390
- * </Transition>
391
- * ```
392
- */
393
- children: n.oneOfType([n.func.isRequired, n.element.isRequired]).isRequired,
394
- /**
395
- * Show the component; triggers the enter or exit states
396
- */
397
- in: n.bool,
398
- /**
399
- * By default the child component is mounted immediately along with
400
- * the parent `Transition` component. If you want to "lazy mount" the component on the
401
- * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
402
- * mounted, even on "exited", unless you also specify `unmountOnExit`.
403
- */
404
- mountOnEnter: n.bool,
405
- /**
406
- * By default the child component stays mounted after it reaches the `'exited'` state.
407
- * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
408
- */
409
- unmountOnExit: n.bool,
410
- /**
411
- * By default the child component does not perform the enter transition when
412
- * it first mounts, regardless of the value of `in`. If you want this
413
- * behavior, set both `appear` and `in` to `true`.
414
- *
415
- * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
416
- * > only adds an additional enter transition. However, in the
417
- * > `<CSSTransition>` component that first enter transition does result in
418
- * > additional `.appear-*` classes, that way you can choose to style it
419
- * > differently.
420
- */
421
- appear: n.bool,
422
- /**
423
- * Enable or disable enter transitions.
424
- */
425
- enter: n.bool,
426
- /**
427
- * Enable or disable exit transitions.
428
- */
429
- exit: n.bool,
430
- /**
431
- * The duration of the transition, in milliseconds.
432
- * Required unless `addEndListener` is provided.
433
- *
434
- * You may specify a single timeout for all transitions:
435
- *
436
- * ```jsx
437
- * timeout={500}
438
- * ```
439
- *
440
- * or individually:
441
- *
442
- * ```jsx
443
- * timeout={{
444
- * appear: 500,
445
- * enter: 300,
446
- * exit: 500,
447
- * }}
448
- * ```
449
- *
450
- * - `appear` defaults to the value of `enter`
451
- * - `enter` defaults to `0`
452
- * - `exit` defaults to `0`
453
- *
454
- * @type {number | { enter?: number, exit?: number, appear?: number }}
455
- */
456
- timeout: function(s) {
457
- var i = se;
458
- s.addEndListener || (i = i.isRequired);
459
- for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), e = 1; e < r; e++)
460
- t[e - 1] = arguments[e];
461
- return i.apply(void 0, [s].concat(t));
462
- },
463
- /**
464
- * Add a custom transition end trigger. Called with the transitioning
465
- * DOM node and a `done` callback. Allows for more fine grained transition end
466
- * logic. Timeouts are still used as a fallback if provided.
467
- *
468
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
469
- *
470
- * ```jsx
471
- * addEndListener={(node, done) => {
472
- * // use the css transitionend event to mark the finish of a transition
473
- * node.addEventListener('transitionend', done, false);
474
- * }}
475
- * ```
476
- */
477
- addEndListener: n.func,
478
- /**
479
- * Callback fired before the "entering" status is applied. An extra parameter
480
- * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
481
- *
482
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
483
- *
484
- * @type Function(node: HtmlElement, isAppearing: bool) -> void
485
- */
486
- onEnter: n.func,
487
- /**
488
- * Callback fired after the "entering" status is applied. An extra parameter
489
- * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
490
- *
491
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
492
- *
493
- * @type Function(node: HtmlElement, isAppearing: bool)
494
- */
495
- onEntering: n.func,
496
- /**
497
- * Callback fired after the "entered" status is applied. An extra parameter
498
- * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
499
- *
500
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
501
- *
502
- * @type Function(node: HtmlElement, isAppearing: bool) -> void
503
- */
504
- onEntered: n.func,
505
- /**
506
- * Callback fired before the "exiting" status is applied.
507
- *
508
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
509
- *
510
- * @type Function(node: HtmlElement) -> void
511
- */
512
- onExit: n.func,
513
- /**
514
- * Callback fired after the "exiting" status is applied.
515
- *
516
- * **Note**: when `nodeRef` prop is passed, `node` is not passed.
517
- *
518
- * @type Function(node: HtmlElement) -> void
519
- */
520
- onExiting: n.func,
521
- /**
522
- * Callback fired after the "exited" status is applied.
523
- *
524
- * **Note**: when `nodeRef` prop is passed, `node` is not passed
525
- *
526
- * @type Function(node: HtmlElement) -> void
527
- */
528
- onExited: n.func
529
- } : {};
530
- function _() {
531
- }
532
- b.defaultProps = {
533
- in: !1,
534
- mountOnEnter: !1,
535
- unmountOnExit: !1,
536
- appear: !1,
537
- enter: !0,
538
- exit: !0,
539
- onEnter: _,
540
- onEntering: _,
541
- onEntered: _,
542
- onExit: _,
543
- onExiting: _,
544
- onExited: _
545
- };
546
- b.UNMOUNTED = D;
547
- b.EXITED = g;
548
- b.ENTERING = x;
549
- b.ENTERED = w;
550
- b.EXITING = A;
551
- const ie = "_snackbar_1w4kg_56", ue = "_bottomToTop_1w4kg_1", v = {
552
- "u-typography-h1": "_u-typography-h1_1w4kg_1",
553
- "u-typography-h2": "_u-typography-h2_1w4kg_8",
554
- "u-typography-h3": "_u-typography-h3_1w4kg_15",
555
- "u-typography-h4": "_u-typography-h4_1w4kg_22",
556
- "u-typography-h5": "_u-typography-h5_1w4kg_29",
557
- "u-typography-h6": "_u-typography-h6_1w4kg_36",
558
- "u-typography-base": "_u-typography-base_1w4kg_43",
559
- "u-typography-base--xxl": "_u-typography-base--xxl_1w4kg_48",
560
- "u-typography-base--xl": "_u-typography-base--xl_1w4kg_52",
561
- "u-typography-base--lg": "_u-typography-base--lg_1w4kg_56",
562
- "snackbar--message": "_snackbar--message_1w4kg_56",
563
- "u-typography-base--sm": "_u-typography-base--sm_1w4kg_60",
564
- "u-typography-base--bold": "_u-typography-base--bold_1w4kg_64",
565
- "u-typography-base--strikethrough": "_u-typography-base--strikethrough_1w4kg_67",
566
- "u-typography-base--underlined": "_u-typography-base--underlined_1w4kg_70",
567
- "u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_1w4kg_73",
568
- snackbar: ie,
569
- "snackbar__snackbar-el-wrapper": "_snackbar__snackbar-el-wrapper_1w4kg_90",
570
- "snackbar--content": "_snackbar--content_1w4kg_95",
571
- "snackbar--success": "_snackbar--success_1w4kg_105",
572
- "snackbar--error": "_snackbar--error_1w4kg_108",
573
- "snackbar--warning": "_snackbar--warning_1w4kg_111",
574
- "snackbar--action": "_snackbar--action_1w4kg_121",
575
- bottomToTop: ue
576
- }, ye = ({
577
- snackbarMessage: u,
578
- variant: s,
579
- autoHideDuration: i = 5e3,
580
- open: r = !0,
581
- onClose: t,
582
- onClosed: e,
583
- classNameWrapper: o,
584
- "data-testid": a
585
- }) => {
586
- const [p, h] = V(!0), d = X(null), m = {
587
- entering: "translateY(0)",
588
- entered: "translateY(0)",
589
- exiting: "translateY(80px)",
590
- exited: "translateY(80px)",
591
- unmounted: "translateY(80px)"
592
- }, y = () => {
593
- h(!1);
594
- }, T = () => {
595
- h(!0);
596
- };
597
- return /* @__PURE__ */ E("div", { className: N(v.snackbar, o), children: /* @__PURE__ */ E(
598
- q,
599
- {
600
- autoHideDuration: i,
601
- open: r,
602
- onClose: (k, O) => O !== "clickaway" && (t == null ? void 0 : t()),
603
- exited: p,
604
- className: N(v["snackbar__snackbar-el-wrapper"]),
605
- children: /* @__PURE__ */ E(
606
- b,
607
- {
608
- timeout: { enter: 400, exit: 400 },
609
- in: r,
610
- appear: !0,
611
- unmountOnExit: !0,
612
- onEnter: y,
613
- onExited: T,
614
- onExit: e,
615
- nodeRef: d,
616
- children: (k) => /* @__PURE__ */ Y(
617
- "div",
618
- {
619
- className: N(v["snackbar--content"], v[`snackbar--${s}`]),
620
- style: {
621
- transform: m[k],
622
- transition: "transform 300ms ease"
623
- },
624
- ref: d,
625
- "data-testid": a,
626
- children: [
627
- /* @__PURE__ */ E("div", { className: N(v["snackbar--message"]), children: /* @__PURE__ */ E("p", { children: u }) }),
628
- /* @__PURE__ */ E("div", { className: N(v["snackbar--action"]), children: /* @__PURE__ */ E("a", { onClick: t, children: /* @__PURE__ */ E(K, { icon: "xmark", color: "var(--white-100)", size: "1.5rem" }) }) })
629
- ]
630
- }
631
- )
632
- }
633
- )
634
- }
635
- ) });
636
- };
637
- export {
638
- ye as Snackbar
639
- };