@activecollab/components 2.0.434 → 2.0.436

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 (92) hide show
  1. package/dist/cjs/components/ConfirmDialog/ConfirmDialog.js +6 -5
  2. package/dist/cjs/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
  3. package/dist/cjs/components/Dialog/Dialog.js +65 -43
  4. package/dist/cjs/components/Dialog/Dialog.js.map +1 -1
  5. package/dist/cjs/components/Dialog/DialogActions.js +13 -5
  6. package/dist/cjs/components/Dialog/DialogActions.js.map +1 -1
  7. package/dist/cjs/components/Dialog/DialogContent.js +4 -5
  8. package/dist/cjs/components/Dialog/DialogContent.js.map +1 -1
  9. package/dist/cjs/components/Dialog/DialogContext.js +14 -7
  10. package/dist/cjs/components/Dialog/DialogContext.js.map +1 -1
  11. package/dist/cjs/components/Dialog/DialogTitle.js +19 -5
  12. package/dist/cjs/components/Dialog/DialogTitle.js.map +1 -1
  13. package/dist/cjs/components/Dialog/Styles.js +55 -13
  14. package/dist/cjs/components/Dialog/Styles.js.map +1 -1
  15. package/dist/cjs/components/Dialog/index.js +11 -0
  16. package/dist/cjs/components/Dialog/index.js.map +1 -1
  17. package/dist/cjs/components/Modal/Modal.js +3 -2
  18. package/dist/cjs/components/Modal/Modal.js.map +1 -1
  19. package/dist/cjs/components/Popper/Popper.js +4 -3
  20. package/dist/cjs/components/Popper/Popper.js.map +1 -1
  21. package/dist/cjs/components/Tooltip/Tooltip.js +3 -1
  22. package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
  23. package/dist/cjs/components/Transitions/Fade/Fade.js +11 -2
  24. package/dist/cjs/components/Transitions/Fade/Fade.js.map +1 -1
  25. package/dist/cjs/components/Transitions/SlideFromTop/SlideFromTop.js +46 -30
  26. package/dist/cjs/components/Transitions/SlideFromTop/SlideFromTop.js.map +1 -1
  27. package/dist/cjs/components/Wizard/Step.js +4 -1
  28. package/dist/cjs/components/Wizard/Step.js.map +1 -1
  29. package/dist/cjs/components/Wizard/Wizard.js +14 -2
  30. package/dist/cjs/components/Wizard/Wizard.js.map +1 -1
  31. package/dist/esm/components/ConfirmDialog/ConfirmDialog.d.ts +3 -0
  32. package/dist/esm/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
  33. package/dist/esm/components/ConfirmDialog/ConfirmDialog.js +6 -5
  34. package/dist/esm/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
  35. package/dist/esm/components/Dialog/Dialog.d.ts +7 -2
  36. package/dist/esm/components/Dialog/Dialog.d.ts.map +1 -1
  37. package/dist/esm/components/Dialog/Dialog.js +65 -48
  38. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  39. package/dist/esm/components/Dialog/DialogActions.d.ts.map +1 -1
  40. package/dist/esm/components/Dialog/DialogActions.js +10 -5
  41. package/dist/esm/components/Dialog/DialogActions.js.map +1 -1
  42. package/dist/esm/components/Dialog/DialogContent.d.ts +5 -1
  43. package/dist/esm/components/Dialog/DialogContent.d.ts.map +1 -1
  44. package/dist/esm/components/Dialog/DialogContent.js +4 -5
  45. package/dist/esm/components/Dialog/DialogContent.js.map +1 -1
  46. package/dist/esm/components/Dialog/DialogContext.d.ts +11 -1
  47. package/dist/esm/components/Dialog/DialogContext.d.ts.map +1 -1
  48. package/dist/esm/components/Dialog/DialogContext.js +10 -8
  49. package/dist/esm/components/Dialog/DialogContext.js.map +1 -1
  50. package/dist/esm/components/Dialog/DialogTitle.d.ts +4 -1
  51. package/dist/esm/components/Dialog/DialogTitle.d.ts.map +1 -1
  52. package/dist/esm/components/Dialog/DialogTitle.js +20 -6
  53. package/dist/esm/components/Dialog/DialogTitle.js.map +1 -1
  54. package/dist/esm/components/Dialog/Styles.d.ts +19 -2
  55. package/dist/esm/components/Dialog/Styles.d.ts.map +1 -1
  56. package/dist/esm/components/Dialog/Styles.js +47 -11
  57. package/dist/esm/components/Dialog/Styles.js.map +1 -1
  58. package/dist/esm/components/Dialog/index.d.ts +1 -0
  59. package/dist/esm/components/Dialog/index.d.ts.map +1 -1
  60. package/dist/esm/components/Dialog/index.js +1 -0
  61. package/dist/esm/components/Dialog/index.js.map +1 -1
  62. package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
  63. package/dist/esm/components/Modal/Modal.js +3 -2
  64. package/dist/esm/components/Modal/Modal.js.map +1 -1
  65. package/dist/esm/components/Popper/Popper.d.ts +6 -1
  66. package/dist/esm/components/Popper/Popper.d.ts.map +1 -1
  67. package/dist/esm/components/Popper/Popper.js +4 -3
  68. package/dist/esm/components/Popper/Popper.js.map +1 -1
  69. package/dist/esm/components/Tooltip/Tooltip.d.ts +3 -1
  70. package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
  71. package/dist/esm/components/Tooltip/Tooltip.js +3 -1
  72. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  73. package/dist/esm/components/Transitions/Fade/Fade.d.ts.map +1 -1
  74. package/dist/esm/components/Transitions/Fade/Fade.js +11 -2
  75. package/dist/esm/components/Transitions/Fade/Fade.js.map +1 -1
  76. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.d.ts +2 -0
  77. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.d.ts.map +1 -1
  78. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.js +46 -30
  79. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.js.map +1 -1
  80. package/dist/esm/components/Wizard/Step.d.ts +4 -0
  81. package/dist/esm/components/Wizard/Step.d.ts.map +1 -1
  82. package/dist/esm/components/Wizard/Step.js +4 -1
  83. package/dist/esm/components/Wizard/Step.js.map +1 -1
  84. package/dist/esm/components/Wizard/Wizard.d.ts +3 -0
  85. package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
  86. package/dist/esm/components/Wizard/Wizard.js +14 -2
  87. package/dist/esm/components/Wizard/Wizard.js.map +1 -1
  88. package/dist/index.js +264 -120
  89. package/dist/index.js.map +1 -1
  90. package/dist/index.min.js +1 -1
  91. package/dist/index.min.js.map +1 -1
  92. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","names":["React","forwardRef","classnames","DialogActions","DialogContent","DialogContentDivider","DialogTitle","StyledDialog","Modal","Fade","SlideFromTop","_Dialog","_ref","ref","children","_ref$open","open","onClose","className","_ref$enableBackground","enableBackgroundClick","_ref$disableCloseOnEs","disableCloseOnEsc","_ref$animate","animate","onClickOutside","rest","_objectWithoutPropertiesLoose","_excluded","animateDialog","createElement","in","_extends","disableBackgroundClick","displayName","Dialog","Object","assign","Title","Content","ContentDivider","Actions"],"sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes, PropsWithChildren } from \"react\";\n\nimport classnames from \"classnames\";\n\n// import { DialogContext } from \"./DialogContext\";\n\nimport { DialogActions } from \"./DialogActions\";\nimport { DialogContent } from \"./DialogContent\";\nimport { DialogContentDivider } from \"./DialogContentDivider\";\nimport { DialogTitle } from \"./DialogTitle\";\nimport { StyledDialog } from \"./Styles\";\nimport { Modal } from \"../Modal\";\nimport { Fade } from \"../Transitions\";\nimport { SlideFromTop } from \"../Transitions/SlideFromTop\";\n\nexport interface DialogProps extends HTMLAttributes<HTMLDivElement> {\n open?: boolean;\n onClose?: () => void;\n className?: string;\n enableBackgroundClick?: boolean;\n disableCloseOnEsc?: boolean;\n animate?: \"fade\" | \"slide\";\n onClickOutside?: (event) => void;\n}\n\nexport const _Dialog = forwardRef<\n HTMLDivElement,\n PropsWithChildren<DialogProps>\n>(\n (\n {\n children,\n open = false,\n onClose,\n className,\n enableBackgroundClick = false,\n disableCloseOnEsc = false,\n animate = \"slide\",\n onClickOutside,\n ...rest\n },\n ref\n ) => {\n const animateDialog = () => {\n switch (animate) {\n case \"fade\":\n return (\n <Fade in={open}>\n <StyledDialog className={classnames(\"c-dialog\", className)}>\n {children}\n </StyledDialog>\n </Fade>\n );\n default:\n return (\n <SlideFromTop in={open}>\n <StyledDialog className={classnames(\"c-dialog\", className)}>\n {children}\n </StyledDialog>\n </SlideFromTop>\n );\n }\n };\n\n return (\n // <DialogContext.Provider value={{}}>\n\n <Modal\n ref={ref}\n open={open}\n onClose={onClose}\n disableBackgroundClick={!enableBackgroundClick}\n disableCloseOnEsc={disableCloseOnEsc}\n onClickOutside={onClickOutside}\n {...rest}\n >\n {animateDialog()}\n </Modal>\n // </DialogContext.Provider>\n );\n }\n);\n\n_Dialog.displayName = \"Dialog\";\n\n// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757\nexport const Dialog = Object.assign({}, _Dialog, {\n Title: DialogTitle,\n Content: DialogContent,\n ContentDivider: DialogContentDivider,\n Actions: DialogActions,\n});\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAA2C,OAAO;AAE5E,OAAOC,UAAU,MAAM,YAAY;;AAEnC;;AAEA,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,YAAY,QAAQ,UAAU;AACvC,SAASC,KAAK,QAAQ,UAAU;AAChC,SAASC,IAAI,QAAQ,gBAAgB;AACrC,SAASC,YAAY,QAAQ,6BAA6B;AAY1D,OAAO,MAAMC,OAAO,gBAAGV,UAAU,CAI/B,CAAAW,IAAA,EAYEC,GAAG,KACA;EAAA,IAXDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,SAAA,GAAAH,IAAA,CACRI,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,KAAK,GAAAA,SAAA;IACZE,OAAO,GAAAL,IAAA,CAAPK,OAAO;IACPC,SAAS,GAAAN,IAAA,CAATM,SAAS;IAAAC,qBAAA,GAAAP,IAAA,CACTQ,qBAAqB;IAArBA,qBAAqB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IAAAE,qBAAA,GAAAT,IAAA,CAC7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BiC,OAAO,EAAEnC,aAAa;EACtBoC,cAAc,EAAEnC,oBAAoB;EACpCoC,OAAO,EAAEtC;AACX,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Dialog.js","names":["React","forwardRef","useMemo","classnames","DialogActions","DialogContent","DialogContentDivider","DialogContext","DialogTitle","dialogSizes","StyledDialog","StyledDialogViewport","Modal","Fade","SlideFromTop","DialogSurface","_ref","_ref$in","in","inProp","onEnter","onExited","forceClose","onClose","animate","children","Animation","value","requestClose","createElement","Provider","className","displayName","_Dialog","_ref2","ref","_dialogSizes$size","_ref2$open","open","_ref2$enableBackgroun","enableBackgroundClick","_ref2$disableCloseOnE","disableCloseOnEsc","_ref2$animate","onClickOutside","_ref2$size","size","_ref2$height","height","rest","_objectWithoutPropertiesLoose","_excluded","_extends","disableBackgroundClick","$maxWidth","m","$height","undefined","Dialog","Object","assign","Title","Content","ContentDivider","Actions"],"sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n PropsWithChildren,\n ReactElement,\n useMemo,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { DialogActions } from \"./DialogActions\";\nimport { DialogContent } from \"./DialogContent\";\nimport { DialogContentDivider } from \"./DialogContentDivider\";\nimport { DialogContext } from \"./DialogContext\";\nimport { DialogTitle } from \"./DialogTitle\";\nimport {\n DialogSize,\n dialogSizes,\n StyledDialog,\n StyledDialogViewport,\n} from \"./Styles\";\nimport { Modal } from \"../Modal\";\nimport { Fade } from \"../Transitions\";\nimport { SlideFromTop } from \"../Transitions/SlideFromTop\";\n\nexport interface DialogProps extends HTMLAttributes<HTMLDivElement> {\n open?: boolean;\n onClose?: () => void;\n className?: string;\n enableBackgroundClick?: boolean;\n disableCloseOnEsc?: boolean;\n animate?: \"fade\" | \"slide\";\n onClickOutside?: (event) => void;\n /** Width step. Every step is a max-width; the dialog always fills it when there is room. */\n size?: DialogSize;\n /** \"fluid\" follows the content. A CSS length (\"95%\", \"600px\") pins the height instead. */\n height?: string;\n}\n\ninterface DialogSurfaceProps {\n in?: boolean;\n onEnter?: () => void;\n onExited?: () => void;\n forceClose?: () => void;\n onClose?: () => void;\n animate: \"fade\" | \"slide\";\n children: ReactElement;\n}\n\n// Modal only treats a child as a transition when its props already carry `in`, so this element\n// must declare it even though Modal overwrites it on clone.\nconst DialogSurface = ({\n in: inProp = false,\n onEnter,\n onExited,\n forceClose,\n onClose,\n animate,\n children,\n}: DialogSurfaceProps) => {\n const Animation = animate === \"fade\" ? Fade : SlideFromTop;\n const value = useMemo(\n () => ({ requestClose: forceClose, onClose }),\n [forceClose, onClose]\n );\n\n return (\n <DialogContext.Provider value={value}>\n <StyledDialogViewport className=\"c-dialog-viewport\">\n <Animation in={inProp} onEnter={onEnter} onExited={onExited}>\n {children}\n </Animation>\n </StyledDialogViewport>\n </DialogContext.Provider>\n );\n};\n\nDialogSurface.displayName = \"DialogSurface\";\n\nexport const _Dialog = forwardRef<\n HTMLDivElement,\n PropsWithChildren<DialogProps>\n>(\n (\n {\n children,\n open = false,\n onClose,\n className,\n enableBackgroundClick = false,\n disableCloseOnEsc = false,\n animate = \"slide\",\n onClickOutside,\n size = \"m\",\n height = \"fluid\",\n ...rest\n },\n ref\n ) => {\n return (\n <Modal\n ref={ref}\n open={open}\n onClose={onClose}\n disableBackgroundClick={!enableBackgroundClick}\n disableCloseOnEsc={disableCloseOnEsc}\n onClickOutside={onClickOutside}\n {...rest}\n >\n <DialogSurface in={open} onClose={onClose} animate={animate}>\n <StyledDialog\n $maxWidth={dialogSizes[size] ?? dialogSizes.m}\n $height={height === \"fluid\" ? undefined : height}\n className={classnames(\"c-dialog\", className)}\n >\n {children}\n </StyledDialog>\n </DialogSurface>\n </Modal>\n );\n }\n);\n\n_Dialog.displayName = \"Dialog\";\n\n// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757\nexport const Dialog = Object.assign({}, _Dialog, {\n Title: DialogTitle,\n Content: DialogContent,\n ContentDiv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sB,EAAE,CAACb,qBAAsB;IAC/CE,iBAAiB,EAAEA,iBAAkB;IACrCE,cAAc,EAAEA;EAAe,GAC3BK,IAAI,gBAERjD,KAAA,CAAA6B,aAAA,CAACd,aAAa;IAACG,EAAE,EAAEoB,IAAK;IAACf,OAAO,EAAEA,OAAQ;IAACC,OAAO,EAAEA;EAAQ,gBAC1DxB,KAAA,CAAA6B,aAAA,CAACnB,YAAY;IACX4C,SAAS,GAAAlB,iBAAA,GAAE3B,WAAW,CAACqC,IAAI,CAAC,YAAAV,iBAAA,GAAI3B,WAAW,CAAC8C,CAAE;IAC9CC,OAAO,EAAER,MAAM,KAAK,OAAO,GAAGS,SAAS,GAAGT,MAAO;IACjDjB,SAAS,EAAE5B,UAAU,CAAC,UAAU,EAAE4B,SAAS;EAAE,GAE5CN,QACW,CACD,CACV,CAAC;AAEZ,CACF,CAAC;AAEDQ,OAAO,CAACD,WAAW,GAAG,QAAQ;;AAE9B;AACA,OAAO,MAAM0B,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAE3B,OAAO,EAAE;EAC/C4B,KAAK,EAAErD,WAAW;EAClBsD,OAAO,EAAEzD,aAAa;EACtB0D,cAAc,EAAEzD,oBAAoB;EACpC0D,OAAO,EAAE5D;AACX,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"DialogActions.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAO9C,eAAO,MAAM,aAAa;uCAIvB,cAAc,CAAC,cAAc,CAAC;;CAWhC,CAAC"}
