@vibe/dialog 4.0.0-alpha.0 → 4.0.0-alpha.2

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.
Files changed (65) hide show
  1. package/dist/Dialog/Dialog.d.ts +4 -0
  2. package/dist/Dialog/Dialog.js +2 -0
  3. package/dist/Dialog/Dialog.js.map +1 -0
  4. package/dist/Dialog/Dialog.module.scss.js +2 -0
  5. package/dist/Dialog/Dialog.module.scss.js.map +1 -0
  6. package/dist/Dialog/Dialog.types.d.ts +214 -0
  7. package/dist/Dialog/DialogConstants.d.ts +8 -0
  8. package/dist/Dialog/DialogConstants.js +2 -0
  9. package/dist/Dialog/DialogConstants.js.map +1 -0
  10. package/dist/Dialog/components/DialogContent/DialogContent.d.ts +79 -0
  11. package/dist/Dialog/components/DialogContent/DialogContent.js +2 -0
  12. package/dist/Dialog/components/DialogContent/DialogContent.js.map +1 -0
  13. package/dist/Dialog/components/DialogContent/DialogContent.module.scss.js +2 -0
  14. package/dist/Dialog/components/DialogContent/DialogContent.module.scss.js.map +1 -0
  15. package/dist/Dialog/components/Refable/Refable.d.ts +18 -0
  16. package/dist/Dialog/components/Refable/Refable.js +2 -0
  17. package/dist/Dialog/components/Refable/Refable.js.map +1 -0
  18. package/dist/Dialog/hooks/useDisableScroll.d.ts +5 -0
  19. package/dist/Dialog/hooks/useDisableScroll.js +2 -0
  20. package/dist/Dialog/hooks/useDisableScroll.js.map +1 -0
  21. package/dist/Dialog/index.d.ts +3 -0
  22. package/dist/DialogContentContainer/DialogContentContainer.d.ts +36 -0
  23. package/dist/DialogContentContainer/DialogContentContainer.js +2 -0
  24. package/dist/DialogContentContainer/DialogContentContainer.js.map +1 -0
  25. package/dist/DialogContentContainer/DialogContentContainer.module.scss.js +2 -0
  26. package/dist/DialogContentContainer/DialogContentContainer.module.scss.js.map +1 -0
  27. package/dist/DialogContentContainer/index.d.ts +1 -0
  28. package/dist/_virtual/_tslib.js +2 -0
  29. package/dist/_virtual/_tslib.js.map +1 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +2 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/mocked_classnames/Dialog/Dialog.d.ts +4 -0
  34. package/dist/mocked_classnames/Dialog/Dialog.js +2 -0
  35. package/dist/mocked_classnames/Dialog/Dialog.js.map +1 -0
  36. package/dist/mocked_classnames/Dialog/Dialog.module.scss.js +2 -0
  37. package/dist/mocked_classnames/Dialog/Dialog.module.scss.js.map +1 -0
  38. package/dist/mocked_classnames/Dialog/Dialog.types.d.ts +214 -0
  39. package/dist/mocked_classnames/Dialog/DialogConstants.d.ts +8 -0
  40. package/dist/mocked_classnames/Dialog/DialogConstants.js +2 -0
  41. package/dist/mocked_classnames/Dialog/DialogConstants.js.map +1 -0
  42. package/dist/mocked_classnames/Dialog/components/DialogContent/DialogContent.d.ts +79 -0
  43. package/dist/mocked_classnames/Dialog/components/DialogContent/DialogContent.js +2 -0
  44. package/dist/mocked_classnames/Dialog/components/DialogContent/DialogContent.js.map +1 -0
  45. package/dist/mocked_classnames/Dialog/components/DialogContent/DialogContent.module.scss.js +2 -0
  46. package/dist/mocked_classnames/Dialog/components/DialogContent/DialogContent.module.scss.js.map +1 -0
  47. package/dist/mocked_classnames/Dialog/components/Refable/Refable.d.ts +18 -0
  48. package/dist/mocked_classnames/Dialog/components/Refable/Refable.js +2 -0
  49. package/dist/mocked_classnames/Dialog/components/Refable/Refable.js.map +1 -0
  50. package/dist/mocked_classnames/Dialog/hooks/useDisableScroll.d.ts +5 -0
  51. package/dist/mocked_classnames/Dialog/hooks/useDisableScroll.js +2 -0
  52. package/dist/mocked_classnames/Dialog/hooks/useDisableScroll.js.map +1 -0
  53. package/dist/mocked_classnames/Dialog/index.d.ts +3 -0
  54. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.d.ts +36 -0
  55. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.js +2 -0
  56. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.js.map +1 -0
  57. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.module.scss.js +2 -0
  58. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.module.scss.js.map +1 -0
  59. package/dist/mocked_classnames/DialogContentContainer/index.d.ts +1 -0
  60. package/dist/mocked_classnames/_virtual/_tslib.js +2 -0
  61. package/dist/mocked_classnames/_virtual/_tslib.js.map +1 -0
  62. package/dist/mocked_classnames/index.d.ts +2 -0
  63. package/dist/mocked_classnames/index.js +2 -0
  64. package/dist/mocked_classnames/index.js.map +1 -0
  65. package/package.json +8 -7
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { type DialogProps } from "./Dialog.types";
3
+ declare function Dialog({ id, "data-testid": dataTestId, children, content, position, moveBy, middleware: middlewareProp, startingEdge, showDelay, hideDelay, instantShowAndHide, getDynamicShowDelay, showTrigger, hideTrigger, showOnDialogEnter, showTriggerIgnoreClass, hideTriggerIgnoreClass, addKeyboardHideShowTriggersByDefault, shouldShowOnMount, disable, open, isOpen: isOpenProp, useDerivedStateFromProps, animationType, preventAnimationOnMount, tooltip, tooltipClassName, containerSelector, disableContainerScroll, zIndex, wrapperClassName, referenceWrapperClassName, referenceWrapperElement, onBlur: onBlurProp, onKeyDown: onKeyDownProp, onClick: onClickProp, onFocus: onFocusProp, onMouseDown: onMouseDownProp, onMouseEnter: onMouseEnterProp, onMouseLeave: onMouseLeaveProp, onContextMenu: onContextMenuProp, onDialogDidShow, onDialogDidHide, onClickOutside: onClickOutsideProp, onContentClick: onContentClickProp, hideWhenReferenceHidden, shouldCallbackOnMount, observeContentResize }: DialogProps): React.JSX.Element;
4
+ export default Dialog;
@@ -0,0 +1,2 @@
1
+ import e from"classnames";import n,{useState as t,useRef as r,useContext as o,useMemo as a,useCallback as l,useEffect as i}from"react";import{createPortal as s}from"react-dom";import{offset as u,flip as c,shift as m,arrow as d,hide as p,autoUpdate as f,useFloating as g}from"@floating-ui/react-dom";import{isFunction as y}from"es-toolkit";import{convertToArray as h,isInsideClass as v,chainFunctions as w,isClient as C,getTestId as b,ComponentDefaultTestId as D,chainRefFunctions as E,NOOP as k}from"@vibe/shared";import T from"./components/DialogContent/DialogContent.js";import{Refable as x}from"./components/Refable/Refable.js";import M from"./Dialog.module.scss.js";import{LayerContext as S,LayerProvider as O}from"@vibe/layer";function R({id:R,"data-testid":A,children:H,content:j,position:L="top",moveBy:F={main:0,secondary:0},middleware:N=[],startingEdge:I,showDelay:z=100,hideDelay:B=100,instantShowAndHide:K=!1,getDynamicShowDelay:W,showTrigger:q="mouseenter",hideTrigger:G="mouseleave",showOnDialogEnter:P=!1,showTriggerIgnoreClass:V,hideTriggerIgnoreClass:J,addKeyboardHideShowTriggersByDefault:Q=!0,shouldShowOnMount:U=!1,disable:X=!1,open:Y=!1,isOpen:Z,useDerivedStateFromProps:$=!1,animationType:_="expand",preventAnimationOnMount:ee=!1,tooltip:ne=!1,tooltipClassName:te,containerSelector:re,disableContainerScroll:oe,zIndex:ae,wrapperClassName:le,referenceWrapperClassName:ie,referenceWrapperElement:se,onBlur:ue,onKeyDown:ce,onClick:me,onFocus:de,onMouseDown:pe,onMouseEnter:fe,onMouseLeave:ge,onContextMenu:ye,onDialogDidShow:he=k,onDialogDidHide:ve=k,onClickOutside:we=k,onContentClick:Ce=k,hideWhenReferenceHidden:be=!1,shouldCallbackOnMount:De=!1,observeContentResize:Ee=!1}){var ke,Te;const[xe,Me]=t(U),[Se,Oe]=t(!1),[Re,Ae]=t(null),He=r(null),je=r(null),Le=r(null),Fe=r(null),Ne=n.Children.toArray(H).some((e=>n.isValidElement(e))),{layerRef:Ie}=o(S),ze=($?Z:xe)||Y,Be=a((()=>{const e=[],n=N.filter((e=>null!=e&&"object"==typeof e&&"function"==typeof e.fn)),t=n.some((e=>"offset"===e.name)),r=n.some((e=>"flip"===e.name)),o=n.some((e=>"shift"===e.name));return t||0===F.main&&0===F.secondary||e.push(u({mainAxis:F.main||0,crossAxis:F.secondary||0})),r||e.push(c()),o||e.push(m()),e.push(...n),ne&&e.push(d({element:Fe})),be&&e.push(p()),e}),[F.main,F.secondary,ne,be,N]),Ke=l(((e,n,t)=>f(e,n,t,{elementResize:Ee,layoutShift:!1})),[Ee]),{refs:We,floatingStyles:qe,placement:Ge,middlewareData:Pe}=g({placement:L,middleware:Be,whileElementsMounted:Ke,elements:{reference:Re}}),Ve=null!==(Te=null===(ke=Pe.hide)||void 0===ke?void 0:ke.referenceHidden)&&void 0!==Te&&Te,Je=l((e=>{const n=h(q);return!(!Q||"focus"!==e||!n.includes("mouseenter"))||n.includes(e)}),[q,Q]),Qe=l((e=>{const n=h(G);return!(!Q||"blur"!==e||!n.includes("mouseleave"))||n.includes(e)}),[G,Q]),Ue=l(((e,n,t={})=>{let r=z,o=t.preventAnimation;if(W){const e=W();r=e.showDelay||0,o=null!=o?o:e.preventAnimation}K?(he(e,n),Me(!0),Oe(!!o),He.current=null):He.current=setTimeout((()=>{he(e,n),He.current=null,Me(!0),Oe(!!o)}),r)}),[z,W,K,he]),Xe=l(((e,n)=>{K?(ve(e,n),Me(!1),je.current=null):je.current=setTimeout((()=>{ve(e,n),Me(!1),je.current=null}),B)}),[B,K,ve]),Ye=l(((e,n,t={})=>{X||(je.current&&(clearTimeout(je.current),je.current=null),He.current||Ue(e,n,t))}),[X,Ue]),Ze=l(((e,n)=>{He.current&&(clearTimeout(He.current),He.current=null),je.current||Xe(e,n)}),[Xe]),$e=l(((e,n,t)=>{if(n)return!Je(e)||ze||v(n,V)?Qe(e)&&!v(n,J)?Ze(t,e):void 0:Ye(t,e)}),[Je,Qe,ze,V,J,Ye,Ze]),_e=l((()=>{if(re){const e=document.querySelector(re);if(e instanceof Element)return e}return(null==Ie?void 0:Ie.current)||document.body}),[re,Ie]),en=l((e=>$e("mouseenter",e.target,e)),[$e]),nn=l((e=>$e("mouseleave",e.target,e)),[$e]),tn=l((e=>{e.button||$e("click",e.target,e)}),[$e]),rn=l((e=>{"Enter"===e.key&&$e("enter",e.target,e),"Tab"===e.key&&$e("tab",e.target,e)}),[$e]),on=l((e=>{e.button||$e("mousedown",e.target,e)}),[$e]),an=l((e=>$e("focus",e.target,e)),[$e]),ln=l((e=>{$e("blur",e.relatedTarget||e.target,e)}),[$e]),sn=l((e=>$e("esckey",e.target,e)),[$e]),un=l((e=>{(Je("contextmenu")&&!ze||Qe("contextmenu")&&ze)&&e.preventDefault(),$e("contextmenu",e.target,e)}),[ze,Je,Qe,$e]),cn=l((e=>{$e("clickoutside",e.target,e),we(e)}),[$e,we]),mn=l((e=>{P&&Ye(e,"DialogEnter")}),[P,Ye]),dn=l((e=>{P&&Ze(e,"DialogLeave")}),[P,Ze]),pn=l((e=>{$e("onContentClick",e.target,e),Ce(e)}),[$e,Ce]),fn=a((()=>w([ue,ln],!0)),[ue,ln]),gn=a((()=>w([ce,rn],!0)),[ce,rn]),yn=a((()=>w([me,tn],!0)),[me,tn]),hn=a((()=>w([de,an],!0)),[de,an]),vn=a((()=>w([pe,on],!0)),[pe,on]),wn=a((()=>w([fe,en],!0)),[fe,en]),Cn=a((()=>w([ge,nn],!0)),[ge,nn]),bn=a((()=>w([ye,un],!0)),[ye,un]),Dn=r();Dn.current=e=>{if(ze)switch(e.key){case"Escape":Ze(e,"esckey");break;case"Tab":$e("tab",e.target,e);break;case"Enter":$e("enter",e.target,e)}},i((()=>{De&&U&&he()}),[]),i((()=>()=>{He.current&&clearTimeout(He.current),je.current&&clearTimeout(je.current)}),[]),i((()=>{if(!C())return;const e=e=>{var n;return null===(n=Dn.current)||void 0===n?void 0:n.call(Dn,e)};return document.addEventListener("keyup",e),()=>document.removeEventListener("keyup",e)}),[]),i((()=>{if(be&&Ve&&ze){const e=new CustomEvent("onReferenceHidden");Xe(e,"onReferenceHidden")}}),[be,Ve,ze,Xe]);const En=A||b(D.DIALOG,R),kn=a((()=>{if(!Pe.arrow)return{};const{x:e,y:n}=Pe.arrow;return{left:null!=e?e+"px":"",top:null!=n?n+"px":"",transform:"rotate(45deg)"}}),[Pe.arrow]),Tn=a((()=>Object.assign(Ne?Object.assign({},qe):{},void 0!==ae&&{zIndex:ae})),[qe,ae,Ne]),xn=ee||Se?void 0:_,Mn=y(j)?j():j;if(!Mn)return n.createElement(n.Fragment,null,H);const Sn=E([We.setFloating,Le]),On=n.createElement(T,{"data-testid":En,isReferenceHidden:be&&Ve,onMouseEnter:mn,onMouseLeave:dn,onClickOutside:cn,onContextMenu:un,onEsc:sn,animationType:xn,position:Ge,wrapperClassName:le,startingEdge:I,isOpen:ze,showDelay:z,styleObject:Tn,ref:Sn,onClick:pn,hasTooltip:!!ne,containerSelector:re,disableContainerScroll:oe},Mn,ne&&n.createElement("div",{style:kn,ref:Fe,className:e(M.arrow,te),"data-placement":Ge}));return n.createElement(n.Fragment,null,n.createElement(x,{className:e(ie),wrapperElement:se,ref:Ae,onBlur:fn,onKeyDown:gn,onClick:yn,onFocus:hn,onMouseDown:vn,onMouseEnter:wn,onMouseLeave:Cn,onContextMenu:bn},H),C()&&ze&&s(n.createElement(O,{layerRef:Le},On),_e()))}export{R as default};
2
+ //# sourceMappingURL=Dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.js","sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { useState, useEffect, useRef, useContext, useCallback, useMemo } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n useFloating,\n offset,\n flip,\n shift,\n hide,\n arrow as arrowMiddleware,\n autoUpdate,\n type Placement,\n type Middleware\n} from \"@floating-ui/react-dom\";\nimport { isFunction } from \"es-toolkit\";\nimport {\n chainFunctions,\n chainRefFunctions,\n convertToArray,\n NOOP,\n isInsideClass,\n ComponentDefaultTestId,\n getTestId,\n isClient\n} from \"@vibe/shared\";\nimport DialogContent from \"./components/DialogContent/DialogContent\";\nimport { Refable } from \"./components/Refable/Refable\";\nimport styles from \"./Dialog.module.scss\";\nimport { type DialogTriggerEvent, type DialogEvent, type DialogProps } from \"./Dialog.types\";\nimport { LayerContext, LayerProvider } from \"@vibe/layer\";\n\nfunction Dialog({\n // Core props\n id,\n \"data-testid\": dataTestId,\n children,\n content,\n position = \"top\",\n moveBy = { main: 0, secondary: 0 },\n middleware: middlewareProp = [],\n startingEdge,\n showDelay = 100,\n hideDelay = 100,\n instantShowAndHide = false,\n getDynamicShowDelay,\n showTrigger = \"mouseenter\",\n hideTrigger = \"mouseleave\",\n showOnDialogEnter = false,\n showTriggerIgnoreClass,\n hideTriggerIgnoreClass,\n addKeyboardHideShowTriggersByDefault = true,\n shouldShowOnMount = false,\n disable = false,\n open = false,\n isOpen: isOpenProp,\n useDerivedStateFromProps = false,\n animationType = \"expand\",\n preventAnimationOnMount = false,\n tooltip = false,\n tooltipClassName,\n containerSelector,\n disableContainerScroll,\n zIndex,\n wrapperClassName,\n referenceWrapperClassName,\n referenceWrapperElement,\n onBlur: onBlurProp,\n onKeyDown: onKeyDownProp,\n onClick: onClickProp,\n onFocus: onFocusProp,\n onMouseDown: onMouseDownProp,\n onMouseEnter: onMouseEnterProp,\n onMouseLeave: onMouseLeaveProp,\n onContextMenu: onContextMenuProp,\n onDialogDidShow = NOOP,\n onDialogDidHide = NOOP,\n onClickOutside: onClickOutsideProp = NOOP,\n onContentClick: onContentClickProp = NOOP,\n hideWhenReferenceHidden = false,\n shouldCallbackOnMount = false,\n observeContentResize = false\n}: DialogProps) {\n const [isOpenState, setIsOpenState] = useState(shouldShowOnMount);\n const [preventAnimation, setPreventAnimation] = useState(false);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n\n const showTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hideTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n\n // Check if children are valid React elements (Refable returns null for non-elements)\n const hasValidChildren = React.Children.toArray(children).some(child => React.isValidElement(child));\n\n const { layerRef } = useContext(LayerContext);\n\n // Derived state\n const isOpenInternal = useDerivedStateFromProps ? isOpenProp : isOpenState;\n const isShown = isOpenInternal || open;\n\n // Build middleware array for Floating UI\n const floatingMiddleware = useMemo<Middleware[]>(() => {\n const middlewareList: Middleware[] = [];\n\n // Get user-provided middleware (filter out invalid ones)\n const validMiddleware = middlewareProp.filter(\n (m): m is Middleware => m != null && typeof m === \"object\" && typeof m.fn === \"function\"\n );\n\n // Check if user provided their own middleware to override defaults\n const hasCustomOffset = validMiddleware.some(m => m.name === \"offset\");\n const hasCustomFlip = validMiddleware.some(m => m.name === \"flip\");\n const hasCustomShift = validMiddleware.some(m => m.name === \"shift\");\n\n // Offset middleware - skip if user provided their own\n if (!hasCustomOffset && (moveBy.main !== 0 || moveBy.secondary !== 0)) {\n middlewareList.push(offset({ mainAxis: moveBy.main || 0, crossAxis: moveBy.secondary || 0 }));\n }\n\n // Core positioning middleware - skip if user provided their own\n if (!hasCustomFlip) {\n middlewareList.push(flip());\n }\n if (!hasCustomShift) {\n middlewareList.push(shift());\n }\n\n // Add user-provided middleware\n middlewareList.push(...validMiddleware);\n\n // Arrow middleware - pass ref directly, Floating UI handles null refs\n if (tooltip) {\n middlewareList.push(arrowMiddleware({ element: arrowRef }));\n }\n\n // Hide middleware for detecting when reference is hidden\n if (hideWhenReferenceHidden) {\n middlewareList.push(hide());\n }\n\n return middlewareList;\n }, [moveBy.main, moveBy.secondary, tooltip, hideWhenReferenceHidden, middlewareProp]);\n\n // Configure autoUpdate for position tracking\n const whileElementsMounted = useCallback(\n (reference: HTMLElement, floating: HTMLElement, update: () => void) => {\n return autoUpdate(reference, floating, update, {\n elementResize: observeContentResize,\n layoutShift: false\n });\n },\n [observeContentResize]\n );\n\n // Use Floating UI hook\n const { refs, floatingStyles, placement, middlewareData } = useFloating({\n placement: position as Placement,\n middleware: floatingMiddleware,\n whileElementsMounted,\n elements: {\n reference: referenceElement\n }\n });\n\n // Check if reference is hidden (from hide middleware)\n const isReferenceHidden = middlewareData.hide?.referenceHidden ?? false;\n\n const isShowTrigger = useCallback(\n (eventName: DialogTriggerEvent) => {\n const showTriggersArray = convertToArray(showTrigger);\n if (addKeyboardHideShowTriggersByDefault && eventName === \"focus\" && showTriggersArray.includes(\"mouseenter\")) {\n return true;\n }\n return showTriggersArray.includes(eventName);\n },\n [showTrigger, addKeyboardHideShowTriggersByDefault]\n );\n\n const isHideTrigger = useCallback(\n (eventName: DialogTriggerEvent) => {\n const hideTriggersArray = convertToArray(hideTrigger);\n if (addKeyboardHideShowTriggersByDefault && eventName === \"blur\" && hideTriggersArray.includes(\"mouseleave\")) {\n return true;\n }\n return hideTriggersArray.includes(eventName);\n },\n [hideTrigger, addKeyboardHideShowTriggersByDefault]\n );\n\n const showDialog = useCallback(\n (event: DialogEvent, eventName: DialogTriggerEvent | string, options: { preventAnimation?: boolean } = {}) => {\n let finalShowDelay = showDelay;\n let preventAnimationValue = options.preventAnimation;\n if (getDynamicShowDelay) {\n const dynamicDelayObj = getDynamicShowDelay();\n finalShowDelay = dynamicDelayObj.showDelay || 0;\n preventAnimationValue = preventAnimationValue ?? dynamicDelayObj.preventAnimation;\n }\n\n if (instantShowAndHide) {\n onDialogDidShow(event, eventName);\n setIsOpenState(true);\n setPreventAnimation(!!preventAnimationValue);\n showTimeoutRef.current = null;\n } else {\n showTimeoutRef.current = setTimeout(() => {\n onDialogDidShow(event, eventName);\n showTimeoutRef.current = null;\n setIsOpenState(true);\n setPreventAnimation(!!preventAnimationValue);\n }, finalShowDelay);\n }\n },\n [showDelay, getDynamicShowDelay, instantShowAndHide, onDialogDidShow]\n );\n\n const hideDialog = useCallback(\n (event: DialogEvent, eventName: DialogTriggerEvent | string) => {\n if (instantShowAndHide) {\n onDialogDidHide(event, eventName);\n setIsOpenState(false);\n hideTimeoutRef.current = null;\n } else {\n hideTimeoutRef.current = setTimeout(() => {\n onDialogDidHide(event, eventName);\n setIsOpenState(false);\n hideTimeoutRef.current = null;\n }, hideDelay);\n }\n },\n [hideDelay, instantShowAndHide, onDialogDidHide]\n );\n\n const showDialogIfNeeded = useCallback(\n (event: DialogEvent, eventName: DialogTriggerEvent | string, options = {}) => {\n if (disable) {\n return;\n }\n\n if (hideTimeoutRef.current) {\n clearTimeout(hideTimeoutRef.current);\n hideTimeoutRef.current = null;\n }\n\n if (!showTimeoutRef.current) {\n showDialog(event, eventName, options);\n }\n },\n [disable, showDialog]\n );\n\n const hideDialogIfNeeded = useCallback(\n (event: DialogEvent, eventName: DialogTriggerEvent | string) => {\n if (showTimeoutRef.current) {\n clearTimeout(showTimeoutRef.current);\n showTimeoutRef.current = null;\n }\n\n if (!hideTimeoutRef.current) {\n hideDialog(event, eventName);\n }\n },\n [hideDialog]\n );\n\n // Event handling\n const handleEvent = useCallback(\n (eventName: DialogTriggerEvent, target: EventTarget | null, event: DialogEvent) => {\n if (!target) return; // Guard against null targets (e.g., when focus leaves the document)\n if (isShowTrigger(eventName) && !isShown && !isInsideClass(target as HTMLElement, showTriggerIgnoreClass)) {\n return showDialogIfNeeded(event, eventName);\n }\n\n if (isHideTrigger(eventName) && !isInsideClass(target as HTMLElement, hideTriggerIgnoreClass)) {\n return hideDialogIfNeeded(event, eventName);\n }\n },\n [\n isShowTrigger,\n isHideTrigger,\n isShown,\n showTriggerIgnoreClass,\n hideTriggerIgnoreClass,\n showDialogIfNeeded,\n hideDialogIfNeeded\n ]\n );\n\n const getContainer = useCallback(() => {\n if (containerSelector) {\n const containerElement = document.querySelector(containerSelector);\n if (containerElement instanceof Element) {\n return containerElement;\n }\n }\n return layerRef?.current || document.body;\n }, [containerSelector, layerRef]);\n\n // Memoized event handlers to prevent unnecessary re-renders\n const onMouseEnter = useCallback((e: React.MouseEvent) => handleEvent(\"mouseenter\", e.target, e), [handleEvent]);\n const onMouseLeave = useCallback((e: React.MouseEvent) => handleEvent(\"mouseleave\", e.target, e), [handleEvent]);\n const onClick = useCallback(\n (e: React.MouseEvent) => {\n if (e.button) return;\n handleEvent(\"click\", e.target, e);\n },\n [handleEvent]\n );\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n // Handle element-level keyboard events for triggers\n if (event.key === \"Enter\") handleEvent(\"enter\", event.target, event);\n if (event.key === \"Tab\") handleEvent(\"tab\", event.target, event);\n },\n [handleEvent]\n );\n\n const onMouseDown = useCallback(\n (e: React.MouseEvent) => {\n if (e.button) return;\n handleEvent(\"mousedown\", e.target, e);\n },\n [handleEvent]\n );\n const onFocus = useCallback((e: React.FocusEvent) => handleEvent(\"focus\", e.target, e), [handleEvent]);\n const onBlur = useCallback(\n (e: React.FocusEvent) => {\n const target = e.relatedTarget || e.target;\n handleEvent(\"blur\", target, e);\n },\n [handleEvent]\n );\n const onEsc = useCallback((e: React.KeyboardEvent) => handleEvent(\"esckey\", e.target, e), [handleEvent]);\n const onContextMenu = useCallback(\n (e: React.MouseEvent) => {\n if ((isShowTrigger(\"contextmenu\") && !isShown) || (isHideTrigger(\"contextmenu\") && isShown)) {\n e.preventDefault();\n }\n handleEvent(\"contextmenu\", e.target, e);\n },\n [isShown, isShowTrigger, isHideTrigger, handleEvent]\n );\n\n const onClickOutside = useCallback(\n (event: React.MouseEvent) => {\n handleEvent(\"clickoutside\", event.target, event);\n onClickOutsideProp(event);\n },\n [handleEvent, onClickOutsideProp]\n );\n\n const onDialogEnter = useCallback(\n (event: React.MouseEvent) => {\n if (showOnDialogEnter) showDialogIfNeeded(event, \"DialogEnter\");\n },\n [showOnDialogEnter, showDialogIfNeeded]\n );\n\n const onDialogLeave = useCallback(\n (event: React.MouseEvent) => {\n if (showOnDialogEnter) hideDialogIfNeeded(event, \"DialogLeave\");\n },\n [showOnDialogEnter, hideDialogIfNeeded]\n );\n\n const onContentClick = useCallback(\n (e: React.MouseEvent) => {\n handleEvent(\"onContentClick\", e.target, e);\n onContentClickProp(e);\n },\n [handleEvent, onContentClickProp]\n );\n\n // Memoized chained event handlers to prevent Refable children re-renders\n const chainedOnBlur = useMemo(() => chainFunctions([onBlurProp, onBlur], true), [onBlurProp, onBlur]);\n const chainedOnKeyDown = useMemo(() => chainFunctions([onKeyDownProp, onKeyDown], true), [onKeyDownProp, onKeyDown]);\n const chainedOnClick = useMemo(() => chainFunctions([onClickProp, onClick], true), [onClickProp, onClick]);\n const chainedOnFocus = useMemo(() => chainFunctions([onFocusProp, onFocus], true), [onFocusProp, onFocus]);\n const chainedOnMouseDown = useMemo(\n () => chainFunctions([onMouseDownProp, onMouseDown], true),\n [onMouseDownProp, onMouseDown]\n );\n const chainedOnMouseEnter = useMemo(\n () => chainFunctions([onMouseEnterProp, onMouseEnter], true),\n [onMouseEnterProp, onMouseEnter]\n );\n const chainedOnMouseLeave = useMemo(\n () => chainFunctions([onMouseLeaveProp, onMouseLeave], true),\n [onMouseLeaveProp, onMouseLeave]\n );\n const chainedOnContextMenu = useMemo(\n () => chainFunctions([onContextMenuProp, onContextMenu], true),\n [onContextMenuProp, onContextMenu]\n );\n\n // Document-level keyboard handler using stable ref pattern\n // Must handle Escape, Tab, and Enter at document level to match old behavior\n const closeDialogOnEscapeRef = useRef<(event: KeyboardEvent) => void>();\n closeDialogOnEscapeRef.current = (event: KeyboardEvent) => {\n if (!isShown) return;\n\n switch (event.key) {\n case \"Escape\":\n hideDialogIfNeeded(event, \"esckey\");\n break;\n case \"Tab\":\n handleEvent(\"tab\", event.target, event);\n break;\n case \"Enter\":\n handleEvent(\"enter\", event.target, event);\n break;\n }\n };\n\n // Effects\n\n // Callback on mount\n useEffect(() => {\n if (shouldCallbackOnMount && shouldShowOnMount) {\n onDialogDidShow();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Cleanup timeouts on unmount\n useEffect(() => {\n return () => {\n if (showTimeoutRef.current) clearTimeout(showTimeoutRef.current);\n if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);\n };\n }, []);\n\n // Document keyboard listener (stable reference via ref)\n useEffect(() => {\n if (!isClient()) return;\n\n const handler = (event: KeyboardEvent) => closeDialogOnEscapeRef.current?.(event);\n document.addEventListener(\"keyup\", handler);\n return () => document.removeEventListener(\"keyup\", handler);\n }, []);\n\n // Handle reference hidden state\n useEffect(() => {\n if (hideWhenReferenceHidden && isReferenceHidden && isShown) {\n const event = new CustomEvent(\"onReferenceHidden\");\n hideDialog(event, \"onReferenceHidden\");\n }\n }, [hideWhenReferenceHidden, isReferenceHidden, isShown, hideDialog]);\n\n // Computed values\n const overrideDataTestId = dataTestId || getTestId(ComponentDefaultTestId.DIALOG, id);\n\n const arrowStyles = useMemo<React.CSSProperties>(() => {\n if (!middlewareData.arrow) return {};\n const { x, y } = middlewareData.arrow;\n return {\n left: x != null ? `${x}px` : \"\",\n top: y != null ? `${y}px` : \"\",\n transform: \"rotate(45deg)\"\n };\n }, [middlewareData.arrow]);\n\n // Skip Floating UI positioning when no children (e.g. floating Tipseen) — let CSS handle it\n const finalFloatingStyles = useMemo<React.CSSProperties>(\n () =>\n hasValidChildren\n ? { ...floatingStyles, ...(zIndex !== undefined && { zIndex }) }\n : { ...(zIndex !== undefined && { zIndex }) },\n [floatingStyles, zIndex, hasValidChildren]\n );\n\n const animationTypeCalculated = preventAnimationOnMount || preventAnimation ? undefined : animationType;\n const contentRendered = isFunction(content) ? content() : content;\n\n // Early return if no content - wrap in fragment for type safety\n if (!contentRendered) {\n return <>{children}</>;\n }\n\n const mergedFloatingRef = chainRefFunctions([refs.setFloating, containerRef]);\n\n const dialogContent = (\n <DialogContent\n data-testid={overrideDataTestId}\n isReferenceHidden={hideWhenReferenceHidden && isReferenceHidden}\n onMouseEnter={onDialogEnter}\n onMouseLeave={onDialogLeave}\n onClickOutside={onClickOutside}\n onContextMenu={onContextMenu}\n onEsc={onEsc}\n animationType={animationTypeCalculated}\n position={placement}\n wrapperClassName={wrapperClassName}\n startingEdge={startingEdge}\n isOpen={isShown}\n showDelay={showDelay}\n styleObject={finalFloatingStyles}\n ref={mergedFloatingRef}\n onClick={onContentClick}\n hasTooltip={!!tooltip}\n containerSelector={containerSelector}\n disableContainerScroll={disableContainerScroll}\n >\n {contentRendered}\n {tooltip && (\n <div\n style={arrowStyles}\n ref={arrowRef}\n className={cx(styles.arrow, tooltipClassName)}\n data-placement={placement}\n />\n )}\n </DialogContent>\n );\n\n return (\n <>\n <Refable\n className={cx(referenceWrapperClassName)}\n wrapperElement={referenceWrapperElement}\n ref={setReferenceElement}\n onBlur={chainedOnBlur}\n onKeyDown={chainedOnKeyDown}\n onClick={chainedOnClick}\n onFocus={chainedOnFocus}\n onMouseDown={chainedOnMouseDown}\n onMouseEnter={chainedOnMouseEnter}\n onMouseLeave={chainedOnMouseLeave}\n onContextMenu={chainedOnContextMenu}\n >\n {children}\n </Refable>\n {isClient() &&\n isShown &&\n createPortal(<LayerProvider layerRef={containerRef}>{dialogContent}</LayerProvider>, getContainer())}\n </>\n );\n}\n\nexport default Dialog;\n"],"names":["Dialog","id","dataTestId","children","content","position","moveBy","main","secondary","middleware","middlewareProp","startingEdge","showDelay","hideDelay","instantShowAndHide","getDynamicShowDelay","showTrigger","hideTrigger","showOnDialogEnter","showTriggerIgnoreClass","hideTriggerIgnoreClass","addKeyboardHideShowTriggersByDefault","shouldShowOnMount","disable","open","isOpen","isOpenProp","useDerivedStateFromProps","animationType","preventAnimationOnMount","tooltip","tooltipClassName","containerSelector","disableContainerScroll","zIndex","wrapperClassName","referenceWrapperClassName","referenceWrapperElement","onBlur","onBlurProp","onKeyDown","onKeyDownProp","onClick","onClickProp","onFocus","onFocusProp","onMouseDown","onMouseDownProp","onMouseEnter","onMouseEnterProp","onMouseLeave","onMouseLeaveProp","onContextMenu","onContextMenuProp","onDialogDidShow","NOOP","onDialogDidHide","onClickOutside","onClickOutsideProp","onContentClick","onContentClickProp","hideWhenReferenceHidden","shouldCallbackOnMount","observeContentResize","isOpenState","setIsOpenState","useState","preventAnimation","setPreventAnimation","referenceElement","setReferenceElement","showTimeoutRef","useRef","hideTimeoutRef","containerRef","arrowRef","hasValidChildren","React","Children","toArray","some","child","isValidElement","layerRef","useContext","LayerContext","isShown","floatingMiddleware","useMemo","middlewareList","validMiddleware","filter","m","fn","hasCustomOffset","name","hasCustomFlip","hasCustomShift","push","offset","mainAxis","crossAxis","flip","shift","arrowMiddleware","element","hide","whileElementsMounted","useCallback","reference","floating","update","autoUpdate","elementResize","layoutShift","refs","floatingStyles","placement","middlewareData","useFloating","elements","isReferenceHidden","_b","_a","referenceHidden","isShowTrigger","eventName","showTriggersArray","convertToArray","includes","isHideTrigger","hideTriggersArray","showDialog","event","options","finalShowDelay","preventAnimationValue","dynamicDelayObj","current","setTimeout","hideDialog","showDialogIfNeeded","clearTimeout","hideDialogIfNeeded","handleEvent","target","isInsideClass","getContainer","containerElement","document","querySelector","Element","body","e","button","key","relatedTarget","onEsc","preventDefault","onDialogEnter","onDialogLeave","chainedOnBlur","chainFunctions","chainedOnKeyDown","chainedOnClick","chainedOnFocus","chainedOnMouseDown","chainedOnMouseEnter","chainedOnMouseLeave","chainedOnContextMenu","closeDialogOnEscapeRef","useEffect","isClient","handler","call","addEventListener","removeEventListener","CustomEvent","overrideDataTestId","getTestId","ComponentDefaultTestId","DIALOG","arrowStyles","arrow","x","y","left","top","transform","finalFloatingStyles","Object","assign","undefined","animationTypeCalculated","contentRendered","isFunction","createElement","Fragment","mergedFloatingRef","chainRefFunctions","setFloating","dialogContent","DialogContent","styleObject","ref","hasTooltip","style","className","cx","styles","Refable","wrapperElement","createPortal","LayerProvider"],"mappings":"4tBA+BA,SAASA,GAAOC,GAEdA,EACA,cAAeC,EAAUC,SACzBA,EAAQC,QACRA,EAAOC,SACPA,EAAW,MAAKC,OAChBA,EAAS,CAAEC,KAAM,EAAGC,UAAW,GAC/BC,WAAYC,EAAiB,GAAEC,aAC/BA,EAAYC,UACZA,EAAY,IAAGC,UACfA,EAAY,IAAGC,mBACfA,GAAqB,EAAKC,oBAC1BA,EAAmBC,YACnBA,EAAc,aAAYC,YAC1BA,EAAc,aAAYC,kBAC1BA,GAAoB,EAAKC,uBACzBA,EAAsBC,uBACtBA,EAAsBC,qCACtBA,GAAuC,EAAIC,kBAC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,SAAUgH,GACVlF,iBAAkBA,GAClBxB,aAAcA,EACdc,OAAQ6D,GACR1E,UAAWA,EACX+L,YAAad,GACbe,IAAKN,GACL5J,QAASiB,GACTkJ,aAAc/K,GACdE,kBAAmBA,GACnBC,uBAAwBA,IAEvBiK,GACApK,IACC+C,EAAAuH,cAAA,MAAA,CACEU,MAAOxB,GACPsB,IAAKjI,GACLoI,UAAWC,EAAGC,EAAO1B,MAAOxJ,IACZ,iBAAAsF,MAMxB,OACExC,EAAAuH,cAAAvH,EAAAwH,SAAA,KACExH,EAACuH,cAAAc,GACCH,UAAWC,EAAG5K,IACd+K,eAAgB9K,GAChBuK,IAAKtI,GACLhC,OAAQ2H,GACRzH,UAAW2H,GACXzH,QAAS0H,GACTxH,QAASyH,GACTvH,YAAawH,GACbtH,aAAcuH,GACdrH,aAAcsH,GACdpH,cAAeqH,IAEdtK,GAEFyK,KACCtF,IACA8H,EAAavI,EAACuH,cAAAiB,EAAc,CAAAlI,SAAUT,IAAe+H,IAAgCtD,MAG7F"}
@@ -0,0 +1,2 @@
1
+ var a={arrow:"arrow_0f548a71ff"};!function(a){const e="s_id-3fb64cda561a_4_0_0-alpha_1";if("undefined"!=typeof document){const t=document.head||document.getElementsByTagName("head")[0];if(t.querySelector("#"+e))return;const r=document.createElement("style");r.id=e,t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r),r.appendChild(document.createTextNode(a))}else globalThis.injectedStyles&&(globalThis.injectedStyles[e]=a)}(".arrow_0f548a71ff {\n width: 12px;\n height: 12px;\n position: absolute;\n border-radius: 2px;\n background-color: var(--secondary-background-color);\n}\n.dark-app-theme .arrow_0f548a71ff[data-placement*=right], .black-app-theme .arrow_0f548a71ff[data-placement*=right], .hacker-app-theme .arrow_0f548a71ff[data-placement*=right] {\n box-shadow: -1px 1px 0px 0px var(--layout-border-color);\n}\n.dark-app-theme .arrow_0f548a71ff[data-placement*=left], .black-app-theme .arrow_0f548a71ff[data-placement*=left], .hacker-app-theme .arrow_0f548a71ff[data-placement*=left] {\n box-shadow: 1px -1px 0px 0px var(--layout-border-color);\n}\n.dark-app-theme .arrow_0f548a71ff[data-placement*=bottom], .black-app-theme .arrow_0f548a71ff[data-placement*=bottom], .hacker-app-theme .arrow_0f548a71ff[data-placement*=bottom] {\n box-shadow: -1px -1px 0px 0px var(--layout-border-color);\n}\n.dark-app-theme .arrow_0f548a71ff[data-placement*=top], .black-app-theme .arrow_0f548a71ff[data-placement*=top], .hacker-app-theme .arrow_0f548a71ff[data-placement*=top] {\n box-shadow: 1px 1px 0px 0px var(--layout-border-color);\n}\n.arrow_0f548a71ff[data-placement*=bottom] {\n top: 1px;\n}\n.arrow_0f548a71ff[data-placement*=top] {\n bottom: 1px;\n}\n.arrow_0f548a71ff[data-placement*=left] {\n right: 1px;\n}\n.arrow_0f548a71ff[data-placement*=right] {\n left: 1px;\n}");export{a as default};
2
+ //# sourceMappingURL=Dialog.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,214 @@
1
+ import type React from "react";
2
+ import type { ReactElement } from "react";
3
+ import type { VibeComponentProps } from "@vibe/shared";
4
+ import type { Middleware, Placement } from "@floating-ui/react-dom";
5
+ export type DialogType = "modal" | "popover";
6
+ export type DialogSize = "none" | "small" | "medium" | "large";
7
+ export type DialogPosition = "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end" | "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end";
8
+ export type DialogTriggerEvent = "click" | "clickoutside" | "esckey" | "tab" | "mouseenter" | "mouseleave" | "enter" | "mousedown" | "focus" | "blur" | "onContentClick" | "contextmenu";
9
+ export type DialogAnimationType = "opacity-and-slide" | "expand";
10
+ export type DialogStartingEdge = "top" | "bottom";
11
+ export type DialogOffset = {
12
+ main?: number;
13
+ secondary?: number;
14
+ };
15
+ export type DialogEvent = React.MouseEvent | React.KeyboardEvent | KeyboardEvent | React.FocusEvent | CustomEvent;
16
+ export type DialogMiddleware = Middleware;
17
+ export type DialogPlacement = Placement;
18
+ export interface DialogProps extends VibeComponentProps {
19
+ /**
20
+ * Event handler for blur events on the reference element.
21
+ */
22
+ onBlur?: (e: React.FocusEvent) => void;
23
+ /**
24
+ * Event handler for keydown events on the reference element.
25
+ */
26
+ onKeyDown?: (e: React.KeyboardEvent) => void;
27
+ /**
28
+ * Event handler for click events on the reference element.
29
+ */
30
+ onClick?: (e: React.MouseEvent) => void;
31
+ /**
32
+ * Event handler for focus events on the reference element.
33
+ */
34
+ onFocus?: (e: React.FocusEvent) => void;
35
+ /**
36
+ * Event handler for mousedown events on the reference element.
37
+ */
38
+ onMouseDown?: (e: React.MouseEvent) => void;
39
+ /**
40
+ * Event handler for mouseenter events on the reference element.
41
+ */
42
+ onMouseEnter?: (e: React.MouseEvent) => void;
43
+ /**
44
+ * Event handler for mouseleave events on the reference element.
45
+ */
46
+ onMouseLeave?: (e: React.MouseEvent) => void;
47
+ /**
48
+ * Event handler for contextmenu events on the reference element.
49
+ */
50
+ onContextMenu?: (e: React.MouseEvent) => void;
51
+ /**
52
+ * Class name applied to the reference wrapper element.
53
+ */
54
+ referenceWrapperClassName?: string;
55
+ /**
56
+ * The wrapper element type to use for React components. Defaults to "span".
57
+ */
58
+ referenceWrapperElement?: "span" | "div";
59
+ /**
60
+ * The placement of the dialog relative to the reference element.
61
+ */
62
+ position?: DialogPosition;
63
+ /**
64
+ * Custom Floating UI middleware for positioning logic.
65
+ * If you provide `offset`, `flip`, or `shift` middleware, the defaults will be skipped.
66
+ * Other middleware (like `size`, `inline`, `autoPlacement`) are added to the chain.
67
+ * @see https://floating-ui.com/docs/middleware
68
+ */
69
+ middleware?: DialogMiddleware[];
70
+ /**
71
+ * The starting edge of the dialog animation.
72
+ */
73
+ startingEdge?: DialogStartingEdge;
74
+ /**
75
+ * Offset values for positioning adjustments.
76
+ * `main` - distance from reference element
77
+ * `secondary` - cross-axis offset (skidding)
78
+ */
79
+ moveBy?: {
80
+ main?: number;
81
+ secondary?: number;
82
+ };
83
+ /**
84
+ * Delay in milliseconds before showing the dialog.
85
+ */
86
+ showDelay?: number;
87
+ /**
88
+ * Delay in milliseconds before hiding the dialog.
89
+ */
90
+ hideDelay?: number;
91
+ /**
92
+ * Events that trigger showing the dialog.
93
+ */
94
+ showTrigger?: DialogTriggerEvent | DialogTriggerEvent[];
95
+ /**
96
+ * Events that trigger hiding the dialog.
97
+ */
98
+ hideTrigger?: DialogTriggerEvent | DialogTriggerEvent[];
99
+ /**
100
+ * If true, keeps the dialog open when mouse enters it.
101
+ */
102
+ showOnDialogEnter?: boolean;
103
+ /**
104
+ * If true, shows the dialog when the component mounts.
105
+ */
106
+ shouldShowOnMount?: boolean;
107
+ /**
108
+ * If true, disables opening the dialog.
109
+ */
110
+ disable?: boolean;
111
+ /**
112
+ * Controls the open state of the dialog (controlled mode).
113
+ */
114
+ open?: boolean;
115
+ /**
116
+ * Controlled open state for derived state pattern.
117
+ */
118
+ isOpen?: boolean;
119
+ /**
120
+ * CSS class names that, when present on target, prevent showing the dialog.
121
+ */
122
+ showTriggerIgnoreClass?: string | string[];
123
+ /**
124
+ * CSS class names that, when present on target, prevent hiding the dialog.
125
+ */
126
+ hideTriggerIgnoreClass?: string | string[];
127
+ /**
128
+ * The animation type used for the dialog.
129
+ */
130
+ animationType?: DialogAnimationType;
131
+ /**
132
+ * Class name applied to the dialog content wrapper.
133
+ */
134
+ wrapperClassName?: string;
135
+ /**
136
+ * If true, prevents animation when mounting.
137
+ */
138
+ preventAnimationOnMount?: boolean;
139
+ /**
140
+ * CSS selector of the container where the dialog is portaled.
141
+ */
142
+ containerSelector?: string;
143
+ /**
144
+ * If true, renders with tooltip arrow styling.
145
+ */
146
+ tooltip?: boolean;
147
+ /**
148
+ * Class name applied to the tooltip arrow element.
149
+ */
150
+ tooltipClassName?: string;
151
+ /**
152
+ * Callback fired when the dialog is shown.
153
+ */
154
+ onDialogDidShow?: (event?: DialogEvent, eventName?: DialogTriggerEvent | string) => void;
155
+ /**
156
+ * Callback fired when the dialog is hidden.
157
+ */
158
+ onDialogDidHide?: (event: DialogEvent, eventName: DialogTriggerEvent | string) => void;
159
+ /**
160
+ * Callback fired when clicking outside the dialog.
161
+ */
162
+ onClickOutside?: (event: React.MouseEvent) => void;
163
+ /**
164
+ * Callback fired when clicking inside the dialog content.
165
+ */
166
+ onContentClick?: (event: React.MouseEvent) => void;
167
+ /**
168
+ * The z-index applied to the dialog.
169
+ */
170
+ zIndex?: number;
171
+ /**
172
+ * If true, uses derived state from props pattern.
173
+ */
174
+ useDerivedStateFromProps?: boolean;
175
+ /**
176
+ * If true, hides the dialog when the reference element scrolls out of view.
177
+ */
178
+ hideWhenReferenceHidden?: boolean;
179
+ /**
180
+ * If true, fires onDialogDidShow callback on mount.
181
+ */
182
+ shouldCallbackOnMount?: boolean;
183
+ /**
184
+ * If true, shows and hides the dialog without delay.
185
+ */
186
+ instantShowAndHide?: boolean;
187
+ /**
188
+ * Callback to dynamically adjust show delay and animation behavior.
189
+ */
190
+ getDynamicShowDelay?: () => {
191
+ showDelay: number;
192
+ preventAnimation: boolean;
193
+ };
194
+ /**
195
+ * The content displayed inside the dialog. Can be a render function.
196
+ */
197
+ content?: (() => JSX.Element) | JSX.Element;
198
+ /**
199
+ * The reference element(s) that the dialog is positioned relative to.
200
+ */
201
+ children?: ReactElement | ReactElement[] | string;
202
+ /**
203
+ * If true, keyboard focus/blur events behave like mouse enter/leave.
204
+ */
205
+ addKeyboardHideShowTriggersByDefault?: boolean;
206
+ /**
207
+ * If true or a selector string, disables scrolling in the container when open.
208
+ */
209
+ disableContainerScroll?: boolean | string;
210
+ /**
211
+ * If true, automatically updates position when content resizes.
212
+ */
213
+ observeContentResize?: boolean;
214
+ }
@@ -0,0 +1,8 @@
1
+ export declare enum DialogPlacement {
2
+ RIGHT = "right",
3
+ RIGHT_START = "right-start",
4
+ RIGHT_END = "right-end",
5
+ LEFT = "left",
6
+ LEFT_START = "left-start",
7
+ LEFT_END = "left-end"
8
+ }
@@ -0,0 +1,2 @@
1
+ var t;!function(t){t.RIGHT="right",t.RIGHT_START="right-start",t.RIGHT_END="right-end",t.LEFT="left",t.LEFT_START="left-start",t.LEFT_END="left-end"}(t||(t={}));export{t as DialogPlacement};
2
+ //# sourceMappingURL=DialogConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogConstants.js","sources":["../../src/Dialog/DialogConstants.ts"],"sourcesContent":["export enum DialogPlacement {\n RIGHT = \"right\",\n RIGHT_START = \"right-start\",\n RIGHT_END = \"right-end\",\n LEFT = \"left\",\n LEFT_START = \"left-start\",\n LEFT_END = \"left-end\"\n}\n"],"names":["DialogPlacement"],"mappings":"IAAYA,GAAZ,SAAYA,GACVA,EAAA,MAAA,QACAA,EAAA,YAAA,cACAA,EAAA,UAAA,YACAA,EAAA,KAAA,OACAA,EAAA,WAAA,aACAA,EAAA,SAAA,UACD,CAPD,CAAYA,IAAAA,EAOX,CAAA"}
@@ -0,0 +1,79 @@
1
+ import React, { type CSSProperties, type ReactElement } from "react";
2
+ import { type VibeComponentProps } from "@vibe/shared";
3
+ import { type DialogAnimationType, type DialogTriggerEvent, type DialogStartingEdge, type DialogPlacement } from "../../Dialog.types";
4
+ export interface DialogContentProps extends VibeComponentProps {
5
+ /**
6
+ * The content inside the dialog.
7
+ */
8
+ children?: ReactElement | ReactElement[];
9
+ /**
10
+ * The placement of the dialog relative to the reference element.
11
+ */
12
+ position?: DialogPlacement;
13
+ /**
14
+ * Class name applied to the dialog wrapper.
15
+ */
16
+ wrapperClassName?: string;
17
+ /**
18
+ * If true, the dialog is open.
19
+ */
20
+ isOpen?: boolean;
21
+ /**
22
+ * The starting edge for animation direction.
23
+ */
24
+ startingEdge?: DialogStartingEdge;
25
+ /**
26
+ * The animation type used for showing/hiding the dialog.
27
+ */
28
+ animationType?: DialogAnimationType;
29
+ /**
30
+ * Callback fired when the Escape key is pressed.
31
+ */
32
+ onEsc?: (event: React.KeyboardEvent) => void;
33
+ /**
34
+ * Callback fired when the mouse enters the dialog.
35
+ */
36
+ onMouseEnter?: (event: React.MouseEvent) => void;
37
+ /**
38
+ * Callback fired when the mouse leaves the dialog.
39
+ */
40
+ onMouseLeave?: (event: React.MouseEvent) => void;
41
+ /**
42
+ * Callback fired when clicking outside the dialog.
43
+ */
44
+ onClickOutside?: (event: React.MouseEvent, hideShowEvent: DialogTriggerEvent) => void;
45
+ /**
46
+ * Callback fired when clicking inside the dialog.
47
+ */
48
+ onClick?: (event: React.MouseEvent) => void;
49
+ /**
50
+ * Delay before showing the dialog (used for animation timing).
51
+ */
52
+ showDelay?: number;
53
+ /**
54
+ * Inline styles applied to the dialog wrapper.
55
+ */
56
+ styleObject?: CSSProperties;
57
+ /**
58
+ * If true, indicates the reference element is hidden.
59
+ */
60
+ isReferenceHidden?: boolean;
61
+ /**
62
+ * If true, applies tooltip arrow styling.
63
+ */
64
+ hasTooltip?: boolean;
65
+ /**
66
+ * CSS selector of the container for scroll disabling.
67
+ */
68
+ containerSelector?: string;
69
+ /**
70
+ * If true or a selector string, disables scrolling when open.
71
+ */
72
+ disableContainerScroll?: boolean | string;
73
+ /**
74
+ * Callback fired on context menu (right-click) events.
75
+ */
76
+ onContextMenu?: (e: React.MouseEvent) => void;
77
+ }
78
+ declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLElement>>;
79
+ export default DialogContent;
@@ -0,0 +1,2 @@
1
+ import e,{forwardRef as a,useRef as o,useCallback as t,useMemo as s,useEffect as n,cloneElement as r}from"react";import i from"classnames";import{camelCase as l}from"es-toolkit";import{CSSTransition as p}from"react-transition-group";import{useClickOutside as c}from"@vibe/hooks";import{keyCodes as m,useMergeRef as d,NOOP as u,useKeyEvent as f,chainFunctions as k,getStyle as v}from"@vibe/shared";import E from"./DialogContent.module.scss.js";import b from"../../hooks/useDisableScroll.js";const y={},C=[m.ESCAPE],h=a((({onEsc:a=u,children:m,position:h,wrapperClassName:x,isOpen:A=!1,startingEdge:N,animationType:g="expand",onMouseEnter:S=u,onMouseLeave:M=u,onClickOutside:w=u,onClick:j=u,onContextMenu:D=u,showDelay:L,styleObject:O=y,isReferenceHidden:T,hasTooltip:R=!1,containerSelector:H,disableContainerScroll:P=!1,"data-testid":V},W)=>{const q=o(null),z=o(null),B=d(W,z),F=t((e=>{if(A)return w(e,"clickoutside")}),[A,w]),G=t((e=>{A&&D(e)}),[A,D]),I=s((()=>e=>{A&&a!==u&&a(e)}),[A,a]);f({keys:C,callback:I}),c({callback:F,ref:z}),c({eventName:"contextmenu",callback:G,ref:z});const J="string"==typeof P?P:H,{disableScroll:K,enableScroll:Q}=b(J);n((()=>{P&&(A?K():Q())}),[P,K,Q,A]);const U={classNames:void 0};switch(g){case"expand":U.classNames={appear:E.expandAppear,appearActive:E.expandAppearActive,exit:E.expandExit};break;case"opacity-and-slide":U.classNames={appear:E.opacitySlideAppear,appearActive:E.opacitySlideAppearActive}}const X=e.Children.map(m,(a=>e.isValidElement(a)?r(a,{onMouseEnter:k([a.props.onMouseEnter,S]),onMouseLeave:k([a.props.onMouseLeave,M])}):a));return e.createElement("span",{className:i("monday-style-dialog-content-wrapper",E.contentWrapper,x),ref:B,"data-testid":V,style:O,onClickCapture:j,"data-dialog-reference-hidden":T},e.createElement(p,{classNames:U.classNames,nodeRef:q,in:A,appear:!!g,timeout:L},e.createElement("div",{className:i(E.contentComponent,v(E,l(h)),{[v(E,l("edge-"+N))]:N,[E.hasTooltip]:R}),ref:q},X)))}));export{h as default};
2
+ //# sourceMappingURL=DialogContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogContent.js","sources":["../../../../src/Dialog/components/DialogContent/DialogContent.tsx"],"sourcesContent":["import React, {\n cloneElement,\n type CSSProperties,\n forwardRef,\n type ReactElement,\n useCallback,\n useEffect,\n useMemo,\n useRef\n} from \"react\";\nimport cx from \"classnames\";\nimport { camelCase } from \"es-toolkit\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { type CSSTransitionProps } from \"react-transition-group/CSSTransition\";\nimport { useClickOutside } from \"@vibe/hooks\";\nimport {\n chainFunctions,\n NOOP,\n useKeyEvent,\n type VibeComponentProps,\n keyCodes,\n getStyle,\n useMergeRef\n} from \"@vibe/shared\";\nimport {\n type DialogAnimationType,\n type DialogTriggerEvent,\n type DialogStartingEdge,\n type DialogPlacement\n} from \"../../Dialog.types\";\nimport styles from \"./DialogContent.module.scss\";\nimport useDisableScroll from \"../../hooks/useDisableScroll\";\n\nconst EMPTY_OBJECT: CSSProperties = {};\nconst ESCAPE_KEYS = [keyCodes.ESCAPE];\n\nexport interface DialogContentProps extends VibeComponentProps {\n /**\n * The content inside the dialog.\n */\n children?: ReactElement | ReactElement[];\n /**\n * The placement of the dialog relative to the reference element.\n */\n position?: DialogPlacement;\n /**\n * Class name applied to the dialog wrapper.\n */\n wrapperClassName?: string;\n /**\n * If true, the dialog is open.\n */\n isOpen?: boolean;\n /**\n * The starting edge for animation direction.\n */\n startingEdge?: DialogStartingEdge;\n /**\n * The animation type used for showing/hiding the dialog.\n */\n animationType?: DialogAnimationType;\n /**\n * Callback fired when the Escape key is pressed.\n */\n onEsc?: (event: React.KeyboardEvent) => void;\n /**\n * Callback fired when the mouse enters the dialog.\n */\n onMouseEnter?: (event: React.MouseEvent) => void;\n /**\n * Callback fired when the mouse leaves the dialog.\n */\n onMouseLeave?: (event: React.MouseEvent) => void;\n /**\n * Callback fired when clicking outside the dialog.\n */\n onClickOutside?: (event: React.MouseEvent, hideShowEvent: DialogTriggerEvent) => void;\n /**\n * Callback fired when clicking inside the dialog.\n */\n onClick?: (event: React.MouseEvent) => void;\n /**\n * Delay before showing the dialog (used for animation timing).\n */\n showDelay?: number;\n /**\n * Inline styles applied to the dialog wrapper.\n */\n styleObject?: CSSProperties;\n /**\n * If true, indicates the reference element is hidden.\n */\n isReferenceHidden?: boolean;\n /**\n * If true, applies tooltip arrow styling.\n */\n hasTooltip?: boolean;\n /**\n * CSS selector of the container for scroll disabling.\n */\n containerSelector?: string;\n /**\n * If true or a selector string, disables scrolling when open.\n */\n disableContainerScroll?: boolean | string;\n /**\n * Callback fired on context menu (right-click) events.\n */\n onContextMenu?: (e: React.MouseEvent) => void;\n}\n\nconst DialogContent = forwardRef<HTMLElement, DialogContentProps>(\n (\n {\n onEsc = NOOP,\n children,\n position,\n wrapperClassName,\n isOpen = false,\n startingEdge,\n animationType = \"expand\",\n onMouseEnter = NOOP,\n onMouseLeave = NOOP,\n onClickOutside = NOOP,\n onClick = NOOP,\n onContextMenu = NOOP,\n showDelay,\n styleObject = EMPTY_OBJECT,\n isReferenceHidden,\n hasTooltip = false,\n containerSelector,\n disableContainerScroll = false,\n \"data-testid\": dataTestId\n },\n forwardedRef\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const wrapperRef = useRef<HTMLSpanElement>(null);\n const mergedWrapperRef = useMergeRef(forwardedRef, wrapperRef);\n\n const onOutsideClick = useCallback(\n (event: React.MouseEvent) => {\n if (isOpen) {\n return onClickOutside(event, \"clickoutside\");\n }\n },\n [isOpen, onClickOutside]\n );\n const overrideOnContextMenu = useCallback(\n (event: React.MouseEvent) => {\n if (isOpen) {\n onContextMenu(event);\n }\n },\n [isOpen, onContextMenu]\n );\n\n // Wrap escape callback to ensure useKeyEvent always receives a valid function\n const escapeCallback = useMemo(\n () => (event: KeyboardEvent) => {\n if (isOpen && onEsc !== NOOP) {\n onEsc(event as unknown as React.KeyboardEvent);\n }\n },\n [isOpen, onEsc]\n );\n useKeyEvent({ keys: ESCAPE_KEYS, callback: escapeCallback });\n\n // Watch the wrapper ref to include padding area, tooltip arrows, and nested Dialogs\n useClickOutside({ callback: onOutsideClick, ref: wrapperRef });\n useClickOutside({ eventName: \"contextmenu\", callback: overrideOnContextMenu, ref: wrapperRef });\n const selectorToDisable = typeof disableContainerScroll === \"string\" ? disableContainerScroll : containerSelector;\n const { disableScroll, enableScroll } = useDisableScroll(selectorToDisable);\n\n useEffect(() => {\n if (disableContainerScroll) {\n if (isOpen) {\n disableScroll();\n } else {\n enableScroll();\n }\n }\n }, [disableContainerScroll, disableScroll, enableScroll, isOpen]);\n\n const transitionOptions: Partial<CSSTransitionProps> = { classNames: undefined };\n\n switch (animationType) {\n case \"expand\":\n transitionOptions.classNames = {\n appear: styles.expandAppear,\n appearActive: styles.expandAppearActive,\n exit: styles.expandExit\n };\n break;\n case \"opacity-and-slide\":\n transitionOptions.classNames = {\n appear: styles.opacitySlideAppear,\n appearActive: styles.opacitySlideAppearActive\n };\n break;\n }\n\n // Clone children to attach mouse event handlers, with proper type checking\n const childrenWithHandlers = React.Children.map(children, child => {\n // Only clone valid React elements, pass through primitives unchanged\n if (!React.isValidElement(child)) {\n return child;\n }\n\n return cloneElement(child as ReactElement, {\n onMouseEnter: chainFunctions([(child as ReactElement).props.onMouseEnter, onMouseEnter]),\n onMouseLeave: chainFunctions([(child as ReactElement).props.onMouseLeave, onMouseLeave])\n });\n });\n\n return (\n <span\n // Legacy class name preserved for Monolith overrides\n className={cx(\"monday-style-dialog-content-wrapper\", styles.contentWrapper, wrapperClassName)}\n ref={mergedWrapperRef}\n data-testid={dataTestId}\n style={styleObject}\n onClickCapture={onClick}\n data-dialog-reference-hidden={isReferenceHidden}\n >\n <CSSTransition\n classNames={transitionOptions.classNames}\n nodeRef={contentRef}\n in={isOpen}\n appear={!!animationType}\n timeout={showDelay}\n >\n <div\n className={cx(styles.contentComponent, getStyle(styles, camelCase(position)), {\n [getStyle(styles, camelCase(\"edge-\" + startingEdge))]: startingEdge,\n [styles.hasTooltip]: hasTooltip\n })}\n ref={contentRef}\n >\n {childrenWithHandlers}\n </div>\n </CSSTransition>\n </span>\n );\n }\n);\n\nexport default DialogContent;\n"],"names":["EMPTY_OBJECT","ESCAPE_KEYS","keyCodes","ESCAPE","DialogContent","forwardRef","onEsc","NOOP","children","position","wrapperClassName","isOpen","startingEdge","animationType","onMouseEnter","onMouseLeave","onClickOutside","onClick","onContextMenu","showDelay","styleObject","isReferenceHidden","hasTooltip","containerSelector","disableContainerScroll","dataTestId","forwardedRef","contentRef","useRef","wrapperRef","mergedWrapperRef","useMergeRef","onOutsideClick","useCallback","event","overrideOnContextMenu","escapeCallback","useMemo","useKeyEvent","keys","callback","useClickOutside","ref","eventName","selectorToDisable","disableScroll","enableScroll","useDisableScroll","useEffect","transitionOptions","classNames","undefined","appear","styles","expandAppear","appearActive","expandAppearActive","exit","expandExit","opacitySlideAppear","opacitySlideAppearActive","childrenWithHandlers","React","Children","map","child","isValidElement","cloneElement","chainFunctions","props","createElement","className","cx","contentWrapper","style","onClickCapture","CSSTransition","nodeRef","in","timeout","contentComponent","getStyle","camelCase"],"mappings":"0eAiCA,MAAMA,EAA8B,CAAA,EAC9BC,EAAc,CAACC,EAASC,QA6ExBC,EAAgBC,GACpB,EAEIC,QAAQC,EACRC,WACAC,WACAC,mBACAC,UAAS,EACTC,eACAC,gBAAgB,SAChBC,eAAeP,EACfQ,eAAeR,EACfS,iBAAiBT,EACjBU,UAAUV,EACVW,gBAAgBX,EAChBY,YACAC,cAAcpB,EACdqB,oBACAC,cAAa,EACbC,oBACAC,0BAAyB,EACzB,cAAeC,GAEjBC,KAEA,MAAMC,EAAaC,EAAuB,MACpCC,EAAaD,EAAwB,MACrCE,EAAmBC,EAAYL,EAAcG,GAE7CG,EAAiBC,GACpBC,IACC,GAAIvB,EACF,OAAOK,EAAekB,EAAO,eAC/B,GAEF,CAACvB,EAAQK,IAELmB,EAAwBF,GAC3BC,IACKvB,GACFO,EAAcgB,EAChB,GAEF,CAACvB,EAAQO,IAILkB,EAAiBC,GACrB,IAAOH,IACDvB,GAAUL,IAAUC,GACtBD,EAAM4B,EACR,GAEF,CAACvB,EAAQL,IAEXgC,EAAY,CAAEC,KAAMtC,EAAauC,SAAUJ,IAG3CK,EAAgB,CAAED,SAAUR,EAAgBU,IAAKb,IACjDY,EAAgB,CAAEE,UAAW,cAAeH,SAAUL,EAAuBO,IAAKb,IAClF,MAAMe,EAAsD,i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art:"bottomStart_fbd1e25e89",topStart:"topStart_9a8c4a01bc",bottomEnd:"bottomEnd_ba529273ef",topEnd:"topEnd_0e38f20f92",leftStart:"leftStart_cf0b3a6bb9",rightStart:"rightStart_580e8aef51",leftEnd:"leftEnd_ce9e71cb01",rightEnd:"rightEnd_d96bee3181",contentComponent:"contentComponent_b34301a306",hasTooltip:"hasTooltip_a1adbdc630",opacitySlideAppear:"opacitySlideAppear_f6f46e5a82",opacitySlideAppearActive:"opacitySlideAppearActive_85cf766591",expandAppear:"expandAppear_06c51691ba",expandExit:"expandExit_a6a8ffad6c",edgeBottom:"edgeBottom_9b900eb12f",edgeTop:"edgeTop_ca42d0fbe4",expandAppearActive:"expandAppearActive_33fb953403"};!function(e){const a="s_id-b5fc9eb29715_4_0_0-alpha_1";if("undefined"!=typeof document){const t=document.head||document.getElementsByTagName("head")[0];if(t.querySelector("#"+a))return;const n=document.createElement("style");n.id=a,t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.appendChild(document.createTextNode(e))}else globalThis.injectedStyles&&(globalThis.injectedStyles[a]=e)}("/* stylelint-disable */\n/* stylelint-enable */\n.contentWrapper_8668232f0e {\n outline: 0;\n}\n.contentWrapper_8668232f0e.top_4ba4151aa8, .contentWrapper_8668232f0e.right_e179e42aa9, .contentWrapper_8668232f0e.left_77fc68d0df, .contentWrapper_8668232f0e.bottom_9f5adc5420 {\n padding: var(--space-4);\n}\n.contentWrapper_8668232f0e.bottomStart_fbd1e25e89, .contentWrapper_8668232f0e.topStart_9a8c4a01bc, .contentWrapper_8668232f0e.bottomEnd_ba529273ef, .contentWrapper_8668232f0e.topEnd_0e38f20f92 {\n padding-block: var(--space-4);\n}\n.contentWrapper_8668232f0e.bottomStart_fbd1e25e89, .contentWrapper_8668232f0e.topStart_9a8c4a01bc {\n padding-inline-end: var(--space-4);\n}\n.contentWrapper_8668232f0e.bottomEnd_ba529273ef, .contentWrapper_8668232f0e.topEnd_0e38f20f92 {\n padding-inline-start: var(--space-4);\n}\n.contentWrapper_8668232f0e.leftStart_cf0b3a6bb9, .contentWrapper_8668232f0e.rightStart_580e8aef51, .contentWrapper_8668232f0e.leftEnd_ce9e71cb01, .contentWrapper_8668232f0e.rightEnd_d96bee3181 {\n padding-inline: var(--space-4);\n}\n.contentWrapper_8668232f0e.leftStart_cf0b3a6bb9, .contentWrapper_8668232f0e.rightStart_580e8aef51 {\n padding-block-end: var(--space-4);\n}\n.contentWrapper_8668232f0e.leftEnd_ce9e71cb01, .contentWrapper_8668232f0e.rightEnd_d96bee3181 {\n padding-block-start: var(--space-4);\n}\n.contentWrapper_8668232f0e[data-dialog-reference-hidden=true] {\n visibility: hidden;\n pointer-events: none;\n}\n.contentComponent_b34301a306:focus {\n outline: none;\n}\n.contentComponent_b34301a306.hasTooltip_a1adbdc630 {\n padding: 6px;\n}\n.opacitySlideAppear_f6f46e5a82 {\n opacity: 0;\n}\n.opacitySlideAppear_f6f46e5a82.top_4ba4151aa8 {\n transform: translateY(var(--space-16));\n}\n.opacitySlideAppear_f6f46e5a82.right_e179e42aa9 {\n transform: translateX(calc(var(--space-16) * -1));\n}\n.opacitySlideAppear_f6f46e5a82.bottom_9f5adc5420 {\n transform: translateY(calc(var(--space-16) * -1));\n}\n.opacitySlideAppear_f6f46e5a82.left_77fc68d0df {\n transform: translateX(var(--space-16));\n}\n.opacitySlideAppearActive_85cf766591 {\n transition: opacity 0.2s ease, transform 0.2s ease-out;\n opacity: 1;\n pointer-events: none;\n}\n.opacitySlideAppearActive_85cf766591.top_4ba4151aa8, .opacitySlideAppearActive_85cf766591.bottom_9f5adc5420 {\n transform: translateY(0);\n}\n.opacitySlideAppearActive_85cf766591.right_e179e42aa9, .opacitySlideAppearActive_85cf766591.left_77fc68d0df {\n transform: translateX(0);\n}\n.expandAppear_06c51691ba,\n.expandExit_a6a8ffad6c {\n transition: transform 0.1s cubic-bezier(0, 0, 0.35, 1);\n}\n.expandAppear_06c51691ba.top_4ba4151aa8, .expandAppear_06c51691ba.topStart_9a8c4a01bc, .expandAppear_06c51691ba.topEnd_0e38f20f92,\n.expandExit_a6a8ffad6c.top_4ba4151aa8,\n.expandExit_a6a8ffad6c.topStart_9a8c4a01bc,\n.expandExit_a6a8ffad6c.topEnd_0e38f20f92 {\n transform-origin: bottom center;\n transform: scale(0.8);\n}\n.expandAppear_06c51691ba.top_4ba4151aa8.edgeBottom_9b900eb12f, .expandAppear_06c51691ba.topStart_9a8c4a01bc.edgeBottom_9b900eb12f, .expandAppear_06c51691ba.topEnd_0e38f20f92.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.top_4ba4151aa8.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.topStart_9a8c4a01bc.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.topEnd_0e38f20f92.edgeBottom_9b900eb12f {\n transform-origin: bottom left;\n}\n.expandAppear_06c51691ba.top_4ba4151aa8.edgeTop_ca42d0fbe4, .expandAppear_06c51691ba.topStart_9a8c4a01bc.edgeTop_ca42d0fbe4, .expandAppear_06c51691ba.topEnd_0e38f20f92.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.top_4ba4151aa8.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.topStart_9a8c4a01bc.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.topEnd_0e38f20f92.edgeTop_ca42d0fbe4 {\n transform-origin: bottom right;\n}\n.expandAppear_06c51691ba.right_e179e42aa9, .expandAppear_06c51691ba.rightStart_580e8aef51, .expandAppear_06c51691ba.rightEnd_d96bee3181,\n.expandExit_a6a8ffad6c.right_e179e42aa9,\n.expandExit_a6a8ffad6c.rightStart_580e8aef51,\n.expandExit_a6a8ffad6c.rightEnd_d96bee3181 {\n transform-origin: left;\n transform: scale(0.8);\n}\n.expandAppear_06c51691ba.right_e179e42aa9.edgeBottom_9b900eb12f, .expandAppear_06c51691ba.rightStart_580e8aef51.edgeBottom_9b900eb12f, .expandAppear_06c51691ba.rightEnd_d96bee3181.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.right_e179e42aa9.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.rightStart_580e8aef51.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.rightEnd_d96bee3181.edgeBottom_9b900eb12f {\n transform-origin: top left;\n}\n.expandAppear_06c51691ba.right_e179e42aa9.edgeTop_ca42d0fbe4, .expandAppear_06c51691ba.rightStart_580e8aef51.edgeTop_ca42d0fbe4, .expandAppear_06c51691ba.rightEnd_d96bee3181.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.right_e179e42aa9.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.rightStart_580e8aef51.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.rightEnd_d96bee3181.edgeTop_ca42d0fbe4 {\n transform-origin: bottom left;\n}\n.expandAppear_06c51691ba.bottom_9f5adc5420, .expandAppear_06c51691ba.bottomStart_fbd1e25e89, .expandAppear_06c51691ba.bottomEnd_ba529273ef,\n.expandExit_a6a8ffad6c.bottom_9f5adc5420,\n.expandExit_a6a8ffad6c.bottomStart_fbd1e25e89,\n.expandExit_a6a8ffad6c.bottomEnd_ba529273ef {\n transform-origin: top;\n transform: scale(0.8);\n}\n.expandAppear_06c51691ba.bottom_9f5adc5420.edgeBottom_9b900eb12f, .expandAppear_06c51691ba.bottomStart_fbd1e25e89.edgeBottom_9b900eb12f, .expandAppear_06c51691ba.bottomEnd_ba529273ef.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.bottom_9f5adc5420.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.bottomStart_fbd1e25e89.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.bottomEnd_ba529273ef.edgeBottom_9b900eb12f {\n transform-origin: top left;\n}\n.expandAppear_06c51691ba.bottom_9f5adc5420.edgeTop_ca42d0fbe4, .expandAppear_06c51691ba.bottomStart_fbd1e25e89.edgeTop_ca42d0fbe4, .expandAppear_06c51691ba.bottomEnd_ba529273ef.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.bottom_9f5adc5420.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.bottomStart_fbd1e25e89.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.bottomEnd_ba529273ef.edgeTop_ca42d0fbe4 {\n transform-origin: top right;\n}\n.expandAppear_06c51691ba.left_77fc68d0df, .expandAppear_06c51691ba.leftStart_cf0b3a6bb9, .expandAppear_06c51691ba.leftEnd_ce9e71cb01,\n.expandExit_a6a8ffad6c.left_77fc68d0df,\n.expandExit_a6a8ffad6c.leftStart_cf0b3a6bb9,\n.expandExit_a6a8ffad6c.leftEnd_ce9e71cb01 {\n transform-origin: right;\n transform: scale(0.8);\n}\n.expandAppear_06c51691ba.left_77fc68d0df.edgeBottom_9b900eb12f, .expandAppear_06c51691ba.leftStart_cf0b3a6bb9.edgeBottom_9b900eb12f, .expandAppear_06c51691ba.leftEnd_ce9e71cb01.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.left_77fc68d0df.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.leftStart_cf0b3a6bb9.edgeBottom_9b900eb12f,\n.expandExit_a6a8ffad6c.leftEnd_ce9e71cb01.edgeBottom_9b900eb12f {\n transform-origin: top right;\n}\n.expandAppear_06c51691ba.left_77fc68d0df.edgeTop_ca42d0fbe4, .expandAppear_06c51691ba.leftStart_cf0b3a6bb9.edgeTop_ca42d0fbe4, .expandAppear_06c51691ba.leftEnd_ce9e71cb01.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.left_77fc68d0df.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.leftStart_cf0b3a6bb9.edgeTop_ca42d0fbe4,\n.expandExit_a6a8ffad6c.leftEnd_ce9e71cb01.edgeTop_ca42d0fbe4 {\n transform-origin: bottom right;\n}\n.expandExit_a6a8ffad6c {\n transition: transform 0.1s cubic-bezier(0, 0, 0.35, 1);\n}\n.expandAppearActive_33fb953403 {\n transition: transform 0.1s cubic-bezier(0, 0, 0.35, 1);\n pointer-events: none;\n}\n.expandAppearActive_33fb953403.top_4ba4151aa8, .expandAppearActive_33fb953403.topStart_9a8c4a01bc, .expandAppearActive_33fb953403.topEnd_0e38f20f92, .expandAppearActive_33fb953403.bottom_9f5adc5420, .expandAppearActive_33fb953403.bottomStart_fbd1e25e89, .expandAppearActive_33fb953403.bottomEnd_ba529273ef, .expandAppearActive_33fb953403.right_e179e42aa9, .expandAppearActive_33fb953403.rightStart_580e8aef51, .expandAppearActive_33fb953403.rightEnd_d96bee3181, .expandAppearActive_33fb953403.left_77fc68d0df, .expandAppearActive_33fb953403.leftStart_cf0b3a6bb9, .expandAppearActive_33fb953403.leftEnd_ce9e71cb01 {\n transform: scale(1);\n}");export{e as default};
2
+ //# sourceMappingURL=DialogContent.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogContent.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import React, { type HTMLProps, type ReactElement } from "react";
2
+ import { type VibeComponentProps } from "@vibe/shared";
3
+ export interface RefableProps extends React.PropsWithChildren<HTMLProps<HTMLElement> & VibeComponentProps> {
4
+ children: ReactElement | ReactElement[] | string;
5
+ /**
6
+ * The wrapper element type to use for React components. Defaults to "span".
7
+ */
8
+ wrapperElement?: "span" | "div";
9
+ }
10
+ /**
11
+ * Refable is a utility component that enables ref forwarding to children elements.
12
+ *
13
+ * For native HTML elements: Clones the child and merges refs and event handlers.
14
+ * For React components: Wraps in a span/div and attaches the ref to the wrapper.
15
+ *
16
+ * This allows Dialog to get a reference to the trigger element for positioning.
17
+ */
18
+ export declare const Refable: React.ForwardRefExoticComponent<Omit<RefableProps, "ref"> & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,2 @@
1
+ import{__rest as e}from"../../../_virtual/_tslib.js";import n from"react";import{chainRefFunctions as o,chainFunctions as r}from"@vibe/shared";const t=n.forwardRef(((r,t)=>{var{children:i,wrapperElement:u="span"}=r,l=e(r,["children","wrapperElement"]);return n.Children.map(i,(e=>{if(!n.isValidElement(e))return null;if("string"!=typeof e.type){return n.createElement(u,Object.assign({ref:t},l),e)}const r=e.props;return n.cloneElement(e,Object.assign(Object.assign(Object.assign({},l),r),{onClick:s("onClick",r,l),onBlur:s("onBlur",r,l),onFocus:s("onFocus",r,l),onMouseEnter:s("onMouseEnter",r,l),onMouseLeave:s("onMouseLeave",r,l),onMouseDown:s("onMouseDown",r,l),onKeyDown:s("onKeyDown",r,l),onContextMenu:s("onContextMenu",r,l),ref:o([e.ref,t])}))}))}));function s(e,n,o){return r([n[e],o[e]],!0)}export{t as Refable};
2
+ //# sourceMappingURL=Refable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Refable.js","sources":["../../../../src/Dialog/components/Refable/Refable.tsx"],"sourcesContent":["import React, { type HTMLProps, type ReactElement } from \"react\";\nimport { chainFunctions, chainRefFunctions, type VibeComponentProps } from \"@vibe/shared\";\n\nexport interface RefableProps extends React.PropsWithChildren<HTMLProps<HTMLElement> & VibeComponentProps> {\n children: ReactElement | ReactElement[] | string;\n /**\n * The wrapper element type to use for React components. Defaults to \"span\".\n */\n wrapperElement?: \"span\" | \"div\";\n}\n\n/**\n * Refable is a utility component that enables ref forwarding to children elements.\n *\n * For native HTML elements: Clones the child and merges refs and event handlers.\n * For React components: Wraps in a span/div and attaches the ref to the wrapper.\n *\n * This allows Dialog to get a reference to the trigger element for positioning.\n */\nexport const Refable = React.forwardRef<HTMLElement, RefableProps>(\n ({ children, wrapperElement = \"span\", ...rest }, ref) => {\n return React.Children.map(children, child => {\n if (!React.isValidElement(child)) return null;\n\n // For React components, wrap in a native element to attach the ref\n if (typeof child.type !== \"string\") {\n const WrapperElement = wrapperElement;\n return (\n // @ts-expect-error - TypeScript can't infer the correct ref type when using a variable as JSX tag\n <WrapperElement ref={ref} {...rest}>\n {child}\n </WrapperElement>\n );\n }\n\n // For native HTML elements, clone and merge props/refs\n const childProps = child.props as React.HTMLProps<HTMLElement>;\n\n return React.cloneElement(child, {\n ...rest,\n ...childProps,\n // Chain all event handlers to preserve both parent and child handlers\n onClick: getChainedFunction(\"onClick\", childProps, rest),\n onBlur: getChainedFunction(\"onBlur\", childProps, rest),\n onFocus: getChainedFunction(\"onFocus\", childProps, rest),\n onMouseEnter: getChainedFunction(\"onMouseEnter\", childProps, rest),\n onMouseLeave: getChainedFunction(\"onMouseLeave\", childProps, rest),\n onMouseDown: getChainedFunction(\"onMouseDown\", childProps, rest),\n onKeyDown: getChainedFunction(\"onKeyDown\", childProps, rest),\n onContextMenu: getChainedFunction(\"onContextMenu\", childProps, rest),\n ref: chainRefFunctions([(child as any).ref, ref])\n } as any);\n }) as any;\n }\n);\n\nfunction getChainedFunction(\n name: keyof React.HTMLProps<unknown>,\n childProps: React.PropsWithChildren<React.HTMLProps<unknown>>,\n wrapperProps: React.HTMLProps<unknown>\n) {\n return chainFunctions([childProps[name], wrapperProps[name]], true);\n}\n"],"names":["Refable","React","forwardRef","_a","ref","children","wrapperElement","rest","__rest","Children","map","child","isValidElement","type","createElement","Object","assign","childProps","props","cloneElement","onClick","getChainedFunction","onBlur","onFocus","onMouseEnter","onMouseLeave","onMouseDown","onKeyDown","onContextMenu","chainRefFunctions","name","wrapperProps","chainFunctions"],"mappings":"+IAmBO,MAAMA,EAAUC,EAAMC,YAC3B,CAACC,EAAgDC,SAAhDC,SAAEA,EAAQC,eAAEA,EAAiB,UAAWC,EAAxCC,EAAAL,EAAA,CAAA,WAAA,mBACC,OAAOF,EAAMQ,SAASC,IAAIL,GAAUM,IAClC,IAAKV,EAAMW,eAAeD,GAAQ,OAAO,KAGzC,GAA0B,iBAAfA,EAAME,KAAmB,CAElC,OAEEZ,EAACa,cAHoBR,EAGLS,OAAAC,OAAA,CAAAZ,IAAKA,GAASG,GAC3BI,EAGP,CAGA,MAAMM,EAAaN,EAAMO,MAEzB,OAAOjB,EAAMkB,aAAaR,EAAOI,OAAAC,OAAAD,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAC5BT,GACAU,GAAU,CAEbG,QAASC,EAAmB,UAAWJ,EAAYV,GACnDe,OAAQD,EAAmB,SAAUJ,EAAYV,GACjDgB,QAASF,EAAmB,UAAWJ,EAAYV,GACnDiB,aAAcH,EAAmB,eAAgBJ,EAAYV,GAC7DkB,aAAcJ,EAAmB,eAAgBJ,EAAYV,GAC7DmB,YAAaL,EAAmB,cAAeJ,EAAYV,GAC3DoB,UAAWN,EAAmB,YAAaJ,EAAYV,GACvDqB,cAAeP,EAAmB,gBAAiBJ,EAAYV,GAC/DH,IAAKyB,EAAkB,CAAElB,EAAcP,IAAKA,MACrC,GACF,IAIb,SAASiB,EACPS,EACAb,EACAc,GAEA,OAAOC,EAAe,CAACf,EAAWa,GAAOC,EAAaD,KAAQ,EAChE"}
@@ -0,0 +1,5 @@
1
+ declare const useDisableScroll: (scrollableQuerySelector: string | undefined) => {
2
+ disableScroll: () => void;
3
+ enableScroll: () => void;
4
+ };
5
+ export default useDisableScroll;
@@ -0,0 +1,2 @@
1
+ import{useCallback as e,useEffect as l}from"react";const t=t=>{const o=e((e=>(e.preventDefault(),e.stopPropagation(),!1)),[]),r=e((()=>{(null==t?void 0:t.length)&&t.length>0&&document.querySelectorAll(t).forEach((e=>{e.addEventListener("wheel",o,{passive:!1})}))}),[o,t]),n=e((()=>{(null==t?void 0:t.length)&&t.length>0&&document.querySelectorAll(t).forEach((e=>{e.removeEventListener("wheel",o)}))}),[o,t]);return l((()=>n),[n]),{disableScroll:r,enableScroll:n}};export{t as default};
2
+ //# sourceMappingURL=useDisableScroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDisableScroll.js","sources":["../../../src/Dialog/hooks/useDisableScroll.ts"],"sourcesContent":["import { useCallback, useEffect } from \"react\";\n\nconst useDisableScroll = (scrollableQuerySelector: string | undefined) => {\n const _disableScroll = useCallback((e: Event) => {\n e.preventDefault();\n e.stopPropagation();\n\n return false;\n }, []);\n\n const disableScroll = useCallback(() => {\n if (scrollableQuerySelector?.length && scrollableQuerySelector.length > 0) {\n document.querySelectorAll(scrollableQuerySelector).forEach((item: Element) => {\n item.addEventListener(\"wheel\", _disableScroll, { passive: false });\n });\n }\n }, [_disableScroll, scrollableQuerySelector]);\n\n const enableScroll = useCallback(() => {\n if (scrollableQuerySelector?.length && scrollableQuerySelector.length > 0) {\n document.querySelectorAll(scrollableQuerySelector).forEach((item: Element) => {\n item.removeEventListener(\"wheel\", _disableScroll);\n });\n }\n }, [_disableScroll, scrollableQuerySelector]);\n\n useEffect(() => {\n return enableScroll;\n }, [enableScroll]);\n\n return {\n disableScroll,\n enableScroll\n };\n};\n\nexport default useDisableScroll;\n"],"names":["useDisableScroll","scrollableQuerySelector","_disableScroll","useCallback","e","preventDefault","stopPropagation","disableScroll","length","document","querySelectorAll","forEach","item","addEventListener","passive","enableScroll","removeEventListener","useEffect"],"mappings":"mDAEMA,MAAAA,EAAoBC,IACxB,MAAMC,EAAiBC,GAAaC,IAClCA,EAAEC,iBACFD,EAAEE,mBAEK,IACN,IAEGC,EAAgBJ,GAAY,MAC5BF,eAAAA,EAAyBO,SAAUP,EAAwBO,OAAS,GACtEC,SAASC,iBAAiBT,GAAyBU,SAASC,IAC1DA,EAAKC,iBAAiB,QAASX,EAAgB,CAAEY,SAAS,GAAQ,GAEtE,GACC,CAACZ,EAAgBD,IAEdc,EAAeZ,GAAY,MAC3BF,eAAAA,EAAyBO,SAAUP,EAAwBO,OAAS,GACtEC,SAASC,iBAAiBT,GAAyBU,SAASC,IAC1DA,EAAKI,oBAAoB,QAASd,EAAe,GAErD,GACC,CAACA,EAAgBD,IAMpB,OAJAgB,GAAU,IACDF,GACN,CAACA,IAEG,CACLR,gBACAQ,eACD"}
@@ -0,0 +1,3 @@
1
+ export { default as Dialog } from "./Dialog";
2
+ export { DialogPlacement as DialogPlacementEnum } from "./DialogConstants";
3
+ export * from "./Dialog.types";
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { type VibeComponentProps } from "@vibe/shared";
3
+ import { type DialogSize, type DialogType } from "../Dialog";
4
+ export interface DialogContentContainerProps extends VibeComponentProps {
5
+ /**
6
+ * The content inside the dialog container.
7
+ */
8
+ children?: React.ReactNode;
9
+ /**
10
+ * The ID of the element that labels this dialog.
11
+ */
12
+ "aria-labelledby"?: string;
13
+ /**
14
+ * The ID of the element that describes this dialog.
15
+ */
16
+ "aria-describedby"?: string;
17
+ /**
18
+ * The type of dialog.
19
+ */
20
+ type?: DialogType;
21
+ /**
22
+ * The size of the dialog.
23
+ */
24
+ size?: DialogSize;
25
+ /**
26
+ * Custom styles applied to the dialog container.
27
+ */
28
+ style?: React.CSSProperties;
29
+ /**
30
+ * The ARIA role applied to the dialog container.
31
+ * Defaults to "dialog" when not provided. Pass `null` to remove the role attribute entirely.
32
+ */
33
+ role?: string | null;
34
+ }
35
+ declare const DialogContentContainer: React.ForwardRefExoticComponent<DialogContentContainerProps & React.RefAttributes<HTMLElement>>;
36
+ export default DialogContentContainer;
@@ -0,0 +1,2 @@
1
+ import{__rest as e}from"../_virtual/_tslib.js";import{camelCase as a}from"es-toolkit";import t from"classnames";import i,{forwardRef as r,useRef as l}from"react";import{getTestId as s,ComponentDefaultTestId as o,useMergeRef as d,getStyle as m}from"@vibe/shared";import n from"./DialogContentContainer.module.scss.js";const b=r(((r,b)=>{var{id:c,className:p="","aria-labelledby":y="","aria-describedby":f="",type:N="popover",size:u="small",children:v,style:C,role:g,"data-testid":O=s(o.DIALOG_CONTENT_CONTAINER,c)}=r,_=e(r,["id","className","aria-labelledby","aria-describedby","type","size","children","style","role","data-testid"]);const h=l(null),j=d(b,h);return i.createElement("div",Object.assign({id:c,role:null===g?void 0:g||"dialog","data-testid":O,"aria-labelledby":y,"aria-describedby":f,ref:j,style:C,className:t(n.dialogContentContainer,p,m(n,a("type--"+N)),m(n,a("size--"+u)))},_),v)}));export{b as default};
2
+ //# sourceMappingURL=DialogContentContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogContentContainer.js","sources":["../../src/DialogContentContainer/DialogContentContainer.tsx"],"sourcesContent":["import { camelCase } from \"es-toolkit\";\nimport cx from \"classnames\";\nimport React, { useRef, forwardRef } from \"react\";\nimport { useMergeRef, type VibeComponentProps, ComponentDefaultTestId, getTestId, getStyle } from \"@vibe/shared\";\nimport { type DialogSize, type DialogType } from \"../Dialog\";\nimport styles from \"./DialogContentContainer.module.scss\";\n\nexport interface DialogContentContainerProps extends VibeComponentProps {\n /**\n * The content inside the dialog container.\n */\n children?: React.ReactNode;\n /**\n * The ID of the element that labels this dialog.\n */\n \"aria-labelledby\"?: string;\n /**\n * The ID of the element that describes this dialog.\n */\n \"aria-describedby\"?: string;\n /**\n * The type of dialog.\n */\n type?: DialogType;\n /**\n * The size of the dialog.\n */\n size?: DialogSize;\n /**\n * Custom styles applied to the dialog container.\n */\n style?: React.CSSProperties;\n /**\n * The ARIA role applied to the dialog container.\n * Defaults to \"dialog\" when not provided. Pass `null` to remove the role attribute entirely.\n */\n role?: string | null;\n}\n\nconst DialogContentContainer = forwardRef(\n (\n {\n id,\n className = \"\",\n \"aria-labelledby\": ariaLabelledby = \"\",\n \"aria-describedby\": ariaDescribedby = \"\",\n type = \"popover\",\n size = \"small\",\n children,\n style,\n role,\n \"data-testid\": dataTestId = getTestId(ComponentDefaultTestId.DIALOG_CONTENT_CONTAINER, id),\n ...props\n }: DialogContentContainerProps,\n ref: React.Ref<HTMLElement>\n ) => {\n const componentRef = useRef(null);\n const mergedRef = useMergeRef(ref, componentRef);\n\n const roleValue = role === null ? undefined : role || \"dialog\";\n\n return (\n <div\n id={id}\n role={roleValue}\n data-testid={dataTestId}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n ref={mergedRef}\n style={style}\n className={cx(\n styles.dialogContentContainer,\n className,\n getStyle(styles, camelCase(\"type--\" + type)),\n getStyle(styles, camelCase(\"size--\" + size))\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nexport default DialogContentContainer;\n"],"names":["DialogContentContainer","forwardRef","_a","ref","id","className","ariaLabelledby","ariaDescribedby","type","size","children","style","role","dataTestId","getTestId","ComponentDefaultTestId","DIALOG_CONTENT_CONTAINER","props","__rest","componentRef","useRef","mergedRef","useMergeRef","React","createElement","Object","assign","undefined","cx","styles","dialogContentContainer","getStyle","camelCase"],"mappings":"6TAuCMA,MAAAA,EAAyBC,GAC7B,CACEC,EAaAC,SAbAC,GACEA,EAAEC,UACFA,EAAY,GACZ,kBAAmBC,EAAiB,GACpC,mBAAoBC,EAAkB,GAAEC,KACxCA,EAAO,UAASC,KAChBA,EAAO,QAAOC,SACdA,EAAQC,MACRA,EAAKC,KACLA,EACA,cAAeC,EAAaC,EAAUC,EAAuBC,yBAA0BZ,MACpFa,EAXLC,EAAAhB,EAAA,CAAA,KAAA,YAAA,kBAAA,mBAAA,OAAA,OAAA,WAAA,QAAA,OAAA,gBAeA,MAAMiB,EAAeC,EAAO,MACtBC,EAAYC,EAAYnB,EAAKgB,GAInC,OACEI,EAAAC,cAAA,MAAAC,OAAAC,OAAA,CACEtB,GAAIA,EACJQ,KALuB,OAATA,OAAgBe,EAAYf,GAAQ,SAKnC,cACFC,EAAU,kBACNP,EACC,mBAAAC,EAClBJ,IAAKkB,EACLV,MAAOA,EACPN,UAAWuB,EACTC,EAAOC,uBACPzB,EACA0B,EAASF,EAAQG,EAAU,SAAWxB,IACtCuB,EAASF,EAAQG,EAAU,SAAWvB,MAEpCQ,GAEHP,EACG"}
@@ -0,0 +1,2 @@
1
+ var e={dialogContentContainer:"dialogContentContainer_493dbd2e99",sizeSmall:"sizeSmall_9e9c8067b8",sizeMedium:"sizeMedium_3286626b1e",sizeLarge:"sizeLarge_5d4db17b94",typePopover:"typePopover_1d5948d907",typeModal:"typeModal_11b65ba91d"};!function(e){const d="s_id-e25392b9c982_4_0_0-alpha_1";if("undefined"!=typeof document){const o=document.head||document.getElementsByTagName("head")[0];if(o.querySelector("#"+d))return;const a=document.createElement("style");a.id=d,o.firstChild?o.insertBefore(a,o.firstChild):o.appendChild(a),a.appendChild(document.createTextNode(e))}else globalThis.injectedStyles&&(globalThis.injectedStyles[d]=e)}(".dialogContentContainer_493dbd2e99:focus {\n outline: none;\n}\n\n.sizeSmall_9e9c8067b8 {\n padding: var(--space-8);\n}\n\n.sizeMedium_3286626b1e {\n padding: var(--space-16);\n}\n\n.sizeLarge_5d4db17b94 {\n padding: var(--space-24);\n}\n\n.typePopover_1d5948d907 {\n box-shadow: var(--box-shadow-medium);\n border-radius: var(--border-radius-medium);\n background-color: var(--secondary-background-color);\n}\n\n.dark-app-theme .typePopover_1d5948d907, .black-app-theme .typePopover_1d5948d907, .hacker-app-theme .typePopover_1d5948d907 {\n box-shadow: 0 0 0 1px var(--layout-border-color), var(--box-shadow-medium);\n}\n\n.typeModal_11b65ba91d {\n box-shadow: var(--box-shadow-large);\n border-radius: var(--border-radius-big);\n background-color: var(--primary-background-color);\n}");export{e as default};
2
+ //# sourceMappingURL=DialogContentContainer.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogContentContainer.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export { default as DialogContentContainer, type DialogContentContainerProps } from "./DialogContentContainer";
@@ -0,0 +1,2 @@
1
+ function r(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&0>e.indexOf(o)&&(t[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(r);o.length>n;n++)0>e.indexOf(o[n])&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]])}return t}"function"==typeof SuppressedError&&SuppressedError;export{r as __rest};
2
+ //# sourceMappingURL=_tslib.js.map