@elliemae/ds-dialog 2.2.0 → 2.3.0-alpha.3

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 (43) hide show
  1. package/cjs/DSDialog.js +82 -102
  2. package/cjs/DSDialog.js.map +7 -0
  3. package/cjs/DSDialogDatatestid.js +36 -8
  4. package/cjs/DSDialogDatatestid.js.map +7 -0
  5. package/cjs/DSDialogInternalTypes.js +27 -2
  6. package/cjs/DSDialogInternalTypes.js.map +7 -0
  7. package/cjs/DSDialogTypes.js +27 -2
  8. package/cjs/DSDialogTypes.js.map +7 -0
  9. package/cjs/defaultProps.js +38 -11
  10. package/cjs/defaultProps.js.map +7 -0
  11. package/cjs/index.js +94 -24
  12. package/cjs/index.js.map +7 -0
  13. package/cjs/propTypes.js +44 -16
  14. package/cjs/propTypes.js.map +7 -0
  15. package/cjs/styles.js +149 -143
  16. package/cjs/styles.js.map +7 -0
  17. package/cjs/utils.js +50 -30
  18. package/cjs/utils.js.map +7 -0
  19. package/esm/DSDialog.js +50 -82
  20. package/esm/DSDialog.js.map +7 -0
  21. package/esm/DSDialogDatatestid.js +7 -4
  22. package/esm/DSDialogDatatestid.js.map +7 -0
  23. package/esm/DSDialogInternalTypes.js +2 -1
  24. package/esm/DSDialogInternalTypes.js.map +7 -0
  25. package/esm/DSDialogTypes.js +2 -1
  26. package/esm/DSDialogTypes.js.map +7 -0
  27. package/esm/defaultProps.js +8 -6
  28. package/esm/defaultProps.js.map +7 -0
  29. package/esm/index.js +75 -4
  30. package/esm/index.js.map +7 -0
  31. package/esm/propTypes.js +15 -12
  32. package/esm/propTypes.js.map +7 -0
  33. package/esm/styles.js +120 -123
  34. package/esm/styles.js.map +7 -0
  35. package/esm/utils.js +21 -23
  36. package/esm/utils.js.map +7 -0
  37. package/package.json +3 -3
  38. package/types/DSDialog.d.ts +2 -27
  39. package/types/DSDialogInternalTypes.d.ts +4 -4
  40. package/types/index.d.ts +49 -1
  41. package/types/propTypes.d.ts +2 -19
  42. package/types/styles.d.ts +4 -4
  43. package/types/utils.d.ts +6 -6
