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