@khanacademy/wonder-blocks-modal 8.10.7 → 9.0.0

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.js CHANGED
@@ -5,13 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
7
  var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
8
- var aphrodite = require('aphrodite');
9
- var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
10
8
  var wonderBlocksAnnouncer = require('@khanacademy/wonder-blocks-announcer');
9
+ var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
11
10
  var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
12
11
  var ReactDOM = require('react-dom');
13
12
  var wonderBlocksTiming = require('@khanacademy/wonder-blocks-timing');
14
- var wonderBlocksStyles = require('@khanacademy/wonder-blocks-styles');
15
13
  var xIcon = require('@phosphor-icons/core/bold/x-bold.svg');
16
14
  var IconButton = require('@khanacademy/wonder-blocks-icon-button');
17
15
  var wonderBlocksConfig = require('@khanacademy/wonder-blocks-config');
@@ -43,61 +41,89 @@ var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
43
41
 
44
42
  function useModalAnnouncer(forwardedRef){const internalRef=React__namespace.useRef(null);React__namespace.useEffect(()=>{const el=internalRef.current;if(!el){return}wonderBlocksAnnouncer.attachAnnouncerToModal(el);return ()=>{wonderBlocksAnnouncer.detachAnnouncerFromModal(el);}},[]);const ariaModalRef=React__namespace.useCallback(node=>{internalRef.current=node;if(typeof forwardedRef==="function"){forwardedRef(node);}else if(forwardedRef){forwardedRef.current=node;}},[]);return {ariaModalRef}}
45
43
 
44
+ const theme$1={root:{border:{radius:wonderBlocksTokens.border.radius.radius_040}},dialog:{layout:{padding:wonderBlocksTokens.sizing.size_160},shadow:{default:"none"}},header:{layout:{padding:{block:wonderBlocksTokens.sizing.size_240,inline:{default:wonderBlocksTokens.sizing.size_320,small:wonderBlocksTokens.sizing.size_160}},gap:{default:wonderBlocksTokens.sizing.size_080,title:{default:wonderBlocksTokens.sizing.size_160,small:wonderBlocksTokens.sizing.size_320}}}},panel:{layout:{gap:{default:wonderBlocksTokens.sizing.size_320,small:wonderBlocksTokens.sizing.size_160}}},footer:{layout:{padding:{inline:wonderBlocksTokens.sizing.size_160,block:wonderBlocksTokens.sizing.size_080}}},closeButton:{layout:{gapRight:wonderBlocksTokens.sizing.size_080,gapTop:wonderBlocksTokens.sizing.size_080}}};var themeDefault = theme$1;
45
+
46
+ var theme = wonderBlocksTokens.mapValuesToCssVars(themeDefault,"--wb-c-modal-");
47
+
46
48
  const ModalLauncherPortalAttributeName="data-modal-launcher-portal";const height={smMin:500};const width={mid:767};const modalMediaQuery={midOrSmaller:`@media screen and (max-width: ${width.mid}px) /* breakpoint.mediaQuery.midOrSmaller */`,midOrLarger:`@media screen and (min-width: ${width.mid}px) /* breakpoint.mediaQuery.midOrLarger */`,smMinOrSmallerHeight:`@media screen and (max-height:${height.smMin}px)`};
47
49
 
48
- const theme$1={root:{border:{radius:wonderBlocksTokens.border.radius.radius_040}},dialog:{layout:{padding:wonderBlocksTokens.sizing.size_160},shadow:{default:"none"}},header:{layout:{padding:{block:wonderBlocksTokens.sizing.size_240,inline:{default:wonderBlocksTokens.sizing.size_320,small:wonderBlocksTokens.sizing.size_160}},gap:{default:wonderBlocksTokens.sizing.size_080,title:{default:wonderBlocksTokens.sizing.size_160,small:wonderBlocksTokens.sizing.size_320}}}},panel:{layout:{gap:{default:wonderBlocksTokens.sizing.size_320,small:wonderBlocksTokens.sizing.size_160}}},footer:{layout:{padding:{inline:wonderBlocksTokens.sizing.size_160,block:wonderBlocksTokens.sizing.size_080}}},closeButton:{layout:{gapRight:wonderBlocksTokens.sizing.size_080,gapTop:wonderBlocksTokens.sizing.size_080}}};
50
+ const wrapperSmallScreenStyles={[modalMediaQuery.smMinOrSmallerHeight]:{overflow:"auto"},[modalMediaQuery.midOrSmaller]:{flexDirection:"column"}};const onePaneDialogSmallScreenStyles={[modalMediaQuery.smMinOrSmallerHeight]:{overflow:"auto"},[modalMediaQuery.midOrSmaller]:{flexDirection:"column",width:"100%",height:"100%",overflow:"hidden"}};const panelSmallScreenStyles={[modalMediaQuery.smMinOrSmallerHeight]:{overflow:"auto"}};const contentSmallScreenStyles={[modalMediaQuery.midOrSmaller]:{paddingInline:theme.panel.layout.gap.small}};const contentSmallHeightStyles={[modalMediaQuery.smMinOrSmallerHeight]:{flex:"unset",minBlockSize:"unset",overflow:"unset"}};const drawerSmallScreenStyles={[wonderBlocksTokens.breakpoint.mediaQuery.smOrSmaller]:{minInlineSize:"unset",maxInlineSize:"unset"}};const drawerBlockEndSmallScreenStyles={[wonderBlocksTokens.breakpoint.mediaQuery.smOrSmaller]:{minInlineSize:"unset",maxInlineSize:"unset",height:"auto"}};
49
51
 
50
- var theme = wonderBlocksTokens.mapValuesToCssVars(theme$1,"--wb-c-modal-");
52
+ var modules_802b32ef={"root":"wb-modal-dialog-root-0c114631","paddingLayer":"wb-modal-dialog-paddingLayer-0c114631","wrapper":"wb-modal-dialog-wrapper-0c114631","dialog":"wb-modal-dialog-dialog-0c114631","above":"wb-modal-dialog-above-0c114631","below":"wb-modal-dialog-below-0c114631"};
51
53
 
