@activecollab/components 2.0.435 → 2.0.437

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 (95) 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/Transitions/Fade/Fade.js +11 -2
  20. package/dist/cjs/components/Transitions/Fade/Fade.js.map +1 -1
  21. package/dist/cjs/components/Transitions/SlideFromTop/SlideFromTop.js +46 -30
  22. package/dist/cjs/components/Transitions/SlideFromTop/SlideFromTop.js.map +1 -1
  23. package/dist/cjs/components/Wizard/Step.js +4 -1
  24. package/dist/cjs/components/Wizard/Step.js.map +1 -1
  25. package/dist/cjs/components/Wizard/Wizard.js +14 -2
  26. package/dist/cjs/components/Wizard/Wizard.js.map +1 -1
  27. package/dist/cjs/presentation/shared/ConnectRepositoryDialog.js +0 -3
  28. package/dist/cjs/presentation/shared/ConnectRepositoryDialog.js.map +1 -1
  29. package/dist/cjs/presentation/shared/LinkBranchOrPullRequestDialog.js +0 -3
  30. package/dist/cjs/presentation/shared/LinkBranchOrPullRequestDialog.js.map +1 -1
  31. package/dist/cjs/presentation/shared/TwoFactorDialogs.js +0 -9
  32. package/dist/cjs/presentation/shared/TwoFactorDialogs.js.map +1 -1
  33. package/dist/esm/components/ConfirmDialog/ConfirmDialog.d.ts +3 -0
  34. package/dist/esm/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
  35. package/dist/esm/components/ConfirmDialog/ConfirmDialog.js +6 -5
  36. package/dist/esm/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
  37. package/dist/esm/components/Dialog/Dialog.d.ts +7 -2
  38. package/dist/esm/components/Dialog/Dialog.d.ts.map +1 -1
  39. package/dist/esm/components/Dialog/Dialog.js +65 -48
  40. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  41. package/dist/esm/components/Dialog/DialogActions.d.ts.map +1 -1
  42. package/dist/esm/components/Dialog/DialogActions.js +10 -5
  43. package/dist/esm/components/Dialog/DialogActions.js.map +1 -1
  44. package/dist/esm/components/Dialog/DialogContent.d.ts +5 -1
  45. package/dist/esm/components/Dialog/DialogContent.d.ts.map +1 -1
  46. package/dist/esm/components/Dialog/DialogContent.js +4 -5
  47. package/dist/esm/components/Dialog/DialogContent.js.map +1 -1
  48. package/dist/esm/components/Dialog/DialogContext.d.ts +11 -1
  49. package/dist/esm/components/Dialog/DialogContext.d.ts.map +1 -1
  50. package/dist/esm/components/Dialog/DialogContext.js +10 -8
  51. package/dist/esm/components/Dialog/DialogContext.js.map +1 -1
  52. package/dist/esm/components/Dialog/DialogTitle.d.ts +4 -1
  53. package/dist/esm/components/Dialog/DialogTitle.d.ts.map +1 -1
  54. package/dist/esm/components/Dialog/DialogTitle.js +20 -6
  55. package/dist/esm/components/Dialog/DialogTitle.js.map +1 -1
  56. package/dist/esm/components/Dialog/Styles.d.ts +19 -2
  57. package/dist/esm/components/Dialog/Styles.d.ts.map +1 -1
  58. package/dist/esm/components/Dialog/Styles.js +47 -11
  59. package/dist/esm/components/Dialog/Styles.js.map +1 -1
  60. package/dist/esm/components/Dialog/index.d.ts +1 -0
  61. package/dist/esm/components/Dialog/index.d.ts.map +1 -1
  62. package/dist/esm/components/Dialog/index.js +1 -0
  63. package/dist/esm/components/Dialog/index.js.map +1 -1
  64. package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
  65. package/dist/esm/components/Modal/Modal.js +3 -2
  66. package/dist/esm/components/Modal/Modal.js.map +1 -1
  67. package/dist/esm/components/Transitions/Fade/Fade.d.ts.map +1 -1
  68. package/dist/esm/components/Transitions/Fade/Fade.js +11 -2
  69. package/dist/esm/components/Transitions/Fade/Fade.js.map +1 -1
  70. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.d.ts +2 -0
  71. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.d.ts.map +1 -1
  72. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.js +46 -30
  73. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.js.map +1 -1
  74. package/dist/esm/components/Wizard/Step.d.ts +4 -0
  75. package/dist/esm/components/Wizard/Step.d.ts.map +1 -1
  76. package/dist/esm/components/Wizard/Step.js +4 -1
  77. package/dist/esm/components/Wizard/Step.js.map +1 -1
  78. package/dist/esm/components/Wizard/Wizard.d.ts +3 -0
  79. package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
  80. package/dist/esm/components/Wizard/Wizard.js +14 -2
  81. package/dist/esm/components/Wizard/Wizard.js.map +1 -1
  82. package/dist/esm/presentation/shared/ConnectRepositoryDialog.d.ts.map +1 -1
  83. package/dist/esm/presentation/shared/ConnectRepositoryDialog.js +0 -3
  84. package/dist/esm/presentation/shared/ConnectRepositoryDialog.js.map +1 -1
  85. package/dist/esm/presentation/shared/LinkBranchOrPullRequestDialog.d.ts.map +1 -1
  86. package/dist/esm/presentation/shared/LinkBranchOrPullRequestDialog.js +0 -3
  87. package/dist/esm/presentation/shared/LinkBranchOrPullRequestDialog.js.map +1 -1
  88. package/dist/esm/presentation/shared/TwoFactorDialogs.d.ts.map +1 -1
  89. package/dist/esm/presentation/shared/TwoFactorDialogs.js +0 -9
  90. package/dist/esm/presentation/shared/TwoFactorDialogs.js.map +1 -1
  91. package/dist/index.js +257 -116
  92. package/dist/index.js.map +1 -1
  93. package/dist/index.min.js +1 -1
  94. package/dist/index.min.js.map +1 -1
  95. package/package.json +1 -1
