@elliemae/ds-dialog 3.0.0-next.6 → 3.0.0-next.60

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 (50) hide show
  1. package/dist/cjs/DSDialog.js +18 -133
  2. package/dist/cjs/DSDialog.js.map +2 -2
  3. package/dist/cjs/DSDialogCTX.js +30 -0
  4. package/dist/cjs/DSDialogCTX.js.map +7 -0
  5. package/dist/cjs/DSDialogDatatestid.js +9 -16
  6. package/dist/cjs/DSDialogDatatestid.js.map +1 -1
  7. package/dist/cjs/config/useDialog.js +110 -0
  8. package/dist/cjs/config/useDialog.js.map +7 -0
  9. package/dist/cjs/defaultProps.js +12 -17
  10. package/dist/cjs/defaultProps.js.map +2 -2
  11. package/dist/cjs/index.js +31 -37
  12. package/dist/cjs/index.js.map +2 -2
  13. package/dist/cjs/parts/DSDialogPortal.js +42 -0
  14. package/dist/cjs/parts/DSDialogPortal.js.map +7 -0
  15. package/dist/cjs/parts/dialogContent/DSDialogContent.js +93 -0
  16. package/dist/cjs/parts/dialogContent/DSDialogContent.js.map +7 -0
  17. package/dist/cjs/parts/dialogContent/useDialogContent.js +62 -0
  18. package/dist/cjs/parts/dialogContent/useDialogContent.js.map +7 -0
  19. package/dist/cjs/propTypes.js +18 -25
  20. package/dist/cjs/propTypes.js.map +2 -2
  21. package/dist/cjs/sharedTypes.js +9 -16
  22. package/dist/cjs/sharedTypes.js.map +2 -2
  23. package/dist/cjs/styles.js +14 -21
  24. package/dist/cjs/styles.js.map +2 -2
  25. package/dist/cjs/utils.js +13 -16
  26. package/dist/cjs/utils.js.map +2 -2
  27. package/dist/esm/DSDialog.js +9 -124
  28. package/dist/esm/DSDialog.js.map +2 -2
  29. package/dist/esm/DSDialogCTX.js +8 -0
  30. package/dist/esm/DSDialogCTX.js.map +7 -0
  31. package/dist/esm/DSDialogDatatestid.js.map +1 -1
  32. package/dist/esm/config/useDialog.js +90 -0
  33. package/dist/esm/config/useDialog.js.map +7 -0
  34. package/dist/esm/defaultProps.js +3 -1
  35. package/dist/esm/defaultProps.js.map +2 -2
  36. package/dist/esm/index.js +1 -1
  37. package/dist/esm/index.js.map +2 -2
  38. package/dist/esm/parts/DSDialogPortal.js +20 -0
  39. package/dist/esm/parts/DSDialogPortal.js.map +7 -0
  40. package/dist/esm/parts/dialogContent/DSDialogContent.js +73 -0
  41. package/dist/esm/parts/dialogContent/DSDialogContent.js.map +7 -0
  42. package/dist/esm/parts/dialogContent/useDialogContent.js +40 -0
  43. package/dist/esm/parts/dialogContent/useDialogContent.js.map +7 -0
  44. package/dist/esm/propTypes.js +1 -1
  45. package/dist/esm/propTypes.js.map +2 -2
  46. package/dist/esm/styles.js +5 -5
  47. package/dist/esm/styles.js.map +2 -2
  48. package/dist/esm/utils.js +4 -0
  49. package/dist/esm/utils.js.map +2 -2
  50. package/package.json +12 -12
@@ -1,157 +1,42 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
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
7
  var __export = (target, all) => {
38
8
  for (var name in all)
39
9
  __defProp(target, name, { get: all[name], enumerable: true });
40
10
  };
41
- var __reExport = (target, module2, copyDefault, desc) => {
42
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
43
- for (let key of __getOwnPropNames(module2))
44
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
45
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
16
  }
47
- return target;
48
- };
49
- var __toESM = (module2, isNodeMode) => {
50
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
17
+ return to;
51
18
  };
52
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
53
- return (module2, temp) => {
54
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
55
- };
56
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
21
  var DSDialog_exports = {};
58
22
  __export(DSDialog_exports, {
59
23
  DSDialog: () => DSDialog,
60
24
  DSDialogWithSchema: () => DSDialogWithSchema
61
25
  });
26
+ module.exports = __toCommonJS(DSDialog_exports);
62
27
  var React = __toESM(require("react"));
63
- var import_react_dom = __toESM(require("react-dom"));
64
28
  var import_react = __toESM(require("react"));
65
- var import_lodash = require("lodash");
66
- var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
67
- var import_styles = require("./styles");
29
+ var import_ds_utilities = require("@elliemae/ds-utilities");
68
30
  var import_propTypes = require("./propTypes");