52
- const ModalDialog=React__namespace.forwardRef(function ModalDialog(props,ref){const{above,below,role="dialog",style,children,testId,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-describedby":ariaDescribedBy}=props;const{ariaModalRef}=useModalAnnouncer(ref);return jsxRuntime.jsx(wonderBlocksCore.View,{style:componentStyles$3.paddingLayer,"data-modal-padding-layer":true,children:jsxRuntime.jsxs(wonderBlocksCore.View,{style:[componentStyles$3.wrapper,style],children:[below&&jsxRuntime.jsx(wonderBlocksCore.View,{style:componentStyles$3.below,children:below}),jsxRuntime.jsx(wonderBlocksCore.View,{role:role,"aria-modal":"true","aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-describedby":ariaDescribedBy,ref:ariaModalRef,style:componentStyles$3.dialog,testId:testId,children:children}),above&&jsxRuntime.jsx(wonderBlocksCore.View,{style:componentStyles$3.above,children:above})]})})});const componentStyles$3=aphrodite.StyleSheet.create({paddingLayer:{alignItems:"center",height:"100%",justifyContent:"center",width:"100%",[modalMediaQuery.midOrSmaller]:{padding:theme.dialog.layout.padding}},wrapper:{alignItems:"stretch",borderRadius:theme.root.border.radius,boxShadow:theme.dialog.shadow.default,color:wonderBlocksTokens.semanticColor.core.foreground.neutral.strong,flexDirection:"row",height:"100%",position:"relative",width:"100%",[modalMediaQuery.midOrSmaller]:{flexDirection:"column"},[modalMediaQuery.smMinOrSmallerHeight]:{overflow:"auto"}},dialog:{width:"100%",height:"100%",borderRadius:theme.root.border.radius,overflow:"hidden",[modalMediaQuery.smMinOrSmallerHeight]:{overflow:"auto"}},above:{pointerEvents:"none",position:"absolute",insetBlockStart:0,insetInlineStart:0,insetBlockEnd:0,insetInlineEnd:0,zIndex:1},below:{pointerEvents:"none",position:"absolute",insetBlockStart:0,insetInlineStart:0,insetBlockEnd:0,insetInlineEnd:0,zIndex:-1}});ModalDialog.displayName="ModalDialog";
54
+ const ModalDialog=React__namespace.forwardRef(function ModalDialog(props,ref){const{above,below,role="dialog",style,children,testId,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-describedby":ariaDescribedBy}=props;const{ariaModalRef}=useModalAnnouncer(ref);return jsxRuntime.jsx(wonderBlocksCore.View,{style:[modules_802b32ef.root,modules_802b32ef.paddingLayer],"data-modal-padding-layer":true,children:jsxRuntime.jsxs(wonderBlocksCore.View,{style:[modules_802b32ef.wrapper,wrapperSmallScreenStyles,style],children:[below&&jsxRuntime.jsx(wonderBlocksCore.View,{style:modules_802b32ef.below,children:below}),jsxRuntime.jsx(wonderBlocksCore.View,{role:role,"aria-modal":"true","aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-describedby":ariaDescribedBy,ref:ariaModalRef,style:modules_802b32ef.dialog,testId:testId,children:children}),above&&jsxRuntime.jsx(wonderBlocksCore.View,{style:modules_802b32ef.above,children:above})]})})});ModalDialog.displayName="ModalDialog";var ModalDialog$1 = ModalDialog;
53
55
 
54
- function ModalFooter({children}){return jsxRuntime.jsx(wonderBlocksCore.View,{style:styles$7.footer,children:children})}ModalFooter.__IS_MODAL_FOOTER__=true;ModalFooter.isComponentOf=instance=>{return instance&&instance.type&&instance.type.__IS_MODAL_FOOTER__};const styles$7=aphrodite.StyleSheet.create({footer:{flex:"0 0 auto",boxSizing:"border-box",marginBlockStart:"auto",minBlockSize:wonderBlocksTokens.sizing.size_640,paddingInline:theme.footer.layout.padding.inline,paddingBlock:theme.footer.layout.padding.block,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",boxShadow:`0px -1px 0px ${wonderBlocksTokens.semanticColor.core.border.neutral.subtle}`}});
56
+ var modules_6a3864ff={"root":"wb-modal-footer-root-9e947823","footer":"wb-modal-footer-footer-9e947823"};var styles$2 = modules_6a3864ff;
55
57
 
56
- function ModalHeader(props){const{breadcrumbs=undefined,subtitle=undefined,testId,title,titleId}=props;if(subtitle&&breadcrumbs){throw new Error("'subtitle' and 'breadcrumbs' can't be used together")}return jsxRuntime.jsxs(wonderBlocksCore.View,{style:[styles$6.header],testId:testId,children:[breadcrumbs&&jsxRuntime.jsx(wonderBlocksCore.View,{style:styles$6.breadcrumbs,children:breadcrumbs}),jsxRuntime.jsx(wonderBlocksTypography.Heading,{size:"large",tag:"h2",style:styles$6.title,id:titleId,testId:testId&&`${testId}-title`,children:title}),subtitle&&jsxRuntime.jsx(wonderBlocksTypography.BodyText,{size:"small",style:styles$6.subtitle,testId:testId&&`${testId}-subtitle`,children:subtitle})]})}const styles$6=aphrodite.StyleSheet.create({header:{boxShadow:`0px 1px 0px ${wonderBlocksTokens.semanticColor.core.border.neutral.subtle}`,display:"flex",flexDirection:"column",minBlockSize:66,paddingBlock:theme.header.layout.padding.block,paddingInline:theme.header.layout.padding.inline.default,position:"relative",width:"100%",[modalMediaQuery.midOrSmaller]:{paddingInline:theme.header.layout.padding.inline.small},[modalMediaQuery.smMinOrSmallerHeight]:{minBlockSize:"unset"}},breadcrumbs:{color:wonderBlocksTokens.semanticColor.core.foreground.neutral.default,marginBlockEnd:theme.header.layout.gap.default},title:{paddingInlineEnd:theme.header.layout.gap.title.default,[modalMediaQuery.midOrSmaller]:{paddingInlineEnd:theme.header.layout.gap.title.small}},subtitle:{color:wonderBlocksTokens.semanticColor.core.foreground.neutral.default,marginBlockStart:theme.header.layout.gap.default}});
58
+ function ModalFooter({children}){return jsxRuntime.jsx(wonderBlocksCore.View,{style:[styles$2.root,styles$2.footer],children:children})}ModalFooter.__IS_MODAL_FOOTER__=true;ModalFooter.isComponentOf=instance=>{return instance&&instance.type&&instance.type.__IS_MODAL_FOOTER__};
57
59
 
58
- const FOCUSABLE_ELEMENTS$1='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';const FocusTrap=({children,style})=>{const modalRootRef=React__namespace.useRef(null);const tryToFocus=React__namespace.useCallback(node=>{if(node instanceof HTMLElement){try{node.focus();}catch(e){}return document.activeElement===node}},[]);const focusElementIn=React__namespace.useCallback(isLast=>{if(!modalRootRef.current){return}const modalRootAsHtmlEl=modalRootRef.current;const focusableNodes=Array.from(modalRootAsHtmlEl.querySelectorAll(FOCUSABLE_ELEMENTS$1)).filter(element=>{const style=window.getComputedStyle(element);return style.display!=="none"&&style.visibility!=="hidden"});const nodeIndex=!isLast?focusableNodes.length-1:0;const focusableNode=focusableNodes[nodeIndex];tryToFocus(focusableNode);},[tryToFocus]);const handleFocusMoveToLast=React__namespace.useCallback(()=>{focusElementIn(false);},[focusElementIn]);const handleFocusMoveToFirst=React__namespace.useCallback(()=>{focusElementIn(true);},[focusElementIn]);const getModalRoot=React__namespace.useCallback(node=>{if(!node){return}const modalRoot=ReactDOM__namespace.findDOMNode(node);if(!modalRoot){throw new Error("Assertion error: modal root should exist after mount")}modalRootRef.current=modalRoot;},[]);return jsxRuntime.jsxs(React__namespace.Fragment,{children:[jsxRuntime.jsx("div",{tabIndex:0,className:"modal-focus-trap-first",onFocus:handleFocusMoveToLast,style:{position:"fixed"}}),jsxRuntime.jsx(wonderBlocksCore.View,{style:style,ref:getModalRoot,children:children}),jsxRuntime.jsx("div",{tabIndex:0,className:"modal-focus-trap-last",onFocus:handleFocusMoveToFirst,style:{position:"fixed"}})]})};
60
+ var modules_0db31a3e={"root":"wb-modal-header-root-861865df","header":"wb-modal-header-header-861865df","breadcrumbs":"wb-modal-header-breadcrumbs-861865df","title":"wb-modal-header-title-861865df","subtitle":"wb-modal-header-subtitle-861865df"};var styles$1 = modules_0db31a3e;
61
+
62
+ function ModalHeader(props){const{breadcrumbs=undefined,subtitle=undefined,testId,title,titleId}=props;if(subtitle&&breadcrumbs){throw new Error("'subtitle' and 'breadcrumbs' can't be used together")}return jsxRuntime.jsxs(wonderBlocksCore.View,{style:[styles$1.root,styles$1.header],testId:testId,children:[breadcrumbs&&jsxRuntime.jsx(wonderBlocksCore.View,{style:styles$1.breadcrumbs,children:breadcrumbs}),jsxRuntime.jsx(wonderBlocksTypography.Heading,{size:"large",tag:"h2",style:styles$1.title,id:titleId,testId:testId&&`${testId}-title`,children:title}),subtitle&&jsxRuntime.jsx(wonderBlocksTypography.BodyText,{size:"small",style:styles$1.subtitle,testId:testId&&`${testId}-subtitle`,children:subtitle})]})}
63
+
64
+ const FOCUSABLE_ELEMENTS$1='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';const FocusTrap=({children,style})=>{const modalRootRef=React__namespace.useRef(null);const tryToFocus=React__namespace.useCallback(node=>{if(node instanceof HTMLElement){try{node.focus();}catch(e){}return document.activeElement===node}},[]);const focusElementIn=React__namespace.useCallback(isLast=>{if(!modalRootRef.current){return}const modalRootAsHtmlEl=modalRootRef.current;const focusableNodes=Array.from(modalRootAsHtmlEl.querySelectorAll(FOCUSABLE_ELEMENTS$1)).filter(element=>{const style=window.getComputedStyle(element);return style.display!=="none"&&style.visibility!=="hidden"});const nodeIndex=!isLast?focusableNodes.length-1:0;const focusableNode=focusableNodes[nodeIndex];tryToFocus(focusableNode);},[tryToFocus]);const handleFocusMoveToLast=React__namespace.useCallback(()=>{focusElementIn(false);},[focusElementIn]);const handleFocusMoveToFirst=React__namespace.useCallback(()=>{focusElementIn(true);},[focusElementIn]);const getModalRoot=React__namespace.useCallback(node=>{if(!node){return}const modalRoot=ReactDOM__namespace.findDOMNode(node);if(!modalRoot){throw new Error("Assertion error: modal root should exist after mount")}modalRootRef.current=modalRoot;},[]);return jsxRuntime.jsxs(React__namespace.Fragment,{children:[jsxRuntime.jsx("div",{tabIndex:0,className:"modal-focus-trap-first",onFocus:handleFocusMoveToLast,style:{position:"fixed"}}),jsxRuntime.jsx(wonderBlocksCore.View,{style:style,ref:getModalRoot,children:children}),jsxRuntime.jsx("div",{tabIndex:0,className:"modal-focus-trap-last",onFocus:handleFocusMoveToFirst,style:{position:"fixed"}})]})};var FocusTrap$1 = FocusTrap;
59
65
 
60
66
  const FOCUSABLE_ELEMENTS="a[href], details, input, textarea, select, button";function findFocusableNodes(root){return Array.from(root.querySelectorAll(FOCUSABLE_ELEMENTS))}
61
67
 
62
- const getInitialFocusElement=(node,initialFocusId)=>{if(!initialFocusId){return null}return ReactDOM__namespace.findDOMNode(node.querySelector(`#${initialFocusId}`))};const getFirstFocusableElement=node=>{const focusableElements=findFocusableNodes(node);if(!focusableElements){return null}return focusableElements[0]};const getDialogElement=node=>{const dialogElement=ReactDOM__namespace.findDOMNode(node.querySelector('[role="dialog"]'));dialogElement?.setAttribute("tabindex","-1");return dialogElement};const ModalBackdrop=({children,initialFocusId,onCloseModal,testId,style})=>{const backdropRef=React__namespace.useRef(null);const[mousePressedOutside,setMousePressedOutside]=React__namespace.useState(false);React__namespace.useEffect(()=>{const node=ReactDOM__namespace.findDOMNode(backdropRef.current);if(!node){return}const firstFocusableElement=getInitialFocusElement(node,initialFocusId)||getFirstFocusableElement(node)||getDialogElement(node);setTimeout(()=>{firstFocusableElement?.focus();},0);},[initialFocusId]);const handleMouseDown=React__namespace.useCallback(e=>{const target=e.target;const isBackdropClick=e.target===e.currentTarget;const isPaddingLayerClick=target?.hasAttribute?.("data-modal-padding-layer");setMousePressedOutside(isBackdropClick||isPaddingLayerClick);},[]);const handleMouseUp=React__namespace.useCallback(e=>{const target=e.target;const isBackdropClick=e.target===e.currentTarget;const isPaddingLayerClick=target?.hasAttribute?.("data-modal-padding-layer");if((isBackdropClick||isPaddingLayerClick)&&mousePressedOutside){onCloseModal();}setMousePressedOutside(false);},[mousePressedOutside,onCloseModal]);const backdropProps={[ModalLauncherPortalAttributeName]:true};return jsxRuntime.jsx(wonderBlocksCore.View,{ref:backdropRef,style:[styles$5.modalPositioner,style],onMouseDown:handleMouseDown,onMouseUp:handleMouseUp,testId:testId,...backdropProps,children:children})};const styles$5=aphrodite.StyleSheet.create({modalPositioner:{position:"fixed",insetInlineStart:0,insetBlockStart:0,width:"100%",height:"100%",alignItems:"center",justifyContent:"center",overflow:"auto",background:wonderBlocksTokens.semanticColor.core.background.overlay.default}});
68
+ var modules_02ebbaa2={"root":"wb-modal-backdrop-root-26b9a9a8","modalPositioner":"wb-modal-backdrop-modalPositioner-26b9a9a8"};
69
+
70
+ const getInitialFocusElement=(node,initialFocusId)=>{if(!initialFocusId){return null}return ReactDOM__namespace.findDOMNode(node.querySelector(`#${initialFocusId}`))};const getFirstFocusableElement=node=>{const focusableElements=findFocusableNodes(node);if(!focusableElements){return null}return focusableElements[0]};const getDialogElement=node=>{const dialogElement=ReactDOM__namespace.findDOMNode(node.querySelector('[role="dialog"]'));dialogElement?.setAttribute("tabindex","-1");return dialogElement};const ModalBackdrop=({children,initialFocusId,onCloseModal,testId,style})=>{const backdropRef=React__namespace.useRef(null);const[mousePressedOutside,setMousePressedOutside]=React__namespace.useState(false);React__namespace.useEffect(()=>{const node=ReactDOM__namespace.findDOMNode(backdropRef.current);if(!node){return}const firstFocusableElement=getInitialFocusElement(node,initialFocusId)||getFirstFocusableElement(node)||getDialogElement(node);setTimeout(()=>{firstFocusableElement?.focus();},0);},[initialFocusId]);const handleMouseDown=React__namespace.useCallback(e=>{const target=e.target;const isBackdropClick=e.target===e.currentTarget;const isPaddingLayerClick=target?.hasAttribute?.("data-modal-padding-layer");setMousePressedOutside(isBackdropClick||isPaddingLayerClick);},[]);const handleMouseUp=React__namespace.useCallback(e=>{const target=e.target;const isBackdropClick=e.target===e.currentTarget;const isPaddingLayerClick=target?.hasAttribute?.("data-modal-padding-layer");if((isBackdropClick||isPaddingLayerClick)&&mousePressedOutside){onCloseModal();}setMousePressedOutside(false);},[mousePressedOutside,onCloseModal]);const backdropProps={[ModalLauncherPortalAttributeName]:true};return jsxRuntime.jsx(wonderBlocksCore.View,{ref:backdropRef,style:[modules_02ebbaa2.root,modules_02ebbaa2.modalPositioner,style],onMouseDown:handleMouseDown,onMouseUp:handleMouseUp,testId:testId,...backdropProps,children:children})};var ModalBackdrop$1 = ModalBackdrop;
71
+
72
+ const needsHackyMobileSafariScrollDisabler=(()=>{if(typeof window==="undefined"){return false}const userAgent=window.navigator.userAgent;return userAgent.indexOf("iPad")>-1||userAgent.indexOf("iPhone")>-1})();let numModalsOpened=0;let oldOverflow;let oldPosition;let oldScrollY;let oldWidth;let oldTop;const ScrollDisabler=_props=>{React__namespace.useEffect(()=>{if(numModalsOpened===0){const body=document.body;if(!body){throw new Error("couldn't find document.body")}oldOverflow=body.style.overflow;oldScrollY=window.scrollY;if(needsHackyMobileSafariScrollDisabler){oldPosition=body.style.position;oldWidth=body.style.width;oldTop=body.style.top;}body.style.overflow="hidden";if(needsHackyMobileSafariScrollDisabler){body.style.position="fixed";body.style.width="100%";body.style.top=`${-oldScrollY}px`;}}numModalsOpened++;return ()=>{numModalsOpened--;if(numModalsOpened===0){const body=document.body;if(!body){throw new Error("couldn't find document.body")}body.style.overflow=oldOverflow;if(needsHackyMobileSafariScrollDisabler){body.style.position=oldPosition;body.style.width=oldWidth;body.style.top=oldTop;}if(typeof window!=="undefined"&&window.scrollTo){window.scrollTo(0,oldScrollY);}}}},[]);return null};var ScrollDisabler$1 = ScrollDisabler;
63
73
 
64
- const needsHackyMobileSafariScrollDisabler=(()=>{if(typeof window==="undefined"){return false}const userAgent=window.navigator.userAgent;return userAgent.indexOf("iPad")>-1||userAgent.indexOf("iPhone")>-1})();let numModalsOpened=0;let oldOverflow;let oldPosition;let oldScrollY;let oldWidth;let oldTop;const ScrollDisabler=_props=>{React__namespace.useEffect(()=>{if(numModalsOpened===0){const body=document.body;if(!body){throw new Error("couldn't find document.body")}oldOverflow=body.style.overflow;oldScrollY=window.scrollY;if(needsHackyMobileSafariScrollDisabler){oldPosition=body.style.position;oldWidth=body.style.width;oldTop=body.style.top;}body.style.overflow="hidden";if(needsHackyMobileSafariScrollDisabler){body.style.position="fixed";body.style.width="100%";body.style.top=`${-oldScrollY}px`;}}numModalsOpened++;return ()=>{numModalsOpened--;if(numModalsOpened===0){const body=document.body;if(!body){throw new Error("couldn't find document.body")}body.style.overflow=oldOverflow;if(needsHackyMobileSafariScrollDisabler){body.style.position=oldPosition;body.style.width=oldWidth;body.style.top=oldTop;}if(typeof window!=="undefined"&&window.scrollTo){window.scrollTo(0,oldScrollY);}}}},[]);return null};
74
+ const defaultContext={closeModal:undefined};const ModalContext=React__namespace.createContext(defaultContext);ModalContext.displayName="ModalContext";var ModalContext$1 = ModalContext;
65
75
 
66
- const defaultContext={closeModal:undefined};const ModalContext=React__namespace.createContext(defaultContext);ModalContext.displayName="ModalContext";
76
+ var modules_5a43fb8b={"root":"wb-modal-launcher-root-8b1f173e","container":"wb-modal-launcher-container-8b1f173e"};
67
77
 
68
- const ModalLauncher=props=>{const{backdropDismissEnabled=true,children,closedFocusId,initialFocusId,modal,onClose,opened:controlledOpened,schedule,styles:stylesProp,testId}=props;const lastElementFocusedOutsideModalRef=React__namespace.useRef(null);const[opened,setOpened]=React__namespace.useState(false);const isOpened=typeof controlledOpened==="boolean"?controlledOpened:opened;React__namespace.useEffect(()=>{if(typeof controlledOpened==="boolean"&&children){console.warn("'children' and 'opened' can't be used together");}if(typeof controlledOpened==="boolean"&&!onClose){console.warn("'onClose' should be used with 'opened'");}if(typeof controlledOpened!=="boolean"&&!children){console.warn("either 'children' or 'opened' must be set");}},[controlledOpened,children,onClose]);const saveLastElementFocused=React__namespace.useCallback(()=>{lastElementFocusedOutsideModalRef.current=document.activeElement;},[]);React__namespace.useEffect(()=>{if(!opened&&controlledOpened){saveLastElementFocused();}},[controlledOpened,opened,saveLastElementFocused]);const openModal=React__namespace.useCallback(()=>{saveLastElementFocused();setOpened(true);},[saveLastElementFocused]);const returnFocus=React__namespace.useCallback(()=>{if(closedFocusId){const focusElement=ReactDOM__namespace.findDOMNode(document.getElementById(closedFocusId));if(focusElement){schedule.animationFrame(()=>focusElement.focus(),{schedulePolicy:wonderBlocksTiming.SchedulePolicy.Immediately,clearPolicy:wonderBlocksTiming.ClearPolicy.Resolve});return}}const lastElement=lastElementFocusedOutsideModalRef.current;if(lastElement!=null){schedule.animationFrame(()=>{lastElement.focus();});}},[closedFocusId,schedule]);const handleCloseModal=React__namespace.useCallback(()=>{setOpened(false);onClose?.();returnFocus();},[onClose,returnFocus]);const renderModal=React__namespace.useCallback(()=>{if(typeof modal==="function"){return modal({closeModal:handleCloseModal})}else {return modal}},[modal,handleCloseModal]);const renderedChildren=children?children({openModal}):null;const{body}=document;if(!body){return null}return jsxRuntime.jsxs(ModalContext.Provider,{value:{closeModal:handleCloseModal},children:[renderedChildren,isOpened&&ReactDOM__namespace.createPortal(jsxRuntime.jsx(FocusTrap,{style:styles$4.container,children:jsxRuntime.jsx(ModalBackdrop,{initialFocusId:initialFocusId,testId:testId,style:stylesProp?.backdrop,onCloseModal:backdropDismissEnabled?handleCloseModal:()=>{},children:renderModal()})}),body),isOpened&&jsxRuntime.jsx(ModalLauncherKeypressListener,{onClose:handleCloseModal}),isOpened&&jsxRuntime.jsx(ScrollDisabler,{})]})};const ModalLauncherKeypressListener=({onClose})=>{const handleKeyup=React__namespace.useCallback(e=>{if(e.key==="Escape"){e.preventDefault();e.stopPropagation();onClose();}},[onClose]);React__namespace.useEffect(()=>{window.addEventListener("keyup",handleKeyup);return ()=>{window.removeEventListener("keyup",handleKeyup);}},[handleKeyup]);return null};const styles$4=aphrodite.StyleSheet.create({container:{zIndex:1080}});var modalLauncher = wonderBlocksTiming.withActionScheduler(ModalLauncher);
78
+ const ModalLauncher=props=>{const{backdropDismissEnabled=true,children,closedFocusId,initialFocusId,modal,onClose,opened:controlledOpened,schedule,styles:stylesProp,testId}=props;const lastElementFocusedOutsideModalRef=React__namespace.useRef(null);const[opened,setOpened]=React__namespace.useState(false);const isOpened=typeof controlledOpened==="boolean"?controlledOpened:opened;React__namespace.useEffect(()=>{if(typeof controlledOpened==="boolean"&&children){console.warn("'children' and 'opened' can't be used together");}if(typeof controlledOpened==="boolean"&&!onClose){console.warn("'onClose' should be used with 'opened'");}if(typeof controlledOpened!=="boolean"&&!children){console.warn("either 'children' or 'opened' must be set");}},[controlledOpened,children,onClose]);const saveLastElementFocused=React__namespace.useCallback(()=>{lastElementFocusedOutsideModalRef.current=document.activeElement;},[]);React__namespace.useEffect(()=>{if(!opened&&controlledOpened){saveLastElementFocused();}},[controlledOpened,opened,saveLastElementFocused]);const openModal=React__namespace.useCallback(()=>{saveLastElementFocused();setOpened(true);},[saveLastElementFocused]);const returnFocus=React__namespace.useCallback(()=>{if(closedFocusId){const focusElement=ReactDOM__namespace.findDOMNode(document.getElementById(closedFocusId));if(focusElement){schedule.animationFrame(()=>focusElement.focus(),{schedulePolicy:wonderBlocksTiming.SchedulePolicy.Immediately,clearPolicy:wonderBlocksTiming.ClearPolicy.Resolve});return}}const lastElement=lastElementFocusedOutsideModalRef.current;if(lastElement!=null){schedule.animationFrame(()=>{lastElement.focus();});}},[closedFocusId,schedule]);const handleCloseModal=React__namespace.useCallback(()=>{setOpened(false);onClose?.();returnFocus();},[onClose,returnFocus]);const renderModal=React__namespace.useCallback(()=>{if(typeof modal==="function"){return modal({closeModal:handleCloseModal})}else {return modal}},[modal,handleCloseModal]);const renderedChildren=children?children({openModal}):null;const{body}=document;if(!body){return null}return jsxRuntime.jsxs(ModalContext$1.Provider,{value:{closeModal:handleCloseModal},children:[renderedChildren,isOpened&&ReactDOM__namespace.createPortal(jsxRuntime.jsx(FocusTrap$1,{style:[modules_5a43fb8b.root,modules_5a43fb8b.container],children:jsxRuntime.jsx(ModalBackdrop$1,{initialFocusId:initialFocusId,testId:testId,style:stylesProp?.backdrop,onCloseModal:backdropDismissEnabled?handleCloseModal:()=>{},children:renderModal()})}),body),isOpened&&jsxRuntime.jsx(ModalLauncherKeypressListener,{onClose:handleCloseModal}),isOpened&&jsxRuntime.jsx(ScrollDisabler$1,{})]})};const ModalLauncherKeypressListener=({onClose})=>{const handleKeyup=React__namespace.useCallback(e=>{if(e.key==="Escape"){e.preventDefault();e.stopPropagation();onClose();}},[onClose]);React__namespace.useEffect(()=>{window.addEventListener("keyup",handleKeyup);return ()=>{window.removeEventListener("keyup",handleKeyup);}},[handleKeyup]);return null};var modalLauncher = wonderBlocksTiming.withActionScheduler(ModalLauncher);
69
79
 
70
- function ModalContent(props){const{scrollOverflow,style,children,applySmallHeightStyles=true}=props;return jsxRuntime.jsx(wonderBlocksCore.View,{style:[styles$3.wrapper,scrollOverflow&&styles$3.scrollOverflow,applySmallHeightStyles&&styles$3.wrapperSmallHeight],children:jsxRuntime.jsx(wonderBlocksCore.View,{style:[styles$3.content,applySmallHeightStyles&&styles$3.contentSmallHeight,style],children:children})})}ModalContent.__IS_MODAL_CONTENT__=true;ModalContent.isComponentOf=instance=>{return instance&&instance.type&&instance.type.__IS_MODAL_CONTENT__};const styles$3=aphrodite.StyleSheet.create({wrapper:{flex:1,display:"block"},wrapperSmallHeight:{[modalMediaQuery.smMinOrSmallerHeight]:{flex:"unset",minBlockSize:"unset",overflow:"unset"}},scrollOverflow:{overflow:"auto"},content:{flex:1,minBlockSize:"100%",padding:theme.panel.layout.gap.default,boxSizing:"border-box",[modalMediaQuery.midOrSmaller]:{paddingInline:theme.panel.layout.gap.small}},contentSmallHeight:{[modalMediaQuery.smMinOrSmallerHeight]:{flex:"unset",minBlockSize:"unset",overflow:"unset"}}});ModalContent.defaultProps={scrollOverflow:true,applySmallHeightStyles:true};
80
+ var modules_8ad27c48={"root":"wb-modal-content-root-71497938","wrapper":"wb-modal-content-wrapper-71497938","scrollOverflow":"wb-modal-content-scrollOverflow-71497938","content":"wb-modal-content-content-71497938","wrapperSmallHeight":"wb-modal-content-wrapperSmallHeight-71497938"};
71
81
 
72
- const CloseButton=({onClick,style,testId})=>{const{strings}=wonderBlocksConfig.useWonderBlocksI18n();return jsxRuntime.jsx(ModalContext.Consumer,{children:({closeModal})=>{if(closeModal&&onClick){throw new Error("You've specified 'onClose' on a modal when using ModalLauncher. Please specify 'onClose' on the ModalLauncher instead")}return jsxRuntime.jsx(IconButton__default["default"],{icon:xIcon__default["default"],"aria-label":strings.iconAltCloseModal,onClick:onClick||closeModal,kind:"tertiary",actionType:"neutral",style:style,testId:testId})}})};
82
+ function ModalContent(props){const{scrollOverflow,style,children,applySmallHeightStyles=true}=props;return jsxRuntime.jsx(wonderBlocksCore.View,{style:[modules_8ad27c48.root,modules_8ad27c48.wrapper,scrollOverflow&&modules_8ad27c48.scrollOverflow,applySmallHeightStyles&&modules_8ad27c48.wrapperSmallHeight],children:jsxRuntime.jsx(wonderBlocksCore.View,{style:[modules_8ad27c48.content,contentSmallScreenStyles,applySmallHeightStyles&&contentSmallHeightStyles,style],children:children})})}ModalContent.__IS_MODAL_CONTENT__=true;ModalContent.isComponentOf=instance=>{return instance&&instance.type&&instance.type.__IS_MODAL_CONTENT__};ModalContent.defaultProps={scrollOverflow:true,applySmallHeightStyles:true};
73
83
 
74
- function ModalPanel({closeButtonVisible=true,scrollOverflow=true,content,footer,header,onClose,style,testId}){const renderMainContent=React__namespace.useCallback(()=>{const mainContent=ModalContent.isComponentOf(content)?content:jsxRuntime.jsx(ModalContent,{children:content});if(!mainContent){return mainContent}return React__namespace.cloneElement(mainContent,{scrollOverflow,style:[!!footer&&styles$2.hasFooter,mainContent.props.style]})},[content,footer,scrollOverflow]);const mainContent=renderMainContent();return jsxRuntime.jsxs(wonderBlocksCore.View,{style:[styles$2.wrapper,style],testId:testId&&`${testId}-panel`,children:[closeButtonVisible&&jsxRuntime.jsx(CloseButton,{onClick:onClose,style:[styles$2.closeButton],testId:testId&&`${testId}-close`}),header,mainContent,!footer||ModalFooter.isComponentOf(footer)?footer:jsxRuntime.jsx(ModalFooter,{children:footer})]})}ModalPanel.defaultProps={closeButtonVisible:true,scrollOverflow:true};const styles$2=aphrodite.StyleSheet.create({wrapper:{flex:"1 1 auto",flexDirection:"column",background:wonderBlocksTokens.semanticColor.core.background.base.default,boxSizing:"border-box",overflow:"hidden",height:"100%",width:"100%",[modalMediaQuery.smMinOrSmallerHeight]:{overflow:"auto"}},closeButton:{position:"absolute",insetInlineEnd:theme.closeButton.layout.gapRight,insetBlockStart:theme.closeButton.layout.gapTop,zIndex:1,":focus":wonderBlocksStyles.focusStyles.focus[":focus-visible"]},hasFooter:{paddingBlockEnd:theme.panel.layout.gap.default}});
84
+ const CloseButton=({onClick,style,testId})=>{const{strings}=wonderBlocksConfig.useWonderBlocksI18n();return jsxRuntime.jsx(ModalContext$1.Consumer,{children:({closeModal})=>{if(closeModal&&onClick){throw new Error("You've specified 'onClose' on a modal when using ModalLauncher. Please specify 'onClose' on the ModalLauncher instead")}return jsxRuntime.jsx(IconButton__default["default"],{icon:xIcon__default["default"],"aria-label":strings.iconAltCloseModal,onClick:onClick||closeModal,kind:"tertiary",actionType:"neutral",style:style,testId:testId})}})};var CloseButton$1 = CloseButton;
75
85
 
76
- const renderHeader=(props,uniqueId)=>{const{title,breadcrumbs=undefined,subtitle=undefined,testId}=props;if(breadcrumbs){return jsxRuntime.jsx(ModalHeader,{title:title,breadcrumbs:breadcrumbs,titleId:uniqueId,testId:testId&&`${testId}-header`})}else if(subtitle){return jsxRuntime.jsx(ModalHeader,{title:title,subtitle:subtitle,titleId:uniqueId,testId:testId&&`${testId}-header`})}else {return jsxRuntime.jsx(ModalHeader,{title:title,titleId:uniqueId,testId:testId&&`${testId}-header`})}};const OnePaneDialog=props=>{const{onClose,footer,content,above,below,style,closeButtonVisible=true,testId,titleId,role,"aria-describedby":ariaDescribedBy}=props;return jsxRuntime.jsx(wonderBlocksCore.Id,{id:titleId,children:uniqueId=>jsxRuntime.jsx(ModalDialog,{style:[styles$1.dialog,style],above:above,below:below,testId:testId,"aria-labelledby":uniqueId,"aria-describedby":ariaDescribedBy,role:role,children:jsxRuntime.jsx(ModalPanel,{onClose:onClose,header:renderHeader(props,uniqueId),content:content,footer:footer,closeButtonVisible:closeButtonVisible,testId:testId})})})};const styles$1=aphrodite.StyleSheet.create({dialog:{maxInlineSize:576,width:"93.75%",height:"81.25%",maxBlockSize:624,[modalMediaQuery.midOrSmaller]:{width:"100%",height:"100%",overflow:"hidden"}}});
86
+ var modules_2c25c143={"root":"wb-modal-panel-root-77565dcb","wrapper":"wb-modal-panel-wrapper-77565dcb","hasFooter":"wb-modal-panel-hasFooter-77565dcb","closeButton":"wb-modal-panel-closeButton-77565dcb"};var styles = modules_2c25c143;
77
87
 
78
- function FlexiblePanel({closeButtonVisible=true,content,title,onClose,styles,testId}){const panelRef=React__namespace.useRef(null);const renderMainContent=React__namespace.useCallback(()=>{const contentNode=typeof content==="function"?content({title}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[title,content]});const mainContent=ModalContent.isComponentOf(contentNode)?contentNode:jsxRuntime.jsx(ModalContent,{style:styles?.content,applySmallHeightStyles:false,children:contentNode});if(!mainContent){return mainContent}return React__namespace.cloneElement(mainContent,{applySmallHeightStyles:false,style:[mainContent.props.style]})},[title,content,styles?.content]);const mainContent=renderMainContent();const defaultBackgroundStyle={backgroundColor:wonderBlocksTokens.semanticColor.core.background.base.default};const combinedBackgroundStyles={...defaultBackgroundStyle,...styles?.panel};return jsxRuntime.jsxs(wonderBlocksCore.View,{style:[componentStyles$2.wrapper,combinedBackgroundStyles],testId:testId&&`${testId}-panel`,ref:panelRef,children:[closeButtonVisible&&jsxRuntime.jsx(CloseButton,{onClick:onClose,style:[componentStyles$2.closeButton,styles?.closeButton],testId:testId&&`${testId}-close`}),mainContent]})}FlexiblePanel.defaultProps={closeButtonVisible:true};const componentStyles$2=aphrodite.StyleSheet.create({wrapper:{flex:"1 1 auto",flexDirection:"column",boxSizing:"border-box",overflow:"hidden",height:"100%",width:"100%"},closeButton:{position:"absolute",insetInlineEnd:theme.closeButton.layout.gapRight,insetBlockStart:theme.closeButton.layout.gapTop,zIndex:1,":focus":wonderBlocksStyles.focusStyles.focus[":focus-visible"]}});
88
+ function ModalPanel({closeButtonVisible=true,scrollOverflow=true,content,footer,header,onClose,style,testId}){const renderMainContent=React__namespace.useCallback(()=>{const mainContent=ModalContent.isComponentOf(content)?content:jsxRuntime.jsx(ModalContent,{children:content});if(!mainContent){return mainContent}return React__namespace.cloneElement(mainContent,{scrollOverflow,style:[!!footer&&styles.hasFooter,mainContent.props.style]})},[content,footer,scrollOverflow]);const mainContent=renderMainContent();return jsxRuntime.jsxs(wonderBlocksCore.View,{style:[styles.root,styles.wrapper,panelSmallScreenStyles,style],testId:testId&&`${testId}-panel`,children:[closeButtonVisible&&jsxRuntime.jsx(CloseButton$1,{onClick:onClose,style:[styles.closeButton],testId:testId&&`${testId}-close`}),header,mainContent,!footer||ModalFooter.isComponentOf(footer)?footer:jsxRuntime.jsx(ModalFooter,{children:footer})]})}ModalPanel.defaultProps={closeButtonVisible:true,scrollOverflow:true};
79
89
 
80
- const FlexibleDialog=React__namespace.forwardRef(function FlexibleDialog(props,ref){const{onClose,title,content,styles,closeButtonVisible=true,testId,titleId,role="dialog",...accessibilityProps}=props;const uniqueId=React__namespace.useId();const headingId=titleId??uniqueId;const{ariaModalRef}=useModalAnnouncer(ref);const renderedTitle=title==null?null:typeof title==="string"?jsxRuntime.jsx(wonderBlocksTypography.Heading,{id:headingId,children:title}):React__namespace.cloneElement(title,{id:headingId});return jsxRuntime.jsx(wonderBlocksCore.View,{style:[componentStyles$1.root,styles?.root],children:jsxRuntime.jsx(wonderBlocksCore.View,{role:role,"aria-modal":"true","aria-label":accessibilityProps["aria-label"],"aria-labelledby":headingId,"aria-describedby":accessibilityProps["aria-describedby"],ref:ariaModalRef,testId:testId,style:[componentStyles$1.dialog,styles?.dialog],children:jsxRuntime.jsx(FlexiblePanel,{styles:{panel:styles?.panel,content:styles?.content,closeButton:styles?.closeButton},onClose:onClose,title:renderedTitle,content:content,closeButtonVisible:closeButtonVisible,testId:testId})})})});const componentStyles$1=aphrodite.StyleSheet.create({root:{boxShadow:theme.dialog.shadow.default,color:wonderBlocksTokens.semanticColor.core.foreground.neutral.strong,overflow:"auto",position:"relative",willChange:"transform, opacity",height:"auto",maxBlockSize:"100vh",maxInlineSize:576,width:"93.75%"}});
90
+ var modules_feb951a9={"onePaneDialog":"wb-one-pane-dialog-onePaneDialog-a4d4f705"};
91
+
92
+ const renderHeader=(props,uniqueId)=>{const{title,breadcrumbs=undefined,subtitle=undefined,testId}=props;if(breadcrumbs){return jsxRuntime.jsx(ModalHeader,{title:title,breadcrumbs:breadcrumbs,titleId:uniqueId,testId:testId&&`${testId}-header`})}else if(subtitle){return jsxRuntime.jsx(ModalHeader,{title:title,subtitle:subtitle,titleId:uniqueId,testId:testId&&`${testId}-header`})}else {return jsxRuntime.jsx(ModalHeader,{title:title,titleId:uniqueId,testId:testId&&`${testId}-header`})}};const OnePaneDialog=props=>{const{onClose,footer,content,above,below,style,closeButtonVisible=true,testId,titleId,role,"aria-describedby":ariaDescribedBy}=props;return jsxRuntime.jsx(wonderBlocksCore.Id,{id:titleId,children:uniqueId=>jsxRuntime.jsx(ModalDialog$1,{style:[modules_feb951a9.onePaneDialog,onePaneDialogSmallScreenStyles,style],above:above,below:below,testId:testId,"aria-labelledby":uniqueId,"aria-describedby":ariaDescribedBy,role:role,children:jsxRuntime.jsx(ModalPanel,{onClose:onClose,header:renderHeader(props,uniqueId),content:content,footer:footer,closeButtonVisible:closeButtonVisible,testId:testId})})})};var OnePaneDialog$1 = OnePaneDialog;
93
+
94
+ var modules_0f19b942={"root":"wb-flexible-panel-root-caa0bc2b","wrapper":"wb-flexible-panel-wrapper-caa0bc2b","closeButton":"wb-flexible-panel-closeButton-caa0bc2b"};var componentStyles = modules_0f19b942;
95
+
96
+ function FlexiblePanel({closeButtonVisible=true,content,title,onClose,styles,testId}){const panelRef=React__namespace.useRef(null);const renderMainContent=React__namespace.useCallback(()=>{const contentNode=typeof content==="function"?content({title}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[title,content]});const mainContent=ModalContent.isComponentOf(contentNode)?contentNode:jsxRuntime.jsx(ModalContent,{style:styles?.content,applySmallHeightStyles:false,children:contentNode});if(!mainContent){return mainContent}return React__namespace.cloneElement(mainContent,{applySmallHeightStyles:false,style:[mainContent.props.style]})},[title,content,styles?.content]);const mainContent=renderMainContent();const defaultBackgroundStyle={backgroundColor:wonderBlocksTokens.semanticColor.core.background.base.default};return jsxRuntime.jsxs(wonderBlocksCore.View,{style:[componentStyles.root,componentStyles.wrapper,defaultBackgroundStyle,styles?.panel],testId:testId&&`${testId}-panel`,ref:panelRef,children:[closeButtonVisible&&jsxRuntime.jsx(CloseButton$1,{onClick:onClose,style:[componentStyles.closeButton,styles?.closeButton],testId:testId&&`${testId}-close`}),mainContent]})}FlexiblePanel.defaultProps={closeButtonVisible:true};
97
+
98
+ var modules_67358578={"root":"wb-flexible-dialog-root-77f9ee79","flexibleRoot":"wb-flexible-dialog-flexibleRoot-77f9ee79"};
99
+
100
+ const FlexibleDialog=React__namespace.forwardRef(function FlexibleDialog(props,ref){const{onClose,title,content,styles,closeButtonVisible=true,testId,titleId,role="dialog",...accessibilityProps}=props;const uniqueId=React__namespace.useId();const headingId=titleId??uniqueId;const{ariaModalRef}=useModalAnnouncer(ref);const renderedTitle=title==null?null:typeof title==="string"?jsxRuntime.jsx(wonderBlocksTypography.Heading,{id:headingId,children:title}):React__namespace.cloneElement(title,{id:headingId});return jsxRuntime.jsx(wonderBlocksCore.View,{style:[modules_67358578.root,modules_67358578.flexibleRoot,styles?.root],children:jsxRuntime.jsx(wonderBlocksCore.View,{role:role,"aria-modal":"true","aria-label":accessibilityProps["aria-label"],"aria-labelledby":headingId,"aria-describedby":accessibilityProps["aria-describedby"],ref:ariaModalRef,testId:testId,style:styles?.dialog,children:jsxRuntime.jsx(FlexiblePanel,{styles:{panel:styles?.panel,content:styles?.content,closeButton:styles?.closeButton},onClose:onClose,title:renderedTitle,content:content,closeButtonVisible:closeButtonVisible,testId:testId})})})});var FlexibleDialog$1 = FlexibleDialog;
81
101
 
82
102
  const DRAWER_ENTER_DURATION_MS=300;const DRAWER_EXIT_DURATION_MS=150;const DRAWER_ENTER_EASING="cubic-bezier(0.05, 0.7, 0.1, 1)";const DRAWER_EXIT_EASING="cubic-bezier(0.3, 0, 0.8, 0.15)";const DRAWER_SLIDE_OFFSET="42%";
83
103
 
84
- const DEFAULT_DRAWER_ANIMATED=true;const DEFAULT_DRAWER_BACKDROP_DISMISS_ENABLED=true;const DEFAULT_DRAWER_IS_EXITING=false;const defaultDrawerContextValue={animated:DEFAULT_DRAWER_ANIMATED,isExiting:DEFAULT_DRAWER_IS_EXITING};const DrawerContext=React__namespace.createContext(defaultDrawerContextValue);const useDrawerContext=()=>{return React__namespace.useContext(DrawerContext)};
104
+ const DEFAULT_DRAWER_TIMING_DURATION_MS=DRAWER_ENTER_DURATION_MS;const DEFAULT_DRAWER_ANIMATED=true;const DEFAULT_DRAWER_BACKDROP_DISMISS_ENABLED=true;const DEFAULT_DRAWER_IS_EXITING=false;const defaultDrawerContextValue={animated:DEFAULT_DRAWER_ANIMATED,isExiting:DEFAULT_DRAWER_IS_EXITING};const DrawerContext=React__namespace.createContext(defaultDrawerContextValue);const useDrawerContext=()=>{return React__namespace.useContext(DrawerContext)};
105
+
106
+ var modules_86e0fdaa={"root":"wb-drawer-backdrop-root-be242eab","backdrop-fade-in":"wb-drawer-backdrop-backdrop-fade-in-be242eab","backdrop-fade-out":"wb-drawer-backdrop-backdrop-fade-out-be242eab","drawerPositioner":"wb-drawer-backdrop-drawerPositioner-be242eab","inlineStart":"wb-drawer-backdrop-inlineStart-be242eab","inlineEnd":"wb-drawer-backdrop-inlineEnd-be242eab","blockEnd":"wb-drawer-backdrop-blockEnd-be242eab","fadeIn":"wb-drawer-backdrop-fadeIn-be242eab","fadeOut":"wb-drawer-backdrop-fadeOut-be242eab"};
85
107
 
86
- const DrawerBackdrop=({children,testId,initialFocusId,onCloseModal,style})=>{const{alignment,animated,timingDuration,isExiting}=useDrawerContext();const[mousePressedOutside,setMousePressedOutside]=React__namespace.useState(false);const backdropRef=React__namespace.useRef(null);const computedTimingDuration=animated?timingDuration??DRAWER_ENTER_DURATION_MS:0;const fadeStyle=isExiting?styles.fadeOut:styles.fadeIn;const fadeDurationOverride=timingDuration!=null?{animationDuration:`${timingDuration}ms`}:undefined;const getInitialFocusElement=React__namespace.useCallback(container=>{if(!initialFocusId){return null}return container.querySelector(`#${initialFocusId}`)},[initialFocusId]);const getFirstFocusableElement=React__namespace.useCallback(container=>{const focusableElements=findFocusableNodes(container);if(!focusableElements){return null}return focusableElements[0]},[]);const getDialogElement=React__namespace.useCallback(container=>{const dialogElement=container.querySelector('[role="dialog"]');if(dialogElement){dialogElement.tabIndex=-1;}return dialogElement},[]);React__namespace.useEffect(()=>{const container=backdropRef.current;if(!container){return}const firstFocusableElement=getInitialFocusElement(container)||getFirstFocusableElement(container)||getDialogElement(container);if(firstFocusableElement){setTimeout(()=>{firstFocusableElement.focus();},computedTimingDuration);}},[getInitialFocusElement,getFirstFocusableElement,getDialogElement,computedTimingDuration]);const handleMouseDown=e=>{if(e.target===e.currentTarget){setMousePressedOutside(true);}};const handleMouseUp=e=>{if(e.target===e.currentTarget&&mousePressedOutside){onCloseModal();}setMousePressedOutside(false);};const backdropProps={[ModalLauncherPortalAttributeName]:true};return jsxRuntime.jsx(wonderBlocksCore.View,{ref:backdropRef,style:[styles.drawerPositioner,alignment&&styles[alignment],animated&&fadeStyle,animated&&fadeDurationOverride,style].filter(Boolean),onMouseDown:handleMouseDown,onMouseUp:handleMouseUp,testId:testId,...backdropProps,children:children})};const keyframes={fadeIn:{"0%":{opacity:0},"100%":{opacity:1}},fadeOut:{"0%":{opacity:1},"100%":{opacity:0}}};const styles=aphrodite.StyleSheet.create({drawerPositioner:{position:"fixed",insetInlineStart:0,insetBlockStart:0,width:"100%",height:"100%",display:"flex",overflow:"hidden",background:wonderBlocksTokens.semanticColor.core.background.overlay.default},inlineStart:{alignItems:"flex-start",justifyContent:"flex-start"},inlineEnd:{alignItems:"flex-end",justifyContent:"flex-start"},blockEnd:{alignItems:"center",justifyContent:"flex-end"},fadeIn:{animationName:keyframes.fadeIn,animationDuration:`${DRAWER_ENTER_DURATION_MS}ms`,animationTimingFunction:"linear",animationFillMode:"forwards"},fadeOut:{animationName:keyframes.fadeOut,animationDuration:`${DRAWER_EXIT_DURATION_MS}ms`,animationTimingFunction:"linear",animationFillMode:"forwards"}});
108
+ const DrawerBackdrop=({children,testId,initialFocusId,onCloseModal,style})=>{const{alignment,animated,timingDuration,isExiting}=useDrawerContext();const[mousePressedOutside,setMousePressedOutside]=React__namespace.useState(false);const backdropRef=React__namespace.useRef(null);const computedTimingDuration=animated?timingDuration??DRAWER_ENTER_DURATION_MS:0;const fadeStyle=isExiting?modules_86e0fdaa.fadeOut:modules_86e0fdaa.fadeIn;const fadeDurationOverride=timingDuration!=null?{animationDuration:`${timingDuration}ms`}:undefined;const getInitialFocusElement=React__namespace.useCallback(container=>{if(!initialFocusId){return null}return container.querySelector(`#${initialFocusId}`)},[initialFocusId]);const getFirstFocusableElement=React__namespace.useCallback(container=>{const focusableElements=findFocusableNodes(container);if(!focusableElements){return null}return focusableElements[0]},[]);const getDialogElement=React__namespace.useCallback(container=>{const dialogElement=container.querySelector('[role="dialog"]');if(dialogElement){dialogElement.tabIndex=-1;}return dialogElement},[]);React__namespace.useEffect(()=>{const container=backdropRef.current;if(!container){return}const firstFocusableElement=getInitialFocusElement(container)||getFirstFocusableElement(container)||getDialogElement(container);if(firstFocusableElement){setTimeout(()=>{firstFocusableElement.focus();},computedTimingDuration);}},[getInitialFocusElement,getFirstFocusableElement,getDialogElement,computedTimingDuration]);const handleMouseDown=e=>{if(e.target===e.currentTarget){setMousePressedOutside(true);}};const handleMouseUp=e=>{if(e.target===e.currentTarget&&mousePressedOutside){onCloseModal();}setMousePressedOutside(false);};const backdropProps={[ModalLauncherPortalAttributeName]:true};return jsxRuntime.jsx(wonderBlocksCore.View,{ref:backdropRef,style:[modules_86e0fdaa.root,modules_86e0fdaa.drawerPositioner,alignment&&modules_86e0fdaa[alignment],animated&&fadeStyle,animated&&fadeDurationOverride,style].filter(Boolean),onMouseDown:handleMouseDown,onMouseUp:handleMouseUp,testId:testId,...backdropProps,children:children})};var DrawerBackdrop$1 = DrawerBackdrop;
87
109
 
88
- const defaultProps={backdropDismissEnabled:DEFAULT_DRAWER_BACKDROP_DISMISS_ENABLED};const DrawerLauncher=props=>{const{modal,backdropDismissEnabled=defaultProps.backdropDismissEnabled,initialFocusId,closedFocusId,testId,opened:controlledOpened,onClose,children,schedule,alignment,styles,animated=DEFAULT_DRAWER_ANIMATED,timingDuration,easing}=props;const easingEnter=easing?.enter;const easingExit=easing?.exit;const[uncontrolledOpened,setUncontrolledOpened]=React__namespace.useState(false);const[isExiting,setIsExiting]=React__namespace.useState(false);const lastElementFocusedOutsideModalRef=React__namespace.useRef(null);const opened=typeof controlledOpened==="boolean"?controlledOpened:uncontrolledOpened;const saveLastElementFocused=React__namespace.useCallback(()=>{lastElementFocusedOutsideModalRef.current=document.activeElement;},[]);React__namespace.useEffect(()=>{if(controlledOpened&&!prevControlledOpened.current){saveLastElementFocused();}prevControlledOpened.current=controlledOpened;},[controlledOpened,saveLastElementFocused]);const prevControlledOpened=React__namespace.useRef(controlledOpened);const returnFocus=React__namespace.useCallback(()=>{const focusElement=closedFocusId?document.getElementById(closedFocusId):null;schedule.animationFrame(()=>{if(focusElement){focusElement.focus();}else if(lastElementFocusedOutsideModalRef.current){lastElementFocusedOutsideModalRef.current.focus();}});},[closedFocusId,schedule]);const handleCloseModal=React__namespace.useCallback(()=>{if(animated){setIsExiting(true);setTimeout(()=>{setIsExiting(false);if(typeof controlledOpened==="boolean"){onClose?.();}else {setUncontrolledOpened(false);onClose?.();}returnFocus();},timingDuration??DRAWER_EXIT_DURATION_MS);}else {if(typeof controlledOpened==="boolean"){onClose?.();}else {setUncontrolledOpened(false);onClose?.();}returnFocus();}},[controlledOpened,onClose,returnFocus,animated,timingDuration]);const openModal=React__namespace.useCallback(()=>{saveLastElementFocused();setUncontrolledOpened(true);},[saveLastElementFocused]);const drawerDialogProps=React__namespace.useMemo(()=>({alignment,animated,isExiting,timingDuration,easing:{enter:easingEnter,exit:easingExit}}),[alignment,animated,isExiting,timingDuration,easingEnter,easingExit]);const renderModal=React__namespace.useCallback(()=>{if(typeof modal==="function"){const renderedModal=modal({closeModal:handleCloseModal});if(!renderedModal){return null}return renderedModal}if(!modal){return null}return modal},[modal,handleCloseModal]);const renderedChildren=children?children({openModal}):null;const body=document.body;if(!body){return null}return jsxRuntime.jsxs(ModalContext.Provider,{value:{closeModal:handleCloseModal},children:[renderedChildren,opened&&!isExiting||opened&&isExiting&&animated?ReactDOM__namespace.createPortal(jsxRuntime.jsx(DrawerContext.Provider,{value:drawerDialogProps,children:jsxRuntime.jsx(FocusTrap,{style:styles?.container,children:jsxRuntime.jsx(DrawerBackdrop,{initialFocusId:initialFocusId,testId:testId,style:styles?.backdrop,onCloseModal:backdropDismissEnabled?handleCloseModal:()=>{},children:renderModal()})})}),body):null,opened&&!isExiting&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(DrawerLauncherKeypressListener,{onClose:handleCloseModal}),jsxRuntime.jsx(ScrollDisabler,{})]})]})};function DrawerLauncherKeypressListener({onClose}){React__namespace.useEffect(()=>{const handleKeyup=e=>{if(e.key==="Escape"){e.preventDefault();e.stopPropagation();onClose();}};window.addEventListener("keyup",handleKeyup);return ()=>window.removeEventListener("keyup",handleKeyup)},[onClose]);return null}DrawerLauncher.displayName="DrawerLauncher";var drawerLauncher = wonderBlocksTiming.withActionScheduler(DrawerLauncher);
110
+ DEFAULT_DRAWER_TIMING_DURATION_MS;const defaultProps={backdropDismissEnabled:DEFAULT_DRAWER_BACKDROP_DISMISS_ENABLED};const DrawerLauncher=props=>{const{modal,backdropDismissEnabled=defaultProps.backdropDismissEnabled,initialFocusId,closedFocusId,testId,opened:controlledOpened,onClose,children,schedule,alignment,styles,animated=DEFAULT_DRAWER_ANIMATED,timingDuration,easing}=props;const easingEnter=easing?.enter;const easingExit=easing?.exit;const[uncontrolledOpened,setUncontrolledOpened]=React__namespace.useState(false);const[isExiting,setIsExiting]=React__namespace.useState(false);const lastElementFocusedOutsideModalRef=React__namespace.useRef(null);const opened=typeof controlledOpened==="boolean"?controlledOpened:uncontrolledOpened;const saveLastElementFocused=React__namespace.useCallback(()=>{lastElementFocusedOutsideModalRef.current=document.activeElement;},[]);React__namespace.useEffect(()=>{if(controlledOpened&&!prevControlledOpened.current){saveLastElementFocused();}prevControlledOpened.current=controlledOpened;},[controlledOpened,saveLastElementFocused]);const prevControlledOpened=React__namespace.useRef(controlledOpened);const returnFocus=React__namespace.useCallback(()=>{const focusElement=closedFocusId?document.getElementById(closedFocusId):null;schedule.animationFrame(()=>{if(focusElement){focusElement.focus();}else if(lastElementFocusedOutsideModalRef.current){lastElementFocusedOutsideModalRef.current.focus();}});},[closedFocusId,schedule]);const handleCloseModal=React__namespace.useCallback(()=>{if(animated){setIsExiting(true);setTimeout(()=>{setIsExiting(false);if(typeof controlledOpened==="boolean"){onClose?.();}else {setUncontrolledOpened(false);onClose?.();}returnFocus();},timingDuration??DRAWER_EXIT_DURATION_MS);}else {if(typeof controlledOpened==="boolean"){onClose?.();}else {setUncontrolledOpened(false);onClose?.();}returnFocus();}},[controlledOpened,onClose,returnFocus,animated,timingDuration]);const openModal=React__namespace.useCallback(()=>{saveLastElementFocused();setUncontrolledOpened(true);},[saveLastElementFocused]);const drawerDialogProps=React__namespace.useMemo(()=>({alignment,animated,isExiting,timingDuration,easing:{enter:easingEnter,exit:easingExit}}),[alignment,animated,isExiting,timingDuration,easingEnter,easingExit]);const renderModal=React__namespace.useCallback(()=>{if(typeof modal==="function"){const renderedModal=modal({closeModal:handleCloseModal});if(!renderedModal){return null}return renderedModal}if(!modal){return null}return modal},[modal,handleCloseModal]);const renderedChildren=children?children({openModal}):null;const body=document.body;if(!body){return null}return jsxRuntime.jsxs(ModalContext$1.Provider,{value:{closeModal:handleCloseModal},children:[renderedChildren,opened&&!isExiting||opened&&isExiting&&animated?ReactDOM__namespace.createPortal(jsxRuntime.jsx(DrawerContext.Provider,{value:drawerDialogProps,children:jsxRuntime.jsx(FocusTrap$1,{style:styles?.container,children:jsxRuntime.jsx(DrawerBackdrop$1,{initialFocusId:initialFocusId,testId:testId,style:styles?.backdrop,onCloseModal:backdropDismissEnabled?handleCloseModal:()=>{},children:renderModal()})})}),body):null,opened&&!isExiting&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(DrawerLauncherKeypressListener,{onClose:handleCloseModal}),jsxRuntime.jsx(ScrollDisabler$1,{})]})]})};function DrawerLauncherKeypressListener({onClose}){React__namespace.useEffect(()=>{const handleKeyup=e=>{if(e.key==="Escape"){e.preventDefault();e.stopPropagation();onClose();}};window.addEventListener("keyup",handleKeyup);return ()=>window.removeEventListener("keyup",handleKeyup)},[onClose]);return null}DrawerLauncher.displayName="DrawerLauncher";var drawerLauncher = wonderBlocksTiming.withActionScheduler(DrawerLauncher);
89
111
 
90
- const DrawerDialog=React__namespace.forwardRef(function DrawerDialog(props,ref){const contextProps=useDrawerContext();const alignment=contextProps.alignment??"inlineEnd";const animated=contextProps.animated??DEFAULT_DRAWER_ANIMATED;const isExiting=contextProps.isExiting??DEFAULT_DRAWER_IS_EXITING;const timingDuration=contextProps.timingDuration;const easing=contextProps.easing;const{styles}=props;const direction=wonderBlocksCore.useDirectionDetection();const isRtl=direction==="rtl";const phase=isExiting?"exit":"enter";const defaultAnimationStyle=DEFAULT_ANIMATION_STYLES[alignment][isRtl?"rtl":"ltr"][phase];const phaseEasing=easing?.[phase];const animationStyle=!animated?undefined:timingDuration===undefined&&phaseEasing===undefined?defaultAnimationStyle:{...defaultAnimationStyle,...timingDuration!==undefined&&{animationDuration:`${timingDuration}ms`},...phaseEasing!==undefined&&{animationTimingFunction:phaseEasing}};return jsxRuntime.jsx(FlexibleDialog,{...props,ref:ref,styles:{root:[componentStyles.root,componentStyles[alignment],animationStyle,styles?.root].filter(Boolean),dialog:[alignment==="blockEnd"?componentStyles.dialogBlockEnd:componentStyles.dialogDefault,styles?.dialog].filter(Boolean),panel:styles?.panel,content:styles?.content,closeButton:styles?.closeButton}})});const REST_TRANSFORM="translate3d(0, 0, 0)";const getTransformValue=(isRtl,alignment,offset)=>{if(alignment==="blockEnd"){return `translate3d(0, ${offset}, 0)`}const isNegative=isRtl?alignment==="inlineEnd":alignment==="inlineStart";const signedOffset=isNegative?`calc(-1 * ${offset})`:offset;return `translate3d(${signedOffset}, 0, 0)`};const createKeyframes=(isRtl,alignment)=>({slideIn:{"0%":{transform:getTransformValue(isRtl,alignment,DRAWER_SLIDE_OFFSET),opacity:0},"100%":{transform:REST_TRANSFORM,opacity:1}},slideOut:{"0%":{transform:REST_TRANSFORM,opacity:1},"100%":{transform:getTransformValue(isRtl,alignment,DRAWER_SLIDE_OFFSET),opacity:0}}});const buildDefaultStyle=(isExiting,alignmentKeyframes)=>({animationName:isExiting?alignmentKeyframes.slideOut:alignmentKeyframes.slideIn,animationDuration:`${isExiting?DRAWER_EXIT_DURATION_MS:DRAWER_ENTER_DURATION_MS}ms`,animationTimingFunction:isExiting?DRAWER_EXIT_EASING:DRAWER_ENTER_EASING,animationFillMode:isExiting?"forwards":"backwards"});const buildDirectionStyles=alignment=>{const ltrKeyframes=createKeyframes(false,alignment);const rtlKeyframes=alignment==="blockEnd"?ltrKeyframes:createKeyframes(true,alignment);return {ltr:{enter:buildDefaultStyle(false,ltrKeyframes),exit:buildDefaultStyle(true,ltrKeyframes)},rtl:{enter:buildDefaultStyle(false,rtlKeyframes),exit:buildDefaultStyle(true,rtlKeyframes)}}};const DEFAULT_ANIMATION_STYLES={inlineStart:buildDirectionStyles("inlineStart"),inlineEnd:buildDirectionStyles("inlineEnd"),blockEnd:buildDirectionStyles("blockEnd")};const componentStyles=aphrodite.StyleSheet.create({root:{boxShadow:theme.dialog.shadow.default,color:wonderBlocksTokens.semanticColor.core.foreground.neutral.strong,overflow:"auto",position:"relative",willChange:"transform, opacity",height:"100%",minBlockSize:"100vh",minInlineSize:wonderBlocksTokens.breakpoint.width.xsMax,maxInlineSize:wonderBlocksTokens.breakpoint.width.smMax,width:"100%",[wonderBlocksTokens.breakpoint.mediaQuery.smOrSmaller]:{minInlineSize:"unset",maxInlineSize:"unset"}},dialogDefault:{minBlockSize:"100vh",minInlineSize:"unset"},dialogBlockEnd:{minBlockSize:"unset",minInlineSize:"unset"},inlineStart:{},inlineEnd:{},blockEnd:{height:"auto",minBlockSize:"unset",maxInlineSize:"unset",[wonderBlocksTokens.breakpoint.mediaQuery.smOrSmaller]:{height:"auto"}}});DrawerDialog.displayName="DrawerDialog";
112
+ var modules_8866c729={"root":"wb-drawer-dialog-root-e8a53d57","drawerRoot":"wb-drawer-dialog-drawerRoot-e8a53d57","blockEnd":"wb-drawer-dialog-blockEnd-e8a53d57","dialogDefault":"wb-drawer-dialog-dialogDefault-e8a53d57","dialogBlockEnd":"wb-drawer-dialog-dialogBlockEnd-e8a53d57"};
113
+
114
+ const DrawerDialog=React__namespace.forwardRef(function DrawerDialog(props,ref){const contextProps=useDrawerContext();const alignment=contextProps.alignment??"inlineEnd";const animated=contextProps.animated??DEFAULT_DRAWER_ANIMATED;const isExiting=contextProps.isExiting??DEFAULT_DRAWER_IS_EXITING;const timingDuration=contextProps.timingDuration;const easing=contextProps.easing;const{styles}=props;const direction=wonderBlocksCore.useDirectionDetection();const isRtl=direction==="rtl";const phase=isExiting?"exit":"enter";const defaultAnimationStyle=DEFAULT_ANIMATION_STYLES[alignment][isRtl?"rtl":"ltr"][phase];const phaseEasing=easing?.[phase];const animationStyle=!animated?undefined:timingDuration===undefined&&phaseEasing===undefined?defaultAnimationStyle:{...defaultAnimationStyle,...timingDuration!==undefined&&{animationDuration:`${timingDuration}ms`},...phaseEasing!==undefined&&{animationTimingFunction:phaseEasing}};return jsxRuntime.jsx(FlexibleDialog$1,{...props,ref:ref,styles:{root:[modules_8866c729.root,modules_8866c729.drawerRoot,alignmentStyles[alignment],animationStyle,alignment==="blockEnd"?drawerBlockEndSmallScreenStyles:drawerSmallScreenStyles,styles?.root].filter(Boolean),dialog:[alignment==="blockEnd"?modules_8866c729.dialogBlockEnd:modules_8866c729.dialogDefault,styles?.dialog].filter(Boolean),panel:styles?.panel,content:styles?.content,closeButton:styles?.closeButton}})});const alignmentStyles={inlineStart:undefined,inlineEnd:undefined,blockEnd:modules_8866c729.blockEnd};const REST_TRANSFORM="translate3d(0, 0, 0)";const getTransformValue=(isRtl,alignment,offset)=>{if(alignment==="blockEnd"){return `translate3d(0, ${offset}, 0)`}const isNegative=isRtl?alignment==="inlineEnd":alignment==="inlineStart";const signedOffset=isNegative?`calc(-1 * ${offset})`:offset;return `translate3d(${signedOffset}, 0, 0)`};const createKeyframes=(isRtl,alignment)=>({slideIn:{"0%":{transform:getTransformValue(isRtl,alignment,DRAWER_SLIDE_OFFSET),opacity:0},"100%":{transform:REST_TRANSFORM,opacity:1}},slideOut:{"0%":{transform:REST_TRANSFORM,opacity:1},"100%":{transform:getTransformValue(isRtl,alignment,DRAWER_SLIDE_OFFSET),opacity:0}}});const buildDefaultStyle=(isExiting,alignmentKeyframes)=>({animationName:isExiting?alignmentKeyframes.slideOut:alignmentKeyframes.slideIn,animationDuration:`${isExiting?DRAWER_EXIT_DURATION_MS:DRAWER_ENTER_DURATION_MS}ms`,animationTimingFunction:isExiting?DRAWER_EXIT_EASING:DRAWER_ENTER_EASING,animationFillMode:isExiting?"forwards":"backwards"});const buildDirectionStyles=alignment=>{const ltrKeyframes=createKeyframes(false,alignment);const rtlKeyframes=alignment==="blockEnd"?ltrKeyframes:createKeyframes(true,alignment);return {ltr:{enter:buildDefaultStyle(false,ltrKeyframes),exit:buildDefaultStyle(true,ltrKeyframes)},rtl:{enter:buildDefaultStyle(false,rtlKeyframes),exit:buildDefaultStyle(true,rtlKeyframes)}}};const DEFAULT_ANIMATION_STYLES={inlineStart:buildDirectionStyles("inlineStart"),inlineEnd:buildDirectionStyles("inlineEnd"),blockEnd:buildDirectionStyles("blockEnd")};DrawerDialog.displayName="DrawerDialog";var DrawerDialog$1 = DrawerDialog;
91
115
 
92
116
  function maybeGetNextAncestorModalLauncherPortal(element){let candidateElement=element&&element.parentElement;while(candidateElement&&!candidateElement.hasAttribute(ModalLauncherPortalAttributeName)){candidateElement=candidateElement.parentElement;}return candidateElement}function maybeGetPortalMountedModalHostElement(element){return maybeGetNextAncestorModalLauncherPortal(element)}
93
117
 
94
- exports.DrawerDialog = DrawerDialog;
118
+ exports.DrawerDialog = DrawerDialog$1;
95
119
  exports.DrawerLauncher = drawerLauncher;
96
- exports.FlexibleDialog = FlexibleDialog;
97
- exports.ModalDialog = ModalDialog;
120
+ exports.FlexibleDialog = FlexibleDialog$1;
121
+ exports.ModalDialog = ModalDialog$1;
98
122
  exports.ModalFooter = ModalFooter;
99
123
  exports.ModalHeader = ModalHeader;
100
124
  exports.ModalLauncher = modalLauncher;
101
125
  exports.ModalPanel = ModalPanel;
102
- exports.OnePaneDialog = OnePaneDialog;
126
+ exports.OnePaneDialog = OnePaneDialog$1;
103
127
  exports.maybeGetPortalMountedModalHostElement = maybeGetPortalMountedModalHostElement;
128
+
129
+ require("./index.css");
@@ -0,0 +1,44 @@
1
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
2
+ /**
3
+ * Small-screen overrides for the modal elements a consumer can style
4
+ * (`OnePaneDialog` / `ModalDialog` `style`, `ModalPanel` `style`,
5
+ * `ModalContent` / `FlexibleDialog` `styles.content`, `DrawerDialog`
6
+ * `styles.root`).
7
+ *
8
+ * These stay plain style objects, not CSS Modules rules, on purpose: a
9
+ * consumer's `style` still goes through Aphrodite (unlayered and
10
+ * `!important`), which outranks every rule in `@layer shared`, media queries
11
+ * included. `processStyleList` merges plain objects into an Aphrodite style
12
+ * after the consumer's `StyleSheet` styles, and Aphrodite emits `@media`
13
+ * blocks after the base declarations, so these keep beating a consumer's base
14
+ * styles on small screens, as they did before the CSS Modules migration.
15
+ *
16
+ * `processStyleList` merges plain objects shallowly, so two objects that share
17
+ * a media-query key replace each other's block. That's why `OnePaneDialog`
18
+ * uses one object that includes the wrapper's rules. Key order is emission
19
+ * order: the small-height block comes before the narrow-width block, as
20
+ * Aphrodite emitted them.
21
+ *
22
+ * TODO [WB-2137]: standardize media query breakpoint tokens
23
+ */
24
+ /** `ModalDialog`'s wrapper (the element that receives its `style`). */
25
+ export declare const wrapperSmallScreenStyles: StyleType;
26
+ /**
27
+ * `OnePaneDialog`'s dialog size, on the same element as the wrapper. Includes
28
+ * the wrapper's rules because it replaces `wrapperSmallScreenStyles` (see
29
+ * above). When both queries match, `overflow: hidden` wins.
30
+ */
31
+ export declare const onePaneDialogSmallScreenStyles: StyleType;
32
+ /** `ModalPanel`'s wrapper. */
33
+ export declare const panelSmallScreenStyles: StyleType;
34
+ /** `ModalContent`'s content element. */
35
+ export declare const contentSmallScreenStyles: StyleType;
36
+ /**
37
+ * `ModalContent`'s content element, unless `applySmallHeightStyles` is false
38
+ * (`FlexibleDialog` / `DrawerDialog`).
39
+ */
40
+ export declare const contentSmallHeightStyles: StyleType;
41
+ /** `DrawerDialog`'s root: unset the minimum/maximum widths on smaller screens. */
42
+ export declare const drawerSmallScreenStyles: StyleType;
43
+ /** `DrawerDialog`'s root with `alignment="blockEnd"`. */
44
+ export declare const drawerBlockEndSmallScreenStyles: StyleType;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "8.10.7",
6
+ "version": "9.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -19,29 +19,36 @@
19
19
  "main": "dist/index.js",
20
20
  "module": "dist/es/index.js",
21
21
  "types": "dist/index.d.ts",
22
+ "sideEffects": [
23
+ "**/*.css"
24
+ ],
22
25
  "exports": {
23
26
  ".": {
27
+ "types": "./dist/index.d.ts",
24
28
  "import": "./dist/es/index.js",
25
- "require": "./dist/index.js",
26
- "types": "./dist/index.d.ts"
29
+ "require": "./dist/index.js"
30
+ },
31
+ "./css": {
32
+ "import": "./dist/es/index.css",
33
+ "require": "./dist/index.css",
34
+ "default": "./dist/index.css"
27
35
  },
28
36
  "./styles.css": "./dist/css/vars.css"
29
37
  },
30
38
  "dependencies": {
31
- "@khanacademy/wonder-blocks-announcer": "1.1.2",
32
- "@khanacademy/wonder-blocks-breadcrumbs": "3.3.8",
39
+ "@khanacademy/wonder-blocks-announcer": "1.1.3",
40
+ "@khanacademy/wonder-blocks-breadcrumbs": "4.0.0",
33
41
  "@khanacademy/wonder-blocks-config": "0.7.1",
34
- "@khanacademy/wonder-blocks-core": "12.5.0",
35
- "@khanacademy/wonder-blocks-icon-button": "12.0.4",
36
- "@khanacademy/wonder-blocks-layout": "4.0.0",
42
+ "@khanacademy/wonder-blocks-core": "13.0.0",
43
+ "@khanacademy/wonder-blocks-icon-button": "13.0.0",
44
+ "@khanacademy/wonder-blocks-layout": "5.0.0",
45
+ "@khanacademy/wonder-blocks-styles": "1.0.0",
37
46
  "@khanacademy/wonder-blocks-timing": "7.1.0",
38
- "@khanacademy/wonder-blocks-styles": "0.4.3",
39
- "@khanacademy/wonder-blocks-tokens": "18.2.1",
40
- "@khanacademy/wonder-blocks-typography": "5.0.8"
47
+ "@khanacademy/wonder-blocks-typography": "6.0.0",
48
+ "@khanacademy/wonder-blocks-tokens": "18.3.0"
41
49
  },
42
50
  "peerDependencies": {
43
51
  "@phosphor-icons/core": "^2.0.2",
44
- "aphrodite": "^1.2.5",
45
52
  "react": "18.2.0",
46
53
  "react-dom": "18.2.0"
47
54
  },