@@ -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,OAAO;AAEhD,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SACEC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,QACjB,UAAU;AACjB,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,eAAe,QAAQ,UAAU;AAC1C,SAASC,OAAO,QAAQ,gCAAgC;AAUxD,OAAO,MAAMC,WAAW,GAAGC,IAAA,IAOgB;EAAA,IAAAC,oBAAA;EAAA,IANzCC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAAC,qBAAA,GAAAJ,IAAA,CACTK,qBAAqB;IAArBA,qBAAqB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IAC7BE,OAAO,GAAAN,IAAA,CAAPM,OAAO;IAAAC,eAAA,GAAAP,IAAA,CACPQ,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,OAAO,GAAAA,eAAA;IACjBE,IAAI,GAAAC,6BAAA,CAAAV,IAAA,EAAAW,SAAA;EAEP,MAAMC,MAAM,GAAGpB,gBAAgB,CAAC,CAAC;EACjC,MAAMqB,OAAO,GAAGR,qBAAqB,GACnCH,QAAQ,gBAERZ,KAAA,CAAAwB,aAAA,CAAChB,OAAO,QAAEI,QAAkB,CAC7B;;EAED;EACA;EACA,MAAMa,WAAW,IAAAd,oBAAA,GAAGW,MAAM,oBAANA,MAAM,CAAEI,YAAY,YAAAf,oBAAA,GAAIK,OAAO;EAEnD,oBACEhB,KAAA,CAAAwB,aAAA,CAACrB,iBAAiB,EAAAwB,QAAA;IAChBd,SAAS,EAAEZ,UAAU,CAAC,wBAAwB,EAAEY,SAAS;EAAE,GACvDM,IAAI,GAEPH,OAAO,gBACNhB,KAAA,CAAAwB,aAAA,CAACpB,oBAAoB,QAClBmB,OAAO,eACRvB,KAAA,CAAAwB,aAAA,CAACnB,sBAAsB,qBACrBL,KAAA,CAAAwB,aAAA,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: 12px;\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\nStyledDialogActions.displayName = \"StyledDialogActions\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,SAAS,QAAQ,cAAc;AAExC,OAAO,MAAMC,WAAW,GAAG;EACzBC,CAAC,EAAE,GAAG;EACNC,CAAC,EAAE,GAAG;EACNC,CAAC,EAAE,GAAG;EACNC,EAAE,EAAE,GAAG;EACPC,GAAG,EAAE,IAAI;EACTC,IAAI,EAAE;AACR,CAAU;AAIV,MAAMC,OAAO,GAAG,OAAO;AACvB,MAAMC,iBAAiB,GAAG,MAAM;;AAEhC;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGd,MAAM,CAACe,GAAG,CA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1B,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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AEDnC,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,OA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
1
- {"version":3,"file":"Fade.d.ts","sourceRoot":"","sources":["../../../../../src/components/Transitions/Fade/Fade.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,YAAY,EAAgB,MAAM,OAAO,CAAC;AAG9D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,UAAU,UAAW,SAAQ,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC;IAC3D,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgBD,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,UAAU,CAoB/B,CAAC"}
1
+ {"version":3,"file":"Fade.d.ts","sourceRoot":"","sources":["../../../../../src/components/Transitions/Fade/Fade.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,YAAY,EAAgB,MAAM,OAAO,CAAC;AAG9D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,UAAU,UAAW,SAAQ,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC;IAC3D,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgBD,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,UAAU,CAqC/B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["in", "children", "style", "timeout"];
3
+ const _excluded = ["in", "children", "style", "timeout", "onEnter"];
4
4
  import React, { cloneElement } from "react";
5
5
  import { Transition } from "react-transition-group";
6
6
  const defaultStyle = duration => ({
@@ -28,11 +28,20 @@ export const Fade = _ref => {
28
28
  style = _ref.style,
29
29
  _ref$timeout = _ref.timeout,
30
30
  timeout = _ref$timeout === void 0 ? 500 : _ref$timeout,
31
+ onEnter = _ref.onEnter,
31
32
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
33
+ // Same forced layout as SlideFromTop: without it the starting opacity never lands in the DOM.
34
+ const handleEnter = (node, isAppearing) => {
35
+ if (node) {
36
+ void node.offsetHeight;
37
+ }
38
+ onEnter == null || onEnter(node, isAppearing);
39
+ };
32
40
  return /*#__PURE__*/React.createElement(Transition, _extends({
33
41
  appear: true,
34
42
  in: inProp,
35
- timeout: timeout
43
+ timeout: timeout,
44
+ onEnter: handleEnter
36
45
  }, rest), state => {
37
46
  return /*#__PURE__*/cloneElement(children, {
38
47
  style: _extends({
@@ -1 +1 @@
1
- {"version":3,"file":"Fade.js","names":["React","cloneElement","Transition","defaultStyle","duration","transition","opacity","transitionStyles","entering","entered","exiting","exited","Fade","_ref","_ref$in","in","inProp","children","style","_ref$timeout","timeout","rest","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","appear","state","visibility","undefined","props","displayName"],"sources":["../../../../../src/components/Transitions/Fade/Fade.tsx"],"sourcesContent":["import React, { FC, ReactElement, cloneElement } from \"react\";\nimport { Transition } from \"react-transition-group\";\n\nimport { TransitionProps } from \"../types\";\n\ninterface IFadeProps extends Omit<TransitionProps, \"timeout\"> {\n children: ReactElement;\n timeout?: number;\n}\n\nconst defaultStyle = (\n duration: number\n): Partial<{ transition: string; opacity: number }> => ({\n transition: `all ${duration}ms ease-in-out`,\n opacity: 0,\n});\n\nconst transitionStyles = {\n entering: { opacity: 1 },\n entered: { opacity: 1 },\n exiting: { opacity: 0 },\n exited: { opacity: 0 },\n};\n\nexport const Fade: FC<IFadeProps> = ({\n in: inProp = false,\n children,\n style,\n timeout = 500,\n ...rest\n}) => (\n <Transition appear in={inProp} timeout={timeout} {...rest}>\n {(state): ReactElement => {\n return cloneElement(children, {\n style: {\n visibility: state === \"exited\" && !inProp ? \"hidden\" : undefined,\n ...defaultStyle(timeout),\n ...transitionStyles[state],\n ...style,\n ...children.props.style,\n },\n });\n }}\n </Transition>\n);\n\nFade.displayName = \"Fade\";\n"],"mappings":";;;AAA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C,CAAC;EACJ,CACU,CAAC;AAAA,CACd;AAEDN,IAAI,CAACmB,WAAW,GAAG,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"Fade.js","names":["React","cloneElement","Transition","defaultStyle","duration","transition","opacity","transitionStyles","entering","entered","exiting","exited","Fade","_ref","_ref$in","in","inProp","children","style","_ref$timeout","timeout","onEnter","rest","_objectWithoutPropertiesLoose","_excluded","handleEnter","node","isAppearing","offsetHeight","createElement","_extends","appear","state","visibility","undefined","props","displayName"],"sources":["../../../../../src/components/Transitions/Fade/Fade.tsx"],"sourcesContent":["import React, { FC, ReactElement, cloneElement } from \"react\";\nimport { Transition } from \"react-transition-group\";\n\nimport { TransitionProps } from \"../types\";\n\ninterface IFadeProps extends Omit<TransitionProps, \"timeout\"> {\n children: ReactElement;\n timeout?: number;\n}\n\nconst defaultStyle = (\n duration: number\n): Partial<{ transition: string; opacity: number }> => ({\n transition: `all ${duration}ms ease-in-out`,\n opacity: 0,\n});\n\nconst transitionStyles = {\n entering: { opacity: 1 },\n entered: { opacity: 1 },\n exiting: { opacity: 0 },\n exited: { opacity: 0 },\n};\n\nexport const Fade: FC<IFadeProps> = ({\n in: inProp = false,\n children,\n style,\n timeout = 500,\n onEnter,\n ...rest\n}) => {\n // Same forced layout as SlideFromTop: without it the starting opacity never lands in the DOM.\n const handleEnter = (node: HTMLElement, isAppearing: boolean) => {\n if (node) {\n void node.offsetHeight;\n }\n onEnter?.(node, isAppearing);\n };\n\n return (\n <Transition\n appear\n in={inProp}\n timeout={timeout}\n onEnter={handleEnter}\n {...rest}\n >\n {(state): ReactElement => {\n return cloneElement(children, {\n style: {\n visibility: state === \"exited\" && !inProp ? \"hidden\" : undefined,\n ...defaultStyle(timeout),\n ...transitionStyles[state],\n ...style,\n ...children.props.style,\n },\n });\n }}\n </Transition>\n );\n};\n\nFade.displayName = \"Fade\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAsBC,YAAY,QAAQ,OAAO;AAC7D,SAASC,UAAU,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AU,EAAED,KAAK,KAAK,QAAQ,IAAI,CAAChB,MAAM,GAAG,QAAQ,GAAGkB;MAAS,GAC7D/B,YAAY,CAACiB,OAAO,CAAC,EACrBb,gBAAgB,CAACyB,KAAK,CAAC,EACvBd,KAAK,EACLD,QAAQ,CAACkB,KAAK,CAACjB,KAAK;IAE3B,CAAC,CAAC;EACJ,CACU,CAAC;AAEjB,CAAC;AAEDN,IAAI,CAACwB,WAAW,GAAG,MAAM","ignoreList":[]}
@@ -3,6 +3,8 @@ import { TransitionProps } from "../types";
3
3
  interface ISlideFromTop extends Omit<TransitionProps, "timeout"> {
4
4
  children: ReactElement;
5
5
  timeout?: number;
6
+ /** How far above its resting place the element starts. A fixed travel, not a share of its height. */
7
+ distance?: number;
6
8
  }
7
9
  export declare const SlideFromTop: FC<ISlideFromTop>;
8
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"SlideFromTop.d.ts","sourceRoot":"","sources":["../../../../../src/components/Transitions/SlideFromTop/SlideFromTop.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,YAAY,EAAgB,MAAM,OAAO,CAAC;AAG9D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,UAAU,aAAc,SAAQ,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC;IAC9D,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgCD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,aAAa,CA2B1C,CAAC"}
1
+ {"version":3,"file":"SlideFromTop.d.ts","sourceRoot":"","sources":["../../../../../src/components/Transitions/SlideFromTop/SlideFromTop.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,YAAY,EAAgB,MAAM,OAAO,CAAC;AAG9D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,UAAU,aAAc,SAAQ,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC;IAC9D,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qGAAqG;IACrG,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA6BD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,aAAa,CAyC1C,CAAC"}
@@ -1,33 +1,37 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import React, { cloneElement } from "react";
3
3
  import { Transition } from "react-transition-group";
4
- const defaultStyle = {
5
- transitionProperty: "opacity, transform",
6
- transitionTimingFunction: "linear ease-out",
7
- transform: "translateY(-100%)",
8
- opacity: 0
9
- };
10
- const transitionStyles = {
11
- entering: {
12
- opacity: 1,
13
- transform: "translateY(0)",
14
- transitionDuration: ".3s"
15
- },
16
- entered: {
17
- opacity: 1,
18
- transform: "translateY(0)",
19
- transitionDuration: ".3s"
20
- },
21
- exiting: {
22
- opacity: 0,
23
- transform: "translateY(-100%)",
24
- transitionDuration: ".2s"
25
- },
26
- exited: {
27
- opacity: 0,
28
- transform: "translateY(-100%)",
29
- transitionDuration: ".2s"
30
- }
4
+ const DEFAULT_DISTANCE = 25;
5
+ const buildStyles = distance => {
6
+ const away = "translateY(-" + distance + "px)";
7
+ return {
8
+ base: {
9
+ transitionProperty: "opacity, transform",
10
+ transitionTimingFunction: "ease-out",
11
+ transform: away,
12
+ opacity: 0
13
+ },
14
+ entering: {
15
+ opacity: 1,
16
+ transform: "translateY(0)",
17
+ transitionDuration: ".3s"
18
+ },
19
+ entered: {
20
+ opacity: 1,
21
+ transform: "translateY(0)",
22
+ transitionDuration: ".3s"
23
+ },
24
+ exiting: {
25
+ opacity: 0,
26
+ transform: away,
27
+ transitionDuration: ".2s"
28
+ },
29
+ exited: {
30
+ opacity: 0,
31
+ transform: away,
32
+ transitionDuration: ".2s"
33
+ }
34
+ };
31
35
  };
32
36
  export const SlideFromTop = _ref => {
33
37
  let _ref$in = _ref.in,
@@ -37,18 +41,30 @@ export const SlideFromTop = _ref => {
37
41
  children = _ref.children,
38
42
  style = _ref.style,
39
43
  _ref$timeout = _ref.timeout,
40
- timeout = _ref$timeout === void 0 ? 400 : _ref$timeout;
44
+ timeout = _ref$timeout === void 0 ? 400 : _ref$timeout,
45
+ _ref$distance = _ref.distance,
46
+ distance = _ref$distance === void 0 ? DEFAULT_DISTANCE : _ref$distance;
47
+ const styles = buildStyles(distance);
48
+
49
+ // React flushes the state change that follows onEnter before the browser paints, so without a
50
+ // forced layout here the element never holds its starting style and the transition is skipped.
51
+ const handleEnter = (node, isAppearing) => {
52
+ if (node) {
53
+ void node.offsetHeight;
54
+ }
55
+ onEnter == null || onEnter(node, isAppearing);
56
+ };
41
57
  return /*#__PURE__*/React.createElement(Transition, {
42
58
  appear: true,
43
59
  in: inProp,
44
60
  timeout: timeout,
45
- onEnter: onEnter,
61
+ onEnter: handleEnter,
46
62
  onExited: onExited
47
63
  }, state => {
48
64
  return /*#__PURE__*/cloneElement(children, {
49
65
  style: _extends({
50
66
  visibility: state === "exited" && !inProp ? "hidden" : undefined
51
- }, defaultStyle, transitionStyles[state], style, children.props.style)
67
+ }, styles.base, styles[state], style, children.props.style)
52
68
  });
53
69
  });
54
70
  };