@zendeskgarden/react-notifications 8.62.1 → 8.62.2
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.cjs.js +86 -89
- package/dist/index.esm.js +22 -22
- package/dist/typings/elements/toaster/styled.d.ts +4 -5
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var React = require('react');
|
|
13
11
|
var PropTypes = require('prop-types');
|
|
14
12
|
var styled = require('styled-components');
|
|
@@ -18,7 +16,7 @@ var polished = require('polished');
|
|
|
18
16
|
var reactTransitionGroup = require('react-transition-group');
|
|
19
17
|
var reactUid = require('react-uid');
|
|
20
18
|
|
|
21
|
-
function
|
|
19
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
20
|
|
|
23
21
|
function _interopNamespace(e) {
|
|
24
22
|
if (e && e.__esModule) return e;
|
|
@@ -34,14 +32,13 @@ function _interopNamespace(e) {
|
|
|
34
32
|
}
|
|
35
33
|
});
|
|
36
34
|
}
|
|
37
|
-
n
|
|
35
|
+
n.default = e;
|
|
38
36
|
return Object.freeze(n);
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
42
39
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
43
|
-
var PropTypes__default = /*#__PURE__*/
|
|
44
|
-
var styled__default = /*#__PURE__*/
|
|
40
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
41
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
45
42
|
|
|
46
43
|
function _extends$6() {
|
|
47
44
|
_extends$6 = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -61,9 +58,9 @@ function _extends$6() {
|
|
|
61
58
|
const TYPE = ['success', 'warning', 'error', 'info'];
|
|
62
59
|
|
|
63
60
|
const COMPONENT_ID$b = 'notifications.close';
|
|
64
|
-
const StyledClose = styled__default
|
|
61
|
+
const StyledClose = styled__default.default.button.attrs({
|
|
65
62
|
'data-garden-id': COMPONENT_ID$b,
|
|
66
|
-
'data-garden-version': '8.62.
|
|
63
|
+
'data-garden-version': '8.62.2'
|
|
67
64
|
}).withConfig({
|
|
68
65
|
displayName: "StyledClose",
|
|
69
66
|
componentId: "sc-1mr9nx1-0"
|
|
@@ -73,9 +70,9 @@ StyledClose.defaultProps = {
|
|
|
73
70
|
};
|
|
74
71
|
|
|
75
72
|
const COMPONENT_ID$a = 'notifications.paragraph';
|
|
76
|
-
const StyledParagraph = styled__default
|
|
73
|
+
const StyledParagraph = styled__default.default.p.attrs({
|
|
77
74
|
'data-garden-id': COMPONENT_ID$a,
|
|
78
|
-
'data-garden-version': '8.62.
|
|
75
|
+
'data-garden-version': '8.62.2'
|
|
79
76
|
}).withConfig({
|
|
80
77
|
displayName: "StyledParagraph",
|
|
81
78
|
componentId: "sc-12tmd6p-0"
|
|
@@ -85,9 +82,9 @@ StyledParagraph.defaultProps = {
|
|
|
85
82
|
};
|
|
86
83
|
|
|
87
84
|
const COMPONENT_ID$9 = 'notifications.title';
|
|
88
|
-
const StyledTitle = styled__default
|
|
85
|
+
const StyledTitle = styled__default.default.div.attrs({
|
|
89
86
|
'data-garden-id': COMPONENT_ID$9,
|
|
90
|
-
'data-garden-version': '8.62.
|
|
87
|
+
'data-garden-version': '8.62.2'
|
|
91
88
|
}).withConfig({
|
|
92
89
|
displayName: "StyledTitle",
|
|
93
90
|
componentId: "sc-xx4jsv-0"
|
|
@@ -132,7 +129,7 @@ const padding = props => {
|
|
|
132
129
|
const paddingHorizontal = `${space.base * 10}px`;
|
|
133
130
|
return `${paddingVertical} ${paddingHorizontal}`;
|
|
134
131
|
};
|
|
135
|
-
const StyledBase = styled__default
|
|
132
|
+
const StyledBase = styled__default.default.div.withConfig({
|
|
136
133
|
displayName: "StyledBase",
|
|
137
134
|
componentId: "sc-14syaqw-0"
|
|
138
135
|
})(["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 => reactTheming.getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', colorStyles$6);
|
|
@@ -142,9 +139,9 @@ StyledBase.defaultProps = {
|
|
|
142
139
|
|
|
143
140
|
const COMPONENT_ID$8 = 'notifications.alert';
|
|
144
141
|
const colorStyles$5 = props => styled.css(["", "{color:", ";}"], StyledTitle, props.hue && reactTheming.getColor(props.hue, 800, props.theme));
|
|
145
|
-
const StyledAlert = styled__default
|
|
142
|
+
const StyledAlert = styled__default.default(StyledBase).attrs(props => ({
|
|
146
143
|
'data-garden-id': COMPONENT_ID$8,
|
|
147
|
-
'data-garden-version': '8.62.
|
|
144
|
+
'data-garden-version': '8.62.2',
|
|
148
145
|
role: props.role === undefined ? 'alert' : props.role
|
|
149
146
|
})).withConfig({
|
|
150
147
|
displayName: "StyledAlert",
|
|
@@ -189,25 +186,25 @@ const colorStyles$4 = props => {
|
|
|
189
186
|
}
|
|
190
187
|
return styled.css(["", "{color:", ";}"], StyledTitle, color);
|
|
191
188
|
};
|
|
192
|
-
const StyledNotification = styled__default
|
|
189
|
+
const StyledNotification = styled__default.default(StyledBase).attrs(props => ({
|
|
193
190
|
'data-garden-id': COMPONENT_ID$7,
|
|
194
|
-
'data-garden-version': '8.62.
|
|
191
|
+
'data-garden-version': '8.62.2',
|
|
195
192
|
role: props.role === undefined ? 'status' : props.role
|
|
196
193
|
})).withConfig({
|
|
197
194
|
displayName: "StyledNotification",
|
|
198
195
|
componentId: "sc-uf6jh-0"
|
|
199
196
|
})(["", " ", ";"], colorStyles$4, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
200
197
|
StyledNotification.propTypes = {
|
|
201
|
-
type: PropTypes__default
|
|
198
|
+
type: PropTypes__default.default.oneOf(TYPE)
|
|
202
199
|
};
|
|
203
200
|
StyledNotification.defaultProps = {
|
|
204
201
|
theme: reactTheming.DEFAULT_THEME
|
|
205
202
|
};
|
|
206
203
|
|
|
207
204
|
const COMPONENT_ID$6 = 'notifications.well';
|
|
208
|
-
const StyledWell = styled__default
|
|
205
|
+
const StyledWell = styled__default.default(StyledBase).attrs({
|
|
209
206
|
'data-garden-id': COMPONENT_ID$6,
|
|
210
|
-
'data-garden-version': '8.62.
|
|
207
|
+
'data-garden-version': '8.62.2'
|
|
211
208
|
}).withConfig({
|
|
212
209
|
displayName: "StyledWell",
|
|
213
210
|
componentId: "sc-a5831c-0"
|
|
@@ -216,12 +213,12 @@ StyledWell.defaultProps = {
|
|
|
216
213
|
theme: reactTheming.DEFAULT_THEME
|
|
217
214
|
};
|
|
218
215
|
|
|
219
|
-
const StyledIcon = styled__default
|
|
216
|
+
const StyledIcon = styled__default.default(_ref => {
|
|
220
217
|
let {
|
|
221
218
|
children,
|
|
222
219
|
...props
|
|
223
220
|
} = _ref;
|
|
224
|
-
return
|
|
221
|
+
return React__namespace.default.cloneElement(React.Children.only(children), props);
|
|
225
222
|
}).withConfig({
|
|
226
223
|
displayName: "StyledIcon",
|
|
227
224
|
componentId: "sc-msklws-0"
|
|
@@ -285,9 +282,9 @@ const sizeStyles$3 = props => {
|
|
|
285
282
|
const lineHeight = reactTheming.getLineHeight(space.base * 5, fontSizes.md);
|
|
286
283
|
return styled.css(["padding:", "px;min-height:", "px;line-height:", ";font-size:", ";"], padding, minHeight, lineHeight, fontSizes.md);
|
|
287
284
|
};
|
|
288
|
-
const StyledGlobalAlert = styled__default
|
|
285
|
+
const StyledGlobalAlert = styled__default.default.div.attrs({
|
|
289
286
|
'data-garden-id': COMPONENT_ID$5,
|
|
290
|
-
'data-garden-version': '8.62.
|
|
287
|
+
'data-garden-version': '8.62.2'
|
|
291
288
|
}).withConfig({
|
|
292
289
|
displayName: "StyledGlobalAlert",
|
|
293
290
|
componentId: "sc-k6rimt-0"
|
|
@@ -341,9 +338,9 @@ const sizeStyles$2 = props => {
|
|
|
341
338
|
const marginEnd = `-${props.theme.space.base * 2}px`;
|
|
342
339
|
return styled.css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : marginEnd, marginVertical, props.theme.rtl ? marginEnd : marginStart);
|
|
343
340
|
};
|
|
344
|
-
const StyledGlobalAlertClose = styled__default
|
|
341
|
+
const StyledGlobalAlertClose = styled__default.default(reactButtons.IconButton).attrs({
|
|
345
342
|
'data-garden-id': COMPONENT_ID$4,
|
|
346
|
-
'data-garden-version': '8.62.
|
|
343
|
+
'data-garden-version': '8.62.2',
|
|
347
344
|
size: 'small'
|
|
348
345
|
}).withConfig({
|
|
349
346
|
displayName: "StyledGlobalAlertClose",
|
|
@@ -392,9 +389,9 @@ function sizeStyles$1(props) {
|
|
|
392
389
|
const marginStart = `${props.theme.space.base * 2}px`;
|
|
393
390
|
return styled.css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : 0, marginVertical, props.theme.rtl ? 0 : marginStart);
|
|
394
391
|
}
|
|
395
|
-
const StyledGlobalAlertButton = styled__default
|
|
392
|
+
const StyledGlobalAlertButton = styled__default.default(reactButtons.Button).attrs({
|
|
396
393
|
'data-garden-id': COMPONENT_ID$3,
|
|
397
|
-
'data-garden-version': '8.62.
|
|
394
|
+
'data-garden-version': '8.62.2',
|
|
398
395
|
focusInset: false,
|
|
399
396
|
isDanger: false,
|
|
400
397
|
isLink: false,
|
|
@@ -411,9 +408,9 @@ StyledGlobalAlertButton.defaultProps = {
|
|
|
411
408
|
};
|
|
412
409
|
|
|
413
410
|
const COMPONENT_ID$2 = 'notifications.global-alert.content';
|
|
414
|
-
const StyledGlobalAlertContent = styled__default
|
|
411
|
+
const StyledGlobalAlertContent = styled__default.default.div.attrs({
|
|
415
412
|
'data-garden-id': COMPONENT_ID$2,
|
|
416
|
-
'data-garden-version': '8.62.
|
|
413
|
+
'data-garden-version': '8.62.2'
|
|
417
414
|
}).withConfig({
|
|
418
415
|
displayName: "StyledGlobalAlertContent",
|
|
419
416
|
componentId: "sc-rept0u-0"
|
|
@@ -429,15 +426,15 @@ const sizeStyles = props => {
|
|
|
429
426
|
const marginHorizontal = `${props.theme.space.base * 2}px`;
|
|
430
427
|
return styled.css(["margin-top:", ";margin-", ":", ";width:", ";height:", ";"], marginTop, props.theme.rtl ? 'left' : 'right', marginHorizontal, size, size);
|
|
431
428
|
};
|
|
432
|
-
const StyledGlobalAlertIcon = styled__default
|
|
429
|
+
const StyledGlobalAlertIcon = styled__default.default(_ref => {
|
|
433
430
|
let {
|
|
434
431
|
children,
|
|
435
432
|
...props
|
|
436
433
|
} = _ref;
|
|
437
|
-
return
|
|
434
|
+
return React__namespace.default.cloneElement(React.Children.only(children), props);
|
|
438
435
|
}).attrs({
|
|
439
436
|
'data-garden-id': COMPONENT_ID$1,
|
|
440
|
-
'data-garden-version': '8.62.
|
|
437
|
+
'data-garden-version': '8.62.2'
|
|
441
438
|
}).withConfig({
|
|
442
439
|
displayName: "StyledGlobalAlertIcon",
|
|
443
440
|
componentId: "sc-84ne9k-0"
|
|
@@ -463,9 +460,9 @@ const colorStyles = props => {
|
|
|
463
460
|
}
|
|
464
461
|
return styled.css(["color:", ";"], color);
|
|
465
462
|
};
|
|
466
|
-
const StyledGlobalAlertTitle = styled__default
|
|
463
|
+
const StyledGlobalAlertTitle = styled__default.default.div.attrs({
|
|
467
464
|
'data-garden-id': COMPONENT_ID,
|
|
468
|
-
'data-garden-version': '8.62.
|
|
465
|
+
'data-garden-version': '8.62.2'
|
|
469
466
|
}).withConfig({
|
|
470
467
|
displayName: "StyledGlobalAlertTitle",
|
|
471
468
|
componentId: "sc-10clqbo-0"
|
|
@@ -607,46 +604,46 @@ const useNotificationsContext = () => {
|
|
|
607
604
|
return React.useContext(NotificationsContext);
|
|
608
605
|
};
|
|
609
606
|
|
|
610
|
-
const Alert =
|
|
607
|
+
const Alert = React__namespace.default.forwardRef((props, ref) => {
|
|
611
608
|
const hue = validationHues[props.type];
|
|
612
609
|
const Icon = validationIcons[props.type];
|
|
613
|
-
return
|
|
610
|
+
return React__namespace.default.createElement(NotificationsContext.Provider, {
|
|
614
611
|
value: hue
|
|
615
|
-
},
|
|
612
|
+
}, React__namespace.default.createElement(StyledAlert, _extends$6({
|
|
616
613
|
ref: ref,
|
|
617
614
|
hue: hue
|
|
618
|
-
}, props),
|
|
615
|
+
}, props), React__namespace.default.createElement(StyledIcon, {
|
|
619
616
|
hue: hue
|
|
620
|
-
},
|
|
617
|
+
}, React__namespace.default.createElement(Icon, null)), props.children));
|
|
621
618
|
});
|
|
622
619
|
Alert.displayName = 'Alert';
|
|
623
620
|
Alert.propTypes = {
|
|
624
|
-
type: PropTypes__default
|
|
621
|
+
type: PropTypes__default.default.oneOf(TYPE).isRequired
|
|
625
622
|
};
|
|
626
623
|
|
|
627
|
-
const Notification =
|
|
624
|
+
const Notification = React__namespace.default.forwardRef((props, ref) => {
|
|
628
625
|
const Icon = props.type ? validationIcons[props.type] : SvgInfoStroke;
|
|
629
626
|
const hue = props.type && validationHues[props.type];
|
|
630
|
-
return
|
|
627
|
+
return React__namespace.default.createElement(StyledNotification, _extends$6({
|
|
631
628
|
ref: ref,
|
|
632
629
|
type: props.type,
|
|
633
630
|
isFloating: true
|
|
634
|
-
}, props), props.type &&
|
|
631
|
+
}, props), props.type && React__namespace.default.createElement(StyledIcon, {
|
|
635
632
|
hue: hue
|
|
636
|
-
},
|
|
633
|
+
}, React__namespace.default.createElement(Icon, null)), props.children);
|
|
637
634
|
});
|
|
638
635
|
Notification.displayName = 'Notification';
|
|
639
636
|
Notification.propTypes = {
|
|
640
|
-
type: PropTypes__default
|
|
637
|
+
type: PropTypes__default.default.oneOf(TYPE)
|
|
641
638
|
};
|
|
642
639
|
|
|
643
|
-
const Well =
|
|
640
|
+
const Well = React__namespace.default.forwardRef((props, ref) => React__namespace.default.createElement(StyledWell, _extends$6({
|
|
644
641
|
ref: ref
|
|
645
642
|
}, props)));
|
|
646
643
|
Well.displayName = 'Well';
|
|
647
644
|
Well.propTypes = {
|
|
648
|
-
isRecessed: PropTypes__default
|
|
649
|
-
isFloating: PropTypes__default
|
|
645
|
+
isRecessed: PropTypes__default.default.bool,
|
|
646
|
+
isFloating: PropTypes__default.default.bool
|
|
650
647
|
};
|
|
651
648
|
|
|
652
649
|
var _path$1;
|
|
@@ -669,23 +666,23 @@ var SvgXStroke$1 = function SvgXStroke(props) {
|
|
|
669
666
|
})));
|
|
670
667
|
};
|
|
671
668
|
|
|
672
|
-
const Close =
|
|
669
|
+
const Close = React__namespace.default.forwardRef((props, ref) => {
|
|
673
670
|
const ariaLabel = reactTheming.useText(Close, props, 'aria-label', 'Close');
|
|
674
671
|
const hue = useNotificationsContext();
|
|
675
|
-
return
|
|
672
|
+
return React__namespace.default.createElement(StyledClose, _extends$6({
|
|
676
673
|
ref: ref,
|
|
677
674
|
hue: hue,
|
|
678
675
|
"aria-label": ariaLabel
|
|
679
|
-
}, props),
|
|
676
|
+
}, props), React__namespace.default.createElement(SvgXStroke$1, null));
|
|
680
677
|
});
|
|
681
678
|
Close.displayName = 'Close';
|
|
682
679
|
|
|
683
|
-
const Paragraph =
|
|
680
|
+
const Paragraph = React__namespace.default.forwardRef((props, ref) => React__namespace.default.createElement(StyledParagraph, _extends$6({
|
|
684
681
|
ref: ref
|
|
685
682
|
}, props)));
|
|
686
683
|
Paragraph.displayName = 'Paragraph';
|
|
687
684
|
|
|
688
|
-
const Title =
|
|
685
|
+
const Title = React__namespace.default.forwardRef((props, ref) => React__namespace.default.createElement(StyledTitle, _extends$6({
|
|
689
686
|
ref: ref
|
|
690
687
|
}, props)));
|
|
691
688
|
Title.displayName = 'Title';
|
|
@@ -864,7 +861,7 @@ const Toast = _ref => {
|
|
|
864
861
|
|
|
865
862
|
const TRANSITION_CLASS = 'garden-toast-transition';
|
|
866
863
|
const DEFAULT_DURATION = '400ms';
|
|
867
|
-
const StyledFadeInTransition = styled__default
|
|
864
|
+
const StyledFadeInTransition = styled__default.default.div.withConfig({
|
|
868
865
|
displayName: "styled__StyledFadeInTransition",
|
|
869
866
|
componentId: "sc-nq0usb-0"
|
|
870
867
|
})(["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 && polished.hideVisually(), TRANSITION_CLASS, props => {
|
|
@@ -885,7 +882,7 @@ const placementStyles = props => {
|
|
|
885
882
|
const bottomLeftStyles = styled.css(["bottom:", ";left:", ";"], verticalDistance, horizontalDistance);
|
|
886
883
|
const bottomStyles = styled.css(["bottom:", ";left:50%;transform:translate(-50%,0);"], verticalDistance);
|
|
887
884
|
const bottomRightStyles = styled.css(["right:", ";bottom:", ";"], horizontalDistance, verticalDistance);
|
|
888
|
-
switch (props
|
|
885
|
+
switch (props.toastPlacement) {
|
|
889
886
|
case 'top-start':
|
|
890
887
|
if (props.theme.rtl) {
|
|
891
888
|
return topRightStyles;
|
|
@@ -914,11 +911,11 @@ const placementStyles = props => {
|
|
|
914
911
|
return '';
|
|
915
912
|
}
|
|
916
913
|
};
|
|
917
|
-
const
|
|
918
|
-
displayName: "
|
|
914
|
+
const StyledTransitionContainer = styled__default.default.div.withConfig({
|
|
915
|
+
displayName: "styled__StyledTransitionContainer",
|
|
919
916
|
componentId: "sc-nq0usb-1"
|
|
920
|
-
})(["position:fixed;z-index:", ";", ";"], props => props
|
|
921
|
-
|
|
917
|
+
})(["position:fixed;z-index:", ";", ";"], props => props.toastZIndex, placementStyles);
|
|
918
|
+
StyledTransitionContainer.defaultProps = {
|
|
922
919
|
theme: reactTheming.DEFAULT_THEME
|
|
923
920
|
};
|
|
924
921
|
|
|
@@ -962,15 +959,15 @@ const ToastSlot = _ref => {
|
|
|
962
959
|
}
|
|
963
960
|
return index >= limit;
|
|
964
961
|
}, [limit, placement, toasts.length]);
|
|
965
|
-
return
|
|
962
|
+
return React__namespace.default.createElement(StyledTransitionContainer, _extends$6({
|
|
966
963
|
key: placement,
|
|
967
|
-
|
|
968
|
-
|
|
964
|
+
toastPlacement: placement,
|
|
965
|
+
toastZIndex: zIndex,
|
|
969
966
|
onMouseEnter: handleMouseEnter,
|
|
970
967
|
onMouseLeave: handleMouseLeave
|
|
971
|
-
}, props), toasts.map((toast, index) => {
|
|
972
|
-
const transitionRef =
|
|
973
|
-
return
|
|
968
|
+
}, props), React__namespace.default.createElement(reactTransitionGroup.TransitionGroup, null, toasts.map((toast, index) => {
|
|
969
|
+
const transitionRef = React__namespace.default.createRef();
|
|
970
|
+
return React__namespace.default.createElement(reactTransitionGroup.CSSTransition, {
|
|
974
971
|
key: toast.id,
|
|
975
972
|
timeout: {
|
|
976
973
|
enter: 400,
|
|
@@ -979,15 +976,15 @@ const ToastSlot = _ref => {
|
|
|
979
976
|
unmountOnExit: true,
|
|
980
977
|
classNames: TRANSITION_CLASS,
|
|
981
978
|
nodeRef: transitionRef
|
|
982
|
-
},
|
|
979
|
+
}, React__namespace.default.createElement(StyledFadeInTransition, {
|
|
983
980
|
ref: transitionRef,
|
|
984
981
|
placement: placement,
|
|
985
982
|
isHidden: isHidden(index)
|
|
986
|
-
},
|
|
983
|
+
}, React__namespace.default.createElement(Toast, {
|
|
987
984
|
toast: toast,
|
|
988
985
|
pauseTimers: pauseTimers || isHidden(index)
|
|
989
986
|
})));
|
|
990
|
-
}));
|
|
987
|
+
})));
|
|
991
988
|
};
|
|
992
989
|
|
|
993
990
|
const ToastProvider = _ref => {
|
|
@@ -1007,14 +1004,14 @@ const ToastProvider = _ref => {
|
|
|
1007
1004
|
if (placement === 'bottom' || placement === 'bottom-start' || placement === 'bottom-end') {
|
|
1008
1005
|
matchingToasts = matchingToasts.reverse();
|
|
1009
1006
|
}
|
|
1010
|
-
return
|
|
1007
|
+
return React__namespace.default.createElement(ToastSlot, _extends$6({
|
|
1011
1008
|
placement: placement,
|
|
1012
1009
|
toasts: matchingToasts,
|
|
1013
1010
|
zIndex: zIndex,
|
|
1014
1011
|
limit: limit
|
|
1015
1012
|
}, placementProps[placement]));
|
|
1016
1013
|
}, [limit, state.toasts, zIndex, placementProps]);
|
|
1017
|
-
return
|
|
1014
|
+
return React__namespace.default.createElement(ToastContext.Provider, {
|
|
1018
1015
|
value: contextValue
|
|
1019
1016
|
}, toastsByPlacement('top-start'), toastsByPlacement('top'), toastsByPlacement('top-end'), children, toastsByPlacement('bottom-start'), toastsByPlacement('bottom'), toastsByPlacement('bottom-end'));
|
|
1020
1017
|
};
|
|
@@ -1023,9 +1020,9 @@ ToastProvider.defaultProps = {
|
|
|
1023
1020
|
limit: 4
|
|
1024
1021
|
};
|
|
1025
1022
|
ToastProvider.propTypes = {
|
|
1026
|
-
limit: PropTypes__default
|
|
1027
|
-
zIndex: PropTypes__default
|
|
1028
|
-
placementProps: PropTypes__default
|
|
1023
|
+
limit: PropTypes__default.default.number,
|
|
1024
|
+
zIndex: PropTypes__default.default.number,
|
|
1025
|
+
placementProps: PropTypes__default.default.object
|
|
1029
1026
|
};
|
|
1030
1027
|
|
|
1031
1028
|
const GlobalAlertContext = React.createContext({
|
|
@@ -1041,7 +1038,7 @@ const GlobalAlertButton = React.forwardRef((_ref, ref) => {
|
|
|
1041
1038
|
const {
|
|
1042
1039
|
type
|
|
1043
1040
|
} = useGlobalAlertContext();
|
|
1044
|
-
return
|
|
1041
|
+
return React__namespace.default.createElement(StyledGlobalAlertButton, _extends$6({
|
|
1045
1042
|
ref: ref,
|
|
1046
1043
|
alertType: type
|
|
1047
1044
|
}, props, {
|
|
@@ -1051,7 +1048,7 @@ const GlobalAlertButton = React.forwardRef((_ref, ref) => {
|
|
|
1051
1048
|
});
|
|
1052
1049
|
GlobalAlertButton.displayName = 'GlobalAlert.Button';
|
|
1053
1050
|
GlobalAlertButton.propTypes = {
|
|
1054
|
-
isBasic: PropTypes__default
|
|
1051
|
+
isBasic: PropTypes__default.default.bool
|
|
1055
1052
|
};
|
|
1056
1053
|
|
|
1057
1054
|
var _path;
|
|
@@ -1079,10 +1076,10 @@ const GlobalAlertClose = React.forwardRef((props, ref) => {
|
|
|
1079
1076
|
type
|
|
1080
1077
|
} = useGlobalAlertContext();
|
|
1081
1078
|
const label = reactTheming.useText(GlobalAlertClose, props, 'aria-label', 'Close');
|
|
1082
|
-
return
|
|
1079
|
+
return React__namespace.default.createElement(StyledGlobalAlertClose, _extends$6({
|
|
1083
1080
|
ref: ref,
|
|
1084
1081
|
alertType: type
|
|
1085
|
-
}, props),
|
|
1082
|
+
}, props), React__namespace.default.createElement(SvgXStroke, {
|
|
1086
1083
|
role: "img",
|
|
1087
1084
|
"aria-label": label
|
|
1088
1085
|
}));
|
|
@@ -1090,7 +1087,7 @@ const GlobalAlertClose = React.forwardRef((props, ref) => {
|
|
|
1090
1087
|
GlobalAlertClose.displayName = 'GlobalAlert.Close';
|
|
1091
1088
|
|
|
1092
1089
|
const GlobalAlertContent = React.forwardRef((props, ref) => {
|
|
1093
|
-
return
|
|
1090
|
+
return React__namespace.default.createElement(StyledGlobalAlertContent, _extends$6({
|
|
1094
1091
|
ref: ref
|
|
1095
1092
|
}, props));
|
|
1096
1093
|
});
|
|
@@ -1100,14 +1097,14 @@ const GlobalAlertTitle = React.forwardRef((props, ref) => {
|
|
|
1100
1097
|
const {
|
|
1101
1098
|
type
|
|
1102
1099
|
} = useGlobalAlertContext();
|
|
1103
|
-
return
|
|
1100
|
+
return React__namespace.default.createElement(StyledGlobalAlertTitle, _extends$6({
|
|
1104
1101
|
alertType: type,
|
|
1105
1102
|
ref: ref
|
|
1106
1103
|
}, props));
|
|
1107
1104
|
});
|
|
1108
1105
|
GlobalAlertTitle.displayName = 'GlobalAlert.Title';
|
|
1109
1106
|
GlobalAlertTitle.propTypes = {
|
|
1110
|
-
isRegular: PropTypes__default
|
|
1107
|
+
isRegular: PropTypes__default.default.bool
|
|
1111
1108
|
};
|
|
1112
1109
|
|
|
1113
1110
|
const GlobalAlertComponent = React.forwardRef((_ref, ref) => {
|
|
@@ -1115,19 +1112,19 @@ const GlobalAlertComponent = React.forwardRef((_ref, ref) => {
|
|
|
1115
1112
|
type,
|
|
1116
1113
|
...props
|
|
1117
1114
|
} = _ref;
|
|
1118
|
-
return
|
|
1115
|
+
return React__namespace.default.createElement(GlobalAlertContext.Provider, {
|
|
1119
1116
|
value: React.useMemo(() => ({
|
|
1120
1117
|
type
|
|
1121
1118
|
}), [type])
|
|
1122
|
-
},
|
|
1119
|
+
}, React__namespace.default.createElement(StyledGlobalAlert, _extends$6({
|
|
1123
1120
|
ref: ref,
|
|
1124
1121
|
role: "status",
|
|
1125
1122
|
alertType: type
|
|
1126
1123
|
}, props), {
|
|
1127
|
-
success:
|
|
1128
|
-
error:
|
|
1129
|
-
warning:
|
|
1130
|
-
info:
|
|
1124
|
+
success: React__namespace.default.createElement(StyledGlobalAlertIcon, null, React__namespace.default.createElement(SvgCheckCircleStroke, null)),
|
|
1125
|
+
error: React__namespace.default.createElement(StyledGlobalAlertIcon, null, React__namespace.default.createElement(SvgAlertErrorStroke, null)),
|
|
1126
|
+
warning: React__namespace.default.createElement(StyledGlobalAlertIcon, null, React__namespace.default.createElement(SvgAlertWarningStroke, null)),
|
|
1127
|
+
info: React__namespace.default.createElement(StyledGlobalAlertIcon, null, React__namespace.default.createElement(SvgInfoStroke, null))
|
|
1131
1128
|
}[type], props.children));
|
|
1132
1129
|
});
|
|
1133
1130
|
GlobalAlertComponent.displayName = 'GlobalAlert';
|
|
@@ -1137,7 +1134,7 @@ GlobalAlert.Close = GlobalAlertClose;
|
|
|
1137
1134
|
GlobalAlert.Content = GlobalAlertContent;
|
|
1138
1135
|
GlobalAlert.Title = GlobalAlertTitle;
|
|
1139
1136
|
GlobalAlert.propTypes = {
|
|
1140
|
-
type: PropTypes__default
|
|
1137
|
+
type: PropTypes__default.default.oneOf(TYPE).isRequired
|
|
1141
1138
|
};
|
|
1142
1139
|
|
|
1143
1140
|
exports.Alert = Alert;
|
package/dist/index.esm.js
CHANGED
|
@@ -35,7 +35,7 @@ const TYPE = ['success', 'warning', 'error', 'info'];
|
|
|
35
35
|
const COMPONENT_ID$b = 'notifications.close';
|
|
36
36
|
const StyledClose = styled.button.attrs({
|
|
37
37
|
'data-garden-id': COMPONENT_ID$b,
|
|
38
|
-
'data-garden-version': '8.62.
|
|
38
|
+
'data-garden-version': '8.62.2'
|
|
39
39
|
}).withConfig({
|
|
40
40
|
displayName: "StyledClose",
|
|
41
41
|
componentId: "sc-1mr9nx1-0"
|
|
@@ -47,7 +47,7 @@ StyledClose.defaultProps = {
|
|
|
47
47
|
const COMPONENT_ID$a = 'notifications.paragraph';
|
|
48
48
|
const StyledParagraph = styled.p.attrs({
|
|
49
49
|
'data-garden-id': COMPONENT_ID$a,
|
|
50
|
-
'data-garden-version': '8.62.
|
|
50
|
+
'data-garden-version': '8.62.2'
|
|
51
51
|
}).withConfig({
|
|
52
52
|
displayName: "StyledParagraph",
|
|
53
53
|
componentId: "sc-12tmd6p-0"
|
|
@@ -59,7 +59,7 @@ StyledParagraph.defaultProps = {
|
|
|
59
59
|
const COMPONENT_ID$9 = 'notifications.title';
|
|
60
60
|
const StyledTitle = styled.div.attrs({
|
|
61
61
|
'data-garden-id': COMPONENT_ID$9,
|
|
62
|
-
'data-garden-version': '8.62.
|
|
62
|
+
'data-garden-version': '8.62.2'
|
|
63
63
|
}).withConfig({
|
|
64
64
|
displayName: "StyledTitle",
|
|
65
65
|
componentId: "sc-xx4jsv-0"
|
|
@@ -116,7 +116,7 @@ const COMPONENT_ID$8 = 'notifications.alert';
|
|
|
116
116
|
const colorStyles$5 = props => css(["", "{color:", ";}"], StyledTitle, props.hue && getColor(props.hue, 800, props.theme));
|
|
117
117
|
const StyledAlert = styled(StyledBase).attrs(props => ({
|
|
118
118
|
'data-garden-id': COMPONENT_ID$8,
|
|
119
|
-
'data-garden-version': '8.62.
|
|
119
|
+
'data-garden-version': '8.62.2',
|
|
120
120
|
role: props.role === undefined ? 'alert' : props.role
|
|
121
121
|
})).withConfig({
|
|
122
122
|
displayName: "StyledAlert",
|
|
@@ -163,7 +163,7 @@ const colorStyles$4 = props => {
|
|
|
163
163
|
};
|
|
164
164
|
const StyledNotification = styled(StyledBase).attrs(props => ({
|
|
165
165
|
'data-garden-id': COMPONENT_ID$7,
|
|
166
|
-
'data-garden-version': '8.62.
|
|
166
|
+
'data-garden-version': '8.62.2',
|
|
167
167
|
role: props.role === undefined ? 'status' : props.role
|
|
168
168
|
})).withConfig({
|
|
169
169
|
displayName: "StyledNotification",
|
|
@@ -179,7 +179,7 @@ StyledNotification.defaultProps = {
|
|
|
179
179
|
const COMPONENT_ID$6 = 'notifications.well';
|
|
180
180
|
const StyledWell = styled(StyledBase).attrs({
|
|
181
181
|
'data-garden-id': COMPONENT_ID$6,
|
|
182
|
-
'data-garden-version': '8.62.
|
|
182
|
+
'data-garden-version': '8.62.2'
|
|
183
183
|
}).withConfig({
|
|
184
184
|
displayName: "StyledWell",
|
|
185
185
|
componentId: "sc-a5831c-0"
|
|
@@ -259,7 +259,7 @@ const sizeStyles$3 = props => {
|
|
|
259
259
|
};
|
|
260
260
|
const StyledGlobalAlert = styled.div.attrs({
|
|
261
261
|
'data-garden-id': COMPONENT_ID$5,
|
|
262
|
-
'data-garden-version': '8.62.
|
|
262
|
+
'data-garden-version': '8.62.2'
|
|
263
263
|
}).withConfig({
|
|
264
264
|
displayName: "StyledGlobalAlert",
|
|
265
265
|
componentId: "sc-k6rimt-0"
|
|
@@ -315,7 +315,7 @@ const sizeStyles$2 = props => {
|
|
|
315
315
|
};
|
|
316
316
|
const StyledGlobalAlertClose = styled(IconButton).attrs({
|
|
317
317
|
'data-garden-id': COMPONENT_ID$4,
|
|
318
|
-
'data-garden-version': '8.62.
|
|
318
|
+
'data-garden-version': '8.62.2',
|
|
319
319
|
size: 'small'
|
|
320
320
|
}).withConfig({
|
|
321
321
|
displayName: "StyledGlobalAlertClose",
|
|
@@ -366,7 +366,7 @@ function sizeStyles$1(props) {
|
|
|
366
366
|
}
|
|
367
367
|
const StyledGlobalAlertButton = styled(Button).attrs({
|
|
368
368
|
'data-garden-id': COMPONENT_ID$3,
|
|
369
|
-
'data-garden-version': '8.62.
|
|
369
|
+
'data-garden-version': '8.62.2',
|
|
370
370
|
focusInset: false,
|
|
371
371
|
isDanger: false,
|
|
372
372
|
isLink: false,
|
|
@@ -385,7 +385,7 @@ StyledGlobalAlertButton.defaultProps = {
|
|
|
385
385
|
const COMPONENT_ID$2 = 'notifications.global-alert.content';
|
|
386
386
|
const StyledGlobalAlertContent = styled.div.attrs({
|
|
387
387
|
'data-garden-id': COMPONENT_ID$2,
|
|
388
|
-
'data-garden-version': '8.62.
|
|
388
|
+
'data-garden-version': '8.62.2'
|
|
389
389
|
}).withConfig({
|
|
390
390
|
displayName: "StyledGlobalAlertContent",
|
|
391
391
|
componentId: "sc-rept0u-0"
|
|
@@ -409,7 +409,7 @@ const StyledGlobalAlertIcon = styled(_ref => {
|
|
|
409
409
|
return React__default.cloneElement(Children.only(children), props);
|
|
410
410
|
}).attrs({
|
|
411
411
|
'data-garden-id': COMPONENT_ID$1,
|
|
412
|
-
'data-garden-version': '8.62.
|
|
412
|
+
'data-garden-version': '8.62.2'
|
|
413
413
|
}).withConfig({
|
|
414
414
|
displayName: "StyledGlobalAlertIcon",
|
|
415
415
|
componentId: "sc-84ne9k-0"
|
|
@@ -437,7 +437,7 @@ const colorStyles = props => {
|
|
|
437
437
|
};
|
|
438
438
|
const StyledGlobalAlertTitle = styled.div.attrs({
|
|
439
439
|
'data-garden-id': COMPONENT_ID,
|
|
440
|
-
'data-garden-version': '8.62.
|
|
440
|
+
'data-garden-version': '8.62.2'
|
|
441
441
|
}).withConfig({
|
|
442
442
|
displayName: "StyledGlobalAlertTitle",
|
|
443
443
|
componentId: "sc-10clqbo-0"
|
|
@@ -857,7 +857,7 @@ const placementStyles = props => {
|
|
|
857
857
|
const bottomLeftStyles = css(["bottom:", ";left:", ";"], verticalDistance, horizontalDistance);
|
|
858
858
|
const bottomStyles = css(["bottom:", ";left:50%;transform:translate(-50%,0);"], verticalDistance);
|
|
859
859
|
const bottomRightStyles = css(["right:", ";bottom:", ";"], horizontalDistance, verticalDistance);
|
|
860
|
-
switch (props
|
|
860
|
+
switch (props.toastPlacement) {
|
|
861
861
|
case 'top-start':
|
|
862
862
|
if (props.theme.rtl) {
|
|
863
863
|
return topRightStyles;
|
|
@@ -886,11 +886,11 @@ const placementStyles = props => {
|
|
|
886
886
|
return '';
|
|
887
887
|
}
|
|
888
888
|
};
|
|
889
|
-
const
|
|
890
|
-
displayName: "
|
|
889
|
+
const StyledTransitionContainer = styled.div.withConfig({
|
|
890
|
+
displayName: "styled__StyledTransitionContainer",
|
|
891
891
|
componentId: "sc-nq0usb-1"
|
|
892
|
-
})(["position:fixed;z-index:", ";", ";"], props => props
|
|
893
|
-
|
|
892
|
+
})(["position:fixed;z-index:", ";", ";"], props => props.toastZIndex, placementStyles);
|
|
893
|
+
StyledTransitionContainer.defaultProps = {
|
|
894
894
|
theme: DEFAULT_THEME
|
|
895
895
|
};
|
|
896
896
|
|
|
@@ -934,13 +934,13 @@ const ToastSlot = _ref => {
|
|
|
934
934
|
}
|
|
935
935
|
return index >= limit;
|
|
936
936
|
}, [limit, placement, toasts.length]);
|
|
937
|
-
return React__default.createElement(
|
|
937
|
+
return React__default.createElement(StyledTransitionContainer, _extends$6({
|
|
938
938
|
key: placement,
|
|
939
|
-
|
|
940
|
-
|
|
939
|
+
toastPlacement: placement,
|
|
940
|
+
toastZIndex: zIndex,
|
|
941
941
|
onMouseEnter: handleMouseEnter,
|
|
942
942
|
onMouseLeave: handleMouseLeave
|
|
943
|
-
}, props), toasts.map((toast, index) => {
|
|
943
|
+
}, props), React__default.createElement(TransitionGroup, null, toasts.map((toast, index) => {
|
|
944
944
|
const transitionRef = React__default.createRef();
|
|
945
945
|
return React__default.createElement(CSSTransition, {
|
|
946
946
|
key: toast.id,
|
|
@@ -959,7 +959,7 @@ const ToastSlot = _ref => {
|
|
|
959
959
|
toast: toast,
|
|
960
960
|
pauseTimers: pauseTimers || isHidden(index)
|
|
961
961
|
})));
|
|
962
|
-
}));
|
|
962
|
+
})));
|
|
963
963
|
};
|
|
964
964
|
|
|
965
965
|
const ToastProvider = _ref => {
|
|
@@ -5,16 +5,15 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import { DefaultTheme } from 'styled-components';
|
|
8
|
-
import { TransitionGroup } from 'react-transition-group';
|
|
9
8
|
import { Placement } from '../../types';
|
|
10
9
|
export declare const TRANSITION_CLASS = "garden-toast-transition";
|
|
11
10
|
export declare const StyledFadeInTransition: import("styled-components").StyledComponent<"div", DefaultTheme, {
|
|
12
11
|
isHidden: boolean;
|
|
13
12
|
placement: Placement;
|
|
14
13
|
}, never>;
|
|
15
|
-
interface
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
interface IStyledTransitionContainerProps {
|
|
15
|
+
toastPlacement: Placement;
|
|
16
|
+
toastZIndex?: number;
|
|
18
17
|
}
|
|
19
|
-
export declare const
|
|
18
|
+
export declare const StyledTransitionContainer: import("styled-components").StyledComponent<"div", DefaultTheme, IStyledTransitionContainerProps, never>;
|
|
20
19
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-notifications",
|
|
3
|
-
"version": "8.62.
|
|
3
|
+
"version": "8.62.2",
|
|
4
4
|
"description": "Notification and Well components within the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@zendeskgarden/react-buttons": "^8.62.
|
|
24
|
+
"@zendeskgarden/react-buttons": "^8.62.2",
|
|
25
25
|
"polished": "^4.1.1",
|
|
26
26
|
"prop-types": "^15.5.7",
|
|
27
27
|
"react-transition-group": "^4.4.2",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/react-transition-group": "4.4.5",
|
|
38
|
-
"@zendeskgarden/react-theming": "^8.62.
|
|
38
|
+
"@zendeskgarden/react-theming": "^8.62.2",
|
|
39
39
|
"@zendeskgarden/svg-icons": "6.33.0"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"zendeskgarden:src": "src/index.ts",
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "27a7d6c021f3360396af60d51ecbf66e9076a405"
|
|
52
52
|
}
|