@elliemae/ds-dialog 2.2.0-alpha.4 → 3.0.0-next.2

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/cjs/styles.js CHANGED
@@ -1,150 +1,121 @@
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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
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 });
17
- }
18
- return target;
19
- };
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);
28
- var styles_exports = {};
29
- __export(styles_exports, {
30
- DSDialogAddon: () => DSDialogAddon,
31
- DSDialogBody: () => DSDialogBody,
32
- DSDialogDefaultLayout: () => DSDialogDefaultLayout,
33
- DSDialogFooter: () => DSDialogFooter,
34
- DSDialogHeader: () => DSDialogHeader,
35
- DSDialogPrimaryMessage: () => DSDialogPrimaryMessage,
36
- DSDialogSecondaryMessage: () => DSDialogSecondaryMessage,
37
- DSDialogSeparator: () => DSDialogSeparator,
38
- DSDialogTitle: () => DSDialogTitle,
39
- FixedBody: () => FixedBody,
40
- StyledDialogBackground: () => StyledDialogBackground,
41
- StyledDialogContainer: () => StyledDialogContainer
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
+ var styled = require('@xstyled/styled-components');
7
+ var utils = require('./utils.js');
8
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
12
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
13
+
14
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
15
+ const FixedBody = styled.createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n body {\n overflow: hidden;\n \n ", "\n }\n"])), _ref => {
16
+ let {
17
+ isBodyOverflow
18
+ } = _ref;
19
+ return isBodyOverflow ? "padding-right: 15px !important;" : "";
20
+ });
21
+ const StyledDialogBackground = styled__default["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n position: fixed;\n top: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n background: rgba(37, 41, 47, 50%);\n overflow-y: auto;\n z-index: ", ";\n"])), _ref2 => {
22
+ let {
23
+ zIndex
24
+ } = _ref2;
25
+ return zIndex;
26
+ });
27
+ const StyledDialogContainer = styled__default["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n height: fit-content;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: ", ";\n width: ", ";\n min-width: 300px;\n box-shadow: 0 10px 20px 0 ", ";\n background: ", ";\n overflow-y: auto;\n ", "\n &:focus {\n outline: none;\n }\n"])), _ref3 => {
28
+ let {
29
+ centered
30
+ } = _ref3;
31
+ return centered ? 'auto' : '20vh auto auto auto';
32
+ }, _ref4 => {
33
+ let {
34
+ size
35
+ } = _ref4;
36
+ return utils.allSizes[size];
37
+ }, _ref5 => {
38
+ let {
39
+ theme
40
+ } = _ref5;
41
+ return theme.colors.neutral[500];
42
+ }, _ref6 => {
43
+ let {
44
+ theme
45
+ } = _ref6;
46
+ return theme.colors.neutral['000'];
47
+ }, styled.space);
48
+ const DSDialogTitle = styled__default["default"].h3(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n font-size: ", ";\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n margin: 0;\n"])), _ref7 => {
49
+ let {
50
+ theme
51
+ } = _ref7;
52
+ return theme.fontSizes.title[700];
53
+ });
54
+ const DSDialogAddon = styled__default["default"].div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral__default["default"]([""])));
55
+ const DSDialogHeader = styled__default["default"].div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral__default["default"](["\n display: grid;\n align-items: center;\n grid-auto-flow: column;\n min-height: ", ";\n padding: 10px ", ";\n & ", " + ", " {\n align-self: flex-start;\n justify-self: flex-end;\n }\n & ", ":only-child {\n justify-self: flex-end;\n }\n ", "\n"])), _ref8 => {
56
+ let {
57
+ theme
58
+ } = _ref8;
59
+ return theme.space.m;
60
+ }, _ref9 => {
61
+ let {
62
+ theme
63
+ } = _ref9;
64
+ return theme.space.xs;
65
+ }, DSDialogTitle, DSDialogAddon, DSDialogAddon, styled.space);
66
+ const DSDialogSeparator = styled__default["default"].hr.attrs(() => ({
67
+ 'aria-hidden': true
68
+ }))(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral__default["default"](["\n margin: 0;\n border-top: 1px solid ", ";\n"])), _ref10 => {
69
+ let {
70
+ theme
71
+ } = _ref10;
72
+ return theme.colors.neutral['080'];
73
+ });
74
+ const DSDialogBody = styled__default["default"].div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral__default["default"](["\n padding: ", ";\n overflow-y: auto;\n ", "\n ", "\n ", "\n ", "\n"])), _ref11 => {
75
+ let {
76
+ theme
77
+ } = _ref11;
78
+ return theme.space.xs;
79
+ }, styled.layout, styled.space, styled.flexboxes, styled.sizing);
80
+ const DSDialogPrimaryMessage = styled__default["default"].h3(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral__default["default"](["\n margin: 0;\n"])));
81
+ const DSDialogSecondaryMessage = styled__default["default"].p(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral__default["default"](["\n margin: 0;\n color: ", ";\n"])), _ref12 => {
82
+ let {
83
+ theme
84
+ } = _ref12;
85
+ return theme.colors.neutral[500];
42
86
  });
