@zendeskgarden/react-modals 8.62.1 → 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 +178 -124
- package/dist/index.esm.js +83 -26
- package/dist/typings/utils/useModalContext.d.ts +2 -0
- package/package.json +3 -3
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';
|
|
@@ -770,18 +784,30 @@ const Header$1 = React.forwardRef((_ref, ref) => {
|
|
|
770
784
|
} = _ref;
|
|
771
785
|
const {
|
|
772
786
|
isCloseButtonPresent,
|
|
787
|
+
hasHeader,
|
|
788
|
+
setHasHeader,
|
|
773
789
|
getTitleProps
|
|
774
790
|
} = useModalContext();
|
|
775
|
-
|
|
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), {
|
|
776
802
|
as: tag,
|
|
777
803
|
isCloseButtonPresent: isCloseButtonPresent,
|
|
778
804
|
ref: ref
|
|
779
|
-
}), other.isDanger &&
|
|
805
|
+
}), other.isDanger && React__namespace.default.createElement(StyledDangerIcon, null), children);
|
|
780
806
|
});
|
|
781
807
|
Header$1.displayName = 'Header';
|
|
782
808
|
Header$1.propTypes = {
|
|
783
|
-
isDanger: PropTypes__default
|
|
784
|
-
tag: PropTypes__default
|
|
809
|
+
isDanger: PropTypes__default.default.bool,
|
|
810
|
+
tag: PropTypes__default.default.any
|
|
785
811
|
};
|
|
786
812
|
Header$1.defaultProps = {
|
|
787
813
|
tag: 'div'
|
|
@@ -817,14 +843,14 @@ const TitleComponent = React.forwardRef((_ref, ref) => {
|
|
|
817
843
|
}
|
|
818
844
|
};
|
|
819
845
|
}, [hasTitle, setHasTitle]);
|
|
820
|
-
return
|
|
846
|
+
return React__namespace.default.createElement(StyledTooltipModalTitle, _extends$2({}, getTitleProps(other), {
|
|
821
847
|
as: tag,
|
|
822
848
|
ref: ref
|
|
823
849
|
}), children);
|
|
824
850
|
});
|
|
825
851
|
TitleComponent.displayName = 'TooltipModal.Title';
|
|
826
852
|
TitleComponent.propTypes = {
|
|
827
|
-
tag: PropTypes__default
|
|
853
|
+
tag: PropTypes__default.default.any
|
|
828
854
|
};
|
|
829
855
|
TitleComponent.defaultProps = {
|
|
830
856
|
tag: 'div'
|
|
@@ -835,7 +861,7 @@ const BodyComponent$1 = React.forwardRef((props, ref) => {
|
|
|
835
861
|
const {
|
|
836
862
|
getContentProps
|
|
837
863
|
} = useTooltipModalContext();
|
|
838
|
-
return
|
|
864
|
+
return React__namespace.default.createElement(StyledTooltipModalBody, _extends$2({}, getContentProps(props), {
|
|
839
865
|
ref: ref
|
|
840
866
|
}));
|
|
841
867
|
});
|
|
@@ -847,29 +873,29 @@ const CloseComponent$1 = React.forwardRef((props, ref) => {
|
|
|
847
873
|
getCloseProps
|
|
848
874
|
} = useTooltipModalContext();
|
|
849
875
|
const ariaLabel = reactTheming.useText(CloseComponent$1, props, 'aria-label', 'Close tooltip');
|
|
850
|
-
return
|
|
876
|
+
return React__namespace.default.createElement(StyledTooltipModalClose, _extends$2({}, getCloseProps({
|
|
851
877
|
...props,
|
|
852
878
|
'aria-label': ariaLabel
|
|
853
879
|
}), {
|
|
854
880
|
ref: ref
|
|
855
|
-
}),
|
|
881
|
+
}), React__namespace.default.createElement(SvgXStroke, null));
|
|
856
882
|
});
|
|
857
883
|
CloseComponent$1.displayName = 'TooltipModal.Close';
|
|
858
884
|
const Close$1 = CloseComponent$1;
|
|
859
885
|
|
|
860
|
-
const FooterComponent$1 = React.forwardRef((props, ref) =>
|
|
886
|
+
const FooterComponent$1 = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledTooltipModalFooter, _extends$2({
|
|
861
887
|
ref: ref
|
|
862
888
|
}, props)));
|
|
863
889
|
FooterComponent$1.displayName = 'TooltipModal.Footer';
|
|
864
890
|
const Footer$1 = FooterComponent$1;
|
|
865
891
|
|
|
866
|
-
const FooterItemComponent$1 = React.forwardRef((props, ref) =>
|
|
892
|
+
const FooterItemComponent$1 = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledTooltipModalFooterItem, _extends$2({
|
|
867
893
|
ref: ref
|
|
868
894
|
}, props)));
|
|
869
895
|
FooterItemComponent$1.displayName = 'TooltipModal.FooterItem';
|
|
870
896
|
const FooterItem$1 = FooterItemComponent$1;
|
|
871
897
|
|
|
872
|
-
const TooltipModalComponent =
|
|
898
|
+
const TooltipModalComponent = React__namespace.default.forwardRef((_ref, ref) => {
|
|
873
899
|
let {
|
|
874
900
|
referenceElement,
|
|
875
901
|
popperModifiers,
|
|
@@ -930,7 +956,7 @@ const TooltipModalComponent = React__default["default"].forwardRef((_ref, ref) =
|
|
|
930
956
|
})
|
|
931
957
|
});
|
|
932
958
|
const attribute = hasTitle ? 'aria-labelledby' : 'aria-label';
|
|
933
|
-
const defaultValue = hasTitle ?
|
|
959
|
+
const defaultValue = hasTitle ? modalProps['aria-labelledby'] : 'Modal dialog';
|
|
934
960
|
const labelValue = hasTitle ? modalProps['aria-labelledby'] : props['aria-label'];
|
|
935
961
|
const ariaProps = {
|
|
936
962
|
[attribute]: reactTheming.useText(TooltipModalComponent, {
|
|
@@ -944,52 +970,51 @@ const TooltipModalComponent = React__default["default"].forwardRef((_ref, ref) =
|
|
|
944
970
|
getContentProps,
|
|
945
971
|
getCloseProps
|
|
946
972
|
};
|
|
947
|
-
return
|
|
973
|
+
return React__namespace.default.createElement(reactTransitionGroup.CSSTransition, {
|
|
948
974
|
unmountOnExit: true,
|
|
949
975
|
timeout: isAnimated ? 200 : 0,
|
|
950
976
|
in: Boolean(referenceElement),
|
|
951
977
|
classNames: isAnimated ? 'garden-tooltip-modal-transition' : '',
|
|
952
978
|
nodeRef: transitionRef
|
|
953
979
|
}, transitionState => {
|
|
954
|
-
return
|
|
980
|
+
return React__namespace.default.createElement(TooltipModalContext.Provider, {
|
|
955
981
|
value: value
|
|
956
|
-
},
|
|
982
|
+
}, React__namespace.default.createElement(StyledTooltipModalBackdrop, _extends$2({}, getBackdropProps(), backdropProps, {
|
|
957
983
|
ref: transitionRef
|
|
958
|
-
}),
|
|
984
|
+
}), React__namespace.default.createElement(StyledTooltipWrapper, _extends$2({
|
|
959
985
|
ref: setPopperElement,
|
|
960
986
|
style: styles.popper,
|
|
961
987
|
placement: state ? state.placement : undefined,
|
|
962
988
|
zIndex: zIndex,
|
|
963
989
|
isAnimated: isAnimated
|
|
964
|
-
}, attributes.popper),
|
|
990
|
+
}, attributes.popper), React__namespace.default.createElement(StyledTooltipModal, _extends$2({
|
|
965
991
|
transitionState: transitionState,
|
|
966
992
|
placement: state ? state.placement : 'top',
|
|
967
993
|
hasArrow: hasArrow,
|
|
968
994
|
isAnimated: isAnimated
|
|
969
995
|
}, modalProps, ariaProps, props, {
|
|
970
|
-
ref: mergeRefs__default
|
|
996
|
+
ref: mergeRefs__default.default([modalRef, ref])
|
|
971
997
|
})))));
|
|
972
998
|
});
|
|
973
999
|
});
|
|
974
1000
|
TooltipModalComponent.displayName = 'TooltipModal';
|
|
975
1001
|
TooltipModalComponent.defaultProps = {
|
|
976
1002
|
placement: 'auto',
|
|
977
|
-
isAnimated: true,
|
|
978
1003
|
hasArrow: true,
|
|
979
1004
|
focusOnMount: true,
|
|
980
1005
|
restoreFocus: true
|
|
981
1006
|
};
|
|
982
1007
|
TooltipModalComponent.propTypes = {
|
|
983
|
-
referenceElement: PropTypes__default
|
|
984
|
-
popperModifiers: PropTypes__default
|
|
985
|
-
placement: PropTypes__default
|
|
986
|
-
isAnimated: PropTypes__default
|
|
987
|
-
hasArrow: PropTypes__default
|
|
988
|
-
zIndex: PropTypes__default
|
|
989
|
-
onClose: PropTypes__default
|
|
990
|
-
backdropProps: PropTypes__default
|
|
991
|
-
focusOnMount: PropTypes__default
|
|
992
|
-
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
|
|
993
1018
|
};
|
|
994
1019
|
const TooltipModal = TooltipModalComponent;
|
|
995
1020
|
TooltipModal.Body = Body$1;
|
|
@@ -1005,9 +1030,21 @@ const HeaderComponent = React.forwardRef((_ref, ref) => {
|
|
|
1005
1030
|
} = _ref;
|
|
1006
1031
|
const {
|
|
1007
1032
|
isCloseButtonPresent,
|
|
1033
|
+
hasHeader,
|
|
1034
|
+
setHasHeader,
|
|
1008
1035
|
getTitleProps
|
|
1009
1036
|
} = useModalContext();
|
|
1010
|
-
|
|
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), {
|
|
1011
1048
|
as: tag,
|
|
1012
1049
|
isCloseButtonPresent: isCloseButtonPresent,
|
|
1013
1050
|
ref: ref
|
|
@@ -1015,7 +1052,7 @@ const HeaderComponent = React.forwardRef((_ref, ref) => {
|
|
|
1015
1052
|
});
|
|
1016
1053
|
HeaderComponent.displayName = 'DrawerModal.Header';
|
|
1017
1054
|
HeaderComponent.propTypes = {
|
|
1018
|
-
tag: PropTypes__default
|
|
1055
|
+
tag: PropTypes__default.default.any
|
|
1019
1056
|
};
|
|
1020
1057
|
HeaderComponent.defaultProps = {
|
|
1021
1058
|
tag: 'div'
|
|
@@ -1026,7 +1063,7 @@ const BodyComponent = React.forwardRef((props, ref) => {
|
|
|
1026
1063
|
const {
|
|
1027
1064
|
getContentProps
|
|
1028
1065
|
} = useModalContext();
|
|
1029
|
-
return
|
|
1066
|
+
return React__namespace.default.createElement(StyledDrawerModalBody, _extends$2({}, getContentProps(props), {
|
|
1030
1067
|
ref: ref
|
|
1031
1068
|
}), props.children);
|
|
1032
1069
|
});
|
|
@@ -1043,23 +1080,23 @@ const CloseComponent = React.forwardRef((props, ref) => {
|
|
|
1043
1080
|
return () => setIsCloseButtonPresent(false);
|
|
1044
1081
|
});
|
|
1045
1082
|
const ariaLabel = reactTheming.useText(CloseComponent, props, 'aria-label', 'Close drawer');
|
|
1046
|
-
return
|
|
1083
|
+
return React__namespace.default.createElement(StyledDrawerModalClose, _extends$2({}, getCloseProps({
|
|
1047
1084
|
...props,
|
|
1048
1085
|
'aria-label': ariaLabel
|
|
1049
1086
|
}), {
|
|
1050
1087
|
ref: ref
|
|
1051
|
-
}),
|
|
1088
|
+
}), React__namespace.default.createElement(SvgXStroke, null));
|
|
1052
1089
|
});
|
|
1053
1090
|
CloseComponent.displayName = 'DrawerModal.Close';
|
|
1054
1091
|
const Close = CloseComponent;
|
|
1055
1092
|
|
|
1056
|
-
const FooterComponent = React.forwardRef((props, ref) =>
|
|
1093
|
+
const FooterComponent = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledDrawerModalFooter, _extends$2({
|
|
1057
1094
|
ref: ref
|
|
1058
1095
|
}, props)));
|
|
1059
1096
|
FooterComponent.displayName = 'DrawerModal.Footer';
|
|
1060
1097
|
const Footer = FooterComponent;
|
|
1061
1098
|
|
|
1062
|
-
const FooterItemComponent = React.forwardRef((props, ref) =>
|
|
1099
|
+
const FooterItemComponent = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledDrawerModalFooterItem, _extends$2({
|
|
1063
1100
|
ref: ref
|
|
1064
1101
|
}, props)));
|
|
1065
1102
|
FooterItemComponent.displayName = 'DrawerModal.FooterItem';
|
|
@@ -1081,6 +1118,7 @@ const DrawerModalComponent = React.forwardRef((_ref, ref) => {
|
|
|
1081
1118
|
const theme = React.useContext(styled.ThemeContext);
|
|
1082
1119
|
const environment = reactTheming.useDocument(theme);
|
|
1083
1120
|
const [isCloseButtonPresent, setIsCloseButtonPresent] = React.useState(false);
|
|
1121
|
+
const [hasHeader, setHasHeader] = React.useState(false);
|
|
1084
1122
|
containerFocusvisible.useFocusVisible({
|
|
1085
1123
|
scope: modalRef,
|
|
1086
1124
|
relativeDocument: modalRef.current
|
|
@@ -1126,36 +1164,52 @@ const DrawerModalComponent = React.forwardRef((_ref, ref) => {
|
|
|
1126
1164
|
}, [appendToNode, environment]);
|
|
1127
1165
|
const value = React.useMemo(() => ({
|
|
1128
1166
|
isCloseButtonPresent,
|
|
1167
|
+
hasHeader,
|
|
1168
|
+
setHasHeader,
|
|
1129
1169
|
getTitleProps,
|
|
1130
1170
|
getContentProps,
|
|
1131
1171
|
getCloseProps,
|
|
1132
1172
|
setIsCloseButtonPresent
|
|
1133
|
-
}), [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
|
+
};
|
|
1134
1188
|
if (!rootNode) {
|
|
1135
1189
|
return null;
|
|
1136
1190
|
}
|
|
1137
|
-
return ReactDOM__default
|
|
1191
|
+
return ReactDOM__default.default.createPortal( React__namespace.default.createElement(ModalsContext.Provider, {
|
|
1138
1192
|
value: value
|
|
1139
|
-
},
|
|
1193
|
+
}, React__namespace.default.createElement(reactTransitionGroup.CSSTransition, {
|
|
1140
1194
|
in: isOpen,
|
|
1141
1195
|
timeout: 250,
|
|
1142
1196
|
unmountOnExit: true,
|
|
1143
1197
|
classNames: "garden-drawer-transition",
|
|
1144
1198
|
nodeRef: transitionRef
|
|
1145
|
-
},
|
|
1199
|
+
}, React__namespace.default.createElement(StyledBackdrop, _extends$2({
|
|
1146
1200
|
isAnimated: true
|
|
1147
|
-
}, getBackdropProps(backdropProps)),
|
|
1148
|
-
ref: mergeRefs__default
|
|
1201
|
+
}, getBackdropProps(backdropProps)), React__namespace.default.createElement(StyledDrawerModal, _extends$2({}, modalProps, ariaProps, props, {
|
|
1202
|
+
ref: mergeRefs__default.default([ref, modalRef, transitionRef])
|
|
1149
1203
|
}))))), rootNode);
|
|
1150
1204
|
});
|
|
1151
1205
|
DrawerModalComponent.displayName = 'DrawerModal';
|
|
1152
1206
|
DrawerModalComponent.propTypes = {
|
|
1153
|
-
backdropProps: PropTypes__default
|
|
1154
|
-
focusOnMount: PropTypes__default
|
|
1155
|
-
restoreFocus: PropTypes__default
|
|
1156
|
-
onClose: PropTypes__default
|
|
1157
|
-
appendToNode: PropTypes__default
|
|
1158
|
-
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
|
|
1159
1213
|
};
|
|
1160
1214
|
const DrawerModal = DrawerModalComponent;
|
|
1161
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
|
});
|
|
@@ -740,8 +757,20 @@ const Header$1 = forwardRef((_ref, ref) => {
|
|
|
740
757
|
} = _ref;
|
|
741
758
|
const {
|
|
742
759
|
isCloseButtonPresent,
|
|
760
|
+
hasHeader,
|
|
761
|
+
setHasHeader,
|
|
743
762
|
getTitleProps
|
|
744
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]);
|
|
745
774
|
return React__default.createElement(StyledHeader, _extends$2({}, getTitleProps(other), {
|
|
746
775
|
as: tag,
|
|
747
776
|
isCloseButtonPresent: isCloseButtonPresent,
|
|
@@ -900,7 +929,7 @@ const TooltipModalComponent = React__default.forwardRef((_ref, ref) => {
|
|
|
900
929
|
})
|
|
901
930
|
});
|
|
902
931
|
const attribute = hasTitle ? 'aria-labelledby' : 'aria-label';
|
|
903
|
-
const defaultValue = hasTitle ?
|
|
932
|
+
const defaultValue = hasTitle ? modalProps['aria-labelledby'] : 'Modal dialog';
|
|
904
933
|
const labelValue = hasTitle ? modalProps['aria-labelledby'] : props['aria-label'];
|
|
905
934
|
const ariaProps = {
|
|
906
935
|
[attribute]: useText(TooltipModalComponent, {
|
|
@@ -944,7 +973,6 @@ const TooltipModalComponent = React__default.forwardRef((_ref, ref) => {
|
|
|
944
973
|
TooltipModalComponent.displayName = 'TooltipModal';
|
|
945
974
|
TooltipModalComponent.defaultProps = {
|
|
946
975
|
placement: 'auto',
|
|
947
|
-
isAnimated: true,
|
|
948
976
|
hasArrow: true,
|
|
949
977
|
focusOnMount: true,
|
|
950
978
|
restoreFocus: true
|
|
@@ -975,8 +1003,20 @@ const HeaderComponent = forwardRef((_ref, ref) => {
|
|
|
975
1003
|
} = _ref;
|
|
976
1004
|
const {
|
|
977
1005
|
isCloseButtonPresent,
|
|
1006
|
+
hasHeader,
|
|
1007
|
+
setHasHeader,
|
|
978
1008
|
getTitleProps
|
|
979
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]);
|
|
980
1020
|
return React__default.createElement(StyledDrawerModalHeader, _extends$2({}, getTitleProps(other), {
|
|
981
1021
|
as: tag,
|
|
982
1022
|
isCloseButtonPresent: isCloseButtonPresent,
|
|
@@ -1051,6 +1091,7 @@ const DrawerModalComponent = forwardRef((_ref, ref) => {
|
|
|
1051
1091
|
const theme = useContext(ThemeContext);
|
|
1052
1092
|
const environment = useDocument(theme);
|
|
1053
1093
|
const [isCloseButtonPresent, setIsCloseButtonPresent] = useState(false);
|
|
1094
|
+
const [hasHeader, setHasHeader] = useState(false);
|
|
1054
1095
|
useFocusVisible({
|
|
1055
1096
|
scope: modalRef,
|
|
1056
1097
|
relativeDocument: modalRef.current
|
|
@@ -1096,11 +1137,27 @@ const DrawerModalComponent = forwardRef((_ref, ref) => {
|
|
|
1096
1137
|
}, [appendToNode, environment]);
|
|
1097
1138
|
const value = useMemo(() => ({
|
|
1098
1139
|
isCloseButtonPresent,
|
|
1140
|
+
hasHeader,
|
|
1141
|
+
setHasHeader,
|
|
1099
1142
|
getTitleProps,
|
|
1100
1143
|
getContentProps,
|
|
1101
1144
|
getCloseProps,
|
|
1102
1145
|
setIsCloseButtonPresent
|
|
1103
|
-
}), [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
|
+
};
|
|
1104
1161
|
if (!rootNode) {
|
|
1105
1162
|
return null;
|
|
1106
1163
|
}
|
|
@@ -1114,7 +1171,7 @@ const DrawerModalComponent = forwardRef((_ref, ref) => {
|
|
|
1114
1171
|
nodeRef: transitionRef
|
|
1115
1172
|
}, React__default.createElement(StyledBackdrop, _extends$2({
|
|
1116
1173
|
isAnimated: true
|
|
1117
|
-
}, getBackdropProps(backdropProps)), React__default.createElement(StyledDrawerModal, _extends$2({},
|
|
1174
|
+
}, getBackdropProps(backdropProps)), React__default.createElement(StyledDrawerModal, _extends$2({}, modalProps, ariaProps, props, {
|
|
1118
1175
|
ref: mergeRefs([ref, modalRef, transitionRef])
|
|
1119
1176
|
}))))), rootNode);
|
|
1120
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'];
|
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
|
}
|