@vibe/dialog 3.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.
Files changed (93) hide show
  1. package/dist/Dialog/Dialog.d.ts +267 -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 +11 -0
  7. package/dist/Dialog/DialogConstants.d.ts +65 -0
  8. package/dist/Dialog/DialogConstants.js +2 -0
  9. package/dist/Dialog/DialogConstants.js.map +1 -0
  10. package/dist/Dialog/DialogContent/DialogContent.d.ts +80 -0
  11. package/dist/Dialog/DialogContent/DialogContent.js +2 -0
  12. package/dist/Dialog/DialogContent/DialogContent.js.map +1 -0
  13. package/dist/Dialog/DialogContent/DialogContent.module.scss.js +2 -0
  14. package/dist/Dialog/DialogContent/DialogContent.module.scss.js.map +1 -0
  15. package/dist/Dialog/DialogContent/useDisableScroll.d.ts +5 -0
  16. package/dist/Dialog/DialogContent/useDisableScroll.js +2 -0
  17. package/dist/Dialog/DialogContent/useDisableScroll.js.map +1 -0
  18. package/dist/Dialog/DialogContent/useDisableScroll.test.d.ts +1 -0
  19. package/dist/Dialog/index.d.ts +4 -0
  20. package/dist/Dialog/modifiers/observeContentResizeModifier.d.ts +2 -0
  21. package/dist/Dialog/modifiers/observeContentResizeModifier.js +2 -0
  22. package/dist/Dialog/modifiers/observeContentResizeModifier.js.map +1 -0
  23. package/dist/Dialog/modifiers/observeReferenceResizeModifier.d.ts +2 -0
  24. package/dist/Dialog/modifiers/observeReferenceResizeModifier.js +2 -0
  25. package/dist/Dialog/modifiers/observeReferenceResizeModifier.js.map +1 -0
  26. package/dist/Dialog/useForceUpdate.d.ts +2 -0
  27. package/dist/Dialog/useForceUpdate.js +2 -0
  28. package/dist/Dialog/useForceUpdate.js.map +1 -0
  29. package/dist/Dialog/usePopover.d.ts +19 -0
  30. package/dist/Dialog/usePopover.js +2 -0
  31. package/dist/Dialog/usePopover.js.map +1 -0
  32. package/dist/DialogContentContainer/DialogContentContainer.d.ts +40 -0
  33. package/dist/DialogContentContainer/DialogContentContainer.js +2 -0
  34. package/dist/DialogContentContainer/DialogContentContainer.js.map +1 -0
  35. package/dist/DialogContentContainer/DialogContentContainer.module.scss.js +2 -0
  36. package/dist/DialogContentContainer/DialogContentContainer.module.scss.js.map +1 -0
  37. package/dist/DialogContentContainer/index.d.ts +1 -0
  38. package/dist/Refable/Refable.d.ts +11 -0
  39. package/dist/Refable/Refable.js +2 -0
  40. package/dist/Refable/Refable.js.map +1 -0
  41. package/dist/Refable/index.d.ts +1 -0
  42. package/dist/_virtual/_tslib.js +2 -0
  43. package/dist/_virtual/_tslib.js.map +1 -0
  44. package/dist/index.d.ts +2 -0
  45. package/dist/index.js +2 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/mocked_classnames/Dialog/Dialog.d.ts +267 -0
  48. package/dist/mocked_classnames/Dialog/Dialog.js +2 -0
  49. package/dist/mocked_classnames/Dialog/Dialog.js.map +1 -0
  50. package/dist/mocked_classnames/Dialog/Dialog.module.scss.js +2 -0
  51. package/dist/mocked_classnames/Dialog/Dialog.module.scss.js.map +1 -0
  52. package/dist/mocked_classnames/Dialog/Dialog.types.d.ts +11 -0
  53. package/dist/mocked_classnames/Dialog/DialogConstants.d.ts +65 -0
  54. package/dist/mocked_classnames/Dialog/DialogConstants.js +2 -0
  55. package/dist/mocked_classnames/Dialog/DialogConstants.js.map +1 -0
  56. package/dist/mocked_classnames/Dialog/DialogContent/DialogContent.d.ts +80 -0
  57. package/dist/mocked_classnames/Dialog/DialogContent/DialogContent.js +2 -0
  58. package/dist/mocked_classnames/Dialog/DialogContent/DialogContent.js.map +1 -0
  59. package/dist/mocked_classnames/Dialog/DialogContent/DialogContent.module.scss.js +2 -0
  60. package/dist/mocked_classnames/Dialog/DialogContent/DialogContent.module.scss.js.map +1 -0
  61. package/dist/mocked_classnames/Dialog/DialogContent/useDisableScroll.d.ts +5 -0
  62. package/dist/mocked_classnames/Dialog/DialogContent/useDisableScroll.js +2 -0
  63. package/dist/mocked_classnames/Dialog/DialogContent/useDisableScroll.js.map +1 -0
  64. package/dist/mocked_classnames/Dialog/DialogContent/useDisableScroll.test.d.ts +1 -0
  65. package/dist/mocked_classnames/Dialog/index.d.ts +4 -0
  66. package/dist/mocked_classnames/Dialog/modifiers/observeContentResizeModifier.d.ts +2 -0
  67. package/dist/mocked_classnames/Dialog/modifiers/observeContentResizeModifier.js +2 -0
  68. package/dist/mocked_classnames/Dialog/modifiers/observeContentResizeModifier.js.map +1 -0
  69. package/dist/mocked_classnames/Dialog/modifiers/observeReferenceResizeModifier.d.ts +2 -0
  70. package/dist/mocked_classnames/Dialog/modifiers/observeReferenceResizeModifier.js +2 -0
  71. package/dist/mocked_classnames/Dialog/modifiers/observeReferenceResizeModifier.js.map +1 -0
  72. package/dist/mocked_classnames/Dialog/useForceUpdate.d.ts +2 -0
  73. package/dist/mocked_classnames/Dialog/useForceUpdate.js +2 -0
  74. package/dist/mocked_classnames/Dialog/useForceUpdate.js.map +1 -0
  75. package/dist/mocked_classnames/Dialog/usePopover.d.ts +19 -0
  76. package/dist/mocked_classnames/Dialog/usePopover.js +2 -0
  77. package/dist/mocked_classnames/Dialog/usePopover.js.map +1 -0
  78. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.d.ts +40 -0
  79. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.js +2 -0
  80. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.js.map +1 -0
  81. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.module.scss.js +2 -0
  82. package/dist/mocked_classnames/DialogContentContainer/DialogContentContainer.module.scss.js.map +1 -0
  83. package/dist/mocked_classnames/DialogContentContainer/index.d.ts +1 -0
  84. package/dist/mocked_classnames/Refable/Refable.d.ts +11 -0
  85. package/dist/mocked_classnames/Refable/Refable.js +2 -0
  86. package/dist/mocked_classnames/Refable/Refable.js.map +1 -0
  87. package/dist/mocked_classnames/Refable/index.d.ts +1 -0
  88. package/dist/mocked_classnames/_virtual/_tslib.js +2 -0
  89. package/dist/mocked_classnames/_virtual/_tslib.js.map +1 -0
  90. package/dist/mocked_classnames/index.d.ts +2 -0
  91. package/dist/mocked_classnames/index.js +2 -0
  92. package/dist/mocked_classnames/index.js.map +1 -0
  93. package/package.json +76 -0