69
- var import_defaultProps = require("./defaultProps");
70
- var import_utils = require("./utils");
71
- var import_DSDialogDatatestid = require("./DSDialogDatatestid");
31
+ var import_useDialog = require("./config/useDialog");
32
+ var import_DSDialogPortal = require("./parts/DSDialogPortal");
33
+ var import_DSDialogCTX = require("./DSDialogCTX");
72
34
  const DSDialog = (props) => {
73
- const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_defaultProps.defaultProps);
74
- const [bodyInfo, setBodyInfo] = (0, import_react.useState)({
75
- overflow: false,
76
- paddingRight: "0px",
77
- scrollbarWidth: "0px"
78
- });
79
- (0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_propTypes.propTypes);
80
- const _a = propsWithDefault, { children, isOpen, onClickOutside, onClose, centered, size, removeAutoFocus, zIndex } = _a, rest = __objRest(_a, ["children", "isOpen", "onClickOutside", "onClose", "centered", "size", "removeAutoFocus", "zIndex"]);
81
- const containerRef = (0, import_react.useRef)(null);
82
- const focusContainer = (0, import_react.useCallback)(() => {
83
- const isContainerOrChildFocused = containerRef.current?.contains(document.activeElement);
84
- if (!isContainerOrChildFocused)
85
- containerRef.current?.focus?.();
86
- }, []);
87
- (0, import_react.useEffect)(() => {
88
- document.addEventListener("focusin", focusContainer);
89
- return () => document.removeEventListener("focusin", focusContainer);
90
- }, [focusContainer]);
91
- const handleOutsideClick = (0, import_react.useCallback)((e) => {
92
- if (e.target.dataset.portalbg)
93
- onClickOutside();
94
- }, [onClickOutside]);
95
- const handleOnKeyDown = (0, import_react.useCallback)((e) => {
96
- if (e.key === "Escape")
97
- onClose();
98
- }, [onClose]);
99
- const _b = (0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefault, {
100
- onClick: handleOutsideClick,
101
- onKeyDown: handleOnKeyDown
102
- }), { className } = _b, restOfGlobalAttributes = __objRest(_b, ["className"]);
103
- const calculateScrollbar = (0, import_react.useCallback)(() => {
104
- const body = document.getElementsByTagName("body")[0];
105
- const { clientWidth } = body;
106
- setBodyInfo((prev) => __spreadProps(__spreadValues({}, prev), { scrollbarWidth: `${window.innerWidth - clientWidth}px` }));
107
- }, []);
108
- const debouncedCalculateScrollbar = (0, import_react.useMemo)(() => (0, import_lodash.debounce)(calculateScrollbar, 300), [calculateScrollbar]);
109
- (0, import_react.useEffect)(() => {
110
- calculateScrollbar();
111
- }, [calculateScrollbar]);
112
- (0, import_react.useEffect)(() => {
113
- window.addEventListener("resize", debouncedCalculateScrollbar);
114
- return () => {
115
- window.removeEventListener("resize", debouncedCalculateScrollbar);
116
- };
117
- }, [calculateScrollbar, debouncedCalculateScrollbar]);
118
- (0, import_react.useEffect)(() => {
119
- if (isOpen) {
120
- const body = document.getElementsByTagName("body")[0];
121
- const { clientHeight, scrollHeight } = body;
122
- const paddingRight = window.getComputedStyle(body, null)?.getPropertyValue("padding-right");
123
- setBodyInfo((prev) => __spreadProps(__spreadValues({}, prev), { overflow: scrollHeight > clientHeight, paddingRight }));
124
- } else
125
- setBodyInfo((prev) => __spreadProps(__spreadValues({}, prev), { overflow: false, paddingRight: "0px" }));
126
- }, [isOpen]);
127
- (0, import_react.useEffect)(() => {
128
- if (isOpen && !removeAutoFocus)
129
- containerRef?.current?.focus();
130
- }, [isOpen, removeAutoFocus]);
131
- if (isOpen) {
132
- return import_react_dom.default.createPortal(/* @__PURE__ */ import_react.default.createElement(import_styles.StyledDialogBackground, {
133
- className,
134
- onClick: handleOutsideClick,
135
- "data-portalbg": true,
136
- "data-testid": import_DSDialogDatatestid.DSDialogDatatestid.BACKGROUND,
137
- zIndex
138
- }, /* @__PURE__ */ import_react.default.createElement(import_styles.FixedBody, {
139
- bodyInfo
140
- }), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledDialogContainer, __spreadProps(__spreadValues(__spreadProps(__spreadValues({
141
- role: "dialog",
142
- "aria-modal": true,
143
- ref: containerRef,
144
- tabIndex: !removeAutoFocus ? 0 : void 0
145
- }, (0, import_utils.getSpaceProps)(rest)), {
146
- centered,
147
- "data-testid": import_DSDialogDatatestid.DSDialogDatatestid.CONTAINER
148
- }), restOfGlobalAttributes), {
149
- size
150
- }), children)), document.getElementsByTagName("body")[0]);
151
- }
152
- return null;
35
+ const ctx = (0, import_useDialog.useDialog)(props);
36
+ return /* @__PURE__ */ import_react.default.createElement(import_DSDialogCTX.DSDialogContext.Provider, {
37
+ value: ctx
38
+ }, /* @__PURE__ */ import_react.default.createElement(import_DSDialogPortal.DSDialogPortal, null));
153
39
  };
