@elliemae/ds-dialog 3.3.0-next.3 → 3.3.0-next.6
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.
- package/dist/cjs/config/useDialog.js +4 -19
- package/dist/cjs/config/useDialog.js.map +1 -1
- package/dist/cjs/parts/dialogContent/DSDialogContent.js +9 -38
- package/dist/cjs/parts/dialogContent/DSDialogContent.js.map +1 -1
- package/dist/cjs/propTypes.js +3 -19
- package/dist/cjs/propTypes.js.map +1 -1
- package/dist/esm/config/useDialog.js +4 -21
- package/dist/esm/config/useDialog.js.map +1 -1
- package/dist/esm/parts/dialogContent/DSDialogContent.js +9 -40
- package/dist/esm/parts/dialogContent/DSDialogContent.js.map +1 -1
- package/dist/esm/propTypes.js +3 -21
- package/dist/esm/propTypes.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -77,14 +60,16 @@ const useDialog = (props) => {
|
|
|
77
60
|
}, [actualPortalRef, isOpen, portalClassName]);
|
|
78
61
|
(0, import_react.useEffect)(() => {
|
|
79
62
|
if (actualPortalRef.current) {
|
|
80
|
-
setPortalInfo((prev) =>
|
|
63
|
+
setPortalInfo((prev) => ({
|
|
64
|
+
...prev,
|
|
81
65
|
paddingRight: (0, import_utils.getCurrentRightPadding)(actualPortalRef.current)
|
|
82
66
|
}));
|
|
83
67
|
}
|
|
84
68
|
}, []);
|
|
85
69
|
const calculateScrollbar = (0, import_react.useCallback)(() => {
|
|
86
70
|
if (actualPortalRef.current && !isOpen) {
|
|
87
|
-
setPortalInfo((prev) =>
|
|
71
|
+
setPortalInfo((prev) => ({
|
|
72
|
+
...prev,
|
|
88
73
|
scrollbarWidth: (0, import_utils.getScrollbarWidth)(actualPortalRef.current)
|
|
89
74
|
}));
|
|
90
75
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useDialog.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useEffect, useMemo, useState, useCallback, useRef, useLayoutEffect } from 'react';\nimport { debounce } from 'lodash';\nimport { uid } from 'uid';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { defaultProps } from '../defaultProps';\nimport { propTypes } from '../propTypes';\nimport { getScrollbarWidth, getCurrentRightPadding } from '../utils';\nimport type { DSDialogT } from '../propTypes';\nimport type { DSDialogInternalsT } from '../sharedTypes';\n\nexport const useDialog = (props: DSDialogT.Props): DSDialogInternalsT.DSDialogContext => {\n useValidateTypescriptPropTypes<DSDialogT.Props>(props, propTypes);\n const propsWithDefault = useMemoMergePropsWithDefault<DSDialogT.InternalProps>(props, defaultProps);\n const { portalRef, isOpen } = propsWithDefault;\n\n const actualPortalRef = useRef<HTMLElement | null>(null);\n const containerRef = useRef<HTMLDivElement | null>(null);\n\n const [portalInfo, setPortalInfo] = useState<DSDialogInternalsT.PortalInfo>({\n paddingRight: '0px',\n scrollbarWidth: '0px',\n });\n\n const portalClassName = useMemo(() => `ds-dialog-${uid(8)}`, []);\n\n useEffect(() => {\n if (portalRef) actualPortalRef.current = portalRef.current;\n else actualPortalRef.current = document.getElementsByTagName('body')['0'];\n }, [portalRef]);\n\n useLayoutEffect(() => {\n if (actualPortalRef.current) {\n if (isOpen) {\n actualPortalRef.current.classList.add(portalClassName);\n } else {\n actualPortalRef.current.classList.remove(portalClassName);\n }\n }\n }, [actualPortalRef, isOpen, portalClassName]);\n\n useEffect(() => {\n if (actualPortalRef.current) {\n setPortalInfo((prev) => ({\n ...prev,\n paddingRight: getCurrentRightPadding(actualPortalRef.current as HTMLElement),\n }));\n }\n }, []);\n\n const calculateScrollbar = useCallback(() => {\n if (actualPortalRef.current && !isOpen) {\n setPortalInfo((prev) => ({\n ...prev,\n scrollbarWidth: getScrollbarWidth(actualPortalRef.current as HTMLElement),\n }));\n }\n }, [isOpen]);\n\n const debouncedCalculateScrollbar = useMemo(() => debounce(calculateScrollbar, 300), [calculateScrollbar]);\n\n useEffect(() => {\n window.addEventListener('resize', debouncedCalculateScrollbar);\n return () => {\n window.removeEventListener('resize', debouncedCalculateScrollbar);\n };\n }, [calculateScrollbar, debouncedCalculateScrollbar]);\n\n useEffect(() => {\n calculateScrollbar();\n }, [calculateScrollbar, isOpen]);\n\n const ctx = useMemo(\n () => ({\n props: propsWithDefault,\n actualPortalRef,\n containerRef,\n portalInfo,\n portalClassName,\n }),\n [portalClassName, portalInfo, propsWithDefault],\n );\n\n return ctx;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA0F;AAC1F,oBAAyB;AACzB,iBAAoB;AACpB,0BAA6E;AAC7E,0BAA6B;AAC7B,uBAA0B;AAC1B,mBAA0D;AAInD,MAAM,YAAY,CAAC,UAA+D;AACvF,0DAAgD,OAAO,0BAAS;AAChE,QAAM,mBAAmB,sDAAsD,OAAO,gCAAY;AAClG,QAAM,EAAE,WAAW,WAAW;AAE9B,QAAM,kBAAkB,yBAA2B,IAAI;AACvD,QAAM,eAAe,yBAA8B,IAAI;AAEvD,QAAM,CAAC,YAAY,iBAAiB,2BAAwC;AAAA,IAC1E,cAAc;AAAA,IACd,gBAAgB;AAAA,EAClB,CAAC;AAED,QAAM,kBAAkB,0BAAQ,MAAM,aAAa,oBAAI,CAAC,KAAK,CAAC,CAAC;AAE/D,8BAAU,MAAM;AACd,QAAI;AAAW,sBAAgB,UAAU,UAAU;AAAA;AAC9C,sBAAgB,UAAU,SAAS,qBAAqB,MAAM,EAAE;AAAA,EACvE,GAAG,CAAC,SAAS,CAAC;AAEd,oCAAgB,MAAM;AACpB,QAAI,gBAAgB,SAAS;AAC3B,UAAI,QAAQ;AACV,wBAAgB,QAAQ,UAAU,IAAI,eAAe;AAAA,MACvD,OAAO;AACL,wBAAgB,QAAQ,UAAU,OAAO,eAAe;AAAA,MAC1D;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,QAAQ,eAAe,CAAC;AAE7C,8BAAU,MAAM;AACd,QAAI,gBAAgB,SAAS;AAC3B,oBAAc,CAAC,SAAU;AAAA,QACvB,GAAG;AAAA,QACH,cAAc,yCAAuB,gBAAgB,OAAsB;AAAA,MAC7E,EAAE;AAAA,IACJ;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,qBAAqB,8BAAY,MAAM;AAC3C,QAAI,gBAAgB,WAAW,CAAC,QAAQ;AACtC,oBAAc,CAAC,SAAU;AAAA,QACvB,GAAG;AAAA,QACH,gBAAgB,oCAAkB,gBAAgB,OAAsB;AAAA,MAC1E,EAAE;AAAA,IACJ;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,8BAA8B,0BAAQ,MAAM,4BAAS,oBAAoB,GAAG,GAAG,CAAC,kBAAkB,CAAC;AAEzG,8BAAU,MAAM;AACd,WAAO,iBAAiB,UAAU,2BAA2B;AAC7D,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,2BAA2B;AAAA,IAClE;AAAA,EACF,GAAG,CAAC,oBAAoB,2BAA2B,CAAC;AAEpD,8BAAU,MAAM;AACd,uBAAmB;AAAA,EACrB,GAAG,CAAC,oBAAoB,MAAM,CAAC;AAE/B,QAAM,MAAM,0BACV,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IACA,CAAC,iBAAiB,YAAY,gBAAgB,CAChD;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
8
|
var __export = (target, all) => {
|
|
38
9
|
for (var name in all)
|
|
39
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -64,11 +35,11 @@ var import_useDialogContent = require("./useDialogContent");
|
|
|
64
35
|
const DSDialogContent = () => {
|
|
65
36
|
const { handleOutsideClick, handleOnKeyDown } = (0, import_useDialogContent.useDialogContent)();
|
|
66
37
|
const { props, containerRef, portalInfo, portalClassName } = (0, import_react.useContext)(import_DSDialogCTX.DSDialogContext);
|
|
67
|
-
const
|
|
68
|
-
const
|
|
38
|
+
const { removeAutoFocus, zIndex, centered, size, children, ...rest } = props;
|
|
39
|
+
const { className, ...restOfGlobalAttributes } = (0, import_ds_utilities.useGetGlobalAttributes)(props, {
|
|
69
40
|
onClick: handleOutsideClick,
|
|
70
41
|
onKeyDown: handleOnKeyDown
|
|
71
|
-
})
|
|
42
|
+
});
|
|
72
43
|
const refCallback = (0, import_react.useCallback)((_ref) => {
|
|
73
44
|
if (_ref) {
|
|
74
45
|
containerRef.current = _ref;
|
|
@@ -85,17 +56,17 @@ const DSDialogContent = () => {
|
|
|
85
56
|
}, /* @__PURE__ */ import_react.default.createElement(import_styles.PortalStyles, {
|
|
86
57
|
portalInfo,
|
|
87
58
|
portalClassName
|
|
88
|
-
}), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledDialogContainer,
|
|
59
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledDialogContainer, {
|
|
89
60
|
role: "dialog",
|
|
90
61
|
"aria-modal": true,
|
|
91
62
|
ref: refCallback,
|
|
92
63
|
tabIndex: !removeAutoFocus ? 0 : void 0,
|
|
93
|
-
onKeyDown: handleOnKeyDown
|
|
94
|
-
|
|
64
|
+
onKeyDown: handleOnKeyDown,
|
|
65
|
+
...(0, import_utils.getSpaceProps)(rest),
|
|
95
66
|
centered,
|
|
96
|
-
"data-testid": import_DSDialogDatatestid.DSDialogDatatestid.CONTAINER
|
|
97
|
-
|
|
67
|
+
"data-testid": import_DSDialogDatatestid.DSDialogDatatestid.CONTAINER,
|
|
68
|
+
...restOfGlobalAttributes,
|
|
98
69
|
size
|
|
99
|
-
}
|
|
70
|
+
}, children));
|
|
100
71
|
};
|
|
101
72
|
//# sourceMappingURL=DSDialogContent.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/dialogContent/DSDialogContent.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useCallback, useContext } from 'react';\nimport { useGetGlobalAttributes } from '@elliemae/ds-utilities';\nimport { PortalStyles, StyledDialogBackground, StyledDialogContainer } from '../../styles';\nimport { getSpaceProps } from '../../utils';\nimport { DSDialogDatatestid } from '../../DSDialogDatatestid';\nimport { DSDialogContext } from '../../DSDialogCTX';\nimport { useDialogContent } from './useDialogContent';\n\nexport const DSDialogContent = () => {\n const { handleOutsideClick, handleOnKeyDown } = useDialogContent();\n const { props, containerRef, portalInfo, portalClassName } = useContext(DSDialogContext);\n\n const { removeAutoFocus, zIndex, centered, size, children, ...rest } = props;\n\n const { className, ...restOfGlobalAttributes } = useGetGlobalAttributes(props, {\n onClick: handleOutsideClick,\n onKeyDown: handleOnKeyDown,\n });\n\n const refCallback = useCallback(\n (_ref: HTMLDivElement | null) => {\n if (_ref) {\n containerRef.current = _ref;\n if (!removeAutoFocus) _ref.focus();\n }\n },\n [containerRef, removeAutoFocus],\n );\n\n return (\n <StyledDialogBackground\n className={className}\n onClick={handleOutsideClick}\n data-portalbg\n data-testid={DSDialogDatatestid.BACKGROUND}\n zIndex={zIndex}\n >\n <PortalStyles portalInfo={portalInfo} portalClassName={portalClassName} />\n <StyledDialogContainer\n role=\"dialog\"\n aria-modal\n ref={refCallback}\n tabIndex={!removeAutoFocus ? 0 : undefined}\n onKeyDown={handleOnKeyDown}\n {...getSpaceProps(rest as unknown as Record<string, unknown>)}\n centered={centered}\n data-testid={DSDialogDatatestid.CONTAINER}\n {...restOfGlobalAttributes}\n size={size}\n >\n {children}\n </StyledDialogContainer>\n </StyledDialogBackground>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+C;AAC/C,0BAAuC;AACvC,oBAA4E;AAC5E,mBAA8B;AAC9B,gCAAmC;AACnC,yBAAgC;AAChC,8BAAiC;AAE1B,MAAM,kBAAkB,MAAM;AACnC,QAAM,EAAE,oBAAoB,oBAAoB,8CAAiB;AACjE,QAAM,EAAE,OAAO,cAAc,YAAY,oBAAoB,6BAAW,kCAAe;AAEvF,QAAM,EAAE,iBAAiB,QAAQ,UAAU,MAAM,aAAa,SAAS;AAEvE,QAAM,EAAE,cAAc,2BAA2B,gDAAuB,OAAO;AAAA,IAC7E,SAAS;AAAA,IACT,WAAW;AAAA,EACb,CAAC;AAED,QAAM,cAAc,8BAClB,CAAC,SAAgC;AAC/B,QAAI,MAAM;AACR,mBAAa,UAAU;AACvB,UAAI,CAAC;AAAiB,aAAK,MAAM;AAAA,IACnC;AAAA,EACF,GACA,CAAC,cAAc,eAAe,CAChC;AAEA,SACE,mDAAC;AAAA,IACC;AAAA,IACA,SAAS;AAAA,IACT,iBAAa;AAAA,IACb,eAAa,6CAAmB;AAAA,IAChC;AAAA,KAEA,mDAAC;AAAA,IAAa;AAAA,IAAwB;AAAA,GAAkC,GACxE,mDAAC;AAAA,IACC,MAAK;AAAA,IACL,cAAU;AAAA,IACV,KAAK;AAAA,IACL,UAAU,CAAC,kBAAkB,IAAI;AAAA,IACjC,WAAW;AAAA,IACV,GAAG,gCAAc,IAA0C;AAAA,IAC5D;AAAA,IACA,eAAa,6CAAmB;AAAA,IAC/B,GAAG;AAAA,IACJ;AAAA,KAEC,QACH,CACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/propTypes.js
CHANGED
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -44,7 +27,8 @@ module.exports = __toCommonJS(propTypes_exports);
|
|
|
44
27
|
var React = __toESM(require("react"));
|
|
45
28
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
46
29
|
var import_utils = require("./utils");
|
|
47
|
-
const propTypes =
|
|
30
|
+
const propTypes = {
|
|
31
|
+
...import_ds_utilities.globalAttributesPropTypes,
|
|
48
32
|
isOpen: import_ds_utilities.PropTypes.bool.description("Whether the Dialog is open or not.").defaultValue(false),
|
|
49
33
|
children: import_ds_utilities.PropTypes.node.description("Nested components.").isRequired,
|
|
50
34
|
centered: import_ds_utilities.PropTypes.bool.description("Centers the Dialog.").defaultValue(false),
|
|
@@ -54,5 +38,5 @@ const propTypes = __spreadProps(__spreadValues({}, import_ds_utilities.globalAtt
|
|
|
54
38
|
onClose: import_ds_utilities.PropTypes.func.description("Callback triggered with ESC key.").defaultValue(() => {
|
|
55
39
|
}),
|
|
56
40
|
size: import_ds_utilities.PropTypes.oneOf(import_utils.DSDialogSizesArrayValues).description(`Dialog's width size.`).defaultValue(import_utils.DSDialogSizes.DEFAULT)
|
|
57
|
-
}
|
|
41
|
+
};
|
|
58
42
|
//# sourceMappingURL=propTypes.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/propTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-len */\nimport { globalAttributesPropTypes, GlobalAttributesT, PropTypes } from '@elliemae/ds-utilities';\nimport { DSDialogSizes, DSDialogSizesArrayValues } from './utils';\n\nexport declare namespace DSDialogT {\n export type Sizes = 'default' | 'small' | 'medium' | 'large' | 'x-large' | 'xx-large';\n export interface DefaultProps {\n [key: string]: unknown;\n isOpen: boolean;\n centered: boolean;\n size: Sizes;\n removeAutoFocus: boolean;\n onClickOutside: () => void;\n onClose: () => void;\n portalRef: null;\n children: React.ReactNode[] | [];\n }\n\n export interface PropsRequired {\n children: React.ReactNode[] | [];\n }\n\n export interface PropsOptional {\n portalRef: React.MutableRefObject<HTMLElement | null> | null;\n zIndex: number;\n }\n\n export interface InternalProps extends Omit<DefaultProps, 'portalRef'>, PropsRequired, PropsOptional {}\n\n export interface Props\n extends Omit<DefaultProps, 'portalRef'>,\n PropsRequired,\n PropsOptional,\n Omit<GlobalAttributesT<HTMLDivElement>, 'size' | 'children'> {}\n}\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\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('Callback that should be used to close the modal when the user clicks outside.')\n .defaultValue(() => {}),\n onClose: PropTypes.func.description('Callback triggered with ESC key.').defaultValue(() => {}),\n size: PropTypes.oneOf(DSDialogSizesArrayValues)\n .description(`Dialog's width size.`)\n .defaultValue(DSDialogSizes.DEFAULT),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAAwE;AACxE,mBAAwD;AAkCjD,MAAM,YAAY;AAAA,EACvB,GAAG;AAAA,EACH,QAAQ,8BAAU,KAAK,YAAY,oCAAoC,EAAE,aAAa,KAAK;AAAA,EAC3F,UAAU,8BAAU,KAAK,YAAY,oBAAoB,EAAE;AAAA,EAC3D,UAAU,8BAAU,KAAK,YAAY,qBAAqB,EAAE,aAAa,KAAK;AAAA,EAC9E,iBAAiB,8BAAU,KACxB,YACC,uIACF,EACC,aAAa,KAAK;AAAA,EACrB,gBAAgB,8BAAU,KACvB,YAAY,+EAA+E,EAC3F,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EACxB,SAAS,8BAAU,KAAK,YAAY,kCAAkC,EAAE,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EAC7F,MAAM,8BAAU,MAAM,qCAAwB,EAC3C,YAAY,sBAAsB,EAClC,aAAa,2BAAc,OAAO;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import { useEffect, useMemo, useState, useCallback, useRef, useLayoutEffect } from "react";
|
|
23
4
|
import { debounce } from "lodash";
|
|
@@ -54,14 +35,16 @@ const useDialog = (props) => {
|
|
|
54
35
|
}, [actualPortalRef, isOpen, portalClassName]);
|
|
55
36
|
useEffect(() => {
|
|
56
37
|
if (actualPortalRef.current) {
|
|
57
|
-
setPortalInfo((prev) =>
|
|
38
|
+
setPortalInfo((prev) => ({
|
|
39
|
+
...prev,
|
|
58
40
|
paddingRight: getCurrentRightPadding(actualPortalRef.current)
|
|
59
41
|
}));
|
|
60
42
|
}
|
|
61
43
|
}, []);
|
|
62
44
|
const calculateScrollbar = useCallback(() => {
|
|
63
45
|
if (actualPortalRef.current && !isOpen) {
|
|
64
|
-
setPortalInfo((prev) =>
|
|
46
|
+
setPortalInfo((prev) => ({
|
|
47
|
+
...prev,
|
|
65
48
|
scrollbarWidth: getScrollbarWidth(actualPortalRef.current)
|
|
66
49
|
}));
|
|
67
50
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useDialog.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useEffect, useMemo, useState, useCallback, useRef, useLayoutEffect } from 'react';\nimport { debounce } from 'lodash';\nimport { uid } from 'uid';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport { defaultProps } from '../defaultProps';\nimport { propTypes } from '../propTypes';\nimport { getScrollbarWidth, getCurrentRightPadding } from '../utils';\nimport type { DSDialogT } from '../propTypes';\nimport type { DSDialogInternalsT } from '../sharedTypes';\n\nexport const useDialog = (props: DSDialogT.Props): DSDialogInternalsT.DSDialogContext => {\n useValidateTypescriptPropTypes<DSDialogT.Props>(props, propTypes);\n const propsWithDefault = useMemoMergePropsWithDefault<DSDialogT.InternalProps>(props, defaultProps);\n const { portalRef, isOpen } = propsWithDefault;\n\n const actualPortalRef = useRef<HTMLElement | null>(null);\n const containerRef = useRef<HTMLDivElement | null>(null);\n\n const [portalInfo, setPortalInfo] = useState<DSDialogInternalsT.PortalInfo>({\n paddingRight: '0px',\n scrollbarWidth: '0px',\n });\n\n const portalClassName = useMemo(() => `ds-dialog-${uid(8)}`, []);\n\n useEffect(() => {\n if (portalRef) actualPortalRef.current = portalRef.current;\n else actualPortalRef.current = document.getElementsByTagName('body')['0'];\n }, [portalRef]);\n\n useLayoutEffect(() => {\n if (actualPortalRef.current) {\n if (isOpen) {\n actualPortalRef.current.classList.add(portalClassName);\n } else {\n actualPortalRef.current.classList.remove(portalClassName);\n }\n }\n }, [actualPortalRef, isOpen, portalClassName]);\n\n useEffect(() => {\n if (actualPortalRef.current) {\n setPortalInfo((prev) => ({\n ...prev,\n paddingRight: getCurrentRightPadding(actualPortalRef.current as HTMLElement),\n }));\n }\n }, []);\n\n const calculateScrollbar = useCallback(() => {\n if (actualPortalRef.current && !isOpen) {\n setPortalInfo((prev) => ({\n ...prev,\n scrollbarWidth: getScrollbarWidth(actualPortalRef.current as HTMLElement),\n }));\n }\n }, [isOpen]);\n\n const debouncedCalculateScrollbar = useMemo(() => debounce(calculateScrollbar, 300), [calculateScrollbar]);\n\n useEffect(() => {\n window.addEventListener('resize', debouncedCalculateScrollbar);\n return () => {\n window.removeEventListener('resize', debouncedCalculateScrollbar);\n };\n }, [calculateScrollbar, debouncedCalculateScrollbar]);\n\n useEffect(() => {\n calculateScrollbar();\n }, [calculateScrollbar, isOpen]);\n\n const ctx = useMemo(\n () => ({\n props: propsWithDefault,\n actualPortalRef,\n containerRef,\n portalInfo,\n portalClassName,\n }),\n [portalClassName, portalInfo, propsWithDefault],\n );\n\n return ctx;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AAIO,MAAM,YAAY,CAAC,UAA+D;AACvF,iCAAgD,OAAO,SAAS;AAChE,QAAM,mBAAmB,6BAAsD,OAAO,YAAY;AAClG,QAAM,EAAE,WAAW,WAAW;AAE9B,QAAM,kBAAkB,OAA2B,IAAI;AACvD,QAAM,eAAe,OAA8B,IAAI;AAEvD,QAAM,CAAC,YAAY,iBAAiB,SAAwC;AAAA,IAC1E,cAAc;AAAA,IACd,gBAAgB;AAAA,EAClB,CAAC;AAED,QAAM,kBAAkB,QAAQ,MAAM,aAAa,IAAI,CAAC,KAAK,CAAC,CAAC;AAE/D,YAAU,MAAM;AACd,QAAI;AAAW,sBAAgB,UAAU,UAAU;AAAA;AAC9C,sBAAgB,UAAU,SAAS,qBAAqB,MAAM,EAAE;AAAA,EACvE,GAAG,CAAC,SAAS,CAAC;AAEd,kBAAgB,MAAM;AACpB,QAAI,gBAAgB,SAAS;AAC3B,UAAI,QAAQ;AACV,wBAAgB,QAAQ,UAAU,IAAI,eAAe;AAAA,MACvD,OAAO;AACL,wBAAgB,QAAQ,UAAU,OAAO,eAAe;AAAA,MAC1D;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,QAAQ,eAAe,CAAC;AAE7C,YAAU,MAAM;AACd,QAAI,gBAAgB,SAAS;AAC3B,oBAAc,CAAC,SAAU;AAAA,QACvB,GAAG;AAAA,QACH,cAAc,uBAAuB,gBAAgB,OAAsB;AAAA,MAC7E,EAAE;AAAA,IACJ;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,qBAAqB,YAAY,MAAM;AAC3C,QAAI,gBAAgB,WAAW,CAAC,QAAQ;AACtC,oBAAc,CAAC,SAAU;AAAA,QACvB,GAAG;AAAA,QACH,gBAAgB,kBAAkB,gBAAgB,OAAsB;AAAA,MAC1E,EAAE;AAAA,IACJ;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,8BAA8B,QAAQ,MAAM,SAAS,oBAAoB,GAAG,GAAG,CAAC,kBAAkB,CAAC;AAEzG,YAAU,MAAM;AACd,WAAO,iBAAiB,UAAU,2BAA2B;AAC7D,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,2BAA2B;AAAA,IAClE;AAAA,EACF,GAAG,CAAC,oBAAoB,2BAA2B,CAAC;AAEpD,YAAU,MAAM;AACd,uBAAmB;AAAA,EACrB,GAAG,CAAC,oBAAoB,MAAM,CAAC;AAE/B,QAAM,MAAM,QACV,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IACA,CAAC,iBAAiB,YAAY,gBAAgB,CAChD;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import React2, { useCallback, useContext } from "react";
|
|
35
4
|
import { useGetGlobalAttributes } from "@elliemae/ds-utilities";
|
|
@@ -41,11 +10,11 @@ import { useDialogContent } from "./useDialogContent";
|
|
|
41
10
|
const DSDialogContent = () => {
|
|
42
11
|
const { handleOutsideClick, handleOnKeyDown } = useDialogContent();
|
|
43
12
|
const { props, containerRef, portalInfo, portalClassName } = useContext(DSDialogContext);
|
|
44
|
-
const
|
|
45
|
-
const
|
|
13
|
+
const { removeAutoFocus, zIndex, centered, size, children, ...rest } = props;
|
|
14
|
+
const { className, ...restOfGlobalAttributes } = useGetGlobalAttributes(props, {
|
|
46
15
|
onClick: handleOutsideClick,
|
|
47
16
|
onKeyDown: handleOnKeyDown
|
|
48
|
-
})
|
|
17
|
+
});
|
|
49
18
|
const refCallback = useCallback((_ref) => {
|
|
50
19
|
if (_ref) {
|
|
51
20
|
containerRef.current = _ref;
|
|
@@ -62,18 +31,18 @@ const DSDialogContent = () => {
|
|
|
62
31
|
}, /* @__PURE__ */ React2.createElement(PortalStyles, {
|
|
63
32
|
portalInfo,
|
|
64
33
|
portalClassName
|
|
65
|
-
}), /* @__PURE__ */ React2.createElement(StyledDialogContainer,
|
|
34
|
+
}), /* @__PURE__ */ React2.createElement(StyledDialogContainer, {
|
|
66
35
|
role: "dialog",
|
|
67
36
|
"aria-modal": true,
|
|
68
37
|
ref: refCallback,
|
|
69
38
|
tabIndex: !removeAutoFocus ? 0 : void 0,
|
|
70
|
-
onKeyDown: handleOnKeyDown
|
|
71
|
-
|
|
39
|
+
onKeyDown: handleOnKeyDown,
|
|
40
|
+
...getSpaceProps(rest),
|
|
72
41
|
centered,
|
|
73
|
-
"data-testid": DSDialogDatatestid.CONTAINER
|
|
74
|
-
|
|
42
|
+
"data-testid": DSDialogDatatestid.CONTAINER,
|
|
43
|
+
...restOfGlobalAttributes,
|
|
75
44
|
size
|
|
76
|
-
}
|
|
45
|
+
}, children));
|
|
77
46
|
};
|
|
78
47
|
export {
|
|
79
48
|
DSDialogContent
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/dialogContent/DSDialogContent.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useContext } from 'react';\nimport { useGetGlobalAttributes } from '@elliemae/ds-utilities';\nimport { PortalStyles, StyledDialogBackground, StyledDialogContainer } from '../../styles';\nimport { getSpaceProps } from '../../utils';\nimport { DSDialogDatatestid } from '../../DSDialogDatatestid';\nimport { DSDialogContext } from '../../DSDialogCTX';\nimport { useDialogContent } from './useDialogContent';\n\nexport const DSDialogContent = () => {\n const { handleOutsideClick, handleOnKeyDown } = useDialogContent();\n const { props, containerRef, portalInfo, portalClassName } = useContext(DSDialogContext);\n\n const { removeAutoFocus, zIndex, centered, size, children, ...rest } = props;\n\n const { className, ...restOfGlobalAttributes } = useGetGlobalAttributes(props, {\n onClick: handleOutsideClick,\n onKeyDown: handleOnKeyDown,\n });\n\n const refCallback = useCallback(\n (_ref: HTMLDivElement | null) => {\n if (_ref) {\n containerRef.current = _ref;\n if (!removeAutoFocus) _ref.focus();\n }\n },\n [containerRef, removeAutoFocus],\n );\n\n return (\n <StyledDialogBackground\n className={className}\n onClick={handleOutsideClick}\n data-portalbg\n data-testid={DSDialogDatatestid.BACKGROUND}\n zIndex={zIndex}\n >\n <PortalStyles portalInfo={portalInfo} portalClassName={portalClassName} />\n <StyledDialogContainer\n role=\"dialog\"\n aria-modal\n ref={refCallback}\n tabIndex={!removeAutoFocus ? 0 : undefined}\n onKeyDown={handleOnKeyDown}\n {...getSpaceProps(rest as unknown as Record<string, unknown>)}\n centered={centered}\n data-testid={DSDialogDatatestid.CONTAINER}\n {...restOfGlobalAttributes}\n size={size}\n >\n {children}\n </StyledDialogContainer>\n </StyledDialogBackground>\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAM,kBAAkB,MAAM;AACnC,QAAM,EAAE,oBAAoB,oBAAoB,iBAAiB;AACjE,QAAM,EAAE,OAAO,cAAc,YAAY,oBAAoB,WAAW,eAAe;AAEvF,QAAM,EAAE,iBAAiB,QAAQ,UAAU,MAAM,aAAa,SAAS;AAEvE,QAAM,EAAE,cAAc,2BAA2B,uBAAuB,OAAO;AAAA,IAC7E,SAAS;AAAA,IACT,WAAW;AAAA,EACb,CAAC;AAED,QAAM,cAAc,YAClB,CAAC,SAAgC;AAC/B,QAAI,MAAM;AACR,mBAAa,UAAU;AACvB,UAAI,CAAC;AAAiB,aAAK,MAAM;AAAA,IACnC;AAAA,EACF,GACA,CAAC,cAAc,eAAe,CAChC;AAEA,SACE,qCAAC;AAAA,IACC;AAAA,IACA,SAAS;AAAA,IACT,iBAAa;AAAA,IACb,eAAa,mBAAmB;AAAA,IAChC;AAAA,KAEA,qCAAC;AAAA,IAAa;AAAA,IAAwB;AAAA,GAAkC,GACxE,qCAAC;AAAA,IACC,MAAK;AAAA,IACL,cAAU;AAAA,IACV,KAAK;AAAA,IACL,UAAU,CAAC,kBAAkB,IAAI;AAAA,IACjC,WAAW;AAAA,IACV,GAAG,cAAc,IAA0C;AAAA,IAC5D;AAAA,IACA,eAAa,mBAAmB;AAAA,IAC/B,GAAG;AAAA,IACJ;AAAA,KAEC,QACH,CACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/propTypes.js
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import { globalAttributesPropTypes, PropTypes } from "@elliemae/ds-utilities";
|
|
23
4
|
import { DSDialogSizes, DSDialogSizesArrayValues } from "./utils";
|
|
24
|
-
const propTypes =
|
|
5
|
+
const propTypes = {
|
|
6
|
+
...globalAttributesPropTypes,
|
|
25
7
|
isOpen: PropTypes.bool.description("Whether the Dialog is open or not.").defaultValue(false),
|
|
26
8
|
children: PropTypes.node.description("Nested components.").isRequired,
|
|
27
9
|
centered: PropTypes.bool.description("Centers the Dialog.").defaultValue(false),
|
|
@@ -31,7 +13,7 @@ const propTypes = __spreadProps(__spreadValues({}, globalAttributesPropTypes), {
|
|
|
31
13
|
onClose: PropTypes.func.description("Callback triggered with ESC key.").defaultValue(() => {
|
|
32
14
|
}),
|
|
33
15
|
size: PropTypes.oneOf(DSDialogSizesArrayValues).description(`Dialog's width size.`).defaultValue(DSDialogSizes.DEFAULT)
|
|
34
|
-
}
|
|
16
|
+
};
|
|
35
17
|
export {
|
|
36
18
|
propTypes
|
|
37
19
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-len */\nimport { globalAttributesPropTypes, GlobalAttributesT, PropTypes } from '@elliemae/ds-utilities';\nimport { DSDialogSizes, DSDialogSizesArrayValues } from './utils';\n\nexport declare namespace DSDialogT {\n export type Sizes = 'default' | 'small' | 'medium' | 'large' | 'x-large' | 'xx-large';\n export interface DefaultProps {\n [key: string]: unknown;\n isOpen: boolean;\n centered: boolean;\n size: Sizes;\n removeAutoFocus: boolean;\n onClickOutside: () => void;\n onClose: () => void;\n portalRef: null;\n children: React.ReactNode[] | [];\n }\n\n export interface PropsRequired {\n children: React.ReactNode[] | [];\n }\n\n export interface PropsOptional {\n portalRef: React.MutableRefObject<HTMLElement | null> | null;\n zIndex: number;\n }\n\n export interface InternalProps extends Omit<DefaultProps, 'portalRef'>, PropsRequired, PropsOptional {}\n\n export interface Props\n extends Omit<DefaultProps, 'portalRef'>,\n PropsRequired,\n PropsOptional,\n Omit<GlobalAttributesT<HTMLDivElement>, 'size' | 'children'> {}\n}\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\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('Callback that should be used to close the modal when the user clicks outside.')\n .defaultValue(() => {}),\n onClose: PropTypes.func.description('Callback triggered with ESC key.').defaultValue(() => {}),\n size: PropTypes.oneOf(DSDialogSizesArrayValues)\n .description(`Dialog's width size.`)\n .defaultValue(DSDialogSizes.DEFAULT),\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AACA;AAkCO,MAAM,YAAY;AAAA,EACvB,GAAG;AAAA,EACH,QAAQ,UAAU,KAAK,YAAY,oCAAoC,EAAE,aAAa,KAAK;AAAA,EAC3F,UAAU,UAAU,KAAK,YAAY,oBAAoB,EAAE;AAAA,EAC3D,UAAU,UAAU,KAAK,YAAY,qBAAqB,EAAE,aAAa,KAAK;AAAA,EAC9E,iBAAiB,UAAU,KACxB,YACC,uIACF,EACC,aAAa,KAAK;AAAA,EACrB,gBAAgB,UAAU,KACvB,YAAY,+EAA+E,EAC3F,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EACxB,SAAS,UAAU,KAAK,YAAY,kCAAkC,EAAE,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EAC7F,MAAM,UAAU,MAAM,wBAAwB,EAC3C,YAAY,sBAAsB,EAClC,aAAa,cAAc,OAAO;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-dialog",
|
|
3
|
-
"version": "3.3.0-next.
|
|
3
|
+
"version": "3.3.0-next.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Dialog",
|
|
6
6
|
"files": [
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"indent": 4
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@elliemae/ds-button": "3.3.0-next.
|
|
71
|
-
"@elliemae/ds-icons": "3.3.0-next.
|
|
72
|
-
"@elliemae/ds-system": "3.3.0-next.
|
|
73
|
-
"@elliemae/ds-utilities": "3.3.0-next.
|
|
70
|
+
"@elliemae/ds-button": "3.3.0-next.6",
|
|
71
|
+
"@elliemae/ds-icons": "3.3.0-next.6",
|
|
72
|
+
"@elliemae/ds-system": "3.3.0-next.6",
|
|
73
|
+
"@elliemae/ds-utilities": "3.3.0-next.6",
|
|
74
74
|
"@xstyled/styled-components": "~3.6.0",
|
|
75
75
|
"lodash": "~4.17.21",
|
|
76
76
|
"uid": "~2.0.0"
|