1
+ {"version":3,"file":"DialogActions.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,cAAc,EAEf,MAAM,OAAO,CAAC;AAOf,eAAO,MAAM,aAAa;uCAIvB,cAAc,CAAC,cAAc,CAAC;;CAuBhC,CAAC"}
@@ -1,20 +1,25 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["className", "children"];
4
- import React from "react";
4
+ import React, { Children, cloneElement, isValidElement } from "react";
5
5
  import classnames from "classnames";
6
+ import { useDialogContext } from "./DialogContext";
6
7
  import { StyledDialogActions } from "./Styles";
7
- // import { useDialogContext } from "./DialogContext";
8
-
9
8
  export const DialogActions = _ref => {
10
9
  let className = _ref.className,
11
10
  children = _ref.children,
12
11
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
13
- // useDialogContext();
12
+ const dialog = useDialogContext();
14
13
 
14
+ // A footer button that does nothing but close gets the same path as clicking the overlay, so the
15
+ // exit transition runs before the caller unmounts the dialog. Matching on identity leaves a
16
+ // button that does anything else alone.
17
+ const wired = dialog != null && dialog.requestClose && dialog != null && dialog.onClose ? Children.map(children, child => /*#__PURE__*/isValidElement(child) && child.props.onClick === dialog.onClose ? /*#__PURE__*/cloneElement(child, {
18
+ onClick: dialog.requestClose
19
+ }) : child) : children;
15
20
  return /*#__PURE__*/React.createElement(StyledDialogActions, _extends({
16
21
  className: classnames("c-dialog-actions", className)
17
- }, rest), children);
22
+ }, rest), wired);
18
23
  };
19
24
  DialogActions.displayName = "DialogActions";
