@zendeskgarden/react-modals 8.48.2 → 8.49.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 +95 -53
- package/dist/index.esm.js +97 -55
- package/dist/typings/elements/DrawerModal/DrawerModal.d.ts +1 -1
- package/dist/typings/elements/Modal.d.ts +1 -1
- package/dist/typings/elements/TooltipModal/TooltipModal.d.ts +1 -1
- package/dist/typings/styled/StyledClose.d.ts +5 -0
- package/dist/typings/styled/StyledDrawerModalClose.d.ts +5 -0
- package/dist/typings/styled/StyledDrawerModalHeader.d.ts +4 -0
- package/dist/typings/styled/StyledHeader.d.ts +5 -0
- package/dist/typings/utils/useModalContext.d.ts +2 -0
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -301,7 +301,7 @@ var COMPONENT_ID$j = 'modals.backdrop';
|
|
|
301
301
|
var animationName$1 = styled.keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
|
|
302
302
|
var StyledBackdrop = styled__default["default"].div.attrs({
|
|
303
303
|
'data-garden-id': COMPONENT_ID$j,
|
|
304
|
-
'data-garden-version': '8.
|
|
304
|
+
'data-garden-version': '8.49.2'
|
|
305
305
|
}).withConfig({
|
|
306
306
|
displayName: "StyledBackdrop",
|
|
307
307
|
componentId: "sc-mzdjpo-0"
|
|
@@ -331,7 +331,7 @@ StyledBackdrop.propTypes = {
|
|
|
331
331
|
var COMPONENT_ID$i = 'modals.body';
|
|
332
332
|
var StyledBody = styled__default["default"].div.attrs({
|
|
333
333
|
'data-garden-id': COMPONENT_ID$i,
|
|
334
|
-
'data-garden-version': '8.
|
|
334
|
+
'data-garden-version': '8.49.2'
|
|
335
335
|
}).withConfig({
|
|
336
336
|
displayName: "StyledBody",
|
|
337
337
|
componentId: "sc-14rzecg-0"
|
|
@@ -356,22 +356,27 @@ var colorStyles = function colorStyles(props) {
|
|
|
356
356
|
var foregroundColor = 'neutralHue';
|
|
357
357
|
return styled.css(["background-color:transparent;color:", ";&:hover{background-color:", ";color:", ";}&[data-garden-focus-visible]{box-shadow:", ";}&:active{transition:background-color 0.1s ease-in-out,color 0.1s ease-in-out;background-color:", ";color:", ";}"], reactTheming.getColor(foregroundColor, 600, props.theme), reactTheming.getColor(backgroundColor, 600, props.theme, 0.08), reactTheming.getColor(foregroundColor, 700, props.theme), props.theme.shadows.md(reactTheming.getColor(backgroundColor, 600, props.theme, 0.35)), reactTheming.getColor(backgroundColor, 600, props.theme, 0.2), reactTheming.getColor(foregroundColor, 800, props.theme));
|
|
358
358
|
};
|
|
359
|
+
var BASE_MULTIPLIERS$1 = {
|
|
360
|
+
top: 2.5,
|
|
361
|
+
side: 6.5,
|
|
362
|
+
size: 10
|
|
363
|
+
};
|
|
359
364
|
var StyledClose = styled__default["default"].button.attrs({
|
|
360
365
|
'data-garden-id': COMPONENT_ID$h,
|
|
361
|
-
'data-garden-version': '8.
|
|
366
|
+
'data-garden-version': '8.49.2'
|
|
362
367
|
}).withConfig({
|
|
363
368
|
displayName: "StyledClose",
|
|
364
369
|
componentId: "sc-iseudj-0"
|
|
365
370
|
})(["display:block;position:absolute;top:", "px;", ":", ";transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out;border:none;border-radius:50%;background-color:transparent;cursor:pointer;padding:0;width:", "px;height:", "px;overflow:hidden;text-decoration:none;font-size:0;user-select:none;&::-moz-focus-inner{border:0;}&:focus{outline:none;}", " & > svg{vertical-align:middle;}", ";"], function (props) {
|
|
366
|
-
return props.theme.space.base *
|
|
371
|
+
return props.theme.space.base * BASE_MULTIPLIERS$1.top;
|
|
367
372
|
}, function (props) {
|
|
368
373
|
return props.theme.rtl ? 'left' : 'right';
|
|
369
374
|
}, function (props) {
|
|
370
|
-
return "".concat(props.theme.space.base *
|
|
375
|
+
return "".concat(props.theme.space.base * BASE_MULTIPLIERS$1.side, "px");
|
|
371
376
|
}, function (props) {
|
|
372
|
-
return props.theme.space.base *
|
|
377
|
+
return props.theme.space.base * BASE_MULTIPLIERS$1.size;
|
|
373
378
|
}, function (props) {
|
|
374
|
-
return props.theme.space.base *
|
|
379
|
+
return props.theme.space.base * BASE_MULTIPLIERS$1.size;
|
|
375
380
|
}, function (props) {
|
|
376
381
|
return colorStyles(props);
|
|
377
382
|
}, function (props) {
|
|
@@ -384,7 +389,7 @@ StyledClose.defaultProps = {
|
|
|
384
389
|
var COMPONENT_ID$g = 'modals.footer';
|
|
385
390
|
var StyledFooter = styled__default["default"].div.attrs({
|
|
386
391
|
'data-garden-id': COMPONENT_ID$g,
|
|
387
|
-
'data-garden-version': '8.
|
|
392
|
+
'data-garden-version': '8.49.2'
|
|
388
393
|
}).withConfig({
|
|
389
394
|
displayName: "StyledFooter",
|
|
390
395
|
componentId: "sc-d8pfdu-0"
|
|
@@ -402,7 +407,7 @@ StyledFooter.defaultProps = {
|
|
|
402
407
|
var COMPONENT_ID$f = 'modals.footer_item';
|
|
403
408
|
var StyledFooterItem = styled__default["default"].span.attrs({
|
|
404
409
|
'data-garden-id': COMPONENT_ID$f,
|
|
405
|
-
'data-garden-version': '8.
|
|
410
|
+
'data-garden-version': '8.49.2'
|
|
406
411
|
}).withConfig({
|
|
407
412
|
displayName: "StyledFooterItem",
|
|
408
413
|
componentId: "sc-1mb76hl-0"
|
|
@@ -422,16 +427,18 @@ StyledFooterItem.defaultProps = {
|
|
|
422
427
|
var COMPONENT_ID$e = 'modals.header';
|
|
423
428
|
var StyledHeader = styled__default["default"].div.attrs({
|
|
424
429
|
'data-garden-id': COMPONENT_ID$e,
|
|
425
|
-
'data-garden-version': '8.
|
|
430
|
+
'data-garden-version': '8.49.2'
|
|
426
431
|
}).withConfig({
|
|
427
432
|
displayName: "StyledHeader",
|
|
428
433
|
componentId: "sc-1787r9v-0"
|
|
429
|
-
})(["display:block;position:", ";margin:0;border-bottom:", " ", ";padding:", ";line-height:", ";color:", ";font-size:", ";font-weight:", ";", ";"], function (props) {
|
|
434
|
+
})(["display:block;position:", ";margin:0;border-bottom:", " ", ";padding:", ";", " line-height:", ";color:", ";font-size:", ";font-weight:", ";", ";"], function (props) {
|
|
430
435
|
return props.isDanger && 'relative';
|
|
431
436
|
}, function (props) {
|
|
432
437
|
return props.theme.borders.sm;
|
|
433
438
|
}, reactTheming.getColor('neutralHue', 200), function (props) {
|
|
434
439
|
return "".concat(props.theme.space.base * 5, "px ").concat(props.theme.space.base * 10, "px");
|
|
440
|
+
}, function (props) {
|
|
441
|
+
return props.isCloseButtonPresent && "padding-".concat(props.theme.rtl ? 'left' : 'right', ": ").concat(props.theme.space.base * (BASE_MULTIPLIERS$1.size + BASE_MULTIPLIERS$1.side + 2), "px;");
|
|
435
442
|
}, function (props) {
|
|
436
443
|
return reactTheming.getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md);
|
|
437
444
|
}, function (props) {
|
|
@@ -503,13 +510,11 @@ var boxShadow$1 = function boxShadow(props) {
|
|
|
503
510
|
return shadows.lg(offsetY, blurRadius, color);
|
|
504
511
|
};
|
|
505
512
|
var sizeStyles$1 = function sizeStyles(props) {
|
|
506
|
-
|
|
507
|
-
var largeWidth = 800;
|
|
508
|
-
return styled.css(["width:", ";@media (max-width:", "){", ":", "px;}"], props.isLarge ? "".concat(largeWidth, "px") : "".concat(defaultWidth, "px"), props.isLarge ? "".concat(largeWidth - 1, "px") : props.theme.breakpoints.md, props.theme.rtl ? 'right' : 'left', props.theme.space.base * 6);
|
|
513
|
+
return styled.css(["", "{width:", ";}"], reactTheming.mediaQuery('up', props.isLarge ? 'md' : 'sm', props.theme), props.isLarge ? props.theme.breakpoints.md : props.theme.breakpoints.sm);
|
|
509
514
|
};
|
|
510
515
|
var StyledModal = styled__default["default"].div.attrs({
|
|
511
516
|
'data-garden-id': COMPONENT_ID$d,
|
|
512
|
-
'data-garden-version': '8.
|
|
517
|
+
'data-garden-version': '8.49.2'
|
|
513
518
|
}).withConfig({
|
|
514
519
|
displayName: "StyledModal",
|
|
515
520
|
componentId: "sc-1pe1axu-0"
|
|
@@ -549,7 +554,7 @@ StyledModal.defaultProps = {
|
|
|
549
554
|
var COMPONENT_ID$c = 'modals.tooltip_modal.backdrop';
|
|
550
555
|
var StyledTooltipModalBackdrop = styled__default["default"].div.attrs({
|
|
551
556
|
'data-garden-id': COMPONENT_ID$c,
|
|
552
|
-
'data-garden-version': '8.
|
|
557
|
+
'data-garden-version': '8.49.2'
|
|
553
558
|
}).withConfig({
|
|
554
559
|
displayName: "StyledTooltipModalBackdrop",
|
|
555
560
|
componentId: "sc-1yaomgq-0"
|
|
@@ -643,7 +648,7 @@ var COMPONENT_ID$b = 'modals.tooltip_modal';
|
|
|
643
648
|
var StyledTooltipModal = styled__default["default"].div.attrs(function (props) {
|
|
644
649
|
return {
|
|
645
650
|
'data-garden-id': COMPONENT_ID$b,
|
|
646
|
-
'data-garden-version': '8.
|
|
651
|
+
'data-garden-version': '8.49.2',
|
|
647
652
|
className: props.isAnimated && 'is-animated'
|
|
648
653
|
};
|
|
649
654
|
}).withConfig({
|
|
@@ -674,7 +679,7 @@ var sizeStyles = function sizeStyles(props) {
|
|
|
674
679
|
};
|
|
675
680
|
var StyledTooltipModalTitle = styled__default["default"].div.attrs({
|
|
676
681
|
'data-garden-id': COMPONENT_ID$a,
|
|
677
|
-
'data-garden-version': '8.
|
|
682
|
+
'data-garden-version': '8.49.2'
|
|
678
683
|
}).withConfig({
|
|
679
684
|
displayName: "StyledTooltipModalTitle",
|
|
680
685
|
componentId: "sc-11xjgjs-0"
|
|
@@ -694,7 +699,7 @@ StyledTooltipModalTitle.defaultProps = {
|
|
|
694
699
|
var COMPONENT_ID$9 = 'modals.tooltip_modal.body';
|
|
695
700
|
var StyledTooltipModalBody = styled__default["default"].div.attrs({
|
|
696
701
|
'data-garden-id': COMPONENT_ID$9,
|
|
697
|
-
'data-garden-version': '8.
|
|
702
|
+
'data-garden-version': '8.49.2'
|
|
698
703
|
}).withConfig({
|
|
699
704
|
displayName: "StyledTooltipModalBody",
|
|
700
705
|
componentId: "sc-195dkzj-0"
|
|
@@ -716,7 +721,7 @@ StyledTooltipModalBody.defaultProps = {
|
|
|
716
721
|
var COMPONENT_ID$8 = 'modals.tooltip_modal.footer';
|
|
717
722
|
var StyledTooltipModalFooter = styled__default["default"].div.attrs({
|
|
718
723
|
'data-garden-id': COMPONENT_ID$8,
|
|
719
|
-
'data-garden-version': '8.
|
|
724
|
+
'data-garden-version': '8.49.2'
|
|
720
725
|
}).withConfig({
|
|
721
726
|
displayName: "StyledTooltipModalFooter",
|
|
722
727
|
componentId: "sc-fm36a9-0"
|
|
@@ -732,7 +737,7 @@ StyledTooltipModalFooter.defaultProps = {
|
|
|
732
737
|
var COMPONENT_ID$7 = 'modals.tooltip_modal.footer_item';
|
|
733
738
|
var StyledTooltipModalFooterItem = styled__default["default"](StyledFooterItem).attrs({
|
|
734
739
|
'data-garden-id': COMPONENT_ID$7,
|
|
735
|
-
'data-garden-version': '8.
|
|
740
|
+
'data-garden-version': '8.49.2'
|
|
736
741
|
}).withConfig({
|
|
737
742
|
displayName: "StyledTooltipModalFooterItem",
|
|
738
743
|
componentId: "sc-1nahj6p-0"
|
|
@@ -746,7 +751,7 @@ StyledTooltipModalFooterItem.defaultProps = {
|
|
|
746
751
|
var COMPONENT_ID$6 = 'modals.tooltip_modal.close';
|
|
747
752
|
var StyledTooltipModalClose = styled__default["default"](StyledClose).attrs({
|
|
748
753
|
'data-garden-id': COMPONENT_ID$6,
|
|
749
|
-
'data-garden-version': '8.
|
|
754
|
+
'data-garden-version': '8.49.2'
|
|
750
755
|
}).withConfig({
|
|
751
756
|
displayName: "StyledTooltipModalClose",
|
|
752
757
|
componentId: "sc-1h2ke3q-0"
|
|
@@ -780,7 +785,7 @@ var boxShadow = function boxShadow(props) {
|
|
|
780
785
|
};
|
|
781
786
|
var StyledDrawerModal = styled__default["default"].div.attrs({
|
|
782
787
|
'data-garden-id': COMPONENT_ID$5,
|
|
783
|
-
'data-garden-version': '8.
|
|
788
|
+
'data-garden-version': '8.49.2'
|
|
784
789
|
}).withConfig({
|
|
785
790
|
displayName: "StyledDrawerModal",
|
|
786
791
|
componentId: "sc-i1sake-0"
|
|
@@ -803,46 +808,51 @@ StyledDrawerModal.defaultProps = {
|
|
|
803
808
|
theme: reactTheming.DEFAULT_THEME
|
|
804
809
|
};
|
|
805
810
|
|
|
806
|
-
var COMPONENT_ID$4 = 'modals.drawer_modal.
|
|
807
|
-
var
|
|
811
|
+
var COMPONENT_ID$4 = 'modals.drawer_modal.close';
|
|
812
|
+
var BASE_MULTIPLIERS = {
|
|
813
|
+
top: BASE_MULTIPLIERS$1.top,
|
|
814
|
+
side: 2,
|
|
815
|
+
size: BASE_MULTIPLIERS$1.size
|
|
816
|
+
};
|
|
817
|
+
var StyledDrawerModalClose = styled__default["default"](StyledClose).attrs({
|
|
808
818
|
'data-garden-id': COMPONENT_ID$4,
|
|
809
|
-
'data-garden-version': '8.
|
|
819
|
+
'data-garden-version': '8.49.2'
|
|
810
820
|
}).withConfig({
|
|
811
|
-
displayName: "
|
|
812
|
-
componentId: "sc-
|
|
813
|
-
})(["
|
|
814
|
-
return props.theme.
|
|
821
|
+
displayName: "StyledDrawerModalClose",
|
|
822
|
+
componentId: "sc-hrnaom-0"
|
|
823
|
+
})(["", ":", ";", ";"], function (props) {
|
|
824
|
+
return props.theme.rtl ? 'left' : 'right';
|
|
825
|
+
}, function (props) {
|
|
826
|
+
return "".concat(props.theme.space.base * BASE_MULTIPLIERS.side, "px");
|
|
815
827
|
}, function (props) {
|
|
816
828
|
return reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props);
|
|
817
829
|
});
|
|
818
|
-
|
|
830
|
+
StyledDrawerModalClose.defaultProps = {
|
|
819
831
|
theme: reactTheming.DEFAULT_THEME
|
|
820
832
|
};
|
|
821
833
|
|
|
822
|
-
var COMPONENT_ID$3 = 'modals.drawer_modal.
|
|
823
|
-
var
|
|
834
|
+
var COMPONENT_ID$3 = 'modals.drawer_modal.header';
|
|
835
|
+
var StyledDrawerModalHeader = styled__default["default"](StyledHeader).attrs({
|
|
824
836
|
'data-garden-id': COMPONENT_ID$3,
|
|
825
|
-
'data-garden-version': '8.
|
|
837
|
+
'data-garden-version': '8.49.2'
|
|
826
838
|
}).withConfig({
|
|
827
|
-
displayName: "
|
|
828
|
-
componentId: "sc-
|
|
829
|
-
})(["
|
|
830
|
-
return props.theme.space.base *
|
|
831
|
-
}, function (props) {
|
|
832
|
-
return props.theme.space.base * 8;
|
|
839
|
+
displayName: "StyledDrawerModalHeader",
|
|
840
|
+
componentId: "sc-1u04rqw-0"
|
|
841
|
+
})(["padding:", "px;", " ", ";"], function (props) {
|
|
842
|
+
return props.theme.space.base * 5;
|
|
833
843
|
}, function (props) {
|
|
834
|
-
return props.theme.space.base *
|
|
844
|
+
return props.isCloseButtonPresent && "padding-".concat(props.theme.rtl ? 'left' : 'right', ": ").concat(props.theme.space.base * (BASE_MULTIPLIERS.size + BASE_MULTIPLIERS.side + 2), "px;");
|
|
835
845
|
}, function (props) {
|
|
836
846
|
return reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props);
|
|
837
847
|
});
|
|
838
|
-
|
|
848
|
+
StyledDrawerModalHeader.defaultProps = {
|
|
839
849
|
theme: reactTheming.DEFAULT_THEME
|
|
840
850
|
};
|
|
841
851
|
|
|
842
852
|
var COMPONENT_ID$2 = 'modals.drawer_modal.body';
|
|
843
853
|
var StyledDrawerModalBody = styled__default["default"](StyledBody).attrs({
|
|
844
854
|
'data-garden-id': COMPONENT_ID$2,
|
|
845
|
-
'data-garden-version': '8.
|
|
855
|
+
'data-garden-version': '8.49.2'
|
|
846
856
|
}).withConfig({
|
|
847
857
|
displayName: "StyledDrawerModalBody",
|
|
848
858
|
componentId: "sc-yafe2y-0"
|
|
@@ -858,7 +868,7 @@ StyledDrawerModalBody.defaultProps = {
|
|
|
858
868
|
var COMPONENT_ID$1 = 'modals.drawer_modal.footer';
|
|
859
869
|
var StyledDrawerModalFooter = styled__default["default"].div.attrs({
|
|
860
870
|
'data-garden-id': COMPONENT_ID$1,
|
|
861
|
-
'data-garden-version': '8.
|
|
871
|
+
'data-garden-version': '8.49.2'
|
|
862
872
|
}).withConfig({
|
|
863
873
|
displayName: "StyledDrawerModalFooter",
|
|
864
874
|
componentId: "sc-17if4ka-0"
|
|
@@ -876,7 +886,7 @@ StyledDrawerModalFooter.defaultProps = {
|
|
|
876
886
|
var COMPONENT_ID = 'modals.drawer_modal.footer_item';
|
|
877
887
|
var StyledDrawerModalFooterItem = styled__default["default"](StyledFooterItem).attrs({
|
|
878
888
|
'data-garden-id': COMPONENT_ID,
|
|
879
|
-
'data-garden-version': '8.
|
|
889
|
+
'data-garden-version': '8.49.2'
|
|
880
890
|
}).withConfig({
|
|
881
891
|
displayName: "StyledDrawerModalFooterItem",
|
|
882
892
|
componentId: "sc-1vbl885-0"
|
|
@@ -924,6 +934,10 @@ var Modal = React.forwardRef(function (_ref, ref) {
|
|
|
924
934
|
var theme = React.useContext(styled.ThemeContext);
|
|
925
935
|
var modalRef = React.useRef(null);
|
|
926
936
|
var environment = reactTheming.useDocument(theme);
|
|
937
|
+
var _useState = React.useState(false),
|
|
938
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
939
|
+
isCloseButtonPresent = _useState2[0],
|
|
940
|
+
setCloseButtonPresent = _useState2[1];
|
|
927
941
|
var _useModal = containerModal.useModal({
|
|
928
942
|
id: id,
|
|
929
943
|
onClose: onClose,
|
|
@@ -980,11 +994,13 @@ var Modal = React.forwardRef(function (_ref, ref) {
|
|
|
980
994
|
var value = React.useMemo(function () {
|
|
981
995
|
return {
|
|
982
996
|
isLarge: isLarge,
|
|
997
|
+
isCloseButtonPresent: isCloseButtonPresent,
|
|
983
998
|
getTitleProps: getTitleProps,
|
|
984
999
|
getContentProps: getContentProps,
|
|
985
|
-
getCloseProps: getCloseProps
|
|
1000
|
+
getCloseProps: getCloseProps,
|
|
1001
|
+
setCloseButtonPresent: setCloseButtonPresent
|
|
986
1002
|
};
|
|
987
|
-
}, [isLarge, getTitleProps, getContentProps, getCloseProps]);
|
|
1003
|
+
}, [isLarge, isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
988
1004
|
if (!rootNode) {
|
|
989
1005
|
return null;
|
|
990
1006
|
}
|
|
@@ -1047,7 +1063,14 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
1047
1063
|
|
|
1048
1064
|
var Close$2 = React__default["default"].forwardRef(function (props, ref) {
|
|
1049
1065
|
var _useModalContext = useModalContext(),
|
|
1050
|
-
getCloseProps = _useModalContext.getCloseProps
|
|
1066
|
+
getCloseProps = _useModalContext.getCloseProps,
|
|
1067
|
+
setCloseButtonPresent = _useModalContext.setCloseButtonPresent;
|
|
1068
|
+
React.useEffect(function () {
|
|
1069
|
+
setCloseButtonPresent(true);
|
|
1070
|
+
return function () {
|
|
1071
|
+
return setCloseButtonPresent(false);
|
|
1072
|
+
};
|
|
1073
|
+
});
|
|
1051
1074
|
return React__default["default"].createElement(StyledClose, _extends$2({
|
|
1052
1075
|
ref: ref
|
|
1053
1076
|
}, getCloseProps(props)), React__default["default"].createElement(SvgXStroke, null));
|
|
@@ -1073,10 +1096,13 @@ FooterItem$2.displayName = 'FooterItem';
|
|
|
1073
1096
|
|
|
1074
1097
|
var Header$1 = React.forwardRef(function (props, ref) {
|
|
1075
1098
|
var _useModalContext = useModalContext(),
|
|
1099
|
+
isCloseButtonPresent = _useModalContext.isCloseButtonPresent,
|
|
1076
1100
|
getTitleProps = _useModalContext.getTitleProps;
|
|
1077
1101
|
return React__default["default"].createElement(StyledHeader, _extends$2({
|
|
1078
1102
|
ref: ref
|
|
1079
|
-
}, getTitleProps(props)
|
|
1103
|
+
}, getTitleProps(props), {
|
|
1104
|
+
isCloseButtonPresent: isCloseButtonPresent
|
|
1105
|
+
}), props.isDanger && React__default["default"].createElement(StyledDangerIcon, null), props.children);
|
|
1080
1106
|
});
|
|
1081
1107
|
Header$1.displayName = 'Header';
|
|
1082
1108
|
|
|
@@ -1255,10 +1281,13 @@ TooltipModal.Title = Title;
|
|
|
1255
1281
|
|
|
1256
1282
|
var HeaderComponent = React.forwardRef(function (props, ref) {
|
|
1257
1283
|
var _useModalContext = useModalContext(),
|
|
1284
|
+
isCloseButtonPresent = _useModalContext.isCloseButtonPresent,
|
|
1258
1285
|
getTitleProps = _useModalContext.getTitleProps;
|
|
1259
1286
|
return React__default["default"].createElement(StyledDrawerModalHeader, _extends$2({
|
|
1260
1287
|
ref: ref
|
|
1261
|
-
}, getTitleProps(props)
|
|
1288
|
+
}, getTitleProps(props), {
|
|
1289
|
+
isCloseButtonPresent: isCloseButtonPresent
|
|
1290
|
+
}));
|
|
1262
1291
|
});
|
|
1263
1292
|
HeaderComponent.displayName = 'DrawerModal.Header';
|
|
1264
1293
|
var Header = HeaderComponent;
|
|
@@ -1275,7 +1304,14 @@ var Body = BodyComponent;
|
|
|
1275
1304
|
|
|
1276
1305
|
var CloseComponent = React.forwardRef(function (props, ref) {
|
|
1277
1306
|
var _useModalContext = useModalContext(),
|
|
1278
|
-
getCloseProps = _useModalContext.getCloseProps
|
|
1307
|
+
getCloseProps = _useModalContext.getCloseProps,
|
|
1308
|
+
setCloseButtonPresent = _useModalContext.setCloseButtonPresent;
|
|
1309
|
+
React.useEffect(function () {
|
|
1310
|
+
setCloseButtonPresent(true);
|
|
1311
|
+
return function () {
|
|
1312
|
+
return setCloseButtonPresent(false);
|
|
1313
|
+
};
|
|
1314
|
+
});
|
|
1279
1315
|
return React__default["default"].createElement(StyledDrawerModalClose, _extends$2({
|
|
1280
1316
|
ref: ref
|
|
1281
1317
|
}, getCloseProps(props)), React__default["default"].createElement(SvgXStroke, null));
|
|
@@ -1313,6 +1349,10 @@ var DrawerModalComponent = React.forwardRef(function (_ref, ref) {
|
|
|
1313
1349
|
var transitionRef = React.useRef(null);
|
|
1314
1350
|
var theme = React.useContext(styled.ThemeContext);
|
|
1315
1351
|
var environment = reactTheming.useDocument(theme);
|
|
1352
|
+
var _useState = React.useState(false),
|
|
1353
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1354
|
+
isCloseButtonPresent = _useState2[0],
|
|
1355
|
+
setCloseButtonPresent = _useState2[1];
|
|
1316
1356
|
containerFocusvisible.useFocusVisible({
|
|
1317
1357
|
scope: modalRef,
|
|
1318
1358
|
relativeDocument: modalRef.current
|
|
@@ -1357,11 +1397,13 @@ var DrawerModalComponent = React.forwardRef(function (_ref, ref) {
|
|
|
1357
1397
|
}, [appendToNode, environment]);
|
|
1358
1398
|
var value = React.useMemo(function () {
|
|
1359
1399
|
return {
|
|
1400
|
+
isCloseButtonPresent: isCloseButtonPresent,
|
|
1360
1401
|
getTitleProps: getTitleProps,
|
|
1361
1402
|
getContentProps: getContentProps,
|
|
1362
|
-
getCloseProps: getCloseProps
|
|
1403
|
+
getCloseProps: getCloseProps,
|
|
1404
|
+
setCloseButtonPresent: setCloseButtonPresent
|
|
1363
1405
|
};
|
|
1364
|
-
}, [getTitleProps, getContentProps, getCloseProps]);
|
|
1406
|
+
}, [isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
1365
1407
|
if (!rootNode) {
|
|
1366
1408
|
return null;
|
|
1367
1409
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import React__default, { createContext, useContext, forwardRef, useRef, useEffect, useMemo
|
|
9
|
+
import React__default, { createContext, useContext, forwardRef, useRef, useState, useEffect, useMemo } from 'react';
|
|
10
10
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
11
11
|
import styled, { keyframes, css, ThemeContext } from 'styled-components';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
|
-
import { getColor, retrieveComponentStyles, DEFAULT_THEME, getLineHeight, menuStyles, arrowStyles, useDocument } from '@zendeskgarden/react-theming';
|
|
13
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME, getLineHeight, mediaQuery, menuStyles, arrowStyles, useDocument } from '@zendeskgarden/react-theming';
|
|
14
14
|
import { useModal } from '@zendeskgarden/container-modal';
|
|
15
15
|
import { useFocusVisible } from '@zendeskgarden/container-focusvisible';
|
|
16
16
|
import mergeRefs from 'react-merge-refs';
|
|
@@ -271,7 +271,7 @@ var COMPONENT_ID$j = 'modals.backdrop';
|
|
|
271
271
|
var animationName$1 = keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
|
|
272
272
|
var StyledBackdrop = styled.div.attrs({
|
|
273
273
|
'data-garden-id': COMPONENT_ID$j,
|
|
274
|
-
'data-garden-version': '8.
|
|
274
|
+
'data-garden-version': '8.49.2'
|
|
275
275
|
}).withConfig({
|
|
276
276
|
displayName: "StyledBackdrop",
|
|
277
277
|
componentId: "sc-mzdjpo-0"
|
|
@@ -301,7 +301,7 @@ StyledBackdrop.propTypes = {
|
|
|
301
301
|
var COMPONENT_ID$i = 'modals.body';
|
|
302
302
|
var StyledBody = styled.div.attrs({
|
|
303
303
|
'data-garden-id': COMPONENT_ID$i,
|
|
304
|
-
'data-garden-version': '8.
|
|
304
|
+
'data-garden-version': '8.49.2'
|
|
305
305
|
}).withConfig({
|
|
306
306
|
displayName: "StyledBody",
|
|
307
307
|
componentId: "sc-14rzecg-0"
|
|
@@ -326,22 +326,27 @@ var colorStyles = function colorStyles(props) {
|
|
|
326
326
|
var foregroundColor = 'neutralHue';
|
|
327
327
|
return css(["background-color:transparent;color:", ";&:hover{background-color:", ";color:", ";}&[data-garden-focus-visible]{box-shadow:", ";}&:active{transition:background-color 0.1s ease-in-out,color 0.1s ease-in-out;background-color:", ";color:", ";}"], getColor(foregroundColor, 600, props.theme), getColor(backgroundColor, 600, props.theme, 0.08), getColor(foregroundColor, 700, props.theme), props.theme.shadows.md(getColor(backgroundColor, 600, props.theme, 0.35)), getColor(backgroundColor, 600, props.theme, 0.2), getColor(foregroundColor, 800, props.theme));
|
|
328
328
|
};
|
|
329
|
+
var BASE_MULTIPLIERS$1 = {
|
|
330
|
+
top: 2.5,
|
|
331
|
+
side: 6.5,
|
|
332
|
+
size: 10
|
|
333
|
+
};
|
|
329
334
|
var StyledClose = styled.button.attrs({
|
|
330
335
|
'data-garden-id': COMPONENT_ID$h,
|
|
331
|
-
'data-garden-version': '8.
|
|
336
|
+
'data-garden-version': '8.49.2'
|
|
332
337
|
}).withConfig({
|
|
333
338
|
displayName: "StyledClose",
|
|
334
339
|
componentId: "sc-iseudj-0"
|
|
335
340
|
})(["display:block;position:absolute;top:", "px;", ":", ";transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out;border:none;border-radius:50%;background-color:transparent;cursor:pointer;padding:0;width:", "px;height:", "px;overflow:hidden;text-decoration:none;font-size:0;user-select:none;&::-moz-focus-inner{border:0;}&:focus{outline:none;}", " & > svg{vertical-align:middle;}", ";"], function (props) {
|
|
336
|
-
return props.theme.space.base *
|
|
341
|
+
return props.theme.space.base * BASE_MULTIPLIERS$1.top;
|
|
337
342
|
}, function (props) {
|
|
338
343
|
return props.theme.rtl ? 'left' : 'right';
|
|
339
344
|
}, function (props) {
|
|
340
|
-
return "".concat(props.theme.space.base *
|
|
345
|
+
return "".concat(props.theme.space.base * BASE_MULTIPLIERS$1.side, "px");
|
|
341
346
|
}, function (props) {
|
|
342
|
-
return props.theme.space.base *
|
|
347
|
+
return props.theme.space.base * BASE_MULTIPLIERS$1.size;
|
|
343
348
|
}, function (props) {
|
|
344
|
-
return props.theme.space.base *
|
|
349
|
+
return props.theme.space.base * BASE_MULTIPLIERS$1.size;
|
|
345
350
|
}, function (props) {
|
|
346
351
|
return colorStyles(props);
|
|
347
352
|
}, function (props) {
|
|
@@ -354,7 +359,7 @@ StyledClose.defaultProps = {
|
|
|
354
359
|
var COMPONENT_ID$g = 'modals.footer';
|
|
355
360
|
var StyledFooter = styled.div.attrs({
|
|
356
361
|
'data-garden-id': COMPONENT_ID$g,
|
|
357
|
-
'data-garden-version': '8.
|
|
362
|
+
'data-garden-version': '8.49.2'
|
|
358
363
|
}).withConfig({
|
|
359
364
|
displayName: "StyledFooter",
|
|
360
365
|
componentId: "sc-d8pfdu-0"
|
|
@@ -372,7 +377,7 @@ StyledFooter.defaultProps = {
|
|
|
372
377
|
var COMPONENT_ID$f = 'modals.footer_item';
|
|
373
378
|
var StyledFooterItem = styled.span.attrs({
|
|
374
379
|
'data-garden-id': COMPONENT_ID$f,
|
|
375
|
-
'data-garden-version': '8.
|
|
380
|
+
'data-garden-version': '8.49.2'
|
|
376
381
|
}).withConfig({
|
|
377
382
|
displayName: "StyledFooterItem",
|
|
378
383
|
componentId: "sc-1mb76hl-0"
|
|
@@ -392,16 +397,18 @@ StyledFooterItem.defaultProps = {
|
|
|
392
397
|
var COMPONENT_ID$e = 'modals.header';
|
|
393
398
|
var StyledHeader = styled.div.attrs({
|
|
394
399
|
'data-garden-id': COMPONENT_ID$e,
|
|
395
|
-
'data-garden-version': '8.
|
|
400
|
+
'data-garden-version': '8.49.2'
|
|
396
401
|
}).withConfig({
|
|
397
402
|
displayName: "StyledHeader",
|
|
398
403
|
componentId: "sc-1787r9v-0"
|
|
399
|
-
})(["display:block;position:", ";margin:0;border-bottom:", " ", ";padding:", ";line-height:", ";color:", ";font-size:", ";font-weight:", ";", ";"], function (props) {
|
|
404
|
+
})(["display:block;position:", ";margin:0;border-bottom:", " ", ";padding:", ";", " line-height:", ";color:", ";font-size:", ";font-weight:", ";", ";"], function (props) {
|
|
400
405
|
return props.isDanger && 'relative';
|
|
401
406
|
}, function (props) {
|
|
402
407
|
return props.theme.borders.sm;
|
|
403
408
|
}, getColor('neutralHue', 200), function (props) {
|
|
404
409
|
return "".concat(props.theme.space.base * 5, "px ").concat(props.theme.space.base * 10, "px");
|
|
410
|
+
}, function (props) {
|
|
411
|
+
return props.isCloseButtonPresent && "padding-".concat(props.theme.rtl ? 'left' : 'right', ": ").concat(props.theme.space.base * (BASE_MULTIPLIERS$1.size + BASE_MULTIPLIERS$1.side + 2), "px;");
|
|
405
412
|
}, function (props) {
|
|
406
413
|
return getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md);
|
|
407
414
|
}, function (props) {
|
|
@@ -473,13 +480,11 @@ var boxShadow$1 = function boxShadow(props) {
|
|
|
473
480
|
return shadows.lg(offsetY, blurRadius, color);
|
|
474
481
|
};
|
|
475
482
|
var sizeStyles$1 = function sizeStyles(props) {
|
|
476
|
-
|
|
477
|
-
var largeWidth = 800;
|
|
478
|
-
return css(["width:", ";@media (max-width:", "){", ":", "px;}"], props.isLarge ? "".concat(largeWidth, "px") : "".concat(defaultWidth, "px"), props.isLarge ? "".concat(largeWidth - 1, "px") : props.theme.breakpoints.md, props.theme.rtl ? 'right' : 'left', props.theme.space.base * 6);
|
|
483
|
+
return css(["", "{width:", ";}"], mediaQuery('up', props.isLarge ? 'md' : 'sm', props.theme), props.isLarge ? props.theme.breakpoints.md : props.theme.breakpoints.sm);
|
|
479
484
|
};
|
|
480
485
|
var StyledModal = styled.div.attrs({
|
|
481
486
|
'data-garden-id': COMPONENT_ID$d,
|
|
482
|
-
'data-garden-version': '8.
|
|
487
|
+
'data-garden-version': '8.49.2'
|
|
483
488
|
}).withConfig({
|
|
484
489
|
displayName: "StyledModal",
|
|
485
490
|
componentId: "sc-1pe1axu-0"
|
|
@@ -519,7 +524,7 @@ StyledModal.defaultProps = {
|
|
|
519
524
|
var COMPONENT_ID$c = 'modals.tooltip_modal.backdrop';
|
|
520
525
|
var StyledTooltipModalBackdrop = styled.div.attrs({
|
|
521
526
|
'data-garden-id': COMPONENT_ID$c,
|
|
522
|
-
'data-garden-version': '8.
|
|
527
|
+
'data-garden-version': '8.49.2'
|
|
523
528
|
}).withConfig({
|
|
524
529
|
displayName: "StyledTooltipModalBackdrop",
|
|
525
530
|
componentId: "sc-1yaomgq-0"
|
|
@@ -613,7 +618,7 @@ var COMPONENT_ID$b = 'modals.tooltip_modal';
|
|
|
613
618
|
var StyledTooltipModal = styled.div.attrs(function (props) {
|
|
614
619
|
return {
|
|
615
620
|
'data-garden-id': COMPONENT_ID$b,
|
|
616
|
-
'data-garden-version': '8.
|
|
621
|
+
'data-garden-version': '8.49.2',
|
|
617
622
|
className: props.isAnimated && 'is-animated'
|
|
618
623
|
};
|
|
619
624
|
}).withConfig({
|
|
@@ -644,7 +649,7 @@ var sizeStyles = function sizeStyles(props) {
|
|
|
644
649
|
};
|
|
645
650
|
var StyledTooltipModalTitle = styled.div.attrs({
|
|
646
651
|
'data-garden-id': COMPONENT_ID$a,
|
|
647
|
-
'data-garden-version': '8.
|
|
652
|
+
'data-garden-version': '8.49.2'
|
|
648
653
|
}).withConfig({
|
|
649
654
|
displayName: "StyledTooltipModalTitle",
|
|
650
655
|
componentId: "sc-11xjgjs-0"
|
|
@@ -664,7 +669,7 @@ StyledTooltipModalTitle.defaultProps = {
|
|
|
664
669
|
var COMPONENT_ID$9 = 'modals.tooltip_modal.body';
|
|
665
670
|
var StyledTooltipModalBody = styled.div.attrs({
|
|
666
671
|
'data-garden-id': COMPONENT_ID$9,
|
|
667
|
-
'data-garden-version': '8.
|
|
672
|
+
'data-garden-version': '8.49.2'
|
|
668
673
|
}).withConfig({
|
|
669
674
|
displayName: "StyledTooltipModalBody",
|
|
670
675
|
componentId: "sc-195dkzj-0"
|
|
@@ -686,7 +691,7 @@ StyledTooltipModalBody.defaultProps = {
|
|
|
686
691
|
var COMPONENT_ID$8 = 'modals.tooltip_modal.footer';
|
|
687
692
|
var StyledTooltipModalFooter = styled.div.attrs({
|
|
688
693
|
'data-garden-id': COMPONENT_ID$8,
|
|
689
|
-
'data-garden-version': '8.
|
|
694
|
+
'data-garden-version': '8.49.2'
|
|
690
695
|
}).withConfig({
|
|
691
696
|
displayName: "StyledTooltipModalFooter",
|
|
692
697
|
componentId: "sc-fm36a9-0"
|
|
@@ -702,7 +707,7 @@ StyledTooltipModalFooter.defaultProps = {
|
|
|
702
707
|
var COMPONENT_ID$7 = 'modals.tooltip_modal.footer_item';
|
|
703
708
|
var StyledTooltipModalFooterItem = styled(StyledFooterItem).attrs({
|
|
704
709
|
'data-garden-id': COMPONENT_ID$7,
|
|
705
|
-
'data-garden-version': '8.
|
|
710
|
+
'data-garden-version': '8.49.2'
|
|
706
711
|
}).withConfig({
|
|
707
712
|
displayName: "StyledTooltipModalFooterItem",
|
|
708
713
|
componentId: "sc-1nahj6p-0"
|
|
@@ -716,7 +721,7 @@ StyledTooltipModalFooterItem.defaultProps = {
|
|
|
716
721
|
var COMPONENT_ID$6 = 'modals.tooltip_modal.close';
|
|
717
722
|
var StyledTooltipModalClose = styled(StyledClose).attrs({
|
|
718
723
|
'data-garden-id': COMPONENT_ID$6,
|
|
719
|
-
'data-garden-version': '8.
|
|
724
|
+
'data-garden-version': '8.49.2'
|
|
720
725
|
}).withConfig({
|
|
721
726
|
displayName: "StyledTooltipModalClose",
|
|
722
727
|
componentId: "sc-1h2ke3q-0"
|
|
@@ -750,7 +755,7 @@ var boxShadow = function boxShadow(props) {
|
|
|
750
755
|
};
|
|
751
756
|
var StyledDrawerModal = styled.div.attrs({
|
|
752
757
|
'data-garden-id': COMPONENT_ID$5,
|
|
753
|
-
'data-garden-version': '8.
|
|
758
|
+
'data-garden-version': '8.49.2'
|
|
754
759
|
}).withConfig({
|
|
755
760
|
displayName: "StyledDrawerModal",
|
|
756
761
|
componentId: "sc-i1sake-0"
|
|
@@ -773,46 +778,51 @@ StyledDrawerModal.defaultProps = {
|
|
|
773
778
|
theme: DEFAULT_THEME
|
|
774
779
|
};
|
|
775
780
|
|
|
776
|
-
var COMPONENT_ID$4 = 'modals.drawer_modal.
|
|
777
|
-
var
|
|
781
|
+
var COMPONENT_ID$4 = 'modals.drawer_modal.close';
|
|
782
|
+
var BASE_MULTIPLIERS = {
|
|
783
|
+
top: BASE_MULTIPLIERS$1.top,
|
|
784
|
+
side: 2,
|
|
785
|
+
size: BASE_MULTIPLIERS$1.size
|
|
786
|
+
};
|
|
787
|
+
var StyledDrawerModalClose = styled(StyledClose).attrs({
|
|
778
788
|
'data-garden-id': COMPONENT_ID$4,
|
|
779
|
-
'data-garden-version': '8.
|
|
789
|
+
'data-garden-version': '8.49.2'
|
|
780
790
|
}).withConfig({
|
|
781
|
-
displayName: "
|
|
782
|
-
componentId: "sc-
|
|
783
|
-
})(["
|
|
784
|
-
return props.theme.
|
|
791
|
+
displayName: "StyledDrawerModalClose",
|
|
792
|
+
componentId: "sc-hrnaom-0"
|
|
793
|
+
})(["", ":", ";", ";"], function (props) {
|
|
794
|
+
return props.theme.rtl ? 'left' : 'right';
|
|
795
|
+
}, function (props) {
|
|
796
|
+
return "".concat(props.theme.space.base * BASE_MULTIPLIERS.side, "px");
|
|
785
797
|
}, function (props) {
|
|
786
798
|
return retrieveComponentStyles(COMPONENT_ID$4, props);
|
|
787
799
|
});
|
|
788
|
-
|
|
800
|
+
StyledDrawerModalClose.defaultProps = {
|
|
789
801
|
theme: DEFAULT_THEME
|
|
790
802
|
};
|
|
791
803
|
|
|
792
|
-
var COMPONENT_ID$3 = 'modals.drawer_modal.
|
|
793
|
-
var
|
|
804
|
+
var COMPONENT_ID$3 = 'modals.drawer_modal.header';
|
|
805
|
+
var StyledDrawerModalHeader = styled(StyledHeader).attrs({
|
|
794
806
|
'data-garden-id': COMPONENT_ID$3,
|
|
795
|
-
'data-garden-version': '8.
|
|
807
|
+
'data-garden-version': '8.49.2'
|
|
796
808
|
}).withConfig({
|
|
797
|
-
displayName: "
|
|
798
|
-
componentId: "sc-
|
|
799
|
-
})(["
|
|
800
|
-
return props.theme.space.base *
|
|
801
|
-
}, function (props) {
|
|
802
|
-
return props.theme.space.base * 8;
|
|
809
|
+
displayName: "StyledDrawerModalHeader",
|
|
810
|
+
componentId: "sc-1u04rqw-0"
|
|
811
|
+
})(["padding:", "px;", " ", ";"], function (props) {
|
|
812
|
+
return props.theme.space.base * 5;
|
|
803
813
|
}, function (props) {
|
|
804
|
-
return props.theme.space.base *
|
|
814
|
+
return props.isCloseButtonPresent && "padding-".concat(props.theme.rtl ? 'left' : 'right', ": ").concat(props.theme.space.base * (BASE_MULTIPLIERS.size + BASE_MULTIPLIERS.side + 2), "px;");
|
|
805
815
|
}, function (props) {
|
|
806
816
|
return retrieveComponentStyles(COMPONENT_ID$3, props);
|
|
807
817
|
});
|
|
808
|
-
|
|
818
|
+
StyledDrawerModalHeader.defaultProps = {
|
|
809
819
|
theme: DEFAULT_THEME
|
|
810
820
|
};
|
|
811
821
|
|
|
812
822
|
var COMPONENT_ID$2 = 'modals.drawer_modal.body';
|
|
813
823
|
var StyledDrawerModalBody = styled(StyledBody).attrs({
|
|
814
824
|
'data-garden-id': COMPONENT_ID$2,
|
|
815
|
-
'data-garden-version': '8.
|
|
825
|
+
'data-garden-version': '8.49.2'
|
|
816
826
|
}).withConfig({
|
|
817
827
|
displayName: "StyledDrawerModalBody",
|
|
818
828
|
componentId: "sc-yafe2y-0"
|
|
@@ -828,7 +838,7 @@ StyledDrawerModalBody.defaultProps = {
|
|
|
828
838
|
var COMPONENT_ID$1 = 'modals.drawer_modal.footer';
|
|
829
839
|
var StyledDrawerModalFooter = styled.div.attrs({
|
|
830
840
|
'data-garden-id': COMPONENT_ID$1,
|
|
831
|
-
'data-garden-version': '8.
|
|
841
|
+
'data-garden-version': '8.49.2'
|
|
832
842
|
}).withConfig({
|
|
833
843
|
displayName: "StyledDrawerModalFooter",
|
|
834
844
|
componentId: "sc-17if4ka-0"
|
|
@@ -846,7 +856,7 @@ StyledDrawerModalFooter.defaultProps = {
|
|
|
846
856
|
var COMPONENT_ID = 'modals.drawer_modal.footer_item';
|
|
847
857
|
var StyledDrawerModalFooterItem = styled(StyledFooterItem).attrs({
|
|
848
858
|
'data-garden-id': COMPONENT_ID,
|
|
849
|
-
'data-garden-version': '8.
|
|
859
|
+
'data-garden-version': '8.49.2'
|
|
850
860
|
}).withConfig({
|
|
851
861
|
displayName: "StyledDrawerModalFooterItem",
|
|
852
862
|
componentId: "sc-1vbl885-0"
|
|
@@ -894,6 +904,10 @@ var Modal = forwardRef(function (_ref, ref) {
|
|
|
894
904
|
var theme = useContext(ThemeContext);
|
|
895
905
|
var modalRef = useRef(null);
|
|
896
906
|
var environment = useDocument(theme);
|
|
907
|
+
var _useState = useState(false),
|
|
908
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
909
|
+
isCloseButtonPresent = _useState2[0],
|
|
910
|
+
setCloseButtonPresent = _useState2[1];
|
|
897
911
|
var _useModal = useModal({
|
|
898
912
|
id: id,
|
|
899
913
|
onClose: onClose,
|
|
@@ -950,11 +964,13 @@ var Modal = forwardRef(function (_ref, ref) {
|
|
|
950
964
|
var value = useMemo(function () {
|
|
951
965
|
return {
|
|
952
966
|
isLarge: isLarge,
|
|
967
|
+
isCloseButtonPresent: isCloseButtonPresent,
|
|
953
968
|
getTitleProps: getTitleProps,
|
|
954
969
|
getContentProps: getContentProps,
|
|
955
|
-
getCloseProps: getCloseProps
|
|
970
|
+
getCloseProps: getCloseProps,
|
|
971
|
+
setCloseButtonPresent: setCloseButtonPresent
|
|
956
972
|
};
|
|
957
|
-
}, [isLarge, getTitleProps, getContentProps, getCloseProps]);
|
|
973
|
+
}, [isLarge, isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
958
974
|
if (!rootNode) {
|
|
959
975
|
return null;
|
|
960
976
|
}
|
|
@@ -1017,7 +1033,14 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
1017
1033
|
|
|
1018
1034
|
var Close$2 = React__default.forwardRef(function (props, ref) {
|
|
1019
1035
|
var _useModalContext = useModalContext(),
|
|
1020
|
-
getCloseProps = _useModalContext.getCloseProps
|
|
1036
|
+
getCloseProps = _useModalContext.getCloseProps,
|
|
1037
|
+
setCloseButtonPresent = _useModalContext.setCloseButtonPresent;
|
|
1038
|
+
useEffect(function () {
|
|
1039
|
+
setCloseButtonPresent(true);
|
|
1040
|
+
return function () {
|
|
1041
|
+
return setCloseButtonPresent(false);
|
|
1042
|
+
};
|
|
1043
|
+
});
|
|
1021
1044
|
return React__default.createElement(StyledClose, _extends$2({
|
|
1022
1045
|
ref: ref
|
|
1023
1046
|
}, getCloseProps(props)), React__default.createElement(SvgXStroke, null));
|
|
@@ -1043,10 +1066,13 @@ FooterItem$2.displayName = 'FooterItem';
|
|
|
1043
1066
|
|
|
1044
1067
|
var Header$1 = forwardRef(function (props, ref) {
|
|
1045
1068
|
var _useModalContext = useModalContext(),
|
|
1069
|
+
isCloseButtonPresent = _useModalContext.isCloseButtonPresent,
|
|
1046
1070
|
getTitleProps = _useModalContext.getTitleProps;
|
|
1047
1071
|
return React__default.createElement(StyledHeader, _extends$2({
|
|
1048
1072
|
ref: ref
|
|
1049
|
-
}, getTitleProps(props)
|
|
1073
|
+
}, getTitleProps(props), {
|
|
1074
|
+
isCloseButtonPresent: isCloseButtonPresent
|
|
1075
|
+
}), props.isDanger && React__default.createElement(StyledDangerIcon, null), props.children);
|
|
1050
1076
|
});
|
|
1051
1077
|
Header$1.displayName = 'Header';
|
|
1052
1078
|
|
|
@@ -1225,10 +1251,13 @@ TooltipModal.Title = Title;
|
|
|
1225
1251
|
|
|
1226
1252
|
var HeaderComponent = forwardRef(function (props, ref) {
|
|
1227
1253
|
var _useModalContext = useModalContext(),
|
|
1254
|
+
isCloseButtonPresent = _useModalContext.isCloseButtonPresent,
|
|
1228
1255
|
getTitleProps = _useModalContext.getTitleProps;
|
|
1229
1256
|
return React__default.createElement(StyledDrawerModalHeader, _extends$2({
|
|
1230
1257
|
ref: ref
|
|
1231
|
-
}, getTitleProps(props)
|
|
1258
|
+
}, getTitleProps(props), {
|
|
1259
|
+
isCloseButtonPresent: isCloseButtonPresent
|
|
1260
|
+
}));
|
|
1232
1261
|
});
|
|
1233
1262
|
HeaderComponent.displayName = 'DrawerModal.Header';
|
|
1234
1263
|
var Header = HeaderComponent;
|
|
@@ -1245,7 +1274,14 @@ var Body = BodyComponent;
|
|
|
1245
1274
|
|
|
1246
1275
|
var CloseComponent = forwardRef(function (props, ref) {
|
|
1247
1276
|
var _useModalContext = useModalContext(),
|
|
1248
|
-
getCloseProps = _useModalContext.getCloseProps
|
|
1277
|
+
getCloseProps = _useModalContext.getCloseProps,
|
|
1278
|
+
setCloseButtonPresent = _useModalContext.setCloseButtonPresent;
|
|
1279
|
+
useEffect(function () {
|
|
1280
|
+
setCloseButtonPresent(true);
|
|
1281
|
+
return function () {
|
|
1282
|
+
return setCloseButtonPresent(false);
|
|
1283
|
+
};
|
|
1284
|
+
});
|
|
1249
1285
|
return React__default.createElement(StyledDrawerModalClose, _extends$2({
|
|
1250
1286
|
ref: ref
|
|
1251
1287
|
}, getCloseProps(props)), React__default.createElement(SvgXStroke, null));
|
|
@@ -1283,6 +1319,10 @@ var DrawerModalComponent = forwardRef(function (_ref, ref) {
|
|
|
1283
1319
|
var transitionRef = useRef(null);
|
|
1284
1320
|
var theme = useContext(ThemeContext);
|
|
1285
1321
|
var environment = useDocument(theme);
|
|
1322
|
+
var _useState = useState(false),
|
|
1323
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1324
|
+
isCloseButtonPresent = _useState2[0],
|
|
1325
|
+
setCloseButtonPresent = _useState2[1];
|
|
1286
1326
|
useFocusVisible({
|
|
1287
1327
|
scope: modalRef,
|
|
1288
1328
|
relativeDocument: modalRef.current
|
|
@@ -1327,11 +1367,13 @@ var DrawerModalComponent = forwardRef(function (_ref, ref) {
|
|
|
1327
1367
|
}, [appendToNode, environment]);
|
|
1328
1368
|
var value = useMemo(function () {
|
|
1329
1369
|
return {
|
|
1370
|
+
isCloseButtonPresent: isCloseButtonPresent,
|
|
1330
1371
|
getTitleProps: getTitleProps,
|
|
1331
1372
|
getContentProps: getContentProps,
|
|
1332
|
-
getCloseProps: getCloseProps
|
|
1373
|
+
getCloseProps: getCloseProps,
|
|
1374
|
+
setCloseButtonPresent: setCloseButtonPresent
|
|
1333
1375
|
};
|
|
1334
|
-
}, [getTitleProps, getContentProps, getCloseProps]);
|
|
1376
|
+
}, [isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
1335
1377
|
if (!rootNode) {
|
|
1336
1378
|
return null;
|
|
1337
1379
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
import React, { HTMLAttributes } from 'react';
|
|
7
|
+
import React, { HTMLAttributes, KeyboardEvent, MouseEvent } from 'react';
|
|
8
8
|
import { Header } from './Header';
|
|
9
9
|
import { Body } from './Body';
|
|
10
10
|
import { Close } from './Close';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
import React, { HTMLAttributes } from 'react';
|
|
7
|
+
import React, { HTMLAttributes, KeyboardEvent, MouseEvent } from 'react';
|
|
8
8
|
export interface IModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
9
|
/**
|
|
10
10
|
* Passes HTML attributes to the backdrop element
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
import React, { HTMLAttributes } from 'react';
|
|
7
|
+
import React, { HTMLAttributes, KeyboardEvent, MouseEvent } from 'react';
|
|
8
8
|
import { Modifier } from 'react-popper';
|
|
9
9
|
import { GARDEN_PLACEMENT } from '../../utils/gardenPlacements';
|
|
10
10
|
import { Title } from './Title';
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import { DefaultTheme } from 'styled-components';
|
|
8
|
+
export declare const BASE_MULTIPLIERS: {
|
|
9
|
+
top: number;
|
|
10
|
+
side: number;
|
|
11
|
+
size: number;
|
|
12
|
+
};
|
|
8
13
|
/**
|
|
9
14
|
* 1. Remove dotted outline from Firefox on focus.
|
|
10
15
|
*/
|
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
+
export declare const BASE_MULTIPLIERS: {
|
|
8
|
+
top: number;
|
|
9
|
+
side: number;
|
|
10
|
+
size: number;
|
|
11
|
+
};
|
|
7
12
|
export declare const StyledDrawerModalClose: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
|
|
8
13
|
'data-garden-id': string;
|
|
9
14
|
'data-garden-version': string;
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* 1. the padding added to the Header is based on the close button size and spacing,
|
|
9
|
+
* with additional padding (+ 2) between the Header content and Close button
|
|
10
|
+
*/
|
|
7
11
|
export declare const StyledDrawerModalHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("./StyledHeader").IStyledHeaderProps & {
|
|
8
12
|
'data-garden-id': string;
|
|
9
13
|
'data-garden-version': string;
|
|
@@ -6,5 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export interface IStyledHeaderProps {
|
|
8
8
|
isDanger?: boolean;
|
|
9
|
+
isCloseButtonPresent?: boolean;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* 1. the padding added to the Header is based on the close button size and spacing,
|
|
13
|
+
* with additional padding (+ 2) between the Header content and Close button
|
|
14
|
+
*/
|
|
10
15
|
export declare const StyledHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, IStyledHeaderProps, never>;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
import { HTMLAttributes } from 'react';
|
|
8
8
|
export interface IModalContext {
|
|
9
9
|
isLarge?: boolean;
|
|
10
|
+
isCloseButtonPresent?: boolean;
|
|
10
11
|
getTitleProps: <T>(options?: T) => T & HTMLAttributes<HTMLDivElement>;
|
|
11
12
|
getContentProps: <T>(options?: T) => T & HTMLAttributes<HTMLDivElement>;
|
|
12
13
|
getCloseProps: <T>(options?: T) => T & HTMLAttributes<HTMLButtonElement>;
|
|
14
|
+
setCloseButtonPresent: (isPresent: boolean) => void;
|
|
13
15
|
}
|
|
14
16
|
export declare const ModalsContext: import("react").Context<IModalContext | undefined>;
|
|
15
17
|
export declare const useModalContext: () => IModalContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-modals",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.49.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.4",
|
|
42
|
-
"@zendeskgarden/react-theming": "^8.
|
|
42
|
+
"@zendeskgarden/react-theming": "^8.49.2",
|
|
43
43
|
"@zendeskgarden/svg-icons": "6.30.2"
|
|
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": "fd7769285a2f4bc1169c63f4db57a85a6e793027"
|
|
56
56
|
}
|