@zendeskgarden/react-notifications 8.57.1 → 8.59.0

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/index.esm.js CHANGED
@@ -14,256 +14,76 @@ import { TransitionGroup, CSSTransition } from 'react-transition-group';
14
14
  import { uid } from 'react-uid';
15
15
  import { hideVisually } from 'polished';
16
16
 
17
- function ownKeys(object, enumerableOnly) {
18
- var keys = Object.keys(object);
19
-
20
- if (Object.getOwnPropertySymbols) {
21
- var symbols = Object.getOwnPropertySymbols(object);
22
- enumerableOnly && (symbols = symbols.filter(function (sym) {
23
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
24
- })), keys.push.apply(keys, symbols);
25
- }
26
-
27
- return keys;
28
- }
29
-
30
- function _objectSpread2(target) {
31
- for (var i = 1; i < arguments.length; i++) {
32
- var source = null != arguments[i] ? arguments[i] : {};
33
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
34
- _defineProperty(target, key, source[key]);
35
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
36
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
37
- });
38
- }
39
-
40
- return target;
41
- }
42
-
43
- function _defineProperty(obj, key, value) {
44
- if (key in obj) {
45
- Object.defineProperty(obj, key, {
46
- value: value,
47
- enumerable: true,
48
- configurable: true,
49
- writable: true
50
- });
51
- } else {
52
- obj[key] = value;
53
- }
54
-
55
- return obj;
56
- }
57
-
58
17
  function _extends$5() {
59
18
  _extends$5 = Object.assign ? Object.assign.bind() : function (target) {
60
19
  for (var i = 1; i < arguments.length; i++) {
61
20
  var source = arguments[i];
62
-
63
21
  for (var key in source) {
64
22
  if (Object.prototype.hasOwnProperty.call(source, key)) {
65
23
  target[key] = source[key];
66
24
  }
67
25
  }
68
26
  }
69
-
70
27
  return target;
71
28
  };
72
29
  return _extends$5.apply(this, arguments);
73
30
  }
74
31
 
75
- function _objectWithoutPropertiesLoose(source, excluded) {
76
- if (source == null) return {};
77
- var target = {};
78
- var sourceKeys = Object.keys(source);
79
- var key, i;
80
-
81
- for (i = 0; i < sourceKeys.length; i++) {
82
- key = sourceKeys[i];
83
- if (excluded.indexOf(key) >= 0) continue;
84
- target[key] = source[key];
85
- }
86
-
87
- return target;
88
- }
89
-
90
- function _objectWithoutProperties(source, excluded) {
91
- if (source == null) return {};
92
-
93
- var target = _objectWithoutPropertiesLoose(source, excluded);
94
-
95
- var key, i;
96
-
97
- if (Object.getOwnPropertySymbols) {
98
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
99
-
100
- for (i = 0; i < sourceSymbolKeys.length; i++) {
101
- key = sourceSymbolKeys[i];
102
- if (excluded.indexOf(key) >= 0) continue;
103
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
104
- target[key] = source[key];
105
- }
106
- }
107
-
108
- return target;
109
- }
110
-
111
- function _slicedToArray(arr, i) {
112
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
113
- }
114
-
115
- function _toConsumableArray(arr) {
116
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
117
- }
118
-
119
- function _arrayWithoutHoles(arr) {
120
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
121
- }
122
-
123
- function _arrayWithHoles(arr) {
124
- if (Array.isArray(arr)) return arr;
125
- }
126
-
127
- function _iterableToArray(iter) {
128
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
129
- }
130
-
131
- function _iterableToArrayLimit(arr, i) {
132
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
133
-
134
- if (_i == null) return;
135
- var _arr = [];
136
- var _n = true;
137
- var _d = false;
138
-
139
- var _s, _e;
140
-
141
- try {
142
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
143
- _arr.push(_s.value);
144
-
145
- if (i && _arr.length === i) break;
146
- }
147
- } catch (err) {
148
- _d = true;
149
- _e = err;
150
- } finally {
151
- try {
152
- if (!_n && _i["return"] != null) _i["return"]();
153
- } finally {
154
- if (_d) throw _e;
155
- }
156
- }
157
-
158
- return _arr;
159
- }
160
-
161
- function _unsupportedIterableToArray(o, minLen) {
162
- if (!o) return;
163
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
164
- var n = Object.prototype.toString.call(o).slice(8, -1);
165
- if (n === "Object" && o.constructor) n = o.constructor.name;
166
- if (n === "Map" || n === "Set") return Array.from(o);
167
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
168
- }
169
-
170
- function _arrayLikeToArray(arr, len) {
171
- if (len == null || len > arr.length) len = arr.length;
172
-
173
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
174
-
175
- return arr2;
176
- }
177
-
178
- function _nonIterableSpread() {
179
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
180
- }
181
-
182
- function _nonIterableRest() {
183
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
184
- }
32
+ const TYPE = ['success', 'warning', 'error', 'info'];
185
33
 
