@zendeskgarden/react-modals 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 +10 -10
- package/dist/esm/elements/Body.js +42 -0
- package/dist/esm/elements/Close.js +53 -0
- package/dist/esm/elements/Drawer/Body.js +43 -0
- package/dist/esm/elements/Drawer/Close.js +54 -0
- package/dist/esm/elements/Drawer/Drawer.js +182 -0
- package/dist/esm/elements/Drawer/Footer.js +37 -0
- package/dist/esm/elements/Drawer/FooterItem.js +37 -0
- package/dist/esm/elements/Drawer/Header.js +69 -0
- package/dist/esm/elements/Footer.js +43 -0
- package/dist/esm/elements/FooterItem.js +36 -0
- package/dist/esm/elements/Header.js +70 -0
- package/dist/esm/elements/Modal.js +191 -0
- package/dist/esm/elements/TooltipModal/Body.js +43 -0
- package/dist/esm/elements/TooltipModal/Close.js +50 -0
- package/dist/esm/elements/TooltipModal/Footer.js +37 -0
- package/dist/esm/elements/TooltipModal/FooterItem.js +37 -0
- package/dist/esm/elements/TooltipModal/Title.js +68 -0
- package/dist/esm/elements/TooltipModal/TooltipModal.js +192 -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/x-stroke.svg.js +26 -0
- package/dist/esm/styled/StyledBackdrop.js +49 -0
- package/dist/esm/styled/StyledBody.js +30 -0
- package/dist/esm/styled/StyledClose.js +28 -0
- package/dist/esm/styled/StyledDangerIcon.js +19 -0
- package/dist/esm/styled/StyledDrawer.js +44 -0
- package/dist/esm/styled/StyledDrawerBody.js +23 -0
- package/dist/esm/styled/StyledDrawerClose.js +28 -0
- package/dist/esm/styled/StyledDrawerFooter.js +30 -0
- package/dist/esm/styled/StyledDrawerFooterItem.js +23 -0
- package/dist/esm/styled/StyledDrawerHeader.js +24 -0
- package/dist/esm/styled/StyledFooter.js +22 -0
- package/dist/esm/styled/StyledFooterItem.js +22 -0
- package/dist/esm/styled/StyledHeader.js +38 -0
- package/dist/esm/styled/StyledModal.js +58 -0
- package/dist/esm/styled/StyledTooltipModal.js +33 -0
- package/dist/esm/styled/StyledTooltipModalBackdrop.js +22 -0
- package/dist/esm/styled/StyledTooltipModalBody.js +30 -0
- package/dist/esm/styled/StyledTooltipModalClose.js +23 -0
- package/dist/esm/styled/StyledTooltipModalFooter.js +22 -0
- package/dist/esm/styled/StyledTooltipModalFooterItem.js +23 -0
- package/dist/esm/styled/StyledTooltipModalTitle.js +36 -0
- package/dist/esm/styled/StyledTooltipWrapper.js +25 -0
- package/dist/esm/types/index.js +11 -0
- package/dist/esm/utils/useModalContext.js +18 -0
- package/dist/esm/utils/useTooltipModalContext.js +18 -0
- package/dist/index.cjs.js +272 -215
- package/dist/typings/elements/Body.d.ts +2 -0
- package/dist/typings/elements/Close.d.ts +2 -0
- package/dist/typings/elements/Footer.d.ts +2 -0
- package/dist/typings/elements/FooterItem.d.ts +2 -0
- package/dist/typings/elements/Header.d.ts +2 -0
- package/dist/typings/elements/Modal.d.ts +13 -1
- package/dist/typings/index.d.ts +1 -1
- package/dist/typings/styled/StyledClose.d.ts +2 -5
- package/dist/typings/styled/StyledDrawerClose.d.ts +2 -1
- package/dist/typings/styled/StyledHeader.d.ts +2 -1
- package/dist/typings/styled/StyledTooltipModalClose.d.ts +2 -1
- package/package.json +9 -9
- package/dist/index.esm.js +0 -1115
|
@@ -0,0 +1,192 @@
|
|
|
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, { useContext, useRef, useState, useEffect } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { ThemeContext } from 'styled-components';
|
|
10
|
+
import { CSSTransition } from 'react-transition-group';
|
|
11
|
+
import { useFloating, platform, offset, autoPlacement, autoUpdate } from '@floating-ui/react-dom';
|
|
12
|
+
import { useModal } from '@zendeskgarden/container-modal';
|
|
13
|
+
import { mergeRefs } from 'react-merge-refs';
|
|
14
|
+
import { TooltipModalContext } from '../../utils/useTooltipModalContext.js';
|
|
15
|
+
import '../../styled/StyledBackdrop.js';
|
|
16
|
+
import '../../styled/StyledBody.js';
|
|
17
|
+
import '../../styled/StyledClose.js';
|
|
18
|
+
import '../../styled/StyledFooter.js';
|
|
19
|
+
import '../../styled/StyledFooterItem.js';
|
|
20
|
+
import '../../styled/StyledHeader.js';
|
|
21
|
+
import '../../styled/StyledDangerIcon.js';
|
|
22
|
+
import '../../styled/StyledModal.js';
|
|
23
|
+
import { StyledTooltipModalBackdrop } from '../../styled/StyledTooltipModalBackdrop.js';
|
|
24
|
+
import { StyledTooltipWrapper } from '../../styled/StyledTooltipWrapper.js';
|
|
25
|
+
import { StyledTooltipModal } from '../../styled/StyledTooltipModal.js';
|
|
26
|
+
import '../../styled/StyledTooltipModalTitle.js';
|
|
27
|
+
import '../../styled/StyledTooltipModalBody.js';
|
|
28
|
+
import '../../styled/StyledTooltipModalFooter.js';
|
|
29
|
+
import '../../styled/StyledTooltipModalFooterItem.js';
|
|
30
|
+
import '../../styled/StyledTooltipModalClose.js';
|
|
31
|
+
import '../../styled/StyledDrawer.js';
|
|
32
|
+
import '../../styled/StyledDrawerHeader.js';
|
|
33
|
+
import '../../styled/StyledDrawerClose.js';
|
|
34
|
+
import '../../styled/StyledDrawerBody.js';
|
|
35
|
+
import '../../styled/StyledDrawerFooter.js';
|
|
36
|
+
import '../../styled/StyledDrawerFooterItem.js';
|
|
37
|
+
import { Title } from './Title.js';
|
|
38
|
+
import { Body } from './Body.js';
|
|
39
|
+
import { Close } from './Close.js';
|
|
40
|
+
import { Footer } from './Footer.js';
|
|
41
|
+
import { FooterItem } from './FooterItem.js';
|
|
42
|
+
import { DEFAULT_THEME, getFloatingPlacements, useText } from '@zendeskgarden/react-theming';
|
|
43
|
+
import { createPortal } from 'react-dom';
|
|
44
|
+
|
|
45
|
+
const PLACEMENT_DEFAULT = 'top';
|
|
46
|
+
const TooltipModalComponent = React__default.forwardRef((_ref, ref) => {
|
|
47
|
+
let {
|
|
48
|
+
appendToNode,
|
|
49
|
+
referenceElement,
|
|
50
|
+
placement: _placement,
|
|
51
|
+
onClose,
|
|
52
|
+
hasArrow,
|
|
53
|
+
isAnimated,
|
|
54
|
+
zIndex,
|
|
55
|
+
backdropProps,
|
|
56
|
+
focusOnMount,
|
|
57
|
+
restoreFocus,
|
|
58
|
+
id,
|
|
59
|
+
...props
|
|
60
|
+
} = _ref;
|
|
61
|
+
const theme = useContext(ThemeContext) || DEFAULT_THEME;
|
|
62
|
+
const previousReferenceElementRef = useRef();
|
|
63
|
+
const modalRef = useRef(null);
|
|
64
|
+
const transitionRef = useRef(null);
|
|
65
|
+
const [floatingElement, setFloatingElement] = useState();
|
|
66
|
+
const [hasTitle, setHasTitle] = useState(false);
|
|
67
|
+
const {
|
|
68
|
+
getTitleProps,
|
|
69
|
+
getCloseProps,
|
|
70
|
+
getContentProps,
|
|
71
|
+
getBackdropProps,
|
|
72
|
+
getModalProps
|
|
73
|
+
} = useModal({
|
|
74
|
+
idPrefix: id,
|
|
75
|
+
onClose,
|
|
76
|
+
modalRef,
|
|
77
|
+
focusOnMount,
|
|
78
|
+
restoreFocus: false
|
|
79
|
+
});
|
|
80
|
+
const [floatingPlacement] = getFloatingPlacements(theme, _placement === 'auto' ? PLACEMENT_DEFAULT : _placement);
|
|
81
|
+
const {
|
|
82
|
+
refs,
|
|
83
|
+
placement,
|
|
84
|
+
update,
|
|
85
|
+
floatingStyles: {
|
|
86
|
+
transform
|
|
87
|
+
}
|
|
88
|
+
} = useFloating({
|
|
89
|
+
platform: {
|
|
90
|
+
...platform,
|
|
91
|
+
isRTL: () => theme.rtl
|
|
92
|
+
},
|
|
93
|
+
elements: {
|
|
94
|
+
reference: referenceElement,
|
|
95
|
+
floating: floatingElement
|
|
96
|
+
},
|
|
97
|
+
placement: floatingPlacement,
|
|
98
|
+
middleware: [offset(theme.space.base * 3), _placement === 'auto' ? autoPlacement() : undefined]
|
|
99
|
+
});
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
let cleanup;
|
|
102
|
+
if (referenceElement && floatingElement && refs.reference.current && refs.floating.current) {
|
|
103
|
+
cleanup = autoUpdate(refs.reference.current, refs.floating.current, update, {
|
|
104
|
+
elementResize: typeof ResizeObserver === 'function'
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return () => cleanup && cleanup();
|
|
108
|
+
}, [referenceElement, floatingElement, refs.reference, refs.floating, update]);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (!referenceElement && previousReferenceElementRef.current && restoreFocus) {
|
|
111
|
+
previousReferenceElementRef.current.focus();
|
|
112
|
+
}
|
|
113
|
+
previousReferenceElementRef.current = referenceElement;
|
|
114
|
+
}, [referenceElement, restoreFocus]);
|
|
115
|
+
const modalProps = getModalProps({
|
|
116
|
+
'aria-describedby': undefined,
|
|
117
|
+
...(hasTitle ? {} : {
|
|
118
|
+
'aria-labelledby': undefined
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
const attribute = hasTitle ? 'aria-labelledby' : 'aria-label';
|
|
122
|
+
const defaultValue = hasTitle ? modalProps['aria-labelledby'] : 'Modal dialog';
|
|
123
|
+
const labelValue = hasTitle ? modalProps['aria-labelledby'] : props['aria-label'];
|
|
124
|
+
const ariaProps = {
|
|
125
|
+
[attribute]: useText(TooltipModalComponent, {
|
|
126
|
+
[attribute]: labelValue
|
|
127
|
+
}, attribute, defaultValue)
|
|
128
|
+
};
|
|
129
|
+
const value = {
|
|
130
|
+
hasTitle,
|
|
131
|
+
setHasTitle,
|
|
132
|
+
getTitleProps,
|
|
133
|
+
getContentProps,
|
|
134
|
+
getCloseProps
|
|
135
|
+
};
|
|
136
|
+
const Node = React__default.createElement(CSSTransition, {
|
|
137
|
+
unmountOnExit: true,
|
|
138
|
+
timeout: isAnimated ? 200 : 0,
|
|
139
|
+
in: Boolean(referenceElement),
|
|
140
|
+
classNames: isAnimated ? 'garden-tooltip-modal-transition' : '',
|
|
141
|
+
nodeRef: transitionRef
|
|
142
|
+
}, transitionState => {
|
|
143
|
+
return React__default.createElement(TooltipModalContext.Provider, {
|
|
144
|
+
value: value
|
|
145
|
+
}, React__default.createElement(StyledTooltipModalBackdrop, Object.assign({}, getBackdropProps(), backdropProps, {
|
|
146
|
+
ref: transitionRef
|
|
147
|
+
}), React__default.createElement(StyledTooltipWrapper, {
|
|
148
|
+
ref: setFloatingElement,
|
|
149
|
+
style: {
|
|
150
|
+
transform
|
|
151
|
+
},
|
|
152
|
+
placement: placement,
|
|
153
|
+
zIndex: zIndex,
|
|
154
|
+
isAnimated: isAnimated
|
|
155
|
+
}, React__default.createElement(StyledTooltipModal, Object.assign({
|
|
156
|
+
transitionState: transitionState,
|
|
157
|
+
placement: placement,
|
|
158
|
+
hasArrow: hasArrow,
|
|
159
|
+
isAnimated: isAnimated
|
|
160
|
+
}, modalProps, ariaProps, props, {
|
|
161
|
+
ref: mergeRefs([modalRef, ref])
|
|
162
|
+
})))));
|
|
163
|
+
});
|
|
164
|
+
return appendToNode ? createPortal(Node, appendToNode) : Node;
|
|
165
|
+
});
|
|
166
|
+
TooltipModalComponent.displayName = 'TooltipModal';
|
|
167
|
+
TooltipModalComponent.defaultProps = {
|
|
168
|
+
placement: 'auto',
|
|
169
|
+
hasArrow: true,
|
|
170
|
+
focusOnMount: true,
|
|
171
|
+
restoreFocus: true
|
|
172
|
+
};
|
|
173
|
+
TooltipModalComponent.propTypes = {
|
|
174
|
+
appendToNode: PropTypes.any,
|
|
175
|
+
referenceElement: PropTypes.any,
|
|
176
|
+
placement: PropTypes.any,
|
|
177
|
+
isAnimated: PropTypes.bool,
|
|
178
|
+
hasArrow: PropTypes.bool,
|
|
179
|
+
zIndex: PropTypes.number,
|
|
180
|
+
onClose: PropTypes.func,
|
|
181
|
+
backdropProps: PropTypes.any,
|
|
182
|
+
focusOnMount: PropTypes.bool,
|
|
183
|
+
restoreFocus: PropTypes.bool
|
|
184
|
+
};
|
|
185
|
+
const TooltipModal = TooltipModalComponent;
|
|
186
|
+
TooltipModal.Body = Body;
|
|
187
|
+
TooltipModal.Close = Close;
|
|
188
|
+
TooltipModal.Footer = Footer;
|
|
189
|
+
TooltipModal.FooterItem = FooterItem;
|
|
190
|
+
TooltipModal.Title = Title;
|
|
191
|
+
|
|
192
|
+
export { TooltipModal };
|
|
@@ -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 { Modal } from './elements/Modal.js';
|
|
8
|
+
export { Body } from './elements/Body.js';
|
|
9
|
+
export { Close } from './elements/Close.js';
|
|
10
|
+
export { Footer } from './elements/Footer.js';
|
|
11
|
+
export { FooterItem } from './elements/FooterItem.js';
|
|
12
|
+
export { Header } from './elements/Header.js';
|
|
13
|
+
export { TooltipModal } from './elements/TooltipModal/TooltipModal.js';
|
|
14
|
+
export { Drawer } from './elements/Drawer/Drawer.js';
|
|
15
|
+
export { PLACEMENT } from './types/index.js';
|
|
@@ -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() { 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
|
+
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,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() { 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
|
+
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,49 @@
|
|
|
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, { keyframes, css } from 'styled-components';
|
|
9
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'modals.backdrop';
|
|
12
|
+
const animationName = keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
|
|
13
|
+
const animationStyles = props => {
|
|
14
|
+
if (props.isAnimated) {
|
|
15
|
+
return css(["animation:", " 0.15s ease-in;"], animationName);
|
|
16
|
+
}
|
|
17
|
+
return '';
|
|
18
|
+
};
|
|
19
|
+
const StyledBackdrop = styled.div.attrs({
|
|
20
|
+
'data-garden-id': COMPONENT_ID,
|
|
21
|
+
'data-garden-version': '9.0.0-next.21'
|
|
22
|
+
}).withConfig({
|
|
23
|
+
displayName: "StyledBackdrop",
|
|
24
|
+
componentId: "sc-mzdjpo-0"
|
|
25
|
+
})(["display:flex;position:fixed;inset:0;align-items:", ";justify-content:", ";z-index:400;background-color:", ";overflow:auto;-webkit-overflow-scrolling:touch;font-family:", ";direction:", ";", ";", ";"], props => props.isCentered && 'center', props => props.isCentered && 'center', _ref => {
|
|
26
|
+
let {
|
|
27
|
+
theme
|
|
28
|
+
} = _ref;
|
|
29
|
+
return getColor({
|
|
30
|
+
theme,
|
|
31
|
+
hue: 'neutralHue',
|
|
32
|
+
transparency: theme.opacity[1000],
|
|
33
|
+
light: {
|
|
34
|
+
shade: 900
|
|
35
|
+
},
|
|
36
|
+
dark: {
|
|
37
|
+
shade: 1200
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}, props => props.theme.fonts.system, props => props.theme.rtl && 'rtl', animationStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
41
|
+
StyledBackdrop.defaultProps = {
|
|
42
|
+
theme: DEFAULT_THEME
|
|
43
|
+
};
|
|
44
|
+
StyledBackdrop.propTypes = {
|
|
45
|
+
isCentered: PropTypes.bool,
|
|
46
|
+
isAnimated: PropTypes.bool
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { StyledBackdrop };
|
|
@@ -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 styled from 'styled-components';
|
|
8
|
+
import { getLineHeight, getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'modals.body';
|
|
11
|
+
const StyledBody = styled.div.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledBody",
|
|
16
|
+
componentId: "sc-14rzecg-0"
|
|
17
|
+
})(["display:block;margin:0;padding:", ";height:100%;overflow:auto;line-height:", ";color-scheme:only ", ";color:", ";font-size:", ";", ";"], props => `${props.theme.space.base * 5}px ${props.theme.space.base * 10}px`, props => getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md), p => p.theme.colors.base, _ref => {
|
|
18
|
+
let {
|
|
19
|
+
theme
|
|
20
|
+
} = _ref;
|
|
21
|
+
return getColor({
|
|
22
|
+
theme,
|
|
23
|
+
variable: 'foreground.default'
|
|
24
|
+
});
|
|
25
|
+
}, props => props.theme.fontSizes.md, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
26
|
+
StyledBody.defaultProps = {
|
|
27
|
+
theme: DEFAULT_THEME
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { StyledBody };
|
|
@@ -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 styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { IconButton } from '@zendeskgarden/react-buttons';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'modals.close';
|
|
12
|
+
const BASE_MULTIPLIERS = {
|
|
13
|
+
top: 2.5,
|
|
14
|
+
side: 6.5,
|
|
15
|
+
size: 10
|
|
16
|
+
};
|
|
17
|
+
const StyledClose = styled(IconButton).attrs({
|
|
18
|
+
'data-garden-id': COMPONENT_ID,
|
|
19
|
+
'data-garden-version': '9.0.0-next.21'
|
|
20
|
+
}).withConfig({
|
|
21
|
+
displayName: "StyledClose",
|
|
22
|
+
componentId: "sc-iseudj-0"
|
|
23
|
+
})(["position:absolute;top:", "px;", ":", ";", ";"], props => props.theme.space.base * BASE_MULTIPLIERS.top, props => props.theme.rtl ? 'left' : 'right', props => `${props.theme.space.base * BASE_MULTIPLIERS.side}px`, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
24
|
+
StyledClose.defaultProps = {
|
|
25
|
+
theme: DEFAULT_THEME
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { BASE_MULTIPLIERS, StyledClose };
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import SvgAlertErrorStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js';
|
|
10
|
+
|
|
11
|
+
const StyledDangerIcon = styled(SvgAlertErrorStroke).withConfig({
|
|
12
|
+
displayName: "StyledDangerIcon",
|
|
13
|
+
componentId: "sc-1kwbb39-0"
|
|
14
|
+
})(["position:absolute;top:", "px;", ":", ";"], props => props.theme.space.base * 5.5, props => props.theme.rtl ? 'right' : 'left', props => `${props.theme.space.base * 4}px`);
|
|
15
|
+
StyledDangerIcon.defaultProps = {
|
|
16
|
+
theme: DEFAULT_THEME
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { StyledDangerIcon };
|
|
@@ -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 styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'modals.drawer_modal';
|
|
11
|
+
const DRAWER_WIDTH = 380;
|
|
12
|
+
const colorStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme
|
|
15
|
+
} = _ref;
|
|
16
|
+
const offsetY = `${theme.space.base * 5}px`;
|
|
17
|
+
const blurRadius = `${theme.space.base * 7}px`;
|
|
18
|
+
const shadowColor = getColor({
|
|
19
|
+
variable: 'shadow.large',
|
|
20
|
+
theme
|
|
21
|
+
});
|
|
22
|
+
const shadow = theme.shadows.lg(offsetY, blurRadius, shadowColor);
|
|
23
|
+
const borderColor = getColor({
|
|
24
|
+
theme,
|
|
25
|
+
variable: 'border.default'
|
|
26
|
+
});
|
|
27
|
+
const backgroundColor = getColor({
|
|
28
|
+
theme,
|
|
29
|
+
variable: 'background.raised'
|
|
30
|
+
});
|
|
31
|
+
return css(["border-color:", ";box-shadow:", ";background-color:", ";"], borderColor, shadow, backgroundColor);
|
|
32
|
+
};
|
|
33
|
+
const StyledDrawer = styled.div.attrs({
|
|
34
|
+
'data-garden-id': COMPONENT_ID,
|
|
35
|
+
'data-garden-version': '9.0.0-next.21'
|
|
36
|
+
}).withConfig({
|
|
37
|
+
displayName: "StyledDrawer",
|
|
38
|
+
componentId: "sc-zp66t3-0"
|
|
39
|
+
})(["display:flex;position:fixed;top:0;", ":0;flex-direction:column;z-index:500;", ":", ";width:", "px;height:100%;overflow:auto;-webkit-overflow-scrolling:touch;font-family:", ";direction:", ";&.garden-drawer-transition-enter{transform:translateX(", "px);}&.garden-drawer-transition-enter-active{transform:translateX(0);transition:transform 0.25s ease-in-out;}&.garden-drawer-transition-exit-active{transform:translateX(", "px);transition:transform 0.25s ease-in-out;}&:focus{outline:none;}", " ", ";"], props => props.theme.rtl ? 'left' : 'right', props => props.theme.rtl ? 'border-right' : 'border-left', props => props.theme.borders.sm, DRAWER_WIDTH, props => props.theme.fonts.system, props => props.theme.rtl && 'rtl', props => props.theme.rtl ? -DRAWER_WIDTH : DRAWER_WIDTH, props => props.theme.rtl ? -DRAWER_WIDTH : DRAWER_WIDTH, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
40
|
+
StyledDrawer.defaultProps = {
|
|
41
|
+
theme: DEFAULT_THEME
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { StyledDrawer };
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledBody } from './StyledBody.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'modals.drawer_modal.body';
|
|
12
|
+
const StyledDrawerBody = styled(StyledBody).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.21'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledDrawerBody",
|
|
17
|
+
componentId: "sc-13qufyn-0"
|
|
18
|
+
})(["padding:", "px;color-scheme:only ", ";", ";"], props => props.theme.space.base * 5, p => p.theme.colors.base, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledDrawerBody.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledDrawerBody };
|
|
@@ -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 styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledClose, BASE_MULTIPLIERS as BASE_MULTIPLIERS$1 } from './StyledClose.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'modals.drawer_modal.close';
|
|
12
|
+
const BASE_MULTIPLIERS = {
|
|
13
|
+
top: BASE_MULTIPLIERS$1.top,
|
|
14
|
+
side: 2,
|
|
15
|
+
size: BASE_MULTIPLIERS$1.size
|
|
16
|
+
};
|
|
17
|
+
const StyledDrawerClose = styled(StyledClose).attrs({
|
|
18
|
+
'data-garden-id': COMPONENT_ID,
|
|
19
|
+
'data-garden-version': '9.0.0-next.21'
|
|
20
|
+
}).withConfig({
|
|
21
|
+
displayName: "StyledDrawerClose",
|
|
22
|
+
componentId: "sc-1a0xt3x-0"
|
|
23
|
+
})(["", ":", ";", ";"], props => props.theme.rtl ? 'left' : 'right', props => `${props.theme.space.base * BASE_MULTIPLIERS.side}px`, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
24
|
+
StyledDrawerClose.defaultProps = {
|
|
25
|
+
theme: DEFAULT_THEME
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { BASE_MULTIPLIERS, StyledDrawerClose };
|
|
@@ -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 styled from 'styled-components';
|
|
8
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'modals.drawer_modal.footer';
|
|
11
|
+
const StyledDrawerFooter = styled.div.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledDrawerFooter",
|
|
16
|
+
componentId: "sc-kc7e6p-0"
|
|
17
|
+
})(["display:flex;flex-shrink:0;justify-content:flex-end;border-top:", ";padding:", "px;", ";"], _ref => {
|
|
18
|
+
let {
|
|
19
|
+
theme
|
|
20
|
+
} = _ref;
|
|
21
|
+
return `${theme.borders.sm} ${getColor({
|
|
22
|
+
theme,
|
|
23
|
+
variable: 'border.subtle'
|
|
24
|
+
})}`;
|
|
25
|
+
}, props => props.theme.space.base * 5, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
26
|
+
StyledDrawerFooter.defaultProps = {
|
|
27
|
+
theme: DEFAULT_THEME
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { StyledDrawerFooter };
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledFooterItem } from './StyledFooterItem.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'modals.drawer_modal.footer_item';
|
|
12
|
+
const StyledDrawerFooterItem = styled(StyledFooterItem).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.21'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledDrawerFooterItem",
|
|
17
|
+
componentId: "sc-m2yul4-0"
|
|
18
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledDrawerFooterItem.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledDrawerFooterItem };
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledHeader } from './StyledHeader.js';
|
|
10
|
+
import { BASE_MULTIPLIERS } from './StyledDrawerClose.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'modals.drawer_modal.header';
|
|
13
|
+
const StyledDrawerHeader = styled(StyledHeader).attrs({
|
|
14
|
+
'data-garden-id': COMPONENT_ID,
|
|
15
|
+
'data-garden-version': '9.0.0-next.21'
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledDrawerHeader",
|
|
18
|
+
componentId: "sc-y4mgkj-0"
|
|
19
|
+
})(["padding:", "px;", " ", ";"], props => props.theme.space.base * 5, props => props.isCloseButtonPresent && `padding-${props.theme.rtl ? 'left' : 'right'}: ${props.theme.space.base * (BASE_MULTIPLIERS.size + BASE_MULTIPLIERS.side + 2)}px;`, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
+
StyledDrawerHeader.defaultProps = {
|
|
21
|
+
theme: DEFAULT_THEME
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledDrawerHeader };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'modals.footer';
|
|
11
|
+
const StyledFooter = styled.div.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledFooter",
|
|
16
|
+
componentId: "sc-d8pfdu-0"
|
|
17
|
+
})(["display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;border-top:", ";padding:", ";", ";"], props => props.isLarge && `${props.theme.borders.sm} ${getColorV8('neutralHue', 200, props.theme)}`, props => props.isLarge ? `${props.theme.space.base * 8}px ${props.theme.space.base * 10}px` : `${props.theme.space.base * 5}px ${props.theme.space.base * 10}px ${props.theme.space.base * 8}px`, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledFooter.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledFooter };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'modals.footer_item';
|
|
11
|
+
const StyledFooterItem = styled.span.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledFooterItem",
|
|
16
|
+
componentId: "sc-1mb76hl-0"
|
|
17
|
+
})(["display:flex;margin-", ":", "px;min-width:0;&:first-child{margin-", ":0;}", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 5, props => props.theme.rtl ? 'right' : 'left', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledFooterItem.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledFooterItem };
|
|
@@ -0,0 +1,38 @@
|
|
|
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, retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { BASE_MULTIPLIERS } from './StyledClose.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'modals.header';
|
|
12
|
+
const colorStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
isDanger,
|
|
15
|
+
theme
|
|
16
|
+
} = _ref;
|
|
17
|
+
const bottomBorderColor = getColor({
|
|
18
|
+
theme,
|
|
19
|
+
variable: 'border.subtle'
|
|
20
|
+
});
|
|
21
|
+
const color = getColor({
|
|
22
|
+
theme,
|
|
23
|
+
variable: isDanger ? 'foreground.danger' : 'foreground.default'
|
|
24
|
+
});
|
|
25
|
+
return css(["border-bottom-color:", ";color:", ";"], bottomBorderColor, color);
|
|
26
|
+
};
|
|
27
|
+
const StyledHeader = styled.div.attrs({
|
|
28
|
+
'data-garden-id': COMPONENT_ID,
|
|
29
|
+
'data-garden-version': '9.0.0-next.21'
|
|
30
|
+
}).withConfig({
|
|
31
|
+
displayName: "StyledHeader",
|
|
32
|
+
componentId: "sc-1787r9v-0"
|
|
33
|
+
})(["display:block;position:", ";margin:0;border-bottom:", ";padding:", ";", " line-height:", ";font-size:", ";font-weight:", ";", ";", ";"], props => props.isDanger && 'relative', props => props.theme.borders.sm, props => `${props.theme.space.base * 5}px ${props.theme.space.base * 10}px`, props => props.isCloseButtonPresent && `padding-${props.theme.rtl ? 'left' : 'right'}: ${props.theme.space.base * (BASE_MULTIPLIERS.size + BASE_MULTIPLIERS.side + 2)}px;`, props => getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md), props => props.theme.fontSizes.md, props => props.theme.fontWeights.semibold, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
34
|
+
StyledHeader.defaultProps = {
|
|
35
|
+
theme: DEFAULT_THEME
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { StyledHeader };
|