20
25
  //# sourceMappingURL=DialogActions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DialogActions.js","names":["React","classnames","StyledDialogActions","DialogActions","_ref","className","children","rest","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","displayName"],"sources":["../../../../src/components/Dialog/DialogActions.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledDialogActions } from \"./Styles\";\n// import { useDialogContext } from \"./DialogContext\";\n\nexport const DialogActions = ({\n className,\n children,\n ...rest\n}: HTMLAttributes<HTMLDivElement>) => {\n // useDialogContext();\n\n return (\n <StyledDialogActions\n className={classnames(\"c-dialog-actions\", className)}\n {...rest}\n >\n {children}\n </StyledDialogActions>\n );\n};\n\nDialogActions.displayName = \"DialogActions\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAA0B,OAAO;AAE7C,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,mBAAmB,QAAQ,UAAU;AAC9C;;AAEA,OAAO,MAAMC,aAAa,GAAGC,IAAA,IAIS;EAAA,IAHpCC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACLC,IAAI,GAAAC,6BAAA,CAAAJ,IAAA,EAAAK,SAAA;EAEP;;EAEA,oBACET,KAAA,CAAAU,aAAA,CAACR,mBAAmB,EAAAS,QAAA;IAClBN,SAAS,EAAEJ,UAAU,CAAC,kBAAkB,EAAEI,SAAS;EAAE,GACjDE,IAAI,GAEPD,QACkB,CAAC;AAE1B,CAAC;AAEDH,aAAa,CAACS,WAAW,GAAG,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"DialogActions.js","names":["React","Children","cloneElement","isValidElement","classnames","useDialogContext","StyledDialogActions","DialogActions","_ref","className","children","rest","_objectWithoutPropertiesLoose","_excluded","dialog","wired","requestClose","onClose","map","child","props","onClick","createElement","_extends","displayName"],"sources":["../../../../src/components/Dialog/DialogActions.tsx"],"sourcesContent":["import React, {\n Children,\n cloneElement,\n HTMLAttributes,\n isValidElement,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { useDialogContext } from \"./DialogContext\";\nimport { StyledDialogActions } from \"./Styles\";\n\nexport const DialogActions = ({\n className,\n children,\n ...rest\n}: HTMLAttributes<HTMLDivElement>) => {\n const dialog = useDialogContext();\n\n // A footer button that does nothing but close gets the same path as clicking the overlay, so the\n // exit transition runs before the caller unmounts the dialog. Matching on identity leaves a\n // button that does anything else alone.\n const wired =\n dialog?.requestClose && dialog?.onClose\n ? Children.map(children, (child) =>\n isValidElement(child) && child.props.onClick === dialog.onClose\n ? cloneElement(child, { onClick: dialog.requestClose })\n : child\n )\n : children;\n\n return (\n <StyledDialogActions\n className={classnames(\"c-dialog-actions\", className)}\n {...rest}\n >\n {wired}\n </StyledDialogActions>\n );\n};\n\nDialogActions.displayName = \"DialogActions\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,QAAQ,EACRC,YAAY,EAEZC,cAAc,QACT,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,mBAAmB,QAAQ,UAAU;AAE9C,OAAO,MAAMC,aAAa,GAAGC,IAAA,IAIS;EAAA,IAHpCC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACLC,IAAI,GAAAC,6BAAA,CAAAJ,IAAA,EAAAK,SAAA;EAEP,MAAMC,MAAM,GAAGT,gBAAgB,CAAC,CAAC;;EAEjC;EACA;EACA;EACA,MAAMU,KAAK,GACTD,MAAM,YAANA,MAAM,CAAEE,YAAY,IAAIF,MAAM,YAANA,MAAM,CAAEG,OAAO,GACnChB,QAAQ,CAACiB,GAAG,CAACR,QAAQ,EAAGS,KAAK,IAC3B,aAAAhB,cAAc,CAACgB,KAAK,CAAC,IAAIA,KAAK,CAACC,KAAK,CAACC,OAAO,KAAKP,MAAM,CAACG,OAAO,gBAC3Df,YAAY,CAACiB,KAAK,EAAE;IAAEE,OAAO,EAAEP,MAAM,CAACE;EAAa,CAAC,CAAC,GACrDG,KACN,CAAC,GACDT,QAAQ;EAEd,oBACEV,KAAA,CAAAsB,aAAA,CAAChB,mBAAmB,EAAAiB,QAAA;IAClBd,SAAS,EAAEL,UAAU,CAAC,kBAAkB,EAAEK,SAAS;EAAE,GACjDE,IAAI,GAEPI,KACkB,CAAC;AAE1B,CAAC;AAEDR,aAAa,CAACiB,WAAW,GAAG,eAAe","ignoreList":[]}
@@ -1,6 +1,10 @@
1
1
  import React, { HTMLAttributes } from "react";
2
+ export interface DialogContentProps extends HTMLAttributes<HTMLDivElement> {
3
+ /** Turn off when the content runs its own scroll container. */
4
+ scroll?: boolean;
5
+ }
2
6
  export declare const DialogContent: {
3
- ({ className, children, ...rest }: HTMLAttributes<HTMLDivElement>): React.JSX.Element;
7
+ ({ className, children, scroll, ...rest }: DialogContentProps): React.JSX.Element;
4
8
  displayName: string;
5
9
  };
6
10
  //# sourceMappingURL=DialogContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAO9C,eAAO,MAAM,aAAa;uCAIvB,cAAc,CAAC,cAAc,CAAC;;CAWhC,CAAC"}
1
+ {"version":3,"file":"DialogContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAM9C,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACxE,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,aAAa;+CAKvB,kBAAkB;;CAUpB,CAAC"}
@@ -1,18 +1,17 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["className", "children"];
3
+ const _excluded = ["className", "children", "scroll"];
4
4
  import React from "react";
5
5
  import classnames from "classnames";
6
6
  import { StyledDialogContent } from "./Styles";
7
- // import { useDialogContext } from "./DialogContext";
8
-
9
7
  export const DialogContent = _ref => {
10
8
  let className = _ref.className,
11
9
  children = _ref.children,
10
+ _ref$scroll = _ref.scroll,
11
+ scroll = _ref$scroll === void 0 ? true : _ref$scroll,
12
12
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
13
- // useDialogContext();
14
-
15
13
  return /*#__PURE__*/React.createElement(StyledDialogContent, _extends({
14
+ $scroll: scroll,
16
15
  className: classnames("c-dialog-content", className)
17
16
  }, rest), children);
18
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContent.js","names":["React","classnames","StyledDialogContent","DialogContent","_ref","className","children","rest","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","displayName"],"sources":["../../../../src/components/Dialog/DialogContent.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledDialogContent } from \"./Styles\";\n// import { useDialogContext } from \"./DialogContext\";\n\nexport const DialogContent = ({\n className,\n children,\n ...rest\n}: HTMLAttributes<HTMLDivElement>) => {\n // useDialogContext();\n\n return (\n <StyledDialogContent\n className={classnames(\"c-dialog-content\", className)}\n {...rest}\n >\n {children}\n </StyledDialogContent>\n );\n};\n\nDialogContent.displayName = \"DialogContent\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAA0B,OAAO;AAE7C,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,mBAAmB,QAAQ,UAAU;AAC9C;;AAEA,OAAO,MAAMC,aAAa,GAAGC,IAAA,IAIS;EAAA,IAHpCC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACLC,IAAI,GAAAC,6BAAA,CAAAJ,IAAA,EAAAK,SAAA;EAEP;;EAEA,oBACET,KAAA,CAAAU,aAAA,CAACR,mBAAmB,EAAAS,QAAA;IAClBN,SAAS,EAAEJ,UAAU,CAAC,kBAAkB,EAAEI,SAAS;EAAE,GACjDE,IAAI,GAEPD,QACkB,CAAC;AAE1B,CAAC;AAEDH,aAAa,CAACS,WAAW,GAAG,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"DialogContent.js","names":["React","classnames","StyledDialogContent","DialogContent","_ref","className","children","_ref$scroll","scroll","rest","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","$scroll","displayName"],"sources":["../../../../src/components/Dialog/DialogContent.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledDialogContent } from \"./Styles\";\n\nexport interface DialogContentProps extends HTMLAttributes<HTMLDivElement> {\n /** Turn off when the content runs its own scroll container. */\n scroll?: boolean;\n}\n\nexport const DialogContent = ({\n className,\n children,\n scroll = true,\n ...rest\n}: DialogContentProps) => {\n return (\n <StyledDialogContent\n $scroll={scroll}\n className={classnames(\"c-dialog-content\", className)}\n {...rest}\n >\n {children}\n </StyledDialogContent>\n );\n};\n\nDialogContent.displayName = \"DialogContent\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAA0B,OAAO;AAE7C,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,mBAAmB,QAAQ,UAAU;AAO9C,OAAO,MAAMC,aAAa,GAAGC,IAAA,IAKH;EAAA,IAJxBC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,WAAA,GAAAH,IAAA,CACRI,MAAM;IAANA,MAAM,GAAAD,WAAA,cAAG,IAAI,GAAAA,WAAA;IACVE,IAAI,GAAAC,6BAAA,CAAAN,IAAA,EAAAO,SAAA;EAEP,oBACEX,KAAA,CAAAY,aAAA,CAACV,mBAAmB,EAAAW,QAAA;IAClBC,OAAO,EAAEN,MAAO;IAChBH,SAAS,EAAEJ,UAAU,CAAC,kBAAkB,EAAEI,SAAS;EAAE,GACjDI,IAAI,GAEPH,QACkB,CAAC;AAE1B,CAAC;AAEDH,aAAa,CAACY,WAAW,GAAG,eAAe","ignoreList":[]}
@@ -1,5 +1,15 @@
1
1
  export interface DialogContextProps {
2
+ /** Starts the closing transition. The dialog's own onClose runs once it finishes. */
3
+ requestClose?: () => void;
4
+ /** The handler the dialog was given, used to recognise a button that only closes. */
5
+ onClose?: () => void;
2
6
  }
3
7
  export declare const DialogContext: import("react").Context<DialogContextProps | null>;