154
- const DSDialogWithSchema = (0, import_ds_props_helpers.describe)(DSDialog);
40
+ const DSDialogWithSchema = (0, import_ds_utilities.describe)(DSDialog);
155
41
  DSDialogWithSchema.propTypes = import_propTypes.propTypes;
156
- module.exports = __toCommonJS(DSDialog_exports);
157
42
  //# sourceMappingURL=DSDialog.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSDialog.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import ReactDOM from 'react-dom';\nimport React, { useCallback, useRef, useEffect, useState, WeakValidationMap, useMemo } from 'react';\nimport { debounce } from 'lodash';\nimport {\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useValidateTypescriptPropTypes,\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 { DSDialogT } from './propTypes';\nimport type { DSDialogInternalsT } from './sharedTypes';\n\nconst DSDialog = (props: DSDialogT.Props): JSX.Element | null => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSDialogT.Props>(props, defaultProps);\n const [bodyInfo, setBodyInfo] = useState<DSDialogInternalsT.BodyInfoT>({\n overflow: false,\n paddingRight: '0px',\n scrollbarWidth: '0px',\n });\n\n useValidateTypescriptPropTypes<DSDialogT.Props>(propsWithDefault, propTypes);\n\n const { children, isOpen, onClickOutside, onClose, centered, size, removeAutoFocus, zIndex, ...rest } =\n propsWithDefault;\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n\n const focusContainer = useCallback(() => {\n const isContainerOrChildFocused = containerRef.current?.contains(document.activeElement);\n if (!isContainerOrChildFocused) containerRef.current?.focus?.();\n }, []);\n\n useEffect(() => {\n document.addEventListener('focusin', focusContainer);\n return () => document.removeEventListener('focusin', focusContainer);\n }, [focusContainer]);\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') onClose();\n },\n [onClose],\n );\n\n const { className, ...restOfGlobalAttributes } = useGetGlobalAttributes(propsWithDefault, {\n onClick: handleOutsideClick,\n onKeyDown: handleOnKeyDown,\n });\n\n const calculateScrollbar = useCallback(() => {\n const body = document.getElementsByTagName('body')[0];\n const { clientWidth } = body;\n setBodyInfo((prev) => ({ ...prev, scrollbarWidth: `${window.innerWidth - clientWidth}px` }));\n }, []);\n\n const debouncedCalculateScrollbar = useMemo(() => debounce(calculateScrollbar, 300), [calculateScrollbar]);\n\n useEffect(() => {\n calculateScrollbar();\n }, [calculateScrollbar]);\n\n useEffect(() => {\n window.addEventListener('resize', debouncedCalculateScrollbar);\n return () => {\n window.removeEventListener('resize', debouncedCalculateScrollbar);\n };\n }, [calculateScrollbar, debouncedCalculateScrollbar]);\n\n useEffect(() => {\n if (isOpen) {\n const body = document.getElementsByTagName('body')[0];\n const { clientHeight, scrollHeight } = body;\n const paddingRight = window.getComputedStyle(body, null)?.getPropertyValue('padding-right');\n\n setBodyInfo((prev) => ({ ...prev, overflow: scrollHeight > clientHeight, paddingRight }));\n } else setBodyInfo((prev) => ({ ...prev, overflow: false, paddingRight: '0px' }));\n }, [isOpen]);\n\n useEffect(() => {\n if (isOpen && !removeAutoFocus) containerRef?.current?.focus();\n }, [isOpen, removeAutoFocus]);\n\n if (isOpen) {\n return ReactDOM.createPortal(\n <StyledDialogBackground\n className={className}\n onClick={handleOutsideClick}\n data-portalbg\n data-testid={DSDialogDatatestid.BACKGROUND}\n zIndex={zIndex}\n >\n <FixedBody bodyInfo={bodyInfo} />\n <StyledDialogContainer\n role=\"dialog\"\n aria-modal\n ref={containerRef}\n tabIndex={!removeAutoFocus ? 0 : undefined}\n {...getSpaceProps(rest as Record<string, string | number>)}\n centered={centered}\n data-testid={DSDialogDatatestid.CONTAINER}\n {...restOfGlobalAttributes}\n size={size}\n >\n {children}\n </StyledDialogContainer>\n </StyledDialogBackground>,\n document.getElementsByTagName('body')[0],\n );\n }\n\n return null;\n};\n\nconst DSDialogWithSchema = describe<DSDialogT.Props>(DSDialog);\nDSDialogWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { DSDialog, DSDialogWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAqB;AACrB,mBAA4F;AAC5F,oBAAyB;AACzB,8BAKO;AACP,oBAAyE;AACzE,uBAA0B;AAC1B,0BAA6B;AAC7B,mBAA8B;AAC9B,gCAAmC;AAInC,MAAM,WAAW,CAAC,UAA+C;AAC/D,QAAM,mBAAmB,0DAA8C,OAAO;AAC9E,QAAM,CAAC,UAAU,eAAe,2BAAuC;AAAA,IACrE,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA;AAGlB,8DAAgD,kBAAkB;AAElE,QACE,uBADM,YAAU,QAAQ,gBAAgB,SAAS,UAAU,MAAM,iBAAiB,WAClF,IAD6F,iBAC7F,IAD6F,CAAvF,YAAU,UAAQ,kBAAgB,WAAS,YAAU,QAAM,mBAAiB;AAGpF,QAAM,eAAe,yBAA8B;AAEnD,QAAM,iBAAiB,8BAAY,MAAM;AACvC,UAAM,4BAA4B,aAAa,SAAS,SAAS,SAAS;AAC1E,QAAI,CAAC;AAA2B,mBAAa,SAAS;AAAA,KACrD;AAEH,8BAAU,MAAM;AACd,aAAS,iBAAiB,WAAW;AACrC,WAAO,MAAM,SAAS,oBAAoB,WAAW;AAAA,KACpD,CAAC;AAEJ,QAAM,qBAAqB,8BACzB,CAAC,MAAwB;AACvB,QAAK,EAAE,OAA0B,QAAQ;AAAU;AAAA,KAErD,CAAC;AAGH,QAAM,kBAAkB,8BACtB,CAAC,MAA2B;AAC1B,QAAI,EAAE,QAAQ;AAAU;AAAA,KAE1B,CAAC;AAGH,QAAiD,yDAAuB,kBAAkB;AAAA,IACxF,SAAS;AAAA,IACT,WAAW;AAAA,MAFL,gBAAyC,IAA3B,mCAA2B,IAA3B,CAAd;AAKR,QAAM,qBAAqB,8BAAY,MAAM;AAC3C,UAAM,OAAO,SAAS,qBAAqB,QAAQ;AACnD,UAAM,EAAE,gBAAgB;AACxB,gBAAY,CAAC,SAAU,iCAAK,OAAL,EAAW,gBAAgB,GAAG,OAAO,aAAa;AAAA,KACxE;AAEH,QAAM,8BAA8B,0BAAQ,MAAM,4BAAS,oBAAoB,MAAM,CAAC;AAEtF,8BAAU,MAAM;AACd;AAAA,KACC,CAAC;AAEJ,8BAAU,MAAM;AACd,WAAO,iBAAiB,UAAU;AAClC,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU;AAAA;AAAA,KAEtC,CAAC,oBAAoB;AAExB,8BAAU,MAAM;AACd,QAAI,QAAQ;AACV,YAAM,OAAO,SAAS,qBAAqB,QAAQ;AACnD,YAAM,EAAE,cAAc,iBAAiB;AACvC,YAAM,eAAe,OAAO,iBAAiB,MAAM,OAAO,iBAAiB;AAE3E,kBAAY,CAAC,SAAU,iCAAK,OAAL,EAAW,UAAU,eAAe,cAAc;AAAA;AACpE,kBAAY,CAAC,SAAU,iCAAK,OAAL,EAAW,UAAU,OAAO,cAAc;AAAA,KACvE,CAAC;AAEJ,8BAAU,MAAM;AACd,QAAI,UAAU,CAAC;AAAiB,oBAAc,SAAS;AAAA,KACtD,CAAC,QAAQ;AAEZ,MAAI,QAAQ;AACV,WAAO,yBAAS,aACd,mDAAC,sCAAD;AAAA,MACE;AAAA,MACA,SAAS;AAAA,MACT,iBAAa;AAAA,MACb,eAAa,6CAAmB;AAAA,MAChC;AAAA,OAEA,mDAAC,yBAAD;AAAA,MAAW;AAAA,QACX,mDAAC,qCAAD;AAAA,MACE,MAAK;AAAA,MACL,cAAU;AAAA,MACV,KAAK;AAAA,MACL,UAAU,CAAC,kBAAkB,IAAI;AAAA,OAC7B,gCAAc,QALpB;AAAA,MAME;AAAA,MACA,eAAa,6CAAmB;AAAA,QAC5B,yBARN;AAAA,MASE;AAAA,QAEC,YAGL,SAAS,qBAAqB,QAAQ;AAAA;AAI1C,SAAO;AAAA;AAGT,MAAM,qBAAqB,sCAA0B;AACrD,mBAAmB,YAAY;",
