@mmb-digital/ds-lilly 0.10.59 → 0.10.60

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/ds-lilly.js CHANGED
@@ -92889,6 +92889,7 @@ var FormGroupContext = Object(external_root_React_commonjs2_react_commonjs_react
92889
92889
  var ModalContext_noop = function () { return null; };
92890
92890
  var ModalContext = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["createContext"])({
92891
92891
  disableDefaultCloseBehavior: false,
92892
+ disableCloseByEscape: false,
92892
92893
  identification: '',
92893
92894
  isFocused: false,
92894
92895
  isVisible: false,
@@ -105912,7 +105913,7 @@ var ModalContent = function (_a) {
105912
105913
  var ModalDialog = function (_a) {
105913
105914
  var _b;
105914
105915
  var children = _a.children, size = _a.size, testId = _a.testId, theme = _a.theme;
105915
- var _c = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useContext"])(contexts_ModalContext), disableDefaultCloseBehavior = _c.disableDefaultCloseBehavior, identification = _c.identification, reference = _c.reference;
105916
+ var _c = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useContext"])(contexts_ModalContext), disableCloseByEscape = _c.disableCloseByEscape, disableDefaultCloseBehavior = _c.disableDefaultCloseBehavior, identification = _c.identification, reference = _c.reference;
105916
105917
  var _d = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(''), scroll = _d[0], setScroll = _d[1];
105917
105918
  var updateSize = function () {
105918
105919
  var modalContent = document.getElementById(identification + "_content");
@@ -105929,7 +105930,13 @@ var ModalDialog = function (_a) {
105929
105930
  updateSize();
105930
105931
  return function () { return window.removeEventListener('resize', updateSize); };
105931
105932
  }, []);
105932
- return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("aside", { ref: reference, "aria-labelledby": identification + "_title", className: classBinder_cx('c-modal'), "data-testid": testId, role: disableDefaultCloseBehavior ? 'alertdialog' : 'dialog' },
105933
+ var handleKeyDown = function (event) {
105934
+ if (event.key === KEYS.Escape && disableCloseByEscape) {
105935
+ event.preventDefault();
105936
+ event.stopPropagation();
105937
+ }
105938
+ };
105939
+ return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("aside", { ref: reference, "aria-labelledby": identification + "_title", className: classBinder_cx('c-modal'), "data-testid": testId, role: disableDefaultCloseBehavior ? 'alertdialog' : 'dialog', onKeyDown: handleKeyDown },
105933
105940
  external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: classBinder_cx('c-modal__content', (_b = {},
105934
105941
  _b["" + scroll] = scroll,
105935
105942
  _b["c-modal__content--" + size] = size,
@@ -105975,9 +105982,10 @@ var external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_
105975
105982
 
105976
105983
 
105977
105984
  var Modal = function (_a) {
105978
- var children = _a.children, disableDefaultCloseBehavior = _a.disableDefaultCloseBehavior, hide = _a.hide, identification = _a.identification, isFocused = _a.isFocused, isVisible = _a.isVisible, reference = _a.reference, show = _a.show, size = _a.size, testId = _a.testId, theme = _a.theme;
105985
+ var children = _a.children, disableCloseByEscape = _a.disableCloseByEscape, disableDefaultCloseBehavior = _a.disableDefaultCloseBehavior, hide = _a.hide, identification = _a.identification, isFocused = _a.isFocused, isVisible = _a.isVisible, reference = _a.reference, show = _a.show, size = _a.size, testId = _a.testId, theme = _a.theme;
105979
105986
  var modalContext = {
105980
105987
  disableDefaultCloseBehavior: disableDefaultCloseBehavior,
105988
+ disableCloseByEscape: disableCloseByEscape,
105981
105989
  isVisible: isVisible,
105982
105990
  isFocused: isFocused,
105983
105991
  reference: reference,
@@ -106086,6 +106094,7 @@ var useModal = function (_a) {
106086
106094
  }, [isVisible]);
106087
106095
  var modalProps = {
106088
106096
  disableDefaultCloseBehavior: disableCloseByOutsideClick,
106097
+ disableCloseByEscape: disableCloseByEscape,
106089
106098
  isVisible: isVisible,
106090
106099
  isFocused: isFocused,
106091
106100
  reference: reference,
@@ -7,5 +7,5 @@ export interface ModalPropsType extends ComponentPropsType, ModalContextType {
7
7
  /** Optional size of modal content. */
8
8
  size?: 'small' | 'large';
9
9
  }
10
- export declare const Modal: ({ children, disableDefaultCloseBehavior, hide, identification, isFocused, isVisible, reference, show, size, testId, theme }: ModalPropsType) => JSX.Element;
10
+ export declare const Modal: ({ children, disableCloseByEscape, disableDefaultCloseBehavior, hide, identification, isFocused, isVisible, reference, show, size, testId, theme }: ModalPropsType) => JSX.Element;
11
11
  //# sourceMappingURL=Modal.d.ts.map
@@ -2,6 +2,8 @@
2
2
  export interface ModalContextType {
3
3
  /** If `true`, modal can be closed only by action buttons. */
4
4
  disableDefaultCloseBehavior: boolean;
5
+ /** If `true`, modal can not be closed by ESC key. */
6
+ disableCloseByEscape: boolean;
5
7
  /** Unique identification of modal. */
6
8
  identification: string;
7
9
  /** If `true` modal is focused for keyboard navigation. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmb-digital/ds-lilly",
3
- "version": "0.10.59",
3
+ "version": "0.10.60",
4
4
  "description": "MMB LILLY design system",
5
5
  "license": "UNLICENSED",
6
6
  "sideEffects": false,