4
- export declare const useDialogContext: () => DialogContextProps;
8
+ export declare const useDialogContext: () => DialogContextProps | null;
9
+ /**
10
+ * Closes the dialog the way clicking the overlay does: the exit transition runs first, and the
11
+ * dialog's own onClose fires once it finishes. Use it for a Cancel button instead of calling the
12
+ * parent's close handler, which would unmount the dialog before it can animate out.
13
+ */
14
+ export declare const useDialogClose: (fallback?: () => void) => () => void;
5
15
  //# sourceMappingURL=DialogContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogContext.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;CAAG;AAEtC,eAAO,MAAM,aAAa,oDAAiD,CAAC;AAE5E,eAAO,MAAM,gBAAgB,0BAU5B,CAAC"}
1
+ {"version":3,"file":"DialogContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogContext.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,oDAAiD,CAAC;AAE5E,eAAO,MAAM,gBAAgB,iCAAkC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,IAAI,WAd7B,IAkBtB,CAAC"}
@@ -1,13 +1,15 @@
1
1
  import { createContext, useContext } from "react";
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
4
-
5
2
  export const DialogContext = /*#__PURE__*/createContext(null);
6
- export const useDialogContext = () => {
3
+ export const useDialogContext = () => useContext(DialogContext);
4
+
5
+ /**
6
+ * Closes the dialog the way clicking the overlay does: the exit transition runs first, and the
7
+ * dialog's own onClose fires once it finishes. Use it for a Cancel button instead of calling the
8
+ * parent's close handler, which would unmount the dialog before it can animate out.
9
+ */
10
+ export const useDialogClose = fallback => {
11
+ var _ref, _context$requestClose;
7
12
  const context = useContext(DialogContext);
8
- if (!context) {
9
- throw new Error("Child components of Dialog can not be rendered outside the Dialog component!");
10
- }
11
- return context;
13
+ return (_ref = (_context$requestClose = context == null ? void 0 : context.requestClose) != null ? _context$requestClose : fallback) != null ? _ref : () => undefined;
12
14
  };
13
15
  //# sourceMappingURL=DialogContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContext.js","names":["createContext","useContext","DialogContext","useDialogContext","context","Error"],"sources":["../../../../src/components/Dialog/DialogContext.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface DialogContextProps {}\n\nexport const DialogContext = createContext<DialogContextProps | null>(null);\n\nexport const useDialogContext = () => {\n const context = useContext(DialogContext);\n\n if (!context) {\n throw new Error(\n \"Child components of Dialog can not be rendered outside the Dialog component!\"\n );\n }\n\n return context;\n};\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;;AAEjD;;AAGA,OAAO,MAAMC,aAAa,gBAAGF,aAAa,CAA4B,IAAI,CAAC;AAE3E,OAAO,MAAMG,gBAAgB,GAAGA,CAAA,KAAM;EACpC,MAAMC,OAAO,GAAGH,UAAU,CAACC,aAAa,CAAC;EAEzC,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CACb,8EACF,CAAC;EACH;EAEA,OAAOD,OAAO;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"DialogContext.js","names":["createContext","useContext","DialogContext","useDialogContext","useDialogClose","fallback","_ref","_context$requestClose","context","requestClose","undefined"],"sources":["../../../../src/components/Dialog/DialogContext.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport interface DialogContextProps {\n /** Starts the closing transition. The dialog's own onClose runs once it finishes. */\n requestClose?: () => void;\n /** The handler the dialog was given, used to recognise a button that only closes. */\n onClose?: () => void;\n}\n\nexport const DialogContext = createContext<DialogContextProps | null>(null);\n\nexport const useDialogContext = () => useContext(DialogContext);\n\n/**\n * Closes the dialog the way clicking the overlay does: the exit transition runs first, and the\n * dialog's own onClose fires once it finishes. Use it for a Cancel button instead of calling the\n * parent's close handler, which would unmount the dialog before it can animate out.\n */\nexport const useDialogClose = (fallback?: () => void) => {\n const context = useContext(DialogContext);\n\n return context?.requestClose ?? fallback ?? (() => undefined);\n};\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AASjD,OAAO,MAAMC,aAAa,gBAAGF,aAAa,CAA4B,IAAI,CAAC;AAE3E,OAAO,MAAMG,gBAAgB,GAAGA,CAAA,KAAMF,UAAU,CAACC,aAAa,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,cAAc,GAAIC,QAAqB,IAAK;EAAA,IAAAC,IAAA,EAAAC,qBAAA;EACvD,MAAMC,OAAO,GAAGP,UAAU,CAACC,aAAa,CAAC;EAEzC,QAAAI,IAAA,IAAAC,qBAAA,GAAOC,OAAO,oBAAPA,OAAO,CAAEC,YAAY,YAAAF,qBAAA,GAAIF,QAAQ,YAAAC,IAAA,GAAK,MAAMI,SAAS;AAC9D,CAAC","ignoreList":[]}
@@ -2,9 +2,12 @@ import React, { PropsWithChildren } from "react";
2
2
  export interface DialogTitleProps {
3
3
  className?: string;
4
4
  disableDefaultHeading?: boolean;
5
+ /** Draws a close button next to the heading. */
6
+ onClose?: () => void;
7
+ closeLabel?: string;
5
8
  }
6
9
  export declare const DialogTitle: {
7
- ({ children, className, disableDefaultHeading, ...rest }: PropsWithChildren<DialogTitleProps>): React.JSX.Element;
10
+ ({ children, className, disableDefaultHeading, onClose, closeLabel, ...rest }: PropsWithChildren<DialogTitleProps>): React.JSX.Element;
8
11
  displayName: string;
9
12
  };
10
13
  //# sourceMappingURL=DialogTitle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DialogTitle.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAQjD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,WAAW;8DAKrB,iBAAiB,CAAC,gBAAgB,CAAC;;CAWrC,CAAC"}
1
+ {"version":3,"file":"DialogTitle.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAcjD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,WAAW;mFAOrB,iBAAiB,CAAC,gBAAgB,CAAC;;CAoCrC,CAAC"}
@@ -1,23 +1,37 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["children", "className", "disableDefaultHeading"];
3
+ const _excluded = ["children", "className", "disableDefaultHeading", "onClose", "closeLabel"];
4
4
  import React from "react";
5
5
  import classnames from "classnames";
6
- import { StyledDialogTitle } from "./Styles";
6
+ import { useDialogContext } from "./DialogContext";
7
+ import { StyledDialogTitle, StyledDialogTitleBar, StyledDialogTitleClose } from "./Styles";
8
+ import { IconButton } from "../IconButton";
9
+ import { CancelCrossIcon } from "../Icons";
7
10
  import { Header3 } from "../Typography/Variants/Header3";
8
- // import { useDialogContext } from "./DialogContext";
9
-
10
11
  export const DialogTitle = _ref => {
12
+ var _dialog$requestClose;
11
13
  let children = _ref.children,
12
14
  className = _ref.className,
13
15
  _ref$disableDefaultHe = _ref.disableDefaultHeading,
14
16
  disableDefaultHeading = _ref$disableDefaultHe === void 0 ? false : _ref$disableDefaultHe,
17
+ onClose = _ref.onClose,
18
+ _ref$closeLabel = _ref.closeLabel,
19
+ closeLabel = _ref$closeLabel === void 0 ? "Close" : _ref$closeLabel,
15
20
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
16
- // useDialogContext();
21
+ const dialog = useDialogContext();
22
+ const heading = disableDefaultHeading ? children : /*#__PURE__*/React.createElement(Header3, null, children);
17
23
 
24
+ // Closing through the dialog lets the exit transition run; the caller's onClose fires once it
25
+ // finishes. Falling back keeps a title used outside a dialog working.
26
+ const handleClose = (_dialog$requestClose = dialog == null ? void 0 : dialog.requestClose) != null ? _dialog$requestClose : onClose;
18
27
  return /*#__PURE__*/React.createElement(StyledDialogTitle, _extends({
19
28
  className: classnames("c-dialog-title-wrapper", className)
20
- }, rest), disableDefaultHeading ? children : /*#__PURE__*/React.createElement(Header3, null, children));
29
+ }, rest), onClose ? /*#__PURE__*/React.createElement(StyledDialogTitleBar, null, heading, /*#__PURE__*/React.createElement(StyledDialogTitleClose, null, /*#__PURE__*/React.createElement(IconButton, {
30
+ type: "button",
31
+ variant: "text gray",
32
+ "aria-label": closeLabel,
33
+ onClick: handleClose
34
+ }, /*#__PURE__*/React.createElement(CancelCrossIcon, null)))) : heading);
21
35
  };
22
36
  DialogTitle.displayName = "DialogTitle";