4
+ "sourcesContent": ["import React, { WeakValidationMap } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { propTypes } from './propTypes';\nimport { useDialog } from './config/useDialog';\nimport { DSDialogPortal } from './parts/DSDialogPortal';\nimport { DSDialogContext } from './DSDialogCTX';\nimport type { DSDialogT } from './propTypes';\n\nconst DSDialog = (props: DSDialogT.Props): JSX.Element => {\n const ctx = useDialog(props);\n\n return (\n <DSDialogContext.Provider value={ctx}>\n <DSDialogPortal />\n </DSDialogContext.Provider>\n );\n};\n\nconst DSDialogWithSchema = describe(DSDialog);\nDSDialogWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { DSDialog, DSDialogWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAyC;AACzC,0BAAyB;AACzB,uBAA0B;AAC1B,uBAA0B;AAC1B,4BAA+B;AAC/B,yBAAgC;AAGhC,MAAM,WAAW,CAAC,UAAwC;AACxD,QAAM,MAAM,gCAAU,KAAK;AAE3B,SACE,mDAAC,mCAAgB,UAAhB;AAAA,IAAyB,OAAO;AAAA,KAC/B,mDAAC,0CAAe,CAClB;AAEJ;AAEA,MAAM,qBAAqB,kCAAS,QAAQ;AAC5C,mBAAmB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,30 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var DSDialogCTX_exports = {};
22
+ __export(DSDialogCTX_exports, {
23
+ DSDialogContext: () => DSDialogContext
24
+ });
25
+ module.exports = __toCommonJS(DSDialogCTX_exports);
26
+ var React = __toESM(require("react"));
27
+ var import_react = require("react");
28
+ const defaultContext = {};
29
+ const DSDialogContext = (0, import_react.createContext)(defaultContext);
30
+ //# sourceMappingURL=DSDialogCTX.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSDialogCTX.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { createContext } from 'react';\nimport type { DSDialogInternalsT } from './sharedTypes';\n\nconst defaultContext = {} as DSDialogInternalsT.DSDialogContext;\n\nexport const DSDialogContext = createContext<DSDialogInternalsT.DSDialogContext>(defaultContext);\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAG9B,MAAM,iBAAiB,CAAC;AAEjB,MAAM,kBAAkB,gCAAkD,cAAc;",
6
+ "names": []
7
+ }
@@ -4,35 +4,28 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
11
10
  };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