186
- var TYPE = ['success', 'warning', 'error', 'info'];
187
-
188
- var COMPONENT_ID$5 = 'notifications.close';
189
- var StyledClose = styled.button.attrs({
34
+ const COMPONENT_ID$5 = 'notifications.close';
35
+ const StyledClose = styled.button.attrs({
190
36
  'data-garden-id': COMPONENT_ID$5,
191
- 'data-garden-version': '8.57.1'
37
+ 'data-garden-version': '8.59.0'
192
38
  }).withConfig({
193
39
  displayName: "StyledClose",
194
40
  componentId: "sc-1mr9nx1-0"
195
- })(["display:block;position:absolute;top:", "px;", ":", ";transition:background-color 0.1s ease-in-out,color 0.25s ease-in-out;border:none;border-radius:50%;background-color:transparent;cursor:pointer;padding:0;width:", "px;height:", "px;overflow:hidden;color:", ";font-size:0;user-select:none;&:hover{color:", ";}&:focus{outline:none;}&[data-garden-focus-visible]{background-color:", ";color:", ";&::-moz-focus-inner{border:0;}}", ";"], function (props) {
196
- return props.theme.space.base;
197
- }, function (props) {
198
- return props.theme.rtl ? 'left' : 'right';
199
- }, function (props) {
200
- return "".concat(props.theme.space.base, "px");
201
- }, function (props) {
202
- return props.theme.space.base * 7;
203
- }, function (props) {
204
- return props.theme.space.base * 7;
205
- }, function (props) {
206
- return props.hue ? getColor(props.hue, props.hue === 'warningHue' ? 700 : 600, props.theme) : getColor('neutralHue', 600, props.theme);
207
- }, function (props) {
208
- return props.hue ? getColor(props.hue, 800, props.theme) : getColor('neutralHue', 800, props.theme);
209
- }, function (props) {
210
- return props.hue ? getColor(props.hue, props.hue === 'warningHue' ? 700 : 600, props.theme, 0.15) : getColor('neutralHue', 600, props.theme, 0.15);
211
- }, function (props) {
212
- return props.hue ? getColor(props.hue, 800, props.theme) : getColor('neutralHue', 800, props.theme);
213
- }, function (props) {
214
- return retrieveComponentStyles(COMPONENT_ID$5, props);
215
- });
41
+ })(["display:block;position:absolute;top:", "px;", ":", ";transition:background-color 0.1s ease-in-out,color 0.25s ease-in-out;border:none;border-radius:50%;background-color:transparent;cursor:pointer;padding:0;width:", "px;height:", "px;overflow:hidden;color:", ";font-size:0;user-select:none;&:hover{color:", ";}&:focus{outline:none;}&[data-garden-focus-visible]{background-color:", ";color:", ";&::-moz-focus-inner{border:0;}}", ";"], props => props.theme.space.base, props => props.theme.rtl ? 'left' : 'right', props => `${props.theme.space.base}px`, props => props.theme.space.base * 7, props => props.theme.space.base * 7, props => props.hue ? getColor(props.hue, props.hue === 'warningHue' ? 700 : 600, props.theme) : getColor('neutralHue', 600, props.theme), props => props.hue ? getColor(props.hue, 800, props.theme) : getColor('neutralHue', 800, props.theme), props => props.hue ? getColor(props.hue, props.hue === 'warningHue' ? 700 : 600, props.theme, 0.15) : getColor('neutralHue', 600, props.theme, 0.15), props => props.hue ? getColor(props.hue, 800, props.theme) : getColor('neutralHue', 800, props.theme), props => retrieveComponentStyles(COMPONENT_ID$5, props));
216
42
  StyledClose.defaultProps = {
217
43
  theme: DEFAULT_THEME
218
44
  };
219
45
 
220
- var COMPONENT_ID$4 = 'notifications.paragraph';
221
- var StyledParagraph = styled.p.attrs({
46
+ const COMPONENT_ID$4 = 'notifications.paragraph';
47
+ const StyledParagraph = styled.p.attrs({
222
48
  'data-garden-id': COMPONENT_ID$4,
223
- 'data-garden-version': '8.57.1'
49
+ 'data-garden-version': '8.59.0'
224
50
  }).withConfig({
225
51
  displayName: "StyledParagraph",
226
52
  componentId: "sc-12tmd6p-0"
227
- })(["margin:", "px 0 0;", ";"], function (props) {
228
- return props.theme.space.base * 2;
229
- }, function (props) {
230
- return retrieveComponentStyles(COMPONENT_ID$4, props);
231
- });
53
+ })(["margin:", "px 0 0;", ";"], props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID$4, props));
232
54
  StyledParagraph.defaultProps = {
233
55
  theme: DEFAULT_THEME
234
56
  };
235
57
 
236
- var COMPONENT_ID$3 = 'notifications.title';
237
- var StyledTitle = styled.div.attrs({
58
+ const COMPONENT_ID$3 = 'notifications.title';
59
+ const StyledTitle = styled.div.attrs({
238
60
  'data-garden-id': COMPONENT_ID$3,
239
- 'data-garden-version': '8.57.1'
61
+ 'data-garden-version': '8.59.0'
240
62
  }).withConfig({
241
63
  displayName: "StyledTitle",
242
64
  componentId: "sc-xx4jsv-0"
243
- })(["margin:0;color:", ";font-weight:", ";", ";"], function (props) {
244
- return props.theme.colors.foreground;
245
- }, function (props) {
246
- return props.isRegular ? props.theme.fontWeights.regular : props.theme.fontWeights.semibold;
247
- }, function (props) {
248
- return retrieveComponentStyles(COMPONENT_ID$3, props);
249
- });
65
+ })(["margin:0;color:", ";font-weight:", ";", ";"], props => props.theme.colors.foreground, props => props.isRegular ? props.theme.fontWeights.regular : props.theme.fontWeights.semibold, props => retrieveComponentStyles(COMPONENT_ID$3, props));
250
66
  StyledTitle.defaultProps = {
251
67
  theme: DEFAULT_THEME
252
68
  };
253
69
 
