@elliemae/ds-dialog 2.1.1-rc.1 → 2.2.0-alpha.4

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,121 +1,150 @@
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];
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
86
42
  });
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);
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};
109
132
 
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;
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
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/styles.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport styled from 'styled-components';\nimport { createGlobalStyle } from '@elliemae/ds-system';\nimport { space, flexboxes, layout, sizing } from '@xstyled/styled-components';\nimport { allSizes } from './utils';\nimport type { StyledDialogContainerT } from './types/index.d';\n\nexport const FixedBody = createGlobalStyle`\n body {\n overflow: hidden;\n \n ${({ isBodyOverflow }) => (isBodyOverflow ? `padding-right: 15px !important;` : ``)}\n }\n`;\n\nexport const StyledDialogBackground = styled.div`\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: ${({ zIndex }) => zIndex};\n`;\n\nexport const StyledDialogContainer = styled.div<StyledDialogContainerT>`\n height: fit-content;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: ${({ centered }) => (centered ? 'auto' : '20vh auto auto auto')};\n width: ${({ size }) => allSizes[size]};\n min-width: 300px;\n box-shadow: 0 10px 20px 0 ${({ theme }) => theme.colors.neutral[500]};\n background: ${({ theme }) => theme.colors.neutral['000']};\n overflow-y: auto;\n ${space}\n &:focus {\n outline: none;\n }\n`;\n\nexport const DSDialogTitle = styled.h3`\n font-size: ${({ theme }) => theme.fontSizes.title[700]};\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n margin: 0;\n`;\n\nexport const DSDialogAddon = styled.div``;\n\nexport const DSDialogHeader = styled.div`\n display: grid;\n align-items: center;\n grid-auto-flow: column;\n min-height: ${({ theme }) => theme.space.m};\n padding: 10px ${({ theme }) => theme.space.xs};\n & ${DSDialogTitle} + ${DSDialogAddon} {\n align-self: flex-start;\n justify-self: flex-end;\n }\n & ${DSDialogAddon}:only-child {\n justify-self: flex-end;\n }\n ${space}\n`;\n\nexport const DSDialogSeparator = styled.hr.attrs(() => ({ 'aria-hidden': true }))`\n margin: 0;\n border-top: 1px solid ${({ theme }) => theme.colors.neutral['080']};\n`;\n\nexport const DSDialogBody = styled.div`\n padding: ${({ theme }) => theme.space.xs};\n overflow-y: auto;\n ${layout}\n ${space}\n ${flexboxes}\n ${sizing}\n`;\n\nexport const DSDialogPrimaryMessage = styled.h3`\n margin: 0;\n`;\n\nexport const DSDialogSecondaryMessage = styled.p`\n margin: 0;\n color: ${({ theme }) => theme.colors.neutral[500]};\n`;\n\nexport const DSDialogDefaultLayout = styled.div`\n display: grid;\n grid-auto-flow: row;\n justify-items: center;\n align-items: center;\n grid-gap: ${({ theme }) => theme.space.xxs};\n\n ${DSDialogSecondaryMessage} {\n text-align: center;\n }\n`;\n\nexport const DSDialogFooter = styled.div`\n display: grid;\n grid-auto-flow: column;\n align-items: center;\n justify-content: flex-end;\n grid-gap: ${({ theme }) => theme.space.xxs};\n min-height: ${({ theme }) => theme.space.m};\n padding: 0 ${({ theme }) => theme.space.xs};\n ${space}\n ${flexboxes}\n ${sizing}\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;ACAA,YAAuB;ADCvB,+BAAmB;AACnB,uBAAkC;AAClC,gCAAiD;AACjD,mBAAyB;AAGlB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,MAInB,CAAC,EAAE,qBAAsB,iBAAiB,oCAAoC;AAAA;AAAA;AAI7E,MAAM,yBAAyB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAQhC,CAAC,EAAE,aAAa;AAAA;AAGtB,MAAM,wBAAwB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAOhC,CAAC,EAAE,eAAgB,WAAW,SAAS;AAAA,WACxC,CAAC,EAAE,WAAW,sBAAS;AAAA;AAAA,8BAEJ,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA,gBAClD,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAAA,IAEhD;AAAA;AAAA;AAAA;AAAA;AAMG,MAAM,gBAAgB,iCAAO;AAAA,eACrB,CAAC,EAAE,YAAY,MAAM,UAAU,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ7C,MAAM,gBAAgB,iCAAO;AAE7B,MAAM,iBAAiB,iCAAO;AAAA;AAAA;AAAA;AAAA,gBAIrB,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,kBACzB,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,MACvC,mBAAmB;AAAA;AAAA;AAAA;AAAA,MAInB;AAAA;AAAA;AAAA,IAGF;AAAA;AAGG,MAAM,oBAAoB,iCAAO,GAAG,MAAM,MAAO,GAAE,eAAe;AAAA;AAAA,0BAE/C,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAGvD,MAAM,eAAe,iCAAO;AAAA,aACtB,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA;AAAA,IAEpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,yBAAyB,iCAAO;AAAA;AAAA;AAItC,MAAM,2BAA2B,iCAAO;AAAA;AAAA,WAEpC,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAGxC,MAAM,wBAAwB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA,cAK9B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA;AAAA,IAErC;AAAA;AAAA;AAAA;AAKG,MAAM,iBAAiB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA,cAKvB,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,gBACzB,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,eAC5B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,IACtC;AAAA,IACA;AAAA,IACA;AAAA;",
6
+ "names": []
7
+ }
package/cjs/utils.js CHANGED
@@ -1,35 +1,55 @@
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
- }));
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)));
14
37
  const DSDialogSizes = {
15
- DEFAULT: 'default',
16
- SMALL: 'small',
17
- MEDIUM: 'medium',
18
- LARGE: 'large',
19
- XLARGE: 'x-large',
20
- XXLARGE: 'xx-large'
38
+ DEFAULT: "default",
39
+ SMALL: "small",
40
+ MEDIUM: "medium",
41
+ LARGE: "large",
42
+ XLARGE: "x-large",
43
+ XXLARGE: "xx-large"
21
44
  };
22
45
  const DSDialogSizesArrayValues = Object.values(DSDialogSizes);
23
46
  const allSizes = {
24
- default: '576px',
25
- small: '320px',
26
- medium: '656px',
27
- large: '848px',
28
- 'x-large': '1042px',
29
- 'xx-large': '1440px'
47
+ default: "576px",
48
+ small: "320px",
49
+ medium: "656px",
50
+ large: "848px",
51
+ "x-large": "1042px",
52
+ "xx-large": "1440px"
30
53
  };
31
-
32
- exports.DSDialogSizes = DSDialogSizes;
33
- exports.DSDialogSizesArrayValues = DSDialogSizesArrayValues;
34
- exports.allSizes = allSizes;
35
- exports.getSpaceProps = getSpaceProps;
54
+ module.exports = __toCommonJS(utils_exports);
55
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import type { GetSpaceArgsT } from './DSDialogInternalTypes';\n\nexport const getSpaceProps = (props: GetSpaceArgsT): GetSpaceArgsT =>\n Object.fromEntries(Object.entries(props).filter(([key]) => /^[pm][xytblr]?$/.exec(key)));\n\nexport const DSDialogSizes = {\n DEFAULT: 'default',\n SMALL: 'small',\n MEDIUM: 'medium',\n LARGE: 'large',\n XLARGE: 'x-large',\n XXLARGE: 'xx-large',\n} as const;\n\nexport const DSDialogSizesArrayValues = Object.values(DSDialogSizes);\n\nexport const allSizes = {\n default: '576px',\n small: '320px',\n medium: '656px',\n large: '848px',\n 'x-large': '1042px',\n 'xx-large': '1440px',\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEhB,MAAM,gBAAgB,CAAC,UAC5B,OAAO,YAAY,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC,SAAS,kBAAkB,KAAK;AAE7E,MAAM,gBAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA;AAGJ,MAAM,2BAA2B,OAAO,OAAO;AAE/C,MAAM,WAAW;AAAA,EACtB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AAAA,EACX,YAAY;AAAA;",
6
+ "names": []
7
+ }
package/esm/DSDialog.js CHANGED
@@ -1,95 +1,65 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
- import 'core-js/modules/web.dom-collections.iterator.js';
10
- import ReactDOM from 'react-dom';
11
- import { useState, useRef, useCallback, useEffect } from 'react';
12
- import { describe } from 'react-desc';
13
- import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
14
- import { StyledDialogBackground, FixedBody, StyledDialogContainer } from './styles.js';
15
- import { propTypes } from './propTypes.js';
16
- import { defaultProps } from './defaultProps.js';
17
- import { getSpaceProps } from './utils.js';
18
- import { DSDialogDatatestid } from './DSDialogDatatestid.js';
19
- import { jsx } from 'react/jsx-runtime';
20
-
21
- const _excluded = ["children", "isOpen", "onClickOutside", "centered", "size", "removeAutoFocus", "zIndex"];
22
-
23
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24
-
25
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
-
27
- const DSDialog = props => {
28
- var _FixedBody;
29
-
1
+ import * as React from "react";
2
+ import ReactDOM from "react-dom";
3
+ import React2, { useCallback, useRef, useEffect, useState } from "react";
4
+ import { 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) => {
30
12
  const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
31
13
  const [isBodyOverflow, setIsBodyOverflow] = useState(false);
32
14
  useValidateTypescriptPropTypes(propsWithDefault, propTypes);
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
-
15
+ const { children, isOpen, onClickOutside, centered, size, removeAutoFocus, zIndex, ...rest } = propsWithDefault;
45
16
  const containerRef = useRef(null);
46
- const handleOutsideClick = useCallback(e => {
47
- if (e.target.dataset.portalbg) onClickOutside();
17
+ const handleOutsideClick = useCallback((e) => {
18
+ if (e.target.dataset.portalbg)
19
+ onClickOutside();
48
20
  }, [onClickOutside]);
49
- const handleOnKeyDown = useCallback(e => {
50
- if (e.key === 'Escape') onClickOutside();
21
+ const handleOnKeyDown = useCallback((e) => {
22
+ if (e.key === "Escape")
23
+ onClickOutside();
51
24
  }, [onClickOutside]);
52
25
  useEffect(() => {
53
- const body = document.getElementsByTagName('body')[0];
54
- const {
55
- offsetHeight,
56
- scrollHeight
57
- } = body;
58
- if (!isOpen) return setIsBodyOverflow(false);
26
+ const body = document.getElementsByTagName("body")[0];
27
+ const { offsetHeight, scrollHeight } = body;
28
+ if (!isOpen)
29
+ return setIsBodyOverflow(false);
59
30
  return setIsBodyOverflow(offsetHeight < scrollHeight);
60
31
  }, [isOpen]);
61
32
  useEffect(() => {
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();
33
+ if (isOpen && !removeAutoFocus)
34
+ containerRef?.current?.focus();
65
35
  }, [isOpen, removeAutoFocus]);
66
-
67
36
  if (isOpen) {
68
- return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/_jsx(StyledDialogBackground, {
37
+ return ReactDOM.createPortal(/* @__PURE__ */ React2.createElement(StyledDialogBackground, {
69
38
  onClick: handleOutsideClick,
70
39
  "data-portalbg": true,
71
40
  "data-testid": DSDialogDatatestid.BACKGROUND,
72
- zIndex: zIndex
73
- }, void 0, _FixedBody || (_FixedBody = /*#__PURE__*/_jsx(FixedBody, {
74
- isBodyOverflow: isBodyOverflow
75
- })), /*#__PURE__*/jsx(StyledDialogContainer, _objectSpread(_objectSpread({
41
+ zIndex
42
+ }, /* @__PURE__ */ React2.createElement(FixedBody, {
43
+ isBodyOverflow
44
+ }), /* @__PURE__ */ React2.createElement(StyledDialogContainer, {
76
45
  role: "dialog",
77
46
  "aria-modal": true,
78
47
  ref: containerRef,
79
- tabIndex: !removeAutoFocus ? 0 : undefined,
80
- onKeyDown: handleOnKeyDown
81
- }, getSpaceProps(rest)), {}, {
82
- size: size,
83
- centered: centered,
84
- "data-testid": DSDialogDatatestid.CONTAINER,
85
- children: children
86
- }))), document.getElementsByTagName('body')[0]);
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]);
87
55
  }
88
-
89
56
  return null;
90
57
  };
91
-
58
+ DSDialog.propTypes = propTypes;
92
59
  const DSDialogWithSchema = describe(DSDialog);
93
60
  DSDialogWithSchema.propTypes = propTypes;
94
-
95
- export { DSDialog, DSDialogWithSchema };
61
+ export {
62
+ DSDialog,
63
+ DSDialogWithSchema
64
+ };
65
+ //# sourceMappingURL=DSDialog.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSDialog.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import ReactDOM from 'react-dom';\nimport React, { useCallback, useRef, useEffect, useState } from 'react';\nimport { describe } from 'react-desc';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } 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 { DSDialogPropsWithDefaultT } from './DSDialogInternalTypes';\nimport type { DSDialogPropsT } from './DSDialogTypes';\n\nconst DSDialog = (props: DSDialogPropsT): React.ReactNode => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps) as DSDialogPropsWithDefaultT;\n const [isBodyOverflow, setIsBodyOverflow] = useState<boolean>(false);\n\n useValidateTypescriptPropTypes(propsWithDefault, propTypes);\n\n const { children, isOpen, onClickOutside, centered, size, removeAutoFocus, zIndex, ...rest } = propsWithDefault;\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n\n const handleOutsideClick = useCallback(\n (e: React.MouseEvent) => {\n if ((e.target as HTMLDivElement).dataset.portalbg) onClickOutside();\n },\n [onClickOutside],\n );\n\n const handleOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') onClickOutside();\n },\n [onClickOutside],\n );\n\n useEffect(() => {\n const body = document.getElementsByTagName('body')[0];\n const { offsetHeight, scrollHeight } = body;\n\n if (!isOpen) return setIsBodyOverflow(false);\n return setIsBodyOverflow(offsetHeight < scrollHeight);\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 onClick={handleOutsideClick}\n data-portalbg\n data-testid={DSDialogDatatestid.BACKGROUND}\n zIndex={zIndex}\n >\n <FixedBody isBodyOverflow={isBodyOverflow} />\n <StyledDialogContainer\n role=\"dialog\"\n aria-modal\n ref={containerRef}\n tabIndex={!removeAutoFocus ? 0 : undefined}\n onKeyDown={handleOnKeyDown}\n {...getSpaceProps(rest)}\n size={size}\n centered={centered}\n data-testid={DSDialogDatatestid.CONTAINER}\n >\n {children}\n </StyledDialogContainer>\n </StyledDialogBackground>,\n document.getElementsByTagName('body')[0],\n );\n }\n\n return null;\n};\n\nDSDialog.propTypes = propTypes;\n\nconst DSDialogWithSchema = describe(DSDialog);\nDSDialogWithSchema.propTypes = propTypes;\n\nexport { DSDialog, DSDialogWithSchema };\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,MAAM,WAAW,CAAC,UAA2C;AAC3D,QAAM,mBAAmB,6BAA6B,OAAO;AAC7D,QAAM,CAAC,gBAAgB,qBAAqB,SAAkB;AAE9D,iCAA+B,kBAAkB;AAEjD,QAAM,EAAE,UAAU,QAAQ,gBAAgB,UAAU,MAAM,iBAAiB,WAAW,SAAS;AAE/F,QAAM,eAAe,OAA8B;AAEnD,QAAM,qBAAqB,YACzB,CAAC,MAAwB;AACvB,QAAK,EAAE,OAA0B,QAAQ;AAAU;AAAA,KAErD,CAAC;AAGH,QAAM,kBAAkB,YACtB,CAAC,MAA2B;AAC1B,QAAI,EAAE,QAAQ;AAAU;AAAA,KAE1B,CAAC;AAGH,YAAU,MAAM;AACd,UAAM,OAAO,SAAS,qBAAqB,QAAQ;AACnD,UAAM,EAAE,cAAc,iBAAiB;AAEvC,QAAI,CAAC;AAAQ,aAAO,kBAAkB;AACtC,WAAO,kBAAkB,eAAe;AAAA,KACvC,CAAC;AAEJ,YAAU,MAAM;AACd,QAAI,UAAU,CAAC;AAAiB,oBAAc,SAAS;AAAA,KACtD,CAAC,QAAQ;AAEZ,MAAI,QAAQ;AACV,WAAO,SAAS,aACd,qCAAC,wBAAD;AAAA,MACE,SAAS;AAAA,MACT,iBAAa;AAAA,MACb,eAAa,mBAAmB;AAAA,MAChC;AAAA,OAEA,qCAAC,WAAD;AAAA,MAAW;AAAA,QACX,qCAAC,uBAAD;AAAA,MACE,MAAK;AAAA,MACL,cAAU;AAAA,MACV,KAAK;AAAA,MACL,UAAU,CAAC,kBAAkB,IAAI;AAAA,MACjC,WAAW;AAAA,SACP,cAAc;AAAA,MAClB;AAAA,MACA;AAAA,MACA,eAAa,mBAAmB;AAAA,OAE/B,YAGL,SAAS,qBAAqB,QAAQ;AAAA;AAI1C,SAAO;AAAA;AAGT,SAAS,YAAY;AAErB,MAAM,qBAAqB,SAAS;AACpC,mBAAmB,YAAY;",
6
+ "names": []
7
+ }
@@ -1,6 +1,9 @@
1
+ import * as React from "react";
1
2
  const DSDialogDatatestid = {
2
- CONTAINER: 'ds-dialog-container',
3
- BACKGROUND: 'ds-dialog-background'
3
+ CONTAINER: "ds-dialog-container",
4
+ BACKGROUND: "ds-dialog-background"
4
5
  };
5
-
6
- export { DSDialogDatatestid };
6
+ export {
7
+ DSDialogDatatestid
8
+ };
9
+ //# sourceMappingURL=DSDialogDatatestid.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSDialogDatatestid.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSDialogDatatestid = {\n CONTAINER: 'ds-dialog-container',\n BACKGROUND: 'ds-dialog-background',\n};\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,YAAY;AAAA;",
6
+ "names": []
7
+ }
@@ -1 +1,2 @@
1
-
1
+ import * as React from "react";
2
+ //# sourceMappingURL=DSDialogInternalTypes.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -1 +1,2 @@
1
-
1
+ import * as React from "react";
2
+ //# sourceMappingURL=DSDialogTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
- import { DSDialogSizes } from './utils.js';
2
-
3
- const noop = () => {};
4
-
1
+ import * as React from "react";
2
+ import { DSDialogSizes } from "./utils";
3
+ const noop = () => {
4
+ };
5
5
  const defaultProps = {
6
6
  isOpen: false,
7
7
  centered: false,
@@ -10,5 +10,7 @@ const defaultProps = {
10
10
  onClickOutside: noop,
11
11
  zIndex: 10
12
12
  };
13
-
14
- export { defaultProps };
13
+ export {
14
+ defaultProps
15
+ };
16
+ //# sourceMappingURL=defaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSDialogSizes } from './utils';\nimport type { DSDialogDefaultPropsT } from './DSDialogInternalTypes';\n\nconst noop = () => {};\n\nexport const defaultProps: DSDialogDefaultPropsT = {\n isOpen: false,\n centered: false,\n size: DSDialogSizes.DEFAULT,\n removeAutoFocus: false,\n onClickOutside: noop,\n zIndex: 10,\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAGA,MAAM,OAAO,MAAM;AAAA;AAEZ,MAAM,eAAsC;AAAA,EACjD,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM,cAAc;AAAA,EACpB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,QAAQ;AAAA;",
6
+ "names": []
7
+ }