@zendeskgarden/react-notifications 9.0.0-next.7 → 9.0.0-next.9
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/Alert.js +56 -0
- package/dist/esm/elements/Notification.js +56 -0
- package/dist/esm/elements/Well.js +38 -0
- package/dist/esm/elements/content/Close.js +37 -0
- package/dist/esm/elements/content/Paragraph.js +28 -0
- package/dist/esm/elements/content/Title.js +28 -0
- package/dist/esm/elements/global-alert/GlobalAlert.js +65 -0
- package/dist/esm/elements/global-alert/GlobalAlertButton.js +46 -0
- package/dist/esm/elements/global-alert/GlobalAlertClose.js +41 -0
- package/dist/esm/elements/global-alert/GlobalAlertContent.js +30 -0
- package/dist/esm/elements/global-alert/GlobalAlertTitle.js +39 -0
- package/dist/esm/elements/global-alert/utility.js +14 -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/index.js +15 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +26 -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 +25 -0
- package/dist/esm/styled/StyledBase.js +54 -0
- package/dist/esm/styled/StyledIcon.js +18 -0
- package/dist/esm/styled/StyledNotification.js +62 -0
- package/dist/esm/styled/StyledWell.js +23 -0
- package/dist/esm/styled/content/StyledClose.js +25 -0
- package/dist/esm/styled/content/StyledParagraph.js +22 -0
- package/dist/esm/styled/content/StyledTitle.js +22 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlert.js +85 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertButton.js +75 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertClose.js +74 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertContent.js +22 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertIcon.js +29 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertTitle.js +38 -0
- package/dist/esm/types/index.js +9 -0
- package/dist/esm/utils/icons.js +25 -0
- package/dist/esm/utils/useNotificationsContext.js +14 -0
- package/dist/index.cjs.js +63 -84
- package/dist/typings/styled/StyledIcon.d.ts +2 -2
- package/dist/typings/styled/global-alert/StyledGlobalAlertButton.d.ts +2 -2
- package/dist/typings/styled/global-alert/StyledGlobalAlertIcon.d.ts +2 -2
- package/package.json +6 -6
- package/dist/index.esm.js +0 -1134
|
@@ -0,0 +1,82 @@
|
|
|
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, { useState, useContext, useCallback, useEffect } from 'react';
|
|
8
|
+
import { ThemeContext } from 'styled-components';
|
|
9
|
+
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
10
|
+
import { useDocument } from '@zendeskgarden/react-theming';
|
|
11
|
+
import { Toast } from './Toast.js';
|
|
12
|
+
import { StyledTransitionContainer, TRANSITION_CLASS, StyledFadeInTransition } from './styled.js';
|
|
13
|
+
|
|
14
|
+
const ToastSlot = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
toasts,
|
|
17
|
+
placement,
|
|
18
|
+
zIndex,
|
|
19
|
+
limit,
|
|
20
|
+
...props
|
|
21
|
+
} = _ref;
|
|
22
|
+
const [pauseTimers, setPauseTimers] = useState(false);
|
|
23
|
+
const theme = useContext(ThemeContext);
|
|
24
|
+
const environment = useDocument(theme);
|
|
25
|
+
const handleVisibilityChange = useCallback(e => {
|
|
26
|
+
if (e.target.visibilityState === 'visible') {
|
|
27
|
+
setPauseTimers(false);
|
|
28
|
+
} else {
|
|
29
|
+
setPauseTimers(true);
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (environment) {
|
|
34
|
+
environment.addEventListener('visibilitychange', handleVisibilityChange);
|
|
35
|
+
}
|
|
36
|
+
return () => {
|
|
37
|
+
if (environment) {
|
|
38
|
+
environment.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}, [environment, handleVisibilityChange]);
|
|
42
|
+
const handleMouseEnter = useCallback(() => {
|
|
43
|
+
setPauseTimers(true);
|
|
44
|
+
}, []);
|
|
45
|
+
const handleMouseLeave = useCallback(() => {
|
|
46
|
+
setPauseTimers(false);
|
|
47
|
+
}, []);
|
|
48
|
+
const isHidden = useCallback(index => {
|
|
49
|
+
if (placement === 'bottom' || placement === 'bottom-start' || placement === 'bottom-end') {
|
|
50
|
+
return index < toasts.length - limit;
|
|
51
|
+
}
|
|
52
|
+
return index >= limit;
|
|
53
|
+
}, [limit, placement, toasts.length]);
|
|
54
|
+
return React__default.createElement(StyledTransitionContainer, Object.assign({
|
|
55
|
+
key: placement,
|
|
56
|
+
toastPlacement: placement,
|
|
57
|
+
toastZIndex: zIndex,
|
|
58
|
+
onMouseEnter: handleMouseEnter,
|
|
59
|
+
onMouseLeave: handleMouseLeave
|
|
60
|
+
}, props), React__default.createElement(TransitionGroup, null, toasts.map((toast, index) => {
|
|
61
|
+
const transitionRef = React__default.createRef();
|
|
62
|
+
return React__default.createElement(CSSTransition, {
|
|
63
|
+
key: toast.id,
|
|
64
|
+
timeout: {
|
|
65
|
+
enter: 400,
|
|
66
|
+
exit: 550
|
|
67
|
+
},
|
|
68
|
+
unmountOnExit: true,
|
|
69
|
+
classNames: TRANSITION_CLASS,
|
|
70
|
+
nodeRef: transitionRef
|
|
71
|
+
}, React__default.createElement(StyledFadeInTransition, {
|
|
72
|
+
ref: transitionRef,
|
|
73
|
+
placement: placement,
|
|
74
|
+
isHidden: isHidden(index)
|
|
75
|
+
}, React__default.createElement(Toast, {
|
|
76
|
+
toast: toast,
|
|
77
|
+
pauseTimers: pauseTimers || isHidden(index)
|
|
78
|
+
})));
|
|
79
|
+
})));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { ToastSlot };
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
const getInitialState = () => {
|
|
8
|
+
return {
|
|
9
|
+
toasts: []
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const toasterReducer = (state, action) => {
|
|
13
|
+
switch (action.type) {
|
|
14
|
+
case 'ADD_TOAST':
|
|
15
|
+
{
|
|
16
|
+
return {
|
|
17
|
+
...state,
|
|
18
|
+
toasts: [...state.toasts, action.payload]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
case 'REMOVE_TOAST':
|
|
22
|
+
{
|
|
23
|
+
const filteredToasts = state.toasts.filter(toast => toast.id !== action.payload);
|
|
24
|
+
return {
|
|
25
|
+
...state,
|
|
26
|
+
toasts: filteredToasts
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
case 'UPDATE_TOAST':
|
|
30
|
+
{
|
|
31
|
+
const updatedToasts = state.toasts.map(toast => {
|
|
32
|
+
if (toast.id !== action.payload.id) {
|
|
33
|
+
return toast;
|
|
34
|
+
}
|
|
35
|
+
const updatedToast = toast;
|
|
36
|
+
const {
|
|
37
|
+
content,
|
|
38
|
+
...newOptions
|
|
39
|
+
} = action.payload.options;
|
|
40
|
+
if (content) {
|
|
41
|
+
updatedToast.content = content;
|
|
42
|
+
}
|
|
43
|
+
updatedToast.options = {
|
|
44
|
+
...updatedToast.options,
|
|
45
|
+
...newOptions
|
|
46
|
+
};
|
|
47
|
+
return updatedToast;
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
...state,
|
|
51
|
+
toasts: updatedToasts
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
case 'REMOVE_ALL_TOASTS':
|
|
55
|
+
{
|
|
56
|
+
return {
|
|
57
|
+
...state,
|
|
58
|
+
toasts: []
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
throw new Error('Invalid toaster reducer action');
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export { getInitialState, toasterReducer };
|
|
@@ -0,0 +1,71 @@
|
|
|
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 styled, { css } from 'styled-components';
|
|
8
|
+
import { hideVisually } from 'polished';
|
|
9
|
+
import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const TRANSITION_CLASS = 'garden-toast-transition';
|
|
12
|
+
const DEFAULT_DURATION = '400ms';
|
|
13
|
+
const StyledFadeInTransition = styled.div.withConfig({
|
|
14
|
+
displayName: "styled__StyledFadeInTransition",
|
|
15
|
+
componentId: "sc-nq0usb-0"
|
|
16
|
+
})(["transition:opacity ", " ease-in 300ms;opacity:", ";margin-bottom:", "px;", " &.", "-enter{transform:translateY( ", " );opacity:0;max-height:0;}&.", "-enter-active{transform:translateY(0);transition:opacity ", " ease-in,transform ", " cubic-bezier(0.15,0.85,0.35,1.2),max-height ", ";opacity:1;max-height:500px;}&.", "-exit{opacity:1;max-height:500px;}&.", "-exit-active{transition:opacity 550ms ease-out,max-height ", " linear 150ms;opacity:0;max-height:0;}"], DEFAULT_DURATION, p => p.isHidden ? '0 !important' : 1, p => p.theme.space.base * 2, p => p.isHidden && hideVisually(), TRANSITION_CLASS, props => {
|
|
17
|
+
if (props.placement === 'bottom-start' || props.placement === 'bottom' || props.placement === 'bottom-end') {
|
|
18
|
+
return '100px';
|
|
19
|
+
}
|
|
20
|
+
return '-100px';
|
|
21
|
+
}, TRANSITION_CLASS, DEFAULT_DURATION, DEFAULT_DURATION, DEFAULT_DURATION, TRANSITION_CLASS, TRANSITION_CLASS, DEFAULT_DURATION);
|
|
22
|
+
StyledFadeInTransition.defaultProps = {
|
|
23
|
+
theme: DEFAULT_THEME
|
|
24
|
+
};
|
|
25
|
+
const placementStyles = props => {
|
|
26
|
+
const verticalDistance = `${props.theme.space.base * 16}px`;
|
|
27
|
+
const horizontalDistance = `${props.theme.space.base * 3}px`;
|
|
28
|
+
const topLeftStyles = css(["top:", ";left:", ";"], verticalDistance, horizontalDistance);
|
|
29
|
+
const topStyles = css(["top:", ";left:50%;transform:translate(-50%,0);"], verticalDistance);
|
|
30
|
+
const topRightStyles = css(["top:", ";right:", ";"], verticalDistance, horizontalDistance);
|
|
31
|
+
const bottomLeftStyles = css(["bottom:", ";left:", ";"], verticalDistance, horizontalDistance);
|
|
32
|
+
const bottomStyles = css(["bottom:", ";left:50%;transform:translate(-50%,0);"], verticalDistance);
|
|
33
|
+
const bottomRightStyles = css(["right:", ";bottom:", ";"], horizontalDistance, verticalDistance);
|
|
34
|
+
switch (props.toastPlacement) {
|
|
35
|
+
case 'top-start':
|
|
36
|
+
if (props.theme.rtl) {
|
|
37
|
+
return topRightStyles;
|
|
38
|
+
}
|
|
39
|
+
return topLeftStyles;
|
|
40
|
+
case 'top':
|
|
41
|
+
return topStyles;
|
|
42
|
+
case 'top-end':
|
|
43
|
+
if (props.theme.rtl) {
|
|
44
|
+
return topLeftStyles;
|
|
45
|
+
}
|
|
46
|
+
return topRightStyles;
|
|
47
|
+
case 'bottom-start':
|
|
48
|
+
if (props.theme.rtl) {
|
|
49
|
+
return bottomRightStyles;
|
|
50
|
+
}
|
|
51
|
+
return bottomLeftStyles;
|
|
52
|
+
case 'bottom':
|
|
53
|
+
return bottomStyles;
|
|
54
|
+
case 'bottom-end':
|
|
55
|
+
if (props.theme.rtl) {
|
|
56
|
+
return bottomLeftStyles;
|
|
57
|
+
}
|
|
58
|
+
return bottomRightStyles;
|
|
59
|
+
default:
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const StyledTransitionContainer = styled.div.withConfig({
|
|
64
|
+
displayName: "styled__StyledTransitionContainer",
|
|
65
|
+
componentId: "sc-nq0usb-1"
|
|
66
|
+
})(["position:fixed;z-index:", ";", ";"], props => props.toastZIndex, placementStyles);
|
|
67
|
+
StyledTransitionContainer.defaultProps = {
|
|
68
|
+
theme: DEFAULT_THEME
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { StyledFadeInTransition, StyledTransitionContainer, TRANSITION_CLASS };
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { useContext, useCallback } from 'react';
|
|
8
|
+
import { uid } from 'react-uid';
|
|
9
|
+
import { ToastContext } from './ToastContext.js';
|
|
10
|
+
|
|
11
|
+
const DEFAULT_TOAST_OPTIONS = {
|
|
12
|
+
autoDismiss: 5000,
|
|
13
|
+
placement: 'top-end'
|
|
14
|
+
};
|
|
15
|
+
const useToast = () => {
|
|
16
|
+
const context = useContext(ToastContext);
|
|
17
|
+
if (context === undefined) {
|
|
18
|
+
throw new Error('useToast() must be used within a "ToastProvider"');
|
|
19
|
+
}
|
|
20
|
+
const {
|
|
21
|
+
dispatch,
|
|
22
|
+
state
|
|
23
|
+
} = context;
|
|
24
|
+
const addToast = useCallback(function (content) {
|
|
25
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26
|
+
const mergedOptions = {
|
|
27
|
+
...DEFAULT_TOAST_OPTIONS,
|
|
28
|
+
...options
|
|
29
|
+
};
|
|
30
|
+
const newToast = {
|
|
31
|
+
id: mergedOptions.id || uid(content),
|
|
32
|
+
content,
|
|
33
|
+
options: mergedOptions
|
|
34
|
+
};
|
|
35
|
+
dispatch({
|
|
36
|
+
type: 'ADD_TOAST',
|
|
37
|
+
payload: newToast
|
|
38
|
+
});
|
|
39
|
+
return newToast.id;
|
|
40
|
+
}, [dispatch]);
|
|
41
|
+
const removeToast = useCallback(id => {
|
|
42
|
+
dispatch({
|
|
43
|
+
type: 'REMOVE_TOAST',
|
|
44
|
+
payload: id
|
|
45
|
+
});
|
|
46
|
+
}, [dispatch]);
|
|
47
|
+
const updateToast = useCallback((id, options) => {
|
|
48
|
+
dispatch({
|
|
49
|
+
type: 'UPDATE_TOAST',
|
|
50
|
+
payload: {
|
|
51
|
+
id,
|
|
52
|
+
options
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}, [dispatch]);
|
|
56
|
+
const removeAllToasts = useCallback(() => {
|
|
57
|
+
dispatch({
|
|
58
|
+
type: 'REMOVE_ALL_TOASTS'
|
|
59
|
+
});
|
|
60
|
+
}, [dispatch]);
|
|
61
|
+
return {
|
|
62
|
+
addToast,
|
|
63
|
+
removeToast,
|
|
64
|
+
updateToast,
|
|
65
|
+
removeAllToasts,
|
|
66
|
+
toasts: state.toasts
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { useToast };
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export { Alert } from './elements/Alert.js';
|
|
8
|
+
export { Notification } from './elements/Notification.js';
|
|
9
|
+
export { Well } from './elements/Well.js';
|
|
10
|
+
export { Close } from './elements/content/Close.js';
|
|
11
|
+
export { Paragraph } from './elements/content/Paragraph.js';
|
|
12
|
+
export { Title } from './elements/content/Title.js';
|
|
13
|
+
export { ToastProvider } from './elements/toaster/ToastProvider.js';
|
|
14
|
+
export { useToast } from './elements/toaster/useToast.js';
|
|
15
|
+
export { GlobalAlert } from './elements/global-alert/GlobalAlert.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
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 * as React from 'react';
|
|
8
|
+
|
|
9
|
+
var _path;
|
|
10
|
+
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); }
|
|
11
|
+
var SvgXStroke = function SvgXStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: 12,
|
|
15
|
+
height: 12,
|
|
16
|
+
focusable: "false",
|
|
17
|
+
viewBox: "0 0 12 12",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
stroke: "currentColor",
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
d: "M3 9l6-6m0 6L3 3"
|
|
23
|
+
})));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { SvgXStroke as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
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 * as React from 'react';
|
|
8
|
+
|
|
9
|
+
var _g, _circle;
|
|
10
|
+
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); }
|
|
11
|
+
var SvgAlertErrorStroke = function SvgAlertErrorStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: 16,
|
|
15
|
+
height: 16,
|
|
16
|
+
focusable: "false",
|
|
17
|
+
viewBox: "0 0 16 16",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
20
|
+
fill: "none",
|
|
21
|
+
stroke: "currentColor"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
23
|
+
cx: 7.5,
|
|
24
|
+
cy: 8.5,
|
|
25
|
+
r: 7
|
|
26
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
27
|
+
strokeLinecap: "round",
|
|
28
|
+
d: "M7.5 4.5V9"
|
|
29
|
+
}))), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
|
|
30
|
+
cx: 7.5,
|
|
31
|
+
cy: 12,
|
|
32
|
+
r: 1,
|
|
33
|
+
fill: "currentColor"
|
|
34
|
+
})));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { SvgAlertErrorStroke as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
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 * as React from 'react';
|
|
8
|
+
|
|
9
|
+
var _path, _circle;
|
|
10
|
+
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); }
|
|
11
|
+
var SvgAlertWarningStroke = function SvgAlertWarningStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: 16,
|
|
15
|
+
height: 16,
|
|
16
|
+
focusable: "false",
|
|
17
|
+
viewBox: "0 0 16 16",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
fill: "none",
|
|
21
|
+
stroke: "currentColor",
|
|
22
|
+
strokeLinecap: "round",
|
|
23
|
+
d: "M.88 13.77L7.06 1.86c.19-.36.7-.36.89 0l6.18 11.91c.17.33-.07.73-.44.73H1.32c-.37 0-.61-.4-.44-.73zM7.5 6v3.5"
|
|
24
|
+
})), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
|
|
25
|
+
cx: 7.5,
|
|
26
|
+
cy: 12,
|
|
27
|
+
r: 1,
|
|
28
|
+
fill: "currentColor"
|
|
29
|
+
})));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { SvgAlertWarningStroke as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
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 * as React from 'react';
|
|
8
|
+
|
|
9
|
+
var _g;
|
|
10
|
+
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); }
|
|
11
|
+
var SvgCheckCircleStroke = function SvgCheckCircleStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: 16,
|
|
15
|
+
height: 16,
|
|
16
|
+
focusable: "false",
|
|
17
|
+
viewBox: "0 0 16 16",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
20
|
+
fill: "none",
|
|
21
|
+
stroke: "currentColor"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
strokeLinecap: "round",
|
|
24
|
+
strokeLinejoin: "round",
|
|
25
|
+
d: "M4 9l2.5 2.5 5-5"
|
|
26
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
27
|
+
cx: 7.5,
|
|
28
|
+
cy: 8.5,
|
|
29
|
+
r: 7
|
|
30
|
+
}))));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { SvgCheckCircleStroke as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
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 * as React from 'react';
|
|
8
|
+
|
|
9
|
+
var _g, _circle;
|
|
10
|
+
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); }
|
|
11
|
+
var SvgInfoStroke = function SvgInfoStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: 16,
|
|
15
|
+
height: 16,
|
|
16
|
+
focusable: "false",
|
|
17
|
+
viewBox: "0 0 16 16",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
20
|
+
stroke: "currentColor"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
22
|
+
cx: 7.5,
|
|
23
|
+
cy: 8.5,
|
|
24
|
+
r: 7,
|
|
25
|
+
fill: "none"
|
|
26
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
27
|
+
strokeLinecap: "round",
|
|
28
|
+
d: "M7.5 12.5V8"
|
|
29
|
+
}))), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
|
|
30
|
+
cx: 7.5,
|
|
31
|
+
cy: 5,
|
|
32
|
+
r: 1,
|
|
33
|
+
fill: "currentColor"
|
|
34
|
+
})));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { SvgInfoStroke as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
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 * as React from 'react';
|
|
8
|
+
|
|
9
|
+
var _path;
|
|
10
|
+
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); }
|
|
11
|
+
var SvgXStroke = function SvgXStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: 16,
|
|
15
|
+
height: 16,
|
|
16
|
+
focusable: "false",
|
|
17
|
+
viewBox: "0 0 16 16",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
stroke: "currentColor",
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
d: "M3 13L13 3m0 10L3 3"
|
|
23
|
+
})));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { SvgXStroke as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
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 styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledTitle } from './content/StyledTitle.js';
|
|
10
|
+
import { StyledBase } from './StyledBase.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'notifications.alert';
|
|
13
|
+
const colorStyles = props => css(["", "{color:", ";}"], StyledTitle, props.hue && getColorV8(props.hue, 800, props.theme));
|
|
14
|
+
const StyledAlert = styled(StyledBase).attrs({
|
|
15
|
+
'data-garden-id': COMPONENT_ID,
|
|
16
|
+
'data-garden-version': '9.0.0-next.9'
|
|
17
|
+
}).withConfig({
|
|
18
|
+
displayName: "StyledAlert",
|
|
19
|
+
componentId: "sc-fyn8jp-0"
|
|
20
|
+
})(["", " ", ";"], colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
21
|
+
StyledAlert.defaultProps = {
|
|
22
|
+
theme: DEFAULT_THEME
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { StyledAlert };
|
|
@@ -0,0 +1,54 @@
|
|
|
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 styled, { css } from 'styled-components';
|
|
8
|
+
import { getLineHeight, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const boxShadow = props => {
|
|
11
|
+
const {
|
|
12
|
+
theme
|
|
13
|
+
} = props;
|
|
14
|
+
const {
|
|
15
|
+
space,
|
|
16
|
+
shadows
|
|
17
|
+
} = theme;
|
|
18
|
+
const offsetY = `${space.base * 5}px`;
|
|
19
|
+
const blurRadius = `${space.base * 7}px`;
|
|
20
|
+
const color = getColorV8('chromeHue', 600, theme, 0.15);
|
|
21
|
+
return shadows.lg(offsetY, blurRadius, color);
|
|
22
|
+
};
|
|
23
|
+
const colorStyles = props => {
|
|
24
|
+
let backgroundColor;
|
|
25
|
+
let borderColor;
|
|
26
|
+
let foregroundColor;
|
|
27
|
+
if (props.hue) {
|
|
28
|
+
backgroundColor = getColorV8(props.hue, 100, props.theme);
|
|
29
|
+
borderColor = getColorV8(props.hue, 300, props.theme);
|
|
30
|
+
foregroundColor = getColorV8(props.hue, props.type === 'info' ? 600 : 700, props.theme);
|
|
31
|
+
} else {
|
|
32
|
+
backgroundColor = getColorV8('background', 600 , props.theme);
|
|
33
|
+
borderColor = getColorV8('neutralHue', 300, props.theme);
|
|
34
|
+
foregroundColor = getColorV8('neutralHue', 800, props.theme);
|
|
35
|
+
}
|
|
36
|
+
return css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, foregroundColor);
|
|
37
|
+
};
|
|
38
|
+
const padding = props => {
|
|
39
|
+
const {
|
|
40
|
+
space
|
|
41
|
+
} = props.theme;
|
|
42
|
+
const paddingVertical = `${space.base * 5}px`;
|
|
43
|
+
const paddingHorizontal = `${space.base * 10}px`;
|
|
44
|
+
return `${paddingVertical} ${paddingHorizontal}`;
|
|
45
|
+
};
|
|
46
|
+
const StyledBase = styled.div.withConfig({
|
|
47
|
+
displayName: "StyledBase",
|
|
48
|
+
componentId: "sc-14syaqw-0"
|
|
49
|
+
})(["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);
|
|
50
|
+
StyledBase.defaultProps = {
|
|
51
|
+
theme: DEFAULT_THEME
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { StyledBase };
|
|
@@ -0,0 +1,18 @@
|
|
|
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 styled from 'styled-components';
|
|
8
|
+
import { StyledBaseIcon, getColorV8, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const StyledIcon = styled(StyledBaseIcon).withConfig({
|
|
11
|
+
displayName: "StyledIcon",
|
|
12
|
+
componentId: "sc-msklws-0"
|
|
13
|
+
})(["position:absolute;right:", ";left:", ";margin-top:", "px;color:", ";"], props => props.theme.rtl && `${props.theme.space.base * 4}px`, props => !props.theme.rtl && `${props.theme.space.base * 4}px`, props => props.theme.space.base / 2, props => props.$hue && getColorV8(props.$hue, props.$hue === 'warningHue' ? 700 : 600, props.theme));
|
|
14
|
+
StyledIcon.defaultProps = {
|
|
15
|
+
theme: DEFAULT_THEME
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { StyledIcon };
|
|
@@ -0,0 +1,62 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
8
|
+
import styled, { css } from 'styled-components';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { TYPE } from '../types/index.js';
|
|
11
|
+
import { StyledTitle } from './content/StyledTitle.js';
|
|
12
|
+
import { StyledBase } from './StyledBase.js';
|
|
13
|
+
|
|
14
|
+
const COMPONENT_ID = 'notifications.notification';
|
|
15
|
+
const colorStyles = props => {
|
|
16
|
+
const {
|
|
17
|
+
type,
|
|
18
|
+
theme
|
|
19
|
+
} = props;
|
|
20
|
+
const {
|
|
21
|
+
colors
|
|
22
|
+
} = theme;
|
|
23
|
+
const {
|
|
24
|
+
successHue,
|
|
25
|
+
dangerHue,
|
|
26
|
+
warningHue
|
|
27
|
+
} = colors;
|
|
28
|
+
let color;
|
|
29
|
+
switch (type) {
|
|
30
|
+
case 'success':
|
|
31
|
+
color = getColorV8(successHue, 600, theme);
|
|
32
|
+
break;
|
|
33
|
+
case 'error':
|
|
34
|
+
color = getColorV8(dangerHue, 600, theme);
|
|
35
|
+
break;
|
|
36
|
+
case 'warning':
|
|
37
|
+
color = getColorV8(warningHue, 700, theme);
|
|
38
|
+
break;
|
|
39
|
+
case 'info':
|
|
40
|
+
color = getColorV8('foreground', 600 , theme);
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
color = 'inherit';
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
return css(["", "{color:", ";}"], StyledTitle, color);
|
|
47
|
+
};
|
|
48
|
+
const StyledNotification = styled(StyledBase).attrs({
|
|
49
|
+
'data-garden-id': COMPONENT_ID,
|
|
50
|
+
'data-garden-version': '9.0.0-next.9'
|
|
51
|
+
}).withConfig({
|
|
52
|
+
displayName: "StyledNotification",
|
|
53
|
+
componentId: "sc-uf6jh-0"
|
|
54
|
+
})(["", " ", ";"], colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
55
|
+
StyledNotification.propTypes = {
|
|
56
|
+
type: PropTypes.oneOf(TYPE)
|
|
57
|
+
};
|
|
58
|
+
StyledNotification.defaultProps = {
|
|
59
|
+
theme: DEFAULT_THEME
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { StyledNotification };
|