23
37
  //# sourceMappingURL=DialogTitle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DialogTitle.js","names":["React","classnames","StyledDialogTitle","Header3","DialogTitle","_ref","children","className","_ref$disableDefaultHe","disableDefaultHeading","rest","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","displayName"],"sources":["../../../../src/components/Dialog/DialogTitle.tsx"],"sourcesContent":["import React, { PropsWithChildren } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledDialogTitle } from \"./Styles\";\nimport { Header3 } from \"../Typography/Variants/Header3\";\n// import { useDialogContext } from \"./DialogContext\";\n\nexport interface DialogTitleProps {\n className?: string;\n disableDefaultHeading?: boolean;\n}\n\nexport const DialogTitle = ({\n children,\n className,\n disableDefaultHeading = false,\n ...rest\n}: PropsWithChildren<DialogTitleProps>) => {\n // useDialogContext();\n\n return (\n <StyledDialogTitle\n className={classnames(\"c-dialog-title-wrapper\", className)}\n {...rest}\n >\n {disableDefaultHeading ? children : <Header3>{children}</Header3>}\n </StyledDialogTitle>\n );\n};\n\nDialogTitle.displayName = \"DialogTitle\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAA6B,OAAO;AAEhD,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,iBAAiB,QAAQ,UAAU;AAC5C,SAASC,OAAO,QAAQ,gCAAgC;AACxD;;AAOA,OAAO,MAAMC,WAAW,GAAGC,IAAA,IAKgB;EAAA,IAJzCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAAC,qBAAA,GAAAH,IAAA,CACTI,qBAAqB;IAArBA,qBAAqB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IAC1BE,IAAI,GAAAC,6BAAA,CAAAN,IAAA,EAAAO,SAAA;EAEP;;EAEA,oBACEZ,KAAA,CAAAa,aAAA,CAACX,iBAAiB,EAAAY,QAAA;IAChBP,SAAS,EAAEN,UAAU,CAAC,wBAAwB,EAAEM,SAAS;EAAE,GACvDG,IAAI,GAEPD,qBAAqB,GAAGH,QAAQ,gBAAGN,KAAA,CAAAa,aAAA,CAACV,OAAO,QAAEG,QAAkB,CAC/C,CAAC;AAExB,CAAC;AAEDF,WAAW,CAACW,WAAW,GAAG,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"DialogTitle.js","names":["React","classnames","useDialogContext","StyledDialogTitle","StyledDialogTitleBar","StyledDialogTitleClose","IconButton","CancelCrossIcon","Header3","DialogTitle","_ref","_dialog$requestClose","children","className","_ref$disableDefaultHe","disableDefaultHeading","onClose","_ref$closeLabel","closeLabel","rest","_objectWithoutPropertiesLoose","_excluded","dialog","heading","createElement","handleClose","requestClose","_extends","type","variant","onClick","displayName"],"sources":["../../../../src/components/Dialog/DialogTitle.tsx"],"sourcesContent":["import React, { PropsWithChildren } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { useDialogContext } from \"./DialogContext\";\nimport {\n StyledDialogTitle,\n StyledDialogTitleBar,\n StyledDialogTitleClose,\n} from \"./Styles\";\nimport { IconButton } from \"../IconButton\";\nimport { CancelCrossIcon } from \"../Icons\";\nimport { Header3 } from \"../Typography/Variants/Header3\";\n\nexport interface DialogTitleProps {\n className?: string;\n disableDefaultHeading?: boolean;\n /** Draws a close button next to the heading. */\n onClose?: () => void;\n closeLabel?: string;\n}\n\nexport const DialogTitle = ({\n children,\n className,\n disableDefaultHeading = false,\n onClose,\n closeLabel = \"Close\",\n ...rest\n}: PropsWithChildren<DialogTitleProps>) => {\n const dialog = useDialogContext();\n const heading = disableDefaultHeading ? (\n children\n ) : (\n <Header3>{children}</Header3>\n );\n\n // Closing through the dialog lets the exit transition run; the caller's onClose fires once it\n // finishes. Falling back keeps a title used outside a dialog working.\n const handleClose = dialog?.requestClose ?? onClose;\n\n return (\n <StyledDialogTitle\n className={classnames(\"c-dialog-title-wrapper\", className)}\n {...rest}\n >\n {onClose ? (\n <StyledDialogTitleBar>\n {heading}\n <StyledDialogTitleClose>\n <IconButton\n type=\"button\"\n variant=\"text gray\"\n aria-label={closeLabel}\n onClick={handleClose}\n >\n <CancelCrossIcon />\n </IconButton>\n </StyledDialogTitleClose>\n </StyledDialogTitleBar>\n ) : (\n heading\n )}\n </StyledDialogTitle>\n );\n};\n\nDialogTitle.displayName = \"DialogTitle\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAA6B,OA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CAAClB,UAAU;IACTsB,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAC,WAAW;IACnB,cAAYX,UAAW;IACvBY,OAAO,EAAEL;EAAY,gBAErBzB,KAAA,CAAAwB,aAAA,CAACjB,eAAe,MAAE,CACR,CACU,CACJ,CAAC,GAEvBgB,OAEe,CAAC;AAExB,CAAC;AAEDd,WAAW,CAACsB,WAAW,GAAG,aAAa","ignoreList":[]}
@@ -1,6 +1,23 @@
1
- export declare const StyledDialog: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const dialogSizes: {
2
+ readonly s: 440;
3
+ readonly m: 540;
4
+ readonly l: 700;
5
+ readonly xl: 840;
6
+ readonly xxl: 1000;
7
+ readonly xxxl: 1120;
8
+ };
9
+ export type DialogSize = keyof typeof dialogSizes;
10
+ export declare const StyledDialogViewport: import("styled-components").StyledComponent<"div", any, {}, never>;
11
+ export declare const StyledDialog: import("styled-components").StyledComponent<"div", any, {
12
+ $maxWidth: number;
13
+ $height?: string;
14
+ }, never>;
2
15
  export declare const StyledDialogTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- export declare const StyledDialogContent: import("styled-components").StyledComponent<"div", any, {}, never>;
16
+ export declare const StyledDialogTitleBar: import("styled-components").StyledComponent<"div", any, {}, never>;
17
+ export declare const StyledDialogTitleClose: import("styled-components").StyledComponent<"div", any, {}, never>;
18
+ export declare const StyledDialogContent: import("styled-components").StyledComponent<"div", any, {
19
+ $scroll: boolean;
20
+ }, never>;
4
21
  export declare const StyledDialogContentDivider: import("styled-components").StyledComponent<"div", any, {}, never>;
5
22
  export declare const StyledDialogActions: import("styled-components").StyledComponent<"div", any, {}, never>;
6
23
  //# sourceMappingURL=Styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/Styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,oEA2BxB,CAAC;AAIF,eAAO,MAAM,iBAAiB,oEAK7B,CAAC;AAGF,eAAO,MAAM,mBAAmB,oEAQ/B,CAAC;AAGF,eAAO,MAAM,0BAA0B,oEAGtC,CAAC;AAGF,eAAO,MAAM,mBAAmB,oEAK/B,CAAC"}
1
+ {"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/Styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW;;;;;;;CAOd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC;AAQlD,eAAO,MAAM,oBAAoB,oEAoChC,CAAC;AAIF,eAAO,MAAM,YAAY;eACZ,MAAM;cACP,MAAM;SA4BjB,CAAC;AAIF,eAAO,MAAM,iBAAiB,oEAM7B,CAAC;AASF,eAAO,MAAM,oBAAoB,oEAKhC,CAAC;AAGF,eAAO,MAAM,sBAAsB,oEAMlC,CAAC;AAGF,eAAO,MAAM,mBAAmB;aAAyB,OAAO;SAQ/D,CAAC;AAGF,eAAO,MAAM,0BAA0B,oEAItC,CAAC;AAGF,eAAO,MAAM,mBAAmB,oEAS/B,CAAC"}
@@ -1,30 +1,66 @@
1
- import styled from "styled-components";
1
+ import styled, { css } from "styled-components";
2
2
  import { BoxSizingStyle } from "../BoxSizingStyle";
3
3
  import { screen } from "../BreakPoints";
4
4
  import { FontStyle } from "../FontStyle";
5
+ export const dialogSizes = {
6
+ s: 440,
7
+ m: 540,
8
+ l: 700,
9
+ xl: 840,
10
+ xxl: 1000,
11
+ xxxl: 1120
12
+ };
13
+ const MIN_GAP = "2.5vh";
14
+ const MAX_DIALOG_HEIGHT = "95vh";
15
+
16
+ // The dialog hangs at a fixed offset while there is room below it, then grows in both directions at
17
+ // once. Two shrinkable spacers express that: only the lower one grows, and past the crossover both
18
+ // shrink from the same basis, so the gaps stay equal down to MIN_GAP.
19
+ export const StyledDialogViewport = styled.div.withConfig({
20
+ displayName: "Styles__StyledDialogViewport",
21
+ componentId: "sc-jwpvgm-0"
22
+ })(["position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;padding-left:16px;padding-right:16px;pointer-events:none;--ac-dialog-offset:60px;", "{--ac-dialog-offset:126px;}&::before,&::after{content:\"\";flex-shrink:1;flex-basis:var(--ac-dialog-offset);min-height:", ";}&::before{flex-grow:0;}&::after{flex-grow:1;}", ""], screen.sm, MIN_GAP, BoxSizingStyle);
23
+ StyledDialogViewport.displayName = "StyledDialogViewport";
5
24
  export const StyledDialog = styled.div.withConfig({
6
25
  displayName: "Styles__StyledDialog",
7
- componentId: "sc-jwpvgm-0"
8
- })(["display:flex;flex-direction:column;flex:1 1 auto;max-height:calc(100vh - 156px);background-color:var(--page-paper-main);color:var(--color-theme-900);box-shadow:var(--shadow-primary);border-radius:8px;width:310px;margin:60px auto 30px auto;position:relative;@media (max-width:640px){width:calc(100% - 32px);max-width:640px;margin-left:16px !important;margin-right:16px !important;}", " ", " ", "{width:540px;margin:126px auto 30px auto;}"], FontStyle, BoxSizingStyle, screen.sm);
26
+ componentId: "sc-jwpvgm-1"
27
+ })(["display:flex;flex-direction:column;flex:0 0 auto;pointer-events:auto;width:100%;max-width:", "px;max-height:", ";background-color:var(--page-paper-main);color:var(--color-theme-900);box-shadow:var(--shadow-primary);border-radius:8px;position:relative;transition:max-width 0.2s ease,height 0.2s ease;@media (prefers-reduced-motion:reduce){transition:none;}", " ", " ", ""], props => props.$maxWidth, MAX_DIALOG_HEIGHT, props => props.$height && css(["height:", ";"], props.$height), FontStyle, BoxSizingStyle);
9
28
  StyledDialog.displayName = "StyledDialog";
