@elliemae/ds-dialog 3.0.0-next.2 → 3.0.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DSDialog.js +157 -0
- package/dist/cjs/DSDialog.js.map +7 -0
- package/dist/cjs/DSDialogDatatestid.js +38 -0
- package/dist/cjs/DSDialogDatatestid.js.map +7 -0
- package/dist/cjs/defaultProps.js +46 -0
- package/dist/cjs/defaultProps.js.map +7 -0
- package/dist/cjs/index.js +94 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/propTypes.js +64 -0
- package/dist/cjs/propTypes.js.map +7 -0
- package/dist/cjs/sharedTypes.js +27 -0
- package/dist/cjs/sharedTypes.js.map +7 -0
- package/dist/cjs/styles.js +153 -0
- package/dist/cjs/styles.js.map +7 -0
- package/dist/cjs/utils.js +55 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/esm/DSDialog.js +135 -0
- package/dist/esm/DSDialog.js.map +7 -0
- package/dist/esm/DSDialogDatatestid.js +9 -0
- package/dist/esm/DSDialogDatatestid.js.map +7 -0
- package/dist/esm/defaultProps.js +17 -0
- package/dist/esm/defaultProps.js.map +7 -0
- package/{esm → dist/esm}/index.js +48 -19
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/propTypes.js +37 -0
- package/dist/esm/propTypes.js.map +7 -0
- package/dist/esm/sharedTypes.js +2 -0
- package/dist/esm/sharedTypes.js.map +7 -0
- package/dist/esm/styles.js +124 -0
- package/dist/esm/styles.js.map +7 -0
- package/dist/esm/utils.js +26 -0
- package/dist/esm/utils.js.map +7 -0
- package/package.json +45 -35
- package/cjs/DSDialog.js +0 -112
- package/cjs/DSDialogDatatestid.js +0 -10
- package/cjs/DSDialogInternalTypes.d.js +0 -2
- package/cjs/DSDialogTypes.js +0 -2
- package/cjs/defaultProps.js +0 -18
- package/cjs/index.js +0 -70
- package/cjs/propTypes.js +0 -31
- package/cjs/styles.js +0 -121
- package/cjs/utils.js +0 -35
- package/esm/DSDialog.js +0 -100
- package/esm/DSDialogDatatestid.js +0 -6
- package/esm/DSDialogInternalTypes.d.js +0 -1
- package/esm/DSDialogTypes.js +0 -1
- package/esm/defaultProps.js +0 -14
- package/esm/propTypes.js +0 -23
- package/esm/styles.js +0 -101
- package/esm/utils.js +0 -28
- package/types/DSDialog.d.ts +0 -2193
- package/types/DSDialogDatatestid.d.ts +0 -4
- package/types/DSDialogTypes.d.ts +0 -10
- package/types/defaultProps.d.ts +0 -2
- package/types/index.d.ts +0 -151
- package/types/propTypes.d.ts +0 -2182
- package/types/styles.d.ts +0 -15
- package/types/utils.d.ts +0 -19
package/cjs/styles.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
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];
|
|
86
|
-
});
|
|
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);
|
|
109
|
-
|
|
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
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
}));
|
|
14
|
-
const DSDialogSizes = {
|
|
15
|
-
DEFAULT: 'default',
|
|
16
|
-
SMALL: 'small',
|
|
17
|
-
MEDIUM: 'medium',
|
|
18
|
-
LARGE: 'large',
|
|
19
|
-
XLARGE: 'x-large',
|
|
20
|
-
XXLARGE: 'xx-large'
|
|
21
|
-
};
|
|
22
|
-
const DSDialogSizesArrayValues = Object.values(DSDialogSizes);
|
|
23
|
-
const allSizes = {
|
|
24
|
-
default: '576px',
|
|
25
|
-
small: '320px',
|
|
26
|
-
medium: '656px',
|
|
27
|
-
large: '848px',
|
|
28
|
-
'x-large': '1042px',
|
|
29
|
-
'xx-large': '1440px'
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
exports.DSDialogSizes = DSDialogSizes;
|
|
33
|
-
exports.DSDialogSizesArrayValues = DSDialogSizesArrayValues;
|
|
34
|
-
exports.allSizes = allSizes;
|
|
35
|
-
exports.getSpaceProps = getSpaceProps;
|
package/esm/DSDialog.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
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
|
-
|
|
30
|
-
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
31
|
-
const [isBodyOverflow, setIsBodyOverflow] = useState(false);
|
|
32
|
-
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
|
-
|
|
45
|
-
const containerRef = useRef(null);
|
|
46
|
-
const handleOutsideClick = useCallback(e => {
|
|
47
|
-
if (e.target.dataset.portalbg) onClickOutside();
|
|
48
|
-
}, [onClickOutside]);
|
|
49
|
-
const handleOnKeyDown = useCallback(e => {
|
|
50
|
-
if (e.key === 'Escape') onClickOutside();
|
|
51
|
-
}, [onClickOutside]);
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
const body = document.getElementsByTagName('body')[0];
|
|
54
|
-
const {
|
|
55
|
-
offsetHeight,
|
|
56
|
-
scrollHeight
|
|
57
|
-
} = body;
|
|
58
|
-
if (!isOpen) return setIsBodyOverflow(false);
|
|
59
|
-
return setIsBodyOverflow(offsetHeight < scrollHeight);
|
|
60
|
-
}, [isOpen]);
|
|
61
|
-
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();
|
|
65
|
-
}, [isOpen, removeAutoFocus]);
|
|
66
|
-
const globalAttributes = useGetGlobalAttributes(propsWithDefault, {
|
|
67
|
-
onClick: handleOutsideClick
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
if (isOpen) {
|
|
71
|
-
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/jsxs(StyledDialogBackground, _objectSpread(_objectSpread({
|
|
72
|
-
onClick: handleOutsideClick,
|
|
73
|
-
"data-portalbg": true,
|
|
74
|
-
"data-testid": DSDialogDatatestid.BACKGROUND,
|
|
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]);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return null;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const DSDialogWithSchema = describe(DSDialog);
|
|
98
|
-
DSDialogWithSchema.propTypes = propTypes;
|
|
99
|
-
|
|
100
|
-
export { DSDialog, DSDialogWithSchema };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/esm/DSDialogTypes.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/esm/defaultProps.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DSDialogSizes } from './utils.js';
|
|
2
|
-
|
|
3
|
-
const noop = () => {};
|
|
4
|
-
|
|
5
|
-
const defaultProps = {
|
|
6
|
-
isOpen: false,
|
|
7
|
-
centered: false,
|
|
8
|
-
size: DSDialogSizes.DEFAULT,
|
|
9
|
-
removeAutoFocus: false,
|
|
10
|
-
onClickOutside: noop,
|
|
11
|
-
zIndex: 10
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { defaultProps };
|
package/esm/propTypes.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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 { PropTypes } from 'react-desc';
|
|
8
|
-
import { globalAttributesPropTypes } from '@elliemae/ds-props-helpers';
|
|
9
|
-
import { DSDialogSizesArrayValues, DSDialogSizes } from './utils.js';
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
const propTypes = _objectSpread({
|
|
15
|
-
isOpen: PropTypes.bool.description('Whether the Dialog is open or not.').defaultValue(false),
|
|
16
|
-
children: PropTypes.node.description('Nested components.').isRequired,
|
|
17
|
-
centered: PropTypes.bool.description('Centers the Dialog.').defaultValue(false),
|
|
18
|
-
size: PropTypes.oneOf(DSDialogSizesArrayValues).description("Dialog's width size.").defaultValue(DSDialogSizes.DEFAULT),
|
|
19
|
-
removeAutoFocus: PropTypes.bool.description('Removes focus in the Dialog container when is open. If you want to focus an specific element in the Dialog, it should be set to true.').defaultValue(false),
|
|
20
|
-
onClickOutside: PropTypes.func.description('Callback that should be used to close the modal when the user clicks outside. Cb also triggers when the user press ESC key for accessibility purposes.').defaultValue(() => {})
|
|
21
|
-
}, globalAttributesPropTypes);
|
|
22
|
-
|
|
23
|
-
export { propTypes };
|
package/esm/styles.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
-
import styled, { createGlobalStyle, space, layout, flexboxes, sizing } from '@xstyled/styled-components';
|
|
3
|
-
import { allSizes } from './utils.js';
|
|
4
|
-
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
6
|
-
const FixedBody = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n body {\n overflow: hidden;\n \n ", "\n }\n"])), _ref => {
|
|
7
|
-
let {
|
|
8
|
-
isBodyOverflow
|
|
9
|
-
} = _ref;
|
|
10
|
-
return isBodyOverflow ? "padding-right: 15px !important;" : "";
|
|
11
|
-
});
|
|
12
|
-
const StyledDialogBackground = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\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 => {
|
|
13
|
-
let {
|
|
14
|
-
zIndex
|
|
15
|
-
} = _ref2;
|
|
16
|
-
return zIndex;
|
|
17
|
-
});
|
|
18
|
-
const StyledDialogContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\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 => {
|
|
19
|
-
let {
|
|
20
|
-
centered
|
|
21
|
-
} = _ref3;
|
|
22
|
-
return centered ? 'auto' : '20vh auto auto auto';
|
|
23
|
-
}, _ref4 => {
|
|
24
|
-
let {
|
|
25
|
-
size
|
|
26
|
-
} = _ref4;
|
|
27
|
-
return allSizes[size];
|
|
28
|
-
}, _ref5 => {
|
|
29
|
-
let {
|
|
30
|
-
theme
|
|
31
|
-
} = _ref5;
|
|
32
|
-
return theme.colors.neutral[500];
|
|
33
|
-
}, _ref6 => {
|
|
34
|
-
let {
|
|
35
|
-
theme
|
|
36
|
-
} = _ref6;
|
|
37
|
-
return theme.colors.neutral['000'];
|
|
38
|
-
}, space);
|
|
39
|
-
const DSDialogTitle = styled.h3(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\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 => {
|
|
40
|
-
let {
|
|
41
|
-
theme
|
|
42
|
-
} = _ref7;
|
|
43
|
-
return theme.fontSizes.title[700];
|
|
44
|
-
});
|
|
45
|
-
const DSDialogAddon = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral([""])));
|
|
46
|
-
const DSDialogHeader = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\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 => {
|
|
47
|
-
let {
|
|
48
|
-
theme
|
|
49
|
-
} = _ref8;
|
|
50
|
-
return theme.space.m;
|
|
51
|
-
}, _ref9 => {
|
|
52
|
-
let {
|
|
53
|
-
theme
|
|
54
|
-
} = _ref9;
|
|
55
|
-
return theme.space.xs;
|
|
56
|
-
}, DSDialogTitle, DSDialogAddon, DSDialogAddon, space);
|
|
57
|
-
const DSDialogSeparator = styled.hr.attrs(() => ({
|
|
58
|
-
'aria-hidden': true
|
|
59
|
-
}))(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin: 0;\n border-top: 1px solid ", ";\n"])), _ref10 => {
|
|
60
|
-
let {
|
|
61
|
-
theme
|
|
62
|
-
} = _ref10;
|
|
63
|
-
return theme.colors.neutral['080'];
|
|
64
|
-
});
|
|
65
|
-
const DSDialogBody = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding: ", ";\n overflow-y: auto;\n ", "\n ", "\n ", "\n ", "\n"])), _ref11 => {
|
|
66
|
-
let {
|
|
67
|
-
theme
|
|
68
|
-
} = _ref11;
|
|
69
|
-
return theme.space.xs;
|
|
70
|
-
}, layout, space, flexboxes, sizing);
|
|
71
|
-
const DSDialogPrimaryMessage = styled.h3(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin: 0;\n"])));
|
|
72
|
-
const DSDialogSecondaryMessage = styled.p(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin: 0;\n color: ", ";\n"])), _ref12 => {
|
|
73
|
-
let {
|
|
74
|
-
theme
|
|
75
|
-
} = _ref12;
|
|
76
|
-
return theme.colors.neutral[500];
|
|
77
|
-
});
|
|
78
|
-
const DSDialogDefaultLayout = styled.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\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 => {
|
|
79
|
-
let {
|
|
80
|
-
theme
|
|
81
|
-
} = _ref13;
|
|
82
|
-
return theme.space.xxs;
|
|
83
|
-
}, DSDialogSecondaryMessage);
|
|
84
|
-
const DSDialogFooter = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\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 => {
|
|
85
|
-
let {
|
|
86
|
-
theme
|
|
87
|
-
} = _ref14;
|
|
88
|
-
return theme.space.xxs;
|
|
89
|
-
}, _ref15 => {
|
|
90
|
-
let {
|
|
91
|
-
theme
|
|
92
|
-
} = _ref15;
|
|
93
|
-
return theme.space.m;
|
|
94
|
-
}, _ref16 => {
|
|
95
|
-
let {
|
|
96
|
-
theme
|
|
97
|
-
} = _ref16;
|
|
98
|
-
return theme.space.xs;
|
|
99
|
-
}, space, flexboxes, sizing);
|
|
100
|
-
|
|
101
|
-
export { DSDialogAddon, DSDialogBody, DSDialogDefaultLayout, DSDialogFooter, DSDialogHeader, DSDialogPrimaryMessage, DSDialogSecondaryMessage, DSDialogSeparator, DSDialogTitle, FixedBody, StyledDialogBackground, StyledDialogContainer };
|
package/esm/utils.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
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/web.dom-collections.iterator.js';
|
|
5
|
-
|
|
6
|
-
const getSpaceProps = props => Object.fromEntries(Object.entries(props).filter(_ref => {
|
|
7
|
-
let [key] = _ref;
|
|
8
|
-
return /^[pm][xytblr]?$/.exec(key);
|
|
9
|
-
}));
|
|
10
|
-
const DSDialogSizes = {
|
|
11
|
-
DEFAULT: 'default',
|
|
12
|
-
SMALL: 'small',
|
|
13
|
-
MEDIUM: 'medium',
|
|
14
|
-
LARGE: 'large',
|
|
15
|
-
XLARGE: 'x-large',
|
|
16
|
-
XXLARGE: 'xx-large'
|
|
17
|
-
};
|
|
18
|
-
const DSDialogSizesArrayValues = Object.values(DSDialogSizes);
|
|
19
|
-
const allSizes = {
|
|
20
|
-
default: '576px',
|
|
21
|
-
small: '320px',
|
|
22
|
-
medium: '656px',
|
|
23
|
-
large: '848px',
|
|
24
|
-
'x-large': '1042px',
|
|
25
|
-
'xx-large': '1440px'
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { DSDialogSizes, DSDialogSizesArrayValues, allSizes, getSpaceProps };
|