@royaloperahouse/chord 2.2.3-b-chord-development → 2.2.3-c-chord-development

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.
@@ -8575,13 +8575,79 @@ var _templateObject$1a, _templateObject2$R, _templateObject3$H, _templateObject4
8575
8575
  var InnerModal = /*#__PURE__*/styled__default.div(_templateObject$1a || (_templateObject$1a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 62px;\n background-color: var(--base-color-white);\n z-index: ", ";\n position: relative;\n\n @media ", ", ", " {\n height: 100vh;\n padding: 62px 0 0;\n }\n"])), zIndexes.popup, devices.smallMobile, devices.mobile);
8576
8576
  var CloseButton = /*#__PURE__*/styled__default.button(_templateObject2$R || (_templateObject2$R = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n right: 0;\n margin: 15px;\n height: 26px;\n width: 26px;\n padding: 0;\n background-color: transparent;\n border: none;\n cursor: pointer;\n @media ", " {\n margin: 25px;\n }\n @media ", ", ", " {\n margin: 30px;\n }\n"])), devices.tablet, devices.desktop, devices.largeDesktop);
8577
8577
  var ContentWrapper$1 = /*#__PURE__*/styled__default.div(_templateObject3$H || (_templateObject3$H = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
8578
- var Overlay = /*#__PURE__*/styled__default(Grid)(_templateObject4$y || (_templateObject4$y = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n align-content: center;\n background-color: rgba(0, 0, 0, 0.40);\n"])));
8578
+ var Overlay = /*#__PURE__*/styled__default(Grid)(_templateObject4$y || (_templateObject4$y = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n align-content: center;\n background-color: rgba(0, 0, 0, 0.4);\n"])));
8579
8579
 
8580
8580
  var _excluded$k = ["isOpen", "setIsOpen", "children", "appElementId"];
8581
+ var MAX_Z_INDEX = 9999999999;
8581
8582
 
8582
8583
  if (Modal.defaultStyles.content) {
8583
8584
  Modal.defaultStyles.content.position = 'static';
8584
8585
  }
8586
+ /**
8587
+ * A ModalWindow component, leveraging React Modal for rendering modals with enhanced accessibility
8588
+ * and styling customization. This component is designed to be flexible for various use cases, with
8589
+ * support for mobile responsiveness, custom z-indexes, and a close button.
8590
+ *
8591
+ * # Usage
8592
+ * This component is intended to be used in React applications where modal functionality is required.
8593
+ * It supports a range of props for customization, including isOpen, setIsOpen, children, appElementId,
8594
+ * and accepts all additional props supported by React Modal for further configuration.
8595
+ *
8596
+ * ## Basic Example
8597
+ * ```tsx
8598
+ * import React, { useState } from 'react';
8599
+ * import ModalWindow from './ModalWindow';
8600
+ *
8601
+ * const App = () => {
8602
+ * const [isOpen, setIsOpen] = useState(false);
8603
+ *
8604
+ * const toggleModal = () => setIsOpen(!isOpen);
8605
+ *
8606
+ * return (
8607
+ * <>
8608
+ * <button onClick={toggleModal}>Open Modal</button>
8609
+ * <ModalWindow
8610
+ * isOpen={isOpen}
8611
+ * setIsOpen={setIsOpen}
8612
+ * appElementId="root"
8613
+ * >
8614
+ * <div>Modal Content Here</div>
8615
+ * </ModalWindow>
8616
+ * </>
8617
+ * );
8618
+ * }
8619
+ * ```
8620
+ *
8621
+ * ## Advanced Usage
8622
+ * You can further customize the modal by directly passing props supported by React Modal.
8623
+ * This component adapts its z-index based on the device type (mobile or desktop) and allows for an
8624
+ * accessible close functionality.
8625
+ *
8626
+ * ```tsx
8627
+ * <ModalWindow
8628
+ * isOpen={isOpen}
8629
+ * setIsOpen={setIsOpen}
8630
+ * appElementId="root"
8631
+ * shouldCloseOnOverlayClick={true}
8632
+ * >
8633
+ * <YourCustomComponent />
8634
+ * </ModalWindow>
8635
+ * ```
8636
+ *
8637
+ * # Props
8638
+ * - `isOpen`: Boolean indicating if the modal is open.
8639
+ * - `setIsOpen`: Function to set the open state of the modal.
8640
+ * - `children`: Content to be displayed within the modal.
8641
+ * - `appElementId`: ID of the app element to assist with accessibility.
8642
+ * - All other props are passed directly to the underlying React Modal component, allowing for extensive customization.
8643
+ *
8644
+ * # Design and Accessibility
8645
+ * This component automatically applies a `ScrollLock` when the modal is open to prevent background
8646
+ * scrolling and sets appropriate z-index values to ensure the modal is layered correctly on the page.
8647
+ * It also configures the modal for accessibility, including support for closing on ESC and setting
8648
+ * `aria-modal` to true.
8649
+ */
8650
+
8585
8651
 
8586
8652
  var ModalWindow = function ModalWindow(_ref) {
8587
8653
  var isOpen = _ref.isOpen,
@@ -8593,10 +8659,10 @@ var ModalWindow = function ModalWindow(_ref) {
8593
8659
  var isMobile = useMobile();
8594
8660
  var customStyles = {
8595
8661
  overlay: {
8596
- zIndex: isMobile ? 9999999999 : zIndexes.overlay
8662
+ zIndex: isMobile ? MAX_Z_INDEX : zIndexes.overlay
8597
8663
  },
8598
8664
  content: {
8599
- zIndex: isMobile ? 9999999999 : zIndexes.popup,
8665
+ zIndex: isMobile ? MAX_Z_INDEX : zIndexes.popup,
8600
8666
  background: 'none',
8601
8667
  border: 'none'
8602
8668
  }
@@ -8612,9 +8678,7 @@ var ModalWindow = function ModalWindow(_ref) {
8612
8678
  style: customStyles,
8613
8679
  appElement: appElement,
8614
8680
  shouldCloseOnEsc: true,
8615
- onRequestClose: function onRequestClose() {
8616
- return setIsOpen(false);
8617
- },
8681
+ onRequestClose: closeModalHandler,
8618
8682
  "aria-modal": "true"
8619
8683
  }, modalProps), /*#__PURE__*/React__default.createElement(Overlay, null, /*#__PURE__*/React__default.createElement(GridItem, {
8620
8684
  columnStartDesktop: 6,