@zendeskgarden/react-notifications 8.59.0 → 8.60.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.cjs.js +414 -56
- package/dist/index.esm.js +416 -59
- package/dist/typings/elements/global-alert/GlobalAlert.d.ts +21 -0
- package/dist/typings/elements/global-alert/GlobalAlertButton.d.ts +12 -0
- package/dist/typings/elements/global-alert/GlobalAlertClose.d.ts +11 -0
- package/dist/typings/elements/global-alert/GlobalAlertContent.d.ts +11 -0
- package/dist/typings/elements/global-alert/GlobalAlertTitle.d.ts +12 -0
- package/dist/typings/elements/global-alert/utility.d.ts +10 -0
- package/dist/typings/index.d.ts +2 -1
- package/dist/typings/styled/global-alert/StyledGlobalAlert.d.ts +16 -0
- package/dist/typings/styled/global-alert/StyledGlobalAlertButton.d.ts +33 -0
- package/dist/typings/styled/global-alert/StyledGlobalAlertClose.d.ts +18 -0
- package/dist/typings/styled/global-alert/StyledGlobalAlertContent.d.ts +10 -0
- package/dist/typings/styled/global-alert/StyledGlobalAlertIcon.d.ts +12 -0
- package/dist/typings/styled/global-alert/StyledGlobalAlertTitle.d.ts +17 -0
- package/dist/typings/styled/global-alert/index.d.ts +12 -0
- package/dist/typings/styled/index.d.ts +1 -0
- package/dist/typings/types/index.d.ts +16 -1
- package/package.json +4 -3
package/dist/index.esm.js
CHANGED
|
@@ -6,16 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import React__default, { Children, createContext, useContext, useCallback, useState, useRef, useEffect, useReducer, useMemo } from 'react';
|
|
9
|
+
import React__default, { Children, createContext, useContext, useCallback, useState, useRef, useEffect, useReducer, useMemo, forwardRef } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import styled, { css, ThemeContext } from 'styled-components';
|
|
12
|
-
import { getColor, retrieveComponentStyles, DEFAULT_THEME, getLineHeight, useDocument } from '@zendeskgarden/react-theming';
|
|
12
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME, getLineHeight, useDocument, useText } from '@zendeskgarden/react-theming';
|
|
13
|
+
import { IconButton, Button } from '@zendeskgarden/react-buttons';
|
|
14
|
+
import { math, hideVisually } from 'polished';
|
|
13
15
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
14
16
|
import { uid } from 'react-uid';
|
|
15
|
-
import { hideVisually } from 'polished';
|
|
16
17
|
|
|
17
|
-
function _extends$
|
|
18
|
-
_extends$
|
|
18
|
+
function _extends$6() {
|
|
19
|
+
_extends$6 = Object.assign ? Object.assign.bind() : function (target) {
|
|
19
20
|
for (var i = 1; i < arguments.length; i++) {
|
|
20
21
|
var source = arguments[i];
|
|
21
22
|
for (var key in source) {
|
|
@@ -26,43 +27,43 @@ function _extends$5() {
|
|
|
26
27
|
}
|
|
27
28
|
return target;
|
|
28
29
|
};
|
|
29
|
-
return _extends$
|
|
30
|
+
return _extends$6.apply(this, arguments);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
const TYPE = ['success', 'warning', 'error', 'info'];
|
|
33
34
|
|
|
34
|
-
const COMPONENT_ID$
|
|
35
|
+
const COMPONENT_ID$b = 'notifications.close';
|
|
35
36
|
const StyledClose = styled.button.attrs({
|
|
36
|
-
'data-garden-id': COMPONENT_ID$
|
|
37
|
-
'data-garden-version': '8.
|
|
37
|
+
'data-garden-id': COMPONENT_ID$b,
|
|
38
|
+
'data-garden-version': '8.60.0'
|
|
38
39
|
}).withConfig({
|
|
39
40
|
displayName: "StyledClose",
|
|
40
41
|
componentId: "sc-1mr9nx1-0"
|
|
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$
|
|
42
|
+
})(["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$b, props));
|
|
42
43
|
StyledClose.defaultProps = {
|
|
43
44
|
theme: DEFAULT_THEME
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
const COMPONENT_ID$
|
|
47
|
+
const COMPONENT_ID$a = 'notifications.paragraph';
|
|
47
48
|
const StyledParagraph = styled.p.attrs({
|
|
48
|
-
'data-garden-id': COMPONENT_ID$
|
|
49
|
-
'data-garden-version': '8.
|
|
49
|
+
'data-garden-id': COMPONENT_ID$a,
|
|
50
|
+
'data-garden-version': '8.60.0'
|
|
50
51
|
}).withConfig({
|
|
51
52
|
displayName: "StyledParagraph",
|
|
52
53
|
componentId: "sc-12tmd6p-0"
|
|
53
|
-
})(["margin:", "px 0 0;", ";"], props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID$
|
|
54
|
+
})(["margin:", "px 0 0;", ";"], props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID$a, props));
|
|
54
55
|
StyledParagraph.defaultProps = {
|
|
55
56
|
theme: DEFAULT_THEME
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
const COMPONENT_ID$
|
|
59
|
+
const COMPONENT_ID$9 = 'notifications.title';
|
|
59
60
|
const StyledTitle = styled.div.attrs({
|
|
60
|
-
'data-garden-id': COMPONENT_ID$
|
|
61
|
-
'data-garden-version': '8.
|
|
61
|
+
'data-garden-id': COMPONENT_ID$9,
|
|
62
|
+
'data-garden-version': '8.60.0'
|
|
62
63
|
}).withConfig({
|
|
63
64
|
displayName: "StyledTitle",
|
|
64
65
|
componentId: "sc-xx4jsv-0"
|
|
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$
|
|
66
|
+
})(["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$9, props));
|
|
66
67
|
StyledTitle.defaultProps = {
|
|
67
68
|
theme: DEFAULT_THEME
|
|
68
69
|
};
|
|
@@ -80,7 +81,7 @@ const boxShadow = props => {
|
|
|
80
81
|
const color = getColor('chromeHue', 600, theme, 0.15);
|
|
81
82
|
return shadows.lg(offsetY, blurRadius, color);
|
|
82
83
|
};
|
|
83
|
-
const colorStyles$
|
|
84
|
+
const colorStyles$6 = props => {
|
|
84
85
|
let backgroundColor;
|
|
85
86
|
let borderColor;
|
|
86
87
|
let foregroundColor;
|
|
@@ -106,27 +107,27 @@ const padding = props => {
|
|
|
106
107
|
const StyledBase = styled.div.withConfig({
|
|
107
108
|
displayName: "StyledBase",
|
|
108
109
|
componentId: "sc-14syaqw-0"
|
|
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$
|
|
110
|
+
})(["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$6);
|
|
110
111
|
StyledBase.defaultProps = {
|
|
111
112
|
theme: DEFAULT_THEME
|
|
112
113
|
};
|
|
113
114
|
|
|
114
|
-
const COMPONENT_ID$
|
|
115
|
-
const colorStyles$
|
|
115
|
+
const COMPONENT_ID$8 = 'notifications.alert';
|
|
116
|
+
const colorStyles$5 = props => css(["", "{color:", ";}"], StyledTitle, props.hue && getColor(props.hue, 800, props.theme));
|
|
116
117
|
const StyledAlert = styled(StyledBase).attrs(props => ({
|
|
117
|
-
'data-garden-id': COMPONENT_ID$
|
|
118
|
-
'data-garden-version': '8.
|
|
118
|
+
'data-garden-id': COMPONENT_ID$8,
|
|
119
|
+
'data-garden-version': '8.60.0',
|
|
119
120
|
role: props.role === undefined ? 'alert' : props.role
|
|
120
121
|
})).withConfig({
|
|
121
122
|
displayName: "StyledAlert",
|
|
122
123
|
componentId: "sc-fyn8jp-0"
|
|
123
|
-
})(["", " ", ";"], colorStyles$
|
|
124
|
+
})(["", " ", ";"], colorStyles$5, props => retrieveComponentStyles(COMPONENT_ID$8, props));
|
|
124
125
|
StyledAlert.defaultProps = {
|
|
125
126
|
theme: DEFAULT_THEME
|
|
126
127
|
};
|
|
127
128
|
|
|
128
|
-
const COMPONENT_ID$
|
|
129
|
-
const colorStyles = props => {
|
|
129
|
+
const COMPONENT_ID$7 = 'notifications.notification';
|
|
130
|
+
const colorStyles$4 = props => {
|
|
130
131
|
const {
|
|
131
132
|
type,
|
|
132
133
|
theme
|
|
@@ -161,13 +162,13 @@ const colorStyles = props => {
|
|
|
161
162
|
return css(["", "{color:", ";}"], StyledTitle, color);
|
|
162
163
|
};
|
|
163
164
|
const StyledNotification = styled(StyledBase).attrs(props => ({
|
|
164
|
-
'data-garden-id': COMPONENT_ID$
|
|
165
|
-
'data-garden-version': '8.
|
|
165
|
+
'data-garden-id': COMPONENT_ID$7,
|
|
166
|
+
'data-garden-version': '8.60.0',
|
|
166
167
|
role: props.role === undefined ? 'status' : props.role
|
|
167
168
|
})).withConfig({
|
|
168
169
|
displayName: "StyledNotification",
|
|
169
170
|
componentId: "sc-uf6jh-0"
|
|
170
|
-
})(["", " ", ";"], colorStyles, props => retrieveComponentStyles(COMPONENT_ID$
|
|
171
|
+
})(["", " ", ";"], colorStyles$4, props => retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
171
172
|
StyledNotification.propTypes = {
|
|
172
173
|
type: PropTypes.oneOf(TYPE)
|
|
173
174
|
};
|
|
@@ -175,14 +176,14 @@ StyledNotification.defaultProps = {
|
|
|
175
176
|
theme: DEFAULT_THEME
|
|
176
177
|
};
|
|
177
178
|
|
|
178
|
-
const COMPONENT_ID = 'notifications.well';
|
|
179
|
+
const COMPONENT_ID$6 = 'notifications.well';
|
|
179
180
|
const StyledWell = styled(StyledBase).attrs({
|
|
180
|
-
'data-garden-id': COMPONENT_ID,
|
|
181
|
-
'data-garden-version': '8.
|
|
181
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
182
|
+
'data-garden-version': '8.60.0'
|
|
182
183
|
}).withConfig({
|
|
183
184
|
displayName: "StyledWell",
|
|
184
185
|
componentId: "sc-a5831c-0"
|
|
185
|
-
})(["background-color:", ";color:", " ", ";"], props => props.isRecessed && getColor('neutralHue', 100, props.theme), props => getColor('neutralHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
186
|
+
})(["background-color:", ";color:", " ", ";"], props => props.isRecessed && getColor('neutralHue', 100, props.theme), props => getColor('neutralHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
186
187
|
StyledWell.defaultProps = {
|
|
187
188
|
theme: DEFAULT_THEME
|
|
188
189
|
};
|
|
@@ -201,12 +202,256 @@ StyledIcon.defaultProps = {
|
|
|
201
202
|
theme: DEFAULT_THEME
|
|
202
203
|
};
|
|
203
204
|
|
|
205
|
+
const COMPONENT_ID$5 = 'notifications.global-alert';
|
|
206
|
+
const colorStyles$3 = props => {
|
|
207
|
+
let borderColor;
|
|
208
|
+
let backgroundColor;
|
|
209
|
+
let foregroundColor;
|
|
210
|
+
let anchorHoverColor;
|
|
211
|
+
let anchorActiveColor;
|
|
212
|
+
let anchorBoxShadowColor;
|
|
213
|
+
switch (props.alertType) {
|
|
214
|
+
case 'success':
|
|
215
|
+
borderColor = getColor('successHue', 700, props.theme);
|
|
216
|
+
backgroundColor = getColor('successHue', 600, props.theme);
|
|
217
|
+
foregroundColor = getColor('successHue', 100, props.theme);
|
|
218
|
+
anchorHoverColor = props.theme.palette.white;
|
|
219
|
+
anchorActiveColor = props.theme.palette.white;
|
|
220
|
+
anchorBoxShadowColor = getColor('successHue', 200, props.theme, 0.35);
|
|
221
|
+
break;
|
|
222
|
+
case 'error':
|
|
223
|
+
borderColor = getColor('dangerHue', 700, props.theme);
|
|
224
|
+
backgroundColor = getColor('dangerHue', 600, props.theme);
|
|
225
|
+
foregroundColor = getColor('dangerHue', 100, props.theme);
|
|
226
|
+
anchorHoverColor = props.theme.palette.white;
|
|
227
|
+
anchorActiveColor = props.theme.palette.white;
|
|
228
|
+
anchorBoxShadowColor = getColor('dangerHue', 100, props.theme, 0.35);
|
|
229
|
+
break;
|
|
230
|
+
case 'warning':
|
|
231
|
+
borderColor = getColor('warningHue', 400, props.theme);
|
|
232
|
+
backgroundColor = getColor('warningHue', 300, props.theme);
|
|
233
|
+
foregroundColor = getColor('warningHue', 800, props.theme);
|
|
234
|
+
anchorHoverColor = getColor('warningHue', 900, props.theme);
|
|
235
|
+
anchorActiveColor = getColor('warningHue', 1000, props.theme);
|
|
236
|
+
anchorBoxShadowColor = getColor('warningHue', 800, props.theme, 0.35);
|
|
237
|
+
break;
|
|
238
|
+
case 'info':
|
|
239
|
+
borderColor = getColor('primaryHue', 300, props.theme);
|
|
240
|
+
backgroundColor = getColor('primaryHue', 200, props.theme);
|
|
241
|
+
foregroundColor = getColor('primaryHue', 700, props.theme);
|
|
242
|
+
anchorHoverColor = getColor('primaryHue', 800, props.theme);
|
|
243
|
+
anchorActiveColor = getColor('primaryHue', 900, props.theme);
|
|
244
|
+
anchorBoxShadowColor = getColor('primaryHue', 700, props.theme, 0.35);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
const boxShadow = `0 ${props.theme.borderWidths.sm} ${props.theme.borderWidths.sm} ${borderColor}`;
|
|
248
|
+
return css(["box-shadow:", ";background-color:", ";color:", ";& a{color:inherit;&:focus{color:inherit;}&:hover,[data-garden-focus-visible]{color:", ";}&[data-garden-focus-visible]{box-shadow:", ";}&:active{color:", ";}}"], boxShadow, backgroundColor, foregroundColor, anchorHoverColor, props.theme.shadows.sm(anchorBoxShadowColor), anchorActiveColor);
|
|
249
|
+
};
|
|
250
|
+
const sizeStyles$3 = props => {
|
|
251
|
+
const {
|
|
252
|
+
fontSizes,
|
|
253
|
+
space
|
|
254
|
+
} = props.theme;
|
|
255
|
+
const minHeight = space.base * 13;
|
|
256
|
+
const padding = space.base * 4;
|
|
257
|
+
const lineHeight = getLineHeight(space.base * 5, fontSizes.md);
|
|
258
|
+
return css(["padding:", "px;min-height:", "px;line-height:", ";font-size:", ";"], padding, minHeight, lineHeight, fontSizes.md);
|
|
259
|
+
};
|
|
260
|
+
const StyledGlobalAlert = styled.div.attrs({
|
|
261
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
262
|
+
'data-garden-version': '8.60.0'
|
|
263
|
+
}).withConfig({
|
|
264
|
+
displayName: "StyledGlobalAlert",
|
|
265
|
+
componentId: "sc-k6rimt-0"
|
|
266
|
+
})(["display:flex;flex-wrap:nowrap;overflow:auto;overflow-x:hidden;box-sizing:border-box;&& a{border-radius:", ";text-decoration:underline;&:focus{text-decoration:underline;}}", " ", " ", ";"], props => props.theme.borderRadii.sm, sizeStyles$3, colorStyles$3, props => retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
267
|
+
StyledGlobalAlert.defaultProps = {
|
|
268
|
+
theme: DEFAULT_THEME
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const COMPONENT_ID$4 = 'notifications.global-alert.close';
|
|
272
|
+
const colorStyles$2 = props => {
|
|
273
|
+
let hoverBackgroundColor;
|
|
274
|
+
let hoverForegroundColor;
|
|
275
|
+
let activeBackgroundColor;
|
|
276
|
+
let activeForegroundColor;
|
|
277
|
+
let boxShadowColor;
|
|
278
|
+
switch (props.alertType) {
|
|
279
|
+
case 'success':
|
|
280
|
+
hoverBackgroundColor = getColor('successHue', 100, props.theme, 0.08);
|
|
281
|
+
hoverForegroundColor = props.theme.palette.white;
|
|
282
|
+
activeBackgroundColor = getColor('successHue', 100, props.theme, 0.2);
|
|
283
|
+
activeForegroundColor = props.theme.palette.white;
|
|
284
|
+
boxShadowColor = getColor('successHue', 100, props.theme, 0.35);
|
|
285
|
+
break;
|
|
286
|
+
case 'error':
|
|
287
|
+
hoverBackgroundColor = getColor('dangerHue', 100, props.theme, 0.08);
|
|
288
|
+
hoverForegroundColor = props.theme.palette.white;
|
|
289
|
+
activeBackgroundColor = getColor('dangerHue', 100, props.theme, 0.2);
|
|
290
|
+
activeForegroundColor = props.theme.palette.white;
|
|
291
|
+
boxShadowColor = getColor('dangerHue', 100, props.theme, 0.35);
|
|
292
|
+
break;
|
|
293
|
+
case 'warning':
|
|
294
|
+
hoverBackgroundColor = getColor('warningHue', 800, props.theme, 0.08);
|
|
295
|
+
hoverForegroundColor = getColor('warningHue', 900, props.theme);
|
|
296
|
+
activeBackgroundColor = getColor('warningHue', 800, props.theme, 0.2);
|
|
297
|
+
activeForegroundColor = getColor('warningHue', 1000, props.theme);
|
|
298
|
+
boxShadowColor = getColor('warningHue', 800, props.theme, 0.35);
|
|
299
|
+
break;
|
|
300
|
+
case 'info':
|
|
301
|
+
hoverBackgroundColor = getColor('primaryHue', 700, props.theme, 0.08);
|
|
302
|
+
hoverForegroundColor = getColor('primaryHue', 800, props.theme);
|
|
303
|
+
activeBackgroundColor = getColor('primaryHue', 700, props.theme, 0.2);
|
|
304
|
+
activeForegroundColor = getColor('primaryHue', 900, props.theme);
|
|
305
|
+
boxShadowColor = getColor('primaryHue', 700, props.theme, 0.35);
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
return css(["color:inherit;&:hover{background-color:", ";color:", ";}&[data-garden-focus-visible]{box-shadow:", ";}&:active{background-color:", ";color:", ";}"], hoverBackgroundColor, hoverForegroundColor, props.theme.shadows.md(boxShadowColor), activeBackgroundColor, activeForegroundColor);
|
|
309
|
+
};
|
|
310
|
+
const sizeStyles$2 = props => {
|
|
311
|
+
const marginVertical = `-${props.theme.space.base * 1.5}px`;
|
|
312
|
+
const marginStart = `${props.theme.space.base * 2}px`;
|
|
313
|
+
const marginEnd = `-${props.theme.space.base * 2}px`;
|
|
314
|
+
return css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : marginEnd, marginVertical, props.theme.rtl ? marginEnd : marginStart);
|
|
315
|
+
};
|
|
316
|
+
const StyledGlobalAlertClose = styled(IconButton).attrs({
|
|
317
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
318
|
+
'data-garden-version': '8.60.0',
|
|
319
|
+
size: 'small'
|
|
320
|
+
}).withConfig({
|
|
321
|
+
displayName: "StyledGlobalAlertClose",
|
|
322
|
+
componentId: "sc-1g5s93s-0"
|
|
323
|
+
})(["", ";", ";", ";"], sizeStyles$2, colorStyles$2, props => retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
324
|
+
StyledGlobalAlertClose.defaultProps = {
|
|
325
|
+
theme: DEFAULT_THEME
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
const COMPONENT_ID$3 = 'notifications.global-alert.button';
|
|
329
|
+
function colorStyles$1(props) {
|
|
330
|
+
if (props.isBasic) {
|
|
331
|
+
return colorStyles$2(props);
|
|
332
|
+
}
|
|
333
|
+
let backgroundColor;
|
|
334
|
+
let hoverBackgroundColor;
|
|
335
|
+
let activeBackgroundColor;
|
|
336
|
+
let boxShadowColor;
|
|
337
|
+
switch (props.alertType) {
|
|
338
|
+
case 'success':
|
|
339
|
+
backgroundColor = getColor('successHue', 800, props.theme);
|
|
340
|
+
hoverBackgroundColor = getColor('successHue', 900, props.theme);
|
|
341
|
+
activeBackgroundColor = getColor('successHue', 1000, props.theme);
|
|
342
|
+
boxShadowColor = getColor('successHue', 200, props.theme, 0.35);
|
|
343
|
+
break;
|
|
344
|
+
case 'error':
|
|
345
|
+
backgroundColor = getColor('dangerHue', 800, props.theme);
|
|
346
|
+
hoverBackgroundColor = getColor('dangerHue', 900, props.theme);
|
|
347
|
+
activeBackgroundColor = getColor('dangerHue', 1000, props.theme);
|
|
348
|
+
boxShadowColor = getColor('dangerHue', 100, props.theme, 0.35);
|
|
349
|
+
break;
|
|
350
|
+
case 'warning':
|
|
351
|
+
backgroundColor = getColor('warningHue', 800, props.theme);
|
|
352
|
+
hoverBackgroundColor = getColor('warningHue', 900, props.theme);
|
|
353
|
+
activeBackgroundColor = getColor('warningHue', 1000, props.theme);
|
|
354
|
+
boxShadowColor = getColor('warningHue', 800, props.theme, 0.35);
|
|
355
|
+
break;
|
|
356
|
+
case 'info':
|
|
357
|
+
boxShadowColor = getColor('primaryHue', 700, props.theme, 0.35);
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
return css(["background-color:", ";&:hover{background-color:", ";}&[data-garden-focus-visible]{box-shadow:", ";}&:active{background-color:", ";}"], backgroundColor, hoverBackgroundColor, boxShadowColor && props.theme.shadows.md(boxShadowColor), activeBackgroundColor);
|
|
361
|
+
}
|
|
362
|
+
function sizeStyles$1(props) {
|
|
363
|
+
const marginVertical = `-${props.theme.space.base * 1.5}px`;
|
|
364
|
+
const marginStart = `${props.theme.space.base * 2}px`;
|
|
365
|
+
return css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : 0, marginVertical, props.theme.rtl ? 0 : marginStart);
|
|
366
|
+
}
|
|
367
|
+
const StyledGlobalAlertButton = styled(Button).attrs({
|
|
368
|
+
'data-garden-id': COMPONENT_ID$3,
|
|
369
|
+
'data-garden-version': '8.60.0',
|
|
370
|
+
focusInset: false,
|
|
371
|
+
isDanger: false,
|
|
372
|
+
isLink: false,
|
|
373
|
+
isNeutral: false,
|
|
374
|
+
isPill: false,
|
|
375
|
+
isStretched: false,
|
|
376
|
+
size: 'small'
|
|
377
|
+
}).withConfig({
|
|
378
|
+
displayName: "StyledGlobalAlertButton",
|
|
379
|
+
componentId: "sc-1txe91a-0"
|
|
380
|
+
})(["flex-shrink:0;", ";", ";", ";"], sizeStyles$1, colorStyles$1, props => retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
381
|
+
StyledGlobalAlertButton.defaultProps = {
|
|
382
|
+
theme: DEFAULT_THEME
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
const COMPONENT_ID$2 = 'notifications.global-alert.content';
|
|
386
|
+
const StyledGlobalAlertContent = styled.div.attrs({
|
|
387
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
388
|
+
'data-garden-version': '8.60.0'
|
|
389
|
+
}).withConfig({
|
|
390
|
+
displayName: "StyledGlobalAlertContent",
|
|
391
|
+
componentId: "sc-rept0u-0"
|
|
392
|
+
})(["flex-grow:1;", ";"], props => retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
393
|
+
StyledGlobalAlertContent.defaultProps = {
|
|
394
|
+
theme: DEFAULT_THEME
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
const COMPONENT_ID$1 = 'notifications.global-alert.icon';
|
|
398
|
+
const sizeStyles = props => {
|
|
399
|
+
const size = props.theme.iconSizes.md;
|
|
400
|
+
const marginTop = math(`(${props.theme.space.base * 5} - ${size}) / 2`);
|
|
401
|
+
const marginHorizontal = `${props.theme.space.base * 2}px`;
|
|
402
|
+
return css(["margin-top:", ";margin-", ":", ";width:", ";height:", ";"], marginTop, props.theme.rtl ? 'left' : 'right', marginHorizontal, size, size);
|
|
403
|
+
};
|
|
404
|
+
const StyledGlobalAlertIcon = styled(_ref => {
|
|
405
|
+
let {
|
|
406
|
+
children,
|
|
407
|
+
...props
|
|
408
|
+
} = _ref;
|
|
409
|
+
return React__default.cloneElement(Children.only(children), props);
|
|
410
|
+
}).attrs({
|
|
411
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
412
|
+
'data-garden-version': '8.60.0'
|
|
413
|
+
}).withConfig({
|
|
414
|
+
displayName: "StyledGlobalAlertIcon",
|
|
415
|
+
componentId: "sc-84ne9k-0"
|
|
416
|
+
})(["flex-shrink:0;", ";", ";"], sizeStyles, props => retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
417
|
+
StyledGlobalAlertIcon.defaultProps = {
|
|
418
|
+
theme: DEFAULT_THEME
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
const COMPONENT_ID = 'notifications.global-alert.title';
|
|
422
|
+
const colorStyles = props => {
|
|
423
|
+
let color;
|
|
424
|
+
switch (props.alertType) {
|
|
425
|
+
case 'success':
|
|
426
|
+
case 'error':
|
|
427
|
+
color = props.theme.palette.white;
|
|
428
|
+
break;
|
|
429
|
+
case 'warning':
|
|
430
|
+
color = getColor('warningHue', 900, props.theme);
|
|
431
|
+
break;
|
|
432
|
+
case 'info':
|
|
433
|
+
color = getColor('primaryHue', 800, props.theme);
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
return css(["color:", ";"], color);
|
|
437
|
+
};
|
|
438
|
+
const StyledGlobalAlertTitle = styled.div.attrs({
|
|
439
|
+
'data-garden-id': COMPONENT_ID,
|
|
440
|
+
'data-garden-version': '8.60.0'
|
|
441
|
+
}).withConfig({
|
|
442
|
+
displayName: "StyledGlobalAlertTitle",
|
|
443
|
+
componentId: "sc-10clqbo-0"
|
|
444
|
+
})(["display:inline;margin-", ":", "px;font-weight:", ";", ";", ";"], props => props.theme.rtl ? 'left' : 'right', props => props.theme.space.base * 2, props => props.isRegular ? props.theme.fontWeights.regular : props.theme.fontWeights.semibold, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
445
|
+
StyledGlobalAlertTitle.defaultProps = {
|
|
446
|
+
theme: DEFAULT_THEME
|
|
447
|
+
};
|
|
448
|
+
|
|
204
449
|
var _g$2, _circle$2;
|
|
205
450
|
|
|
206
|
-
function _extends$
|
|
451
|
+
function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
|
|
207
452
|
|
|
208
453
|
var SvgAlertErrorStroke = function SvgAlertErrorStroke(props) {
|
|
209
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
454
|
+
return /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
210
455
|
xmlns: "http://www.w3.org/2000/svg",
|
|
211
456
|
width: 16,
|
|
212
457
|
height: 16,
|
|
@@ -234,10 +479,10 @@ var SvgAlertErrorStroke = function SvgAlertErrorStroke(props) {
|
|
|
234
479
|
|
|
235
480
|
var _g$1;
|
|
236
481
|
|
|
237
|
-
function _extends$
|
|
482
|
+
function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
|
|
238
483
|
|
|
239
484
|
var SvgCheckCircleStroke = function SvgCheckCircleStroke(props) {
|
|
240
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
485
|
+
return /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
241
486
|
xmlns: "http://www.w3.org/2000/svg",
|
|
242
487
|
width: 16,
|
|
243
488
|
height: 16,
|
|
@@ -259,12 +504,12 @@ var SvgCheckCircleStroke = function SvgCheckCircleStroke(props) {
|
|
|
259
504
|
}))));
|
|
260
505
|
};
|
|
261
506
|
|
|
262
|
-
var _path$
|
|
507
|
+
var _path$2, _circle$1;
|
|
263
508
|
|
|
264
|
-
function _extends$
|
|
509
|
+
function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
|
|
265
510
|
|
|
266
511
|
var SvgAlertWarningStroke = function SvgAlertWarningStroke(props) {
|
|
267
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
512
|
+
return /*#__PURE__*/React.createElement("svg", _extends$3({
|
|
268
513
|
xmlns: "http://www.w3.org/2000/svg",
|
|
269
514
|
width: 16,
|
|
270
515
|
height: 16,
|
|
@@ -272,7 +517,7 @@ var SvgAlertWarningStroke = function SvgAlertWarningStroke(props) {
|
|
|
272
517
|
viewBox: "0 0 16 16",
|
|
273
518
|
"aria-hidden": "true",
|
|
274
519
|
role: "img"
|
|
275
|
-
}, props), _path$
|
|
520
|
+
}, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
|
|
276
521
|
fill: "none",
|
|
277
522
|
stroke: "currentColor",
|
|
278
523
|
strokeLinecap: "round",
|
|
@@ -287,10 +532,10 @@ var SvgAlertWarningStroke = function SvgAlertWarningStroke(props) {
|
|
|
287
532
|
|
|
288
533
|
var _g, _circle;
|
|
289
534
|
|
|
290
|
-
function _extends$
|
|
535
|
+
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
291
536
|
|
|
292
537
|
var SvgInfoStroke = function SvgInfoStroke(props) {
|
|
293
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
538
|
+
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
294
539
|
xmlns: "http://www.w3.org/2000/svg",
|
|
295
540
|
width: 16,
|
|
296
541
|
height: 16,
|
|
@@ -339,7 +584,7 @@ const Alert = React__default.forwardRef((props, ref) => {
|
|
|
339
584
|
const Icon = validationIcons[props.type];
|
|
340
585
|
return React__default.createElement(NotificationsContext.Provider, {
|
|
341
586
|
value: hue
|
|
342
|
-
}, React__default.createElement(StyledAlert, _extends$
|
|
587
|
+
}, React__default.createElement(StyledAlert, _extends$6({
|
|
343
588
|
ref: ref,
|
|
344
589
|
hue: hue
|
|
345
590
|
}, props), React__default.createElement(StyledIcon, {
|
|
@@ -354,7 +599,7 @@ Alert.propTypes = {
|
|
|
354
599
|
const Notification = React__default.forwardRef((props, ref) => {
|
|
355
600
|
const Icon = props.type ? validationIcons[props.type] : SvgInfoStroke;
|
|
356
601
|
const hue = props.type && validationHues[props.type];
|
|
357
|
-
return React__default.createElement(StyledNotification, _extends$
|
|
602
|
+
return React__default.createElement(StyledNotification, _extends$6({
|
|
358
603
|
ref: ref,
|
|
359
604
|
type: props.type,
|
|
360
605
|
isFloating: true
|
|
@@ -367,7 +612,7 @@ Notification.propTypes = {
|
|
|
367
612
|
type: PropTypes.oneOf(TYPE)
|
|
368
613
|
};
|
|
369
614
|
|
|
370
|
-
const Well = React__default.forwardRef((props, ref) => React__default.createElement(StyledWell, _extends$
|
|
615
|
+
const Well = React__default.forwardRef((props, ref) => React__default.createElement(StyledWell, _extends$6({
|
|
371
616
|
ref: ref
|
|
372
617
|
}, props)));
|
|
373
618
|
Well.displayName = 'Well';
|
|
@@ -376,12 +621,12 @@ Well.propTypes = {
|
|
|
376
621
|
isFloating: PropTypes.bool
|
|
377
622
|
};
|
|
378
623
|
|
|
379
|
-
var _path;
|
|
624
|
+
var _path$1;
|
|
380
625
|
|
|
381
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
626
|
+
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
382
627
|
|
|
383
|
-
var SvgXStroke = function SvgXStroke(props) {
|
|
384
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
628
|
+
var SvgXStroke$1 = function SvgXStroke(props) {
|
|
629
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
385
630
|
xmlns: "http://www.w3.org/2000/svg",
|
|
386
631
|
width: 12,
|
|
387
632
|
height: 12,
|
|
@@ -389,7 +634,7 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
389
634
|
viewBox: "0 0 12 12",
|
|
390
635
|
"aria-hidden": "true",
|
|
391
636
|
role: "img"
|
|
392
|
-
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
637
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
393
638
|
stroke: "currentColor",
|
|
394
639
|
strokeLinecap: "round",
|
|
395
640
|
d: "M3 9l6-6m0 6L3 3"
|
|
@@ -398,19 +643,19 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
398
643
|
|
|
399
644
|
const Close = React__default.forwardRef((props, ref) => {
|
|
400
645
|
const hue = useNotificationsContext();
|
|
401
|
-
return React__default.createElement(StyledClose, _extends$
|
|
646
|
+
return React__default.createElement(StyledClose, _extends$6({
|
|
402
647
|
ref: ref,
|
|
403
648
|
hue: hue
|
|
404
|
-
}, props), React__default.createElement(SvgXStroke, null));
|
|
649
|
+
}, props), React__default.createElement(SvgXStroke$1, null));
|
|
405
650
|
});
|
|
406
651
|
Close.displayName = 'Close';
|
|
407
652
|
|
|
408
|
-
const Paragraph = React__default.forwardRef((props, ref) => React__default.createElement(StyledParagraph, _extends$
|
|
653
|
+
const Paragraph = React__default.forwardRef((props, ref) => React__default.createElement(StyledParagraph, _extends$6({
|
|
409
654
|
ref: ref
|
|
410
655
|
}, props)));
|
|
411
656
|
Paragraph.displayName = 'Paragraph';
|
|
412
657
|
|
|
413
|
-
const Title = React__default.forwardRef((props, ref) => React__default.createElement(StyledTitle, _extends$
|
|
658
|
+
const Title = React__default.forwardRef((props, ref) => React__default.createElement(StyledTitle, _extends$6({
|
|
414
659
|
ref: ref
|
|
415
660
|
}, props)));
|
|
416
661
|
Title.displayName = 'Title';
|
|
@@ -687,7 +932,7 @@ const ToastSlot = _ref => {
|
|
|
687
932
|
}
|
|
688
933
|
return index >= limit;
|
|
689
934
|
}, [limit, placement, toasts.length]);
|
|
690
|
-
return React__default.createElement(StyledTransitionGroup, _extends$
|
|
935
|
+
return React__default.createElement(StyledTransitionGroup, _extends$6({
|
|
691
936
|
key: placement,
|
|
692
937
|
$placement: placement,
|
|
693
938
|
$zIndex: zIndex,
|
|
@@ -732,7 +977,7 @@ const ToastProvider = _ref => {
|
|
|
732
977
|
if (placement === 'bottom' || placement === 'bottom-start' || placement === 'bottom-end') {
|
|
733
978
|
matchingToasts = matchingToasts.reverse();
|
|
734
979
|
}
|
|
735
|
-
return React__default.createElement(ToastSlot, _extends$
|
|
980
|
+
return React__default.createElement(ToastSlot, _extends$6({
|
|
736
981
|
placement: placement,
|
|
737
982
|
toasts: matchingToasts,
|
|
738
983
|
zIndex: zIndex,
|
|
@@ -753,4 +998,116 @@ ToastProvider.propTypes = {
|
|
|
753
998
|
placementProps: PropTypes.object
|
|
754
999
|
};
|
|
755
1000
|
|
|
756
|
-
|
|
1001
|
+
const GlobalAlertContext = createContext({
|
|
1002
|
+
type: 'info'
|
|
1003
|
+
});
|
|
1004
|
+
const useGlobalAlertContext = () => useContext(GlobalAlertContext);
|
|
1005
|
+
|
|
1006
|
+
const GlobalAlertButton = forwardRef((_ref, ref) => {
|
|
1007
|
+
let {
|
|
1008
|
+
isBasic,
|
|
1009
|
+
...props
|
|
1010
|
+
} = _ref;
|
|
1011
|
+
const {
|
|
1012
|
+
type
|
|
1013
|
+
} = useGlobalAlertContext();
|
|
1014
|
+
return React__default.createElement(StyledGlobalAlertButton, _extends$6({
|
|
1015
|
+
ref: ref,
|
|
1016
|
+
alertType: type
|
|
1017
|
+
}, props, {
|
|
1018
|
+
isPrimary: !isBasic,
|
|
1019
|
+
isBasic: isBasic
|
|
1020
|
+
}));
|
|
1021
|
+
});
|
|
1022
|
+
GlobalAlertButton.displayName = 'GlobalAlert.Button';
|
|
1023
|
+
GlobalAlertButton.propTypes = {
|
|
1024
|
+
isBasic: PropTypes.bool
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
var _path;
|
|
1028
|
+
|
|
1029
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1030
|
+
|
|
1031
|
+
var SvgXStroke = function SvgXStroke(props) {
|
|
1032
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
1033
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1034
|
+
width: 16,
|
|
1035
|
+
height: 16,
|
|
1036
|
+
focusable: "false",
|
|
1037
|
+
viewBox: "0 0 16 16",
|
|
1038
|
+
"aria-hidden": "true",
|
|
1039
|
+
role: "img"
|
|
1040
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
1041
|
+
stroke: "currentColor",
|
|
1042
|
+
strokeLinecap: "round",
|
|
1043
|
+
d: "M3 13L13 3m0 10L3 3"
|
|
1044
|
+
})));
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
const GlobalAlertClose = forwardRef((props, ref) => {
|
|
1048
|
+
const {
|
|
1049
|
+
type
|
|
1050
|
+
} = useGlobalAlertContext();
|
|
1051
|
+
const label = useText(GlobalAlertClose, props, 'aria-label', 'Close');
|
|
1052
|
+
return React__default.createElement(StyledGlobalAlertClose, _extends$6({
|
|
1053
|
+
ref: ref,
|
|
1054
|
+
alertType: type
|
|
1055
|
+
}, props), React__default.createElement(SvgXStroke, {
|
|
1056
|
+
role: "img",
|
|
1057
|
+
"aria-label": label
|
|
1058
|
+
}));
|
|
1059
|
+
});
|
|
1060
|
+
GlobalAlertClose.displayName = 'GlobalAlert.Close';
|
|
1061
|
+
|
|
1062
|
+
const GlobalAlertContent = forwardRef((props, ref) => {
|
|
1063
|
+
return React__default.createElement(StyledGlobalAlertContent, _extends$6({
|
|
1064
|
+
ref: ref
|
|
1065
|
+
}, props));
|
|
1066
|
+
});
|
|
1067
|
+
GlobalAlertContent.displayName = 'GlobalAlert.Content';
|
|
1068
|
+
|
|
1069
|
+
const GlobalAlertTitle = forwardRef((props, ref) => {
|
|
1070
|
+
const {
|
|
1071
|
+
type
|
|
1072
|
+
} = useGlobalAlertContext();
|
|
1073
|
+
return React__default.createElement(StyledGlobalAlertTitle, _extends$6({
|
|
1074
|
+
alertType: type,
|
|
1075
|
+
ref: ref
|
|
1076
|
+
}, props));
|
|
1077
|
+
});
|
|
1078
|
+
GlobalAlertTitle.displayName = 'GlobalAlert.Title';
|
|
1079
|
+
GlobalAlertTitle.propTypes = {
|
|
1080
|
+
isRegular: PropTypes.bool
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
const GlobalAlertComponent = forwardRef((_ref, ref) => {
|
|
1084
|
+
let {
|
|
1085
|
+
type,
|
|
1086
|
+
...props
|
|
1087
|
+
} = _ref;
|
|
1088
|
+
return React__default.createElement(GlobalAlertContext.Provider, {
|
|
1089
|
+
value: useMemo(() => ({
|
|
1090
|
+
type
|
|
1091
|
+
}), [type])
|
|
1092
|
+
}, React__default.createElement(StyledGlobalAlert, _extends$6({
|
|
1093
|
+
ref: ref,
|
|
1094
|
+
role: "status",
|
|
1095
|
+
alertType: type
|
|
1096
|
+
}, props), {
|
|
1097
|
+
success: React__default.createElement(StyledGlobalAlertIcon, null, React__default.createElement(SvgCheckCircleStroke, null)),
|
|
1098
|
+
error: React__default.createElement(StyledGlobalAlertIcon, null, React__default.createElement(SvgAlertErrorStroke, null)),
|
|
1099
|
+
warning: React__default.createElement(StyledGlobalAlertIcon, null, React__default.createElement(SvgAlertWarningStroke, null)),
|
|
1100
|
+
info: React__default.createElement(StyledGlobalAlertIcon, null, React__default.createElement(SvgInfoStroke, null))
|
|
1101
|
+
}[type], props.children));
|
|
1102
|
+
});
|
|
1103
|
+
GlobalAlertComponent.displayName = 'GlobalAlert';
|
|
1104
|
+
const GlobalAlert = GlobalAlertComponent;
|
|
1105
|
+
GlobalAlert.Button = GlobalAlertButton;
|
|
1106
|
+
GlobalAlert.Close = GlobalAlertClose;
|
|
1107
|
+
GlobalAlert.Content = GlobalAlertContent;
|
|
1108
|
+
GlobalAlert.Title = GlobalAlertTitle;
|
|
1109
|
+
GlobalAlert.propTypes = {
|
|
1110
|
+
type: PropTypes.oneOf(TYPE).isRequired
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
export { Alert, Close, GlobalAlert, Notification, Paragraph, Title, ToastProvider, Well, useToast };
|