10
29
  export const StyledDialogTitle = styled.div.withConfig({
11
30
  displayName: "Styles__StyledDialogTitle",
12
- componentId: "sc-jwpvgm-1"
13
- })(["padding:20px 30px;", " ", ""], FontStyle, BoxSizingStyle);
31
+ componentId: "sc-jwpvgm-2"
32
+ })(["padding:20px 30px;flex:0 0 auto;", " ", ""], FontStyle, BoxSizingStyle);
14
33
  StyledDialogTitle.displayName = "StyledDialogTitle";
34
+
35
+ // The close button hangs 8px into the title padding, so it sits nearer the dialog edge than the
36
+ // heading does. The bar reserves the rest, which keeps the gap to the heading unchanged.
37
+ const CLOSE_OFFSET = 8;
38
+ const CLOSE_RESERVE = 44 - CLOSE_OFFSET;
39
+
40
+ // The header is as tall as its heading, with or without a close button.
41
+ export const StyledDialogTitleBar = styled.div.withConfig({
42
+ displayName: "Styles__StyledDialogTitleBar",
43
+ componentId: "sc-jwpvgm-3"
44
+ })(["position:relative;display:flex;align-items:center;padding-right:", "px;"], CLOSE_RESERVE);
45
+ StyledDialogTitleBar.displayName = "StyledDialogTitleBar";
46
+ export const StyledDialogTitleClose = styled.div.withConfig({
47
+ displayName: "Styles__StyledDialogTitleClose",
48
+ componentId: "sc-jwpvgm-4"
49
+ })(["position:absolute;right:-", "px;top:50%;transform:translateY(-50%);line-height:0;"], CLOSE_OFFSET);
50
+ StyledDialogTitleClose.displayName = "StyledDialogTitleClose";
15
51
  export const StyledDialogContent = styled.div.withConfig({
16
52
  displayName: "Styles__StyledDialogContent",
17
- componentId: "sc-jwpvgm-2"
18
- })(["padding:20px 30px;max-height:580px;overflow-y:auto;flex:1 1 auto;", " ", ""], FontStyle, BoxSizingStyle);
53
+ componentId: "sc-jwpvgm-5"
54
+ })(["padding:20px 30px;flex:1 1 auto;min-height:0;overflow-y:", ";", " ", ""], props => props.$scroll ? "auto" : "visible", FontStyle, BoxSizingStyle);
19
55
  StyledDialogContent.displayName = "StyledDialogContent";
20
56
  export const StyledDialogContentDivider = styled.div.withConfig({
21
57
  displayName: "Styles__StyledDialogContentDivider",
22
- componentId: "sc-jwpvgm-3"
23
- })(["border-top:1px solid var(--border-primary);height:1px;"]);
58
+ componentId: "sc-jwpvgm-6"
59
+ })(["border-top:1px solid var(--border-primary);height:1px;flex:0 0 auto;"]);
24
60
  StyledDialogContentDivider.displayName = "StyledDialogContentDivider";
25
61
  export const StyledDialogActions = styled.div.withConfig({
26
62
  displayName: "Styles__StyledDialogActions",
27
- componentId: "sc-jwpvgm-4"
28
- })(["padding:20px 30px;", " ", ""], FontStyle, BoxSizingStyle);
63
+ componentId: "sc-jwpvgm-7"
64
+ })(["padding:20px 30px;flex:0 0 auto;display:flex;align-items:center;gap:12px;", " ", ""], FontStyle, BoxSizingStyle);
29
65
  StyledDialogActions.displayName = "StyledDialogActions";
30
66
  //# sourceMappingURL=Styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.js","names":["styled","BoxSizingStyle","screen","FontStyle","StyledDialog","div","withConfig","displayName","componentId","sm","StyledDialogTitle","StyledDialogContent","StyledDialogContentDivider","StyledDialogActions"],"sources":["../../../../src/components/Dialog/Styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { screen } from \"../BreakPoints\";\nimport { FontStyle } from \"../FontStyle\";\n\nexport const StyledDialog = styled.div`\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n max-height: calc(100vh - 156px);\n background-color: var(--page-paper-main);\n color: var(--color-theme-900);\n box-shadow: var(--shadow-primary);\n border-radius: 8px;\n width: 310px;\n margin: 60px auto 30px auto;\n position: relative;\n\n @media (max-width: 640px) {\n width: calc(100% - 32px);\n max-width: 640px;\n margin-left: 16px !important;\n margin-right: 16px !important;\n }\n\n ${FontStyle}\n ${BoxSizingStyle}\n\n ${screen.sm} {\n width: 540px;\n margin: 126px auto 30px auto;\n }\n`;\n\nStyledDialog.displayName = \"StyledDialog\";\n\nexport const StyledDialogTitle = styled.div`\n padding: 20px 30px;\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\nStyledDialogTitle.displayName = \"StyledDialogTitle\";\n\nexport const StyledDialogContent = styled.div`\n padding: 20px 30px;\n max-height: 580px;\n overflow-y: auto;\n flex: 1 1 auto;\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\nStyledDialogContent.displayName = \"StyledDialogContent\";\n\nexport const StyledDialogContentDivider = styled.div`\n border-top: 1px solid var(--border-primary);\n height: 1px;\n`;\nStyledDialogContentDivider.displayName = \"StyledDialogContentDivider\";\n\nexport const StyledDialogActions = styled.div`\n padding: 20px 30px;\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\nStyledDialogActions.displayName = \"StyledDialogActions\";\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,SAAS,QAAQ,cAAc;AAExC,OAAO,MAAMC,YAAY,GAAGJ,MAAM,CAACK,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,6bAoBlCL,SAAS,EACTF,cAAc,EAEdC,MAAM,CAACO,EAAE,CAIZ;AAEDL,YAAY,CAACG,WAAW,GAAG,cAAc;AAEzC,OAAO,MAAMG,iBAAiB,GAAGV,MAAM,CAACK,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,oCAGvCL,SAAS,EACTF,cAAc,CACjB;AACDS,iBAAiB,CAACH,WAAW,GAAG,mBAAmB;AAEnD,OAAO,MAAMI,mBAAmB,GAAGX,MAAM,CAACK,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,mFAMzCL,SAAS,EACTF,cAAc,CACjB;AACDU,mBAAmB,CAACJ,WAAW,GAAG,qBAAqB;AAEvD,OAAO,MAAMK,0BAA0B,GAAGZ,MAAM,CAACK,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,8DAGnD;AACDI,0BAA0B,CAACL,WAAW,GAAG,4BAA4B;AAErE,OAAO,MAAMM,mBAAmB,GAAGb,MAAM,CAACK,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,oCAGzCL,SAAS,EACTF,cAAc,CACjB;AACDY,mBAAmB,CAACN,WAAW,GAAG,qBAAqB","ignoreList":[]}