43
- var React = __toESM(require("react"));
44
- var import_styled_components = __toESM(require("styled-components"));
45
- var import_ds_system = require("@elliemae/ds-system");
46
- var import_styled_components2 = require("@xstyled/styled-components");
47
- var import_utils = require("./utils");
48
- const FixedBody = import_ds_system.createGlobalStyle`
49
- body {
50
- overflow: hidden;
51
-
52
- ${({ isBodyOverflow }) => isBodyOverflow ? `padding-right: 15px !important;` : ``}
53
- }
54
- `;
55
- const StyledDialogBackground = import_styled_components.default.div`
56
- position: fixed;
57
- top: 0;
58
- bottom: 0;
59
- width: 100%;
60
- height: 100%;
61
- background: rgba(37, 41, 47, 50%);
62
- overflow-y: auto;
63
- z-index: ${({ zIndex }) => zIndex};
64
- `;
65
- const StyledDialogContainer = import_styled_components.default.div`
66
- height: fit-content;
67
- position: absolute;
68
- top: 0;
69
- bottom: 0;
70
- left: 0;
71
- right: 0;
72
- margin: ${({ centered }) => centered ? "auto" : "20vh auto auto auto"};
73
- width: ${({ size }) => import_utils.allSizes[size]};
74
- min-width: 300px;
75
- box-shadow: 0 10px 20px 0 ${({ theme }) => theme.colors.neutral[500]};
76
- background: ${({ theme }) => theme.colors.neutral["000"]};
77
- overflow-y: auto;
78
- ${import_styled_components2.space}
79
- &:focus {
80
- outline: none;
81
- }
82
- `;
83
- const DSDialogTitle = import_styled_components.default.h3`
84
- font-size: ${({ theme }) => theme.fontSizes.title[700]};
85
- display: -webkit-box;
86
- -webkit-line-clamp: 2;
87
- -webkit-box-orient: vertical;
88
- overflow: hidden;
89
- margin: 0;
90
- `;
91
- const DSDialogAddon = import_styled_components.default.div``;
92
- const DSDialogHeader = import_styled_components.default.div`
93
- display: grid;
94
- align-items: center;
95
- grid-auto-flow: column;
96
- min-height: ${({ theme }) => theme.space.m};
97
- padding: 10px ${({ theme }) => theme.space.xs};
98
- & ${DSDialogTitle} + ${DSDialogAddon} {
99
- align-self: flex-start;
100
- justify-self: flex-end;
101
- }
102
- & ${DSDialogAddon}:only-child {
103
- justify-self: flex-end;
104
- }
105
- ${import_styled_components2.space}
106
- `;
107
- const DSDialogSeparator = import_styled_components.default.hr.attrs(() => ({ "aria-hidden": true }))`
108
- margin: 0;
109
- border-top: 1px solid ${({ theme }) => theme.colors.neutral["080"]};
110
- `;
111
- const DSDialogBody = import_styled_components.default.div`
112
- padding: ${({ theme }) => theme.space.xs};
113
- overflow-y: auto;
114
- ${import_styled_components2.layout}
115
- ${import_styled_components2.space}
116
- ${import_styled_components2.flexboxes}
117
- ${import_styled_components2.sizing}
118
- `;
119
- const DSDialogPrimaryMessage = import_styled_components.default.h3`
120
- margin: 0;
121
- `;
122
- const DSDialogSecondaryMessage = import_styled_components.default.p`
123
- margin: 0;
124
- color: ${({ theme }) => theme.colors.neutral[500]};
125
- `;
126
- const DSDialogDefaultLayout = import_styled_components.default.div`
127
- display: grid;
128
- grid-auto-flow: row;
129
- justify-items: center;
130
- align-items: center;
131
- grid-gap: ${({ theme }) => theme.space.xxs};
87
+ const DSDialogDefaultLayout = styled__default["default"].div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral__default["default"](["\n display: grid;\n grid-auto-flow: row;\n justify-items: center;\n align-items: center;\n grid-gap: ", ";\n\n ", " {\n text-align: center;\n }\n"])), _ref13 => {
88
+ let {
89
+ theme
90
+ } = _ref13;
91
+ return theme.space.xxs;
92
+ }, DSDialogSecondaryMessage);
93
+ const DSDialogFooter = styled__default["default"].div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral__default["default"](["\n display: grid;\n grid-auto-flow: column;\n align-items: center;\n justify-content: flex-end;\n grid-gap: ", ";\n min-height: ", ";\n padding: 0 ", ";\n ", "\n ", "\n ", "\n"])), _ref14 => {
94
+ let {
95
+ theme
96
+ } = _ref14;
97
+ return theme.space.xxs;
98
+ }, _ref15 => {
99
+ let {
100
+ theme
101
+ } = _ref15;
102
+ return theme.space.m;
103
+ }, _ref16 => {
104
+ let {
105
+ theme
106
+ } = _ref16;
107
+ return theme.space.xs;
108
+ }, styled.space, styled.flexboxes, styled.sizing);
132
109
 
133
- ${DSDialogSecondaryMessage} {
134
- text-align: center;
135
- }
136
- `;
137
- const DSDialogFooter = import_styled_components.default.div`
138
- display: grid;
139
- grid-auto-flow: column;
140
- align-items: center;
141
- justify-content: flex-end;
142
- grid-gap: ${({ theme }) => theme.space.xxs};
143
- min-height: ${({ theme }) => theme.space.m};
144
- padding: 0 ${({ theme }) => theme.space.xs};
145
- ${import_styled_components2.space}
146
- ${import_styled_components2.flexboxes}
147
- ${import_styled_components2.sizing}
148
- `;
149
- module.exports = __toCommonJS(styles_exports);
150
- //# sourceMappingURL=styles.js.map
110
+ exports.DSDialogAddon = DSDialogAddon;
111
+ exports.DSDialogBody = DSDialogBody;
112
+ exports.DSDialogDefaultLayout = DSDialogDefaultLayout;
113
+ exports.DSDialogFooter = DSDialogFooter;
114
+ exports.DSDialogHeader = DSDialogHeader;
115
+ exports.DSDialogPrimaryMessage = DSDialogPrimaryMessage;
116
+ exports.DSDialogSecondaryMessage = DSDialogSecondaryMessage;
117
+ exports.DSDialogSeparator = DSDialogSeparator;
118
+ exports.DSDialogTitle = DSDialogTitle;
119
+ exports.FixedBody = FixedBody;
120
+ exports.StyledDialogBackground = StyledDialogBackground;
121
+ exports.StyledDialogContainer = StyledDialogContainer;
package/cjs/utils.js CHANGED
@@ -1,55 +1,35 @@
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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
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 });
17
- }
18
- return target;
19
- };
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);
28
- var utils_exports = {};
29
- __export(utils_exports, {
30
- DSDialogSizes: () => DSDialogSizes,
31
- DSDialogSizesArrayValues: () => DSDialogSizesArrayValues,
32
- allSizes: () => allSizes,
33
- getSpaceProps: () => getSpaceProps
34
- });
35
- var React = __toESM(require("react"));
36
- const getSpaceProps = (props) => Object.fromEntries(Object.entries(props).filter(([key]) => /^[pm][xytblr]?$/.exec(key)));
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/esnext.async-iterator.filter.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.filter.js');
8
+ require('core-js/modules/web.dom-collections.iterator.js');
9
+
10
+ const getSpaceProps = props => Object.fromEntries(Object.entries(props).filter(_ref => {
11
+ let [key] = _ref;
12
+ return /^[pm][xytblr]?$/.exec(key);
13
+ }));
37
14
  const DSDialogSizes = {
38
- DEFAULT: "default",
39
- SMALL: "small",
40
- MEDIUM: "medium",
41
- LARGE: "large",
42
- XLARGE: "x-large",
43
- XXLARGE: "xx-large"
15
+ DEFAULT: 'default',
16
+ SMALL: 'small',
17
+ MEDIUM: 'medium',
18
+ LARGE: 'large',
19
+ XLARGE: 'x-large',
20
+ XXLARGE: 'xx-large'
44
21
  };