16
  }
18
- return target;
17
+ return to;
19
18
  };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
21
  var DSDialogDatatestid_exports = {};
29
22
  __export(DSDialogDatatestid_exports, {
30
23
  DSDialogDatatestid: () => DSDialogDatatestid
31
24
  });
25
+ module.exports = __toCommonJS(DSDialogDatatestid_exports);
32
26
  var React = __toESM(require("react"));
33
27
  const DSDialogDatatestid = {
34
28
  CONTAINER: "ds-dialog-container",
35
29
  BACKGROUND: "ds-dialog-background"
36
30
  };
37
- module.exports = __toCommonJS(DSDialogDatatestid_exports);
38
31
  //# sourceMappingURL=DSDialogDatatestid.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSDialogDatatestid.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["export const DSDialogDatatestid = {\n CONTAINER: 'ds-dialog-container',\n BACKGROUND: 'ds-dialog-background',\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,YAAY;AAAA;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,YAAY;AACd;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,110 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
+ var useDialog_exports = {};
39
+ __export(useDialog_exports, {
40
+ useDialog: () => useDialog
41
+ });
42
+ module.exports = __toCommonJS(useDialog_exports);
43
+ var React = __toESM(require("react"));
44
+ var import_react = require("react");
45
+ var import_lodash = require("lodash");
46
+ var import_uid = require("uid");
47
+ var import_ds_utilities = require("@elliemae/ds-utilities");
48
+ var import_defaultProps = require("../defaultProps");
49
+ var import_propTypes = require("../propTypes");
50
+ var import_utils = require("../utils");
51
+ const useDialog = (props) => {
52
+ (0, import_ds_utilities.useValidateTypescriptPropTypes)(props, import_propTypes.propTypes);
53
+ const propsWithDefault = (0, import_ds_utilities.useMemoMergePropsWithDefault)(props, import_defaultProps.defaultProps);
54
+ const { portalRef, isOpen } = propsWithDefault;
55
+ const actualPortalRef = (0, import_react.useRef)(null);
56
+ const containerRef = (0, import_react.useRef)(null);
57
+ const [portalInfo, setPortalInfo] = (0, import_react.useState)({
58
+ paddingRight: "0px",
59
+ scrollbarWidth: "0px"
60
+ });
61
+ const portalClassName = (0, import_react.useMemo)(() => `ds-dialog-${(0, import_uid.uid)(8)}`, []);
62
+ (0, import_react.useEffect)(() => {
63
+ if (portalRef)
64
+ actualPortalRef.current = portalRef.current;
65
+ else
66
+ actualPortalRef.current = document.getElementsByTagName("body")["0"];
67
+ }, [portalRef]);
68
+ (0, import_react.useLayoutEffect)(() => {
69
+ if (actualPortalRef.current) {
70
+ if (isOpen) {
71
+ actualPortalRef.current.classList.add(portalClassName);
72
+ } else {
73
+ actualPortalRef.current.classList.remove(portalClassName);
74
+ }
75
+ }
76
+ }, [actualPortalRef, isOpen, portalClassName]);
77
+ (0, import_react.useEffect)(() => {
78
+ if (actualPortalRef.current) {
79
+ setPortalInfo((prev) => __spreadProps(__spreadValues({}, prev), {
80
+ paddingRight: (0, import_utils.getCurrentRightPadding)(actualPortalRef.current)
81
+ }));
82
+ }
83
+ }, []);
84
+ const calculateScrollbar = (0, import_react.useCallback)(() => {
85
+ if (actualPortalRef.current && !isOpen) {
86
+ setPortalInfo((prev) => __spreadProps(__spreadValues({}, prev), {
87
+ scrollbarWidth: (0, import_utils.getScrollbarWidth)(actualPortalRef.current)
88
+ }));
89
+ }
90
+ }, [isOpen]);
91
+ const debouncedCalculateScrollbar = (0, import_react.useMemo)(() => (0, import_lodash.debounce)(calculateScrollbar, 300), [calculateScrollbar]);
92
+ (0, import_react.useEffect)(() => {
93
+ window.addEventListener("resize", debouncedCalculateScrollbar);
94
+ return () => {
95
+ window.removeEventListener("resize", debouncedCalculateScrollbar);
96
+ };
97
+ }, [calculateScrollbar, debouncedCalculateScrollbar]);
98
+ (0, import_react.useEffect)(() => {
99
+ calculateScrollbar();
100
+ }, [calculateScrollbar, isOpen]);
101
+ const ctx = (0, import_react.useMemo)(() => ({
102
+ props: propsWithDefault,
103
+ actualPortalRef,
104
+ containerRef,
105
+ portalInfo,
106
+ portalClassName
107
+ }), [portalClassName, portalInfo, propsWithDefault]);
108
+ return ctx;
109
+ };
110
+ //# sourceMappingURL=useDialog.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/useDialog.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,iCACpB,OADoB;AAAA,QAEvB,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,iCACpB,OADoB;AAAA,QAEvB,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
+ "names": []
7
+ }
@@ -4,31 +4,25 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
11
10
  };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
