@zendeskgarden/react-notifications 9.0.0-next.8 → 9.0.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/esm/elements/Close.js +40 -0
- package/dist/esm/elements/Notification.js +13 -14
- package/dist/esm/elements/{Well.js → Paragraph.js} +5 -15
- package/dist/esm/elements/Title.js +35 -0
- package/dist/esm/elements/alert/Alert.js +56 -0
- package/dist/esm/elements/{content → alert}/Close.js +8 -5
- package/dist/esm/elements/{content → alert}/Paragraph.js +1 -1
- package/dist/esm/elements/{content → alert}/Title.js +11 -4
- package/dist/esm/elements/global-alert/GlobalAlert.js +29 -15
- package/dist/esm/elements/global-alert/GlobalAlertButton.js +3 -2
- package/dist/esm/elements/global-alert/GlobalAlertClose.js +5 -3
- package/dist/esm/elements/global-alert/GlobalAlertTitle.js +8 -3
- package/dist/esm/elements/toaster/styled.js +0 -7
- package/dist/esm/elements/well/Well.js +47 -0
- package/dist/esm/index.js +5 -5
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +1 -1
- package/dist/esm/styled/StyledAlert.js +29 -6
- package/dist/esm/styled/StyledBase.js +62 -27
- package/dist/esm/styled/StyledIcon.js +44 -11
- package/dist/esm/styled/StyledNotification.js +19 -28
- package/dist/esm/styled/StyledWell.js +28 -7
- package/dist/esm/styled/content/StyledClose.js +53 -11
- package/dist/esm/styled/content/StyledParagraph.js +2 -5
- package/dist/esm/styled/content/StyledTitle.js +6 -6
- package/dist/esm/styled/global-alert/StyledGlobalAlert.js +113 -41
- package/dist/esm/styled/global-alert/StyledGlobalAlertButton.js +76 -36
- package/dist/esm/styled/global-alert/StyledGlobalAlertClose.js +60 -34
- package/dist/esm/styled/global-alert/StyledGlobalAlertContent.js +3 -6
- package/dist/esm/styled/global-alert/StyledGlobalAlertIcon.js +39 -13
- package/dist/esm/styled/global-alert/StyledGlobalAlertTitle.js +20 -12
- package/dist/esm/utils/icons.js +6 -6
- package/dist/index.cjs.js +800 -446
- package/dist/typings/elements/Notification.d.ts +4 -4
- package/dist/typings/elements/{content/Title.d.ts → Title.d.ts} +1 -1
- package/dist/typings/elements/{Alert.d.ts → alert/Alert.d.ts} +5 -5
- package/dist/typings/elements/alert/Close.d.ts +11 -0
- package/dist/typings/elements/alert/Paragraph.d.ts +11 -0
- package/dist/typings/elements/alert/Title.d.ts +12 -0
- package/dist/typings/elements/global-alert/GlobalAlert.d.ts +8 -1
- package/dist/typings/elements/toaster/Toast.d.ts +0 -1
- package/dist/typings/elements/well/Paragraph.d.ts +11 -0
- package/dist/typings/elements/well/Title.d.ts +12 -0
- package/dist/typings/elements/{Well.d.ts → well/Well.d.ts} +4 -4
- package/dist/typings/index.d.ts +5 -5
- package/dist/typings/styled/StyledAlert.d.ts +8 -3
- package/dist/typings/styled/StyledBase.d.ts +8 -6
- package/dist/typings/styled/StyledIcon.d.ts +10 -2
- package/dist/typings/styled/StyledNotification.d.ts +11 -3
- package/dist/typings/styled/StyledWell.d.ts +7 -2
- package/dist/typings/styled/content/StyledClose.d.ts +4 -3
- package/dist/typings/styled/content/StyledTitle.d.ts +1 -1
- package/dist/typings/styled/global-alert/StyledGlobalAlert.d.ts +1 -1
- package/dist/typings/styled/global-alert/StyledGlobalAlertButton.d.ts +4 -18
- package/dist/typings/styled/global-alert/StyledGlobalAlertClose.d.ts +2 -4
- package/dist/typings/styled/global-alert/StyledGlobalAlertIcon.d.ts +1 -2
- package/dist/typings/styled/global-alert/StyledGlobalAlertTitle.d.ts +2 -2
- package/dist/typings/utils/icons.d.ts +1 -1
- package/dist/typings/{elements/global-alert/utility.d.ts → utils/useGlobalAlertContext.d.ts} +1 -2
- package/dist/typings/utils/useNotificationsContext.d.ts +2 -4
- package/package.json +9 -10
- package/LICENSE.md +0 -176
- package/dist/esm/elements/Alert.js +0 -56
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +0 -26
- /package/dist/esm/{elements/global-alert/utility.js → utils/useGlobalAlertContext.js} +0 -0
- /package/dist/typings/elements/{content/Close.d.ts → Close.d.ts} +0 -0
- /package/dist/typings/elements/{content/Paragraph.d.ts → Paragraph.d.ts} +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import { StyledClose } from '../styled/content/StyledClose.js';
|
|
9
|
+
import '../styled/content/StyledParagraph.js';
|
|
10
|
+
import '../styled/content/StyledTitle.js';
|
|
11
|
+
import '../styled/StyledAlert.js';
|
|
12
|
+
import '../styled/StyledNotification.js';
|
|
13
|
+
import '../styled/StyledWell.js';
|
|
14
|
+
import '../styled/StyledIcon.js';
|
|
15
|
+
import '../styled/StyledBase.js';
|
|
16
|
+
import '../styled/global-alert/StyledGlobalAlert.js';
|
|
17
|
+
import '../styled/global-alert/StyledGlobalAlertButton.js';
|
|
18
|
+
import '../styled/global-alert/StyledGlobalAlertClose.js';
|
|
19
|
+
import '../styled/global-alert/StyledGlobalAlertContent.js';
|
|
20
|
+
import '../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
21
|
+
import '../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
22
|
+
import { useNotificationsContext } from '../utils/useNotificationsContext.js';
|
|
23
|
+
import { useText } from '@zendeskgarden/react-theming';
|
|
24
|
+
import SvgXStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js';
|
|
25
|
+
|
|
26
|
+
const Close = React__default.forwardRef((props, ref) => {
|
|
27
|
+
const ariaLabel = useText(Close, props, 'aria-label', 'Close');
|
|
28
|
+
const type = useNotificationsContext();
|
|
29
|
+
return React__default.createElement(StyledClose, Object.assign({
|
|
30
|
+
ref: ref,
|
|
31
|
+
$type: type,
|
|
32
|
+
"aria-label": ariaLabel
|
|
33
|
+
}, props, {
|
|
34
|
+
focusInset: true,
|
|
35
|
+
size: "small"
|
|
36
|
+
}), React__default.createElement(SvgXStroke, null));
|
|
37
|
+
});
|
|
38
|
+
Close.displayName = 'Notification.Close';
|
|
39
|
+
|
|
40
|
+
export { Close };
|
|
@@ -22,27 +22,26 @@ import '../styled/global-alert/StyledGlobalAlertClose.js';
|
|
|
22
22
|
import '../styled/global-alert/StyledGlobalAlertContent.js';
|
|
23
23
|
import '../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
24
24
|
import '../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
25
|
-
import { validationIcons
|
|
26
|
-
import { Title } from './
|
|
27
|
-
import { Paragraph } from './
|
|
28
|
-
import { Close } from './
|
|
25
|
+
import { validationIcons } from '../utils/icons.js';
|
|
26
|
+
import { Title } from './Title.js';
|
|
27
|
+
import { Paragraph } from './Paragraph.js';
|
|
28
|
+
import { Close } from './Close.js';
|
|
29
29
|
|
|
30
30
|
const NotificationComponent = forwardRef((_ref, ref) => {
|
|
31
31
|
let {
|
|
32
|
-
|
|
32
|
+
children,
|
|
33
|
+
type,
|
|
33
34
|
...props
|
|
34
35
|
} = _ref;
|
|
35
|
-
const Icon =
|
|
36
|
-
const hue = props.type && validationHues[props.type];
|
|
36
|
+
const Icon = type ? validationIcons[type] : SvgInfoStroke;
|
|
37
37
|
return React__default.createElement(StyledNotification, Object.assign({
|
|
38
38
|
ref: ref,
|
|
39
|
-
type:
|
|
40
|
-
isFloating: true
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, React__default.createElement(Icon, null)), props.children);
|
|
39
|
+
$type: type,
|
|
40
|
+
$isFloating: true,
|
|
41
|
+
role: "alert"
|
|
42
|
+
}, props), !!type && React__default.createElement(StyledIcon, {
|
|
43
|
+
$type: type
|
|
44
|
+
}, React__default.createElement(Icon, null)), children);
|
|
46
45
|
});
|
|
47
46
|
NotificationComponent.displayName = 'Notification';
|
|
48
47
|
NotificationComponent.propTypes = {
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import React__default from 'react';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
8
|
import '../styled/content/StyledClose.js';
|
|
10
|
-
import '../styled/content/StyledParagraph.js';
|
|
9
|
+
import { StyledParagraph } from '../styled/content/StyledParagraph.js';
|
|
11
10
|
import '../styled/content/StyledTitle.js';
|
|
12
11
|
import '../styled/StyledAlert.js';
|
|
13
12
|
import '../styled/StyledNotification.js';
|
|
14
|
-
import
|
|
13
|
+
import '../styled/StyledWell.js';
|
|
15
14
|
import '../styled/StyledIcon.js';
|
|
16
15
|
import '../styled/StyledBase.js';
|
|
17
16
|
import '../styled/global-alert/StyledGlobalAlert.js';
|
|
@@ -20,19 +19,10 @@ import '../styled/global-alert/StyledGlobalAlertClose.js';
|
|
|
20
19
|
import '../styled/global-alert/StyledGlobalAlertContent.js';
|
|
21
20
|
import '../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
22
21
|
import '../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
23
|
-
import { Title } from './content/Title.js';
|
|
24
|
-
import { Paragraph } from './content/Paragraph.js';
|
|
25
22
|
|
|
26
|
-
const
|
|
23
|
+
const Paragraph = React__default.forwardRef((props, ref) => React__default.createElement(StyledParagraph, Object.assign({
|
|
27
24
|
ref: ref
|
|
28
25
|
}, props)));
|
|
29
|
-
|
|
30
|
-
WellComponent.propTypes = {
|
|
31
|
-
isRecessed: PropTypes.bool,
|
|
32
|
-
isFloating: PropTypes.bool
|
|
33
|
-
};
|
|
34
|
-
const Well = WellComponent;
|
|
35
|
-
Well.Paragraph = Paragraph;
|
|
36
|
-
Well.Title = Title;
|
|
26
|
+
Paragraph.displayName = 'Notification.Paragraph';
|
|
37
27
|
|
|
38
|
-
export {
|
|
28
|
+
export { Paragraph };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import '../styled/content/StyledClose.js';
|
|
9
|
+
import '../styled/content/StyledParagraph.js';
|
|
10
|
+
import { StyledTitle } from '../styled/content/StyledTitle.js';
|
|
11
|
+
import '../styled/StyledAlert.js';
|
|
12
|
+
import '../styled/StyledNotification.js';
|
|
13
|
+
import '../styled/StyledWell.js';
|
|
14
|
+
import '../styled/StyledIcon.js';
|
|
15
|
+
import '../styled/StyledBase.js';
|
|
16
|
+
import '../styled/global-alert/StyledGlobalAlert.js';
|
|
17
|
+
import '../styled/global-alert/StyledGlobalAlertButton.js';
|
|
18
|
+
import '../styled/global-alert/StyledGlobalAlertClose.js';
|
|
19
|
+
import '../styled/global-alert/StyledGlobalAlertContent.js';
|
|
20
|
+
import '../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
21
|
+
import '../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
22
|
+
|
|
23
|
+
const Title = React__default.forwardRef((_ref, ref) => {
|
|
24
|
+
let {
|
|
25
|
+
isRegular,
|
|
26
|
+
...props
|
|
27
|
+
} = _ref;
|
|
28
|
+
return React__default.createElement(StyledTitle, Object.assign({
|
|
29
|
+
ref: ref,
|
|
30
|
+
$isRegular: isRegular
|
|
31
|
+
}, props));
|
|
32
|
+
});
|
|
33
|
+
Title.displayName = 'Notification.Title';
|
|
34
|
+
|
|
35
|
+
export { Title };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { TYPE } from '../../types/index.js';
|
|
10
|
+
import '../../styled/content/StyledClose.js';
|
|
11
|
+
import '../../styled/content/StyledParagraph.js';
|
|
12
|
+
import '../../styled/content/StyledTitle.js';
|
|
13
|
+
import { StyledAlert } from '../../styled/StyledAlert.js';
|
|
14
|
+
import '../../styled/StyledNotification.js';
|
|
15
|
+
import '../../styled/StyledWell.js';
|
|
16
|
+
import { StyledIcon } from '../../styled/StyledIcon.js';
|
|
17
|
+
import '../../styled/StyledBase.js';
|
|
18
|
+
import '../../styled/global-alert/StyledGlobalAlert.js';
|
|
19
|
+
import '../../styled/global-alert/StyledGlobalAlertButton.js';
|
|
20
|
+
import '../../styled/global-alert/StyledGlobalAlertClose.js';
|
|
21
|
+
import '../../styled/global-alert/StyledGlobalAlertContent.js';
|
|
22
|
+
import '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
23
|
+
import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
24
|
+
import { validationIcons } from '../../utils/icons.js';
|
|
25
|
+
import { NotificationsContext } from '../../utils/useNotificationsContext.js';
|
|
26
|
+
import { Title } from './Title.js';
|
|
27
|
+
import { Paragraph } from './Paragraph.js';
|
|
28
|
+
import { Close } from './Close.js';
|
|
29
|
+
|
|
30
|
+
const AlertComponent = React__default.forwardRef((_ref, ref) => {
|
|
31
|
+
let {
|
|
32
|
+
role,
|
|
33
|
+
type,
|
|
34
|
+
...props
|
|
35
|
+
} = _ref;
|
|
36
|
+
const Icon = validationIcons[type];
|
|
37
|
+
return React__default.createElement(NotificationsContext.Provider, {
|
|
38
|
+
value: type
|
|
39
|
+
}, React__default.createElement(StyledAlert, Object.assign({
|
|
40
|
+
ref: ref,
|
|
41
|
+
$type: type,
|
|
42
|
+
role: role === undefined ? 'alert' : role
|
|
43
|
+
}, props), React__default.createElement(StyledIcon, {
|
|
44
|
+
$type: type
|
|
45
|
+
}, React__default.createElement(Icon, null)), props.children));
|
|
46
|
+
});
|
|
47
|
+
AlertComponent.displayName = 'Alert';
|
|
48
|
+
AlertComponent.propTypes = {
|
|
49
|
+
type: PropTypes.oneOf(TYPE).isRequired
|
|
50
|
+
};
|
|
51
|
+
const Alert = AlertComponent;
|
|
52
|
+
Alert.Close = Close;
|
|
53
|
+
Alert.Paragraph = Paragraph;
|
|
54
|
+
Alert.Title = Title;
|
|
55
|
+
|
|
56
|
+
export { Alert, AlertComponent };
|
|
@@ -21,17 +21,20 @@ import '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
|
21
21
|
import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
22
22
|
import { useNotificationsContext } from '../../utils/useNotificationsContext.js';
|
|
23
23
|
import { useText } from '@zendeskgarden/react-theming';
|
|
24
|
-
import SvgXStroke from '../../node_modules/@zendeskgarden/svg-icons/src/
|
|
24
|
+
import SvgXStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js';
|
|
25
25
|
|
|
26
26
|
const Close = React__default.forwardRef((props, ref) => {
|
|
27
27
|
const ariaLabel = useText(Close, props, 'aria-label', 'Close');
|
|
28
|
-
const
|
|
28
|
+
const type = useNotificationsContext();
|
|
29
29
|
return React__default.createElement(StyledClose, Object.assign({
|
|
30
30
|
ref: ref,
|
|
31
|
-
|
|
31
|
+
$type: type,
|
|
32
32
|
"aria-label": ariaLabel
|
|
33
|
-
}, props
|
|
33
|
+
}, props, {
|
|
34
|
+
focusInset: true,
|
|
35
|
+
size: "small"
|
|
36
|
+
}), React__default.createElement(SvgXStroke, null));
|
|
34
37
|
});
|
|
35
|
-
Close.displayName = 'Close';
|
|
38
|
+
Close.displayName = 'Alert.Close';
|
|
36
39
|
|
|
37
40
|
export { Close };
|
|
@@ -23,6 +23,6 @@ import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
|
23
23
|
const Paragraph = React__default.forwardRef((props, ref) => React__default.createElement(StyledParagraph, Object.assign({
|
|
24
24
|
ref: ref
|
|
25
25
|
}, props)));
|
|
26
|
-
Paragraph.displayName = 'Paragraph';
|
|
26
|
+
Paragraph.displayName = 'Alert.Paragraph';
|
|
27
27
|
|
|
28
28
|
export { Paragraph };
|
|
@@ -20,9 +20,16 @@ import '../../styled/global-alert/StyledGlobalAlertContent.js';
|
|
|
20
20
|
import '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
21
21
|
import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
22
22
|
|
|
23
|
-
const Title = React__default.forwardRef((
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const Title = React__default.forwardRef((_ref, ref) => {
|
|
24
|
+
let {
|
|
25
|
+
isRegular,
|
|
26
|
+
...props
|
|
27
|
+
} = _ref;
|
|
28
|
+
return React__default.createElement(StyledTitle, Object.assign({
|
|
29
|
+
ref: ref,
|
|
30
|
+
$isRegular: isRegular
|
|
31
|
+
}, props));
|
|
32
|
+
});
|
|
33
|
+
Title.displayName = 'Alert.Title';
|
|
27
34
|
|
|
28
35
|
export { Title };
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React__default, { forwardRef, useMemo } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import { ThemeProvider } from 'styled-components';
|
|
9
10
|
import SvgInfoStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js';
|
|
10
11
|
import SvgAlertErrorStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js';
|
|
11
12
|
import SvgAlertWarningStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js';
|
|
@@ -25,7 +26,7 @@ import '../../styled/global-alert/StyledGlobalAlertClose.js';
|
|
|
25
26
|
import '../../styled/global-alert/StyledGlobalAlertContent.js';
|
|
26
27
|
import { StyledGlobalAlertIcon } from '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
27
28
|
import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
28
|
-
import { GlobalAlertContext } from '
|
|
29
|
+
import { GlobalAlertContext } from '../../utils/useGlobalAlertContext.js';
|
|
29
30
|
import { GlobalAlertButton } from './GlobalAlertButton.js';
|
|
30
31
|
import { GlobalAlertClose } from './GlobalAlertClose.js';
|
|
31
32
|
import { GlobalAlertContent } from './GlobalAlertContent.js';
|
|
@@ -36,20 +37,33 @@ const GlobalAlertComponent = forwardRef((_ref, ref) => {
|
|
|
36
37
|
type,
|
|
37
38
|
...props
|
|
38
39
|
} = _ref;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
const icon = {
|
|
41
|
+
success: React__default.createElement(SvgCheckCircleStroke, null),
|
|
42
|
+
error: React__default.createElement(SvgAlertErrorStroke, null),
|
|
43
|
+
warning: React__default.createElement(SvgAlertWarningStroke, null),
|
|
44
|
+
info: React__default.createElement(SvgInfoStroke, null)
|
|
45
|
+
}[type];
|
|
46
|
+
return (
|
|
47
|
+
React__default.createElement(ThemeProvider, {
|
|
48
|
+
theme: theme => ({
|
|
49
|
+
...theme,
|
|
50
|
+
colors: {
|
|
51
|
+
...theme.colors,
|
|
52
|
+
base: 'light'
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}, React__default.createElement(GlobalAlertContext.Provider, {
|
|
56
|
+
value: useMemo(() => ({
|
|
57
|
+
type
|
|
58
|
+
}), [type])
|
|
59
|
+
}, React__default.createElement(StyledGlobalAlert, Object.assign({
|
|
60
|
+
ref: ref,
|
|
61
|
+
role: "status",
|
|
62
|
+
$alertType: type
|
|
63
|
+
}, props), React__default.createElement(StyledGlobalAlertIcon, {
|
|
64
|
+
$alertType: type
|
|
65
|
+
}, icon), props.children)))
|
|
66
|
+
);
|
|
53
67
|
});
|
|
54
68
|
GlobalAlertComponent.displayName = 'GlobalAlert';
|
|
55
69
|
const GlobalAlert = GlobalAlertComponent;
|
|
@@ -20,7 +20,7 @@ import '../../styled/global-alert/StyledGlobalAlertClose.js';
|
|
|
20
20
|
import '../../styled/global-alert/StyledGlobalAlertContent.js';
|
|
21
21
|
import '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
22
22
|
import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
23
|
-
import { useGlobalAlertContext } from '
|
|
23
|
+
import { useGlobalAlertContext } from '../../utils/useGlobalAlertContext.js';
|
|
24
24
|
|
|
25
25
|
const GlobalAlertButton = forwardRef((_ref, ref) => {
|
|
26
26
|
let {
|
|
@@ -32,8 +32,9 @@ const GlobalAlertButton = forwardRef((_ref, ref) => {
|
|
|
32
32
|
} = useGlobalAlertContext();
|
|
33
33
|
return React__default.createElement(StyledGlobalAlertButton, Object.assign({
|
|
34
34
|
ref: ref,
|
|
35
|
-
alertType: type
|
|
35
|
+
$alertType: type
|
|
36
36
|
}, props, {
|
|
37
|
+
size: "small",
|
|
37
38
|
isPrimary: !isBasic,
|
|
38
39
|
isBasic: isBasic
|
|
39
40
|
}));
|
|
@@ -21,7 +21,7 @@ import { StyledGlobalAlertClose } from '../../styled/global-alert/StyledGlobalAl
|
|
|
21
21
|
import '../../styled/global-alert/StyledGlobalAlertContent.js';
|
|
22
22
|
import '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
23
23
|
import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
24
|
-
import { useGlobalAlertContext } from '
|
|
24
|
+
import { useGlobalAlertContext } from '../../utils/useGlobalAlertContext.js';
|
|
25
25
|
|
|
26
26
|
const GlobalAlertClose = forwardRef((props, ref) => {
|
|
27
27
|
const {
|
|
@@ -30,8 +30,10 @@ const GlobalAlertClose = forwardRef((props, ref) => {
|
|
|
30
30
|
const label = useText(GlobalAlertClose, props, 'aria-label', 'Close');
|
|
31
31
|
return React__default.createElement(StyledGlobalAlertClose, Object.assign({
|
|
32
32
|
ref: ref,
|
|
33
|
-
alertType: type
|
|
34
|
-
}, props
|
|
33
|
+
$alertType: type
|
|
34
|
+
}, props, {
|
|
35
|
+
size: "small"
|
|
36
|
+
}), React__default.createElement(SvgXStroke, {
|
|
35
37
|
role: "img",
|
|
36
38
|
"aria-label": label
|
|
37
39
|
}));
|
|
@@ -20,14 +20,19 @@ import '../../styled/global-alert/StyledGlobalAlertClose.js';
|
|
|
20
20
|
import '../../styled/global-alert/StyledGlobalAlertContent.js';
|
|
21
21
|
import '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
22
22
|
import { StyledGlobalAlertTitle } from '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
23
|
-
import { useGlobalAlertContext } from '
|
|
23
|
+
import { useGlobalAlertContext } from '../../utils/useGlobalAlertContext.js';
|
|
24
24
|
|
|
25
|
-
const GlobalAlertTitle = forwardRef((
|
|
25
|
+
const GlobalAlertTitle = forwardRef((_ref, ref) => {
|
|
26
|
+
let {
|
|
27
|
+
isRegular,
|
|
28
|
+
...props
|
|
29
|
+
} = _ref;
|
|
26
30
|
const {
|
|
27
31
|
type
|
|
28
32
|
} = useGlobalAlertContext();
|
|
29
33
|
return React__default.createElement(StyledGlobalAlertTitle, Object.assign({
|
|
30
|
-
alertType: type,
|
|
34
|
+
$alertType: type,
|
|
35
|
+
$isRegular: isRegular,
|
|
31
36
|
ref: ref
|
|
32
37
|
}, props));
|
|
33
38
|
});
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { hideVisually } from 'polished';
|
|
9
|
-
import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
9
|
|
|
11
10
|
const TRANSITION_CLASS = 'garden-toast-transition';
|
|
12
11
|
const DEFAULT_DURATION = '400ms';
|
|
@@ -19,9 +18,6 @@ const StyledFadeInTransition = styled.div.withConfig({
|
|
|
19
18
|
}
|
|
20
19
|
return '-100px';
|
|
21
20
|
}, TRANSITION_CLASS, DEFAULT_DURATION, DEFAULT_DURATION, DEFAULT_DURATION, TRANSITION_CLASS, TRANSITION_CLASS, DEFAULT_DURATION);
|
|
22
|
-
StyledFadeInTransition.defaultProps = {
|
|
23
|
-
theme: DEFAULT_THEME
|
|
24
|
-
};
|
|
25
21
|
const placementStyles = props => {
|
|
26
22
|
const verticalDistance = `${props.theme.space.base * 16}px`;
|
|
27
23
|
const horizontalDistance = `${props.theme.space.base * 3}px`;
|
|
@@ -64,8 +60,5 @@ const StyledTransitionContainer = styled.div.withConfig({
|
|
|
64
60
|
displayName: "styled__StyledTransitionContainer",
|
|
65
61
|
componentId: "sc-nq0usb-1"
|
|
66
62
|
})(["position:fixed;z-index:", ";", ";"], props => props.toastZIndex, placementStyles);
|
|
67
|
-
StyledTransitionContainer.defaultProps = {
|
|
68
|
-
theme: DEFAULT_THEME
|
|
69
|
-
};
|
|
70
63
|
|
|
71
64
|
export { StyledFadeInTransition, StyledTransitionContainer, TRANSITION_CLASS };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import '../../styled/content/StyledClose.js';
|
|
10
|
+
import '../../styled/content/StyledParagraph.js';
|
|
11
|
+
import '../../styled/content/StyledTitle.js';
|
|
12
|
+
import '../../styled/StyledAlert.js';
|
|
13
|
+
import '../../styled/StyledNotification.js';
|
|
14
|
+
import { StyledWell } from '../../styled/StyledWell.js';
|
|
15
|
+
import '../../styled/StyledIcon.js';
|
|
16
|
+
import '../../styled/StyledBase.js';
|
|
17
|
+
import '../../styled/global-alert/StyledGlobalAlert.js';
|
|
18
|
+
import '../../styled/global-alert/StyledGlobalAlertButton.js';
|
|
19
|
+
import '../../styled/global-alert/StyledGlobalAlertClose.js';
|
|
20
|
+
import '../../styled/global-alert/StyledGlobalAlertContent.js';
|
|
21
|
+
import '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
22
|
+
import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
23
|
+
import { Title } from '../Title.js';
|
|
24
|
+
import { Paragraph } from '../Paragraph.js';
|
|
25
|
+
|
|
26
|
+
const WellComponent = React__default.forwardRef((_ref, ref) => {
|
|
27
|
+
let {
|
|
28
|
+
isFloating,
|
|
29
|
+
isRecessed,
|
|
30
|
+
...props
|
|
31
|
+
} = _ref;
|
|
32
|
+
return React__default.createElement(StyledWell, Object.assign({
|
|
33
|
+
ref: ref,
|
|
34
|
+
$isFloating: isFloating,
|
|
35
|
+
$isRecessed: isRecessed
|
|
36
|
+
}, props));
|
|
37
|
+
});
|
|
38
|
+
WellComponent.displayName = 'Well';
|
|
39
|
+
WellComponent.propTypes = {
|
|
40
|
+
isRecessed: PropTypes.bool,
|
|
41
|
+
isFloating: PropTypes.bool
|
|
42
|
+
};
|
|
43
|
+
const Well = WellComponent;
|
|
44
|
+
Well.Paragraph = Paragraph;
|
|
45
|
+
Well.Title = Title;
|
|
46
|
+
|
|
47
|
+
export { Well, WellComponent };
|
package/dist/esm/index.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
export { Alert } from './elements/Alert.js';
|
|
7
|
+
export { Alert } from './elements/alert/Alert.js';
|
|
8
8
|
export { Notification } from './elements/Notification.js';
|
|
9
|
-
export { Well } from './elements/Well.js';
|
|
10
|
-
export { Close } from './elements/
|
|
11
|
-
export { Paragraph } from './elements/
|
|
12
|
-
export { Title } from './elements/
|
|
9
|
+
export { Well } from './elements/well/Well.js';
|
|
10
|
+
export { Close } from './elements/Close.js';
|
|
11
|
+
export { Paragraph } from './elements/Paragraph.js';
|
|
12
|
+
export { Title } from './elements/Title.js';
|
|
13
13
|
export { ToastProvider } from './elements/toaster/ToastProvider.js';
|
|
14
14
|
export { useToast } from './elements/toaster/useToast.js';
|
|
15
15
|
export { GlobalAlert } from './elements/global-alert/GlobalAlert.js';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _g, _circle;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
11
|
var SvgAlertErrorStroke = function SvgAlertErrorStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _path, _circle;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
11
|
var SvgAlertWarningStroke = function SvgAlertWarningStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _g;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
11
|
var SvgCheckCircleStroke = function SvgCheckCircleStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _g, _circle;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
11
|
var SvgInfoStroke = function SvgInfoStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _path;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
11
|
var SvgXStroke = function SvgXStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5,21 +5,44 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles,
|
|
8
|
+
import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledTitle } from './content/StyledTitle.js';
|
|
10
10
|
import { StyledBase } from './StyledBase.js';
|
|
11
|
+
import { validationTypes } from '../utils/icons.js';
|
|
11
12
|
|
|
12
13
|
const COMPONENT_ID = 'notifications.alert';
|
|
13
|
-
const colorStyles = props =>
|
|
14
|
+
const colorStyles = props => {
|
|
15
|
+
const {
|
|
16
|
+
$type,
|
|
17
|
+
theme
|
|
18
|
+
} = props;
|
|
19
|
+
let variable;
|
|
20
|
+
switch ($type) {
|
|
21
|
+
case validationTypes.success:
|
|
22
|
+
variable = 'foreground.successEmphasis';
|
|
23
|
+
break;
|
|
24
|
+
case validationTypes.error:
|
|
25
|
+
variable = 'foreground.dangerEmphasis';
|
|
26
|
+
break;
|
|
27
|
+
case validationTypes.warning:
|
|
28
|
+
variable = 'foreground.warningEmphasis';
|
|
29
|
+
break;
|
|
30
|
+
case validationTypes.info:
|
|
31
|
+
variable = 'foreground.default';
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
const color = variable ? getColor({
|
|
35
|
+
variable,
|
|
36
|
+
theme
|
|
37
|
+
}) : undefined;
|
|
38
|
+
return css(["", "{color:", ";}"], StyledTitle, color);
|
|
39
|
+
};
|
|
14
40
|
const StyledAlert = styled(StyledBase).attrs({
|
|
15
41
|
'data-garden-id': COMPONENT_ID,
|
|
16
|
-
'data-garden-version': '9.0.0
|
|
42
|
+
'data-garden-version': '9.0.0'
|
|
17
43
|
}).withConfig({
|
|
18
44
|
displayName: "StyledAlert",
|
|
19
45
|
componentId: "sc-fyn8jp-0"
|
|
20
46
|
})(["", " ", ";"], colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
21
|
-
StyledAlert.defaultProps = {
|
|
22
|
-
theme: DEFAULT_THEME
|
|
23
|
-
};
|
|
24
47
|
|
|
25
48
|
export { StyledAlert };
|