@zendeskgarden/react-modals 9.0.0-next.0 → 9.0.0-next.2
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 +58 -0
- package/dist/index.cjs.js +108 -153
- package/dist/index.esm.js +109 -154
- package/dist/typings/elements/{DrawerModal/DrawerModal.d.ts → Drawer/Drawer.d.ts} +2 -2
- package/dist/typings/elements/{DrawerModal → Drawer}/Header.d.ts +2 -2
- package/dist/typings/index.d.ts +2 -2
- package/dist/typings/styled/{StyledDrawerModal.d.ts → StyledDrawer.d.ts} +1 -1
- package/dist/typings/styled/{StyledDrawerModalBody.d.ts → StyledDrawerBody.d.ts} +1 -1
- package/dist/typings/styled/{StyledDrawerModalClose.d.ts → StyledDrawerClose.d.ts} +1 -1
- package/dist/typings/styled/{StyledDrawerModalFooterItem.d.ts → StyledDrawerFooter.d.ts} +1 -1
- package/dist/typings/styled/{StyledDrawerModalFooter.d.ts → StyledDrawerFooterItem.d.ts} +1 -1
- package/dist/typings/styled/{StyledDrawerModalHeader.d.ts → StyledDrawerHeader.d.ts} +1 -1
- package/dist/typings/styled/StyledTooltipModal.d.ts +1 -1
- package/dist/typings/styled/StyledTooltipWrapper.d.ts +2 -2
- package/dist/typings/styled/index.d.ts +6 -6
- package/dist/typings/types/index.d.ts +2 -7
- package/package.json +5 -6
- package/dist/typings/utils/gardenPlacements.d.ts +0 -28
- /package/dist/typings/elements/{DrawerModal → Drawer}/Body.d.ts +0 -0
- /package/dist/typings/elements/{DrawerModal → Drawer}/Close.d.ts +0 -0
- /package/dist/typings/elements/{DrawerModal → Drawer}/Footer.d.ts +0 -0
- /package/dist/typings/elements/{DrawerModal → Drawer}/FooterItem.d.ts +0 -0
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ npm install react react-dom styled-components @zendeskgarden/react-theming
|
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
|
+
### Modal
|
|
18
|
+
|
|
17
19
|
```jsx
|
|
18
20
|
import { ThemeProvider } from '@zendeskgarden/react-theming';
|
|
19
21
|
import { Modal, Header, Body, Footer, FooterItem, Close } from '@zendeskgarden/react-modals';
|
|
@@ -38,3 +40,59 @@ import { Button } from '@zendeskgarden/react-buttons';
|
|
|
38
40
|
</Modal>
|
|
39
41
|
</ThemeProvider>;
|
|
40
42
|
```
|
|
43
|
+
|
|
44
|
+
### Drawer
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
import { ThemeProvider } from '@zendeskgarden/react-theming';
|
|
48
|
+
import { Drawer } from '@zendeskgarden/react-modals';
|
|
49
|
+
import { Button } from '@zendeskgarden/react-buttons';
|
|
50
|
+
|
|
51
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
52
|
+
|
|
53
|
+
<ThemeProvider>
|
|
54
|
+
<Button onClick={() => setIsOpen(true)}>
|
|
55
|
+
Open
|
|
56
|
+
</Button>
|
|
57
|
+
<Drawer isOpen={state.isOpen} onClose={() => setIsOpen(false)}>
|
|
58
|
+
<Drawer.Header>Example Title</Drawer.Header>
|
|
59
|
+
<Drawer.Body>Some content</Drawer.Body>
|
|
60
|
+
<Drawer.Footer>
|
|
61
|
+
<Drawer.FooterItem>
|
|
62
|
+
<Button>Click</Button>
|
|
63
|
+
</Drawer.FooterItem>
|
|
64
|
+
</Drawer.Footer>
|
|
65
|
+
<Drawer.Close aria-Label="Close" />
|
|
66
|
+
</Drawer>
|
|
67
|
+
</ThemeProvider>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### TooltipModal
|
|
71
|
+
|
|
72
|
+
```jsx
|
|
73
|
+
import { ThemeProvider } from '@zendeskgarden/react-theming';
|
|
74
|
+
import { TooltipModal } from '@zendeskgarden/react-modals';
|
|
75
|
+
import { Button } from '@zendeskgarden/react-buttons';
|
|
76
|
+
|
|
77
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
78
|
+
const buttonRef = useRef(null);
|
|
79
|
+
|
|
80
|
+
<ThemeProvider>
|
|
81
|
+
<Button ref={buttonRef} onClick={() => setIsOpen(!isOpen)}>
|
|
82
|
+
Open
|
|
83
|
+
</Button>
|
|
84
|
+
<TooltipModal
|
|
85
|
+
onClose={() => setIsOpen(false)}
|
|
86
|
+
referenceElement={isOpen && buttonRef.current ? buttonRef.current : undefined}
|
|
87
|
+
>
|
|
88
|
+
<TooltipModal.Title>Example Title</TooltipModal.Title>
|
|
89
|
+
<TooltipModal.Body>Some content</TooltipModal.Body>
|
|
90
|
+
<TooltipModal.Footer>
|
|
91
|
+
<TooltipModal.FooterItem>
|
|
92
|
+
<Button>Click</Button>
|
|
93
|
+
</TooltipModal.FooterItem>
|
|
94
|
+
</TooltipModal.Footer>
|
|
95
|
+
<TooltipModal.Close aria-label="Close" />
|
|
96
|
+
</TooltipModal>
|
|
97
|
+
</ThemeProvider>;
|
|
98
|
+
```
|
package/dist/index.cjs.js
CHANGED
|
@@ -20,8 +20,8 @@ var ownerDocument = require('dom-helpers/ownerDocument');
|
|
|
20
20
|
var ownerWindow = require('dom-helpers/ownerWindow');
|
|
21
21
|
var css = require('dom-helpers/css');
|
|
22
22
|
var getScrollbarSize = require('dom-helpers/scrollbarSize');
|
|
23
|
-
var reactPopper = require('react-popper');
|
|
24
23
|
var reactTransitionGroup = require('react-transition-group');
|
|
24
|
+
var reactDom = require('@floating-ui/react-dom');
|
|
25
25
|
var activeElement = require('dom-helpers/activeElement');
|
|
26
26
|
|
|
27
27
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -80,7 +80,7 @@ const animationStyles$1 = props => {
|
|
|
80
80
|
};
|
|
81
81
|
const StyledBackdrop = styled__default.default.div.attrs({
|
|
82
82
|
'data-garden-id': COMPONENT_ID$j,
|
|
83
|
-
'data-garden-version': '9.0.0-next.
|
|
83
|
+
'data-garden-version': '9.0.0-next.2'
|
|
84
84
|
}).withConfig({
|
|
85
85
|
displayName: "StyledBackdrop",
|
|
86
86
|
componentId: "sc-mzdjpo-0"
|
|
@@ -96,7 +96,7 @@ StyledBackdrop.propTypes = {
|
|
|
96
96
|
const COMPONENT_ID$i = 'modals.body';
|
|
97
97
|
const StyledBody = styled__default.default.div.attrs({
|
|
98
98
|
'data-garden-id': COMPONENT_ID$i,
|
|
99
|
-
'data-garden-version': '9.0.0-next.
|
|
99
|
+
'data-garden-version': '9.0.0-next.2'
|
|
100
100
|
}).withConfig({
|
|
101
101
|
displayName: "StyledBody",
|
|
102
102
|
componentId: "sc-14rzecg-0"
|
|
@@ -121,7 +121,7 @@ const BASE_MULTIPLIERS$1 = {
|
|
|
121
121
|
};
|
|
122
122
|
const StyledClose = styled__default.default.button.attrs({
|
|
123
123
|
'data-garden-id': COMPONENT_ID$h,
|
|
124
|
-
'data-garden-version': '9.0.0-next.
|
|
124
|
+
'data-garden-version': '9.0.0-next.2'
|
|
125
125
|
}).withConfig({
|
|
126
126
|
displayName: "StyledClose",
|
|
127
127
|
componentId: "sc-iseudj-0"
|
|
@@ -133,7 +133,7 @@ StyledClose.defaultProps = {
|
|
|
133
133
|
const COMPONENT_ID$g = 'modals.footer';
|
|
134
134
|
const StyledFooter = styled__default.default.div.attrs({
|
|
135
135
|
'data-garden-id': COMPONENT_ID$g,
|
|
136
|
-
'data-garden-version': '9.0.0-next.
|
|
136
|
+
'data-garden-version': '9.0.0-next.2'
|
|
137
137
|
}).withConfig({
|
|
138
138
|
displayName: "StyledFooter",
|
|
139
139
|
componentId: "sc-d8pfdu-0"
|
|
@@ -145,7 +145,7 @@ StyledFooter.defaultProps = {
|
|
|
145
145
|
const COMPONENT_ID$f = 'modals.footer_item';
|
|
146
146
|
const StyledFooterItem = styled__default.default.span.attrs({
|
|
147
147
|
'data-garden-id': COMPONENT_ID$f,
|
|
148
|
-
'data-garden-version': '9.0.0-next.
|
|
148
|
+
'data-garden-version': '9.0.0-next.2'
|
|
149
149
|
}).withConfig({
|
|
150
150
|
displayName: "StyledFooterItem",
|
|
151
151
|
componentId: "sc-1mb76hl-0"
|
|
@@ -157,7 +157,7 @@ StyledFooterItem.defaultProps = {
|
|
|
157
157
|
const COMPONENT_ID$e = 'modals.header';
|
|
158
158
|
const StyledHeader = styled__default.default.div.attrs({
|
|
159
159
|
'data-garden-id': COMPONENT_ID$e,
|
|
160
|
-
'data-garden-version': '9.0.0-next.
|
|
160
|
+
'data-garden-version': '9.0.0-next.2'
|
|
161
161
|
}).withConfig({
|
|
162
162
|
displayName: "StyledHeader",
|
|
163
163
|
componentId: "sc-1787r9v-0"
|
|
@@ -228,7 +228,7 @@ const sizeStyles$1 = props => {
|
|
|
228
228
|
};
|
|
229
229
|
const StyledModal = styled__default.default.div.attrs({
|
|
230
230
|
'data-garden-id': COMPONENT_ID$d,
|
|
231
|
-
'data-garden-version': '9.0.0-next.
|
|
231
|
+
'data-garden-version': '9.0.0-next.2'
|
|
232
232
|
}).withConfig({
|
|
233
233
|
displayName: "StyledModal",
|
|
234
234
|
componentId: "sc-1pe1axu-0"
|
|
@@ -244,7 +244,7 @@ StyledModal.defaultProps = {
|
|
|
244
244
|
const COMPONENT_ID$c = 'modals.tooltip_modal.backdrop';
|
|
245
245
|
const StyledTooltipModalBackdrop = styled__default.default.div.attrs({
|
|
246
246
|
'data-garden-id': COMPONENT_ID$c,
|
|
247
|
-
'data-garden-version': '9.0.0-next.
|
|
247
|
+
'data-garden-version': '9.0.0-next.2'
|
|
248
248
|
}).withConfig({
|
|
249
249
|
displayName: "StyledTooltipModalBackdrop",
|
|
250
250
|
componentId: "sc-1yaomgq-0"
|
|
@@ -253,70 +253,14 @@ StyledTooltipModalBackdrop.defaultProps = {
|
|
|
253
253
|
theme: reactTheming.DEFAULT_THEME
|
|
254
254
|
};
|
|
255
255
|
|
|
256
|
-
function getPopperPlacement(gardenPlacement) {
|
|
257
|
-
const gardenToPopperMapping = {
|
|
258
|
-
auto: 'auto',
|
|
259
|
-
top: 'top',
|
|
260
|
-
'top-start': 'top-start',
|
|
261
|
-
'top-end': 'top-end',
|
|
262
|
-
bottom: 'bottom',
|
|
263
|
-
'bottom-start': 'bottom-start',
|
|
264
|
-
'bottom-end': 'bottom-end',
|
|
265
|
-
end: 'right',
|
|
266
|
-
'end-top': 'right-start',
|
|
267
|
-
'end-bottom': 'right-end',
|
|
268
|
-
start: 'left',
|
|
269
|
-
'start-top': 'left-start',
|
|
270
|
-
'start-bottom': 'left-end'
|
|
271
|
-
};
|
|
272
|
-
return gardenToPopperMapping[gardenPlacement];
|
|
273
|
-
}
|
|
274
|
-
function getRtlPopperPlacement(gardenPlacement) {
|
|
275
|
-
const rtlPlacementMappings = {
|
|
276
|
-
left: 'right',
|
|
277
|
-
'left-start': 'right-start',
|
|
278
|
-
'left-end': 'right-end',
|
|
279
|
-
'top-start': 'top-end',
|
|
280
|
-
'top-end': 'top-start',
|
|
281
|
-
right: 'left',
|
|
282
|
-
'right-start': 'left-start',
|
|
283
|
-
'right-end': 'left-end',
|
|
284
|
-
'bottom-start': 'bottom-end',
|
|
285
|
-
'bottom-end': 'bottom-start'
|
|
286
|
-
};
|
|
287
|
-
const popperPlacement = getPopperPlacement(gardenPlacement);
|
|
288
|
-
return rtlPlacementMappings[popperPlacement] || popperPlacement;
|
|
289
|
-
}
|
|
290
|
-
function getArrowPosition(popperPlacement) {
|
|
291
|
-
const arrowPositionMappings = {
|
|
292
|
-
top: 'bottom',
|
|
293
|
-
'top-start': 'bottom-left',
|
|
294
|
-
'top-end': 'bottom-right',
|
|
295
|
-
right: 'left',
|
|
296
|
-
'right-start': 'left-top',
|
|
297
|
-
'right-end': 'left-bottom',
|
|
298
|
-
bottom: 'top',
|
|
299
|
-
'bottom-start': 'top-left',
|
|
300
|
-
'bottom-end': 'top-right',
|
|
301
|
-
left: 'right',
|
|
302
|
-
'left-start': 'right-top',
|
|
303
|
-
'left-end': 'right-bottom'
|
|
304
|
-
};
|
|
305
|
-
return arrowPositionMappings[popperPlacement] || 'top';
|
|
306
|
-
}
|
|
307
|
-
function getMenuPosition(popperPlacement) {
|
|
308
|
-
return popperPlacement ? popperPlacement.split('-')[0] : 'bottom';
|
|
309
|
-
}
|
|
310
|
-
|
|
311
256
|
const StyledTooltipWrapper = styled__default.default.div.attrs(props => ({
|
|
312
257
|
className: props.isAnimated && 'is-animated'
|
|
313
258
|
})).withConfig({
|
|
314
259
|
displayName: "StyledTooltipWrapper",
|
|
315
260
|
componentId: "sc-1xk05kf-0"
|
|
316
|
-
})(["", ";"], props => reactTheming.menuStyles(getMenuPosition(props.placement), {
|
|
261
|
+
})(["top:0;left:0;", ";"], props => reactTheming.menuStyles(reactTheming.getMenuPosition(props.placement), {
|
|
317
262
|
theme: props.theme,
|
|
318
263
|
hidden: false,
|
|
319
|
-
margin: '0',
|
|
320
264
|
zIndex: props.zIndex,
|
|
321
265
|
animationModifier: '.is-animated'
|
|
322
266
|
}));
|
|
@@ -327,13 +271,13 @@ StyledTooltipWrapper.defaultProps = {
|
|
|
327
271
|
const COMPONENT_ID$b = 'modals.tooltip_modal';
|
|
328
272
|
const StyledTooltipModal = styled__default.default.div.attrs(props => ({
|
|
329
273
|
'data-garden-id': COMPONENT_ID$b,
|
|
330
|
-
'data-garden-version': '9.0.0-next.
|
|
274
|
+
'data-garden-version': '9.0.0-next.2',
|
|
331
275
|
className: props.isAnimated && 'is-animated'
|
|
332
276
|
})).withConfig({
|
|
333
277
|
displayName: "StyledTooltipModal",
|
|
334
278
|
componentId: "sc-42ubfr-0"
|
|
335
279
|
})(["padding:", "px;width:400px;", ";", ";"], props => props.theme.space.base * 5, props => {
|
|
336
|
-
const computedArrowStyles = reactTheming.arrowStyles(getArrowPosition(props.placement), {
|
|
280
|
+
const computedArrowStyles = reactTheming.arrowStyles(reactTheming.getArrowPosition(props.theme, props.placement), {
|
|
337
281
|
size: `${props.theme.space.base * 2}px`,
|
|
338
282
|
inset: '1px',
|
|
339
283
|
animationModifier: '.is-animated'
|
|
@@ -356,7 +300,7 @@ const sizeStyles = props => `
|
|
|
356
300
|
`;
|
|
357
301
|
const StyledTooltipModalTitle = styled__default.default.div.attrs({
|
|
358
302
|
'data-garden-id': COMPONENT_ID$a,
|
|
359
|
-
'data-garden-version': '9.0.0-next.
|
|
303
|
+
'data-garden-version': '9.0.0-next.2'
|
|
360
304
|
}).withConfig({
|
|
361
305
|
displayName: "StyledTooltipModalTitle",
|
|
362
306
|
componentId: "sc-11xjgjs-0"
|
|
@@ -368,7 +312,7 @@ StyledTooltipModalTitle.defaultProps = {
|
|
|
368
312
|
const COMPONENT_ID$9 = 'modals.tooltip_modal.body';
|
|
369
313
|
const StyledTooltipModalBody = styled__default.default.div.attrs({
|
|
370
314
|
'data-garden-id': COMPONENT_ID$9,
|
|
371
|
-
'data-garden-version': '9.0.0-next.
|
|
315
|
+
'data-garden-version': '9.0.0-next.2'
|
|
372
316
|
}).withConfig({
|
|
373
317
|
displayName: "StyledTooltipModalBody",
|
|
374
318
|
componentId: "sc-195dkzj-0"
|
|
@@ -380,7 +324,7 @@ StyledTooltipModalBody.defaultProps = {
|
|
|
380
324
|
const COMPONENT_ID$8 = 'modals.tooltip_modal.footer';
|
|
381
325
|
const StyledTooltipModalFooter = styled__default.default.div.attrs({
|
|
382
326
|
'data-garden-id': COMPONENT_ID$8,
|
|
383
|
-
'data-garden-version': '9.0.0-next.
|
|
327
|
+
'data-garden-version': '9.0.0-next.2'
|
|
384
328
|
}).withConfig({
|
|
385
329
|
displayName: "StyledTooltipModalFooter",
|
|
386
330
|
componentId: "sc-fm36a9-0"
|
|
@@ -392,7 +336,7 @@ StyledTooltipModalFooter.defaultProps = {
|
|
|
392
336
|
const COMPONENT_ID$7 = 'modals.tooltip_modal.footer_item';
|
|
393
337
|
const StyledTooltipModalFooterItem = styled__default.default(StyledFooterItem).attrs({
|
|
394
338
|
'data-garden-id': COMPONENT_ID$7,
|
|
395
|
-
'data-garden-version': '9.0.0-next.
|
|
339
|
+
'data-garden-version': '9.0.0-next.2'
|
|
396
340
|
}).withConfig({
|
|
397
341
|
displayName: "StyledTooltipModalFooterItem",
|
|
398
342
|
componentId: "sc-1nahj6p-0"
|
|
@@ -404,7 +348,7 @@ StyledTooltipModalFooterItem.defaultProps = {
|
|
|
404
348
|
const COMPONENT_ID$6 = 'modals.tooltip_modal.close';
|
|
405
349
|
const StyledTooltipModalClose = styled__default.default(StyledClose).attrs({
|
|
406
350
|
'data-garden-id': COMPONENT_ID$6,
|
|
407
|
-
'data-garden-version': '9.0.0-next.
|
|
351
|
+
'data-garden-version': '9.0.0-next.2'
|
|
408
352
|
}).withConfig({
|
|
409
353
|
displayName: "StyledTooltipModalClose",
|
|
410
354
|
componentId: "sc-1h2ke3q-0"
|
|
@@ -428,14 +372,14 @@ const boxShadow = props => {
|
|
|
428
372
|
const color = reactTheming.getColor('neutralHue', 800, theme, 0.35);
|
|
429
373
|
return shadows.lg(offsetY, blurRadius, color);
|
|
430
374
|
};
|
|
431
|
-
const
|
|
375
|
+
const StyledDrawer = styled__default.default.div.attrs({
|
|
432
376
|
'data-garden-id': COMPONENT_ID$5,
|
|
433
|
-
'data-garden-version': '9.0.0-next.
|
|
377
|
+
'data-garden-version': '9.0.0-next.2'
|
|
434
378
|
}).withConfig({
|
|
435
|
-
displayName: "
|
|
436
|
-
componentId: "sc-
|
|
379
|
+
displayName: "StyledDrawer",
|
|
380
|
+
componentId: "sc-zp66t3-0"
|
|
437
381
|
})(["display:flex;position:fixed;top:0;", ":0;flex-direction:column;z-index:500;box-shadow:", ";background:", ";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', boxShadow, props => props.theme.colors.background, 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, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
438
|
-
|
|
382
|
+
StyledDrawer.defaultProps = {
|
|
439
383
|
theme: reactTheming.DEFAULT_THEME
|
|
440
384
|
};
|
|
441
385
|
|
|
@@ -445,62 +389,62 @@ const BASE_MULTIPLIERS = {
|
|
|
445
389
|
side: 2,
|
|
446
390
|
size: BASE_MULTIPLIERS$1.size
|
|
447
391
|
};
|
|
448
|
-
const
|
|
392
|
+
const StyledDrawerClose = styled__default.default(StyledClose).attrs({
|
|
449
393
|
'data-garden-id': COMPONENT_ID$4,
|
|
450
|
-
'data-garden-version': '9.0.0-next.
|
|
394
|
+
'data-garden-version': '9.0.0-next.2'
|
|
451
395
|
}).withConfig({
|
|
452
|
-
displayName: "
|
|
453
|
-
componentId: "sc-
|
|
396
|
+
displayName: "StyledDrawerClose",
|
|
397
|
+
componentId: "sc-1a0xt3x-0"
|
|
454
398
|
})(["", ":", ";", ";"], props => props.theme.rtl ? 'left' : 'right', props => `${props.theme.space.base * BASE_MULTIPLIERS.side}px`, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
455
|
-
|
|
399
|
+
StyledDrawerClose.defaultProps = {
|
|
456
400
|
theme: reactTheming.DEFAULT_THEME
|
|
457
401
|
};
|
|
458
402
|
|
|
459
403
|
const COMPONENT_ID$3 = 'modals.drawer_modal.header';
|
|
460
|
-
const
|
|
404
|
+
const StyledDrawerHeader = styled__default.default(StyledHeader).attrs({
|
|
461
405
|
'data-garden-id': COMPONENT_ID$3,
|
|
462
|
-
'data-garden-version': '9.0.0-next.
|
|
406
|
+
'data-garden-version': '9.0.0-next.2'
|
|
463
407
|
}).withConfig({
|
|
464
|
-
displayName: "
|
|
465
|
-
componentId: "sc-
|
|
408
|
+
displayName: "StyledDrawerHeader",
|
|
409
|
+
componentId: "sc-y4mgkj-0"
|
|
466
410
|
})(["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 => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
467
|
-
|
|
411
|
+
StyledDrawerHeader.defaultProps = {
|
|
468
412
|
theme: reactTheming.DEFAULT_THEME
|
|
469
413
|
};
|
|
470
414
|
|
|
471
415
|
const COMPONENT_ID$2 = 'modals.drawer_modal.body';
|
|
472
|
-
const
|
|
416
|
+
const StyledDrawerBody = styled__default.default(StyledBody).attrs({
|
|
473
417
|
'data-garden-id': COMPONENT_ID$2,
|
|
474
|
-
'data-garden-version': '9.0.0-next.
|
|
418
|
+
'data-garden-version': '9.0.0-next.2'
|
|
475
419
|
}).withConfig({
|
|
476
|
-
displayName: "
|
|
477
|
-
componentId: "sc-
|
|
420
|
+
displayName: "StyledDrawerBody",
|
|
421
|
+
componentId: "sc-13qufyn-0"
|
|
478
422
|
})(["padding:", "px;", ";"], props => props.theme.space.base * 5, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
479
|
-
|
|
423
|
+
StyledDrawerBody.defaultProps = {
|
|
480
424
|
theme: reactTheming.DEFAULT_THEME
|
|
481
425
|
};
|
|
482
426
|
|
|
483
427
|
const COMPONENT_ID$1 = 'modals.drawer_modal.footer';
|
|
484
|
-
const
|
|
428
|
+
const StyledDrawerFooter = styled__default.default.div.attrs({
|
|
485
429
|
'data-garden-id': COMPONENT_ID$1,
|
|
486
|
-
'data-garden-version': '9.0.0-next.
|
|
430
|
+
'data-garden-version': '9.0.0-next.2'
|
|
487
431
|
}).withConfig({
|
|
488
|
-
displayName: "
|
|
489
|
-
componentId: "sc-
|
|
432
|
+
displayName: "StyledDrawerFooter",
|
|
433
|
+
componentId: "sc-kc7e6p-0"
|
|
490
434
|
})(["display:flex;flex-shrink:0;justify-content:flex-end;border-top:", ";padding:", "px;", ";"], props => `${props.theme.borders.sm} ${reactTheming.getColor('neutralHue', 200, props.theme)}`, props => props.theme.space.base * 5, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
491
|
-
|
|
435
|
+
StyledDrawerFooter.defaultProps = {
|
|
492
436
|
theme: reactTheming.DEFAULT_THEME
|
|
493
437
|
};
|
|
494
438
|
|
|
495
439
|
const COMPONENT_ID = 'modals.drawer_modal.footer_item';
|
|
496
|
-
const
|
|
440
|
+
const StyledDrawerFooterItem = styled__default.default(StyledFooterItem).attrs({
|
|
497
441
|
'data-garden-id': COMPONENT_ID,
|
|
498
|
-
'data-garden-version': '9.0.0-next.
|
|
442
|
+
'data-garden-version': '9.0.0-next.2'
|
|
499
443
|
}).withConfig({
|
|
500
|
-
displayName: "
|
|
501
|
-
componentId: "sc-
|
|
444
|
+
displayName: "StyledDrawerFooterItem",
|
|
445
|
+
componentId: "sc-m2yul4-0"
|
|
502
446
|
})(["", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
503
|
-
|
|
447
|
+
StyledDrawerFooterItem.defaultProps = {
|
|
504
448
|
theme: reactTheming.DEFAULT_THEME
|
|
505
449
|
};
|
|
506
450
|
|
|
@@ -835,12 +779,12 @@ const FooterItemComponent$1 = React.forwardRef((props, ref) => React__namespace.
|
|
|
835
779
|
FooterItemComponent$1.displayName = 'TooltipModal.FooterItem';
|
|
836
780
|
const FooterItem$1 = FooterItemComponent$1;
|
|
837
781
|
|
|
782
|
+
const PLACEMENT_DEFAULT = 'top';
|
|
838
783
|
const TooltipModalComponent = React__namespace.default.forwardRef((_ref, ref) => {
|
|
839
784
|
let {
|
|
840
785
|
appendToNode,
|
|
841
786
|
referenceElement,
|
|
842
|
-
|
|
843
|
-
placement,
|
|
787
|
+
placement: _placement,
|
|
844
788
|
onClose,
|
|
845
789
|
hasArrow,
|
|
846
790
|
isAnimated,
|
|
@@ -851,11 +795,11 @@ const TooltipModalComponent = React__namespace.default.forwardRef((_ref, ref) =>
|
|
|
851
795
|
id,
|
|
852
796
|
...props
|
|
853
797
|
} = _ref;
|
|
854
|
-
const theme = React.useContext(styled.ThemeContext);
|
|
798
|
+
const theme = React.useContext(styled.ThemeContext) || reactTheming.DEFAULT_THEME;
|
|
855
799
|
const previousReferenceElementRef = React.useRef();
|
|
856
800
|
const modalRef = React.useRef(null);
|
|
857
801
|
const transitionRef = React.useRef(null);
|
|
858
|
-
const [
|
|
802
|
+
const [floatingElement, setFloatingElement] = React.useState();
|
|
859
803
|
const [hasTitle, setHasTitle] = React.useState(false);
|
|
860
804
|
const {
|
|
861
805
|
getTitleProps,
|
|
@@ -870,27 +814,37 @@ const TooltipModalComponent = React__namespace.default.forwardRef((_ref, ref) =>
|
|
|
870
814
|
focusOnMount,
|
|
871
815
|
restoreFocus: false
|
|
872
816
|
});
|
|
817
|
+
const [floatingPlacement] = reactTheming.getFloatingPlacements(theme, _placement === 'auto' ? PLACEMENT_DEFAULT : _placement);
|
|
818
|
+
const {
|
|
819
|
+
refs,
|
|
820
|
+
placement,
|
|
821
|
+
update,
|
|
822
|
+
floatingStyles: {
|
|
823
|
+
transform
|
|
824
|
+
}
|
|
825
|
+
} = reactDom.useFloating({
|
|
826
|
+
elements: {
|
|
827
|
+
reference: referenceElement,
|
|
828
|
+
floating: floatingElement
|
|
829
|
+
},
|
|
830
|
+
placement: floatingPlacement,
|
|
831
|
+
middleware: [reactDom.offset(theme.space.base * 3), _placement === 'auto' ? reactDom.autoPlacement() : undefined]
|
|
832
|
+
});
|
|
833
|
+
React.useEffect(() => {
|
|
834
|
+
let cleanup;
|
|
835
|
+
if (referenceElement && floatingElement && refs.reference.current && refs.floating.current) {
|
|
836
|
+
cleanup = reactDom.autoUpdate(refs.reference.current, refs.floating.current, update, {
|
|
837
|
+
elementResize: typeof ResizeObserver === 'function'
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
return () => cleanup && cleanup();
|
|
841
|
+
}, [referenceElement, floatingElement, refs.reference, refs.floating, update]);
|
|
873
842
|
React.useEffect(() => {
|
|
874
843
|
if (!referenceElement && previousReferenceElementRef.current && restoreFocus) {
|
|
875
844
|
previousReferenceElementRef.current.focus();
|
|
876
845
|
}
|
|
877
846
|
previousReferenceElementRef.current = referenceElement;
|
|
878
847
|
}, [referenceElement, restoreFocus]);
|
|
879
|
-
const popperPlacement = React.useMemo(() => theme.rtl ? getRtlPopperPlacement(placement) : getPopperPlacement(placement), [placement, theme.rtl]);
|
|
880
|
-
const {
|
|
881
|
-
styles,
|
|
882
|
-
attributes,
|
|
883
|
-
state
|
|
884
|
-
} = reactPopper.usePopper(referenceElement, popperElement, {
|
|
885
|
-
placement: popperPlacement,
|
|
886
|
-
modifiers: [{
|
|
887
|
-
name: 'offset',
|
|
888
|
-
options: {
|
|
889
|
-
offset: [0, theme.space.base * 3]
|
|
890
|
-
}
|
|
891
|
-
},
|
|
892
|
-
...(popperModifiers || [])]
|
|
893
|
-
});
|
|
894
848
|
const modalProps = getModalProps({
|
|
895
849
|
'aria-describedby': undefined,
|
|
896
850
|
...(hasTitle ? {} : {
|
|
@@ -923,15 +877,17 @@ const TooltipModalComponent = React__namespace.default.forwardRef((_ref, ref) =>
|
|
|
923
877
|
value: value
|
|
924
878
|
}, React__namespace.default.createElement(StyledTooltipModalBackdrop, _extends$2({}, getBackdropProps(), backdropProps, {
|
|
925
879
|
ref: transitionRef
|
|
926
|
-
}), React__namespace.default.createElement(StyledTooltipWrapper,
|
|
927
|
-
ref:
|
|
928
|
-
style:
|
|
929
|
-
|
|
880
|
+
}), React__namespace.default.createElement(StyledTooltipWrapper, {
|
|
881
|
+
ref: setFloatingElement,
|
|
882
|
+
style: {
|
|
883
|
+
transform
|
|
884
|
+
},
|
|
885
|
+
placement: placement,
|
|
930
886
|
zIndex: zIndex,
|
|
931
887
|
isAnimated: isAnimated
|
|
932
|
-
},
|
|
888
|
+
}, React__namespace.default.createElement(StyledTooltipModal, _extends$2({
|
|
933
889
|
transitionState: transitionState,
|
|
934
|
-
placement:
|
|
890
|
+
placement: placement,
|
|
935
891
|
hasArrow: hasArrow,
|
|
936
892
|
isAnimated: isAnimated
|
|
937
893
|
}, modalProps, ariaProps, props, {
|
|
@@ -950,7 +906,6 @@ TooltipModalComponent.defaultProps = {
|
|
|
950
906
|
TooltipModalComponent.propTypes = {
|
|
951
907
|
appendToNode: PropTypes__default.default.any,
|
|
952
908
|
referenceElement: PropTypes__default.default.any,
|
|
953
|
-
popperModifiers: PropTypes__default.default.any,
|
|
954
909
|
placement: PropTypes__default.default.any,
|
|
955
910
|
isAnimated: PropTypes__default.default.bool,
|
|
956
911
|
hasArrow: PropTypes__default.default.bool,
|
|
@@ -988,13 +943,13 @@ const HeaderComponent = React.forwardRef((_ref, ref) => {
|
|
|
988
943
|
}
|
|
989
944
|
};
|
|
990
945
|
}, [hasHeader, setHasHeader]);
|
|
991
|
-
return React__namespace.default.createElement(
|
|
946
|
+
return React__namespace.default.createElement(StyledDrawerHeader, _extends$2({}, getTitleProps(other), {
|
|
992
947
|
as: tag,
|
|
993
948
|
isCloseButtonPresent: isCloseButtonPresent,
|
|
994
949
|
ref: ref
|
|
995
950
|
}));
|
|
996
951
|
});
|
|
997
|
-
HeaderComponent.displayName = '
|
|
952
|
+
HeaderComponent.displayName = 'Drawer.Header';
|
|
998
953
|
HeaderComponent.propTypes = {
|
|
999
954
|
tag: PropTypes__default.default.any
|
|
1000
955
|
};
|
|
@@ -1007,11 +962,11 @@ const BodyComponent = React.forwardRef((props, ref) => {
|
|
|
1007
962
|
const {
|
|
1008
963
|
getContentProps
|
|
1009
964
|
} = useModalContext();
|
|
1010
|
-
return React__namespace.default.createElement(
|
|
965
|
+
return React__namespace.default.createElement(StyledDrawerBody, _extends$2({}, getContentProps(props), {
|
|
1011
966
|
ref: ref
|
|
1012
967
|
}), props.children);
|
|
1013
968
|
});
|
|
1014
|
-
BodyComponent.displayName = '
|
|
969
|
+
BodyComponent.displayName = 'Drawer.Body';
|
|
1015
970
|
const Body = BodyComponent;
|
|
1016
971
|
|
|
1017
972
|
const CloseComponent = React.forwardRef((props, ref) => {
|
|
@@ -1024,29 +979,29 @@ const CloseComponent = React.forwardRef((props, ref) => {
|
|
|
1024
979
|
return () => setIsCloseButtonPresent(false);
|
|
1025
980
|
});
|
|
1026
981
|
const ariaLabel = reactTheming.useText(CloseComponent, props, 'aria-label', 'Close drawer');
|
|
1027
|
-
return React__namespace.default.createElement(
|
|
982
|
+
return React__namespace.default.createElement(StyledDrawerClose, _extends$2({}, getCloseProps({
|
|
1028
983
|
...props,
|
|
1029
984
|
'aria-label': ariaLabel
|
|
1030
985
|
}), {
|
|
1031
986
|
ref: ref
|
|
1032
987
|
}), React__namespace.default.createElement(SvgXStroke, null));
|
|
1033
988
|
});
|
|
1034
|
-
CloseComponent.displayName = '
|
|
989
|
+
CloseComponent.displayName = 'Drawer.Close';
|
|
1035
990
|
const Close = CloseComponent;
|
|
1036
991
|
|
|
1037
|
-
const FooterComponent = React.forwardRef((props, ref) => React__namespace.default.createElement(
|
|
992
|
+
const FooterComponent = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledDrawerFooter, _extends$2({
|
|
1038
993
|
ref: ref
|
|
1039
994
|
}, props)));
|
|
1040
|
-
FooterComponent.displayName = '
|
|
995
|
+
FooterComponent.displayName = 'Drawer.Footer';
|
|
1041
996
|
const Footer = FooterComponent;
|
|
1042
997
|
|
|
1043
|
-
const FooterItemComponent = React.forwardRef((props, ref) => React__namespace.default.createElement(
|
|
998
|
+
const FooterItemComponent = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledDrawerFooterItem, _extends$2({
|
|
1044
999
|
ref: ref
|
|
1045
1000
|
}, props)));
|
|
1046
|
-
FooterItemComponent.displayName = '
|
|
1001
|
+
FooterItemComponent.displayName = 'Drawer.FooterItem';
|
|
1047
1002
|
const FooterItem = FooterItemComponent;
|
|
1048
1003
|
|
|
1049
|
-
const
|
|
1004
|
+
const DrawerComponent = React.forwardRef((_ref, ref) => {
|
|
1050
1005
|
let {
|
|
1051
1006
|
id,
|
|
1052
1007
|
isOpen,
|
|
@@ -1146,7 +1101,7 @@ const DrawerModalComponent = React.forwardRef((_ref, ref) => {
|
|
|
1146
1101
|
const defaultValue = hasHeader ? modalProps['aria-labelledby'] : 'Modal dialog';
|
|
1147
1102
|
const labelValue = hasHeader ? modalProps['aria-labelledby'] : props['aria-label'];
|
|
1148
1103
|
const ariaProps = {
|
|
1149
|
-
[attribute]: reactTheming.useText(
|
|
1104
|
+
[attribute]: reactTheming.useText(DrawerComponent, {
|
|
1150
1105
|
[attribute]: labelValue
|
|
1151
1106
|
}, attribute, defaultValue)
|
|
1152
1107
|
};
|
|
@@ -1163,12 +1118,12 @@ const DrawerModalComponent = React.forwardRef((_ref, ref) => {
|
|
|
1163
1118
|
nodeRef: transitionRef
|
|
1164
1119
|
}, React__namespace.default.createElement(StyledBackdrop, _extends$2({
|
|
1165
1120
|
isAnimated: true
|
|
1166
|
-
}, getBackdropProps(backdropProps)), React__namespace.default.createElement(
|
|
1121
|
+
}, getBackdropProps(backdropProps)), React__namespace.default.createElement(StyledDrawer, _extends$2({}, modalProps, ariaProps, props, {
|
|
1167
1122
|
ref: reactMergeRefs.mergeRefs([ref, modalRef, transitionRef])
|
|
1168
1123
|
}))))), rootNode);
|
|
1169
1124
|
});
|
|
1170
|
-
|
|
1171
|
-
|
|
1125
|
+
DrawerComponent.displayName = 'Drawer';
|
|
1126
|
+
DrawerComponent.propTypes = {
|
|
1172
1127
|
backdropProps: PropTypes__default.default.object,
|
|
1173
1128
|
focusOnMount: PropTypes__default.default.bool,
|
|
1174
1129
|
restoreFocus: PropTypes__default.default.bool,
|
|
@@ -1176,22 +1131,22 @@ DrawerModalComponent.propTypes = {
|
|
|
1176
1131
|
appendToNode: PropTypes__default.default.any,
|
|
1177
1132
|
isOpen: PropTypes__default.default.bool
|
|
1178
1133
|
};
|
|
1179
|
-
|
|
1134
|
+
DrawerComponent.defaultProps = {
|
|
1180
1135
|
focusOnMount: true ,
|
|
1181
1136
|
restoreFocus: true
|
|
1182
1137
|
};
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1138
|
+
const Drawer = DrawerComponent;
|
|
1139
|
+
Drawer.Body = Body;
|
|
1140
|
+
Drawer.Close = Close;
|
|
1141
|
+
Drawer.Footer = Footer;
|
|
1142
|
+
Drawer.FooterItem = FooterItem;
|
|
1143
|
+
Drawer.Header = Header;
|
|
1189
1144
|
|
|
1190
|
-
const PLACEMENT = ['auto',
|
|
1145
|
+
const PLACEMENT = ['auto', ...reactTheming.PLACEMENT];
|
|
1191
1146
|
|
|
1192
1147
|
exports.Body = Body$2;
|
|
1193
1148
|
exports.Close = Close$2;
|
|
1194
|
-
exports.
|
|
1149
|
+
exports.Drawer = Drawer;
|
|
1195
1150
|
exports.Footer = Footer$2;
|
|
1196
1151
|
exports.FooterItem = FooterItem$2;
|
|
1197
1152
|
exports.Header = Header$1;
|