16
  }
18
- return target;
17
+ return to;
19
18
  };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
21
  var defaultProps_exports = {};
29
22
  __export(defaultProps_exports, {
30
23
  defaultProps: () => defaultProps
31
24
  });
25
+ module.exports = __toCommonJS(defaultProps_exports);
32
26
  var React = __toESM(require("react"));
33
27
  var import_utils = require("./utils");
34
28
  const noop = () => {
@@ -40,7 +34,8 @@ const defaultProps = {
40
34
  removeAutoFocus: false,
41
35
  onClickOutside: noop,
42
36
  onClose: noop,
43
- zIndex: 10
37
+ zIndex: 10,
38
+ portalRef: null,
39
+ children: []
44
40
  };
45
- module.exports = __toCommonJS(defaultProps_exports);
46
41
  //# sourceMappingURL=defaultProps.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/defaultProps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { DSDialogSizes } from './utils';\nimport type { DSDialogT } from './propTypes';\n\nconst noop = () => {};\n\nexport const defaultProps: DSDialogT.DefaultProps = {\n isOpen: false,\n centered: false,\n size: DSDialogSizes.DEFAULT,\n removeAutoFocus: false,\n onClickOutside: noop,\n onClose: noop,\n zIndex: 10,\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAG9B,MAAM,OAAO,MAAM;AAAA;AAEZ,MAAM,eAAuC;AAAA,EAClD,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM,2BAAc;AAAA,EACpB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,QAAQ;AAAA;",
4
+ "sourcesContent": ["import { DSDialogSizes } from './utils';\nimport type { DSDialogT } from './propTypes';\n\nconst noop = () => {};\n\nexport const defaultProps: DSDialogT.DefaultProps = {\n isOpen: false,\n centered: false,\n size: DSDialogSizes.DEFAULT,\n removeAutoFocus: false,\n onClickOutside: noop,\n onClose: noop,\n zIndex: 10,\n portalRef: null,\n children: [],\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAG9B,MAAM,OAAO,MAAM;AAAC;AAEb,MAAM,eAAuC;AAAA,EAClD,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM,2BAAc;AAAA,EACpB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU,CAAC;AACb;",
6
6
  "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -4,27 +4,21 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
7
  var __export = (target, all) => {
9
8
  for (var name in all)
10
9
  __defProp(target, name, { get: all[name], enumerable: true });
11
10
  };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
16
  }
18
- return target;
17
+ return to;
19
18
  };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