1
+ {"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","screen","FontStyle","dialogSizes","s","m","l","xl","xxl","xxxl","MIN_GAP","MAX_DIALOG_HEIGHT","StyledDialogViewport","div","withConfig","displayName","componentId","sm","StyledDialog","props","$maxWidth","$height","StyledDialogTitle","CLOSE_OFFSET","CLOSE_RESERVE","StyledDialogTitleBar","StyledDialogTitleClose","StyledDialogContent","$scroll","StyledDialogContentDivider","StyledDialogActions"],"sources":["../../../../src/components/Dialog/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { screen } from \"../BreakPoints\";\nimport { FontStyle } from \"../FontStyle\";\n\nexport const dialogSizes = {\n s: 440,\n m: 540,\n l: 700,\n xl: 840,\n xxl: 1000,\n xxxl: 1120,\n} as const;\n\nexport type DialogSize = keyof typeof dialogSizes;\n\nconst MIN_GAP = \"2.5vh\";\nconst MAX_DIALOG_HEIGHT = \"95vh\";\n\n// The dialog hangs at a fixed offset while there is room below it, then grows in both directions at\n// once. Two shrinkable spacers express that: only the lower one grows, and past the crossover both\n// shrink from the same basis, so the gaps stay equal down to MIN_GAP.\nexport const StyledDialogViewport = styled.div`\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n padding-left: 16px;\n padding-right: 16px;\n pointer-events: none;\n\n --ac-dialog-offset: 60px;\n\n ${screen.sm} {\n --ac-dialog-offset: 126px;\n }\n\n &::before,\n &::after {\n content: \"\";\n flex-shrink: 1;\n flex-basis: var(--ac-dialog-offset);\n min-height: ${MIN_GAP};\n }\n\n &::before {\n flex-grow: 0;\n }\n\n &::after {\n flex-grow: 1;\n }\n\n ${BoxSizingStyle}\n`;\n\nStyledDialogViewport.displayName = \"StyledDialogViewport\";\n\nexport const StyledDialog = styled.div<{\n $maxWidth: number;\n $height?: string;\n}>`\n display: flex;\n flex-direction: column;\n flex: 0 0 auto;\n pointer-events: auto;\n width: 100%;\n max-width: ${(props) => props.$maxWidth}px;\n max-height: ${MAX_DIALOG_HEIGHT};\n background-color: var(--page-paper-main);\n color: var(--color-theme-900);\n box-shadow: var(--shadow-primary);\n border-radius: 8px;\n position: relative;\n transition: max-width 0.2s ease, height 0.2s ease;\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n\n ${(props) =>\n props.$height &&\n css`\n height: ${props.$height};\n `}\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\n\nStyledDialog.displayName = \"StyledDialog\";\n\nexport const StyledDialogTitle = styled.div`\n padding: 20px 30px;\n flex: 0 0 auto;\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\nStyledDialogTitle.displayName = \"StyledDialogTitle\";\n\n// The close button hangs 8px into the title padding, so it sits nearer the dialog edge than the\n// heading does. The bar reserves the rest, which keeps the gap to the heading unchanged.\nconst CLOSE_OFFSET = 8;\nconst CLOSE_RESERVE = 44 - CLOSE_OFFSET;\n\n// The header is as tall as its heading, with or without a close button.\nexport const StyledDialogTitleBar = styled.div`\n position: relative;\n display: flex;\n align-items: center;\n padding-right: ${CLOSE_RESERVE}px;\n`;\nStyledDialogTitleBar.displayName = \"StyledDialogTitleBar\";\n\nexport const StyledDialogTitleClose = styled.div`\n position: absolute;\n right: -${CLOSE_OFFSET}px;\n top: 50%;\n transform: translateY(-50%);\n line-height: 0;\n`;\nStyledDialogTitleClose.displayName = \"StyledDialogTitleClose\";\n\nexport const StyledDialogContent = styled.div<{ $scroll: boolean }>`\n padding: 20px 30px;\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: ${(props) => (props.$scroll ? \"auto\" : \"visible\")};\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\nStyledDialogContent.displayName = \"StyledDialogContent\";\n\nexport const StyledDialogContentDivider = styled.div`\n border-top: 1px solid var(--border-primary);\n height: 1px;\n flex: 0 0 auto;\n`;\nStyledDialogContentDivider.displayName = \"StyledDialogContentDivider\";\n\nexport const StyledDialogActions = styled.div`\n padding: 20px 30px;\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n gap: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AACtB,MAAMC,aAAa,GAAG,EAAE,GAAGD,YAAY;;AAEvC;AACA,OAAO,MAAME,oBAAoB,GAAG3B,MAAM,CAACe,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gFAI3BQ,aAAa,CAC/B;AACDC,oBAAoB,CAACV,WAAW,GAAG,sBAAsB;AAEzD,OAAO,MAAMW,sBAAsB,GAAG5B,MAAM,CAACe,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0FAEpCO,YAAY,CAIvB;AACDG,sBAAsB,CAACX,WAAW,GAAG,wBAAwB;AAE7D,OAAO,MAAMY,mBAAmB,GAAG7B,MAAM,CAACe,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+EAI5BG,KAAK,IAAMA,KAAK,CAACS,OAAO,GAAG,MAAM,GAAG,SAAU,EAE3D1B,SAAS,EACTF,cAAc,CACjB;AACD2B,mBAAmB,CAACZ,WAAW,GAAG,qBAAqB;AAEvD,OAAO,MAAMc,0BAA0B,GAAG/B,MAAM,CAACe,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,4EAInD;AACDa,0BAA0B,CAACd,WAAW,GAAG,4BAA4B;AAErE,OAAO,MAAMe,mBAAmB,GAAGhC,MAAM,CAACe,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,2FAOzCd,SAAS,EACTF,cAAc,CACjB;AACD8B,mBAAmB,CAACf,WAAW,GAAG,qBAAqB","ignoreList":[]}
@@ -1,2 +1,3 @@
1
1
  export * from "./Dialog";
