@zendeskgarden/react-modals 8.62.0 → 8.62.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/dist/index.cjs.js
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var React = require('react');
|
|
13
11
|
var ReactDOM = require('react-dom');
|
|
14
12
|
var styled = require('styled-components');
|
|
@@ -20,7 +18,7 @@ var mergeRefs = require('react-merge-refs');
|
|
|
20
18
|
var reactPopper = require('react-popper');
|
|
21
19
|
var reactTransitionGroup = require('react-transition-group');
|
|
22
20
|
|
|
23
|
-
function
|
|
21
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
22
|
|
|
25
23
|
function _interopNamespace(e) {
|
|
26
24
|
if (e && e.__esModule) return e;
|
|
@@ -36,16 +34,15 @@ function _interopNamespace(e) {
|
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
|
-
n
|
|
37
|
+
n.default = e;
|
|
40
38
|
return Object.freeze(n);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs);
|
|
42
|
+
var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
|
|
43
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
44
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
45
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
|
|
49
46
|
|
|
50
47
|
function _extends$2() {
|
|
51
48
|
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -144,9 +141,9 @@ function scrollbarSize(recalc) {
|
|
|
144
141
|
|
|
145
142
|
const COMPONENT_ID$j = 'modals.backdrop';
|
|
146
143
|
const animationName$1 = styled.keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
|
|
147
|
-
const StyledBackdrop = styled__default
|
|
144
|
+
const StyledBackdrop = styled__default.default.div.attrs({
|
|
148
145
|
'data-garden-id': COMPONENT_ID$j,
|
|
149
|
-
'data-garden-version': '8.62.
|
|
146
|
+
'data-garden-version': '8.62.2'
|
|
150
147
|
}).withConfig({
|
|
151
148
|
displayName: "StyledBackdrop",
|
|
152
149
|
componentId: "sc-mzdjpo-0"
|
|
@@ -155,14 +152,14 @@ StyledBackdrop.defaultProps = {
|
|
|
155
152
|
theme: reactTheming.DEFAULT_THEME
|
|
156
153
|
};
|
|
157
154
|
StyledBackdrop.propTypes = {
|
|
158
|
-
isCentered: PropTypes__default
|
|
159
|
-
isAnimated: PropTypes__default
|
|
155
|
+
isCentered: PropTypes__default.default.bool,
|
|
156
|
+
isAnimated: PropTypes__default.default.bool
|
|
160
157
|
};
|
|
161
158
|
|
|
162
159
|
const COMPONENT_ID$i = 'modals.body';
|
|
163
|
-
const StyledBody = styled__default
|
|
160
|
+
const StyledBody = styled__default.default.div.attrs({
|
|
164
161
|
'data-garden-id': COMPONENT_ID$i,
|
|
165
|
-
'data-garden-version': '8.62.
|
|
162
|
+
'data-garden-version': '8.62.2'
|
|
166
163
|
}).withConfig({
|
|
167
164
|
displayName: "StyledBody",
|
|
168
165
|
componentId: "sc-14rzecg-0"
|
|
@@ -182,9 +179,9 @@ const BASE_MULTIPLIERS$1 = {
|
|
|
182
179
|
side: 6.5,
|
|
183
180
|
size: 10
|
|
184
181
|
};
|
|
185
|
-
const StyledClose = styled__default
|
|
182
|
+
const StyledClose = styled__default.default.button.attrs({
|
|
186
183
|
'data-garden-id': COMPONENT_ID$h,
|
|
187
|
-
'data-garden-version': '8.62.
|
|
184
|
+
'data-garden-version': '8.62.2'
|
|
188
185
|
}).withConfig({
|
|
189
186
|
displayName: "StyledClose",
|
|
190
187
|
componentId: "sc-iseudj-0"
|
|
@@ -194,9 +191,9 @@ StyledClose.defaultProps = {
|
|
|
194
191
|
};
|
|
195
192
|
|
|
196
193
|
const COMPONENT_ID$g = 'modals.footer';
|
|
197
|
-
const StyledFooter = styled__default
|
|
194
|
+
const StyledFooter = styled__default.default.div.attrs({
|
|
198
195
|
'data-garden-id': COMPONENT_ID$g,
|
|
199
|
-
'data-garden-version': '8.62.
|
|
196
|
+
'data-garden-version': '8.62.2'
|
|
200
197
|
}).withConfig({
|
|
201
198
|
displayName: "StyledFooter",
|
|
202
199
|
componentId: "sc-d8pfdu-0"
|
|
@@ -206,9 +203,9 @@ StyledFooter.defaultProps = {
|
|
|
206
203
|
};
|
|
207
204
|
|
|
208
205
|
const COMPONENT_ID$f = 'modals.footer_item';
|
|
209
|
-
const StyledFooterItem = styled__default
|
|
206
|
+
const StyledFooterItem = styled__default.default.span.attrs({
|
|
210
207
|
'data-garden-id': COMPONENT_ID$f,
|
|
211
|
-
'data-garden-version': '8.62.
|
|
208
|
+
'data-garden-version': '8.62.2'
|
|
212
209
|
}).withConfig({
|
|
213
210
|
displayName: "StyledFooterItem",
|
|
214
211
|
componentId: "sc-1mb76hl-0"
|
|
@@ -218,9 +215,9 @@ StyledFooterItem.defaultProps = {
|
|
|
218
215
|
};
|
|
219
216
|
|
|
220
217
|
const COMPONENT_ID$e = 'modals.header';
|
|
221
|
-
const StyledHeader = styled__default
|
|
218
|
+
const StyledHeader = styled__default.default.div.attrs({
|
|
222
219
|
'data-garden-id': COMPONENT_ID$e,
|
|
223
|
-
'data-garden-version': '8.62.
|
|
220
|
+
'data-garden-version': '8.62.2'
|
|
224
221
|
}).withConfig({
|
|
225
222
|
displayName: "StyledHeader",
|
|
226
223
|
componentId: "sc-1787r9v-0"
|
|
@@ -260,7 +257,7 @@ var SvgAlertErrorStroke = function SvgAlertErrorStroke(props) {
|
|
|
260
257
|
})));
|
|
261
258
|
};
|
|
262
259
|
|
|
263
|
-
const StyledDangerIcon = styled__default
|
|
260
|
+
const StyledDangerIcon = styled__default.default(SvgAlertErrorStroke).withConfig({
|
|
264
261
|
displayName: "StyledDangerIcon",
|
|
265
262
|
componentId: "sc-1kwbb39-0"
|
|
266
263
|
})(["position:absolute;top:", "px;", ":", ";"], props => props.theme.space.base * 5.5, props => props.theme.rtl ? 'right' : 'left', props => `${props.theme.space.base * 4}px`);
|
|
@@ -286,25 +283,25 @@ const boxShadow$1 = props => {
|
|
|
286
283
|
const sizeStyles$1 = props => {
|
|
287
284
|
return styled.css(["", "{width:", ";}"], reactTheming.mediaQuery('up', props.isLarge ? 'md' : 'sm', props.theme), props.isLarge ? props.theme.breakpoints.md : props.theme.breakpoints.sm);
|
|
288
285
|
};
|
|
289
|
-
const StyledModal = styled__default
|
|
286
|
+
const StyledModal = styled__default.default.div.attrs({
|
|
290
287
|
'data-garden-id': COMPONENT_ID$d,
|
|
291
|
-
'data-garden-version': '8.62.
|
|
288
|
+
'data-garden-version': '8.62.2'
|
|
292
289
|
}).withConfig({
|
|
293
290
|
displayName: "StyledModal",
|
|
294
291
|
componentId: "sc-1pe1axu-0"
|
|
295
292
|
})(["display:flex;position:fixed;flex-direction:column;margin:", ";border-radius:", ";box-shadow:", ";background-color:", ";min-height:60px;max-height:calc(100vh - ", "px);animation:", ";animation-delay:0.01s;overflow:auto;direction:", ";", " &:focus{outline:none;}@media (max-height:399px){top:", "px;bottom:auto;margin-bottom:", "px;max-height:none;}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){right:", ";bottom:", ";transform:", ";}", ";"], props => props.isCentered ? '0' : `${props.theme.space.base * 12}px`, props => props.theme.borderRadii.md, boxShadow$1, props => props.theme.colors.background, props => props.theme.space.base * 24, props => props.isAnimated && styled.css(["", " 0.3s ease-in-out"], animationName), props => props.theme.rtl && 'rtl', sizeStyles$1, props => props.theme.space.base * 6, props => props.theme.space.base * 6, props => props.isCentered && '50%', props => props.isCentered && '50%', props => props.isCentered && 'translate(50%, 50%)', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$d, props));
|
|
296
293
|
StyledModal.propTypes = {
|
|
297
|
-
isLarge: PropTypes__default
|
|
298
|
-
isAnimated: PropTypes__default
|
|
294
|
+
isLarge: PropTypes__default.default.bool,
|
|
295
|
+
isAnimated: PropTypes__default.default.bool
|
|
299
296
|
};
|
|
300
297
|
StyledModal.defaultProps = {
|
|
301
298
|
theme: reactTheming.DEFAULT_THEME
|
|
302
299
|
};
|
|
303
300
|
|
|
304
301
|
const COMPONENT_ID$c = 'modals.tooltip_modal.backdrop';
|
|
305
|
-
const StyledTooltipModalBackdrop = styled__default
|
|
302
|
+
const StyledTooltipModalBackdrop = styled__default.default.div.attrs({
|
|
306
303
|
'data-garden-id': COMPONENT_ID$c,
|
|
307
|
-
'data-garden-version': '8.62.
|
|
304
|
+
'data-garden-version': '8.62.2'
|
|
308
305
|
}).withConfig({
|
|
309
306
|
displayName: "StyledTooltipModalBackdrop",
|
|
310
307
|
componentId: "sc-1yaomgq-0"
|
|
@@ -368,7 +365,7 @@ function getMenuPosition(popperPlacement) {
|
|
|
368
365
|
return popperPlacement ? popperPlacement.split('-')[0] : 'bottom';
|
|
369
366
|
}
|
|
370
367
|
|
|
371
|
-
const StyledTooltipWrapper = styled__default
|
|
368
|
+
const StyledTooltipWrapper = styled__default.default.div.attrs(props => ({
|
|
372
369
|
className: props.isAnimated && 'is-animated'
|
|
373
370
|
})).withConfig({
|
|
374
371
|
displayName: "StyledTooltipWrapper",
|
|
@@ -385,9 +382,9 @@ StyledTooltipWrapper.defaultProps = {
|
|
|
385
382
|
};
|
|
386
383
|
|
|
387
384
|
const COMPONENT_ID$b = 'modals.tooltip_modal';
|
|
388
|
-
const StyledTooltipModal = styled__default
|
|
385
|
+
const StyledTooltipModal = styled__default.default.div.attrs(props => ({
|
|
389
386
|
'data-garden-id': COMPONENT_ID$b,
|
|
390
|
-
'data-garden-version': '8.62.
|
|
387
|
+
'data-garden-version': '8.62.2',
|
|
391
388
|
className: props.isAnimated && 'is-animated'
|
|
392
389
|
})).withConfig({
|
|
393
390
|
displayName: "StyledTooltipModal",
|
|
@@ -414,9 +411,9 @@ const sizeStyles = props => `
|
|
|
414
411
|
line-height: ${reactTheming.getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md)};
|
|
415
412
|
font-size: ${props.theme.fontSizes.md};
|
|
416
413
|
`;
|
|
417
|
-
const StyledTooltipModalTitle = styled__default
|
|
414
|
+
const StyledTooltipModalTitle = styled__default.default.div.attrs({
|
|
418
415
|
'data-garden-id': COMPONENT_ID$a,
|
|
419
|
-
'data-garden-version': '8.62.
|
|
416
|
+
'data-garden-version': '8.62.2'
|
|
420
417
|
}).withConfig({
|
|
421
418
|
displayName: "StyledTooltipModalTitle",
|
|
422
419
|
componentId: "sc-11xjgjs-0"
|
|
@@ -426,9 +423,9 @@ StyledTooltipModalTitle.defaultProps = {
|
|
|
426
423
|
};
|
|
427
424
|
|
|
428
425
|
const COMPONENT_ID$9 = 'modals.tooltip_modal.body';
|
|
429
|
-
const StyledTooltipModalBody = styled__default
|
|
426
|
+
const StyledTooltipModalBody = styled__default.default.div.attrs({
|
|
430
427
|
'data-garden-id': COMPONENT_ID$9,
|
|
431
|
-
'data-garden-version': '8.62.
|
|
428
|
+
'data-garden-version': '8.62.2'
|
|
432
429
|
}).withConfig({
|
|
433
430
|
displayName: "StyledTooltipModalBody",
|
|
434
431
|
componentId: "sc-195dkzj-0"
|
|
@@ -438,9 +435,9 @@ StyledTooltipModalBody.defaultProps = {
|
|
|
438
435
|
};
|
|
439
436
|
|
|
440
437
|
const COMPONENT_ID$8 = 'modals.tooltip_modal.footer';
|
|
441
|
-
const StyledTooltipModalFooter = styled__default
|
|
438
|
+
const StyledTooltipModalFooter = styled__default.default.div.attrs({
|
|
442
439
|
'data-garden-id': COMPONENT_ID$8,
|
|
443
|
-
'data-garden-version': '8.62.
|
|
440
|
+
'data-garden-version': '8.62.2'
|
|
444
441
|
}).withConfig({
|
|
445
442
|
displayName: "StyledTooltipModalFooter",
|
|
446
443
|
componentId: "sc-fm36a9-0"
|
|
@@ -450,9 +447,9 @@ StyledTooltipModalFooter.defaultProps = {
|
|
|
450
447
|
};
|
|
451
448
|
|
|
452
449
|
const COMPONENT_ID$7 = 'modals.tooltip_modal.footer_item';
|
|
453
|
-
const StyledTooltipModalFooterItem = styled__default
|
|
450
|
+
const StyledTooltipModalFooterItem = styled__default.default(StyledFooterItem).attrs({
|
|
454
451
|
'data-garden-id': COMPONENT_ID$7,
|
|
455
|
-
'data-garden-version': '8.62.
|
|
452
|
+
'data-garden-version': '8.62.2'
|
|
456
453
|
}).withConfig({
|
|
457
454
|
displayName: "StyledTooltipModalFooterItem",
|
|
458
455
|
componentId: "sc-1nahj6p-0"
|
|
@@ -462,9 +459,9 @@ StyledTooltipModalFooterItem.defaultProps = {
|
|
|
462
459
|
};
|
|
463
460
|
|
|
464
461
|
const COMPONENT_ID$6 = 'modals.tooltip_modal.close';
|
|
465
|
-
const StyledTooltipModalClose = styled__default
|
|
462
|
+
const StyledTooltipModalClose = styled__default.default(StyledClose).attrs({
|
|
466
463
|
'data-garden-id': COMPONENT_ID$6,
|
|
467
|
-
'data-garden-version': '8.62.
|
|
464
|
+
'data-garden-version': '8.62.2'
|
|
468
465
|
}).withConfig({
|
|
469
466
|
displayName: "StyledTooltipModalClose",
|
|
470
467
|
componentId: "sc-1h2ke3q-0"
|
|
@@ -488,9 +485,9 @@ const boxShadow = props => {
|
|
|
488
485
|
const color = reactTheming.getColor('neutralHue', 800, theme, 0.35);
|
|
489
486
|
return shadows.lg(offsetY, blurRadius, color);
|
|
490
487
|
};
|
|
491
|
-
const StyledDrawerModal = styled__default
|
|
488
|
+
const StyledDrawerModal = styled__default.default.div.attrs({
|
|
492
489
|
'data-garden-id': COMPONENT_ID$5,
|
|
493
|
-
'data-garden-version': '8.62.
|
|
490
|
+
'data-garden-version': '8.62.2'
|
|
494
491
|
}).withConfig({
|
|
495
492
|
displayName: "StyledDrawerModal",
|
|
496
493
|
componentId: "sc-i1sake-0"
|
|
@@ -505,9 +502,9 @@ const BASE_MULTIPLIERS = {
|
|
|
505
502
|
side: 2,
|
|
506
503
|
size: BASE_MULTIPLIERS$1.size
|
|
507
504
|
};
|
|
508
|
-
const StyledDrawerModalClose = styled__default
|
|
505
|
+
const StyledDrawerModalClose = styled__default.default(StyledClose).attrs({
|
|
509
506
|
'data-garden-id': COMPONENT_ID$4,
|
|
510
|
-
'data-garden-version': '8.62.
|
|
507
|
+
'data-garden-version': '8.62.2'
|
|
511
508
|
}).withConfig({
|
|
512
509
|
displayName: "StyledDrawerModalClose",
|
|
513
510
|
componentId: "sc-hrnaom-0"
|
|
@@ -517,9 +514,9 @@ StyledDrawerModalClose.defaultProps = {
|
|
|
517
514
|
};
|
|
518
515
|
|
|
519
516
|
const COMPONENT_ID$3 = 'modals.drawer_modal.header';
|
|
520
|
-
const StyledDrawerModalHeader = styled__default
|
|
517
|
+
const StyledDrawerModalHeader = styled__default.default(StyledHeader).attrs({
|
|
521
518
|
'data-garden-id': COMPONENT_ID$3,
|
|
522
|
-
'data-garden-version': '8.62.
|
|
519
|
+
'data-garden-version': '8.62.2'
|
|
523
520
|
}).withConfig({
|
|
524
521
|
displayName: "StyledDrawerModalHeader",
|
|
525
522
|
componentId: "sc-1u04rqw-0"
|
|
@@ -529,9 +526,9 @@ StyledDrawerModalHeader.defaultProps = {
|
|
|
529
526
|
};
|
|
530
527
|
|
|
531
528
|
const COMPONENT_ID$2 = 'modals.drawer_modal.body';
|
|
532
|
-
const StyledDrawerModalBody = styled__default
|
|
529
|
+
const StyledDrawerModalBody = styled__default.default(StyledBody).attrs({
|
|
533
530
|
'data-garden-id': COMPONENT_ID$2,
|
|
534
|
-
'data-garden-version': '8.62.
|
|
531
|
+
'data-garden-version': '8.62.2'
|
|
535
532
|
}).withConfig({
|
|
536
533
|
displayName: "StyledDrawerModalBody",
|
|
537
534
|
componentId: "sc-yafe2y-0"
|
|
@@ -541,9 +538,9 @@ StyledDrawerModalBody.defaultProps = {
|
|
|
541
538
|
};
|
|
542
539
|
|
|
543
540
|
const COMPONENT_ID$1 = 'modals.drawer_modal.footer';
|
|
544
|
-
const StyledDrawerModalFooter = styled__default
|
|
541
|
+
const StyledDrawerModalFooter = styled__default.default.div.attrs({
|
|
545
542
|
'data-garden-id': COMPONENT_ID$1,
|
|
546
|
-
'data-garden-version': '8.62.
|
|
543
|
+
'data-garden-version': '8.62.2'
|
|
547
544
|
}).withConfig({
|
|
548
545
|
displayName: "StyledDrawerModalFooter",
|
|
549
546
|
componentId: "sc-17if4ka-0"
|
|
@@ -553,9 +550,9 @@ StyledDrawerModalFooter.defaultProps = {
|
|
|
553
550
|
};
|
|
554
551
|
|
|
555
552
|
const COMPONENT_ID = 'modals.drawer_modal.footer_item';
|
|
556
|
-
const StyledDrawerModalFooterItem = styled__default
|
|
553
|
+
const StyledDrawerModalFooterItem = styled__default.default(StyledFooterItem).attrs({
|
|
557
554
|
'data-garden-id': COMPONENT_ID,
|
|
558
|
-
'data-garden-version': '8.62.
|
|
555
|
+
'data-garden-version': '8.62.2'
|
|
559
556
|
}).withConfig({
|
|
560
557
|
displayName: "StyledDrawerModalFooterItem",
|
|
561
558
|
componentId: "sc-1vbl885-0"
|
|
@@ -603,6 +600,7 @@ const Modal = React.forwardRef((_ref, ref) => {
|
|
|
603
600
|
const modalRef = React.useRef(null);
|
|
604
601
|
const environment = reactTheming.useDocument(theme);
|
|
605
602
|
const [isCloseButtonPresent, setIsCloseButtonPresent] = React.useState(false);
|
|
603
|
+
const [hasHeader, setHasHeader] = React.useState(false);
|
|
606
604
|
const {
|
|
607
605
|
getBackdropProps,
|
|
608
606
|
getModalProps,
|
|
@@ -660,37 +658,53 @@ const Modal = React.forwardRef((_ref, ref) => {
|
|
|
660
658
|
const value = React.useMemo(() => ({
|
|
661
659
|
isLarge,
|
|
662
660
|
isCloseButtonPresent,
|
|
661
|
+
hasHeader,
|
|
662
|
+
setHasHeader,
|
|
663
663
|
getTitleProps,
|
|
664
664
|
getContentProps,
|
|
665
665
|
getCloseProps,
|
|
666
666
|
setIsCloseButtonPresent
|
|
667
|
-
}), [isLarge, isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
667
|
+
}), [isLarge, hasHeader, isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
668
|
+
const modalContainerProps = getModalProps({
|
|
669
|
+
'aria-describedby': undefined,
|
|
670
|
+
...(hasHeader ? {} : {
|
|
671
|
+
'aria-labelledby': undefined
|
|
672
|
+
})
|
|
673
|
+
});
|
|
674
|
+
const attribute = hasHeader ? 'aria-labelledby' : 'aria-label';
|
|
675
|
+
const defaultValue = hasHeader ? modalContainerProps['aria-labelledby'] : 'Modal dialog';
|
|
676
|
+
const labelValue = hasHeader ? modalContainerProps['aria-labelledby'] : modalProps['aria-label'];
|
|
677
|
+
const ariaProps = {
|
|
678
|
+
[attribute]: reactTheming.useText(Modal, {
|
|
679
|
+
[attribute]: labelValue
|
|
680
|
+
}, attribute, defaultValue)
|
|
681
|
+
};
|
|
668
682
|
if (!rootNode) {
|
|
669
683
|
return null;
|
|
670
684
|
}
|
|
671
|
-
return ReactDOM.createPortal(
|
|
685
|
+
return ReactDOM.createPortal( React__namespace.default.createElement(ModalsContext.Provider, {
|
|
672
686
|
value: value
|
|
673
|
-
},
|
|
687
|
+
}, React__namespace.default.createElement(StyledBackdrop, _extends$2({
|
|
674
688
|
isCentered: isCentered,
|
|
675
689
|
isAnimated: isAnimated
|
|
676
|
-
}, getBackdropProps(backdropProps)),
|
|
690
|
+
}, getBackdropProps(backdropProps)), React__namespace.default.createElement(StyledModal, _extends$2({
|
|
677
691
|
isCentered: isCentered,
|
|
678
692
|
isAnimated: isAnimated,
|
|
679
693
|
isLarge: isLarge
|
|
680
|
-
},
|
|
681
|
-
ref: mergeRefs__default
|
|
694
|
+
}, modalContainerProps, ariaProps, modalProps, {
|
|
695
|
+
ref: mergeRefs__default.default([ref, modalRef])
|
|
682
696
|
}), children))), rootNode);
|
|
683
697
|
});
|
|
684
698
|
Modal.displayName = 'Modal';
|
|
685
699
|
Modal.propTypes = {
|
|
686
|
-
backdropProps: PropTypes__default
|
|
687
|
-
isLarge: PropTypes__default
|
|
688
|
-
isAnimated: PropTypes__default
|
|
689
|
-
isCentered: PropTypes__default
|
|
690
|
-
focusOnMount: PropTypes__default
|
|
691
|
-
restoreFocus: PropTypes__default
|
|
692
|
-
onClose: PropTypes__default
|
|
693
|
-
appendToNode: PropTypes__default
|
|
700
|
+
backdropProps: PropTypes__default.default.object,
|
|
701
|
+
isLarge: PropTypes__default.default.bool,
|
|
702
|
+
isAnimated: PropTypes__default.default.bool,
|
|
703
|
+
isCentered: PropTypes__default.default.bool,
|
|
704
|
+
focusOnMount: PropTypes__default.default.bool,
|
|
705
|
+
restoreFocus: PropTypes__default.default.bool,
|
|
706
|
+
onClose: PropTypes__default.default.func,
|
|
707
|
+
appendToNode: PropTypes__default.default.any
|
|
694
708
|
};
|
|
695
709
|
Modal.defaultProps = {
|
|
696
710
|
isAnimated: true,
|
|
@@ -701,7 +715,7 @@ const Body$2 = React.forwardRef((props, ref) => {
|
|
|
701
715
|
const {
|
|
702
716
|
getContentProps
|
|
703
717
|
} = useModalContext();
|
|
704
|
-
return
|
|
718
|
+
return React__namespace.default.createElement(StyledBody, _extends$2({}, getContentProps(props), {
|
|
705
719
|
ref: ref
|
|
706
720
|
}));
|
|
707
721
|
});
|
|
@@ -737,27 +751,27 @@ const Close$2 = React.forwardRef((props, ref) => {
|
|
|
737
751
|
return () => setIsCloseButtonPresent(false);
|
|
738
752
|
});
|
|
739
753
|
const ariaLabel = reactTheming.useText(Close$2, props, 'aria-label', 'Close modal');
|
|
740
|
-
return
|
|
754
|
+
return React__namespace.default.createElement(StyledClose, _extends$2({}, getCloseProps({
|
|
741
755
|
...props,
|
|
742
756
|
'aria-label': ariaLabel
|
|
743
757
|
}), {
|
|
744
758
|
ref: ref
|
|
745
|
-
}),
|
|
759
|
+
}), React__namespace.default.createElement(SvgXStroke, null));
|
|
746
760
|
});
|
|
747
761
|
Close$2.displayName = 'Close';
|
|
748
762
|
|
|
749
|
-
const Footer$2 =
|
|
763
|
+
const Footer$2 = React__namespace.default.forwardRef((props, ref) => {
|
|
750
764
|
const {
|
|
751
765
|
isLarge
|
|
752
766
|
} = useModalContext();
|
|
753
|
-
return
|
|
767
|
+
return React__namespace.default.createElement(StyledFooter, _extends$2({
|
|
754
768
|
ref: ref,
|
|
755
769
|
isLarge: isLarge
|
|
756
770
|
}, props));
|
|
757
771
|
});
|
|
758
772
|
Footer$2.displayName = 'Footer';
|
|
759
773
|
|
|
760
|
-
const FooterItem$2 =
|
|
774
|
+
const FooterItem$2 = React__namespace.default.forwardRef((props, ref) => React__namespace.default.createElement(StyledFooterItem, _extends$2({
|
|
761
775
|
ref: ref
|
|
762
776
|
}, props)));
|
|
763
777
|
FooterItem$2.displayName = 'FooterItem';
|
|
@@ -765,24 +779,35 @@ FooterItem$2.displayName = 'FooterItem';
|
|
|
765
779
|
const Header$1 = React.forwardRef((_ref, ref) => {
|
|
766
780
|
let {
|
|
767
781
|
children,
|
|
768
|
-
isDanger,
|
|
769
782
|
tag,
|
|
770
783
|
...other
|
|
771
784
|
} = _ref;
|
|
772
785
|
const {
|
|
773
786
|
isCloseButtonPresent,
|
|
787
|
+
hasHeader,
|
|
788
|
+
setHasHeader,
|
|
774
789
|
getTitleProps
|
|
775
790
|
} = useModalContext();
|
|
776
|
-
|
|
791
|
+
React.useEffect(() => {
|
|
792
|
+
if (!hasHeader && setHasHeader) {
|
|
793
|
+
setHasHeader(true);
|
|
794
|
+
}
|
|
795
|
+
return () => {
|
|
796
|
+
if (hasHeader && setHasHeader) {
|
|
797
|
+
setHasHeader(false);
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
}, [hasHeader, setHasHeader]);
|
|
801
|
+
return React__namespace.default.createElement(StyledHeader, _extends$2({}, getTitleProps(other), {
|
|
777
802
|
as: tag,
|
|
778
803
|
isCloseButtonPresent: isCloseButtonPresent,
|
|
779
804
|
ref: ref
|
|
780
|
-
}), isDanger &&
|
|
805
|
+
}), other.isDanger && React__namespace.default.createElement(StyledDangerIcon, null), children);
|
|
781
806
|
});
|
|
782
807
|
Header$1.displayName = 'Header';
|
|
783
808
|
Header$1.propTypes = {
|
|
784
|
-
isDanger: PropTypes__default
|
|
785
|
-
tag: PropTypes__default
|
|
809
|
+
isDanger: PropTypes__default.default.bool,
|
|
810
|
+
tag: PropTypes__default.default.any
|
|
786
811
|
};
|
|
787
812
|
Header$1.defaultProps = {
|
|
788
813
|
tag: 'div'
|
|
@@ -804,16 +829,28 @@ const TitleComponent = React.forwardRef((_ref, ref) => {
|
|
|
804
829
|
...other
|
|
805
830
|
} = _ref;
|
|
806
831
|
const {
|
|
807
|
-
getTitleProps
|
|
832
|
+
getTitleProps,
|
|
833
|
+
hasTitle,
|
|
834
|
+
setHasTitle
|
|
808
835
|
} = useTooltipModalContext();
|
|
809
|
-
|
|
836
|
+
React.useEffect(() => {
|
|
837
|
+
if (!hasTitle && setHasTitle) {
|
|
838
|
+
setHasTitle(true);
|
|
839
|
+
}
|
|
840
|
+
return () => {
|
|
841
|
+
if (hasTitle && setHasTitle) {
|
|
842
|
+
setHasTitle(false);
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
}, [hasTitle, setHasTitle]);
|
|
846
|
+
return React__namespace.default.createElement(StyledTooltipModalTitle, _extends$2({}, getTitleProps(other), {
|
|
810
847
|
as: tag,
|
|
811
848
|
ref: ref
|
|
812
849
|
}), children);
|
|
813
850
|
});
|
|
814
851
|
TitleComponent.displayName = 'TooltipModal.Title';
|
|
815
852
|
TitleComponent.propTypes = {
|
|
816
|
-
tag: PropTypes__default
|
|
853
|
+
tag: PropTypes__default.default.any
|
|
817
854
|
};
|
|
818
855
|
TitleComponent.defaultProps = {
|
|
819
856
|
tag: 'div'
|
|
@@ -824,7 +861,7 @@ const BodyComponent$1 = React.forwardRef((props, ref) => {
|
|
|
824
861
|
const {
|
|
825
862
|
getContentProps
|
|
826
863
|
} = useTooltipModalContext();
|
|
827
|
-
return
|
|
864
|
+
return React__namespace.default.createElement(StyledTooltipModalBody, _extends$2({}, getContentProps(props), {
|
|
828
865
|
ref: ref
|
|
829
866
|
}));
|
|
830
867
|
});
|
|
@@ -836,29 +873,29 @@ const CloseComponent$1 = React.forwardRef((props, ref) => {
|
|
|
836
873
|
getCloseProps
|
|
837
874
|
} = useTooltipModalContext();
|
|
838
875
|
const ariaLabel = reactTheming.useText(CloseComponent$1, props, 'aria-label', 'Close tooltip');
|
|
839
|
-
return
|
|
876
|
+
return React__namespace.default.createElement(StyledTooltipModalClose, _extends$2({}, getCloseProps({
|
|
840
877
|
...props,
|
|
841
878
|
'aria-label': ariaLabel
|
|
842
879
|
}), {
|
|
843
880
|
ref: ref
|
|
844
|
-
}),
|
|
881
|
+
}), React__namespace.default.createElement(SvgXStroke, null));
|
|
845
882
|
});
|
|
846
883
|
CloseComponent$1.displayName = 'TooltipModal.Close';
|
|
847
884
|
const Close$1 = CloseComponent$1;
|
|
848
885
|
|
|
849
|
-
const FooterComponent$1 = React.forwardRef((props, ref) =>
|
|
886
|
+
const FooterComponent$1 = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledTooltipModalFooter, _extends$2({
|
|
850
887
|
ref: ref
|
|
851
888
|
}, props)));
|
|
852
889
|
FooterComponent$1.displayName = 'TooltipModal.Footer';
|
|
853
890
|
const Footer$1 = FooterComponent$1;
|
|
854
891
|
|
|
855
|
-
const FooterItemComponent$1 = React.forwardRef((props, ref) =>
|
|
892
|
+
const FooterItemComponent$1 = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledTooltipModalFooterItem, _extends$2({
|
|
856
893
|
ref: ref
|
|
857
894
|
}, props)));
|
|
858
895
|
FooterItemComponent$1.displayName = 'TooltipModal.FooterItem';
|
|
859
896
|
const FooterItem$1 = FooterItemComponent$1;
|
|
860
897
|
|
|
861
|
-
const TooltipModalComponent =
|
|
898
|
+
const TooltipModalComponent = React__namespace.default.forwardRef((_ref, ref) => {
|
|
862
899
|
let {
|
|
863
900
|
referenceElement,
|
|
864
901
|
popperModifiers,
|
|
@@ -878,6 +915,7 @@ const TooltipModalComponent = React__default["default"].forwardRef((_ref, ref) =
|
|
|
878
915
|
const modalRef = React.useRef(null);
|
|
879
916
|
const transitionRef = React.useRef(null);
|
|
880
917
|
const [popperElement, setPopperElement] = React.useState();
|
|
918
|
+
const [hasTitle, setHasTitle] = React.useState(false);
|
|
881
919
|
const {
|
|
882
920
|
getTitleProps,
|
|
883
921
|
getCloseProps,
|
|
@@ -911,57 +949,72 @@ const TooltipModalComponent = React__default["default"].forwardRef((_ref, ref) =
|
|
|
911
949
|
}
|
|
912
950
|
}, ...(popperModifiers || [])]
|
|
913
951
|
});
|
|
952
|
+
const modalProps = getModalProps({
|
|
953
|
+
'aria-describedby': undefined,
|
|
954
|
+
...(hasTitle ? {} : {
|
|
955
|
+
'aria-labelledby': undefined
|
|
956
|
+
})
|
|
957
|
+
});
|
|
958
|
+
const attribute = hasTitle ? 'aria-labelledby' : 'aria-label';
|
|
959
|
+
const defaultValue = hasTitle ? modalProps['aria-labelledby'] : 'Modal dialog';
|
|
960
|
+
const labelValue = hasTitle ? modalProps['aria-labelledby'] : props['aria-label'];
|
|
961
|
+
const ariaProps = {
|
|
962
|
+
[attribute]: reactTheming.useText(TooltipModalComponent, {
|
|
963
|
+
[attribute]: labelValue
|
|
964
|
+
}, attribute, defaultValue)
|
|
965
|
+
};
|
|
914
966
|
const value = {
|
|
967
|
+
hasTitle,
|
|
968
|
+
setHasTitle,
|
|
915
969
|
getTitleProps,
|
|
916
970
|
getContentProps,
|
|
917
971
|
getCloseProps
|
|
918
972
|
};
|
|
919
|
-
return
|
|
973
|
+
return React__namespace.default.createElement(reactTransitionGroup.CSSTransition, {
|
|
920
974
|
unmountOnExit: true,
|
|
921
975
|
timeout: isAnimated ? 200 : 0,
|
|
922
976
|
in: Boolean(referenceElement),
|
|
923
977
|
classNames: isAnimated ? 'garden-tooltip-modal-transition' : '',
|
|
924
978
|
nodeRef: transitionRef
|
|
925
979
|
}, transitionState => {
|
|
926
|
-
return
|
|
980
|
+
return React__namespace.default.createElement(TooltipModalContext.Provider, {
|
|
927
981
|
value: value
|
|
928
|
-
},
|
|
982
|
+
}, React__namespace.default.createElement(StyledTooltipModalBackdrop, _extends$2({}, getBackdropProps(), backdropProps, {
|
|
929
983
|
ref: transitionRef
|
|
930
|
-
}),
|
|
984
|
+
}), React__namespace.default.createElement(StyledTooltipWrapper, _extends$2({
|
|
931
985
|
ref: setPopperElement,
|
|
932
986
|
style: styles.popper,
|
|
933
987
|
placement: state ? state.placement : undefined,
|
|
934
988
|
zIndex: zIndex,
|
|
935
989
|
isAnimated: isAnimated
|
|
936
|
-
}, attributes.popper),
|
|
990
|
+
}, attributes.popper), React__namespace.default.createElement(StyledTooltipModal, _extends$2({
|
|
937
991
|
transitionState: transitionState,
|
|
938
992
|
placement: state ? state.placement : 'top',
|
|
939
993
|
hasArrow: hasArrow,
|
|
940
994
|
isAnimated: isAnimated
|
|
941
|
-
},
|
|
942
|
-
ref: mergeRefs__default
|
|
995
|
+
}, modalProps, ariaProps, props, {
|
|
996
|
+
ref: mergeRefs__default.default([modalRef, ref])
|
|
943
997
|
})))));
|
|
944
998
|
});
|
|
945
999
|
});
|
|
946
1000
|
TooltipModalComponent.displayName = 'TooltipModal';
|
|
947
1001
|
TooltipModalComponent.defaultProps = {
|
|
948
1002
|
placement: 'auto',
|
|
949
|
-
isAnimated: true,
|
|
950
1003
|
hasArrow: true,
|
|
951
1004
|
focusOnMount: true,
|
|
952
1005
|
restoreFocus: true
|
|
953
1006
|
};
|
|
954
1007
|
TooltipModalComponent.propTypes = {
|
|
955
|
-
referenceElement: PropTypes__default
|
|
956
|
-
popperModifiers: PropTypes__default
|
|
957
|
-
placement: PropTypes__default
|
|
958
|
-
isAnimated: PropTypes__default
|
|
959
|
-
hasArrow: PropTypes__default
|
|
960
|
-
zIndex: PropTypes__default
|
|
961
|
-
onClose: PropTypes__default
|
|
962
|
-
backdropProps: PropTypes__default
|
|
963
|
-
focusOnMount: PropTypes__default
|
|
964
|
-
restoreFocus: PropTypes__default
|
|
1008
|
+
referenceElement: PropTypes__default.default.any,
|
|
1009
|
+
popperModifiers: PropTypes__default.default.any,
|
|
1010
|
+
placement: PropTypes__default.default.any,
|
|
1011
|
+
isAnimated: PropTypes__default.default.bool,
|
|
1012
|
+
hasArrow: PropTypes__default.default.bool,
|
|
1013
|
+
zIndex: PropTypes__default.default.number,
|
|
1014
|
+
onClose: PropTypes__default.default.func,
|
|
1015
|
+
backdropProps: PropTypes__default.default.any,
|
|
1016
|
+
focusOnMount: PropTypes__default.default.bool,
|
|
1017
|
+
restoreFocus: PropTypes__default.default.bool
|
|
965
1018
|
};
|
|
966
1019
|
const TooltipModal = TooltipModalComponent;
|
|
967
1020
|
TooltipModal.Body = Body$1;
|
|
@@ -977,9 +1030,21 @@ const HeaderComponent = React.forwardRef((_ref, ref) => {
|
|
|
977
1030
|
} = _ref;
|
|
978
1031
|
const {
|
|
979
1032
|
isCloseButtonPresent,
|
|
1033
|
+
hasHeader,
|
|
1034
|
+
setHasHeader,
|
|
980
1035
|
getTitleProps
|
|
981
1036
|
} = useModalContext();
|
|
982
|
-
|
|
1037
|
+
React.useEffect(() => {
|
|
1038
|
+
if (!hasHeader && setHasHeader) {
|
|
1039
|
+
setHasHeader(true);
|
|
1040
|
+
}
|
|
1041
|
+
return () => {
|
|
1042
|
+
if (hasHeader && setHasHeader) {
|
|
1043
|
+
setHasHeader(false);
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
}, [hasHeader, setHasHeader]);
|
|
1047
|
+
return React__namespace.default.createElement(StyledDrawerModalHeader, _extends$2({}, getTitleProps(other), {
|
|
983
1048
|
as: tag,
|
|
984
1049
|
isCloseButtonPresent: isCloseButtonPresent,
|
|
985
1050
|
ref: ref
|
|
@@ -987,7 +1052,7 @@ const HeaderComponent = React.forwardRef((_ref, ref) => {
|
|
|
987
1052
|
});
|
|
988
1053
|
HeaderComponent.displayName = 'DrawerModal.Header';
|
|
989
1054
|
HeaderComponent.propTypes = {
|
|
990
|
-
tag: PropTypes__default
|
|
1055
|
+
tag: PropTypes__default.default.any
|
|
991
1056
|
};
|
|
992
1057
|
HeaderComponent.defaultProps = {
|
|
993
1058
|
tag: 'div'
|
|
@@ -998,7 +1063,7 @@ const BodyComponent = React.forwardRef((props, ref) => {
|
|
|
998
1063
|
const {
|
|
999
1064
|
getContentProps
|
|
1000
1065
|
} = useModalContext();
|
|
1001
|
-
return
|
|
1066
|
+
return React__namespace.default.createElement(StyledDrawerModalBody, _extends$2({}, getContentProps(props), {
|
|
1002
1067
|
ref: ref
|
|
1003
1068
|
}), props.children);
|
|
1004
1069
|
});
|
|
@@ -1015,23 +1080,23 @@ const CloseComponent = React.forwardRef((props, ref) => {
|
|
|
1015
1080
|
return () => setIsCloseButtonPresent(false);
|
|
1016
1081
|
});
|
|
1017
1082
|
const ariaLabel = reactTheming.useText(CloseComponent, props, 'aria-label', 'Close drawer');
|
|
1018
|
-
return
|
|
1083
|
+
return React__namespace.default.createElement(StyledDrawerModalClose, _extends$2({}, getCloseProps({
|
|
1019
1084
|
...props,
|
|
1020
1085
|
'aria-label': ariaLabel
|
|
1021
1086
|
}), {
|
|
1022
1087
|
ref: ref
|
|
1023
|
-
}),
|
|
1088
|
+
}), React__namespace.default.createElement(SvgXStroke, null));
|
|
1024
1089
|
});
|
|
1025
1090
|
CloseComponent.displayName = 'DrawerModal.Close';
|
|
1026
1091
|
const Close = CloseComponent;
|
|
1027
1092
|
|
|
1028
|
-
const FooterComponent = React.forwardRef((props, ref) =>
|
|
1093
|
+
const FooterComponent = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledDrawerModalFooter, _extends$2({
|
|
1029
1094
|
ref: ref
|
|
1030
1095
|
}, props)));
|
|
1031
1096
|
FooterComponent.displayName = 'DrawerModal.Footer';
|
|
1032
1097
|
const Footer = FooterComponent;
|
|
1033
1098
|
|
|
1034
|
-
const FooterItemComponent = React.forwardRef((props, ref) =>
|
|
1099
|
+
const FooterItemComponent = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledDrawerModalFooterItem, _extends$2({
|
|
1035
1100
|
ref: ref
|
|
1036
1101
|
}, props)));
|
|
1037
1102
|
FooterItemComponent.displayName = 'DrawerModal.FooterItem';
|
|
@@ -1053,6 +1118,7 @@ const DrawerModalComponent = React.forwardRef((_ref, ref) => {
|
|
|
1053
1118
|
const theme = React.useContext(styled.ThemeContext);
|
|
1054
1119
|
const environment = reactTheming.useDocument(theme);
|
|
1055
1120
|
const [isCloseButtonPresent, setIsCloseButtonPresent] = React.useState(false);
|
|
1121
|
+
const [hasHeader, setHasHeader] = React.useState(false);
|
|
1056
1122
|
containerFocusvisible.useFocusVisible({
|
|
1057
1123
|
scope: modalRef,
|
|
1058
1124
|
relativeDocument: modalRef.current
|
|
@@ -1098,36 +1164,52 @@ const DrawerModalComponent = React.forwardRef((_ref, ref) => {
|
|
|
1098
1164
|
}, [appendToNode, environment]);
|
|
1099
1165
|
const value = React.useMemo(() => ({
|
|
1100
1166
|
isCloseButtonPresent,
|
|
1167
|
+
hasHeader,
|
|
1168
|
+
setHasHeader,
|
|
1101
1169
|
getTitleProps,
|
|
1102
1170
|
getContentProps,
|
|
1103
1171
|
getCloseProps,
|
|
1104
1172
|
setIsCloseButtonPresent
|
|
1105
|
-
}), [isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
1173
|
+
}), [isCloseButtonPresent, hasHeader, getTitleProps, getContentProps, getCloseProps]);
|
|
1174
|
+
const modalProps = getModalProps({
|
|
1175
|
+
'aria-describedby': undefined,
|
|
1176
|
+
...(hasHeader ? {} : {
|
|
1177
|
+
'aria-labelledby': undefined
|
|
1178
|
+
})
|
|
1179
|
+
});
|
|
1180
|
+
const attribute = hasHeader ? 'aria-labelledby' : 'aria-label';
|
|
1181
|
+
const defaultValue = hasHeader ? modalProps['aria-labelledby'] : 'Modal dialog';
|
|
1182
|
+
const labelValue = hasHeader ? modalProps['aria-labelledby'] : props['aria-label'];
|
|
1183
|
+
const ariaProps = {
|
|
1184
|
+
[attribute]: reactTheming.useText(DrawerModalComponent, {
|
|
1185
|
+
[attribute]: labelValue
|
|
1186
|
+
}, attribute, defaultValue)
|
|
1187
|
+
};
|
|
1106
1188
|
if (!rootNode) {
|
|
1107
1189
|
return null;
|
|
1108
1190
|
}
|
|
1109
|
-
return ReactDOM__default
|
|
1191
|
+
return ReactDOM__default.default.createPortal( React__namespace.default.createElement(ModalsContext.Provider, {
|
|
1110
1192
|
value: value
|
|
1111
|
-
},
|
|
1193
|
+
}, React__namespace.default.createElement(reactTransitionGroup.CSSTransition, {
|
|
1112
1194
|
in: isOpen,
|
|
1113
1195
|
timeout: 250,
|
|
1114
1196
|
unmountOnExit: true,
|
|
1115
1197
|
classNames: "garden-drawer-transition",
|
|
1116
1198
|
nodeRef: transitionRef
|
|
1117
|
-
},
|
|
1199
|
+
}, React__namespace.default.createElement(StyledBackdrop, _extends$2({
|
|
1118
1200
|
isAnimated: true
|
|
1119
|
-
}, getBackdropProps(backdropProps)),
|
|
1120
|
-
ref: mergeRefs__default
|
|
1201
|
+
}, getBackdropProps(backdropProps)), React__namespace.default.createElement(StyledDrawerModal, _extends$2({}, modalProps, ariaProps, props, {
|
|
1202
|
+
ref: mergeRefs__default.default([ref, modalRef, transitionRef])
|
|
1121
1203
|
}))))), rootNode);
|
|
1122
1204
|
});
|
|
1123
1205
|
DrawerModalComponent.displayName = 'DrawerModal';
|
|
1124
1206
|
DrawerModalComponent.propTypes = {
|
|
1125
|
-
backdropProps: PropTypes__default
|
|
1126
|
-
focusOnMount: PropTypes__default
|
|
1127
|
-
restoreFocus: PropTypes__default
|
|
1128
|
-
onClose: PropTypes__default
|
|
1129
|
-
appendToNode: PropTypes__default
|
|
1130
|
-
isOpen: PropTypes__default
|
|
1207
|
+
backdropProps: PropTypes__default.default.object,
|
|
1208
|
+
focusOnMount: PropTypes__default.default.bool,
|
|
1209
|
+
restoreFocus: PropTypes__default.default.bool,
|
|
1210
|
+
onClose: PropTypes__default.default.func,
|
|
1211
|
+
appendToNode: PropTypes__default.default.any,
|
|
1212
|
+
isOpen: PropTypes__default.default.bool
|
|
1131
1213
|
};
|
|
1132
1214
|
const DrawerModal = DrawerModalComponent;
|
|
1133
1215
|
DrawerModal.Body = Body;
|
package/dist/index.esm.js
CHANGED
|
@@ -116,7 +116,7 @@ const COMPONENT_ID$j = 'modals.backdrop';
|
|
|
116
116
|
const animationName$1 = keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
|
|
117
117
|
const StyledBackdrop = styled.div.attrs({
|
|
118
118
|
'data-garden-id': COMPONENT_ID$j,
|
|
119
|
-
'data-garden-version': '8.62.
|
|
119
|
+
'data-garden-version': '8.62.2'
|
|
120
120
|
}).withConfig({
|
|
121
121
|
displayName: "StyledBackdrop",
|
|
122
122
|
componentId: "sc-mzdjpo-0"
|
|
@@ -132,7 +132,7 @@ StyledBackdrop.propTypes = {
|
|
|
132
132
|
const COMPONENT_ID$i = 'modals.body';
|
|
133
133
|
const StyledBody = styled.div.attrs({
|
|
134
134
|
'data-garden-id': COMPONENT_ID$i,
|
|
135
|
-
'data-garden-version': '8.62.
|
|
135
|
+
'data-garden-version': '8.62.2'
|
|
136
136
|
}).withConfig({
|
|
137
137
|
displayName: "StyledBody",
|
|
138
138
|
componentId: "sc-14rzecg-0"
|
|
@@ -154,7 +154,7 @@ const BASE_MULTIPLIERS$1 = {
|
|
|
154
154
|
};
|
|
155
155
|
const StyledClose = styled.button.attrs({
|
|
156
156
|
'data-garden-id': COMPONENT_ID$h,
|
|
157
|
-
'data-garden-version': '8.62.
|
|
157
|
+
'data-garden-version': '8.62.2'
|
|
158
158
|
}).withConfig({
|
|
159
159
|
displayName: "StyledClose",
|
|
160
160
|
componentId: "sc-iseudj-0"
|
|
@@ -166,7 +166,7 @@ StyledClose.defaultProps = {
|
|
|
166
166
|
const COMPONENT_ID$g = 'modals.footer';
|
|
167
167
|
const StyledFooter = styled.div.attrs({
|
|
168
168
|
'data-garden-id': COMPONENT_ID$g,
|
|
169
|
-
'data-garden-version': '8.62.
|
|
169
|
+
'data-garden-version': '8.62.2'
|
|
170
170
|
}).withConfig({
|
|
171
171
|
displayName: "StyledFooter",
|
|
172
172
|
componentId: "sc-d8pfdu-0"
|
|
@@ -178,7 +178,7 @@ StyledFooter.defaultProps = {
|
|
|
178
178
|
const COMPONENT_ID$f = 'modals.footer_item';
|
|
179
179
|
const StyledFooterItem = styled.span.attrs({
|
|
180
180
|
'data-garden-id': COMPONENT_ID$f,
|
|
181
|
-
'data-garden-version': '8.62.
|
|
181
|
+
'data-garden-version': '8.62.2'
|
|
182
182
|
}).withConfig({
|
|
183
183
|
displayName: "StyledFooterItem",
|
|
184
184
|
componentId: "sc-1mb76hl-0"
|
|
@@ -190,7 +190,7 @@ StyledFooterItem.defaultProps = {
|
|
|
190
190
|
const COMPONENT_ID$e = 'modals.header';
|
|
191
191
|
const StyledHeader = styled.div.attrs({
|
|
192
192
|
'data-garden-id': COMPONENT_ID$e,
|
|
193
|
-
'data-garden-version': '8.62.
|
|
193
|
+
'data-garden-version': '8.62.2'
|
|
194
194
|
}).withConfig({
|
|
195
195
|
displayName: "StyledHeader",
|
|
196
196
|
componentId: "sc-1787r9v-0"
|
|
@@ -258,7 +258,7 @@ const sizeStyles$1 = props => {
|
|
|
258
258
|
};
|
|
259
259
|
const StyledModal = styled.div.attrs({
|
|
260
260
|
'data-garden-id': COMPONENT_ID$d,
|
|
261
|
-
'data-garden-version': '8.62.
|
|
261
|
+
'data-garden-version': '8.62.2'
|
|
262
262
|
}).withConfig({
|
|
263
263
|
displayName: "StyledModal",
|
|
264
264
|
componentId: "sc-1pe1axu-0"
|
|
@@ -274,7 +274,7 @@ StyledModal.defaultProps = {
|
|
|
274
274
|
const COMPONENT_ID$c = 'modals.tooltip_modal.backdrop';
|
|
275
275
|
const StyledTooltipModalBackdrop = styled.div.attrs({
|
|
276
276
|
'data-garden-id': COMPONENT_ID$c,
|
|
277
|
-
'data-garden-version': '8.62.
|
|
277
|
+
'data-garden-version': '8.62.2'
|
|
278
278
|
}).withConfig({
|
|
279
279
|
displayName: "StyledTooltipModalBackdrop",
|
|
280
280
|
componentId: "sc-1yaomgq-0"
|
|
@@ -357,7 +357,7 @@ StyledTooltipWrapper.defaultProps = {
|
|
|
357
357
|
const COMPONENT_ID$b = 'modals.tooltip_modal';
|
|
358
358
|
const StyledTooltipModal = styled.div.attrs(props => ({
|
|
359
359
|
'data-garden-id': COMPONENT_ID$b,
|
|
360
|
-
'data-garden-version': '8.62.
|
|
360
|
+
'data-garden-version': '8.62.2',
|
|
361
361
|
className: props.isAnimated && 'is-animated'
|
|
362
362
|
})).withConfig({
|
|
363
363
|
displayName: "StyledTooltipModal",
|
|
@@ -386,7 +386,7 @@ const sizeStyles = props => `
|
|
|
386
386
|
`;
|
|
387
387
|
const StyledTooltipModalTitle = styled.div.attrs({
|
|
388
388
|
'data-garden-id': COMPONENT_ID$a,
|
|
389
|
-
'data-garden-version': '8.62.
|
|
389
|
+
'data-garden-version': '8.62.2'
|
|
390
390
|
}).withConfig({
|
|
391
391
|
displayName: "StyledTooltipModalTitle",
|
|
392
392
|
componentId: "sc-11xjgjs-0"
|
|
@@ -398,7 +398,7 @@ StyledTooltipModalTitle.defaultProps = {
|
|
|
398
398
|
const COMPONENT_ID$9 = 'modals.tooltip_modal.body';
|
|
399
399
|
const StyledTooltipModalBody = styled.div.attrs({
|
|
400
400
|
'data-garden-id': COMPONENT_ID$9,
|
|
401
|
-
'data-garden-version': '8.62.
|
|
401
|
+
'data-garden-version': '8.62.2'
|
|
402
402
|
}).withConfig({
|
|
403
403
|
displayName: "StyledTooltipModalBody",
|
|
404
404
|
componentId: "sc-195dkzj-0"
|
|
@@ -410,7 +410,7 @@ StyledTooltipModalBody.defaultProps = {
|
|
|
410
410
|
const COMPONENT_ID$8 = 'modals.tooltip_modal.footer';
|
|
411
411
|
const StyledTooltipModalFooter = styled.div.attrs({
|
|
412
412
|
'data-garden-id': COMPONENT_ID$8,
|
|
413
|
-
'data-garden-version': '8.62.
|
|
413
|
+
'data-garden-version': '8.62.2'
|
|
414
414
|
}).withConfig({
|
|
415
415
|
displayName: "StyledTooltipModalFooter",
|
|
416
416
|
componentId: "sc-fm36a9-0"
|
|
@@ -422,7 +422,7 @@ StyledTooltipModalFooter.defaultProps = {
|
|
|
422
422
|
const COMPONENT_ID$7 = 'modals.tooltip_modal.footer_item';
|
|
423
423
|
const StyledTooltipModalFooterItem = styled(StyledFooterItem).attrs({
|
|
424
424
|
'data-garden-id': COMPONENT_ID$7,
|
|
425
|
-
'data-garden-version': '8.62.
|
|
425
|
+
'data-garden-version': '8.62.2'
|
|
426
426
|
}).withConfig({
|
|
427
427
|
displayName: "StyledTooltipModalFooterItem",
|
|
428
428
|
componentId: "sc-1nahj6p-0"
|
|
@@ -434,7 +434,7 @@ StyledTooltipModalFooterItem.defaultProps = {
|
|
|
434
434
|
const COMPONENT_ID$6 = 'modals.tooltip_modal.close';
|
|
435
435
|
const StyledTooltipModalClose = styled(StyledClose).attrs({
|
|
436
436
|
'data-garden-id': COMPONENT_ID$6,
|
|
437
|
-
'data-garden-version': '8.62.
|
|
437
|
+
'data-garden-version': '8.62.2'
|
|
438
438
|
}).withConfig({
|
|
439
439
|
displayName: "StyledTooltipModalClose",
|
|
440
440
|
componentId: "sc-1h2ke3q-0"
|
|
@@ -460,7 +460,7 @@ const boxShadow = props => {
|
|
|
460
460
|
};
|
|
461
461
|
const StyledDrawerModal = styled.div.attrs({
|
|
462
462
|
'data-garden-id': COMPONENT_ID$5,
|
|
463
|
-
'data-garden-version': '8.62.
|
|
463
|
+
'data-garden-version': '8.62.2'
|
|
464
464
|
}).withConfig({
|
|
465
465
|
displayName: "StyledDrawerModal",
|
|
466
466
|
componentId: "sc-i1sake-0"
|
|
@@ -477,7 +477,7 @@ const BASE_MULTIPLIERS = {
|
|
|
477
477
|
};
|
|
478
478
|
const StyledDrawerModalClose = styled(StyledClose).attrs({
|
|
479
479
|
'data-garden-id': COMPONENT_ID$4,
|
|
480
|
-
'data-garden-version': '8.62.
|
|
480
|
+
'data-garden-version': '8.62.2'
|
|
481
481
|
}).withConfig({
|
|
482
482
|
displayName: "StyledDrawerModalClose",
|
|
483
483
|
componentId: "sc-hrnaom-0"
|
|
@@ -489,7 +489,7 @@ StyledDrawerModalClose.defaultProps = {
|
|
|
489
489
|
const COMPONENT_ID$3 = 'modals.drawer_modal.header';
|
|
490
490
|
const StyledDrawerModalHeader = styled(StyledHeader).attrs({
|
|
491
491
|
'data-garden-id': COMPONENT_ID$3,
|
|
492
|
-
'data-garden-version': '8.62.
|
|
492
|
+
'data-garden-version': '8.62.2'
|
|
493
493
|
}).withConfig({
|
|
494
494
|
displayName: "StyledDrawerModalHeader",
|
|
495
495
|
componentId: "sc-1u04rqw-0"
|
|
@@ -501,7 +501,7 @@ StyledDrawerModalHeader.defaultProps = {
|
|
|
501
501
|
const COMPONENT_ID$2 = 'modals.drawer_modal.body';
|
|
502
502
|
const StyledDrawerModalBody = styled(StyledBody).attrs({
|
|
503
503
|
'data-garden-id': COMPONENT_ID$2,
|
|
504
|
-
'data-garden-version': '8.62.
|
|
504
|
+
'data-garden-version': '8.62.2'
|
|
505
505
|
}).withConfig({
|
|
506
506
|
displayName: "StyledDrawerModalBody",
|
|
507
507
|
componentId: "sc-yafe2y-0"
|
|
@@ -513,7 +513,7 @@ StyledDrawerModalBody.defaultProps = {
|
|
|
513
513
|
const COMPONENT_ID$1 = 'modals.drawer_modal.footer';
|
|
514
514
|
const StyledDrawerModalFooter = styled.div.attrs({
|
|
515
515
|
'data-garden-id': COMPONENT_ID$1,
|
|
516
|
-
'data-garden-version': '8.62.
|
|
516
|
+
'data-garden-version': '8.62.2'
|
|
517
517
|
}).withConfig({
|
|
518
518
|
displayName: "StyledDrawerModalFooter",
|
|
519
519
|
componentId: "sc-17if4ka-0"
|
|
@@ -525,7 +525,7 @@ StyledDrawerModalFooter.defaultProps = {
|
|
|
525
525
|
const COMPONENT_ID = 'modals.drawer_modal.footer_item';
|
|
526
526
|
const StyledDrawerModalFooterItem = styled(StyledFooterItem).attrs({
|
|
527
527
|
'data-garden-id': COMPONENT_ID,
|
|
528
|
-
'data-garden-version': '8.62.
|
|
528
|
+
'data-garden-version': '8.62.2'
|
|
529
529
|
}).withConfig({
|
|
530
530
|
displayName: "StyledDrawerModalFooterItem",
|
|
531
531
|
componentId: "sc-1vbl885-0"
|
|
@@ -573,6 +573,7 @@ const Modal = forwardRef((_ref, ref) => {
|
|
|
573
573
|
const modalRef = useRef(null);
|
|
574
574
|
const environment = useDocument(theme);
|
|
575
575
|
const [isCloseButtonPresent, setIsCloseButtonPresent] = useState(false);
|
|
576
|
+
const [hasHeader, setHasHeader] = useState(false);
|
|
576
577
|
const {
|
|
577
578
|
getBackdropProps,
|
|
578
579
|
getModalProps,
|
|
@@ -630,11 +631,27 @@ const Modal = forwardRef((_ref, ref) => {
|
|
|
630
631
|
const value = useMemo(() => ({
|
|
631
632
|
isLarge,
|
|
632
633
|
isCloseButtonPresent,
|
|
634
|
+
hasHeader,
|
|
635
|
+
setHasHeader,
|
|
633
636
|
getTitleProps,
|
|
634
637
|
getContentProps,
|
|
635
638
|
getCloseProps,
|
|
636
639
|
setIsCloseButtonPresent
|
|
637
|
-
}), [isLarge, isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
640
|
+
}), [isLarge, hasHeader, isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
641
|
+
const modalContainerProps = getModalProps({
|
|
642
|
+
'aria-describedby': undefined,
|
|
643
|
+
...(hasHeader ? {} : {
|
|
644
|
+
'aria-labelledby': undefined
|
|
645
|
+
})
|
|
646
|
+
});
|
|
647
|
+
const attribute = hasHeader ? 'aria-labelledby' : 'aria-label';
|
|
648
|
+
const defaultValue = hasHeader ? modalContainerProps['aria-labelledby'] : 'Modal dialog';
|
|
649
|
+
const labelValue = hasHeader ? modalContainerProps['aria-labelledby'] : modalProps['aria-label'];
|
|
650
|
+
const ariaProps = {
|
|
651
|
+
[attribute]: useText(Modal, {
|
|
652
|
+
[attribute]: labelValue
|
|
653
|
+
}, attribute, defaultValue)
|
|
654
|
+
};
|
|
638
655
|
if (!rootNode) {
|
|
639
656
|
return null;
|
|
640
657
|
}
|
|
@@ -647,7 +664,7 @@ const Modal = forwardRef((_ref, ref) => {
|
|
|
647
664
|
isCentered: isCentered,
|
|
648
665
|
isAnimated: isAnimated,
|
|
649
666
|
isLarge: isLarge
|
|
650
|
-
},
|
|
667
|
+
}, modalContainerProps, ariaProps, modalProps, {
|
|
651
668
|
ref: mergeRefs([ref, modalRef])
|
|
652
669
|
}), children))), rootNode);
|
|
653
670
|
});
|
|
@@ -735,19 +752,30 @@ FooterItem$2.displayName = 'FooterItem';
|
|
|
735
752
|
const Header$1 = forwardRef((_ref, ref) => {
|
|
736
753
|
let {
|
|
737
754
|
children,
|
|
738
|
-
isDanger,
|
|
739
755
|
tag,
|
|
740
756
|
...other
|
|
741
757
|
} = _ref;
|
|
742
758
|
const {
|
|
743
759
|
isCloseButtonPresent,
|
|
760
|
+
hasHeader,
|
|
761
|
+
setHasHeader,
|
|
744
762
|
getTitleProps
|
|
745
763
|
} = useModalContext();
|
|
764
|
+
useEffect(() => {
|
|
765
|
+
if (!hasHeader && setHasHeader) {
|
|
766
|
+
setHasHeader(true);
|
|
767
|
+
}
|
|
768
|
+
return () => {
|
|
769
|
+
if (hasHeader && setHasHeader) {
|
|
770
|
+
setHasHeader(false);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
}, [hasHeader, setHasHeader]);
|
|
746
774
|
return React__default.createElement(StyledHeader, _extends$2({}, getTitleProps(other), {
|
|
747
775
|
as: tag,
|
|
748
776
|
isCloseButtonPresent: isCloseButtonPresent,
|
|
749
777
|
ref: ref
|
|
750
|
-
}), isDanger && React__default.createElement(StyledDangerIcon, null), children);
|
|
778
|
+
}), other.isDanger && React__default.createElement(StyledDangerIcon, null), children);
|
|
751
779
|
});
|
|
752
780
|
Header$1.displayName = 'Header';
|
|
753
781
|
Header$1.propTypes = {
|
|
@@ -774,8 +802,20 @@ const TitleComponent = forwardRef((_ref, ref) => {
|
|
|
774
802
|
...other
|
|
775
803
|
} = _ref;
|
|
776
804
|
const {
|
|
777
|
-
getTitleProps
|
|
805
|
+
getTitleProps,
|
|
806
|
+
hasTitle,
|
|
807
|
+
setHasTitle
|
|
778
808
|
} = useTooltipModalContext();
|
|
809
|
+
useEffect(() => {
|
|
810
|
+
if (!hasTitle && setHasTitle) {
|
|
811
|
+
setHasTitle(true);
|
|
812
|
+
}
|
|
813
|
+
return () => {
|
|
814
|
+
if (hasTitle && setHasTitle) {
|
|
815
|
+
setHasTitle(false);
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
}, [hasTitle, setHasTitle]);
|
|
779
819
|
return React__default.createElement(StyledTooltipModalTitle, _extends$2({}, getTitleProps(other), {
|
|
780
820
|
as: tag,
|
|
781
821
|
ref: ref
|
|
@@ -848,6 +888,7 @@ const TooltipModalComponent = React__default.forwardRef((_ref, ref) => {
|
|
|
848
888
|
const modalRef = useRef(null);
|
|
849
889
|
const transitionRef = useRef(null);
|
|
850
890
|
const [popperElement, setPopperElement] = useState();
|
|
891
|
+
const [hasTitle, setHasTitle] = useState(false);
|
|
851
892
|
const {
|
|
852
893
|
getTitleProps,
|
|
853
894
|
getCloseProps,
|
|
@@ -881,7 +922,23 @@ const TooltipModalComponent = React__default.forwardRef((_ref, ref) => {
|
|
|
881
922
|
}
|
|
882
923
|
}, ...(popperModifiers || [])]
|
|
883
924
|
});
|
|
925
|
+
const modalProps = getModalProps({
|
|
926
|
+
'aria-describedby': undefined,
|
|
927
|
+
...(hasTitle ? {} : {
|
|
928
|
+
'aria-labelledby': undefined
|
|
929
|
+
})
|
|
930
|
+
});
|
|
931
|
+
const attribute = hasTitle ? 'aria-labelledby' : 'aria-label';
|
|
932
|
+
const defaultValue = hasTitle ? modalProps['aria-labelledby'] : 'Modal dialog';
|
|
933
|
+
const labelValue = hasTitle ? modalProps['aria-labelledby'] : props['aria-label'];
|
|
934
|
+
const ariaProps = {
|
|
935
|
+
[attribute]: useText(TooltipModalComponent, {
|
|
936
|
+
[attribute]: labelValue
|
|
937
|
+
}, attribute, defaultValue)
|
|
938
|
+
};
|
|
884
939
|
const value = {
|
|
940
|
+
hasTitle,
|
|
941
|
+
setHasTitle,
|
|
885
942
|
getTitleProps,
|
|
886
943
|
getContentProps,
|
|
887
944
|
getCloseProps
|
|
@@ -908,7 +965,7 @@ const TooltipModalComponent = React__default.forwardRef((_ref, ref) => {
|
|
|
908
965
|
placement: state ? state.placement : 'top',
|
|
909
966
|
hasArrow: hasArrow,
|
|
910
967
|
isAnimated: isAnimated
|
|
911
|
-
},
|
|
968
|
+
}, modalProps, ariaProps, props, {
|
|
912
969
|
ref: mergeRefs([modalRef, ref])
|
|
913
970
|
})))));
|
|
914
971
|
});
|
|
@@ -916,7 +973,6 @@ const TooltipModalComponent = React__default.forwardRef((_ref, ref) => {
|
|
|
916
973
|
TooltipModalComponent.displayName = 'TooltipModal';
|
|
917
974
|
TooltipModalComponent.defaultProps = {
|
|
918
975
|
placement: 'auto',
|
|
919
|
-
isAnimated: true,
|
|
920
976
|
hasArrow: true,
|
|
921
977
|
focusOnMount: true,
|
|
922
978
|
restoreFocus: true
|
|
@@ -947,8 +1003,20 @@ const HeaderComponent = forwardRef((_ref, ref) => {
|
|
|
947
1003
|
} = _ref;
|
|
948
1004
|
const {
|
|
949
1005
|
isCloseButtonPresent,
|
|
1006
|
+
hasHeader,
|
|
1007
|
+
setHasHeader,
|
|
950
1008
|
getTitleProps
|
|
951
1009
|
} = useModalContext();
|
|
1010
|
+
useEffect(() => {
|
|
1011
|
+
if (!hasHeader && setHasHeader) {
|
|
1012
|
+
setHasHeader(true);
|
|
1013
|
+
}
|
|
1014
|
+
return () => {
|
|
1015
|
+
if (hasHeader && setHasHeader) {
|
|
1016
|
+
setHasHeader(false);
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
}, [hasHeader, setHasHeader]);
|
|
952
1020
|
return React__default.createElement(StyledDrawerModalHeader, _extends$2({}, getTitleProps(other), {
|
|
953
1021
|
as: tag,
|
|
954
1022
|
isCloseButtonPresent: isCloseButtonPresent,
|
|
@@ -1023,6 +1091,7 @@ const DrawerModalComponent = forwardRef((_ref, ref) => {
|
|
|
1023
1091
|
const theme = useContext(ThemeContext);
|
|
1024
1092
|
const environment = useDocument(theme);
|
|
1025
1093
|
const [isCloseButtonPresent, setIsCloseButtonPresent] = useState(false);
|
|
1094
|
+
const [hasHeader, setHasHeader] = useState(false);
|
|
1026
1095
|
useFocusVisible({
|
|
1027
1096
|
scope: modalRef,
|
|
1028
1097
|
relativeDocument: modalRef.current
|
|
@@ -1068,11 +1137,27 @@ const DrawerModalComponent = forwardRef((_ref, ref) => {
|
|
|
1068
1137
|
}, [appendToNode, environment]);
|
|
1069
1138
|
const value = useMemo(() => ({
|
|
1070
1139
|
isCloseButtonPresent,
|
|
1140
|
+
hasHeader,
|
|
1141
|
+
setHasHeader,
|
|
1071
1142
|
getTitleProps,
|
|
1072
1143
|
getContentProps,
|
|
1073
1144
|
getCloseProps,
|
|
1074
1145
|
setIsCloseButtonPresent
|
|
1075
|
-
}), [isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
1146
|
+
}), [isCloseButtonPresent, hasHeader, getTitleProps, getContentProps, getCloseProps]);
|
|
1147
|
+
const modalProps = getModalProps({
|
|
1148
|
+
'aria-describedby': undefined,
|
|
1149
|
+
...(hasHeader ? {} : {
|
|
1150
|
+
'aria-labelledby': undefined
|
|
1151
|
+
})
|
|
1152
|
+
});
|
|
1153
|
+
const attribute = hasHeader ? 'aria-labelledby' : 'aria-label';
|
|
1154
|
+
const defaultValue = hasHeader ? modalProps['aria-labelledby'] : 'Modal dialog';
|
|
1155
|
+
const labelValue = hasHeader ? modalProps['aria-labelledby'] : props['aria-label'];
|
|
1156
|
+
const ariaProps = {
|
|
1157
|
+
[attribute]: useText(DrawerModalComponent, {
|
|
1158
|
+
[attribute]: labelValue
|
|
1159
|
+
}, attribute, defaultValue)
|
|
1160
|
+
};
|
|
1076
1161
|
if (!rootNode) {
|
|
1077
1162
|
return null;
|
|
1078
1163
|
}
|
|
@@ -1086,7 +1171,7 @@ const DrawerModalComponent = forwardRef((_ref, ref) => {
|
|
|
1086
1171
|
nodeRef: transitionRef
|
|
1087
1172
|
}, React__default.createElement(StyledBackdrop, _extends$2({
|
|
1088
1173
|
isAnimated: true
|
|
1089
|
-
}, getBackdropProps(backdropProps)), React__default.createElement(StyledDrawerModal, _extends$2({},
|
|
1174
|
+
}, getBackdropProps(backdropProps)), React__default.createElement(StyledDrawerModal, _extends$2({}, modalProps, ariaProps, props, {
|
|
1090
1175
|
ref: mergeRefs([ref, modalRef, transitionRef])
|
|
1091
1176
|
}))))), rootNode);
|
|
1092
1177
|
});
|
|
@@ -8,6 +8,8 @@ import { IUseModalReturnValue } from '@zendeskgarden/container-modal';
|
|
|
8
8
|
export interface IModalContext {
|
|
9
9
|
isLarge?: boolean;
|
|
10
10
|
isCloseButtonPresent?: boolean;
|
|
11
|
+
hasHeader: boolean;
|
|
12
|
+
setHasHeader: (hasHeader: boolean) => void;
|
|
11
13
|
getTitleProps: IUseModalReturnValue['getTitleProps'];
|
|
12
14
|
getContentProps: IUseModalReturnValue['getContentProps'];
|
|
13
15
|
getCloseProps: IUseModalReturnValue['getCloseProps'];
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { IUseModalReturnValue } from '@zendeskgarden/container-modal';
|
|
8
8
|
export interface IModalContext {
|
|
9
|
+
hasTitle: boolean;
|
|
10
|
+
setHasTitle: (isPresent: boolean) => void;
|
|
9
11
|
getTitleProps: IUseModalReturnValue['getTitleProps'];
|
|
10
12
|
getContentProps: IUseModalReturnValue['getContentProps'];
|
|
11
13
|
getCloseProps: IUseModalReturnValue['getCloseProps'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-modals",
|
|
3
|
-
"version": "8.62.
|
|
3
|
+
"version": "8.62.2",
|
|
4
4
|
"description": "Components relating to modals in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/react-transition-group": "4.4.5",
|
|
42
|
-
"@zendeskgarden/react-theming": "^8.62.
|
|
42
|
+
"@zendeskgarden/react-theming": "^8.62.2",
|
|
43
43
|
"@zendeskgarden/svg-icons": "6.33.0"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"zendeskgarden:src": "src/index.ts",
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "27a7d6c021f3360396af60d51ecbf66e9076a405"
|
|
56
56
|
}
|