254
- var boxShadow = function boxShadow(props) {
255
- var theme = props.theme;
256
- var space = theme.space,
257
- shadows = theme.shadows;
258
- var offsetY = "".concat(space.base * 5, "px");
259
- var blurRadius = "".concat(space.base * 7, "px");
260
- var color = getColor('chromeHue', 600, theme, 0.15);
70
+ const boxShadow = props => {
71
+ const {
72
+ theme
73
+ } = props;
74
+ const {
75
+ space,
76
+ shadows
77
+ } = theme;
78
+ const offsetY = `${space.base * 5}px`;
79
+ const blurRadius = `${space.base * 7}px`;
80
+ const color = getColor('chromeHue', 600, theme, 0.15);
261
81
  return shadows.lg(offsetY, blurRadius, color);
262
82
  };
263
- var colorStyles$2 = function colorStyles(props) {
264
- var backgroundColor;
265
- var borderColor;
266
- var foregroundColor;
83
+ const colorStyles$2 = props => {
84
+ let backgroundColor;
85
+ let borderColor;
86
+ let foregroundColor;
267
87
  if (props.hue) {
268
88
  backgroundColor = getColor(props.hue, 100, props.theme);
269
89
  borderColor = getColor(props.hue, 300, props.theme);
@@ -275,62 +95,52 @@ var colorStyles$2 = function colorStyles(props) {
275
95
  }
276
96
  return css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, foregroundColor);
277
97
  };
278
- var padding = function padding(props) {
279
- var space = props.theme.space;
280
- var paddingVertical = "".concat(space.base * 5, "px");
281
- var paddingHorizontal = "".concat(space.base * 10, "px");
282
- return "".concat(paddingVertical, " ").concat(paddingHorizontal);
98
+ const padding = props => {
99
+ const {
100
+ space
101
+ } = props.theme;
102
+ const paddingVertical = `${space.base * 5}px`;
103
+ const paddingHorizontal = `${space.base * 10}px`;
104
+ return `${paddingVertical} ${paddingHorizontal}`;
283
105
  };
284
- var StyledBase = styled.div.withConfig({
106
+ const StyledBase = styled.div.withConfig({
285
107
  displayName: "StyledBase",
286
108
  componentId: "sc-14syaqw-0"
287
- })(["position:relative;border:", ";border-radius:", ";box-shadow:", ";padding:", ";line-height:", ";font-size:", ";direction:", ";", ";"], function (props) {
288
- return props.theme.borders.sm;
289
- }, function (props) {
290
- return props.theme.borderRadii.md;
291
- }, function (props) {
292
- return props.isFloating && boxShadow;
293
- }, padding, function (props) {
294
- return getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md);
295
- }, function (props) {
296
- return props.theme.fontSizes.md;
297
- }, function (props) {
298
- return props.theme.rtl && 'rtl';
299
- }, colorStyles$2);
109
+ })(["position:relative;border:", ";border-radius:", ";box-shadow:", ";padding:", ";line-height:", ";font-size:", ";direction:", ";", ";"], props => props.theme.borders.sm, props => props.theme.borderRadii.md, props => props.isFloating && boxShadow, padding, props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', colorStyles$2);
300
110
  StyledBase.defaultProps = {
301
111
  theme: DEFAULT_THEME
302
112
  };
303
113
 
304
- var COMPONENT_ID$2 = 'notifications.alert';
305
- var colorStyles$1 = function colorStyles(props) {
306
- return css(["", "{color:", ";}"], StyledTitle, props.hue && getColor(props.hue, 800, props.theme));
307
- };
308
- var StyledAlert = styled(StyledBase).attrs(function (props) {
309
- return {
310
- 'data-garden-id': COMPONENT_ID$2,
311
- 'data-garden-version': '8.57.1',
312
- role: props.role === undefined ? 'alert' : props.role
313
- };
314
- }).withConfig({
114
+ const COMPONENT_ID$2 = 'notifications.alert';
115
+ const colorStyles$1 = props => css(["", "{color:", ";}"], StyledTitle, props.hue && getColor(props.hue, 800, props.theme));
116
+ const StyledAlert = styled(StyledBase).attrs(props => ({
117
+ 'data-garden-id': COMPONENT_ID$2,
118
+ 'data-garden-version': '8.59.0',
119
+ role: props.role === undefined ? 'alert' : props.role
120
+ })).withConfig({
315
121
  displayName: "StyledAlert",
316
122
  componentId: "sc-fyn8jp-0"
317
- })(["", " ", ";"], colorStyles$1, function (props) {
318
- return retrieveComponentStyles(COMPONENT_ID$2, props);
319
- });
123
+ })(["", " ", ";"], colorStyles$1, props => retrieveComponentStyles(COMPONENT_ID$2, props));
320
124
  StyledAlert.defaultProps = {
321
125
  theme: DEFAULT_THEME
322
126
  };
323
127
 
324
- var COMPONENT_ID$1 = 'notifications.notification';
325
- var colorStyles = function colorStyles(props) {
326
- var type = props.type,
327
- theme = props.theme;
328
- var colors = theme.colors;
329
- var successHue = colors.successHue,
330
- dangerHue = colors.dangerHue,
331
- warningHue = colors.warningHue,
332
- foreground = colors.foreground;
333
- var color;
128
+ const COMPONENT_ID$1 = 'notifications.notification';
129
+ const colorStyles = props => {
130
+ const {
131
+ type,
132
+ theme
133
+ } = props;
134
+ const {
135
+ colors
136
+ } = theme;
137
+ const {
138
+ successHue,
139
+ dangerHue,
140
+ warningHue,
141
+ foreground
142
+ } = colors;
143
+ let color;
334
144
  switch (type) {
335
145
  case 'success':
336
146
  color = getColor(successHue, 600, theme);
@@ -350,18 +160,14 @@ var colorStyles = function colorStyles(props) {
350
160
  }
351
161
  return css(["", "{color:", ";}"], StyledTitle, color);
352
162
  };
353
- var StyledNotification = styled(StyledBase).attrs(function (props) {
354
- return {
355
- 'data-garden-id': COMPONENT_ID$1,
356
- 'data-garden-version': '8.57.1',
357
- role: props.role === undefined ? 'status' : props.role
358
- };
359
- }).withConfig({
163
+ const StyledNotification = styled(StyledBase).attrs(props => ({
164
+ 'data-garden-id': COMPONENT_ID$1,
165
+ 'data-garden-version': '8.59.0',
166
+ role: props.role === undefined ? 'status' : props.role
167
+ })).withConfig({
360
168
  displayName: "StyledNotification",
361
169
  componentId: "sc-uf6jh-0"
362
- })(["", " ", ";"], colorStyles, function (props) {
363
- return retrieveComponentStyles(COMPONENT_ID$1, props);
364
- });
170
+ })(["", " ", ";"], colorStyles, props => retrieveComponentStyles(COMPONENT_ID$1, props));
365
171
  StyledNotification.propTypes = {
366
172
  type: PropTypes.oneOf(TYPE)
367
173
  };
@@ -369,41 +175,28 @@ StyledNotification.defaultProps = {
369
175
  theme: DEFAULT_THEME
370
176
  };
371
177
 
372
- var COMPONENT_ID = 'notifications.well';
373
- var StyledWell = styled(StyledBase).attrs({
178
+ const COMPONENT_ID = 'notifications.well';
179
+ const StyledWell = styled(StyledBase).attrs({
374
180
  'data-garden-id': COMPONENT_ID,
375
- 'data-garden-version': '8.57.1'
181
+ 'data-garden-version': '8.59.0'
376
182
  }).withConfig({
377
183
  displayName: "StyledWell",
378
184
  componentId: "sc-a5831c-0"
379
- })(["background-color:", ";color:", " ", ";"], function (props) {
380
- return props.isRecessed && getColor('neutralHue', 100, props.theme);
381
- }, function (props) {
382
- return getColor('neutralHue', 600, props.theme);
383
- }, function (props) {
384
- return retrieveComponentStyles(COMPONENT_ID, props);
385
- });
185
+ })(["background-color:", ";color:", " ", ";"], props => props.isRecessed && getColor('neutralHue', 100, props.theme), props => getColor('neutralHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID, props));
386
186
  StyledWell.defaultProps = {
387
187
  theme: DEFAULT_THEME
388
188
  };
389
189
 
390
- var _excluded$2 = ["children"];
391
- var StyledIcon = styled(function (_ref) {
392
- var children = _ref.children,
393
- props = _objectWithoutProperties(_ref, _excluded$2);
190
+ const StyledIcon = styled(_ref => {
191
+ let {
192
+ children,
193
+ ...props
194
+ } = _ref;
394
195
  return React__default.cloneElement(Children.only(children), props);
395
196
  }).withConfig({
396
197
  displayName: "StyledIcon",
397
198
  componentId: "sc-msklws-0"
398
- })(["position:absolute;right:", ";left:", ";margin-top:", "px;color:", ";"], function (props) {
399
- return props.theme.rtl && "".concat(props.theme.space.base * 4, "px");
400
- }, function (props) {
401
- return !props.theme.rtl && "".concat(props.theme.space.base * 4, "px");
402
- }, function (props) {
403
- return props.theme.space.base / 2;
404
- }, function (props) {
405
- return props.hue && getColor(props.hue, props.hue === 'warningHue' ? 700 : 600, props.theme);
406
- });
199
+ })(["position:absolute;right:", ";left:", ";margin-top:", "px;color:", ";"], props => props.theme.rtl && `${props.theme.space.base * 4}px`, props => !props.theme.rtl && `${props.theme.space.base * 4}px`, props => props.theme.space.base / 2, props => props.hue && getColor(props.hue, props.hue === 'warningHue' ? 700 : 600, props.theme));
407
200
  StyledIcon.defaultProps = {
408
201
  theme: DEFAULT_THEME
409
202
  };
@@ -419,7 +212,8 @@ var SvgAlertErrorStroke = function SvgAlertErrorStroke(props) {
419
212
  height: 16,
420
213
  focusable: "false",
421
214
  viewBox: "0 0 16 16",
422
- "aria-hidden": "true"
215
+ "aria-hidden": "true",
216
+ role: "img"
423
217
  }, props), _g$2 || (_g$2 = /*#__PURE__*/React.createElement("g", {
424
218
  fill: "none",
425
219
  stroke: "currentColor"
@@ -449,7 +243,8 @@ var SvgCheckCircleStroke = function SvgCheckCircleStroke(props) {
449
243
  height: 16,
450
244
  focusable: "false",
451
245
  viewBox: "0 0 16 16",
452
- "aria-hidden": "true"
246
+ "aria-hidden": "true",
247
+ role: "img"
453
248
  }, props), _g$1 || (_g$1 = /*#__PURE__*/React.createElement("g", {
454
249
  fill: "none",
455
250
  stroke: "currentColor"
@@ -475,7 +270,8 @@ var SvgAlertWarningStroke = function SvgAlertWarningStroke(props) {
475
270
  height: 16,
476
271
  focusable: "false",
477
272
  viewBox: "0 0 16 16",
478
- "aria-hidden": "true"
273
+ "aria-hidden": "true",
274
+ role: "img"
479
275
  }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
480
276
  fill: "none",
481
277
  stroke: "currentColor",
@@ -500,7 +296,8 @@ var SvgInfoStroke = function SvgInfoStroke(props) {
500
296
  height: 16,
501
297
  focusable: "false",
502
298
  viewBox: "0 0 16 16",
503
- "aria-hidden": "true"
299
+ "aria-hidden": "true",
300
+ role: "img"
504
301
  }, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
505
302
  stroke: "currentColor"
506
303
  }, /*#__PURE__*/React.createElement("circle", {
@@ -519,27 +316,27 @@ var SvgInfoStroke = function SvgInfoStroke(props) {
519
316
  })));
520
317
  };
521
318
 
522
- var validationIcons = {
319
+ const validationIcons = {
523
320
  success: SvgCheckCircleStroke,
524
321
  error: SvgAlertErrorStroke,
525
322
  warning: SvgAlertWarningStroke,
526
323
  info: SvgInfoStroke
527
324
  };
528
- var validationHues = {
325
+ const validationHues = {
529
326
  success: 'successHue',
530
327
  error: 'dangerHue',
531
328
  warning: 'warningHue',
532
329
  info: 'neutralHue'
533
330
  };
534
331
 
535
- var NotificationsContext = createContext(undefined);
536
- var useNotificationsContext = function useNotificationsContext() {
332
+ const NotificationsContext = createContext(undefined);
333
+ const useNotificationsContext = () => {
537
334
  return useContext(NotificationsContext);
538
335
  };
539
336
 
540
- var Alert = React__default.forwardRef(function (props, ref) {
541
- var hue = validationHues[props.type];
542
- var Icon = validationIcons[props.type];
337
+ const Alert = React__default.forwardRef((props, ref) => {
338
+ const hue = validationHues[props.type];
339
+ const Icon = validationIcons[props.type];
543
340
  return React__default.createElement(NotificationsContext.Provider, {
544
341
  value: hue
545
342
  }, React__default.createElement(StyledAlert, _extends$5({
@@ -554,9 +351,9 @@ Alert.propTypes = {
554
351
  type: PropTypes.oneOf(TYPE).isRequired
555
352
  };
556
353
 
557
- var Notification = React__default.forwardRef(function (props, ref) {
558
- var Icon = props.type ? validationIcons[props.type] : SvgInfoStroke;
559
- var hue = props.type && validationHues[props.type];
354
+ const Notification = React__default.forwardRef((props, ref) => {
355
+ const Icon = props.type ? validationIcons[props.type] : SvgInfoStroke;
356
+ const hue = props.type && validationHues[props.type];
560
357
  return React__default.createElement(StyledNotification, _extends$5({
561
358
  ref: ref,
562
359
  type: props.type,
@@ -570,11 +367,9 @@ Notification.propTypes = {
570
367
  type: PropTypes.oneOf(TYPE)
571
368
  };
572
369
 
573
- var Well = React__default.forwardRef(function (props, ref) {
574
- return React__default.createElement(StyledWell, _extends$5({
575
- ref: ref
576
- }, props));
577
- });
370
+ const Well = React__default.forwardRef((props, ref) => React__default.createElement(StyledWell, _extends$5({
371
+ ref: ref
372
+ }, props)));
578
373
  Well.displayName = 'Well';
579
374
  Well.propTypes = {
580
375
  isRecessed: PropTypes.bool,
@@ -592,7 +387,8 @@ var SvgXStroke = function SvgXStroke(props) {
592
387
  height: 12,
593
388
  focusable: "false",
594
389
  viewBox: "0 0 12 12",
595
- "aria-hidden": "true"
390
+ "aria-hidden": "true",
391
+ role: "img"
596
392
  }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
597
393
  stroke: "currentColor",
598
394
  strokeLinecap: "round",
@@ -600,8 +396,8 @@ var SvgXStroke = function SvgXStroke(props) {
600
396
  })));
601
397
  };
602
398
 
603
- var Close = React__default.forwardRef(function (props, ref) {
604
- var hue = useNotificationsContext();
399
+ const Close = React__default.forwardRef((props, ref) => {
400
+ const hue = useNotificationsContext();
605
401
  return React__default.createElement(StyledClose, _extends$5({
606
402
  ref: ref,
607
403
  hue: hue
@@ -609,93 +405,99 @@ var Close = React__default.forwardRef(function (props, ref) {
609
405
  });
610
406
  Close.displayName = 'Close';
611
407
 
612
- var Paragraph = React__default.forwardRef(function (props, ref) {
613
- return React__default.createElement(StyledParagraph, _extends$5({
614
- ref: ref
615
- }, props));
616
- });
408
+ const Paragraph = React__default.forwardRef((props, ref) => React__default.createElement(StyledParagraph, _extends$5({
409
+ ref: ref
410
+ }, props)));
617
411
  Paragraph.displayName = 'Paragraph';
618
412
 
619
- var Title = React__default.forwardRef(function (props, ref) {
620
- return React__default.createElement(StyledTitle, _extends$5({
621
- ref: ref
622
- }, props));
623
- });
413
+ const Title = React__default.forwardRef((props, ref) => React__default.createElement(StyledTitle, _extends$5({
414
+ ref: ref
415
+ }, props)));
624
416
  Title.displayName = 'Title';
625
417
 
626
- var _excluded$1 = ["content"];
627
- var getInitialState = function getInitialState() {
418
+ const getInitialState = () => {
628
419
  return {
629
420
  toasts: []
630
421
  };
631
422
  };
632
- var toasterReducer = function toasterReducer(state, action) {
423
+ const toasterReducer = (state, action) => {
633
424
  switch (action.type) {
634
425
  case 'ADD_TOAST':
635
426
  {
636
- return _objectSpread2(_objectSpread2({}, state), {}, {
637
- toasts: [].concat(_toConsumableArray(state.toasts), [action.payload])
638
- });
427
+ return {
428
+ ...state,
429
+ toasts: [...state.toasts, action.payload]
430
+ };
639
431
  }
640
432
  case 'REMOVE_TOAST':
641
433
  {
642
- var filteredToasts = state.toasts.filter(function (toast) {
643
- return toast.id !== action.payload;
644
- });
645
- return _objectSpread2(_objectSpread2({}, state), {}, {
434
+ const filteredToasts = state.toasts.filter(toast => toast.id !== action.payload);
435
+ return {
436
+ ...state,
646
437
  toasts: filteredToasts
647
- });
438
+ };
648
439
  }
649
440
  case 'UPDATE_TOAST':
650
441
  {
651
- var updatedToasts = state.toasts.map(function (toast) {
442
+ const updatedToasts = state.toasts.map(toast => {
652
443
  if (toast.id !== action.payload.id) {
653
444
  return toast;
654
445
  }
655
- var updatedToast = toast;
656
- var _action$payload$optio = action.payload.options,
657
- content = _action$payload$optio.content,
658
- newOptions = _objectWithoutProperties(_action$payload$optio, _excluded$1);
446
+ const updatedToast = toast;
447
+ const {
448
+ content,
449
+ ...newOptions
450
+ } = action.payload.options;
659
451
  if (content) {
660
452
  updatedToast.content = content;
661
453
  }
662
- updatedToast.options = _objectSpread2(_objectSpread2({}, updatedToast.options), newOptions);
454
+ updatedToast.options = {
455
+ ...updatedToast.options,
456
+ ...newOptions
457
+ };
663
458
  return updatedToast;
664
459
  });
665
- return _objectSpread2(_objectSpread2({}, state), {}, {
460
+ return {
461
+ ...state,
666
462
  toasts: updatedToasts
667
- });
463
+ };
668
464
  }
669
465
  case 'REMOVE_ALL_TOASTS':
670
466
  {
671
- return _objectSpread2(_objectSpread2({}, state), {}, {
467
+ return {
468
+ ...state,
672
469
  toasts: []
673
- });
470
+ };
674
471
  }
675
472
  default:
676
473
  throw new Error('Invalid toaster reducer action');
677
474
  }
678
475
  };
679
476
 
680
- var ToastContext = createContext(undefined);
477
+ const ToastContext = createContext(undefined);
681
478
 
682
- var DEFAULT_TOAST_OPTIONS = {
479
+ const DEFAULT_TOAST_OPTIONS = {
683
480
  autoDismiss: 5000,
684
481
  placement: 'top-end'
685
482
  };
686
- var useToast = function useToast() {
687
- var context = useContext(ToastContext);
483
+ const useToast = () => {
484
+ const context = useContext(ToastContext);
688
485
  if (context === undefined) {
689
486
  throw new Error('useToast() must be used within a "ToastProvider"');
690
487
  }
691
- var dispatch = context.dispatch,
692
- state = context.state;
693
- var addToast = useCallback(function (content) {
694
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
695
- var mergedOptions = _objectSpread2(_objectSpread2({}, DEFAULT_TOAST_OPTIONS), options);
696
- var newToast = {
488
+ const {
489
+ dispatch,
490
+ state
491
+ } = context;
492
+ const addToast = useCallback(function (content) {
493
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
494
+ const mergedOptions = {
495
+ ...DEFAULT_TOAST_OPTIONS,
496
+ ...options
497
+ };
498
+ const newToast = {
697
499
  id: mergedOptions.id || uid(content),
698
- content: content,
500
+ content,
699
501
  options: mergedOptions
700
502
  };
701
503
  dispatch({
@@ -704,56 +506,60 @@ var useToast = function useToast() {
704
506
  });
705
507
  return newToast.id;
706
508
  }, [dispatch]);
707
- var removeToast = useCallback(function (id) {
509
+ const removeToast = useCallback(id => {
708
510
  dispatch({
709
511
  type: 'REMOVE_TOAST',
710
512
  payload: id
711
513
  });
712
514
  }, [dispatch]);
713
- var updateToast = useCallback(function (id, options) {
515
+ const updateToast = useCallback((id, options) => {
714
516
  dispatch({
715
517
  type: 'UPDATE_TOAST',
716
518
  payload: {
717
- id: id,
718
- options: options
519
+ id,
520
+ options
719
521
  }
720
522
  });
721
523
  }, [dispatch]);
722
- var removeAllToasts = useCallback(function () {
524
+ const removeAllToasts = useCallback(() => {
723
525
  dispatch({
724
526
  type: 'REMOVE_ALL_TOASTS'
725
527
  });
726
528
  }, [dispatch]);
727
529
  return {
728
- addToast: addToast,
729
- removeToast: removeToast,
730
- updateToast: updateToast,
731
- removeAllToasts: removeAllToasts,
530
+ addToast,
531
+ removeToast,
532
+ updateToast,
533
+ removeAllToasts,
732
534
  toasts: state.toasts
733
535
  };
734
536
  };
735
537
 
736
- var Toast = function Toast(_ref) {
737
- var toast = _ref.toast,
738
- pauseTimers = _ref.pauseTimers;
739
- var _useToast = useToast(),
740
- removeToast = _useToast.removeToast;
741
- var id = toast.id;
742
- var autoDismiss = toast.options.autoDismiss;
743
- var _useState = useState(NaN),
744
- _useState2 = _slicedToArray(_useState, 2),
745
- remainingTime = _useState2[0],
746
- setRemainingTime = _useState2[1];
747
- var startTimeRef = useRef(Date.now());
748
- var previousRemainingTimeRef = useRef(remainingTime);
749
- useEffect(function () {
538
+ const Toast = _ref => {
539
+ let {
540
+ toast,
541
+ pauseTimers
542
+ } = _ref;
543
+ const {
544
+ removeToast
545
+ } = useToast();
546
+ const {
547
+ id
548
+ } = toast;
549
+ const {
550
+ autoDismiss
551
+ } = toast.options;
552
+ const [remainingTime, setRemainingTime] = useState(NaN);
553
+ const startTimeRef = useRef(Date.now());
554
+ const previousRemainingTimeRef = useRef(remainingTime);
555
+ useEffect(() => {
750
556
  if (typeof autoDismiss === 'number') {
751
557
  setRemainingTime(autoDismiss);
752
558
  } else {
753
559
  setRemainingTime(NaN);
754
560
  }
755
561
  }, [autoDismiss]);
756
- useEffect(function () {
562
+ useEffect(() => {
757
563
  if (pauseTimers && !isNaN(remainingTime)) {
758
564
  previousRemainingTimeRef.current = remainingTime - (Date.now() - startTimeRef.current);
759
565
  setRemainingTime(NaN);
@@ -761,38 +567,32 @@ var Toast = function Toast(_ref) {
761
567
  setRemainingTime(previousRemainingTimeRef.current);
762
568
  }
763
569
  }, [pauseTimers, remainingTime]);
764
- useEffect(function () {
765
- var timeout;
570
+ useEffect(() => {
571
+ let timeout;
766
572
  if (!isNaN(remainingTime)) {
767
573
  startTimeRef.current = Date.now();
768
- timeout = setTimeout(function () {
574
+ timeout = setTimeout(() => {
769
575
  removeToast(id);
770
576
  }, remainingTime);
771
577
  }
772
- return function () {
578
+ return () => {
773
579
  clearTimeout(timeout);
774
580
  };
775
581
  }, [id, pauseTimers, remainingTime, removeToast]);
776
- var close = useCallback(function () {
582
+ const close = useCallback(() => {
777
583
  removeToast(toast.id);
778
584
  }, [removeToast, toast.id]);
779
585
  return toast.content({
780
- close: close
586
+ close
781
587
  });
782
588
  };
783
589
 
784
- var TRANSITION_CLASS = 'garden-toast-transition';
785
- var DEFAULT_DURATION = '400ms';
786
- var StyledFadeInTransition = styled.div.withConfig({
590
+ const TRANSITION_CLASS = 'garden-toast-transition';
591
+ const DEFAULT_DURATION = '400ms';
592
+ const StyledFadeInTransition = styled.div.withConfig({
787
593
  displayName: "styled__StyledFadeInTransition",
788
594
  componentId: "sc-nq0usb-0"
789
- })(["transition:opacity ", " ease-in 300ms;opacity:", ";margin-bottom:", "px;", " &.", "-enter{transform:translateY( ", " );opacity:0;max-height:0;}&.", "-enter-active{transform:translateY(0);transition:opacity ", " ease-in,transform ", " cubic-bezier(0.15,0.85,0.35,1.2),max-height ", ";opacity:1;max-height:500px;}&.", "-exit{opacity:1;max-height:500px;}&.", "-exit-active{transition:opacity 550ms ease-out,max-height ", " linear 150ms;opacity:0;max-height:0;}"], DEFAULT_DURATION, function (p) {
790
- return p.isHidden ? '0 !important' : 1;
791
- }, function (p) {
792
- return p.theme.space.base * 2;
793
- }, function (p) {
794
- return p.isHidden && hideVisually();
795
- }, TRANSITION_CLASS, function (props) {
595
+ })(["transition:opacity ", " ease-in 300ms;opacity:", ";margin-bottom:", "px;", " &.", "-enter{transform:translateY( ", " );opacity:0;max-height:0;}&.", "-enter-active{transform:translateY(0);transition:opacity ", " ease-in,transform ", " cubic-bezier(0.15,0.85,0.35,1.2),max-height ", ";opacity:1;max-height:500px;}&.", "-exit{opacity:1;max-height:500px;}&.", "-exit-active{transition:opacity 550ms ease-out,max-height ", " linear 150ms;opacity:0;max-height:0;}"], DEFAULT_DURATION, p => p.isHidden ? '0 !important' : 1, p => p.theme.space.base * 2, p => p.isHidden && hideVisually(), TRANSITION_CLASS, props => {
796
596
  if (props.placement === 'bottom-start' || props.placement === 'bottom' || props.placement === 'bottom-end') {
797
597
  return '100px';
798
598
  }
@@ -801,15 +601,15 @@ var StyledFadeInTransition = styled.div.withConfig({
801
601
  StyledFadeInTransition.defaultProps = {
802
602
  theme: DEFAULT_THEME
803
603
  };
804
- var placementStyles = function placementStyles(props) {
805
- var verticalDistance = "".concat(props.theme.space.base * 16, "px");
806
- var horizontalDistance = "".concat(props.theme.space.base * 3, "px");
807
- var topLeftStyles = css(["top:", ";left:", ";"], verticalDistance, horizontalDistance);
808
- var topStyles = css(["top:", ";left:50%;transform:translate(-50%,0);"], verticalDistance);
809
- var topRightStyles = css(["top:", ";right:", ";"], verticalDistance, horizontalDistance);
810
- var bottomLeftStyles = css(["bottom:", ";left:", ";"], verticalDistance, horizontalDistance);
811
- var bottomStyles = css(["bottom:", ";left:50%;transform:translate(-50%,0);"], verticalDistance);
812
- var bottomRightStyles = css(["right:", ";bottom:", ";"], horizontalDistance, verticalDistance);
604
+ const placementStyles = props => {
605
+ const verticalDistance = `${props.theme.space.base * 16}px`;
606
+ const horizontalDistance = `${props.theme.space.base * 3}px`;
607
+ const topLeftStyles = css(["top:", ";left:", ";"], verticalDistance, horizontalDistance);
608
+ const topStyles = css(["top:", ";left:50%;transform:translate(-50%,0);"], verticalDistance);
609
+ const topRightStyles = css(["top:", ";right:", ";"], verticalDistance, horizontalDistance);
610
+ const bottomLeftStyles = css(["bottom:", ";left:", ";"], verticalDistance, horizontalDistance);
611
+ const bottomStyles = css(["bottom:", ";left:50%;transform:translate(-50%,0);"], verticalDistance);
612
+ const bottomRightStyles = css(["right:", ";bottom:", ";"], horizontalDistance, verticalDistance);
813
613
  switch (props.$placement) {
814
614
  case 'top-start':
815
615
  if (props.theme.rtl) {
@@ -839,53 +639,49 @@ var placementStyles = function placementStyles(props) {
839
639
  return '';
840
640
  }
841
641
  };
842
- var StyledTransitionGroup = styled(TransitionGroup).withConfig({
642
+ const StyledTransitionGroup = styled(TransitionGroup).withConfig({
843
643
  displayName: "styled__StyledTransitionGroup",
844
644
  componentId: "sc-nq0usb-1"
845
- })(["position:fixed;z-index:", ";", ";"], function (props) {
846
- return props.$zIndex;
847
- }, placementStyles);
645
+ })(["position:fixed;z-index:", ";", ";"], props => props.$zIndex, placementStyles);
848
646
  StyledTransitionGroup.defaultProps = {
849
647
  theme: DEFAULT_THEME
850
648
  };
851
649
 
852
- var _excluded = ["toasts", "placement", "zIndex", "limit"];
853
- var ToastSlot = function ToastSlot(_ref) {
854
- var toasts = _ref.toasts,
855
- placement = _ref.placement,
856
- zIndex = _ref.zIndex,
857
- limit = _ref.limit,
858
- props = _objectWithoutProperties(_ref, _excluded);
859
- var _useState = useState(false),
860
- _useState2 = _slicedToArray(_useState, 2),
861
- pauseTimers = _useState2[0],
862
- setPauseTimers = _useState2[1];
863
- var theme = useContext(ThemeContext);
864
- var environment = useDocument(theme);
865
- var handleVisibilityChange = useCallback(function (e) {
650
+ const ToastSlot = _ref => {
651
+ let {
652
+ toasts,
653
+ placement,
654
+ zIndex,
655
+ limit,
656
+ ...props
657
+ } = _ref;
658
+ const [pauseTimers, setPauseTimers] = useState(false);
659
+ const theme = useContext(ThemeContext);
660
+ const environment = useDocument(theme);
661
+ const handleVisibilityChange = useCallback(e => {
866
662
  if (e.target.visibilityState === 'visible') {
867
663
  setPauseTimers(false);
868
664
  } else {
869
665
  setPauseTimers(true);
870
666
  }
871
667
  }, []);
872
- useEffect(function () {
668
+ useEffect(() => {
873
669
  if (environment) {
874
670
  environment.addEventListener('visibilitychange', handleVisibilityChange);
875
671
  }
876
- return function () {
672
+ return () => {
877
673
  if (environment) {
878
674
  environment.removeEventListener('visibilitychange', handleVisibilityChange);
879
675
  }
880
676
  };
881
677
  }, [environment, handleVisibilityChange]);
882
- var handleMouseEnter = useCallback(function () {
678
+ const handleMouseEnter = useCallback(() => {
883
679
  setPauseTimers(true);
884
680
  }, []);
885
- var handleMouseLeave = useCallback(function () {
681
+ const handleMouseLeave = useCallback(() => {
886
682
  setPauseTimers(false);
887
683
  }, []);
888
- var isHidden = useCallback(function (index) {
684
+ const isHidden = useCallback(index => {
889
685
  if (placement === 'bottom' || placement === 'bottom-start' || placement === 'bottom-end') {
890
686
  return index < toasts.length - limit;
891
687
  }
@@ -897,8 +693,8 @@ var ToastSlot = function ToastSlot(_ref) {
897
693
  $zIndex: zIndex,
898
694
  onMouseEnter: handleMouseEnter,
899
695
  onMouseLeave: handleMouseLeave
900
- }, props), toasts.map(function (toast, index) {
901
- var transitionRef = React__default.createRef();
696
+ }, props), toasts.map((toast, index) => {
697
+ const transitionRef = React__default.createRef();
902
698
  return React__default.createElement(CSSTransition, {
903
699
  key: toast.id,
904
700
  timeout: {
@@ -919,26 +715,20 @@ var ToastSlot = function ToastSlot(_ref) {
919
715
  }));
920
716
  };
921
717
 
922
- var ToastProvider = function ToastProvider(_ref) {
923
- var limit = _ref.limit,
924
- zIndex = _ref.zIndex,
925
- _ref$placementProps = _ref.placementProps,
926
- placementProps = _ref$placementProps === void 0 ? {} : _ref$placementProps,
927
- children = _ref.children;
928
- var _useReducer = useReducer(toasterReducer, getInitialState()),
929
- _useReducer2 = _slicedToArray(_useReducer, 2),
930
- state = _useReducer2[0],
931
- dispatch = _useReducer2[1];
932
- var contextValue = useMemo(function () {
933
- return {
934
- state: state,
935
- dispatch: dispatch
936
- };
937
- }, [state, dispatch]);
938
- var toastsByPlacement = useCallback(function (placement) {
939
- var matchingToasts = state.toasts.filter(function (toast) {
940
- return toast.options.placement === placement;
941
- });
718
+ const ToastProvider = _ref => {
719
+ let {
720
+ limit,
721
+ zIndex,
722
+ placementProps = {},
723
+ children
724
+ } = _ref;
725
+ const [state, dispatch] = useReducer(toasterReducer, getInitialState());
726
+ const contextValue = useMemo(() => ({
727
+ state,
728
+ dispatch
729
+ }), [state, dispatch]);
730
+ const toastsByPlacement = useCallback(placement => {
731
+ let matchingToasts = state.toasts.filter(toast => toast.options.placement === placement);
942
732
  if (placement === 'bottom' || placement === 'bottom-start' || placement === 'bottom-end') {
943
733
  matchingToasts = matchingToasts.reverse();
944
734
  }