2
+ export * from "./DialogContext";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./Dialog";
2
+ export * from "./DialogContext";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/Dialog/index.ts"],"sourcesContent":["export * from \"./Dialog\";\n"],"mappings":"AAAA,cAAc,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/Dialog/index.ts"],"sourcesContent":["export * from \"./Dialog\";\nexport * from \"./DialogContext\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,iBAAiB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,YAAY,EAIb,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,MAAM;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,KAAK,KAAA,KAAK,IAAI,CAAC;CAClC;AAQD,eAAO,MAAM,KAAK,sHAuGjB,CAAC"}
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,YAAY,EAIb,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,MAAM;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,KAAK,KAAA,KAAK,IAAI,CAAC;CAClC;AAQD,eAAO,MAAM,KAAK,sHAwGjB,CAAC"}
@@ -70,11 +70,12 @@ export const Modal = /*#__PURE__*/forwardRef((_ref, ref) => {
70
70
  props = {
71
71
  onEnter: createChainedFunction(handleEnter, children.props.onEnter),
72
72
  onExited: createChainedFunction(handleExited, children.props.onExited),
73
- in: open
73
+ in: open,
74
+ forceClose: handleClose
74
75
  };
75
76
  }
76
77
  return props;
77
- }, [children, handleEnter, handleExited, hasTransition, open]);
78
+ }, [children, handleClose, handleEnter, handleExited, hasTransition, open]);
78
79
  if (!open && (!hasTransition || exited)) {
79
80
  return null;
80
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","names":["React","forwardRef","useRef","cloneElement","useMemo","useCallback","useState","useEffect","createChainedFunction","useForkRef","Overlay","Window","getHasTransition","children","props","Object","prototype","hasOwnProperty","call","Modal","_ref","ref","_ref$disableFocusLock","disableFocusLock","_ref$disableScrollLoc","disableScrollLock","_ref$disableBackgroun","disableBackgroundClick","_ref$disableBackgroun2","disableBackgroundColor","_ref$disableCloseOnEs","disableCloseOnEsc","_ref$open","open","defaultOpen","onClose","onClickOutside","rest","_objectWithoutPropertiesLoose","_excluded","_useState","setOpen","_useState2","exited","setExited","innerRef","handleRef","hasTransition","handleClose","handleBackgroundClick","event","preventDefault","handleEnter","handleExited","childProps","onEnter","onExited","in","createElement","_extends","onClick","displayName"],"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n useRef,\n cloneElement,\n useMemo,\n useCallback,\n ReactElement,\n useState,\n useEffect,\n MouseEvent,\n} from \"react\";\n\nimport createChainedFunction from \"../../utils/createChainedFunction\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport { Overlay } from \"../Overlay\";\nimport { Window } from \"../Window\";\n\nexport interface IModal {\n disableFocusLock?: boolean;\n disableScrollLock?: boolean;\n open?: boolean;\n disableBackgroundClick?: boolean;\n disableCloseOnEsc?: boolean;\n disableBackgroundColor?: boolean;\n onClose?: () => void;\n children: ReactElement;\n onClickOutside?: (event) => void;\n}\n\nconst getHasTransition = (children): boolean => {\n return children.props\n ? Object.prototype.hasOwnProperty.call(children.props, \"in\")\n : false;\n};\n\nexport const Modal = forwardRef<\n HTMLDivElement,\n IModal & HTMLAttributes<HTMLDivElement>\n>(\n (\n {\n children,\n disableFocusLock = false,\n disableScrollLock = false,\n disableBackgroundClick = false,\n disableBackgroundColor = false,\n disableCloseOnEsc = false,\n open: defaultOpen = false,\n onClose,\n onClickOutside,\n ...rest\n },\n ref\n ) => {\n const [open, setOpen] = useState(defaultOpen);\n const [exited, setExited] = useState(true);\n const innerRef = useRef<HTMLDivElement>(null);\n const handleRef = useForkRef(innerRef, ref);\n\n const hasTransition = useMemo(() => {\n return getHasTransition(children);\n }, [children]);\n\n useEffect(() => {\n setOpen(defaultOpen);\n }, [defaultOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n if (!hasTransition) {\n typeof onClose === \"function\" && onClose();\n }\n }, [hasTransition, onClose]);\n\n const handleBackgroundClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n if (!disableBackgroundClick) {\n event.preventDefault();\n return handleClose();\n }\n\n if (onClickOutside) {\n onClickOutside(event);\n }\n },\n [disableBackgroundClick, onClickOutside, handleClose]\n );\n\n const handleEnter = useCallback(() => {\n setExited(false);\n }, []);\n\n const handleExited = useCallback(() => {\n setExited(true);\n typeof onClose === \"function\" && onClose();\n }, [onClose]);\n\n const childProps = useMemo(() => {\n let props = {};\n\n // It's a Transition like component\n if (hasTransition && children) {\n props = {\n onEnter: createChainedFunction(handleEnter, children.props.onEnter),\n onExited: createChainedFunction(\n handleExited,\n children.props.onExited\n ),\n in: open,\n };\n }\n\n return props;\n }, [children, handleEnter, handleExited, hasTransition, open]);\n\n if (!open && (!hasTransition || exited)) {\n return null;\n }\n\n return (\n <Window\n {...rest}\n ref={handleRef}\n onClose={handleClose}\n disableFocusLock={disableFocusLock}\n disableScrollLock={disableScrollLock}\n disableCloseOnEsc={disableCloseOnEsc}\n >\n {open ? (\n <Overlay\n onClick={handleBackgroundClick}\n disableBackgroundColor={disableBackgroundColor}\n />\n ) : null}\n {cloneElement(children, childProps)}\n </Window>\n );\n }\n);\n\nModal.displayName = \"Modal\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EAEVC,MAAM,EACNC,YAAY,EACZC,OAAO,EACPC,WAAW,EAEXC,QAAQ,EACRC,SAAS,QAEJ,OAAO;AAEd,OAAOC,qBAAqB,MAAM,mCAAmC;AACrE,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,OAAO,QAAQ,YAAY;AACpC,SAASC,MAAM,QAAQ,WAAW;AAclC,MAAMC,gBAAgB,GAAIC,QAAQ,IAAc;EAC9C,OAAOA,QAAQ,CAACC,KAAK,GACjBC,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACL,QAAQ,CAACC,KAAK,EAAE,IAAI,CAAC,GAC1D,KAAK;AACX,CAAC;AAED,OAAO,MAAMK,KAAK,gBAAGlB,UAAU,CAI7B,CAAAmB,IAAA,EAaEC,GAAG,KACA;EAAA,IAZDR,QAAQ,GAAAO,IAAA,CAARP,QAAQ;IAAAS,qBAAA,GAAAF,IAAA,CACRG,gBAAgB;IAAhBA,gBAAgB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IAAAE,qBAAA,GAAAJ,IAAA,CAC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AEd,IAAI,CAAC,CAAC;EAE9D,IAAI,CAACA,IAAI,KAAK,CAACc,aAAa,IAAIJ,MAAM,CAAC,EAAE;IACvC,OAAO,IAAI;EACb;EAEA,oBACE3C,KAAA,CAAA0D,aAAA,CAAC/C,MAAM,EAAAgD,QAAA,KACDtB,IAAI;IACRhB,GAAG,EAAEyB,SAAU;IACfX,OAAO,EAAEa,WAAY;IACrBzB,gBAAgB,EAAEA,gBAAiB;IACnCE,iBAAiB,EAAEA,iBAAkB;IACrCM,iBAAiB,EAAEA;EAAkB,IAEpCE,IAAI,gBACHjC,KAAA,CAAA0D,aAAA,CAAChD,OAAO;IACNkD,OAAO,EAAEX,qBAAsB;IAC/BpB,sBAAsB,EAAEA;EAAuB,CAChD,CAAC,GACA,IAAI,eACP1B,YAAY,CAACU,QAAQ,EAAEyC,UAAU,CAC5B,CAAC;AAEb,CACF,CAAC;AAEDnC,KAAK,CAAC0C,WAAW,GAAG,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"Modal.js","names":["React","forwardRef","useRef","cloneElement","useMemo","useCallback","useState","useEffect","createChainedFunction","useForkRef","Overlay","Window","getHasTransition","children","props","Object","prototype","hasOwnProperty","call","Modal","_ref","ref","_ref$disableFocusLock","disableFocusLock","_ref$disableScrollLoc","disableScrollLock","_ref$disableBackgroun","disableBackgroundClick","_ref$disableBackgroun2","disableBackgroundColor","_ref$disableCloseOnEs","disableCloseOnEsc","_ref$open","open","defaultOpen","onClose","onClickOutside","rest","_objectWithoutPropertiesLoose","_excluded","_useState","setOpen","_useState2","exited","setExited","innerRef","handleRef","hasTransition","handleClose","handleBackgroundClick","event","preventDefault","handleEnter","handleExited","childProps","onEnter","onExited","in","forceClose","createElement","_extends","onClick","displayName"],"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n useRef,\n cloneElement,\n useMemo,\n useCallback,\n ReactElement,\n useState,\n useEffect,\n MouseEvent,\n} from \"react\";\n\nimport createChainedFunction from \"../../utils/createChainedFunction\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport { Overlay } from \"../Overlay\";\nimport { Window } from \"../Window\";\n\nexport interface IModal {\n disableFocusLock?: boolean;\n disableScrollLock?: boolean;\n open?: boolean;\n disableBackgroundClick?: boolean;\n disableCloseOnEsc?: boolean;\n disableBackgroundColor?: boolean;\n onClose?: () => void;\n children: ReactElement;\n onClickOutside?: (event) => void;\n}\n\nconst getHasTransition = (children): boolean => {\n return children.props\n ? Object.prototype.hasOwnProperty.call(children.props, \"in\")\n : false;\n};\n\nexport const Modal = forwardRef<\n HTMLDivElement,\n IModal & HTMLAttributes<HTMLDivElement>\n>(\n (\n {\n children,\n disableFocusLock = false,\n disableScrollLock = false,\n disableBackgroundClick = false,\n disableBackgroundColor = false,\n disableCloseOnEsc = false,\n open: defaultOpen = false,\n onClose,\n onClickOutside,\n ...rest\n },\n ref\n ) => {\n const [open, setOpen] = useState(defaultOpen);\n const [exited, setExited] = useState(true);\n const innerRef = useRef<HTMLDivElement>(null);\n const handleRef = useForkRef(innerRef, ref);\n\n const hasTransition = useMemo(() => {\n return getHasTransition(children);\n }, [children]);\n\n useEffect(() => {\n setOpen(defaultOpen);\n }, [defaultOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n if (!hasTransition) {\n typeof onClose === \"function\" && onClose();\n }\n }, [hasTransition, onClose]);\n\n const handleBackgroundClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n if (!disableBackgroundClick) {\n event.preventDefault();\n return handleClose();\n }\n\n if (onClickOutside) {\n onClickOutside(event);\n }\n },\n [disableBackgroundClick, onClickOutside, handleClose]\n );\n\n const handleEnter = useCallback(() => {\n setExited(false);\n }, []);\n\n const handleExited = useCallback(() => {\n setExited(true);\n typeof onClose === \"function\" && onClose();\n }, [onClose]);\n\n const childProps = useMemo(() => {\n let props = {};\n\n // It's a Transition like component\n if (hasTransition && children) {\n props = {\n onEnter: createChainedFunction(handleEnter, children.props.onEnter),\n onExited: createChainedFunction(\n handleExited,\n children.props.onExited\n ),\n in: open,\n forceClose: handleClose,\n };\n }\n\n return props;\n }, [children, handleClose, handleEnter, handleExited, hasTransition, open]);\n\n if (!open && (!hasTransition || exited)) {\n return null;\n }\n\n return (\n <Window\n {...rest}\n ref={handleRef}\n onClose={handleClose}\n disableFocusLock={disableFocusLock}\n disableScrollLock={disableScrollLock}\n disableCloseOnEsc={disableCloseOnEsc}\n >\n {open ? (\n <Overlay\n onClick={handleBackgroundClick}\n disableBackgroundColor={disableBackgroundColor}\n />\n ) : null}\n {cloneElement(children, childProps)}\n </Window>\n );\n }\n);\n\nModal.displayName = \"Modal\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EAEVC,MAAM,EACNC,YAAY,EACZC,OAAO,EACPC,WAAW,EAEXC,QAAQ,EACRC,SAAS,QAEJ,OAAO;AAEd,OAAOC,qBAAqB,MAAM,mCAAmC;AACrE,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,OAAO,QAAQ,YAAY;AACpC,SAASC,MAAM,QAAQ,WAAW;AAclC,MAAMC,gBAAgB,GAAIC,QAAQ,IAAc;EAC9C,OAAOA,QAAQ,CAACC,KAAK,GACjBC,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACL,QAAQ,CAACC,KAAK,EAAE,IAAI,CAAC,GAC1D,KAAK;AACX,CAAC;AAED,OAAO,MAAMK,KAAK,gBAAGlB,UAAU,CAI7B,CAAAmB,IAAA,EAaEC,GAAG,KACA;EAAA,IAZDR,QAAQ,GAAAO,IAAA,CAARP,QAAQ;IAAAS,qBAAA,GAAAF,IAAA,CACRG,gBAAgB;IAAhBA,gBAAgB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IAAAE,qBAAA,GAAAJ,IAAA,CACxBK,iBAAiB;IAAjBA,iBAAiB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IAAAE,qBAAA,GAAAN,IAAA,CACzBO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,IAAIJ,MAAM,CAAC,EAAE;IACvC,OAAO,IAAI;EACb;EAEA,oBACE3C,KAAA,CAAA2D,aAAA,CAAChD,MAAM,EAAAiD,QAAA,KACDvB,IAAI;IACRhB,GAAG,EAAEyB,SAAU;IACfX,OAAO,EAAEa,WAAY;IACrBzB,gBAAgB,EAAEA,gBAAiB;IACnCE,iBAAiB,EAAEA,iBAAkB;IACrCM,iBAAiB,EAAEA;EAAkB,IAEpCE,IAAI,gBACHjC,KAAA,CAAA2D,aAAA,CAACjD,OAAO;IACNmD,OAAO,EAAEZ,qBAAsB;IAC/BpB,sBAAsB,EAAEA;EAAuB,CAChD,CAAC,GACA,IAAI,eACP1B,YAAY,CAACU,QAAQ,EAAEyC,UAAU,CAC5B,CAAC;AAEb,CACF,CAAC;AAEDnC,KAAK,CAAC2C,WAAW,GAAG,OAAO","ignoreList":[]}
@@ -1,6 +1,9 @@
1
1
  import React, { CSSProperties, ReactNode, HTMLAttributes } from "react";
2
- import { PositioningStrategy } from "@popperjs/core";
2
+ import { Modifier, PositioningStrategy } from "@popperjs/core";
3
3
  import { Placement } from ".";
4
+ export type PopperModifier = Partial<Modifier<string, {
5
+ [key: string]: unknown;
6
+ }>>;
4
7
  interface TransitionProps {
5
8
  in: boolean;
6
9
  onEnter: () => void;
@@ -25,6 +28,8 @@ interface PopperProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
25
28
  strategy?: PositioningStrategy;
26
29
  /** After Write callback */
27
30
  afterWrite?: (...args: any[]) => void;
31
+ /** Extra Popper.js modifiers, merged with the built-in ones */
32
+ modifiers?: PopperModifier[];
28
33
  /** Component children */
29
34
  children?: ReactNode | React.FC<Partial<IChildProps>>;
30
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../../../../src/components/Popper/Popper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,aAAa,EACb,SAAS,EACT,cAAc,EACf,MAAM,OAAO,CAAC;A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