package/esm/DSDialog.js CHANGED
@@ -1,107 +1,75 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
- import 'core-js/modules/web.dom-collections.iterator.js';
10
- import ReactDOM from 'react-dom';
11
- import { useState, useRef, useCallback, useEffect } from 'react';
12
- import { describe } from 'react-desc';
13
- import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
14
- import { StyledDialogBackground, FixedBody, StyledDialogContainer } from './styles.js';
15
- import { propTypes } from './propTypes.js';
16
- import { defaultProps } from './defaultProps.js';
17
- import { getSpaceProps } from './utils.js';
18
- import { DSDialogDatatestid } from './DSDialogDatatestid.js';
19
- import { jsx } from 'react/jsx-runtime';
20
-
21
- const _excluded = ["children", "isOpen", "onClickOutside", "centered", "size", "removeAutoFocus", "zIndex"];
22
-
23
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24
-
25
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
-
27
- const DSDialog = props => {
28
- var _FixedBody;
29
-
1
+ import * as React from "react";
2
+ import ReactDOM from "react-dom";
3
+ import React2, { useCallback, useRef, useEffect, useState } from "react";
4
+ import {
5
+ useMemoMergePropsWithDefault,
6
+ useValidateTypescriptPropTypes,
7
+ useGetGlobalAttributes,
8
+ describe
9
+ } from "@elliemae/ds-props-helpers";
10
+ import { FixedBody, StyledDialogBackground, StyledDialogContainer } from "./styles";
11
+ import { propTypes } from "./propTypes";
12
+ import { defaultProps } from "./defaultProps";
13
+ import { getSpaceProps } from "./utils";
14
+ import { DSDialogDatatestid } from "./DSDialogDatatestid";
15
+ const DSDialog = (props) => {
30
16
  const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
31
- const [bodyInfo, setBodyInfo] = useState({
32
- overflow: false,
33
- padding: '0px'
34
- });
17
+ const [bodyInfo, setBodyInfo] = useState({ overflow: false, padding: "0px" });
35
18
  useValidateTypescriptPropTypes(propsWithDefault, propTypes);
36
-
37
- const {
38
- children,
39
- isOpen,
40
- onClickOutside,
41
- centered,
42
- size,
43
- removeAutoFocus,
44
- zIndex
45
- } = propsWithDefault,
46
- rest = _objectWithoutProperties(propsWithDefault, _excluded);
47
-
19
+ const { children, isOpen, onClickOutside, centered, size, removeAutoFocus, zIndex, ...rest } = propsWithDefault;
48
20
  const containerRef = useRef(null);
49
- const handleOutsideClick = useCallback(e => {
50
- if (e.target.dataset.portalbg) onClickOutside();
21
+ const handleOutsideClick = useCallback((e) => {
22
+ if (e.target.dataset.portalbg)
23
+ onClickOutside();
51
24
  }, [onClickOutside]);
52
- const handleOnKeyDown = useCallback(e => {
53
- if (e.key === 'Escape') onClickOutside();
25
+ const handleOnKeyDown = useCallback((e) => {
26
+ if (e.key === "Escape")
27
+ onClickOutside();
54
28
  }, [onClickOutside]);
55
29
  useEffect(() => {
56
- var _window$getComputedSt;
57
-
58
- const body = document.getElementsByTagName('body')[0];
59
- const {
60
- offsetHeight,
61
- scrollHeight
62
- } = body;
63
- const padding = (_window$getComputedSt = window.getComputedStyle(body, null)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue('padding-right');
64
- if (!isOpen) return setBodyInfo({
65
- overflow: false,
66
- padding: '0px'
67
- });
30
+ const body = document.getElementsByTagName("body")[0];
31
+ const { offsetHeight, scrollHeight } = body;
32
+ const padding = window.getComputedStyle(body, null)?.getPropertyValue("padding-right");
33
+ if (!isOpen)
34
+ return setBodyInfo({ overflow: false, padding: "0px" });
68
35
  return setBodyInfo({
69
36
  overflow: offsetHeight < scrollHeight,
70
37
  padding
71
38
  });
72
39
  }, [isOpen]);
73
40
  useEffect(() => {
74
- var _containerRef$current;
75
-
76
- if (isOpen && !removeAutoFocus) containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.focus();
41
+ if (isOpen && !removeAutoFocus)
42
+ containerRef?.current?.focus();
77
43
  }, [isOpen, removeAutoFocus]);
78
-
44
+ const globalAttributes = useGetGlobalAttributes(propsWithDefault, { onClick: handleOutsideClick });
79
45
  if (isOpen) {
80
- return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/_jsx(StyledDialogBackground, {
46
+ return ReactDOM.createPortal(/* @__PURE__ */ React2.createElement(StyledDialogBackground, {
81
47
  onClick: handleOutsideClick,
82
48
  "data-portalbg": true,
83
49
  "data-testid": DSDialogDatatestid.BACKGROUND,
84
- zIndex: zIndex
85
- }, void 0, _FixedBody || (_FixedBody = /*#__PURE__*/_jsx(FixedBody, {
86
- bodyInfo: bodyInfo
87
- })), /*#__PURE__*/jsx(StyledDialogContainer, _objectSpread(_objectSpread({
50
+ zIndex,
51
+ ...globalAttributes
52
+ }, /* @__PURE__ */ React2.createElement(FixedBody, {
53
+ bodyInfo
54
+ }), /* @__PURE__ */ React2.createElement(StyledDialogContainer, {
88
55
  role: "dialog",
89
56
  "aria-modal": true,
90
57
  ref: containerRef,
91
- tabIndex: !removeAutoFocus ? 0 : undefined,
92
- onKeyDown: handleOnKeyDown
93
- }, getSpaceProps(rest)), {}, {
94
- size: size,
95
- centered: centered,
96
- "data-testid": DSDialogDatatestid.CONTAINER,
97
- children: children
98
- }))), document.getElementsByTagName('body')[0]);
58
+ tabIndex: !removeAutoFocus ? 0 : void 0,
59
+ onKeyDown: handleOnKeyDown,
60
+ ...getSpaceProps(rest),
61
+ size,
62
+ centered,
63
+ "data-testid": DSDialogDatatestid.CONTAINER
64
+ }, children)), document.getElementsByTagName("body")[0]);
99
65
  }
100
-
101
66
  return null;
102
67
  };
103
-
68
+ DSDialog.propTypes = propTypes;
104
69
  const DSDialogWithSchema = describe(DSDialog);
105
70
  DSDialogWithSchema.propTypes = propTypes;
106
-
107
- export { DSDialog, DSDialogWithSchema };
71
+ export {
72
+ DSDialog,
73
+ DSDialogWithSchema
74
+ };
75
+ //# sourceMappingURL=DSDialog.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSDialog.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import ReactDOM from 'react-dom';\nimport React, { useCallback, useRef, useEffect, useState } from 'react';\nimport {\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n useGetGlobalAttributes,\n describe,\n} from '@elliemae/ds-props-helpers';\nimport { FixedBody, StyledDialogBackground, StyledDialogContainer } from './styles';\nimport { propTypes } from './propTypes';\nimport { defaultProps } from './defaultProps';\nimport { getSpaceProps } from './utils';\nimport { DSDialogDatatestid } from './DSDialogDatatestid';\nimport type { BodyInfoT, DSDialogPropsWithDefaultT } from './DSDialogInternalTypes';\nimport type { DSDialogPropsT } from './DSDialogTypes';\n\nconst DSDialog: React.ComponentType<DSDialogPropsT> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps) as DSDialogPropsWithDefaultT;\n const [bodyInfo, setBodyInfo] = useState<BodyInfoT>({ overflow: false, padding: '0px' });\n\n useValidateTypescriptPropTypes(propsWithDefault, propTypes);\n\n const { children, isOpen, onClickOutside, centered, size, removeAutoFocus, zIndex, ...rest } = propsWithDefault;\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n\n const handleOutsideClick = useCallback(\n (e: React.MouseEvent) => {\n if ((e.target as HTMLDivElement).dataset.portalbg) onClickOutside();\n },\n [onClickOutside],\n );\n\n const handleOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') onClickOutside();\n },\n [onClickOutside],\n );\n\n useEffect(() => {\n const body = document.getElementsByTagName('body')[0];\n const { offsetHeight, scrollHeight } = body;\n const padding = window.getComputedStyle(body, null)?.getPropertyValue('padding-right');\n\n if (!isOpen) return setBodyInfo({ overflow: false, padding: '0px' });\n\n return setBodyInfo({\n overflow: offsetHeight < scrollHeight,\n padding,\n });\n }, [isOpen]);\n\n useEffect(() => {\n if (isOpen && !removeAutoFocus) containerRef?.current?.focus();\n }, [isOpen, removeAutoFocus]);\n\n const globalAttributes = useGetGlobalAttributes(propsWithDefault, { onClick: handleOutsideClick });\n\n if (isOpen) {\n return ReactDOM.createPortal(\n <StyledDialogBackground\n onClick={handleOutsideClick}\n data-portalbg\n data-testid={DSDialogDatatestid.BACKGROUND}\n zIndex={zIndex}\n {...globalAttributes}\n >\n <FixedBody bodyInfo={bodyInfo} />\n <StyledDialogContainer\n role=\"dialog\"\n aria-modal\n ref={containerRef}\n tabIndex={!removeAutoFocus ? 0 : undefined}\n onKeyDown={handleOnKeyDown}\n {...getSpaceProps(rest)}\n size={size}\n centered={centered}\n data-testid={DSDialogDatatestid.CONTAINER}\n >\n {children}\n </StyledDialogContainer>\n </StyledDialogBackground>,\n document.getElementsByTagName('body')[0],\n );\n }\n\n return null;\n};\n\nDSDialog.propTypes = propTypes;\n\nconst DSDialogWithSchema = describe(DSDialog);\nDSDialogWithSchema.propTypes = propTypes;\n\nexport { DSDialog, DSDialogWithSchema };\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AACA;AACA;AACA;AACA;AAIA,MAAM,WAAgD,CAAC,UAAU;AAC/D,QAAM,mBAAmB,6BAA6B,OAAO;AAC7D,QAAM,CAAC,UAAU,eAAe,SAAoB,EAAE,UAAU,OAAO,SAAS;AAEhF,iCAA+B,kBAAkB;AAEjD,QAAM,EAAE,UAAU,QAAQ,gBAAgB,UAAU,MAAM,iBAAiB,WAAW,SAAS;AAE/F,QAAM,eAAe,OAA8B;AAEnD,QAAM,qBAAqB,YACzB,CAAC,MAAwB;AACvB,QAAK,EAAE,OAA0B,QAAQ;AAAU;AAAA,KAErD,CAAC;AAGH,QAAM,kBAAkB,YACtB,CAAC,MAA2B;AAC1B,QAAI,EAAE,QAAQ;AAAU;AAAA,KAE1B,CAAC;AAGH,YAAU,MAAM;AACd,UAAM,OAAO,SAAS,qBAAqB,QAAQ;AACnD,UAAM,EAAE,cAAc,iBAAiB;AACvC,UAAM,UAAU,OAAO,iBAAiB,MAAM,OAAO,iBAAiB;AAEtE,QAAI,CAAC;AAAQ,aAAO,YAAY,EAAE,UAAU,OAAO,SAAS;AAE5D,WAAO,YAAY;AAAA,MACjB,UAAU,eAAe;AAAA,MACzB;AAAA;AAAA,KAED,CAAC;AAEJ,YAAU,MAAM;AACd,QAAI,UAAU,CAAC;AAAiB,oBAAc,SAAS;AAAA,KACtD,CAAC,QAAQ;AAEZ,QAAM,mBAAmB,uBAAuB,kBAAkB,EAAE,SAAS;AAE7E,MAAI,QAAQ;AACV,WAAO,SAAS,aACd,qCAAC,wBAAD;AAAA,MACE,SAAS;AAAA,MACT,iBAAa;AAAA,MACb,eAAa,mBAAmB;AAAA,MAChC;AAAA,SACI;AAAA,OAEJ,qCAAC,WAAD;AAAA,MAAW;AAAA,QACX,qCAAC,uBAAD;AAAA,MACE,MAAK;AAAA,MACL,cAAU;AAAA,MACV,KAAK;AAAA,MACL,UAAU,CAAC,kBAAkB,IAAI;AAAA,MACjC,WAAW;AAAA,SACP,cAAc;AAAA,MAClB;AAAA,MACA;AAAA,MACA,eAAa,mBAAmB;AAAA,OAE/B,YAGL,SAAS,qBAAqB,QAAQ;AAAA;AAI1C,SAAO;AAAA;AAGT,SAAS,YAAY;AAErB,MAAM,qBAAqB,SAAS;AACpC,mBAAmB,YAAY;",
6
+ "names": []
7
+ }
@@ -1,6 +1,9 @@
1
+ import * as React from "react";
1
2
  const DSDialogDatatestid = {
2
- CONTAINER: 'ds-dialog-container',
3
- BACKGROUND: 'ds-dialog-background'
3
+ CONTAINER: "ds-dialog-container",
4
+ BACKGROUND: "ds-dialog-background"
4
5
  };
5
-
6
- export { DSDialogDatatestid };
6
+ export {
7
+ DSDialogDatatestid
8
+ };
9
+ //# sourceMappingURL=DSDialogDatatestid.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSDialogDatatestid.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSDialogDatatestid = {\n CONTAINER: 'ds-dialog-container',\n BACKGROUND: 'ds-dialog-background',\n};\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,YAAY;AAAA;",
6
+ "names": []
7
+ }
@@ -1 +1,2 @@
1
-
1
+ import * as React from "react";
2
+ //# sourceMappingURL=DSDialogInternalTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -1 +1,2 @@
1
-
1
+ import * as React from "react";
2
+ //# sourceMappingURL=DSDialogTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
- import { DSDialogSizes } from './utils.js';
2
-
3
- const noop = () => {};
4
-
1
+ import * as React from "react";
2
+ import { DSDialogSizes } from "./utils";
3
+ const noop = () => {
4
+ };
5
5
  const defaultProps = {
6
6
  isOpen: false,
7
7
  centered: false,
@@ -10,5 +10,7 @@ const defaultProps = {
10
10
  onClickOutside: noop,
11
11
  zIndex: 10
12
12
  };
13
-
14
- export { defaultProps };
13
+ export {
14
+ defaultProps
15
+ };
16
+ //# sourceMappingURL=defaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSDialogSizes } from './utils';\nimport type { DSDialogDefaultPropsT } from './DSDialogInternalTypes';\n\nconst noop = () => {};\n\nexport const defaultProps: DSDialogDefaultPropsT = {\n isOpen: false,\n centered: false,\n size: DSDialogSizes.DEFAULT,\n removeAutoFocus: false,\n onClickOutside: noop,\n zIndex: 10,\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAGA,MAAM,OAAO,MAAM;AAAA;AAEZ,MAAM,eAAsC;AAAA,EACjD,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM,cAAc;AAAA,EACpB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,QAAQ;AAAA;",
6
+ "names": []
7
+ }
package/esm/index.js CHANGED
@@ -1,4 +1,75 @@
1
- export { DSDialog, DSDialogWithSchema } from './DSDialog.js';
2
- export { DSDialogDatatestid } from './DSDialogDatatestid.js';
3
- export { DSDialogSizes } from './utils.js';
4
- export { DSDialogAddon, DSDialogBody, DSDialogDefaultLayout, DSDialogFooter, DSDialogHeader, DSDialogPrimaryMessage, DSDialogSecondaryMessage, DSDialogSeparator, DSDialogTitle } from './styles.js';
1
+ import * as React from "react";
2
+ import { describe } from "react-desc";
3
+ import { globalAttributesPropTypes } from "@elliemae/ds-props-helpers";
4
+ import {
5
+ DSDialogBody,
6
+ DSDialogHeader,
7
+ DSDialogFooter,
8
+ DSDialogSeparator,
9
+ DSDialogTitle,
10
+ DSDialogAddon,
11
+ DSDialogDefaultLayout,
12
+ DSDialogPrimaryMessage,
13
+ DSDialogSecondaryMessage
14
+ } from "./styles";
15
+ DSDialogBody.propTypes = globalAttributesPropTypes;
16
+ DSDialogHeader.propTypes = globalAttributesPropTypes;
17
+ DSDialogFooter.propTypes = globalAttributesPropTypes;
18
+ DSDialogSeparator.propTypes = globalAttributesPropTypes;
19
+ DSDialogTitle.propTypes = globalAttributesPropTypes;
20
+ DSDialogAddon.propTypes = globalAttributesPropTypes;
21
+ DSDialogDefaultLayout.propTypes = globalAttributesPropTypes;
22
+ DSDialogPrimaryMessage.propTypes = globalAttributesPropTypes;
23
+ DSDialogSecondaryMessage.propTypes = globalAttributesPropTypes;
24
+ DSDialogBody.displayName = "DSDialogBody";
25
+ DSDialogHeader.displayName = "DSDialogHeader";
26
+ DSDialogFooter.displayName = "DSDialogFooter";
27
+ DSDialogSeparator.displayName = "DSDialogSeparator";
28
+ DSDialogTitle.displayName = "DSDialogTitle";
29
+ DSDialogAddon.displayName = "DSDialogAddon";
30
+ DSDialogDefaultLayout.displayName = "DSDialogDefaultLayout";
31
+ DSDialogPrimaryMessage.displayName = "DSDialogPrimaryMessage";
32
+ DSDialogSecondaryMessage.displayName = "DSDialogSecondaryMessage";
33
+ const DSDialogBodyWithSchema = describe(DSDialogBody);
34
+ const DSDialogHeaderWithSchema = describe(DSDialogHeader);
35
+ const DSDialogFooterWithSchema = describe(DSDialogFooter);
36
+ const DSDialogSeparatorWithSchema = describe(DSDialogSeparator);
37
+ const DSDialogTitleWithSchema = describe(DSDialogTitle);
38
+ const DSDialogAddonWithSchema = describe(DSDialogAddon);
39
+ const DSDialogDefaultLayoutWithSchema = describe(DSDialogDefaultLayout);
40
+ const DSDialogPrimaryMessageWithSchema = describe(DSDialogPrimaryMessage);
41
+ const DSDialogSecondaryMessageWithSchema = describe(DSDialogSecondaryMessage);
42
+ DSDialogBodyWithSchema.propTypes = globalAttributesPropTypes;
43
+ DSDialogHeaderWithSchema.propTypes = globalAttributesPropTypes;
44
+ DSDialogFooterWithSchema.propTypes = globalAttributesPropTypes;
45
+ DSDialogSeparatorWithSchema.propTypes = globalAttributesPropTypes;
46
+ DSDialogTitleWithSchema.propTypes = globalAttributesPropTypes;
47
+ DSDialogAddonWithSchema.propTypes = globalAttributesPropTypes;
48
+ DSDialogDefaultLayoutWithSchema.propTypes = globalAttributesPropTypes;
49
+ DSDialogPrimaryMessageWithSchema.propTypes = globalAttributesPropTypes;
50
+ DSDialogSecondaryMessageWithSchema.propTypes = globalAttributesPropTypes;
51
+ export * from "./DSDialog";
52
+ export * from "./DSDialogDatatestid";
53
+ import { DSDialogSizes } from "./utils";
54
+ export {
55
+ DSDialogAddon,
56
+ DSDialogAddonWithSchema,
57
+ DSDialogBody,
58
+ DSDialogBodyWithSchema,
59
+ DSDialogDefaultLayout,
60
+ DSDialogDefaultLayoutWithSchema,
61
+ DSDialogFooter,
62
+ DSDialogFooterWithSchema,
63
+ DSDialogHeader,
64
+ DSDialogHeaderWithSchema,
65
+ DSDialogPrimaryMessage,
66
+ DSDialogPrimaryMessageWithSchema,
67
+ DSDialogSecondaryMessage,
68
+ DSDialogSecondaryMessageWithSchema,
69
+ DSDialogSeparator,
70
+ DSDialogSeparatorWithSchema,
71
+ DSDialogSizes,
72
+ DSDialogTitle,
73
+ DSDialogTitleWithSchema
74
+ };
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { describe } from 'react-desc';\nimport { globalAttributesPropTypes } from '@elliemae/ds-props-helpers';\nimport {\n DSDialogBody,\n DSDialogHeader,\n DSDialogFooter,\n DSDialogSeparator,\n DSDialogTitle,\n DSDialogAddon,\n DSDialogDefaultLayout,\n DSDialogPrimaryMessage,\n DSDialogSecondaryMessage,\n} from './styles';\n\nDSDialogBody.propTypes = globalAttributesPropTypes;\nDSDialogHeader.propTypes = globalAttributesPropTypes;\nDSDialogFooter.propTypes = globalAttributesPropTypes;\nDSDialogSeparator.propTypes = globalAttributesPropTypes;\nDSDialogTitle.propTypes = globalAttributesPropTypes;\nDSDialogAddon.propTypes = globalAttributesPropTypes;\nDSDialogDefaultLayout.propTypes = globalAttributesPropTypes;\nDSDialogPrimaryMessage.propTypes = globalAttributesPropTypes;\nDSDialogSecondaryMessage.propTypes = globalAttributesPropTypes;\nDSDialogBody.displayName = 'DSDialogBody';\nDSDialogHeader.displayName = 'DSDialogHeader';\nDSDialogFooter.displayName = 'DSDialogFooter';\nDSDialogSeparator.displayName = 'DSDialogSeparator';\nDSDialogTitle.displayName = 'DSDialogTitle';\nDSDialogAddon.displayName = 'DSDialogAddon';\nDSDialogDefaultLayout.displayName = 'DSDialogDefaultLayout';\nDSDialogPrimaryMessage.displayName = 'DSDialogPrimaryMessage';\nDSDialogSecondaryMessage.displayName = 'DSDialogSecondaryMessage';\n\nconst DSDialogBodyWithSchema = describe(DSDialogBody);\nconst DSDialogHeaderWithSchema = describe(DSDialogHeader);\nconst DSDialogFooterWithSchema = describe(DSDialogFooter);\nconst DSDialogSeparatorWithSchema = describe(DSDialogSeparator);\nconst DSDialogTitleWithSchema = describe(DSDialogTitle);\nconst DSDialogAddonWithSchema = describe(DSDialogAddon);\nconst DSDialogDefaultLayoutWithSchema = describe(DSDialogDefaultLayout);\nconst DSDialogPrimaryMessageWithSchema = describe(DSDialogPrimaryMessage);\nconst DSDialogSecondaryMessageWithSchema = describe(DSDialogSecondaryMessage);\n\nDSDialogBodyWithSchema.propTypes = globalAttributesPropTypes;\nDSDialogHeaderWithSchema.propTypes = globalAttributesPropTypes;\nDSDialogFooterWithSchema.propTypes = globalAttributesPropTypes;\nDSDialogSeparatorWithSchema.propTypes = globalAttributesPropTypes;\nDSDialogTitleWithSchema.propTypes = globalAttributesPropTypes;\nDSDialogAddonWithSchema.propTypes = globalAttributesPropTypes;\nDSDialogDefaultLayoutWithSchema.propTypes = globalAttributesPropTypes;\nDSDialogPrimaryMessageWithSchema.propTypes = globalAttributesPropTypes;\nDSDialogSecondaryMessageWithSchema.propTypes = globalAttributesPropTypes;\n\nexport * from './DSDialog';\nexport * from './DSDialogDatatestid';\nexport { DSDialogSizes } from './utils';\nexport {\n DSDialogBody,\n DSDialogHeader,\n DSDialogFooter,\n DSDialogSeparator,\n DSDialogTitle,\n DSDialogAddon,\n DSDialogDefaultLayout,\n DSDialogPrimaryMessage,\n DSDialogSecondaryMessage,\n DSDialogBodyWithSchema,\n DSDialogHeaderWithSchema,\n DSDialogFooterWithSchema,\n DSDialogSeparatorWithSchema,\n DSDialogTitleWithSchema,\n DSDialogAddonWithSchema,\n DSDialogDefaultLayoutWithSchema,\n DSDialogPrimaryMessageWithSchema,\n DSDialogSecondaryMessageWithSchema,\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,aAAa,YAAY;AACzB,eAAe,YAAY;AAC3B,eAAe,YAAY;AAC3B,kBAAkB,YAAY;AAC9B,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,sBAAsB,YAAY;AAClC,uBAAuB,YAAY;AACnC,yBAAyB,YAAY;AACrC,aAAa,cAAc;AAC3B,eAAe,cAAc;AAC7B,eAAe,cAAc;AAC7B,kBAAkB,cAAc;AAChC,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,sBAAsB,cAAc;AACpC,uBAAuB,cAAc;AACrC,yBAAyB,cAAc;AAEvC,MAAM,yBAAyB,SAAS;AACxC,MAAM,2BAA2B,SAAS;AAC1C,MAAM,2BAA2B,SAAS;AAC1C,MAAM,8BAA8B,SAAS;AAC7C,MAAM,0BAA0B,SAAS;AACzC,MAAM,0BAA0B,SAAS;AACzC,MAAM,kCAAkC,SAAS;AACjD,MAAM,mCAAmC,SAAS;AAClD,MAAM,qCAAqC,SAAS;AAEpD,uBAAuB,YAAY;AACnC,yBAAyB,YAAY;AACrC,yBAAyB,YAAY;AACrC,4BAA4B,YAAY;AACxC,wBAAwB,YAAY;AACpC,wBAAwB,YAAY;AACpC,gCAAgC,YAAY;AAC5C,iCAAiC,YAAY;AAC7C,mCAAmC,YAAY;AAE/C;AACA;AACA;",
6
+ "names": []
7
+ }
package/esm/propTypes.js CHANGED
@@ -1,14 +1,17 @@
1
- import { PropTypes } from 'react-desc';
2
- import { DSDialogSizesArrayValues, DSDialogSizes } from './utils.js';
3
-
4
- /* eslint-disable max-len */
1
+ import * as React from "react";
2
+ import { globalAttributesPropTypes, PropTypes } from "@elliemae/ds-props-helpers";
3
+ import { DSDialogSizes, DSDialogSizesArrayValues } from "./utils";
5
4
  const propTypes = {
6
- isOpen: PropTypes.bool.description('Wether the Dialog is open or not.').defaultValue(false),
7
- children: PropTypes.node.description('Nested components.').isRequired,
8
- centered: PropTypes.bool.description('Centers the Dialog.').defaultValue(false),
9
- size: PropTypes.oneOf(DSDialogSizesArrayValues).description("Dialog's width size.").defaultValue(DSDialogSizes.DEFAULT),
10
- removeAutoFocus: PropTypes.bool.description('Removes focus in the Dialog container when is open. If you want to focus an specific element in the Dialog, it should be set to true.').defaultValue(false),
11
- onClickOutside: PropTypes.func.description('Callback that should be used to close the modal when the user clicks outside. Cb also triggers when the user press ESC key for accessibility purposes.').defaultValue(() => {})
5
+ isOpen: PropTypes.bool.description("Whether the Dialog is open or not.").defaultValue(false),
6
+ children: PropTypes.node.description("Nested components.").isRequired,
7
+ centered: PropTypes.bool.description("Centers the Dialog.").defaultValue(false),
8
+ removeAutoFocus: PropTypes.bool.description("Removes focus in the Dialog container when is open. If you want to focus an specific element in the Dialog, it should be set to true.").defaultValue(false),
9
+ onClickOutside: PropTypes.func.description("Callback that should be used to close the modal when the user clicks outside. Cb also triggers when the user press ESC key for accessibility purposes.").defaultValue(() => {
10
+ }),
11
+ ...globalAttributesPropTypes,
12
+ size: PropTypes.oneOf(DSDialogSizesArrayValues).description(`Dialog's width size.`).defaultValue(DSDialogSizes.DEFAULT)
12
13
  };
13
-
14
- export { propTypes };
14
+ export {
15
+ propTypes
16
+ };
17
+ //# sourceMappingURL=propTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-len */\nimport { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-props-helpers';\nimport { WeakValidationMap } from 'react';\nimport { DSDialogSizes, DSDialogSizesArrayValues } from './utils';\n\nexport const propTypes = {\n isOpen: PropTypes.bool.description('Whether the Dialog is open or not.').defaultValue(false),\n children: PropTypes.node.description('Nested components.').isRequired,\n centered: PropTypes.bool.description('Centers the Dialog.').defaultValue(false),\n removeAutoFocus: PropTypes.bool\n .description(\n 'Removes focus in the Dialog container when is open. If you want to focus an specific element in the Dialog, it should be set to true.',\n )\n .defaultValue(false),\n onClickOutside: PropTypes.func\n .description(\n 'Callback that should be used to close the modal when the user clicks outside. Cb also triggers when the user press ESC key for accessibility purposes.',\n )\n .defaultValue(() => {}),\n ...globalAttributesPropTypes,\n size: PropTypes.oneOf(DSDialogSizesArrayValues)\n .description(`Dialog's width size.`)\n .defaultValue(DSDialogSizes.DEFAULT),\n} as WeakValidationMap<unknown>;\n"],
5
+ "mappings": "AAAA;ACCA;AAEA;AAEO,MAAM,YAAY;AAAA,EACvB,QAAQ,UAAU,KAAK,YAAY,sCAAsC,aAAa;AAAA,EACtF,UAAU,UAAU,KAAK,YAAY,sBAAsB;AAAA,EAC3D,UAAU,UAAU,KAAK,YAAY,uBAAuB,aAAa;AAAA,EACzE,iBAAiB,UAAU,KACxB,YACC,yIAED,aAAa;AAAA,EAChB,gBAAgB,UAAU,KACvB,YACC,0JAED,aAAa,MAAM;AAAA;AAAA,KACnB;AAAA,EACH,MAAM,UAAU,MAAM,0BACnB,YAAY,wBACZ,aAAa,cAAc;AAAA;",
6
+ "names": []
7
+ }
package/esm/styles.js CHANGED
@@ -1,125 +1,122 @@
1
- import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
- import styled from 'styled-components';
3
- import { createGlobalStyle } from '@elliemae/ds-system';
4
- import { space, layout, flexboxes, sizing } from '@xstyled/styled-components';
5
- import { allSizes } from './utils.js';
1
+ import * as React from "react";
2
+ import styled from "styled-components";
3
+ import { createGlobalStyle } from "@elliemae/ds-system";
4
+ import { space, flexboxes, layout, sizing } from "@xstyled/styled-components";
5
+ import { allSizes } from "./utils";
6
+ const FixedBody = createGlobalStyle`
7
+ body {
8
+ overflow: hidden;
9
+
10
+ ${({ bodyInfo }) => bodyInfo.overflow ? `padding-right: calc( ${bodyInfo.padding} + 15px ) !important;` : ``}
11
+ }
12
+ `;
13
+ const StyledDialogBackground = styled.div`
14
+ position: fixed;
15
+ top: 0;
16
+ bottom: 0;
17
+ width: 100%;
18
+ height: 100%;
19
+ background: rgba(37, 41, 47, 50%);
20
+ overflow-y: auto;
21
+ z-index: ${({ zIndex }) => zIndex};
22
+ `;
23
+ const StyledDialogContainer = styled.div`
24
+ height: fit-content;
25
+ position: absolute;
26
+ top: 0;
27
+ bottom: 0;
28
+ left: 0;
29
+ right: 0;
30
+ margin: ${({ centered }) => centered ? "auto" : "20vh auto auto auto"};
31
+ width: ${({ size }) => allSizes[size]};
32
+ min-width: 300px;
33
+ box-shadow: 0 10px 20px 0 ${({ theme }) => theme.colors.neutral[500]};
34
+ background: ${({ theme }) => theme.colors.neutral["000"]};
35
+ overflow-y: auto;
36
+ ${space}
37
+ &:focus {
38
+ outline: none;
39
+ }
40
+ `;
41
+ const DSDialogTitle = styled.h3`
42
+ font-size: ${({ theme }) => theme.fontSizes.title[700]};
43
+ display: -webkit-box;
44
+ -webkit-line-clamp: 2;
45
+ -webkit-box-orient: vertical;
46
+ overflow: hidden;
47
+ margin: 0;
48
+ `;
49
+ const DSDialogAddon = styled.div``;
50
+ const DSDialogHeader = styled.div`
51
+ display: grid;
52
+ align-items: center;
53
+ grid-auto-flow: column;
54
+ min-height: ${({ theme }) => theme.space.m};
55
+ padding: 10px ${({ theme }) => theme.space.xs};
56
+ & ${DSDialogTitle} + ${DSDialogAddon} {
57
+ align-self: flex-start;
58
+ justify-self: flex-end;
59
+ }
60
+ & ${DSDialogAddon}:only-child {
61
+ justify-self: flex-end;
62
+ }
63
+ ${space}
64
+ `;
65
+ const DSDialogSeparator = styled.hr.attrs(() => ({ "aria-hidden": true }))`
66
+ margin: 0;
67
+ border-top: 1px solid ${({ theme }) => theme.colors.neutral["080"]};
68
+ `;
69
+ const DSDialogBody = styled.div`
70
+ padding: ${({ theme }) => theme.space.xs};
71
+ overflow-y: auto;
6
72
 
7
- var _templateObject;
8
- const FixedBody = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n body {\n overflow: hidden;\n \n ", "\n }\n"])), _ref => {
9
- let {
10
- bodyInfo
11
- } = _ref;
12
- return bodyInfo.overflow ? "padding-right: calc( ".concat(bodyInfo.padding, " + 15px ) !important;") : "";
13
- });
14
- const StyledDialogBackground = /*#__PURE__*/styled.div.withConfig({
15
- componentId: "sc-106vqwv-0"
16
- })(["position:fixed;top:0;bottom:0;width:100%;height:100%;background:rgba(37,41,47,50%);overflow-y:auto;z-index:", ";"], _ref2 => {
17
- let {
18
- zIndex
19
- } = _ref2;
20
- return zIndex;
21
- });
22
- const StyledDialogContainer = /*#__PURE__*/styled.div.withConfig({
23
- componentId: "sc-106vqwv-1"
24
- })(["height:fit-content;position:absolute;top:0;bottom:0;left:0;right:0;margin:", ";width:", ";min-width:300px;box-shadow:0 10px 20px 0 ", ";background:", ";overflow-y:auto;", " &:focus{outline:none;}"], _ref3 => {
25
- let {
26
- centered
27
- } = _ref3;
28
- return centered ? 'auto' : '20vh auto auto auto';
29
- }, _ref4 => {
30
- let {
31
- size
32
- } = _ref4;
33
- return allSizes[size];
34
- }, _ref5 => {
35
- let {
36
- theme
37
- } = _ref5;
38
- return theme.colors.neutral[500];
39
- }, _ref6 => {
40
- let {
41
- theme
42
- } = _ref6;
43
- return theme.colors.neutral['000'];
44
- }, space);
45
- const DSDialogTitle = /*#__PURE__*/styled.h3.withConfig({
46
- componentId: "sc-106vqwv-2"
47
- })(["font-size:", ";display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;"], _ref7 => {
48
- let {
49
- theme
50
- } = _ref7;
51
- return theme.fontSizes.title[700];
52
- });
53
- const DSDialogAddon = /*#__PURE__*/styled.div.withConfig({
54
- componentId: "sc-106vqwv-3"
55
- })([""]);
56
- const DSDialogHeader = /*#__PURE__*/styled.div.withConfig({
57
- componentId: "sc-106vqwv-4"
58
- })(["display:grid;align-items:center;grid-auto-flow:column;min-height:", ";padding:10px ", ";& ", " + ", "{align-self:flex-start;justify-self:flex-end;}& ", ":only-child{justify-self:flex-end;}", ""], _ref8 => {
59
- let {
60
- theme
61
- } = _ref8;
62
- return theme.space.m;
63
- }, _ref9 => {
64
- let {
65
- theme
66
- } = _ref9;
67
- return theme.space.xs;
68
- }, DSDialogTitle, DSDialogAddon, DSDialogAddon, space);
69
- const DSDialogSeparator = /*#__PURE__*/styled.hr.attrs(() => ({
70
- 'aria-hidden': true
71
- })).withConfig({
72
- componentId: "sc-106vqwv-5"
73
- })(["margin:0;border-top:1px solid ", ";"], _ref10 => {
74
- let {
75
- theme
76
- } = _ref10;
77
- return theme.colors.neutral['080'];
78
- });
79
- const DSDialogBody = /*#__PURE__*/styled.div.withConfig({
80
- componentId: "sc-106vqwv-6"
81
- })(["padding:", ";overflow-y:auto;", " ", " ", " ", ""], _ref11 => {
82
- let {
83
- theme
84
- } = _ref11;
85
- return theme.space.xs;
86
- }, layout, space, flexboxes, sizing);
87
- const DSDialogPrimaryMessage = /*#__PURE__*/styled.h3.withConfig({
88
- componentId: "sc-106vqwv-7"
89
- })(["margin:0;"]);
90
- const DSDialogSecondaryMessage = /*#__PURE__*/styled.p.withConfig({
91
- componentId: "sc-106vqwv-8"
92
- })(["margin:0;color:", ";"], _ref12 => {
93
- let {
94
- theme
95
- } = _ref12;
96
- return theme.colors.neutral[500];
97
- });
98
- const DSDialogDefaultLayout = /*#__PURE__*/styled.div.withConfig({
99
- componentId: "sc-106vqwv-9"
100
- })(["display:grid;grid-auto-flow:row;justify-items:center;align-items:center;grid-gap:", ";", "{text-align:center;}"], _ref13 => {
101
- let {
102
- theme
103
- } = _ref13;
104
- return theme.space.xxs;
105
- }, DSDialogSecondaryMessage);
106
- const DSDialogFooter = /*#__PURE__*/styled.div.withConfig({
107
- componentId: "sc-106vqwv-10"
108
- })(["display:grid;grid-auto-flow:column;align-items:center;justify-content:flex-end;grid-gap:", ";min-height:", ";padding:0 ", ";", " ", " ", ""], _ref14 => {
109
- let {
110
- theme
111
- } = _ref14;
112
- return theme.space.xxs;
113
- }, _ref15 => {
114
- let {
115
- theme
116
- } = _ref15;
117
- return theme.space.m;
118
- }, _ref16 => {
119
- let {
120
- theme
121
- } = _ref16;
122
- return theme.space.xs;
123
- }, space, flexboxes, sizing);
73
+ ${layout}
74
+ ${space}
75
+ ${flexboxes}
76
+ ${sizing}
77
+ `;
78
+ const DSDialogPrimaryMessage = styled.h3`
79
+ margin: 0;
80
+ `;
81
+ const DSDialogSecondaryMessage = styled.p`
82
+ margin: 0;
83
+ color: ${({ theme }) => theme.colors.neutral[500]};
84
+ `;
85
+ const DSDialogDefaultLayout = styled.div`
86
+ display: grid;
87
+ grid-auto-flow: row;
88
+ justify-items: center;
89
+ align-items: center;
90
+ grid-gap: ${({ theme }) => theme.space.xxs};
124
91
 
125
- export { DSDialogAddon, DSDialogBody, DSDialogDefaultLayout, DSDialogFooter, DSDialogHeader, DSDialogPrimaryMessage, DSDialogSecondaryMessage, DSDialogSeparator, DSDialogTitle, FixedBody, StyledDialogBackground, StyledDialogContainer };
92
+ ${DSDialogSecondaryMessage} {
93
+ text-align: center;
94
+ }
95
+ `;
96
+ const DSDialogFooter = styled.div`
97
+ display: grid;
98
+ grid-auto-flow: column;
99
+ align-items: center;
100
+ justify-content: flex-end;
101
+ grid-gap: ${({ theme }) => theme.space.xxs};
102
+ min-height: ${({ theme }) => theme.space.m};
103
+ padding: 0 ${({ theme }) => theme.space.xs};
104
+ ${space}
105
+ ${flexboxes}
106
+ ${sizing}
107
+ `;
108
+ export {
109
+ DSDialogAddon,
110
+ DSDialogBody,
111
+ DSDialogDefaultLayout,
112
+ DSDialogFooter,
113
+ DSDialogHeader,
114
+ DSDialogPrimaryMessage,
115
+ DSDialogSecondaryMessage,
116
+ DSDialogSeparator,
117
+ DSDialogTitle,
118
+ FixedBody,
119
+ StyledDialogBackground,
120
+ StyledDialogContainer
121
+ };
122
+ //# sourceMappingURL=styles.js.map