22
  var src_exports = {};
29
23
  __export(src_exports, {
30
24
  DSDialogAddon: () => import_styles.DSDialogAddon,
@@ -47,22 +41,23 @@ __export(src_exports, {
47
41
  DSDialogTitle: () => import_styles.DSDialogTitle,
48
42
  DSDialogTitleWithSchema: () => DSDialogTitleWithSchema
49
43
  });
44
+ module.exports = __toCommonJS(src_exports);
50
45
  var React = __toESM(require("react"));
51
46
  var import_react_desc = require("react-desc");
52
- var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
47
+ var import_ds_utilities = require("@elliemae/ds-utilities");
53
48
  var import_styles = require("./styles");
54
- __reExport(src_exports, require("./DSDialog"));
55
- __reExport(src_exports, require("./DSDialogDatatestid"));
49
+ __reExport(src_exports, require("./DSDialog"), module.exports);
50
+ __reExport(src_exports, require("./DSDialogDatatestid"), module.exports);
56
51
  var import_utils = require("./utils");
57
- import_styles.DSDialogBody.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
58
- import_styles.DSDialogHeader.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
59
- import_styles.DSDialogFooter.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
60
- import_styles.DSDialogSeparator.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
61
- import_styles.DSDialogTitle.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
62
- import_styles.DSDialogAddon.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
63
- import_styles.DSDialogDefaultLayout.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
64
- import_styles.DSDialogPrimaryMessage.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
65
- import_styles.DSDialogSecondaryMessage.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
52
+ import_styles.DSDialogBody.propTypes = import_ds_utilities.globalAttributesPropTypes;
53
+ import_styles.DSDialogHeader.propTypes = import_ds_utilities.globalAttributesPropTypes;
54
+ import_styles.DSDialogFooter.propTypes = import_ds_utilities.globalAttributesPropTypes;
55
+ import_styles.DSDialogSeparator.propTypes = import_ds_utilities.globalAttributesPropTypes;
56
+ import_styles.DSDialogTitle.propTypes = import_ds_utilities.globalAttributesPropTypes;
57
+ import_styles.DSDialogAddon.propTypes = import_ds_utilities.globalAttributesPropTypes;
58
+ import_styles.DSDialogDefaultLayout.propTypes = import_ds_utilities.globalAttributesPropTypes;
59
+ import_styles.DSDialogPrimaryMessage.propTypes = import_ds_utilities.globalAttributesPropTypes;
60
+ import_styles.DSDialogSecondaryMessage.propTypes = import_ds_utilities.globalAttributesPropTypes;
66
61
  import_styles.DSDialogBody.displayName = "DSDialogBody";
67
62
  import_styles.DSDialogHeader.displayName = "DSDialogHeader";
68
63
  import_styles.DSDialogFooter.displayName = "DSDialogFooter";
@@ -81,14 +76,13 @@ const DSDialogAddonWithSchema = (0, import_react_desc.describe)(import_styles.DS
81
76
  const DSDialogDefaultLayoutWithSchema = (0, import_react_desc.describe)(import_styles.DSDialogDefaultLayout);
82
77
  const DSDialogPrimaryMessageWithSchema = (0, import_react_desc.describe)(import_styles.DSDialogPrimaryMessage);
83
78
  const DSDialogSecondaryMessageWithSchema = (0, import_react_desc.describe)(import_styles.DSDialogSecondaryMessage);
84
- DSDialogBodyWithSchema.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
85
- DSDialogHeaderWithSchema.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
86
- DSDialogFooterWithSchema.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
87
- DSDialogSeparatorWithSchema.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
88
- DSDialogTitleWithSchema.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
89
- DSDialogAddonWithSchema.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
90
- DSDialogDefaultLayoutWithSchema.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
91
- DSDialogPrimaryMessageWithSchema.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
92
- DSDialogSecondaryMessageWithSchema.propTypes = import_ds_props_helpers.globalAttributesPropTypes;
93
- module.exports = __toCommonJS(src_exports);
79
+ DSDialogBodyWithSchema.propTypes = import_ds_utilities.globalAttributesPropTypes;
80
+ DSDialogHeaderWithSchema.propTypes = import_ds_utilities.globalAttributesPropTypes;
81
+ DSDialogFooterWithSchema.propTypes = import_ds_utilities.globalAttributesPropTypes;
82
+ DSDialogSeparatorWithSchema.propTypes = import_ds_utilities.globalAttributesPropTypes;
83
+ DSDialogTitleWithSchema.propTypes = import_ds_utilities.globalAttributesPropTypes;
84
+ DSDialogAddonWithSchema.propTypes = import_ds_utilities.globalAttributesPropTypes;
85
+ DSDialogDefaultLayoutWithSchema.propTypes = import_ds_utilities.globalAttributesPropTypes;
86
+ DSDialogPrimaryMessageWithSchema.propTypes = import_ds_utilities.globalAttributesPropTypes;
87
+ DSDialogSecondaryMessageWithSchema.propTypes = import_ds_utilities.globalAttributesPropTypes;
94
88
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["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;\n\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", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAyB;AACzB,8BAA0C;AAC1C,oBAUO;AA0CP,wBAAc;AACd,wBAAc;AACd,mBAA8B;AA1C9B,2BAAa,YAAY;AACzB,6BAAe,YAAY;AAC3B,6BAAe,YAAY;AAC3B,gCAAkB,YAAY;AAC9B,4BAAc,YAAY;AAC1B,4BAAc,YAAY;AAC1B,oCAAsB,YAAY;AAClC,qCAAuB,YAAY;AACnC,uCAAyB,YAAY;AAErC,2BAAa,cAAc;AAC3B,6BAAe,cAAc;AAC7B,6BAAe,cAAc;AAC7B,gCAAkB,cAAc;AAChC,4BAAc,cAAc;AAC5B,4BAAc,cAAc;AAC5B,oCAAsB,cAAc;AACpC,qCAAuB,cAAc;AACrC,uCAAyB,cAAc;AAEvC,MAAM,yBAAyB,gCAAS;AACxC,MAAM,2BAA2B,gCAAS;AAC1C,MAAM,2BAA2B,gCAAS;AAC1C,MAAM,8BAA8B,gCAAS;AAC7C,MAAM,0BAA0B,gCAAS;AACzC,MAAM,0BAA0B,gCAAS;AACzC,MAAM,kCAAkC,gCAAS;AACjD,MAAM,mCAAmC,gCAAS;AAClD,MAAM,qCAAqC,gCAAS;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;",
4
+ "sourcesContent": ["import { describe } from 'react-desc';\nimport { globalAttributesPropTypes } from '@elliemae/ds-utilities';\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;\n\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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAyB;AACzB,0BAA0C;AAC1C,oBAUO;AA0CP,wBAAc,uBAtDd;AAuDA,wBAAc,iCAvDd;AAwDA,mBAA8B;AA1C9B,2BAAa,YAAY;AACzB,6BAAe,YAAY;AAC3B,6BAAe,YAAY;AAC3B,gCAAkB,YAAY;AAC9B,4BAAc,YAAY;AAC1B,4BAAc,YAAY;AAC1B,oCAAsB,YAAY;AAClC,qCAAuB,YAAY;AACnC,uCAAyB,YAAY;AAErC,2BAAa,cAAc;AAC3B,6BAAe,cAAc;AAC7B,6BAAe,cAAc;AAC7B,gCAAkB,cAAc;AAChC,4BAAc,cAAc;AAC5B,4BAAc,cAAc;AAC5B,oCAAsB,cAAc;AACpC,qCAAuB,cAAc;AACrC,uCAAyB,cAAc;AAEvC,MAAM,yBAAyB,gCAAS,0BAAY;AACpD,MAAM,2BAA2B,gCAAS,4BAAc;AACxD,MAAM,2BAA2B,gCAAS,4BAAc;AACxD,MAAM,8BAA8B,gCAAS,+BAAiB;AAC9D,MAAM,0BAA0B,gCAAS,2BAAa;AACtD,MAAM,0BAA0B,gCAAS,2BAAa;AACtD,MAAM,kCAAkC,gCAAS,mCAAqB;AACtE,MAAM,mCAAmC,gCAAS,oCAAsB;AACxE,MAAM,qCAAqC,gCAAS,sCAAwB;AAE5E,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;",
6
6
  "names": []
7
7
  }