@zendeskgarden/react-modals 8.49.0 → 8.49.3
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 +100 -58
- package/dist/index.esm.js +102 -61
- package/dist/typings/elements/DrawerModal/DrawerModal.d.ts +2 -29
- package/dist/typings/elements/Header.d.ts +2 -7
- package/dist/typings/elements/Modal.d.ts +2 -37
- package/dist/typings/elements/TooltipModal/TooltipModal.d.ts +2 -47
- package/dist/typings/index.d.ts +2 -4
- 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/styled/StyledTooltipModal.d.ts +4 -7
- package/dist/typings/styled/StyledTooltipWrapper.d.ts +2 -3
- package/dist/typings/styled/index.d.ts +0 -2
- package/dist/typings/types/index.d.ts +80 -0
- package/dist/typings/utils/gardenPlacements.d.ts +5 -6
- package/dist/typings/utils/useModalContext.d.ts +2 -0
- package/package.json +4 -4
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.49.
|
|
304
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
334
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
366
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
392
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
410
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
430
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
517
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
557
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
651
|
+
'data-garden-version': '8.49.3',
|
|
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.49.
|
|
682
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
702
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
724
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
740
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
754
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
788
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
819
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
837
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
855
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
871
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
889
|
+
'data-garden-version': '8.49.3'
|
|
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
|
}
|
|
@@ -1009,8 +1025,7 @@ Modal.propTypes = {
|
|
|
1009
1025
|
focusOnMount: PropTypes__default["default"].bool,
|
|
1010
1026
|
restoreFocus: PropTypes__default["default"].bool,
|
|
1011
1027
|
onClose: PropTypes__default["default"].func,
|
|
1012
|
-
appendToNode: PropTypes__default["default"].any
|
|
1013
|
-
id: PropTypes__default["default"].string
|
|
1028
|
+
appendToNode: PropTypes__default["default"].any
|
|
1014
1029
|
};
|
|
1015
1030
|
Modal.defaultProps = {
|
|
1016
1031
|
isAnimated: true,
|
|
@@ -1047,7 +1062,14 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
1047
1062
|
|
|
1048
1063
|
var Close$2 = React__default["default"].forwardRef(function (props, ref) {
|
|
1049
1064
|
var _useModalContext = useModalContext(),
|
|
1050
|
-
getCloseProps = _useModalContext.getCloseProps
|
|
1065
|
+
getCloseProps = _useModalContext.getCloseProps,
|
|
1066
|
+
setCloseButtonPresent = _useModalContext.setCloseButtonPresent;
|
|
1067
|
+
React.useEffect(function () {
|
|
1068
|
+
setCloseButtonPresent(true);
|
|
1069
|
+
return function () {
|
|
1070
|
+
return setCloseButtonPresent(false);
|
|
1071
|
+
};
|
|
1072
|
+
});
|
|
1051
1073
|
return React__default["default"].createElement(StyledClose, _extends$2({
|
|
1052
1074
|
ref: ref
|
|
1053
1075
|
}, getCloseProps(props)), React__default["default"].createElement(SvgXStroke, null));
|
|
@@ -1073,10 +1095,13 @@ FooterItem$2.displayName = 'FooterItem';
|
|
|
1073
1095
|
|
|
1074
1096
|
var Header$1 = React.forwardRef(function (props, ref) {
|
|
1075
1097
|
var _useModalContext = useModalContext(),
|
|
1098
|
+
isCloseButtonPresent = _useModalContext.isCloseButtonPresent,
|
|
1076
1099
|
getTitleProps = _useModalContext.getTitleProps;
|
|
1077
1100
|
return React__default["default"].createElement(StyledHeader, _extends$2({
|
|
1078
1101
|
ref: ref
|
|
1079
|
-
}, getTitleProps(props)
|
|
1102
|
+
}, getTitleProps(props), {
|
|
1103
|
+
isCloseButtonPresent: isCloseButtonPresent
|
|
1104
|
+
}), props.isDanger && React__default["default"].createElement(StyledDangerIcon, null), props.children);
|
|
1080
1105
|
});
|
|
1081
1106
|
Header$1.displayName = 'Header';
|
|
1082
1107
|
|
|
@@ -1243,8 +1268,7 @@ TooltipModalComponent.propTypes = {
|
|
|
1243
1268
|
onClose: PropTypes__default["default"].func,
|
|
1244
1269
|
backdropProps: PropTypes__default["default"].any,
|
|
1245
1270
|
focusOnMount: PropTypes__default["default"].bool,
|
|
1246
|
-
restoreFocus: PropTypes__default["default"].bool
|
|
1247
|
-
id: PropTypes__default["default"].string
|
|
1271
|
+
restoreFocus: PropTypes__default["default"].bool
|
|
1248
1272
|
};
|
|
1249
1273
|
var TooltipModal = TooltipModalComponent;
|
|
1250
1274
|
TooltipModal.Body = Body$1;
|
|
@@ -1255,10 +1279,13 @@ TooltipModal.Title = Title;
|
|
|
1255
1279
|
|
|
1256
1280
|
var HeaderComponent = React.forwardRef(function (props, ref) {
|
|
1257
1281
|
var _useModalContext = useModalContext(),
|
|
1282
|
+
isCloseButtonPresent = _useModalContext.isCloseButtonPresent,
|
|
1258
1283
|
getTitleProps = _useModalContext.getTitleProps;
|
|
1259
1284
|
return React__default["default"].createElement(StyledDrawerModalHeader, _extends$2({
|
|
1260
1285
|
ref: ref
|
|
1261
|
-
}, getTitleProps(props)
|
|
1286
|
+
}, getTitleProps(props), {
|
|
1287
|
+
isCloseButtonPresent: isCloseButtonPresent
|
|
1288
|
+
}));
|
|
1262
1289
|
});
|
|
1263
1290
|
HeaderComponent.displayName = 'DrawerModal.Header';
|
|
1264
1291
|
var Header = HeaderComponent;
|
|
@@ -1275,7 +1302,14 @@ var Body = BodyComponent;
|
|
|
1275
1302
|
|
|
1276
1303
|
var CloseComponent = React.forwardRef(function (props, ref) {
|
|
1277
1304
|
var _useModalContext = useModalContext(),
|
|
1278
|
-
getCloseProps = _useModalContext.getCloseProps
|
|
1305
|
+
getCloseProps = _useModalContext.getCloseProps,
|
|
1306
|
+
setCloseButtonPresent = _useModalContext.setCloseButtonPresent;
|
|
1307
|
+
React.useEffect(function () {
|
|
1308
|
+
setCloseButtonPresent(true);
|
|
1309
|
+
return function () {
|
|
1310
|
+
return setCloseButtonPresent(false);
|
|
1311
|
+
};
|
|
1312
|
+
});
|
|
1279
1313
|
return React__default["default"].createElement(StyledDrawerModalClose, _extends$2({
|
|
1280
1314
|
ref: ref
|
|
1281
1315
|
}, getCloseProps(props)), React__default["default"].createElement(SvgXStroke, null));
|
|
@@ -1313,6 +1347,10 @@ var DrawerModalComponent = React.forwardRef(function (_ref, ref) {
|
|
|
1313
1347
|
var transitionRef = React.useRef(null);
|
|
1314
1348
|
var theme = React.useContext(styled.ThemeContext);
|
|
1315
1349
|
var environment = reactTheming.useDocument(theme);
|
|
1350
|
+
var _useState = React.useState(false),
|
|
1351
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1352
|
+
isCloseButtonPresent = _useState2[0],
|
|
1353
|
+
setCloseButtonPresent = _useState2[1];
|
|
1316
1354
|
containerFocusvisible.useFocusVisible({
|
|
1317
1355
|
scope: modalRef,
|
|
1318
1356
|
relativeDocument: modalRef.current
|
|
@@ -1357,11 +1395,13 @@ var DrawerModalComponent = React.forwardRef(function (_ref, ref) {
|
|
|
1357
1395
|
}, [appendToNode, environment]);
|
|
1358
1396
|
var value = React.useMemo(function () {
|
|
1359
1397
|
return {
|
|
1398
|
+
isCloseButtonPresent: isCloseButtonPresent,
|
|
1360
1399
|
getTitleProps: getTitleProps,
|
|
1361
1400
|
getContentProps: getContentProps,
|
|
1362
|
-
getCloseProps: getCloseProps
|
|
1401
|
+
getCloseProps: getCloseProps,
|
|
1402
|
+
setCloseButtonPresent: setCloseButtonPresent
|
|
1363
1403
|
};
|
|
1364
|
-
}, [getTitleProps, getContentProps, getCloseProps]);
|
|
1404
|
+
}, [isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
1365
1405
|
if (!rootNode) {
|
|
1366
1406
|
return null;
|
|
1367
1407
|
}
|
|
@@ -1389,7 +1429,6 @@ DrawerModalComponent.propTypes = {
|
|
|
1389
1429
|
restoreFocus: PropTypes__default["default"].bool,
|
|
1390
1430
|
onClose: PropTypes__default["default"].func,
|
|
1391
1431
|
appendToNode: PropTypes__default["default"].any,
|
|
1392
|
-
id: PropTypes__default["default"].string,
|
|
1393
1432
|
isOpen: PropTypes__default["default"].bool
|
|
1394
1433
|
};
|
|
1395
1434
|
var DrawerModal = DrawerModalComponent;
|
|
@@ -1399,6 +1438,8 @@ DrawerModal.Footer = Footer;
|
|
|
1399
1438
|
DrawerModal.FooterItem = FooterItem;
|
|
1400
1439
|
DrawerModal.Header = Header;
|
|
1401
1440
|
|
|
1441
|
+
var PLACEMENT = ['auto', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
|
|
1442
|
+
|
|
1402
1443
|
exports.Body = Body$2;
|
|
1403
1444
|
exports.Close = Close$2;
|
|
1404
1445
|
exports.DrawerModal = DrawerModal;
|
|
@@ -1406,4 +1447,5 @@ exports.Footer = Footer$2;
|
|
|
1406
1447
|
exports.FooterItem = FooterItem$2;
|
|
1407
1448
|
exports.Header = Header$1;
|
|
1408
1449
|
exports.Modal = Modal;
|
|
1450
|
+
exports.PLACEMENT = PLACEMENT;
|
|
1409
1451
|
exports.TooltipModal = TooltipModal;
|
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.49.
|
|
274
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
304
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
336
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
362
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
380
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
400
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
487
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
527
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
621
|
+
'data-garden-version': '8.49.3',
|
|
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.49.
|
|
652
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
672
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
694
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
710
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
724
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
758
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
789
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
807
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
825
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
841
|
+
'data-garden-version': '8.49.3'
|
|
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.49.
|
|
859
|
+
'data-garden-version': '8.49.3'
|
|
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
|
}
|
|
@@ -979,8 +995,7 @@ Modal.propTypes = {
|
|
|
979
995
|
focusOnMount: PropTypes.bool,
|
|
980
996
|
restoreFocus: PropTypes.bool,
|
|
981
997
|
onClose: PropTypes.func,
|
|
982
|
-
appendToNode: PropTypes.any
|
|
983
|
-
id: PropTypes.string
|
|
998
|
+
appendToNode: PropTypes.any
|
|
984
999
|
};
|
|
985
1000
|
Modal.defaultProps = {
|
|
986
1001
|
isAnimated: true,
|
|
@@ -1017,7 +1032,14 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
1017
1032
|
|
|
1018
1033
|
var Close$2 = React__default.forwardRef(function (props, ref) {
|
|
1019
1034
|
var _useModalContext = useModalContext(),
|
|
1020
|
-
getCloseProps = _useModalContext.getCloseProps
|
|
1035
|
+
getCloseProps = _useModalContext.getCloseProps,
|
|
1036
|
+
setCloseButtonPresent = _useModalContext.setCloseButtonPresent;
|
|
1037
|
+
useEffect(function () {
|
|
1038
|
+
setCloseButtonPresent(true);
|
|
1039
|
+
return function () {
|
|
1040
|
+
return setCloseButtonPresent(false);
|
|
1041
|
+
};
|
|
1042
|
+
});
|
|
1021
1043
|
return React__default.createElement(StyledClose, _extends$2({
|
|
1022
1044
|
ref: ref
|
|
1023
1045
|
}, getCloseProps(props)), React__default.createElement(SvgXStroke, null));
|
|
@@ -1043,10 +1065,13 @@ FooterItem$2.displayName = 'FooterItem';
|
|
|
1043
1065
|
|
|
1044
1066
|
var Header$1 = forwardRef(function (props, ref) {
|
|
1045
1067
|
var _useModalContext = useModalContext(),
|
|
1068
|
+
isCloseButtonPresent = _useModalContext.isCloseButtonPresent,
|
|
1046
1069
|
getTitleProps = _useModalContext.getTitleProps;
|
|
1047
1070
|
return React__default.createElement(StyledHeader, _extends$2({
|
|
1048
1071
|
ref: ref
|
|
1049
|
-
}, getTitleProps(props)
|
|
1072
|
+
}, getTitleProps(props), {
|
|
1073
|
+
isCloseButtonPresent: isCloseButtonPresent
|
|
1074
|
+
}), props.isDanger && React__default.createElement(StyledDangerIcon, null), props.children);
|
|
1050
1075
|
});
|
|
1051
1076
|
Header$1.displayName = 'Header';
|
|
1052
1077
|
|
|
@@ -1213,8 +1238,7 @@ TooltipModalComponent.propTypes = {
|
|
|
1213
1238
|
onClose: PropTypes.func,
|
|
1214
1239
|
backdropProps: PropTypes.any,
|
|
1215
1240
|
focusOnMount: PropTypes.bool,
|
|
1216
|
-
restoreFocus: PropTypes.bool
|
|
1217
|
-
id: PropTypes.string
|
|
1241
|
+
restoreFocus: PropTypes.bool
|
|
1218
1242
|
};
|
|
1219
1243
|
var TooltipModal = TooltipModalComponent;
|
|
1220
1244
|
TooltipModal.Body = Body$1;
|
|
@@ -1225,10 +1249,13 @@ TooltipModal.Title = Title;
|
|
|
1225
1249
|
|
|
1226
1250
|
var HeaderComponent = forwardRef(function (props, ref) {
|
|
1227
1251
|
var _useModalContext = useModalContext(),
|
|
1252
|
+
isCloseButtonPresent = _useModalContext.isCloseButtonPresent,
|
|
1228
1253
|
getTitleProps = _useModalContext.getTitleProps;
|
|
1229
1254
|
return React__default.createElement(StyledDrawerModalHeader, _extends$2({
|
|
1230
1255
|
ref: ref
|
|
1231
|
-
}, getTitleProps(props)
|
|
1256
|
+
}, getTitleProps(props), {
|
|
1257
|
+
isCloseButtonPresent: isCloseButtonPresent
|
|
1258
|
+
}));
|
|
1232
1259
|
});
|
|
1233
1260
|
HeaderComponent.displayName = 'DrawerModal.Header';
|
|
1234
1261
|
var Header = HeaderComponent;
|
|
@@ -1245,7 +1272,14 @@ var Body = BodyComponent;
|
|
|
1245
1272
|
|
|
1246
1273
|
var CloseComponent = forwardRef(function (props, ref) {
|
|
1247
1274
|
var _useModalContext = useModalContext(),
|
|
1248
|
-
getCloseProps = _useModalContext.getCloseProps
|
|
1275
|
+
getCloseProps = _useModalContext.getCloseProps,
|
|
1276
|
+
setCloseButtonPresent = _useModalContext.setCloseButtonPresent;
|
|
1277
|
+
useEffect(function () {
|
|
1278
|
+
setCloseButtonPresent(true);
|
|
1279
|
+
return function () {
|
|
1280
|
+
return setCloseButtonPresent(false);
|
|
1281
|
+
};
|
|
1282
|
+
});
|
|
1249
1283
|
return React__default.createElement(StyledDrawerModalClose, _extends$2({
|
|
1250
1284
|
ref: ref
|
|
1251
1285
|
}, getCloseProps(props)), React__default.createElement(SvgXStroke, null));
|
|
@@ -1283,6 +1317,10 @@ var DrawerModalComponent = forwardRef(function (_ref, ref) {
|
|
|
1283
1317
|
var transitionRef = useRef(null);
|
|
1284
1318
|
var theme = useContext(ThemeContext);
|
|
1285
1319
|
var environment = useDocument(theme);
|
|
1320
|
+
var _useState = useState(false),
|
|
1321
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1322
|
+
isCloseButtonPresent = _useState2[0],
|
|
1323
|
+
setCloseButtonPresent = _useState2[1];
|
|
1286
1324
|
useFocusVisible({
|
|
1287
1325
|
scope: modalRef,
|
|
1288
1326
|
relativeDocument: modalRef.current
|
|
@@ -1327,11 +1365,13 @@ var DrawerModalComponent = forwardRef(function (_ref, ref) {
|
|
|
1327
1365
|
}, [appendToNode, environment]);
|
|
1328
1366
|
var value = useMemo(function () {
|
|
1329
1367
|
return {
|
|
1368
|
+
isCloseButtonPresent: isCloseButtonPresent,
|
|
1330
1369
|
getTitleProps: getTitleProps,
|
|
1331
1370
|
getContentProps: getContentProps,
|
|
1332
|
-
getCloseProps: getCloseProps
|
|
1371
|
+
getCloseProps: getCloseProps,
|
|
1372
|
+
setCloseButtonPresent: setCloseButtonPresent
|
|
1333
1373
|
};
|
|
1334
|
-
}, [getTitleProps, getContentProps, getCloseProps]);
|
|
1374
|
+
}, [isCloseButtonPresent, getTitleProps, getContentProps, getCloseProps]);
|
|
1335
1375
|
if (!rootNode) {
|
|
1336
1376
|
return null;
|
|
1337
1377
|
}
|
|
@@ -1359,7 +1399,6 @@ DrawerModalComponent.propTypes = {
|
|
|
1359
1399
|
restoreFocus: PropTypes.bool,
|
|
1360
1400
|
onClose: PropTypes.func,
|
|
1361
1401
|
appendToNode: PropTypes.any,
|
|
1362
|
-
id: PropTypes.string,
|
|
1363
1402
|
isOpen: PropTypes.bool
|
|
1364
1403
|
};
|
|
1365
1404
|
var DrawerModal = DrawerModalComponent;
|
|
@@ -1369,4 +1408,6 @@ DrawerModal.Footer = Footer;
|
|
|
1369
1408
|
DrawerModal.FooterItem = FooterItem;
|
|
1370
1409
|
DrawerModal.Header = Header;
|
|
1371
1410
|
|
|
1372
|
-
|
|
1411
|
+
var PLACEMENT = ['auto', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
|
|
1412
|
+
|
|
1413
|
+
export { Body$2 as Body, Close$2 as Close, DrawerModal, Footer$2 as Footer, FooterItem$2 as FooterItem, Header$1 as Header, Modal, PLACEMENT, TooltipModal };
|
|
@@ -4,40 +4,13 @@
|
|
|
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
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IDrawerModalProps } from '../../types';
|
|
8
9
|
import { Header } from './Header';
|
|
9
10
|
import { Body } from './Body';
|
|
10
11
|
import { Close } from './Close';
|
|
11
12
|
import { Footer } from './Footer';
|
|
12
13
|
import { FooterItem } from './FooterItem';
|
|
13
|
-
export interface IDrawerModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
|
-
/**
|
|
15
|
-
* Opens the modal
|
|
16
|
-
*/
|
|
17
|
-
isOpen?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Passes HTML attributes to the backdrop element
|
|
20
|
-
*/
|
|
21
|
-
backdropProps?: any;
|
|
22
|
-
/**
|
|
23
|
-
* Handles close actions. Can be triggered from the backdrop and from the close icon.
|
|
24
|
-
*
|
|
25
|
-
* @param {Object} event The DOM event that triggered the close action
|
|
26
|
-
*/
|
|
27
|
-
onClose?: (event: KeyboardEvent | MouseEvent) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Defines the DOM element that the modal will attatch to
|
|
30
|
-
*/
|
|
31
|
-
appendToNode?: Element;
|
|
32
|
-
/**
|
|
33
|
-
* Directs keyboard focus to the modal on mount
|
|
34
|
-
*/
|
|
35
|
-
focusOnMount?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Returns keyboard focus to the element that triggered the modal
|
|
38
|
-
*/
|
|
39
|
-
restoreFocus?: boolean;
|
|
40
|
-
}
|
|
41
14
|
/**
|
|
42
15
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
43
16
|
*/
|
|
@@ -4,13 +4,8 @@
|
|
|
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
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Applies danger styling
|
|
11
|
-
*/
|
|
12
|
-
isDanger?: boolean;
|
|
13
|
-
}
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IHeaderProps } from '../types';
|
|
14
9
|
/**
|
|
15
10
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
16
11
|
*/
|
|
@@ -4,43 +4,8 @@
|
|
|
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
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Passes HTML attributes to the backdrop element
|
|
11
|
-
*/
|
|
12
|
-
backdropProps?: HTMLAttributes<HTMLDivElement>;
|
|
13
|
-
/**
|
|
14
|
-
* Handles close actions. Can be triggered from the backdrop and from the close icon.
|
|
15
|
-
*
|
|
16
|
-
* @param {Object} event The DOM event that triggered the close action
|
|
17
|
-
*/
|
|
18
|
-
onClose?: (event: KeyboardEvent | MouseEvent) => void;
|
|
19
|
-
/**
|
|
20
|
-
* Centers the modal on the backdrop
|
|
21
|
-
*/
|
|
22
|
-
isCentered?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Animates the modal
|
|
25
|
-
*/
|
|
26
|
-
isAnimated?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Defines the DOM element that the modal will attatch to
|
|
29
|
-
*/
|
|
30
|
-
appendToNode?: Element;
|
|
31
|
-
/**
|
|
32
|
-
* Applies large styling
|
|
33
|
-
*/
|
|
34
|
-
isLarge?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Directs keyboard focus to the modal on mount
|
|
37
|
-
*/
|
|
38
|
-
focusOnMount?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Returns keyboard focus to the element that triggered the modal
|
|
41
|
-
*/
|
|
42
|
-
restoreFocus?: boolean;
|
|
43
|
-
}
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IModalProps } from '../types';
|
|
44
9
|
/**
|
|
45
10
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
46
11
|
*/
|
|
@@ -4,58 +4,13 @@
|
|
|
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
|
|
8
|
-
import {
|
|
9
|
-
import { GARDEN_PLACEMENT } from '../../utils/gardenPlacements';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { ITooltipModalProps } from '../../types';
|
|
10
9
|
import { Title } from './Title';
|
|
11
10
|
import { Body } from './Body';
|
|
12
11
|
import { Close } from './Close';
|
|
13
12
|
import { Footer } from './Footer';
|
|
14
13
|
import { FooterItem } from './FooterItem';
|
|
15
|
-
export interface ITooltipModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
16
|
-
/**
|
|
17
|
-
* Positions the modal relative to the provided `HTMLElement`
|
|
18
|
-
*/
|
|
19
|
-
referenceElement?: HTMLElement | null;
|
|
20
|
-
/**
|
|
21
|
-
* Modifies [Popper instance](https://popper.js.org/docs/v2/modifiers/) to customize positioning logic
|
|
22
|
-
*/
|
|
23
|
-
popperModifiers?: Partial<Modifier<any, any>>[];
|
|
24
|
-
/**
|
|
25
|
-
* Adjusts the placement of the tooltip
|
|
26
|
-
**/
|
|
27
|
-
placement?: GARDEN_PLACEMENT;
|
|
28
|
-
/**
|
|
29
|
-
* Adds an arrow to the tooltop
|
|
30
|
-
*/
|
|
31
|
-
hasArrow?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Animates the tooltop
|
|
34
|
-
*/
|
|
35
|
-
isAnimated?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Sets the `z-index` of the tooltip
|
|
38
|
-
*/
|
|
39
|
-
zIndex?: number;
|
|
40
|
-
/**
|
|
41
|
-
* Handles close actions. Can be triggered from the backdrop and from the close icon.
|
|
42
|
-
*
|
|
43
|
-
* @param {Object} event The DOM event that triggered the close action
|
|
44
|
-
*/
|
|
45
|
-
onClose?: (event: KeyboardEvent | MouseEvent) => void;
|
|
46
|
-
/**
|
|
47
|
-
* Passes HTML attributes to the backdrop element
|
|
48
|
-
*/
|
|
49
|
-
backdropProps?: any;
|
|
50
|
-
/**
|
|
51
|
-
* Directs keyboard focus to the modal on mount
|
|
52
|
-
*/
|
|
53
|
-
focusOnMount?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Returns keyboard focus to the element that triggered the modal
|
|
56
|
-
*/
|
|
57
|
-
restoreFocus?: boolean;
|
|
58
|
-
}
|
|
59
14
|
/**
|
|
60
15
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
61
16
|
*/
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -5,14 +5,12 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
export { Modal } from './elements/Modal';
|
|
8
|
-
export type { IModalProps } from './elements/Modal';
|
|
9
8
|
export { Body } from './elements/Body';
|
|
10
9
|
export { Close } from './elements/Close';
|
|
11
10
|
export { Footer } from './elements/Footer';
|
|
12
11
|
export { FooterItem } from './elements/FooterItem';
|
|
13
12
|
export { Header } from './elements/Header';
|
|
14
13
|
export { TooltipModal } from './elements/TooltipModal/TooltipModal';
|
|
15
|
-
export type { ITooltipModalProps } from './elements/TooltipModal/TooltipModal';
|
|
16
14
|
export { DrawerModal } from './elements/DrawerModal/DrawerModal';
|
|
17
|
-
export
|
|
18
|
-
export type { GARDEN_PLACEMENT } from './
|
|
15
|
+
export { PLACEMENT } from './types';
|
|
16
|
+
export type { IModalProps, IDrawerModalProps, ITooltipModalProps, Placement as GARDEN_PLACEMENT } from './types';
|
|
@@ -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>;
|
|
@@ -5,13 +5,10 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import { Placement } from '@popperjs/core';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* All valid [Popper.JS Placements](https://popper.js.org/popper-documentation.html#Popper.placements)
|
|
12
|
-
*/
|
|
8
|
+
import { TransitionStatus } from 'react-transition-group';
|
|
9
|
+
import { ITooltipModalProps } from '../types';
|
|
10
|
+
export interface IStyledTooltipModalProps extends Pick<ITooltipModalProps, 'hasArrow' | 'isAnimated'> {
|
|
13
11
|
placement: Placement;
|
|
14
|
-
|
|
15
|
-
transitionState?: string;
|
|
12
|
+
transitionState?: TransitionStatus;
|
|
16
13
|
}
|
|
17
14
|
export declare const StyledTooltipModal: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, IStyledTooltipModalProps, never>;
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import { Placement } from '@popperjs/core';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
zIndex?: number;
|
|
8
|
+
import { ITooltipModalProps } from '../types';
|
|
9
|
+
interface IStyledTooltipWrapperProps extends Pick<ITooltipModalProps, 'isAnimated' | 'zIndex'> {
|
|
11
10
|
placement?: Placement;
|
|
12
11
|
}
|
|
13
12
|
export declare const StyledTooltipWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, IStyledTooltipWrapperProps, never>;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
export { StyledBackdrop } from './StyledBackdrop';
|
|
8
|
-
export type { IStyledBackdropProps } from './StyledBackdrop';
|
|
9
8
|
export { StyledBody } from './StyledBody';
|
|
10
9
|
export { StyledClose } from './StyledClose';
|
|
11
10
|
export { StyledFooter } from './StyledFooter';
|
|
@@ -13,7 +12,6 @@ export { StyledFooterItem } from './StyledFooterItem';
|
|
|
13
12
|
export { StyledHeader } from './StyledHeader';
|
|
14
13
|
export { StyledDangerIcon } from './StyledDangerIcon';
|
|
15
14
|
export { StyledModal } from './StyledModal';
|
|
16
|
-
export type { IStyledModalProps } from './StyledModal';
|
|
17
15
|
export { StyledTooltipModalBackdrop } from './StyledTooltipModalBackdrop';
|
|
18
16
|
export { StyledTooltipWrapper } from './StyledTooltipWrapper';
|
|
19
17
|
export { StyledTooltipModal } from './StyledTooltipModal';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLAttributes, KeyboardEvent, MouseEvent } from 'react';
|
|
8
|
+
import { Modifier } from 'react-popper';
|
|
9
|
+
export declare const PLACEMENT: readonly ["auto", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "end", "end-top", "end-bottom", "start", "start-top", "start-bottom"];
|
|
10
|
+
export declare type Placement = typeof PLACEMENT[number];
|
|
11
|
+
export interface IModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
/**
|
|
13
|
+
* Passes HTML attributes to the backdrop element
|
|
14
|
+
*/
|
|
15
|
+
backdropProps?: HTMLAttributes<HTMLDivElement>;
|
|
16
|
+
/**
|
|
17
|
+
* Handles close actions. Can be triggered from the backdrop and from the close icon.
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} event The DOM event that triggered the close action
|
|
20
|
+
*/
|
|
21
|
+
onClose?: (event: KeyboardEvent | MouseEvent) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Centers the modal on the backdrop
|
|
24
|
+
*/
|
|
25
|
+
isCentered?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Animates the modal
|
|
28
|
+
*/
|
|
29
|
+
isAnimated?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Defines the DOM element that the modal will attatch to
|
|
32
|
+
*/
|
|
33
|
+
appendToNode?: Element;
|
|
34
|
+
/**
|
|
35
|
+
* Applies large styling
|
|
36
|
+
*/
|
|
37
|
+
isLarge?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Directs keyboard focus to the modal on mount
|
|
40
|
+
*/
|
|
41
|
+
focusOnMount?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Returns keyboard focus to the element that triggered the modal
|
|
44
|
+
*/
|
|
45
|
+
restoreFocus?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface IHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
48
|
+
/**
|
|
49
|
+
* Applies danger styling
|
|
50
|
+
*/
|
|
51
|
+
isDanger?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface IDrawerModalProps extends Omit<IModalProps, 'isAnimated' | 'isCentered' | 'isLarge'> {
|
|
54
|
+
/**
|
|
55
|
+
* Opens the modal
|
|
56
|
+
*/
|
|
57
|
+
isOpen?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface ITooltipModalProps extends Omit<IModalProps, 'appendToNode' | 'isCentered' | 'isLarge'> {
|
|
60
|
+
/**
|
|
61
|
+
* Positions the modal relative to the provided `HTMLElement`
|
|
62
|
+
*/
|
|
63
|
+
referenceElement?: HTMLElement | null;
|
|
64
|
+
/**
|
|
65
|
+
* Modifies [Popper instance](https://popper.js.org/docs/v2/modifiers/) to customize positioning logic
|
|
66
|
+
*/
|
|
67
|
+
popperModifiers?: Partial<Modifier<any, any>>[];
|
|
68
|
+
/**
|
|
69
|
+
* Adjusts the placement of the tooltip
|
|
70
|
+
**/
|
|
71
|
+
placement?: Placement;
|
|
72
|
+
/**
|
|
73
|
+
* Adds an arrow to the tooltop
|
|
74
|
+
*/
|
|
75
|
+
hasArrow?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Sets the `z-index` of the tooltip
|
|
78
|
+
*/
|
|
79
|
+
zIndex?: number;
|
|
80
|
+
}
|
|
@@ -4,26 +4,25 @@
|
|
|
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 { ARROW_POSITION, MENU_POSITION } from '@zendeskgarden/react-theming';
|
|
8
7
|
import { Placement } from '@popperjs/core';
|
|
9
|
-
|
|
8
|
+
import { Placement as GardenPlacement } from '../types';
|
|
10
9
|
/**
|
|
11
10
|
* Convert Garden RTL aware placement to Popper.JS valid placement
|
|
12
11
|
* @param {String} gardenPlacement
|
|
13
12
|
*/
|
|
14
|
-
export declare function getPopperPlacement(gardenPlacement:
|
|
13
|
+
export declare function getPopperPlacement(gardenPlacement: GardenPlacement): Placement;
|
|
15
14
|
/**
|
|
16
15
|
* Convert Garden RTL aware placement to RTL equivalent Popper.JS placement
|
|
17
16
|
* @param {String} gardenPlacement
|
|
18
17
|
*/
|
|
19
|
-
export declare function getRtlPopperPlacement(gardenPlacement:
|
|
18
|
+
export declare function getRtlPopperPlacement(gardenPlacement: GardenPlacement): Placement;
|
|
20
19
|
/**
|
|
21
20
|
* Convert Popper.JS placement to corresponding arrow position
|
|
22
21
|
* @param {String} popperPlacement
|
|
23
22
|
*/
|
|
24
|
-
export declare function getArrowPosition(popperPlacement: Placement):
|
|
23
|
+
export declare function getArrowPosition(popperPlacement: Placement): "top" | "top-left" | "top-right" | "right" | "right-top" | "right-bottom" | "bottom" | "bottom-left" | "bottom-right" | "left" | "left-top" | "left-bottom";
|
|
25
24
|
/**
|
|
26
25
|
* Convert Popper.JS placement to corresponding menu position
|
|
27
26
|
* @param {String} popperPlacement
|
|
28
27
|
*/
|
|
29
|
-
export declare function getMenuPosition(popperPlacement?: Placement):
|
|
28
|
+
export declare function getMenuPosition(popperPlacement?: Placement): "top" | "right" | "bottom" | "left";
|
|
@@ -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.49.
|
|
3
|
+
"version": "8.49.3",
|
|
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,8 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/react-transition-group": "4.4.4",
|
|
42
|
-
"@zendeskgarden/react-theming": "^8.49.
|
|
43
|
-
"@zendeskgarden/svg-icons": "6.
|
|
42
|
+
"@zendeskgarden/react-theming": "^8.49.3",
|
|
43
|
+
"@zendeskgarden/svg-icons": "6.31.1"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
46
|
"components",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"zendeskgarden:src": "src/index.ts",
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "983322364971c051ca6ce478770edfc3310e4c4b"
|
|
56
56
|
}
|