45
22
  const DSDialogSizesArrayValues = Object.values(DSDialogSizes);
46
23
  const allSizes = {
47
- default: "576px",
48
- small: "320px",
49
- medium: "656px",
50
- large: "848px",
51
- "x-large": "1042px",
52
- "xx-large": "1440px"
24
+ default: '576px',
25
+ small: '320px',
26
+ medium: '656px',
27
+ large: '848px',
28
+ 'x-large': '1042px',
29
+ 'xx-large': '1440px'
53
30
  };
54
- module.exports = __toCommonJS(utils_exports);
55
- //# sourceMappingURL=utils.js.map
31
+
32
+ exports.DSDialogSizes = DSDialogSizes;
33
+ exports.DSDialogSizesArrayValues = DSDialogSizesArrayValues;
34
+ exports.allSizes = allSizes;
35
+ exports.getSpaceProps = getSpaceProps;
package/esm/DSDialog.js CHANGED
@@ -1,65 +1,100 @@
1
- import * as React from "react";
2
- import ReactDOM from "react-dom";
3
- import React2, { useCallback, useRef, useEffect, useState } from "react";
4
- import { describe } from "react-desc";
5
- import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
6
- import { FixedBody, StyledDialogBackground, StyledDialogContainer } from "./styles";
7
- import { propTypes } from "./propTypes";
8
- import { defaultProps } from "./defaultProps";
9
- import { getSpaceProps } from "./utils";
10
- import { DSDialogDatatestid } from "./DSDialogDatatestid";
11
- const DSDialog = (props) => {
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.filter.js';
4
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
5
+ import 'core-js/modules/esnext.iterator.for-each.js';
6
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
8
+ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
+ import 'core-js/modules/web.dom-collections.iterator.js';
10
+ import ReactDOM from 'react-dom';
11
+ import { useState, useRef, useCallback, useEffect } from 'react';
12
+ import { describe } from 'react-desc';
13
+ import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
14
+ import { StyledDialogBackground, FixedBody, StyledDialogContainer } from './styles.js';
15
+ import { propTypes } from './propTypes.js';
16
+ import { defaultProps } from './defaultProps.js';
17
+ import { getSpaceProps } from './utils.js';
18
+ import { DSDialogDatatestid } from './DSDialogDatatestid.js';
19
+ import { jsxs, jsx } from 'react/jsx-runtime';
20
+
21
+ const _excluded = ["children", "isOpen", "onClickOutside", "centered", "size", "removeAutoFocus", "zIndex"];
22
+
23
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24
+
25
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
+
27
+ const DSDialog = props => {
28
+ var _FixedBody;
29
+
12
30
  const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
13
31
  const [isBodyOverflow, setIsBodyOverflow] = useState(false);
14
32
  useValidateTypescriptPropTypes(propsWithDefault, propTypes);
15
- const { children, isOpen, onClickOutside, centered, size, removeAutoFocus, zIndex, ...rest } = propsWithDefault;
33
+
34
+ const {
35
+ children,
36
+ isOpen,
37
+ onClickOutside,
38
+ centered,
39
+ size,
40
+ removeAutoFocus,
41
+ zIndex
42
+ } = propsWithDefault,
43
+ rest = _objectWithoutProperties(propsWithDefault, _excluded);
44
+
16
45
  const containerRef = useRef(null);
17
- const handleOutsideClick = useCallback((e) => {
18
- if (e.target.dataset.portalbg)
19
- onClickOutside();
46
+ const handleOutsideClick = useCallback(e => {
47
+ if (e.target.dataset.portalbg) onClickOutside();
20
48
  }, [onClickOutside]);
21
- const handleOnKeyDown = useCallback((e) => {
22
- if (e.key === "Escape")
23
- onClickOutside();
49
+ const handleOnKeyDown = useCallback(e => {
50
+ if (e.key === 'Escape') onClickOutside();
24
51
  }, [onClickOutside]);
25
52
  useEffect(() => {
26
- const body = document.getElementsByTagName("body")[0];
27
- const { offsetHeight, scrollHeight } = body;
28
- if (!isOpen)
29
- return setIsBodyOverflow(false);
53
+ const body = document.getElementsByTagName('body')[0];
54
+ const {
55
+ offsetHeight,
56
+ scrollHeight
57
+ } = body;
58
+ if (!isOpen) return setIsBodyOverflow(false);
30
59
  return setIsBodyOverflow(offsetHeight < scrollHeight);
31
60
  }, [isOpen]);
32
61
  useEffect(() => {
33
- if (isOpen && !removeAutoFocus)
34
- containerRef?.current?.focus();
62
+ var _containerRef$current;
63
+
64
+ if (isOpen && !removeAutoFocus) containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.focus();
35
65
  }, [isOpen, removeAutoFocus]);
66
+ const globalAttributes = useGetGlobalAttributes(propsWithDefault, {
67
+ onClick: handleOutsideClick
68
+ });
69
+
36
70
  if (isOpen) {
37
- return ReactDOM.createPortal(/* @__PURE__ */ React2.createElement(StyledDialogBackground, {
71
+ return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/jsxs(StyledDialogBackground, _objectSpread(_objectSpread({
38
72
  onClick: handleOutsideClick,
39
73
  "data-portalbg": true,
40
74
  "data-testid": DSDialogDatatestid.BACKGROUND,
41
- zIndex
42
- }, /* @__PURE__ */ React2.createElement(FixedBody, {
43
- isBodyOverflow
44
- }), /* @__PURE__ */ React2.createElement(StyledDialogContainer, {
45
- role: "dialog",
46
- "aria-modal": true,
47
- ref: containerRef,
48
- tabIndex: !removeAutoFocus ? 0 : void 0,
49
- onKeyDown: handleOnKeyDown,
50
- ...getSpaceProps(rest),
51
- size,
52
- centered,
53
- "data-testid": DSDialogDatatestid.CONTAINER
54
- }, children)), document.getElementsByTagName("body")[0]);
75
+ zIndex: zIndex
76
+ }, globalAttributes), {}, {
77
+ children: [_FixedBody || (_FixedBody = /*#__PURE__*/_jsx(FixedBody, {
78
+ isBodyOverflow: isBodyOverflow
79
+ })), /*#__PURE__*/jsx(StyledDialogContainer, _objectSpread(_objectSpread({
80
+ role: "dialog",
81
+ "aria-modal": true,
82
+ ref: containerRef,
83
+ tabIndex: !removeAutoFocus ? 0 : undefined,
84
+ onKeyDown: handleOnKeyDown
85
+ }, getSpaceProps(rest)), {}, {
86
+ size: size,
87
+ centered: centered,
88
+ "data-testid": DSDialogDatatestid.CONTAINER,
89
+ children: children
90
+ }))]
91
+ })), document.getElementsByTagName('body')[0]);
55
92
  }
93
+
56
94
  return null;
57
95
  };
58
- DSDialog.propTypes = propTypes;
96
+
59
97
  const DSDialogWithSchema = describe(DSDialog);
60
98
  DSDialogWithSchema.propTypes = propTypes;
61
- export {
62
- DSDialog,
63
- DSDialogWithSchema
64
- };
65
- //# sourceMappingURL=DSDialog.js.map
99
+
100
+ export { DSDialog, DSDialogWithSchema };
@@ -1,9 +1,6 @@
1
- import * as React from "react";
2
1
  const DSDialogDatatestid = {
3
- CONTAINER: "ds-dialog-container",
4
- BACKGROUND: "ds-dialog-background"
2
+ CONTAINER: 'ds-dialog-container',
3
+ BACKGROUND: 'ds-dialog-background'
5
4
  };
6
- export {
7
- DSDialogDatatestid
8
- };
9
- //# sourceMappingURL=DSDialogDatatestid.js.map
5
+
6
+ export { DSDialogDatatestid };
@@ -1,2 +1 @@
1
- import * as React from "react";
2
- //# sourceMappingURL=DSDialogInternalTypes.d.js.map
1
+
@@ -1,2 +1 @@
1
- import * as React from "react";
2
- //# sourceMappingURL=DSDialogTypes.js.map
1
+
@@ -1,7 +1,7 @@
1
- import * as React from "react";
2
- import { DSDialogSizes } from "./utils";
3
- const noop = () => {
4
- };
1
+ import { DSDialogSizes } from './utils.js';
2
+
3
+ const noop = () => {};
4
+
5
5
  const defaultProps = {
6
6
  isOpen: false,
7
7
  centered: false,
@@ -10,7 +10,5 @@ const defaultProps = {
10
10
  onClickOutside: noop,
11
11
  zIndex: 10
12
12
  };
13
- export {
14
- defaultProps
15
- };
16
- //# sourceMappingURL=defaultProps.js.map
13
+
14
+ export { defaultProps };
package/esm/index.js CHANGED
@@ -1,28 +1,46 @@
1
- import * as React from "react";
2
- export * from "./DSDialog";
3
- export * from "./DSDialogDatatestid";
4
- import { DSDialogSizes } from "./utils";
5
- import {
6
- DSDialogBody,
7
- DSDialogHeader,
8
- DSDialogFooter,
9
- DSDialogSeparator,
10
- DSDialogTitle,
11
- DSDialogAddon,
12
- DSDialogDefaultLayout,
13
- DSDialogPrimaryMessage,
14
- DSDialogSecondaryMessage
15
- } from "./styles";
16
- export {
17
- DSDialogAddon,
18
- DSDialogBody,
19
- DSDialogDefaultLayout,
20
- DSDialogFooter,
21
- DSDialogHeader,
22
- DSDialogPrimaryMessage,
23
- DSDialogSecondaryMessage,
24
- DSDialogSeparator,
25
- DSDialogSizes,
26
- DSDialogTitle
27
- };
28
- //# sourceMappingURL=index.js.map
1
+ import { describe } from 'react-desc';
2
+ import { globalAttributesPropTypes } from '@elliemae/ds-props-helpers';
3
+ import { DSDialogBody, DSDialogHeader, DSDialogFooter, DSDialogSeparator, DSDialogTitle, DSDialogAddon, DSDialogDefaultLayout, DSDialogPrimaryMessage, DSDialogSecondaryMessage } from './styles.js';
4
+ export { DSDialogAddon, DSDialogBody, DSDialogDefaultLayout, DSDialogFooter, DSDialogHeader, DSDialogPrimaryMessage, DSDialogSecondaryMessage, DSDialogSeparator, DSDialogTitle } from './styles.js';
5
+ export { DSDialog, DSDialogWithSchema } from './DSDialog.js';
6
+ export { DSDialogDatatestid } from './DSDialogDatatestid.js';
7
+ export { DSDialogSizes } from './utils.js';
8
+
9
+ DSDialogBody.propTypes = globalAttributesPropTypes;
10
+ DSDialogHeader.propTypes = globalAttributesPropTypes;
11
+ DSDialogFooter.propTypes = globalAttributesPropTypes;
12
+ DSDialogSeparator.propTypes = globalAttributesPropTypes;
13
+ DSDialogTitle.propTypes = globalAttributesPropTypes;
14
+ DSDialogAddon.propTypes = globalAttributesPropTypes;
15
+ DSDialogDefaultLayout.propTypes = globalAttributesPropTypes;
16
+ DSDialogPrimaryMessage.propTypes = globalAttributesPropTypes;
17
+ DSDialogSecondaryMessage.propTypes = globalAttributesPropTypes;
18
+ DSDialogBody.displayName = 'DSDialogBody';
19
+ DSDialogHeader.displayName = 'DSDialogHeader';
20
+ DSDialogFooter.displayName = 'DSDialogFooter';
21
+ DSDialogSeparator.displayName = 'DSDialogSeparator';
22
+ DSDialogTitle.displayName = 'DSDialogTitle';
23
+ DSDialogAddon.displayName = 'DSDialogAddon';
24
+ DSDialogDefaultLayout.displayName = 'DSDialogDefaultLayout';
25
+ DSDialogPrimaryMessage.displayName = 'DSDialogPrimaryMessage';
26
+ DSDialogSecondaryMessage.displayName = 'DSDialogSecondaryMessage';
27
+ const DSDialogBodyWithSchema = describe(DSDialogBody);
28
+ const DSDialogHeaderWithSchema = describe(DSDialogHeader);
29
+ const DSDialogFooterWithSchema = describe(DSDialogFooter);
30
+ const DSDialogSeparatorWithSchema = describe(DSDialogSeparator);
31
+ const DSDialogTitleWithSchema = describe(DSDialogTitle);
32
+ const DSDialogAddonWithSchema = describe(DSDialogAddon);
33
+ const DSDialogDefaultLayoutWithSchema = describe(DSDialogDefaultLayout);
34
+ const DSDialogPrimaryMessageWithSchema = describe(DSDialogPrimaryMessage);
35
+ const DSDialogSecondaryMessageWithSchema = describe(DSDialogSecondaryMessage);
36
+ DSDialogBodyWithSchema.propTypes = globalAttributesPropTypes;
37
+ DSDialogHeaderWithSchema.propTypes = globalAttributesPropTypes;
38
+ DSDialogFooterWithSchema.propTypes = globalAttributesPropTypes;
39
+ DSDialogSeparatorWithSchema.propTypes = globalAttributesPropTypes;
40
+ DSDialogTitleWithSchema.propTypes = globalAttributesPropTypes;
41
+ DSDialogAddonWithSchema.propTypes = globalAttributesPropTypes;
42
+ DSDialogDefaultLayoutWithSchema.propTypes = globalAttributesPropTypes;
43
+ DSDialogPrimaryMessageWithSchema.propTypes = globalAttributesPropTypes;
44
+ DSDialogSecondaryMessageWithSchema.propTypes = globalAttributesPropTypes;
45
+
46
+ export { DSDialogAddonWithSchema, DSDialogBodyWithSchema, DSDialogDefaultLayoutWithSchema, DSDialogFooterWithSchema, DSDialogHeaderWithSchema, DSDialogPrimaryMessageWithSchema, DSDialogSecondaryMessageWithSchema, DSDialogSeparatorWithSchema, DSDialogTitleWithSchema };