@@ -0,0 +1,4 @@
1
+ export { default as Dialog, type DialogProps } from "./Dialog";
2
+ export { HideShowEvent as DialogTriggerEventEnum, AnimationType as DialogAnimationTypeEnum, DialogPosition as DialogPositionEnum, DialogSize as DialogSizeEnum, DialogPlacement as DialogPlacementEnum } from "./DialogConstants";
3
+ export { default as usePopover } from "./usePopover";
4
+ export * from "./Dialog.types";
@@ -0,0 +1,2 @@
1
+ import { type Modifier } from "react-popper";
2
+ export declare const createObserveContentResizeModifier: (isEnabled?: boolean) => Modifier<"observeContentResize">;
@@ -0,0 +1,2 @@
1
+ const e=(e=!1)=>({name:"observeContentResize",enabled:e,phase:"beforeWrite",fn(){},effect({state:e,instance:n}){const t=new ResizeObserver((()=>{n.update()}));return t.observe(e.elements.popper),()=>{t.disconnect()}}});export{e as createObserveContentResizeModifier};
2
+ //# sourceMappingURL=observeContentResizeModifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observeContentResizeModifier.js","sources":["../../../src/Dialog/modifiers/observeContentResizeModifier.ts"],"sourcesContent":["import { type Modifier } from \"react-popper\";\n\nexport const createObserveContentResizeModifier = (isEnabled = false): Modifier<\"observeContentResize\"> => ({\n name: \"observeContentResize\",\n enabled: isEnabled,\n phase: \"beforeWrite\",\n fn() {},\n effect({ state, instance }) {\n const observer = new ResizeObserver(() => {\n instance.update();\n });\n observer.observe(state.elements.popper);\n\n return () => {\n observer.disconnect();\n };\n }\n});\n"],"names":["createObserveContentResizeModifier","isEnabled","name","enabled","phase","fn","effect","state","instance","observer","ResizeObserver","update","observe","elements","popper","disconnect"],"mappings":"MAEaA,EAAqCA,CAACC,GAAY,KAA6C,CAC1GC,KAAM,uBACNC,QAASF,EACTG,MAAO,cACPC,EAAAA,GAAO,EACPC,MAAAA,EAAOC,MAAEA,EAAKC,SAAEA,IACd,MAAMC,EAAW,IAAIC,gBAAe,KAClCF,EAASG,QAAQ,IAInB,OAFAF,EAASG,QAAQL,EAAMM,SAASC,QAEzB,KACLL,EAASM,YAAY,CAEzB"}
@@ -0,0 +1,2 @@
1
+ import { type Modifier } from "react-popper";
2
+ export declare const createObserveReferenceResizeModifier: (isEnabled?: boolean) => Modifier<"observeReferenceResize">;
@@ -0,0 +1,2 @@
1
+ const e=(e=!1)=>({name:"observeReferenceResize",enabled:e,phase:"beforeWrite",fn(){},effect({state:e,instance:n}){if(!e.elements.reference)return;const r=new ResizeObserver((()=>{n.update()}));return r.observe(e.elements.reference),()=>{r.disconnect()}}});export{e as createObserveReferenceResizeModifier};
2
+ //# sourceMappingURL=observeReferenceResizeModifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observeReferenceResizeModifier.js","sources":["../../../src/Dialog/modifiers/observeReferenceResizeModifier.ts"],"sourcesContent":["import { type Modifier } from \"react-popper\";\n\nexport const createObserveReferenceResizeModifier = (isEnabled = false): Modifier<\"observeReferenceResize\"> => ({\n name: \"observeReferenceResize\",\n enabled: isEnabled,\n phase: \"beforeWrite\",\n fn() {},\n effect({ state, instance }) {\n if (!state.elements.reference) return;\n\n const observer = new ResizeObserver(() => {\n instance.update();\n });\n\n const reference = state.elements.reference as Element;\n observer.observe(reference);\n\n return () => {\n observer.disconnect();\n };\n }\n});\n"],"names":["createObserveReferenceResizeModifier","isEnabled","name","enabled","phase","fn","effect","state","instance","elements","reference","observer","ResizeObserver","update","observe","disconnect"],"mappings":"MAEaA,EAAuCA,CAACC,GAAY,KAA+C,CAC9GC,KAAM,yBACNC,QAASF,EACTG,MAAO,cACPC,EAAAA,GAAO,EACPC,MAAAA,EAAOC,MAAEA,EAAKC,SAAEA,IACd,IAAKD,EAAME,SAASC,UAAW,OAE/B,MAAMC,EAAW,IAAIC,gBAAe,KAClCJ,EAASK,QAAQ,IAMnB,OAFAF,EAASG,QADSP,EAAME,SAASC,WAG1B,KACLC,EAASI,YAAY,CAEzB"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function useForceUpdate(): import("react").DispatchWithoutAction;
@@ -0,0 +1,2 @@
1
+ import{useReducer as t}from"react";const r=()=>({});function o(){return t(r,{})[1]}export{o as default};
2
+ //# sourceMappingURL=useForceUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useForceUpdate.js","sources":["../../src/Dialog/useForceUpdate.ts"],"sourcesContent":["import { useReducer } from \"react\";\n\n// the second argument of useReducer is the dispatch function\n// after calling dispatch we will set a new object in the state\n// if the state will change by reference it will force rerender of the component\n\nconst reducerAlwaysReturningNewObj = () => ({});\n\nexport default function useForceUpdate() {\n return useReducer(reducerAlwaysReturningNewObj, {})[1];\n}\n"],"names":["reducerAlwaysReturningNewObj","useForceUpdate","useReducer"],"mappings":"mCAMA,MAAMA,EAA+BA,KAAO,CAAE,GAEhC,SAAUC,IACtB,OAAOC,EAAWF,EAA8B,IAAI,EACtD"}
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { DialogPlacement as Placement } from "./DialogConstants";
3
+ export default function usePopover(referenceElement: HTMLElement, popperElement: HTMLElement, { isOpen, placement, observeContentResize, observeReferenceResize, offset, fallbackPlacements }: {
4
+ isOpen?: boolean;
5
+ placement?: Placement;
6
+ observeContentResize?: boolean;
7
+ observeReferenceResize?: boolean;
8
+ offset?: [number, number];
9
+ fallbackPlacements?: Placement[];
10
+ }): {
11
+ styles: {
12
+ [key: string]: import("react").CSSProperties;
13
+ };
14
+ attributes: {
15
+ [key: string]: {
16
+ [key: string]: string;
17
+ };
18
+ };
19
+ };
@@ -0,0 +1,2 @@
1
+ import{useMemo as e}from"react";import{usePopper as t}from"react-popper";import{DialogPlacement as o}from"./DialogConstants.js";import{useIsomorphicLayoutEffect as s}from"@vibe/shared";import i from"./useForceUpdate.js";import{createObserveContentResizeModifier as r}from"./modifiers/observeContentResizeModifier.js";import{createObserveReferenceResizeModifier as n}from"./modifiers/observeReferenceResizeModifier.js";const{RIGHT_START:f,RIGHT_END:a,LEFT_START:m,LEFT_END:p}=o,l=[a,m,p];function c(o,a,{isOpen:m,placement:p=f,observeContentResize:c,observeReferenceResize:d,offset:b,fallbackPlacements:R=l}){const v=i();s((()=>{v()}),[o,a,v]);const T=e((()=>({placement:p,modifiers:[{name:"flip",options:{fallbackPlacements:R}},{name:"displayNone",enabled:!0,phase:"write",fn:({state:e})=>(e.styles.popper.visibility=m?"visible":"hidden",e)},r(c),n(d),void 0!==b&&{name:"offset",options:{offset:b}}]})),[p,c,b,m]),{styles:u,attributes:y}=t(o,a,T);return{styles:u,attributes:y}}export{c as default};
2
+ //# sourceMappingURL=usePopover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePopover.js","sources":["../../src/Dialog/usePopover.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { usePopper } from \"react-popper\";\nimport { DialogPlacement as Placement } from \"./DialogConstants\";\nimport { useIsomorphicLayoutEffect } from \"@vibe/shared\";\nimport useForceUpdate from \"./useForceUpdate\";\nimport type { Options, State } from \"@popperjs/core\";\nimport { createObserveContentResizeModifier } from \"./modifiers/observeContentResizeModifier\";\nimport { createObserveReferenceResizeModifier } from \"./modifiers/observeReferenceResizeModifier\";\nconst { RIGHT_START, RIGHT_END, LEFT_START, LEFT_END } = Placement;\n\nconst DEFAULT_FALLBACK_PLACEMENTS = [RIGHT_END, LEFT_START, LEFT_END];\n\nexport default function usePopover(\n referenceElement: HTMLElement,\n popperElement: HTMLElement,\n {\n isOpen,\n placement = RIGHT_START,\n observeContentResize,\n observeReferenceResize,\n offset,\n fallbackPlacements = DEFAULT_FALLBACK_PLACEMENTS\n }: {\n isOpen?: boolean;\n placement?: Placement;\n observeContentResize?: boolean;\n observeReferenceResize?: boolean;\n offset?: [number, number];\n fallbackPlacements?: Placement[];\n }\n) {\n const forceUpdate = useForceUpdate();\n\n // we have to use forceUpdate because\n // usePopper need to run again after any refs changes, even after the first render.\n useIsomorphicLayoutEffect(() => {\n forceUpdate();\n }, [referenceElement, popperElement, forceUpdate]);\n\n const popperOptions: Pick<Options, \"placement\" | \"modifiers\"> = useMemo(() => {\n return {\n placement,\n modifiers: [\n {\n name: \"flip\",\n options: {\n fallbackPlacements\n }\n },\n {\n name: \"displayNone\",\n enabled: true,\n phase: \"write\",\n fn: ({ state }: { state: State }) => {\n state.styles.popper.visibility = isOpen ? \"visible\" : \"hidden\";\n return state;\n }\n },\n createObserveContentResizeModifier(observeContentResize),\n createObserveReferenceResizeModifier(observeReferenceResize),\n offset !== undefined && {\n name: \"offset\",\n options: { offset }\n }\n ]\n };\n }, [placement, observeContentResize, offset, isOpen]);\n\n const { styles, attributes } = usePopper(referenceElement, popperElement, popperOptions);\n\n return { styles, attributes };\n}\n"],"names":["RIGHT_START","RIGHT_END","LEFT_START","LEFT_END","Placement","DEFAULT_FALLBACK_PLACEMENTS","usePopover","referenceElement","popperElement","isOpen","placement","observeContentResize","observeReferenceResize","offset","fallbackPlacements","forceUpdate","useForceUpdate","useIsomorphicLayoutEffect","popperOptions","useMemo","modifiers","name","options","enabled","phase","fn","state","styles","popper","visibility","createObserveContentResizeModifier","createObserveReferenceResizeModifier","undefined","attributes","usePopper"],"mappings":"kaAQA,MAAMA,YAAEA,EAAWC,UAAEA,EAASC,WAAEA,EAAUC,SAAEA,GAAaC,EAEnDC,EAA8B,CAACJ,EAAWC,EAAYC,GAE9C,SAAUG,EACtBC,EACAC,GACAC,OACEA,EAAMC,UACNA,EAAYV,EAAWW,qBACvBA,EAAoBC,uBACpBA,EAAsBC,OACtBA,EAAMC,mBACNA,EAAqBT,IAUvB,MAAMU,EAAcC,IAIpBC,GAA0B,KACxBF,GAAa,GACZ,CAACR,EAAkBC,EAAeO,IAErC,MAAMG,EAA0DC,GAAQ,KAC/D,CACLT,YACAU,UAAW,CACT,CACEC,KAAM,OACNC,QAAS,CACPR,uBAGJ,CACEO,KAAM,cACNE,SAAS,EACTC,MAAO,QACPC,GAAIA,EAAGC,YACLA,EAAMC,OAAOC,OAAOC,WAAapB,EAAS,UAAY,SAC/CiB,IAGXI,EAAmCnB,GACnCoB,EAAqCnB,QAC1BoB,IAAXnB,GAAwB,CACtBQ,KAAM,SACNC,QAAS,CAAET,eAIhB,CAACH,EAAWC,EAAsBE,EAAQJ,KAEvCkB,OAAEA,EAAMM,WAAEA,GAAeC,EAAU3B,EAAkBC,EAAeU,GAE1E,MAAO,CAAES,SAAQM,aACnB"}
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import { type VibeComponentProps } from "@vibe/shared";
3
+ import { DialogSize as DialogSizeEnum, DialogType as DialogTypeEnum } from "../Dialog/DialogConstants";
4
+ import { type DialogSize, type DialogType } from "../Dialog";
5
+ export interface DialogContentContainerProps extends VibeComponentProps {
6
+ /**
7
+ * The content inside the dialog container.
8
+ */
9
+ children?: React.ReactNode;
10
+ /**
11
+ * The ID of the element that labels this dialog.
12
+ */
13
+ ariaLabelledby?: string;
14
+ /**
15
+ * The ID of the element that describes this dialog.
16
+ */
17
+ ariaDescribedby?: string;
18
+ /**
19
+ * The type of dialog.
20
+ */
21
+ type?: DialogType;
22
+ /**
23
+ * The size of the dialog.
24
+ */
25
+ size?: DialogSize;
26
+ /**
27
+ * Custom styles applied to the dialog container.
28
+ */
29
+ style?: React.CSSProperties;
30
+ /**
31
+ * The ARIA role applied to the dialog container.
32
+ * Defaults to "dialog" when not provided. Pass `null` to remove the role attribute entirely.
33
+ */
34
+ role?: string | null;
35
+ }
36
+ declare const _default: React.ForwardRefExoticComponent<DialogContentContainerProps & React.RefAttributes<HTMLElement>> & {
37
+ types: typeof DialogTypeEnum;
38
+ sizes: typeof DialogSizeEnum;
39
+ };
40
+ export default _default;
@@ -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 s}from"react";import{getTestId as l,ComponentDefaultTestId as o,useMergeRef as d,getStyle as m,withStaticProps as n}from"@vibe/shared";import{DialogType as b,DialogSize as c}from"../Dialog/DialogConstants.js";import p from"./DialogContentContainer.module.scss.js";var y=n(r(((r,n)=>{var{id:b,className:c="",ariaLabelledby:y="",ariaDescribedby:f="",type:v="popover",size:C="small",children:N,style:g,role:u,"data-testid":D=l(o.DIALOG_CONTENT_CONTAINER,b)}=r,j=e(r,["id","className","ariaLabelledby","ariaDescribedby","type","size","children","style","role","data-testid"]);const z=s(null),O=d(n,z);return i.createElement("div",Object.assign({id:b,role:null===u?void 0:u||"dialog","data-testid":D,"aria-labelledby":y,"aria-describedby":f,ref:O,style:g,className:t(p.dialogContentContainer,c,m(p,a("type--"+v)),m(p,a("size--"+C)))},j),N)})),{types:b,sizes:c});export{y 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 {\n useMergeRef,\n type VibeComponentProps,\n withStaticProps,\n ComponentDefaultTestId,\n getTestId,\n getStyle\n} from \"@vibe/shared\";\nimport { DialogSize as DialogSizeEnum, DialogType as DialogTypeEnum } from \"../Dialog/DialogConstants\";\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 ariaLabelledby?: string;\n /**\n * The ID of the element that describes this dialog.\n */\n ariaDescribedby?: 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 ariaLabelledby = \"\",\n 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\ninterface DialogContentContainerStaticProps {\n types: typeof DialogTypeEnum;\n sizes: typeof DialogSizeEnum;\n}\n\nexport default withStaticProps<DialogContentContainerProps, DialogContentContainerStaticProps>(DialogContentContainer, {\n types: DialogTypeEnum,\n sizes: DialogSizeEnum\n});\n"],"names":["withStaticProps","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","types","DialogTypeEnum","sizes","DialogSizeEnum"],"mappings":"4ZAiGA,IAAeA,EAAAA,EAlDgBC,GAC7B,CACEC,EAaAC,SAbAC,GACEA,EAAEC,UACFA,EAAY,GAAEC,eACdA,EAAiB,GAAEC,gBACnBA,EAAkB,GAAEC,KACpBA,EAAO,UAASC,KAChBA,EAAO,QAAOC,SACdA,EAAQC,MACRA,EAAKC,KACLA,EACA,cAAeC,EAAaC,EAAUC,EAAuBC,yBAA0BZ,MACpFa,EAXLC,EAAAhB,EAAA,CAAA,KAAA,YAAA,iBAAA,kBAAA,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,IAU2G,CACrHuB,MAAOC,EACPC,MAAOC"}
@@ -0,0 +1,2 @@
1
+ var e={dialogContentContainer:"dialogContentContainer_b88df099fa",sizeSmall:"sizeSmall_c3725aa8df",sizeMedium:"sizeMedium_8924e7a30c",sizeLarge:"sizeLarge_6fd2f3e46c",typePopover:"typePopover_7f568df29c",typeModal:"typeModal_c68c8ad8b3"};!function(e){const a="s_id-f752ec1c8102_3_0_0";if("undefined"!=typeof document){const n=document.head||document.getElementsByTagName("head")[0];if(n.querySelector("#"+a))return;const o=document.createElement("style");o.id=a,n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.appendChild(document.createTextNode(e))}else globalThis.injectedStyles&&(globalThis.injectedStyles[a]=e)}(".dialogContentContainer_b88df099fa:focus {\n outline: none;\n}\n\n.sizeSmall_c3725aa8df {\n padding: var(--spacing-small);\n}\n\n.sizeMedium_8924e7a30c {\n padding: var(--spacing-medium);\n}\n\n.sizeLarge_6fd2f3e46c {\n padding: var(--spacing-large);\n}\n\n.typePopover_7f568df29c {\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_7f568df29c, .black-app-theme .typePopover_7f568df29c, .hacker-app-theme .typePopover_7f568df29c {\n box-shadow: 0 0 0 1px var(--layout-border-color), var(--box-shadow-medium);\n}\n\n.typeModal_c68c8ad8b3 {\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,11 @@
1
+ import React, { type ReactElement } from "react";
2
+ import { type VibeComponentProps } from "@vibe/shared";
3
+ export declare const Refable: React.ForwardRefExoticComponent<Omit<React.HTMLProps<any> & VibeComponentProps & {
4
+ children?: React.ReactNode;
5
+ } & {
6
+ children: ReactElement | ReactElement[] | string;
7
+ /**
8
+ * The wrapper element type to use for React components. Defaults to "span".
9
+ */
10
+ wrapperElement?: "span" | "div";
11
+ }, "ref"> & React.RefAttributes<React.ReactElement<any, string | React.JSXElementConstructor<any>>>>;
@@ -0,0 +1,2 @@
1
+ import{__rest as e}from"../_virtual/_tslib.js";import r from"react";import{chainRefFunctions as n,chainFunctions as o}from"@vibe/shared";const s=r.forwardRef(((o,s)=>{var{children:p,wrapperElement:i="span"}=o,l=e(o,["children","wrapperElement"]);return r.Children.map(p,(e=>{if(!r.isValidElement(e))return null;if("string"!=typeof e.type){return r.createElement(i,Object.assign({ref:s},l),r.cloneElement(e,Object.assign({},e.props)))}return r.cloneElement(e,Object.assign(Object.assign(Object.assign({},l),e.props),{onClick:t("onClick",e.props,l),onBlur:t("onBlur",e.props,l),onMouseEnter:t("onMouseEnter",e.props,l),onMouseLeave:t("onMouseLeave",e.props,l),onMouseDown:t("onMouseDown",e.props,l),onFocus:t("onFocus",e.props,l),ref:n([e.ref,s])}))}))}));function t(e,r,n){return o([r[e],n[e]],!0)}export{s as Refable};
2
+ //# sourceMappingURL=Refable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Refable.js","sources":["../../src/Refable/Refable.tsx"],"sourcesContent":["import React, { type HTMLProps, type MutableRefObject, type ReactElement } from \"react\";\nimport { chainFunctions, chainRefFunctions, type VibeComponentProps } from \"@vibe/shared\";\n\nexport const Refable = React.forwardRef<\n ReactElement,\n React.PropsWithChildren<unknown & HTMLProps<any> & 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 // @ts-expect-error React forwardRef type def doesn't seem to support multiple refs\n>(({ children, wrapperElement = \"span\", ...rest }, ref) => {\n return React.Children.map(children, child => {\n if (!React.isValidElement(child)) return null;\n\n if (typeof child.type !== \"string\") {\n const WrapperElement = wrapperElement;\n return (\n <WrapperElement ref={ref as MutableRefObject<any>} {...rest}>\n {React.cloneElement(child, { ...child.props })}\n </WrapperElement>\n );\n }\n\n return React.cloneElement(child, {\n ...rest,\n ...child.props,\n onClick: getChainedFunction(\"onClick\", child.props, rest),\n onBlur: getChainedFunction(\"onBlur\", child.props, rest),\n onMouseEnter: getChainedFunction(\"onMouseEnter\", child.props, rest),\n onMouseLeave: getChainedFunction(\"onMouseLeave\", child.props, rest),\n onMouseDown: getChainedFunction(\"onMouseDown\", child.props, rest),\n onFocus: getChainedFunction(\"onFocus\", child.props, rest),\n // @ts-expect-error\n ref: chainRefFunctions([child.ref, ref as MutableRefObject<any>])\n });\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","Object","assign","cloneElement","props","onClick","getChainedFunction","onBlur","onMouseEnter","onMouseLeave","onMouseDown","onFocus","chainRefFunctions","name","childProps","wrapperProps","chainFunctions"],"mappings":"yIAGO,MAAMA,EAAUC,EAAMC,YAU3B,CAACC,EAAgDC,SAAhDC,SAAEA,EAAQC,eAAEA,EAAiB,UAAWC,EAAxCC,EAAAL,EAAA,CAAA,WAAA,mBACD,OAAOF,EAAMQ,SAASC,IAAIL,GAAUM,IAClC,IAAKV,EAAMW,eAAeD,GAAQ,OAAO,KAEzC,GAA0B,iBAAfA,EAAME,KAAmB,CAElC,OACEZ,gBAFqBK,EAENQ,OAAAC,OAAA,CAACX,IAAKA,GAAkCG,GACpDN,EAAMe,aAAaL,EAAYG,OAAAC,OAAA,GAAAJ,EAAMM,QAG3C,CAED,OAAOhB,EAAMe,aAAaL,EAAKG,OAAAC,OAAAD,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAC1BR,GACAI,EAAMM,OAAK,CACdC,QAASC,EAAmB,UAAWR,EAAMM,MAAOV,GACpDa,OAAQD,EAAmB,SAAUR,EAAMM,MAAOV,GAClDc,aAAcF,EAAmB,eAAgBR,EAAMM,MAAOV,GAC9De,aAAcH,EAAmB,eAAgBR,EAAMM,MAAOV,GAC9DgB,YAAaJ,EAAmB,cAAeR,EAAMM,MAAOV,GAC5DiB,QAASL,EAAmB,UAAWR,EAAMM,MAAOV,GAEpDH,IAAKqB,EAAkB,CAACd,EAAMP,IAAKA,MACnC,GACF,IAGJ,SAASe,EACPO,EACAC,EACAC,GAEA,OAAOC,EAAe,CAACF,EAAWD,GAAOE,EAAaF,KAAQ,EAChE"}
@@ -0,0 +1 @@
1
+ export { Refable } from "./Refable";
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./Dialog";
2
+ export * from "./DialogContentContainer";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export{default as Dialog}from"./Dialog/Dialog.js";export{AnimationType as DialogAnimationTypeEnum,DialogPlacement as DialogPlacementEnum,DialogPosition as DialogPositionEnum,DialogSize as DialogSizeEnum,HideShowEvent as DialogTriggerEventEnum}from"./Dialog/DialogConstants.js";export{default as usePopover}from"./Dialog/usePopover.js";export{default as DialogContentContainer}from"./DialogContentContainer/DialogContentContainer.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,267 @@
1
+ import React, { PureComponent, type ReactElement } from "react";
2
+ import { type Modifier } from "react-popper";
3
+ import { NOOP, type VibeComponentProps } from "@vibe/shared";
4
+ import { AnimationType as AnimationTypeEnum, HideShowEvent as DialogTriggerEventEnum, DialogPosition as DialogPositionEnum } from "./DialogConstants";
5
+ import type * as PopperJS from "@popperjs/core";
6
+ import { type DialogAnimationType, type DialogPosition, type DialogTriggerEvent, type DialogEvent } from "./Dialog.types";
7
+ import { LayerContext } from "@vibe/layer";
8
+ export interface DialogProps extends VibeComponentProps {
9
+ /**
10
+ * Class name applied to the reference wrapper element.
11
+ */
12
+ referenceWrapperClassName?: string;
13
+ /**
14
+ * The wrapper element type to use for React components. Defaults to "span".
15
+ */
16
+ referenceWrapperElement?: "span" | "div";
17
+ /**
18
+ * The placement of the dialog relative to the reference element.
19
+ */
20
+ position?: DialogPosition;
21
+ /**
22
+ * Custom Popper.js modifiers.
23
+ * https://popper.js.org/docs/v2/modifiers/
24
+ */
25
+ modifiers?: Modifier<any>[];
26
+ /**
27
+ * The starting edge of the dialog.
28
+ */
29
+ startingEdge?: string;
30
+ /**
31
+ * Offset values for positioning adjustments.
32
+ * `main` - horizontal offset
33
+ * `secondary` - vertical offset
34
+ */
35
+ moveBy?: {
36
+ main?: number;
37
+ secondary?: number;
38
+ };
39
+ /**
40
+ * Delay in milliseconds before showing the dialog.
41
+ */
42
+ showDelay?: number;
43
+ /**
44
+ * Delay in milliseconds before hiding the dialog.
45
+ */
46
+ hideDelay?: number;
47
+ /**
48
+ * Events that trigger showing the dialog.
49
+ */
50
+ showTrigger?: DialogTriggerEvent | DialogTriggerEvent[];
51
+ /**
52
+ * Events that trigger hiding the dialog.
53
+ */
54
+ hideTrigger?: DialogTriggerEvent | DialogTriggerEvent[];
55
+ /**
56
+ * If true, prevents closing the dialog when the mouse enters it.
57
+ */
58
+ showOnDialogEnter?: boolean;
59
+ /**
60
+ * If true, shows the dialog when the component mounts.
61
+ */
62
+ shouldShowOnMount?: boolean;
63
+ /**
64
+ * If true, disables opening the dialog.
65
+ */
66
+ disable?: boolean;
67
+ /**
68
+ * Controls the open state of the dialog.
69
+ */
70
+ open?: boolean;
71
+ /**
72
+ * Derived state control for managing dialog visibility.
73
+ */
74
+ isOpen?: boolean;
75
+ /**
76
+ * Classes that prevent showing the dialog when present.
77
+ */
78
+ showTriggerIgnoreClass?: string | Array<string>;
79
+ /**
80
+ * Classes that prevent hiding the dialog when present.
81
+ */
82
+ hideTriggerIgnoreClass?: string | Array<string>;
83
+ /**
84
+ * The animation type used for the dialog.
85
+ */
86
+ animationType?: DialogAnimationType;
87
+ /**
88
+ * Class name applied to the dialog content container.
89
+ */
90
+ wrapperClassName?: string;
91
+ /**
92
+ * If true, prevents animation when mounting.
93
+ */
94
+ preventAnimationOnMount?: boolean;
95
+ /**
96
+ * The CSS selector of the container where the dialog is rendered.
97
+ */
98
+ containerSelector?: string;
99
+ /**
100
+ * If true, positions the tooltip element.
101
+ */
102
+ tooltip?: boolean;
103
+ /**
104
+ * Class name applied to the tooltip element.
105
+ */
106
+ tooltipClassName?: string;
107
+ /**
108
+ * Callback fired when the dialog is shown.
109
+ */
110
+ onDialogDidShow?: (event?: DialogEvent, eventName?: DialogTriggerEvent | string) => void;
111
+ /**
112
+ * Callback fired when the dialog is hidden.
113
+ */
114
+ onDialogDidHide?: (event: DialogEvent, eventName: DialogTriggerEvent | string) => void;
115
+ /**
116
+ * Callback fired when clicking outside the dialog.
117
+ */
118
+ onClickOutside?: (event: React.MouseEvent) => void;
119
+ /**
120
+ * Callback fired when clicking inside the dialog content.
121
+ */
122
+ onContentClick?: (event: React.MouseEvent) => void;
123
+ /**
124
+ * The z-index applied to the dialog.
125
+ */
126
+ zIndex?: number;
127
+ /**
128
+ * If true, uses derived state from props.
129
+ */
130
+ useDerivedStateFromProps?: boolean;
131
+ /**
132
+ * If true, makes the dialog disappear when the reference element is hidden.
133
+ */
134
+ hideWhenReferenceHidden?: boolean;
135
+ /**
136
+ * If true, triggers the callback when the dialog mounts.
137
+ */
138
+ shouldCallbackOnMount?: boolean;
139
+ /**
140
+ * If true, instantly shows and hides the dialog without delay.
141
+ */
142
+ instantShowAndHide?: boolean;
143
+ /**
144
+ * Callback to dynamically adjust show delay and animation behavior.
145
+ */
146
+ getDynamicShowDelay?: () => {
147
+ showDelay: number;
148
+ preventAnimation: boolean;
149
+ };
150
+ /**
151
+ * The content displayed inside the dialog.
152
+ */
153
+ content?: (() => JSX.Element) | JSX.Element;
154
+ /**
155
+ * The element to position the dialog beside.
156
+ */
157
+ children?: ReactElement | ReactElement[] | string;
158
+ /**
159
+ * If true, keyboard focus/blur events behave like mouse enter/leave.
160
+ */
161
+ addKeyboardHideShowTriggersByDefault?: boolean;
162
+ /**
163
+ * If true, disables scrolling for the container element.
164
+ */
165
+ disableContainerScroll?: boolean | string;
166
+ /**
167
+ * Enables the observation of content resize for the popper element.
168
+ * When set to `true`, a ResizeObserver is attached to the popper content,
169
+ * automatically triggering repositioning when the size of the content changes.
170
+ *
171
+ * This is useful for dialogs, tooltips, or popovers with dynamic content
172
+ * that may grow or shrink without a re-render being triggered.
173
+ */
174
+ observeContentResize?: boolean;
175
+ /**
176
+ * If true, provides a LayerProvider context for nested dialogs to render correctly.
177
+ * This is useful when you have components that use Dialog internally (like Dropdown)
178
+ * inside another Dialog, ensuring proper z-index stacking and click-outside behavior.
179
+ */
180
+ enableNestedDialogLayer?: boolean;
181
+ }
182
+ export interface DialogState {
183
+ /**
184
+ * If true, the dialog is open.
185
+ */
186
+ isOpen?: boolean;
187
+ /**
188
+ * If true, the dialog state is derived from props.
189
+ */
190
+ shouldUseDerivedStateFromProps?: boolean;
191
+ /**
192
+ * If true, prevents animation when opening or closing the dialog.
193
+ */
194
+ preventAnimation?: boolean;
195
+ }
196
+ export default class Dialog extends PureComponent<DialogProps, DialogState> {
197
+ static hideShowTriggers: typeof DialogTriggerEventEnum;
198
+ static positions: typeof DialogPositionEnum;
199
+ static animationTypes: typeof AnimationTypeEnum;
200
+ static defaultProps: {
201
+ position: string;
202
+ modifiers: (import("react-popper").StrictModifier<any> | Partial<PopperJS.Modifier<any, object>>)[];
203
+ moveBy: {
204
+ main: number;
205
+ secondary: number;
206
+ };
207
+ showDelay: number;
208
+ hideDelay: number;
209
+ showTrigger: DialogTriggerEventEnum;
210
+ hideTrigger: DialogTriggerEventEnum;
211
+ showOnDialogEnter: boolean;
212
+ shouldShowOnMount: boolean;
213
+ disable: boolean;
214
+ open: boolean;
215
+ animationType: AnimationTypeEnum;
216
+ preventAnimationOnMount: boolean;
217
+ tooltip: boolean;
218
+ onDialogDidShow: typeof NOOP;
219
+ onDialogDidHide: typeof NOOP;
220
+ onClickOutside: typeof NOOP;
221
+ onContentClick: typeof NOOP;
222
+ useDerivedStateFromProps: boolean;
223
+ hideWhenReferenceHidden: boolean;
224
+ shouldCallbackOnMount: boolean;
225
+ instantShowAndHide: boolean;
226
+ addKeyboardHideShowTriggersByDefault: boolean;
227
+ observeContentResize: boolean;
228
+ enableNestedDialogLayer: boolean;
229
+ };
230
+ private showTimeout;
231
+ private hideTimeout;
232
+ private containerRef;
233
+ context: React.ContextType<typeof LayerContext>;
234
+ constructor(props: DialogProps);
235
+ closeDialogOnEscape(event: KeyboardEvent): void;
236
+ componentDidMount(): void;
237
+ componentWillUnmount(): void;
238
+ static getDerivedStateFromProps(nextProps: DialogProps, state: DialogState): DialogState;
239
+ getDefaultContainer(): HTMLElement;
240
+ getContainer(): Element;
241
+ showDialog(event: DialogEvent, eventName: DialogTriggerEvent | string, options?: {
242
+ preventAnimation?: boolean;
243
+ }): void;
244
+ onShowDialog(event: DialogEvent, eventName: DialogTriggerEvent | string): void;
245
+ showDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string, options?: {}): void;
246
+ hideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string): void;
247
+ onHideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string): void;
248
+ hideDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string): void;
249
+ handleEvent(eventName: DialogTriggerEvent, target: EventTarget, event: DialogEvent): void;
250
+ isShown(): boolean;
251
+ isShowTrigger(eventName: DialogTriggerEvent): boolean;
252
+ isHideTrigger(eventName: DialogTriggerEvent): boolean;
253
+ onMouseEnter(e: React.MouseEvent): void;
254
+ onMouseLeave(e: React.MouseEvent): void;
255
+ onClick(e: React.MouseEvent): void;
256
+ onKeyDown(event: React.KeyboardEvent): void;
257
+ onMouseDown(e: React.MouseEvent): void;
258
+ onFocus(e: React.FocusEvent): void;
259
+ onBlur(e: React.FocusEvent): void;
260
+ onEsc(e: React.KeyboardEvent): void;
261
+ onContextMenu(e: React.MouseEvent): void;
262
+ onClickOutside(event: React.MouseEvent): void;
263
+ onDialogEnter(event: React.MouseEvent): void;
264
+ onDialogLeave(event: React.MouseEvent): void;
265
+ onContentClick(e: React.MouseEvent): void;
266
+ render(): string | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | React.JSX.Element;
267
+ }
@@ -0,0 +1,2 @@
1
+ import e from"classnames";import t,{PureComponent as i}from"react";import{createPortal as o}from"react-dom";import{Manager as n,Reference as s,Popper as r}from"react-popper";import{isFunction as h}from"es-toolkit";import{NOOP as a,isClient as l,isInsideClass as d,convertToArray as u,getTestId as c,ComponentDefaultTestId as p,chainRefFunctions as m,chainFunctions as g}from"@vibe/shared";import D from"./DialogContent/DialogContent.js";import{Refable as f}from"../Refable/Refable.js";import{HideShowEvent as w,DialogPosition as E,AnimationType as C}from"./DialogConstants.js";import T from"./Dialog.module.scss.js";import{LayerContext as v,LayerProvider as y}from"@vibe/layer";import{createObserveContentResizeModifier as b}from"./modifiers/observeContentResizeModifier.js";class S extends i{constructor(e){super(e),this.state={shouldUseDerivedStateFromProps:e.useDerivedStateFromProps,isOpen:e.shouldShowOnMount},this.containerRef=t.createRef(),this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onClick=this.onClick.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.isShown=this.isShown.bind(this),this.onEsc=this.onEsc.bind(this),this.onClickOutside=this.onClickOutside.bind(this),this.onDialogEnter=this.onDialogEnter.bind(this),this.onDialogLeave=this.onDialogLeave.bind(this),this.getContainer=this.getContainer.bind(this),this.onContentClick=this.onContentClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.closeDialogOnEscape=this.closeDialogOnEscape.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.getDefaultContainer=this.getDefaultContainer.bind(this),this.hideTimeout=null,this.showTimeout=null}closeDialogOnEscape(e){const{isOpen:t}=this.state;if(t)switch(e.key){case"Escape":this.hideDialogIfNeeded(e,w.ESCAPE_KEY);break;case"Tab":this.handleEvent(w.TAB_KEY,e.target,e);break;case"Enter":this.handleEvent(w.ENTER,e.target,e)}}componentDidMount(){const{shouldCallbackOnMount:e,onDialogDidShow:t}=this.props,{isOpen:i}=this.state;l()&&document.addEventListener("keyup",this.closeDialogOnEscape),e&&i&&t&&t()}componentWillUnmount(){l()&&document.removeEventListener("keyup",this.closeDialogOnEscape),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}static getDerivedStateFromProps(e,t){return t.shouldUseDerivedStateFromProps?{isOpen:e.isOpen}:null}getDefaultContainer(){const{layerRef:e}=this.context;return(null==e?void 0:e.current)?e.current:document.body}getContainer(){const{containerSelector:e}=this.props;if(!e)return this.getDefaultContainer();const t=document.querySelector(e);return t&&t instanceof Element?t:this.getDefaultContainer()}showDialog(e,t,i={}){const{showDelay:o,instantShowAndHide:n,getDynamicShowDelay:s}=this.props;let r=o,h=i.preventAnimation;if(s){const e=s();r=e.showDelay||0,h=h||e.preventAnimation}n?(this.onShowDialog(e,t),this.setState({isOpen:!0,preventAnimation:h}),this.showTimeout=null):this.showTimeout=setTimeout((()=>{this.onShowDialog(e,t),this.showTimeout=null,this.setState({isOpen:!0,preventAnimation:h})}),r)}onShowDialog(e,t){if(this.isShown())return;const{onDialogDidShow:i}=this.props;i(e,t)}showDialogIfNeeded(e,t,i={}){const{disable:o}=this.props;o||(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.showTimeout||this.showDialog(e,t,i))}hideDialog(e,t){const{hideDelay:i,instantShowAndHide:o}=this.props;o?(this.onHideDialog(e,t),this.setState({isOpen:!1}),this.hideTimeout=null):this.hideTimeout=setTimeout((()=>{this.onHideDialog(e,t),this.setState({isOpen:!1}),this.hideTimeout=null}),i)}onHideDialog(e,t){const{onDialogDidHide:i}=this.props;i&&i(e,t)}hideDialogIfNeeded(e,t){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.hideTimeout||this.hideDialog(e,t)}handleEvent(e,t,i){const{showTriggerIgnoreClass:o,hideTriggerIgnoreClass:n}=this.props;return!this.isShowTrigger(e)||this.isShown()||d(t,o)?this.isHideTrigger(e)&&!d(t,n)?this.hideDialogIfNeeded(i,e):void 0:this.showDialogIfNeeded(i,e)}isShown(){const{isOpen:e}=this.state,{open:t}=this.props;return e||t}isShowTrigger(e){const{showTrigger:t,addKeyboardHideShowTriggersByDefault:i}=this.props,o=u(t);return!(!i||"focus"!==e||-1>=o.indexOf("mouseenter"))||o.indexOf(e)>-1}isHideTrigger(e){const{hideTrigger:t,addKeyboardHideShowTriggersByDefault:i}=this.props,o=u(t);return!(!i||"blur"!==e||-1>=o.indexOf("mouseleave"))||o.indexOf(e)>-1}onMouseEnter(e){this.handleEvent("mouseenter",e.target,e)}onMouseLeave(e){this.handleEvent("mouseleave",e.target,e)}onClick(e){e.button||this.handleEvent("click",e.target,e)}onKeyDown(e){"Enter"===e.key&&this.handleEvent("enter",e.target,e),"Tab"===e.key&&this.handleEvent("tab",e.target,e)}onMouseDown(e){e.button||this.handleEvent("mousedown",e.target,e)}onFocus(e){this.handleEvent("focus",e.target,e)}onBlur(e){this.handleEvent("blur",e.relatedTarget,e)}onEsc(e){this.handleEvent("esckey",e.target,e)}onContextMenu(e){const t=this.isShown();(this.isShowTrigger("contextmenu")&&!t||this.isHideTrigger("contextmenu")&&t)&&e.preventDefault(),this.handleEvent("contextmenu",e.target,e)}onClickOutside(e){const{onClickOutside:t}=this.props;this.handleEvent("clickoutside",e.target,e),t(e)}onDialogEnter(e){const{showOnDialogEnter:t}=this.props;t&&this.showDialogIfNeeded(e,"DialogEnter")}onDialogLeave(e){const{showOnDialogEnter:t}=this.props;t&&this.hideDialogIfNeeded(e,"DialogLeave")}onContentClick(e){const{onContentClick:t}=this.props;this.handleEvent("onContentClick",e.target,e),t(e)}render(){const{wrapperClassName:i,content:a,startingEdge:d,children:u,preventAnimationOnMount:g,animationType:w,position:E,showDelay:C,moveBy:v,modifiers:S,tooltip:M,tooltipClassName:k,referenceWrapperClassName:x,referenceWrapperElement:H,zIndex:R,hideWhenReferenceHidden:N,disableContainerScroll:L,containerSelector:A,observeContentResize:I,enableNestedDialogLayer:B,id:F,"data-testid":K}=this.props,{preventAnimation:P}=this.state,j=K||c(p.DIALOG,F),z=g||P?void 0:w,U=h(a)?a():a;return U?t.createElement(n,null,t.createElement(s,null,(({ref:i})=>t.createElement(f,{className:e(x),wrapperElement:H,ref:i,onBlur:O("onBlur",this,this.props),onKeyDown:O("onKeyDown",this,this.props),onClick:O("onClick",this,this.props),onFocus:O("onFocus",this,this.props),onMouseDown:O("onMouseDown",this,this.props),onMouseEnter:O("onMouseEnter",this,this.props),onMouseLeave:O("onMouseLeave",this,this.props),onContextMenu:O("onContextMenu",this,this.props)},u))),l()&&o(t.createElement(r,{placement:E,modifiers:[{name:"offset",options:{offset:[v.secondary,v.main]}},{name:"zIndex",enabled:!0,phase:"write",fn:({state:e})=>(R&&(e.styles.popper.zIndex=R+""),e)},{name:"rotator",enabled:!0,phase:"write",fn:({state:e})=>e.styles.arrow?(e.styles.arrow.transform=e.styles.arrow.transform+" rotate(45deg)",e):e},b(I),...S]},(({placement:o,style:n,ref:s,arrowProps:r,isReferenceHidden:h})=>{if(!this.isShown()&&o)return null;if(N&&h){const e=new CustomEvent("onReferenceHidden");this.hideDialog(e,"onReferenceHidden")}const a=m([s,this.containerRef]),l=t.createElement(D,{"data-testid":j,isReferenceHidden:N&&h,onMouseEnter:this.onDialogEnter,onMouseLeave:this.onDialogLeave,onClickOutside:this.onClickOutside,onContextMenu:this.onContextMenu,onEsc:this.onEsc,animationType:z,position:o,wrapperClassName:i,startingEdge:d,isOpen:this.isShown(),showDelay:C,styleObject:n,ref:a,onClick:this.onContentClick,hasTooltip:!!M,containerSelector:A,disableContainerScroll:L},U,M&&t.createElement("div",{style:r.style,ref:r.ref,className:e(T.arrow,k),"data-placement":o}));return B?t.createElement(y,{layerRef:this.containerRef},l):l})),this.getContainer())):u}}function O(e,t,i){return g([i[e],t[e]],!0)}S.hideShowTriggers=w,S.positions=E,S.animationTypes=C,S.defaultProps={position:"top",modifiers:[],moveBy:{main:0,secondary:0},showDelay:100,hideDelay:100,showTrigger:S.hideShowTriggers.MOUSE_ENTER,hideTrigger:S.hideShowTriggers.MOUSE_LEAVE,showOnDialogEnter:!1,shouldShowOnMount:!1,disable:!1,open:!1,animationType:S.animationTypes.EXPAND,preventAnimationOnMount:!1,tooltip:!1,onDialogDidShow:a,onDialogDidHide:a,onClickOutside:a,onContentClick:a,useDerivedStateFromProps:!1,hideWhenReferenceHidden:!1,shouldCallbackOnMount:!1,instantShowAndHide:!1,addKeyboardHideShowTriggersByDefault:!1,observeContentResize:!1,enableNestedDialogLayer:!1},S.contextType=v;export{S 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, { PureComponent, type ReactElement } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Manager, type Modifier, Popper, Reference } from \"react-popper\";\nimport { isFunction } from \"es-toolkit\";\nimport {\n chainFunctions,\n chainRefFunctions,\n convertToArray,\n NOOP,\n isInsideClass,\n type VibeComponentProps,\n ComponentDefaultTestId,\n getTestId,\n isClient\n} from \"@vibe/shared\";\nimport DialogContent from \"./DialogContent/DialogContent\";\nimport { Refable } from \"../Refable/Refable\";\nimport {\n AnimationType as AnimationTypeEnum,\n HideShowEvent as DialogTriggerEventEnum,\n DialogPosition as DialogPositionEnum\n} from \"./DialogConstants\";\nimport type * as PopperJS from \"@popperjs/core\";\nimport styles from \"./Dialog.module.scss\";\nimport {\n type DialogAnimationType,\n type DialogPosition,\n type DialogTriggerEvent,\n type DialogEvent\n} from \"./Dialog.types\";\nimport { LayerContext, LayerProvider } from \"@vibe/layer\";\nimport { createObserveContentResizeModifier } from \"./modifiers/observeContentResizeModifier\";\n\nexport interface DialogProps extends VibeComponentProps {\n /**\n * Class name applied to the reference wrapper element.\n */\n referenceWrapperClassName?: string;\n /**\n * The wrapper element type to use for React components. Defaults to \"span\".\n */\n referenceWrapperElement?: \"span\" | \"div\";\n /**\n * The placement of the dialog relative to the reference element.\n */\n position?: DialogPosition;\n /**\n * Custom Popper.js modifiers.\n * https://popper.js.org/docs/v2/modifiers/\n */\n modifiers?: Modifier<any>[];\n /**\n * The starting edge of the dialog.\n */\n startingEdge?: string;\n /**\n * Offset values for positioning adjustments.\n * `main` - horizontal offset\n * `secondary` - vertical offset\n */\n moveBy?: { main?: number; secondary?: number };\n /**\n * Delay in milliseconds before showing the dialog.\n */\n showDelay?: number;\n /**\n * Delay in milliseconds before hiding the dialog.\n */\n hideDelay?: number;\n /**\n * Events that trigger showing the dialog.\n */\n showTrigger?: DialogTriggerEvent | DialogTriggerEvent[];\n /**\n * Events that trigger hiding the dialog.\n */\n hideTrigger?: DialogTriggerEvent | DialogTriggerEvent[];\n /**\n * If true, prevents closing the dialog when the mouse enters it.\n */\n showOnDialogEnter?: boolean;\n /**\n * If true, shows the dialog when the component mounts.\n */\n shouldShowOnMount?: boolean;\n /**\n * If true, disables opening the dialog.\n */\n disable?: boolean;\n /**\n * Controls the open state of the dialog.\n */\n open?: boolean;\n /**\n * Derived state control for managing dialog visibility.\n */\n isOpen?: boolean;\n /**\n * Classes that prevent showing the dialog when present.\n */\n showTriggerIgnoreClass?: string | Array<string>;\n /**\n * Classes that prevent hiding the dialog when present.\n */\n hideTriggerIgnoreClass?: string | Array<string>;\n /**\n * The animation type used for the dialog.\n */\n animationType?: DialogAnimationType;\n /**\n * Class name applied to the dialog content container.\n */\n wrapperClassName?: string;\n /**\n * If true, prevents animation when mounting.\n */\n preventAnimationOnMount?: boolean;\n /**\n * The CSS selector of the container where the dialog is rendered.\n */\n containerSelector?: string;\n /**\n * If true, positions the tooltip element.\n */\n tooltip?: boolean;\n /**\n * Class name applied to the tooltip element.\n */\n tooltipClassName?: string;\n /**\n * Callback fired when the dialog is shown.\n */\n onDialogDidShow?: (event?: DialogEvent, eventName?: DialogTriggerEvent | string) => void;\n /**\n * Callback fired when the dialog is hidden.\n */\n onDialogDidHide?: (event: DialogEvent, eventName: DialogTriggerEvent | string) => void;\n /**\n * Callback fired when clicking outside the dialog.\n */\n onClickOutside?: (event: React.MouseEvent) => void;\n /**\n * Callback fired when clicking inside the dialog content.\n */\n onContentClick?: (event: React.MouseEvent) => void;\n /**\n * The z-index applied to the dialog.\n */\n zIndex?: number;\n /**\n * If true, uses derived state from props.\n */\n useDerivedStateFromProps?: boolean;\n /**\n * If true, makes the dialog disappear when the reference element is hidden.\n */\n hideWhenReferenceHidden?: boolean;\n /**\n * If true, triggers the callback when the dialog mounts.\n */\n shouldCallbackOnMount?: boolean;\n /**\n * If true, instantly shows and hides the dialog without delay.\n */\n instantShowAndHide?: boolean;\n /**\n * Callback to dynamically adjust show delay and animation behavior.\n */\n getDynamicShowDelay?: () => { showDelay: number; preventAnimation: boolean };\n /**\n * The content displayed inside the dialog.\n */\n content?: (() => JSX.Element) | JSX.Element;\n /**\n * The element to position the dialog beside.\n */\n children?: ReactElement | ReactElement[] | string;\n /**\n * If true, keyboard focus/blur events behave like mouse enter/leave.\n */\n addKeyboardHideShowTriggersByDefault?: boolean;\n /**\n * If true, disables scrolling for the container element.\n */\n disableContainerScroll?: boolean | string;\n /**\n * Enables the observation of content resize for the popper element.\n * When set to `true`, a ResizeObserver is attached to the popper content,\n * automatically triggering repositioning when the size of the content changes.\n *\n * This is useful for dialogs, tooltips, or popovers with dynamic content\n * that may grow or shrink without a re-render being triggered.\n */\n observeContentResize?: boolean;\n /**\n * If true, provides a LayerProvider context for nested dialogs to render correctly.\n * This is useful when you have components that use Dialog internally (like Dropdown)\n * inside another Dialog, ensuring proper z-index stacking and click-outside behavior.\n */\n enableNestedDialogLayer?: boolean;\n}\n\nexport interface DialogState {\n /**\n * If true, the dialog is open.\n */\n isOpen?: boolean;\n /**\n * If true, the dialog state is derived from props.\n */\n shouldUseDerivedStateFromProps?: boolean;\n /**\n * If true, prevents animation when opening or closing the dialog.\n */\n preventAnimation?: boolean;\n}\n\nexport default class Dialog extends PureComponent<DialogProps, DialogState> {\n static hideShowTriggers = DialogTriggerEventEnum;\n static positions = DialogPositionEnum;\n static animationTypes = AnimationTypeEnum;\n static defaultProps = {\n position: \"top\",\n modifiers: [] as Modifier<any>[],\n moveBy: { main: 0, secondary: 0 },\n showDelay: 100,\n hideDelay: 100,\n showTrigger: Dialog.hideShowTriggers.MOUSE_ENTER,\n hideTrigger: Dialog.hideShowTriggers.MOUSE_LEAVE,\n showOnDialogEnter: false,\n shouldShowOnMount: false,\n disable: false,\n open: false,\n animationType: Dialog.animationTypes.EXPAND,\n preventAnimationOnMount: false,\n tooltip: false,\n onDialogDidShow: NOOP,\n onDialogDidHide: NOOP,\n onClickOutside: NOOP,\n onContentClick: NOOP,\n useDerivedStateFromProps: false,\n hideWhenReferenceHidden: false,\n shouldCallbackOnMount: false,\n instantShowAndHide: false,\n addKeyboardHideShowTriggersByDefault: false,\n observeContentResize: false,\n enableNestedDialogLayer: false\n };\n private showTimeout: NodeJS.Timeout;\n private hideTimeout: NodeJS.Timeout;\n private containerRef: React.RefObject<HTMLDivElement>;\n context!: React.ContextType<typeof LayerContext>;\n\n constructor(props: DialogProps) {\n super(props);\n this.state = {\n shouldUseDerivedStateFromProps: props.useDerivedStateFromProps,\n isOpen: props.shouldShowOnMount\n };\n\n this.containerRef = React.createRef<HTMLDivElement>();\n\n // Binding section.\n this.onMouseEnter = this.onMouseEnter.bind(this);\n this.onMouseLeave = this.onMouseLeave.bind(this);\n this.onMouseDown = this.onMouseDown.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.isShown = this.isShown.bind(this);\n this.onEsc = this.onEsc.bind(this);\n this.onClickOutside = this.onClickOutside.bind(this);\n this.onDialogEnter = this.onDialogEnter.bind(this);\n this.onDialogLeave = this.onDialogLeave.bind(this);\n this.getContainer = this.getContainer.bind(this);\n this.onContentClick = this.onContentClick.bind(this);\n this.onKeyDown = this.onKeyDown.bind(this);\n this.closeDialogOnEscape = this.closeDialogOnEscape.bind(this);\n this.onContextMenu = this.onContextMenu.bind(this);\n this.getDefaultContainer = this.getDefaultContainer.bind(this);\n\n // Timeouts\n this.hideTimeout = null;\n this.showTimeout = null;\n }\n\n closeDialogOnEscape(event: KeyboardEvent) {\n const { isOpen } = this.state;\n if (!isOpen) {\n return;\n }\n switch (event.key) {\n case \"Escape\":\n this.hideDialogIfNeeded(event, DialogTriggerEventEnum.ESCAPE_KEY);\n break;\n case \"Tab\":\n this.handleEvent(DialogTriggerEventEnum.TAB_KEY, event.target, event);\n break;\n case \"Enter\":\n this.handleEvent(DialogTriggerEventEnum.ENTER, event.target, event);\n break;\n default:\n break;\n }\n }\n\n componentDidMount() {\n const { shouldCallbackOnMount, onDialogDidShow } = this.props;\n const { isOpen } = this.state;\n if (isClient()) {\n document.addEventListener(\"keyup\", this.closeDialogOnEscape);\n }\n if (shouldCallbackOnMount && isOpen) {\n onDialogDidShow && onDialogDidShow();\n }\n }\n\n componentWillUnmount() {\n if (isClient()) {\n document.removeEventListener(\"keyup\", this.closeDialogOnEscape);\n }\n if (this.showTimeout) {\n clearTimeout(this.showTimeout);\n this.showTimeout = null;\n }\n if (this.hideTimeout) {\n clearTimeout(this.hideTimeout);\n this.hideTimeout = null;\n }\n }\n\n static getDerivedStateFromProps(nextProps: DialogProps, state: DialogState): DialogState {\n if (state.shouldUseDerivedStateFromProps) {\n return { isOpen: nextProps.isOpen };\n }\n return null;\n }\n\n getDefaultContainer() {\n const { layerRef } = this.context;\n if (layerRef?.current) {\n return layerRef.current;\n }\n return document.body;\n }\n\n getContainer() {\n const { containerSelector } = this.props;\n if (!containerSelector) {\n return this.getDefaultContainer();\n }\n\n const containerElement = document.querySelector(containerSelector);\n if (!containerElement || !(containerElement instanceof Element)) {\n return this.getDefaultContainer();\n }\n return containerElement;\n }\n\n showDialog(event: DialogEvent, eventName: DialogTriggerEvent | string, options: { preventAnimation?: boolean } = {}) {\n const { showDelay, instantShowAndHide, getDynamicShowDelay } = this.props;\n let finalShowDelay = showDelay;\n let preventAnimation = options.preventAnimation;\n if (getDynamicShowDelay) {\n const dynamicDelayObj = getDynamicShowDelay();\n finalShowDelay = dynamicDelayObj.showDelay || 0;\n preventAnimation = preventAnimation || dynamicDelayObj.preventAnimation;\n }\n\n if (instantShowAndHide) {\n this.onShowDialog(event, eventName);\n this.setState({ isOpen: true, preventAnimation });\n this.showTimeout = null;\n } else {\n this.showTimeout = setTimeout(() => {\n this.onShowDialog(event, eventName);\n this.showTimeout = null;\n this.setState({ isOpen: true, preventAnimation });\n }, finalShowDelay);\n }\n }\n\n onShowDialog(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n if (this.isShown()) return;\n const { onDialogDidShow } = this.props;\n onDialogDidShow(event, eventName);\n }\n\n showDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string, options = {}) {\n const { disable } = this.props;\n if (disable) {\n return;\n }\n\n if (this.hideTimeout) {\n clearTimeout(this.hideTimeout);\n this.hideTimeout = null;\n }\n\n if (!this.showTimeout) {\n this.showDialog(event, eventName, options);\n }\n }\n\n hideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n const { hideDelay, instantShowAndHide } = this.props;\n if (instantShowAndHide) {\n this.onHideDialog(event, eventName);\n this.setState({ isOpen: false });\n this.hideTimeout = null;\n } else {\n this.hideTimeout = setTimeout(() => {\n this.onHideDialog(event, eventName);\n this.setState({ isOpen: false });\n this.hideTimeout = null;\n }, hideDelay);\n }\n }\n\n onHideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n const { onDialogDidHide } = this.props;\n if (onDialogDidHide) onDialogDidHide(event, eventName);\n }\n\n hideDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string) {\n if (this.showTimeout) {\n clearTimeout(this.showTimeout);\n this.showTimeout = null;\n }\n\n if (this.hideTimeout) {\n return;\n }\n this.hideDialog(event, eventName);\n }\n\n handleEvent(eventName: DialogTriggerEvent, target: EventTarget, event: DialogEvent) {\n const { showTriggerIgnoreClass, hideTriggerIgnoreClass } = this.props;\n if (\n this.isShowTrigger(eventName) &&\n !this.isShown() &&\n !isInsideClass(target as HTMLElement, showTriggerIgnoreClass)\n ) {\n return this.showDialogIfNeeded(event, eventName);\n }\n\n if (this.isHideTrigger(eventName) && !isInsideClass(target as HTMLElement, hideTriggerIgnoreClass)) {\n return this.hideDialogIfNeeded(event, eventName);\n }\n }\n\n isShown() {\n const { isOpen } = this.state;\n const { open } = this.props;\n\n return isOpen || open;\n }\n\n isShowTrigger(eventName: DialogTriggerEvent) {\n const { showTrigger, addKeyboardHideShowTriggersByDefault } = this.props;\n const showTriggersArray = convertToArray(showTrigger);\n\n if (addKeyboardHideShowTriggersByDefault) {\n if (eventName === \"focus\" && showTriggersArray.indexOf(\"mouseenter\") > -1) {\n return true;\n }\n }\n\n return showTriggersArray.indexOf(eventName) > -1;\n }\n\n isHideTrigger(eventName: DialogTriggerEvent) {\n const { hideTrigger, addKeyboardHideShowTriggersByDefault } = this.props;\n const hideTriggersArray = convertToArray(hideTrigger);\n\n if (addKeyboardHideShowTriggersByDefault) {\n if (eventName === \"blur\" && hideTriggersArray.indexOf(\"mouseleave\") > -1) {\n return true;\n }\n }\n\n return hideTriggersArray.indexOf(eventName) > -1;\n }\n\n onMouseEnter(e: React.MouseEvent) {\n this.handleEvent(\"mouseenter\", e.target, e);\n }\n\n onMouseLeave(e: React.MouseEvent) {\n this.handleEvent(\"mouseleave\", e.target, e);\n }\n\n onClick(e: React.MouseEvent) {\n if (e.button) return;\n this.handleEvent(\"click\", e.target, e);\n }\n\n onKeyDown(event: React.KeyboardEvent) {\n if (event.key === \"Enter\") {\n this.handleEvent(\"enter\", event.target, event);\n }\n\n if (event.key === \"Tab\") {\n this.handleEvent(\"tab\", event.target, event);\n }\n }\n\n onMouseDown(e: React.MouseEvent) {\n if (e.button) return;\n this.handleEvent(\"mousedown\", e.target, e);\n }\n\n onFocus(e: React.FocusEvent) {\n this.handleEvent(\"focus\", e.target, e);\n }\n\n onBlur(e: React.FocusEvent) {\n this.handleEvent(\"blur\", e.relatedTarget, e);\n }\n\n onEsc(e: React.KeyboardEvent) {\n this.handleEvent(\"esckey\", e.target, e);\n }\n\n onContextMenu(e: React.MouseEvent) {\n const isShown = this.isShown();\n if ((this.isShowTrigger(\"contextmenu\") && !isShown) || (this.isHideTrigger(\"contextmenu\") && isShown)) {\n e.preventDefault();\n }\n this.handleEvent(\"contextmenu\", e.target, e);\n }\n\n onClickOutside(event: React.MouseEvent) {\n const { onClickOutside } = this.props;\n this.handleEvent(\"clickoutside\", event.target, event);\n onClickOutside(event);\n }\n\n onDialogEnter(event: React.MouseEvent) {\n const { showOnDialogEnter } = this.props;\n if (showOnDialogEnter) this.showDialogIfNeeded(event, \"DialogEnter\");\n }\n\n onDialogLeave(event: React.MouseEvent) {\n const { showOnDialogEnter } = this.props;\n if (showOnDialogEnter) this.hideDialogIfNeeded(event, \"DialogLeave\");\n }\n\n onContentClick(e: React.MouseEvent) {\n const { onContentClick } = this.props;\n this.handleEvent(\"onContentClick\", e.target, e);\n onContentClick(e);\n }\n\n render() {\n const {\n wrapperClassName,\n content,\n startingEdge,\n children,\n preventAnimationOnMount,\n animationType,\n position,\n showDelay,\n moveBy,\n modifiers,\n tooltip,\n tooltipClassName,\n referenceWrapperClassName,\n referenceWrapperElement,\n zIndex,\n hideWhenReferenceHidden,\n disableContainerScroll,\n containerSelector,\n observeContentResize,\n enableNestedDialogLayer,\n id,\n \"data-testid\": dataTestId\n } = this.props;\n const { preventAnimation } = this.state;\n const overrideDataTestId = dataTestId || getTestId(ComponentDefaultTestId.DIALOG, id);\n\n const animationTypeCalculated = preventAnimationOnMount || preventAnimation ? undefined : animationType;\n const contentRendered = isFunction(content) ? content() : content;\n\n if (!contentRendered) {\n return children;\n }\n return (\n <Manager>\n <Reference>\n {({ ref }) => {\n return (\n <Refable\n className={cx(referenceWrapperClassName)}\n wrapperElement={referenceWrapperElement}\n ref={ref}\n onBlur={chainOnPropsAndInstance(\"onBlur\", this, this.props)}\n onKeyDown={chainOnPropsAndInstance(\"onKeyDown\", this, this.props)}\n onClick={chainOnPropsAndInstance(\"onClick\", this, this.props)}\n onFocus={chainOnPropsAndInstance(\"onFocus\", this, this.props)}\n onMouseDown={chainOnPropsAndInstance(\"onMouseDown\", this, this.props)}\n onMouseEnter={chainOnPropsAndInstance(\"onMouseEnter\", this, this.props)}\n onMouseLeave={chainOnPropsAndInstance(\"onMouseLeave\", this, this.props)}\n onContextMenu={chainOnPropsAndInstance(\"onContextMenu\", this, this.props)}\n >\n {children}\n </Refable>\n );\n }}\n </Reference>\n {isClient() &&\n createPortal(\n <Popper\n placement={position as unknown as PopperJS.Placement}\n modifiers={[\n {\n name: \"offset\",\n options: {\n offset: [moveBy.secondary, moveBy.main]\n }\n },\n {\n name: \"zIndex\",\n enabled: true,\n phase: \"write\",\n fn({ state }) {\n if (zIndex) {\n state.styles.popper.zIndex = String(zIndex);\n }\n return state;\n }\n },\n {\n name: \"rotator\",\n enabled: true,\n phase: \"write\",\n fn({ state }) {\n if (!state.styles.arrow) {\n return state;\n }\n // const reg = new RegExp(\n // /translate\\(([0-9].*)px, ([0-9].*)px\\)/\n // );\n // const transform = state.styles.arrow.transform;\n // const res = reg.exec(transform);\n // state.styles.popper.transformOrigin = `${100 -\n // res[1]}% ${100 - res[2]}%`;\n state.styles.arrow.transform = `${state.styles.arrow.transform} rotate(45deg)`;\n return state;\n }\n },\n createObserveContentResizeModifier(observeContentResize),\n ...modifiers\n ]}\n >\n {({ placement, style, ref, arrowProps, isReferenceHidden }) => {\n if (!this.isShown() && placement) {\n return null;\n }\n\n if (hideWhenReferenceHidden && isReferenceHidden) {\n const event = new CustomEvent(\"onReferenceHidden\");\n this.hideDialog(event, \"onReferenceHidden\");\n }\n\n const mergedRef = chainRefFunctions([ref, this.containerRef]);\n\n const dialogContent = (\n <DialogContent\n data-testid={overrideDataTestId}\n isReferenceHidden={hideWhenReferenceHidden && isReferenceHidden}\n onMouseEnter={this.onDialogEnter}\n onMouseLeave={this.onDialogLeave}\n onClickOutside={this.onClickOutside}\n onContextMenu={this.onContextMenu}\n onEsc={this.onEsc}\n animationType={animationTypeCalculated}\n position={placement}\n wrapperClassName={wrapperClassName}\n startingEdge={startingEdge}\n isOpen={this.isShown()}\n showDelay={showDelay}\n styleObject={style}\n ref={mergedRef}\n onClick={this.onContentClick}\n hasTooltip={!!tooltip}\n containerSelector={containerSelector}\n disableContainerScroll={disableContainerScroll}\n >\n {contentRendered}\n {tooltip && (\n <div\n style={arrowProps.style}\n ref={arrowProps.ref}\n className={cx(styles.arrow, tooltipClassName)}\n data-placement={placement}\n />\n )}\n </DialogContent>\n );\n\n return enableNestedDialogLayer ? (\n <LayerProvider layerRef={this.containerRef}>{dialogContent}</LayerProvider>\n ) : (\n dialogContent\n );\n }}\n </Popper>,\n this.getContainer()\n )}\n </Manager>\n );\n }\n}\n\nfunction chainOnPropsAndInstance(name: string, instance: Dialog, props: DialogProps) {\n // @ts-ignore\n return chainFunctions([props[name], instance[name]], true);\n}\n\nDialog.contextType = LayerContext;\n"],"names":["Dialog","PureComponent","constructor","props","super","this","state","shouldUseDerivedStateFromProps","useDerivedStateFromProps","isOpen","shouldShowOnMount","containerRef","React","createRef","onMouseEnter","bind","onMouseLeave","onMouseDown","onClick","onFocus","onBlur","isShown","onEsc","onClickOutside","onDialogEnter","onDialogLeave","getContainer","onContentClick","onKeyDown","closeDialogOnEscape","onContextMenu","getDefaultContainer","hideTimeout","showTimeout","event","key","hideDialogIfNeeded","DialogTriggerEventEnum","ESCAPE_KEY","handleEvent","TAB_KEY","target","ENTER","componentDidMount","shouldCallbackOnMount","onDialogDidShow","isClient","document","addEventListener","componentWillUnmount","removeEventListener","clearTimeout","getDerivedStateFromProps","nextProps","layerRef","context","current","body","containerSelector","containerElement","querySelector","Element","showDialog","eventName","options","showDelay","instantShowAndHide","getDynamicShowDelay","finalShowDelay","preventAnimation","dynamicDelayObj","onShowDialog","setState","setTimeout","showDialogIfNeeded","disable","hideDialog","hideDelay","onHideDialog","onDialogDidHide","showTriggerIgnoreClass","hideTriggerIgnoreClass","isShowTrigger","isInsideClass","isHideTrigger","open","showTrigger","addKeyboardHideShowTriggersByDefault","showTriggersArray","convertToArray","indexOf","hideTrigger","hideTriggersArray","e","button","relatedTarget","preventDefault","showOnDialogEnter","render","wrapperClassName","content","startingEdge","children","preventAnimationOnMount","animationType","position","moveBy","modifiers","tooltip","tooltipClassName","referenceWrapperClassName","referenceWrapperElement","zIndex","hideWhenReferenceHidden","disableContainerScroll","observeContentResize","enableNestedDialogLayer","id","dataTestId","overrideDataTestId","getTestId","ComponentDefaultTestId","DIALOG","animationTypeCalculated","undefined","contentRendered","isFunction","Manager","createElement","Reference","ref","Refable","className","cx","wrapperElement","chainOnPropsAndInstance","createPortal","Popper","placement","name","offset","secondary","main","enabled","phase","fn","styles","popper","String","arrow","transform","createObserveContentResizeModifier","style","arrowProps","isReferenceHidden","CustomEvent","mergedRef","chainRefFunctions","dialogContent","DialogContent","styleObject","hasTooltip","LayerProvider","instance","chainFunctions","hideShowTriggers","positions","DialogPositionEnum","animationTypes","AnimationTypeEnum","defaultProps","MOUSE_ENTER","MOUSE_LEAVE","EXPAND","NOOP","contextType","LayerContext"],"mappings":"uwBA0NqB,MAAAA,UAAeC,EAoClCC,WAAAA,CAAYC,GACVC,MAAMD,GACNE,KAAKC,MAAQ,CACXC,+BAAgCJ,EAAMK,yBACtCC,OAAQN,EAAMO,mBAGhBL,KAAKM,aAAeC,EAAMC,YAG1BR,KAAKS,aAAeT,KAAKS,aAAaC,KAAKV,MAC3CA,KAAKW,aAAeX,KAAKW,aAAaD,KAAKV,MAC3CA,KAAKY,YAAcZ,KAA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AChBtK,0BAA0B,EAC1ByG,yBAAyB,EACzBrE,uBAAuB,EACvBsB,oBAAoB,EACpBqB,sCAAsC,EACtC4B,sBAAsB,EACtBC,yBAAyB,GA2d7BpH,EAAO+K,YAAcC"}
@@ -0,0 +1,2 @@
1
+ var a={arrow:"arrow"};!function(a){const e="s_id-3fb64cda561a_3_0_0";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 {\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[data-placement*=right], .black-app-theme .arrow[data-placement*=right], .hacker-app-theme .arrow[data-placement*=right] {\n box-shadow: -1px 1px 0px 0px var(--layout-border-color);\n}\n.dark-app-theme .arrow[data-placement*=left], .black-app-theme .arrow[data-placement*=left], .hacker-app-theme .arrow[data-placement*=left] {\n box-shadow: 1px -1px 0px 0px var(--layout-border-color);\n}\n.dark-app-theme .arrow[data-placement*=bottom], .black-app-theme .arrow[data-placement*=bottom], .hacker-app-theme .arrow[data-placement*=bottom] {\n box-shadow: -1px -1px 0px 0px var(--layout-border-color);\n}\n.dark-app-theme .arrow[data-placement*=top], .black-app-theme .arrow[data-placement*=top], .hacker-app-theme .arrow[data-placement*=top] {\n box-shadow: 1px 1px 0px 0px var(--layout-border-color);\n}\n.arrow[data-placement*=bottom] {\n top: 1px;\n}\n.arrow[data-placement*=top] {\n bottom: 1px;\n}\n.arrow[data-placement*=left] {\n right: 1px;\n}\n.arrow[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,11 @@
1
+ /// <reference types="react" />
2
+ export type DialogType = "modal" | "popover";
3
+ export type DialogSize = "none" | "small" | "medium" | "large";
4
+ export type DialogPosition = "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end" | "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end";
5
+ export type DialogTriggerEvent = "click" | "clickoutside" | "esckey" | "tab" | "mouseenter" | "mouseleave" | "enter" | "mousedown" | "focus" | "blur" | "onContentClick" | "contextmenu";
6
+ export type DialogAnimationType = "opacity-and-slide" | "expand";
7
+ export type DialogOffset = {
8
+ main?: number;
9
+ secondary?: number;
10
+ };
11
+ export type DialogEvent = React.MouseEvent | React.KeyboardEvent | KeyboardEvent | React.FocusEvent | CustomEvent;