@zendeskgarden/react-notifications 9.0.0-next.2 → 9.0.0-next.21
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/README.md +6 -4
- package/dist/esm/elements/Close.js +40 -0
- package/dist/esm/elements/Notification.js +55 -0
- package/dist/esm/elements/Paragraph.js +28 -0
- package/dist/esm/elements/Title.js +35 -0
- package/dist/esm/elements/alert/Alert.js +56 -0
- package/dist/esm/elements/alert/Close.js +40 -0
- package/dist/esm/elements/alert/Paragraph.js +28 -0
- package/dist/esm/elements/alert/Title.js +35 -0
- package/dist/esm/elements/global-alert/GlobalAlert.js +78 -0
- package/dist/esm/elements/global-alert/GlobalAlertButton.js +47 -0
- package/dist/esm/elements/global-alert/GlobalAlertClose.js +43 -0
- package/dist/esm/elements/global-alert/GlobalAlertContent.js +30 -0
- package/dist/esm/elements/global-alert/GlobalAlertTitle.js +44 -0
- package/dist/esm/elements/toaster/Toast.js +62 -0
- package/dist/esm/elements/toaster/ToastContext.js +11 -0
- package/dist/esm/elements/toaster/ToastProvider.js +51 -0
- package/dist/esm/elements/toaster/ToastSlot.js +82 -0
- package/dist/esm/elements/toaster/reducer.js +66 -0
- package/dist/esm/elements/toaster/styled.js +71 -0
- package/dist/esm/elements/toaster/useToast.js +70 -0
- package/dist/esm/elements/well/Well.js +47 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +37 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +32 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +33 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js +37 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +26 -0
- package/dist/esm/styled/StyledAlert.js +51 -0
- package/dist/esm/styled/StyledBase.js +92 -0
- package/dist/esm/styled/StyledIcon.js +61 -0
- package/dist/esm/styled/StyledNotification.js +56 -0
- package/dist/esm/styled/StyledWell.js +47 -0
- package/dist/esm/styled/content/StyledClose.js +70 -0
- package/dist/esm/styled/content/StyledParagraph.js +22 -0
- package/dist/esm/styled/content/StyledTitle.js +25 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlert.js +160 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertButton.js +118 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertClose.js +103 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertContent.js +22 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertIcon.js +65 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertTitle.js +49 -0
- package/dist/esm/types/index.js +9 -0
- package/dist/esm/utils/icons.js +25 -0
- package/dist/esm/utils/useGlobalAlertContext.js +14 -0
- package/dist/esm/utils/useNotificationsContext.js +14 -0
- package/dist/index.cjs.js +837 -435
- package/dist/typings/elements/Close.d.ts +13 -0
- package/dist/typings/elements/Notification.d.ts +9 -1
- package/dist/typings/elements/Paragraph.d.ts +13 -0
- package/dist/typings/elements/{Well.d.ts → Title.d.ts} +4 -2
- package/dist/typings/elements/alert/Alert.d.ts +20 -0
- package/dist/typings/elements/well/Paragraph.d.ts +11 -0
- package/dist/typings/elements/{Alert.d.ts → well/Title.d.ts} +2 -2
- package/dist/typings/elements/well/Well.d.ts +18 -0
- package/dist/typings/index.d.ts +7 -11
- 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 +11 -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 +5 -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 -11
- package/dist/typings/styled/global-alert/StyledGlobalAlertClose.d.ts +2 -3
- package/dist/typings/styled/global-alert/StyledGlobalAlertIcon.d.ts +2 -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 -1
- package/dist/typings/utils/useNotificationsContext.d.ts +2 -3
- package/package.json +9 -9
- package/dist/index.esm.js +0 -1124
- /package/dist/typings/elements/{content → alert}/Close.d.ts +0 -0
- /package/dist/typings/elements/{content → alert}/Paragraph.d.ts +0 -0
- /package/dist/typings/elements/{content → alert}/Title.d.ts +0 -0
package/README.md
CHANGED
|
@@ -14,16 +14,18 @@ npm install react react-dom styled-components @zendeskgarden/react-theming
|
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
|
+
## Notifications
|
|
18
|
+
|
|
17
19
|
```jsx
|
|
18
20
|
import { ThemeProvider } from '@zendeskgarden/react-theming';
|
|
19
|
-
import { Notification
|
|
21
|
+
import { Notification } from '@zendeskgarden/react-notifications';
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* Place a `ThemeProvider` at the root of your React application
|
|
23
25
|
*/
|
|
24
26
|
<ThemeProvider>
|
|
25
27
|
<Notification>
|
|
26
|
-
<Title>Example Title</Title>
|
|
28
|
+
<Notification.Title>Example Title</Notification.Title>
|
|
27
29
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit...
|
|
28
30
|
</Notification>
|
|
29
31
|
</ThemeProvider>;
|
|
@@ -34,7 +36,7 @@ import { Notification, Title } from '@zendeskgarden/react-notifications';
|
|
|
34
36
|
```jsx
|
|
35
37
|
import { ThemeProvider } from '@zendeskgarden/react-theming';
|
|
36
38
|
import { Button } from '@zendeskgarden/react-buttons';
|
|
37
|
-
import { Notification,
|
|
39
|
+
import { Notification, ToastProvider, useToast } from '@zendeskgarden/react-notifications';
|
|
38
40
|
|
|
39
41
|
const ToastExample = () => {
|
|
40
42
|
const { addToast } = useToast();
|
|
@@ -45,7 +47,7 @@ const ToastExample = () => {
|
|
|
45
47
|
addToast(({ close }) => (
|
|
46
48
|
<Notification>
|
|
47
49
|
Example notification
|
|
48
|
-
<Close onClick={close} aria-label="Close" />
|
|
50
|
+
<Notification.Close onClick={close} aria-label="Close" />
|
|
49
51
|
</Notification>
|
|
50
52
|
))
|
|
51
53
|
}
|
|
@@ -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 };
|
|
@@ -0,0 +1,55 @@
|
|
|
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, { forwardRef } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import SvgInfoStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js';
|
|
10
|
+
import { TYPE } from '../types/index.js';
|
|
11
|
+
import '../styled/content/StyledClose.js';
|
|
12
|
+
import '../styled/content/StyledParagraph.js';
|
|
13
|
+
import '../styled/content/StyledTitle.js';
|
|
14
|
+
import '../styled/StyledAlert.js';
|
|
15
|
+
import { StyledNotification } from '../styled/StyledNotification.js';
|
|
16
|
+
import '../styled/StyledWell.js';
|
|
17
|
+
import { StyledIcon } from '../styled/StyledIcon.js';
|
|
18
|
+
import '../styled/StyledBase.js';
|
|
19
|
+
import '../styled/global-alert/StyledGlobalAlert.js';
|
|
20
|
+
import '../styled/global-alert/StyledGlobalAlertButton.js';
|
|
21
|
+
import '../styled/global-alert/StyledGlobalAlertClose.js';
|
|
22
|
+
import '../styled/global-alert/StyledGlobalAlertContent.js';
|
|
23
|
+
import '../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
24
|
+
import '../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
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
|
+
|
|
30
|
+
const NotificationComponent = forwardRef((_ref, ref) => {
|
|
31
|
+
let {
|
|
32
|
+
children,
|
|
33
|
+
type,
|
|
34
|
+
...props
|
|
35
|
+
} = _ref;
|
|
36
|
+
const Icon = type ? validationIcons[type] : SvgInfoStroke;
|
|
37
|
+
return React__default.createElement(StyledNotification, Object.assign({
|
|
38
|
+
ref: ref,
|
|
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);
|
|
45
|
+
});
|
|
46
|
+
NotificationComponent.displayName = 'Notification';
|
|
47
|
+
NotificationComponent.propTypes = {
|
|
48
|
+
type: PropTypes.oneOf(TYPE)
|
|
49
|
+
};
|
|
50
|
+
const Notification = NotificationComponent;
|
|
51
|
+
Notification.Close = Close;
|
|
52
|
+
Notification.Paragraph = Paragraph;
|
|
53
|
+
Notification.Title = Title;
|
|
54
|
+
|
|
55
|
+
export { Notification, NotificationComponent };
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { StyledParagraph } from '../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
|
+
|
|
23
|
+
const Paragraph = React__default.forwardRef((props, ref) => React__default.createElement(StyledParagraph, Object.assign({
|
|
24
|
+
ref: ref
|
|
25
|
+
}, props)));
|
|
26
|
+
Paragraph.displayName = 'Notification.Paragraph';
|
|
27
|
+
|
|
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 };
|
|
@@ -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 = 'Alert.Close';
|
|
39
|
+
|
|
40
|
+
export { Close };
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { StyledParagraph } from '../../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
|
+
|
|
23
|
+
const Paragraph = React__default.forwardRef((props, ref) => React__default.createElement(StyledParagraph, Object.assign({
|
|
24
|
+
ref: ref
|
|
25
|
+
}, props)));
|
|
26
|
+
Paragraph.displayName = 'Alert.Paragraph';
|
|
27
|
+
|
|
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 = 'Alert.Title';
|
|
34
|
+
|
|
35
|
+
export { Title };
|
|
@@ -0,0 +1,78 @@
|
|
|
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, { forwardRef, useMemo } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { ThemeProvider } from 'styled-components';
|
|
10
|
+
import SvgInfoStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js';
|
|
11
|
+
import SvgAlertErrorStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js';
|
|
12
|
+
import SvgAlertWarningStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js';
|
|
13
|
+
import SvgCheckCircleStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js';
|
|
14
|
+
import { TYPE } from '../../types/index.js';
|
|
15
|
+
import '../../styled/content/StyledClose.js';
|
|
16
|
+
import '../../styled/content/StyledParagraph.js';
|
|
17
|
+
import '../../styled/content/StyledTitle.js';
|
|
18
|
+
import '../../styled/StyledAlert.js';
|
|
19
|
+
import '../../styled/StyledNotification.js';
|
|
20
|
+
import '../../styled/StyledWell.js';
|
|
21
|
+
import '../../styled/StyledIcon.js';
|
|
22
|
+
import '../../styled/StyledBase.js';
|
|
23
|
+
import { StyledGlobalAlert } from '../../styled/global-alert/StyledGlobalAlert.js';
|
|
24
|
+
import '../../styled/global-alert/StyledGlobalAlertButton.js';
|
|
25
|
+
import '../../styled/global-alert/StyledGlobalAlertClose.js';
|
|
26
|
+
import '../../styled/global-alert/StyledGlobalAlertContent.js';
|
|
27
|
+
import { StyledGlobalAlertIcon } from '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
28
|
+
import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
29
|
+
import { GlobalAlertContext } from '../../utils/useGlobalAlertContext.js';
|
|
30
|
+
import { GlobalAlertButton } from './GlobalAlertButton.js';
|
|
31
|
+
import { GlobalAlertClose } from './GlobalAlertClose.js';
|
|
32
|
+
import { GlobalAlertContent } from './GlobalAlertContent.js';
|
|
33
|
+
import { GlobalAlertTitle } from './GlobalAlertTitle.js';
|
|
34
|
+
|
|
35
|
+
const GlobalAlertComponent = forwardRef((_ref, ref) => {
|
|
36
|
+
let {
|
|
37
|
+
type,
|
|
38
|
+
...props
|
|
39
|
+
} = _ref;
|
|
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
|
+
);
|
|
67
|
+
});
|
|
68
|
+
GlobalAlertComponent.displayName = 'GlobalAlert';
|
|
69
|
+
const GlobalAlert = GlobalAlertComponent;
|
|
70
|
+
GlobalAlert.Button = GlobalAlertButton;
|
|
71
|
+
GlobalAlert.Close = GlobalAlertClose;
|
|
72
|
+
GlobalAlert.Content = GlobalAlertContent;
|
|
73
|
+
GlobalAlert.Title = GlobalAlertTitle;
|
|
74
|
+
GlobalAlert.propTypes = {
|
|
75
|
+
type: PropTypes.oneOf(TYPE).isRequired
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export { GlobalAlert };
|
|
@@ -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, { forwardRef } 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 '../../styled/StyledWell.js';
|
|
15
|
+
import '../../styled/StyledIcon.js';
|
|
16
|
+
import '../../styled/StyledBase.js';
|
|
17
|
+
import '../../styled/global-alert/StyledGlobalAlert.js';
|
|
18
|
+
import { StyledGlobalAlertButton } from '../../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 { useGlobalAlertContext } from '../../utils/useGlobalAlertContext.js';
|
|
24
|
+
|
|
25
|
+
const GlobalAlertButton = forwardRef((_ref, ref) => {
|
|
26
|
+
let {
|
|
27
|
+
isBasic,
|
|
28
|
+
...props
|
|
29
|
+
} = _ref;
|
|
30
|
+
const {
|
|
31
|
+
type
|
|
32
|
+
} = useGlobalAlertContext();
|
|
33
|
+
return React__default.createElement(StyledGlobalAlertButton, Object.assign({
|
|
34
|
+
ref: ref,
|
|
35
|
+
$alertType: type
|
|
36
|
+
}, props, {
|
|
37
|
+
size: "small",
|
|
38
|
+
isPrimary: !isBasic,
|
|
39
|
+
isBasic: isBasic
|
|
40
|
+
}));
|
|
41
|
+
});
|
|
42
|
+
GlobalAlertButton.displayName = 'GlobalAlert.Button';
|
|
43
|
+
GlobalAlertButton.propTypes = {
|
|
44
|
+
isBasic: PropTypes.bool
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { GlobalAlertButton };
|
|
@@ -0,0 +1,43 @@
|
|
|
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, { forwardRef } from 'react';
|
|
8
|
+
import { useText } from '@zendeskgarden/react-theming';
|
|
9
|
+
import SvgXStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js';
|
|
10
|
+
import '../../styled/content/StyledClose.js';
|
|
11
|
+
import '../../styled/content/StyledParagraph.js';
|
|
12
|
+
import '../../styled/content/StyledTitle.js';
|
|
13
|
+
import '../../styled/StyledAlert.js';
|
|
14
|
+
import '../../styled/StyledNotification.js';
|
|
15
|
+
import '../../styled/StyledWell.js';
|
|
16
|
+
import '../../styled/StyledIcon.js';
|
|
17
|
+
import '../../styled/StyledBase.js';
|
|
18
|
+
import '../../styled/global-alert/StyledGlobalAlert.js';
|
|
19
|
+
import '../../styled/global-alert/StyledGlobalAlertButton.js';
|
|
20
|
+
import { StyledGlobalAlertClose } from '../../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 { useGlobalAlertContext } from '../../utils/useGlobalAlertContext.js';
|
|
25
|
+
|
|
26
|
+
const GlobalAlertClose = forwardRef((props, ref) => {
|
|
27
|
+
const {
|
|
28
|
+
type
|
|
29
|
+
} = useGlobalAlertContext();
|
|
30
|
+
const label = useText(GlobalAlertClose, props, 'aria-label', 'Close');
|
|
31
|
+
return React__default.createElement(StyledGlobalAlertClose, Object.assign({
|
|
32
|
+
ref: ref,
|
|
33
|
+
$alertType: type
|
|
34
|
+
}, props, {
|
|
35
|
+
size: "small"
|
|
36
|
+
}), React__default.createElement(SvgXStroke, {
|
|
37
|
+
role: "img",
|
|
38
|
+
"aria-label": label
|
|
39
|
+
}));
|
|
40
|
+
});
|
|
41
|
+
GlobalAlertClose.displayName = 'GlobalAlert.Close';
|
|
42
|
+
|
|
43
|
+
export { GlobalAlertClose };
|
|
@@ -0,0 +1,30 @@
|
|
|
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, { forwardRef } from 'react';
|
|
8
|
+
import '../../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 { StyledGlobalAlertContent } from '../../styled/global-alert/StyledGlobalAlertContent.js';
|
|
20
|
+
import '../../styled/global-alert/StyledGlobalAlertIcon.js';
|
|
21
|
+
import '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
22
|
+
|
|
23
|
+
const GlobalAlertContent = forwardRef((props, ref) => {
|
|
24
|
+
return React__default.createElement(StyledGlobalAlertContent, Object.assign({
|
|
25
|
+
ref: ref
|
|
26
|
+
}, props));
|
|
27
|
+
});
|
|
28
|
+
GlobalAlertContent.displayName = 'GlobalAlert.Content';
|
|
29
|
+
|
|
30
|
+
export { GlobalAlertContent };
|
|
@@ -0,0 +1,44 @@
|
|
|
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, { forwardRef } 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 '../../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 { StyledGlobalAlertTitle } from '../../styled/global-alert/StyledGlobalAlertTitle.js';
|
|
23
|
+
import { useGlobalAlertContext } from '../../utils/useGlobalAlertContext.js';
|
|
24
|
+
|
|
25
|
+
const GlobalAlertTitle = forwardRef((_ref, ref) => {
|
|
26
|
+
let {
|
|
27
|
+
isRegular,
|
|
28
|
+
...props
|
|
29
|
+
} = _ref;
|
|
30
|
+
const {
|
|
31
|
+
type
|
|
32
|
+
} = useGlobalAlertContext();
|
|
33
|
+
return React__default.createElement(StyledGlobalAlertTitle, Object.assign({
|
|
34
|
+
$alertType: type,
|
|
35
|
+
$isRegular: isRegular,
|
|
36
|
+
ref: ref
|
|
37
|
+
}, props));
|
|
38
|
+
});
|
|
39
|
+
GlobalAlertTitle.displayName = 'GlobalAlert.Title';
|
|
40
|
+
GlobalAlertTitle.propTypes = {
|
|
41
|
+
isRegular: PropTypes.bool
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { GlobalAlertTitle };
|