@elliemae/ds-dialog 2.2.0-alpha.1 → 2.2.0-alpha.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,145 +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('styled-components');
7
- var dsSystem = require('@elliemae/ds-system');
8
- var styledComponents = require('@xstyled/styled-components');
9
- var utils = require('./utils.js');
10
-
11
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
-
13
- var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
14
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
15
-
16
- var _templateObject;
17
- const FixedBody = dsSystem.createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n body {\n overflow: hidden;\n \n ", "\n }\n"])), _ref => {
18
- let {
19
- isBodyOverflow
20
- } = _ref;
21
- return isBodyOverflow ? "padding-right: 15px !important;" : "";
22
- });
23
- const StyledDialogBackground = /*#__PURE__*/styled__default["default"].div.withConfig({
24
- componentId: "sc-106vqwv-0"
25
- })(["position:fixed;top:0;bottom:0;width:100%;height:100%;background:rgba(37,41,47,50%);overflow-y:auto;z-index:", ";"], _ref2 => {
26
- let {
27
- zIndex
28
- } = _ref2;
29
- return zIndex;
30
- });
31
- const StyledDialogContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
32
- componentId: "sc-106vqwv-1"
33
- })(["height:fit-content;position:absolute;top:0;bottom:0;left:0;right:0;margin:", ";width:", ";min-width:300px;box-shadow:0 10px 20px 0 ", ";background:", ";overflow-y:auto;", " &:focus{outline:none;}"], _ref3 => {
34
- let {
35
- centered
36
- } = _ref3;
37
- return centered ? 'auto' : '20vh auto auto auto';
38
- }, _ref4 => {
39
- let {
40
- size
41
- } = _ref4;
42
- return utils.allSizes[size];
43
- }, _ref5 => {
44
- let {
45
- theme
46
- } = _ref5;
47
- return theme.colors.neutral[500];
48
- }, _ref6 => {
49
- let {
50
- theme
51
- } = _ref6;
52
- return theme.colors.neutral['000'];
53
- }, styledComponents.space);
54
- const DSDialogTitle = /*#__PURE__*/styled__default["default"].h3.withConfig({
55
- componentId: "sc-106vqwv-2"
56
- })(["font-size:", ";display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;"], _ref7 => {
57
- let {
58
- theme
59
- } = _ref7;
60
- return theme.fontSizes.title[700];
61
- });
62
- const DSDialogAddon = /*#__PURE__*/styled__default["default"].div.withConfig({
63
- componentId: "sc-106vqwv-3"
64
- })([""]);
65
- const DSDialogHeader = /*#__PURE__*/styled__default["default"].div.withConfig({
66
- componentId: "sc-106vqwv-4"
67
- })(["display:grid;align-items:center;grid-auto-flow:column;min-height:", ";padding:10px ", ";& ", " + ", "{align-self:flex-start;justify-self:flex-end;}& ", ":only-child{justify-self:flex-end;}", ""], _ref8 => {
68
- let {
69
- theme
70
- } = _ref8;
71
- return theme.space.m;
72
- }, _ref9 => {
73
- let {
74
- theme
75
- } = _ref9;
76
- return theme.space.xs;
77
- }, DSDialogTitle, DSDialogAddon, DSDialogAddon, styledComponents.space);
78
- const DSDialogSeparator = /*#__PURE__*/styled__default["default"].hr.attrs(() => ({
79
- 'aria-hidden': true
80
- })).withConfig({
81
- componentId: "sc-106vqwv-5"
82
- })(["margin:0;border-top:1px solid ", ";"], _ref10 => {
83
- let {
84
- theme
85
- } = _ref10;
86
- return theme.colors.neutral['080'];
87
- });
88
- const DSDialogBody = /*#__PURE__*/styled__default["default"].div.withConfig({
89
- componentId: "sc-106vqwv-6"
90
- })(["padding:", ";overflow-y:auto;", " ", " ", " ", ""], _ref11 => {
91
- let {
92
- theme
93
- } = _ref11;
94
- return theme.space.xs;
95
- }, styledComponents.layout, styledComponents.space, styledComponents.flexboxes, styledComponents.sizing);
96
- const DSDialogPrimaryMessage = /*#__PURE__*/styled__default["default"].h3.withConfig({
97
- componentId: "sc-106vqwv-7"
98
- })(["margin:0;"]);
99
- const DSDialogSecondaryMessage = /*#__PURE__*/styled__default["default"].p.withConfig({
100
- componentId: "sc-106vqwv-8"
101
- })(["margin:0;color:", ";"], _ref12 => {
102
- let {
103
- theme
104
- } = _ref12;
105
- 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
106
42
  });
107
- const DSDialogDefaultLayout = /*#__PURE__*/styled__default["default"].div.withConfig({
108
- componentId: "sc-106vqwv-9"
109
- })(["display:grid;grid-auto-flow:row;justify-items:center;align-items:center;grid-gap:", ";", "{text-align:center;}"], _ref13 => {
110
- let {
111
- theme
112
- } = _ref13;
113
- return theme.space.xxs;
114
- }, DSDialogSecondaryMessage);
115
- const DSDialogFooter = /*#__PURE__*/styled__default["default"].div.withConfig({
116
- componentId: "sc-106vqwv-10"
117
- })(["display:grid;grid-auto-flow:column;align-items:center;justify-content:flex-end;grid-gap:", ";min-height:", ";padding:0 ", ";", " ", " ", ""], _ref14 => {
118
- let {
119
- theme
120
- } = _ref14;
121
- return theme.space.xxs;
122
- }, _ref15 => {
123
- let {
124
- theme
125
- } = _ref15;
126
- return theme.space.m;
127
- }, _ref16 => {
128
- let {
129
- theme
130
- } = _ref16;
131
- return theme.space.xs;
132
- }, styledComponents.space, styledComponents.flexboxes, styledComponents.sizing);
43
+ var React = __toESM(require("react"));
44
+ var import_styled_components = __toESM(require("styled-components"));
45
+ var import_ds_system = __toESM(require("@elliemae/ds-system"));
46
+ var import_styled_components2 = __toESM(require("@xstyled/styled-components"));
47
+ var import_utils = __toESM(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};
133
132
 
134
- exports.DSDialogAddon = DSDialogAddon;
135
- exports.DSDialogBody = DSDialogBody;
136
- exports.DSDialogDefaultLayout = DSDialogDefaultLayout;
137
- exports.DSDialogFooter = DSDialogFooter;
138
- exports.DSDialogHeader = DSDialogHeader;
139
- exports.DSDialogPrimaryMessage = DSDialogPrimaryMessage;
140
- exports.DSDialogSecondaryMessage = DSDialogSecondaryMessage;
141
- exports.DSDialogSeparator = DSDialogSeparator;
142
- exports.DSDialogTitle = DSDialogTitle;
143
- exports.FixedBody = FixedBody;
144
- exports.StyledDialogBackground = StyledDialogBackground;
145
- 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