@elliemae/ds-dialog 2.2.0-alpha.4 → 3.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DSDialog.js +101 -83
- package/cjs/DSDialogDatatestid.js +8 -36
- package/cjs/DSDialogInternalTypes.d.js +2 -27
- package/cjs/DSDialogTypes.js +2 -27
- package/cjs/defaultProps.js +11 -38
- package/cjs/index.js +70 -47
- package/cjs/propTypes.js +31 -45
- package/cjs/styles.js +119 -148
- package/cjs/utils.js +30 -50
- package/esm/DSDialog.js +80 -45
- package/esm/DSDialogDatatestid.js +4 -7
- package/esm/DSDialogInternalTypes.d.js +1 -2
- package/esm/DSDialogTypes.js +1 -2
- package/esm/defaultProps.js +6 -8
- package/esm/index.js +46 -28
- package/esm/propTypes.js +23 -16
- package/esm/styles.js +100 -120
- package/esm/utils.js +23 -21
- package/package.json +4 -7
- package/types/DSDialog.d.ts +2166 -3
- package/types/index.d.ts +148 -1
- package/types/propTypes.d.ts +2166 -3
- package/types/styles.d.ts +13 -12
- package/cjs/DSDialog.js.map +0 -7
- package/cjs/DSDialogDatatestid.js.map +0 -7
- package/cjs/DSDialogInternalTypes.d.js.map +0 -7
- package/cjs/DSDialogTypes.js.map +0 -7
- package/cjs/defaultProps.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/propTypes.js.map +0 -7
- package/cjs/styles.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/esm/DSDialog.js.map +0 -7
- package/esm/DSDialogDatatestid.js.map +0 -7
- package/esm/DSDialogInternalTypes.d.js.map +0 -7
- package/esm/DSDialogTypes.js.map +0 -7
- package/esm/defaultProps.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/propTypes.js.map +0 -7
- package/esm/styles.js.map +0 -7
- package/esm/utils.js.map +0 -7
package/esm/propTypes.js
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
CHANGED
|
@@ -1,121 +1,101 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styled from
|
|
3
|
-
import {
|
|
4
|
-
import { space, flexboxes, layout, sizing } from "@xstyled/styled-components";
|
|
5
|
-
import { allSizes } from "./utils";
|
|
6
|
-
const FixedBody = createGlobalStyle`
|
|
7
|
-
body {
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
|
|
10
|
-
${({ isBodyOverflow }) => isBodyOverflow ? `padding-right: 15px !important;` : ``}
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
13
|
-
const StyledDialogBackground = styled.div`
|
|
14
|
-
position: fixed;
|
|
15
|
-
top: 0;
|
|
16
|
-
bottom: 0;
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
background: rgba(37, 41, 47, 50%);
|
|
20
|
-
overflow-y: auto;
|
|
21
|
-
z-index: ${({ zIndex }) => zIndex};
|
|
22
|
-
`;
|
|
23
|
-
const StyledDialogContainer = styled.div`
|
|
24
|
-
height: fit-content;
|
|
25
|
-
position: absolute;
|
|
26
|
-
top: 0;
|
|
27
|
-
bottom: 0;
|
|
28
|
-
left: 0;
|
|
29
|
-
right: 0;
|
|
30
|
-
margin: ${({ centered }) => centered ? "auto" : "20vh auto auto auto"};
|
|
31
|
-
width: ${({ size }) => allSizes[size]};
|
|
32
|
-
min-width: 300px;
|
|
33
|
-
box-shadow: 0 10px 20px 0 ${({ theme }) => theme.colors.neutral[500]};
|
|
34
|
-
background: ${({ theme }) => theme.colors.neutral["000"]};
|
|
35
|
-
overflow-y: auto;
|
|
36
|
-
${space}
|
|
37
|
-
&:focus {
|
|
38
|
-
outline: none;
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
const DSDialogTitle = styled.h3`
|
|
42
|
-
font-size: ${({ theme }) => theme.fontSizes.title[700]};
|
|
43
|
-
display: -webkit-box;
|
|
44
|
-
-webkit-line-clamp: 2;
|
|
45
|
-
-webkit-box-orient: vertical;
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
margin: 0;
|
|
48
|
-
`;
|
|
49
|
-
const DSDialogAddon = styled.div``;
|
|
50
|
-
const DSDialogHeader = styled.div`
|
|
51
|
-
display: grid;
|
|
52
|
-
align-items: center;
|
|
53
|
-
grid-auto-flow: column;
|
|
54
|
-
min-height: ${({ theme }) => theme.space.m};
|
|
55
|
-
padding: 10px ${({ theme }) => theme.space.xs};
|
|
56
|
-
& ${DSDialogTitle} + ${DSDialogAddon} {
|
|
57
|
-
align-self: flex-start;
|
|
58
|
-
justify-self: flex-end;
|
|
59
|
-
}
|
|
60
|
-
& ${DSDialogAddon}:only-child {
|
|
61
|
-
justify-self: flex-end;
|
|
62
|
-
}
|
|
63
|
-
${space}
|
|
64
|
-
`;
|
|
65
|
-
const DSDialogSeparator = styled.hr.attrs(() => ({ "aria-hidden": true }))`
|
|
66
|
-
margin: 0;
|
|
67
|
-
border-top: 1px solid ${({ theme }) => theme.colors.neutral["080"]};
|
|
68
|
-
`;
|
|
69
|
-
const DSDialogBody = styled.div`
|
|
70
|
-
padding: ${({ theme }) => theme.space.xs};
|
|
71
|
-
overflow-y: auto;
|
|
72
|
-
${layout}
|
|
73
|
-
${space}
|
|
74
|
-
${flexboxes}
|
|
75
|
-
${sizing}
|
|
76
|
-
`;
|
|
77
|
-
const DSDialogPrimaryMessage = styled.h3`
|
|
78
|
-
margin: 0;
|
|
79
|
-
`;
|
|
80
|
-
const DSDialogSecondaryMessage = styled.p`
|
|
81
|
-
margin: 0;
|
|
82
|
-
color: ${({ theme }) => theme.colors.neutral[500]};
|
|
83
|
-
`;
|
|
84
|
-
const DSDialogDefaultLayout = styled.div`
|
|
85
|
-
display: grid;
|
|
86
|
-
grid-auto-flow: row;
|
|
87
|
-
justify-items: center;
|
|
88
|
-
align-items: center;
|
|
89
|
-
grid-gap: ${({ theme }) => theme.space.xxs};
|
|
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';
|
|
90
4
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
}));
|
|
3
10
|
const DSDialogSizes = {
|
|
4
|
-
DEFAULT:
|
|
5
|
-
SMALL:
|
|
6
|
-
MEDIUM:
|
|
7
|
-
LARGE:
|
|
8
|
-
XLARGE:
|
|
9
|
-
XXLARGE:
|
|
11
|
+
DEFAULT: 'default',
|
|
12
|
+
SMALL: 'small',
|
|
13
|
+
MEDIUM: 'medium',
|
|
14
|
+
LARGE: 'large',
|
|
15
|
+
XLARGE: 'x-large',
|
|
16
|
+
XXLARGE: 'xx-large'
|
|
10
17
|
};
|
|
11
18
|
const DSDialogSizesArrayValues = Object.values(DSDialogSizes);
|
|
12
19
|
const allSizes = {
|
|
13
|
-
default:
|
|
14
|
-
small:
|
|
15
|
-
medium:
|
|
16
|
-
large:
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
default: '576px',
|
|
21
|
+
small: '320px',
|
|
22
|
+
medium: '656px',
|
|
23
|
+
large: '848px',
|
|
24
|
+
'x-large': '1042px',
|
|
25
|
+
'xx-large': '1440px'
|
|
19
26
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
DSDialogSizesArrayValues,
|
|
23
|
-
allSizes,
|
|
24
|
-
getSpaceProps
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=utils.js.map
|
|
27
|
+
|
|
28
|
+
export { DSDialogSizes, DSDialogSizesArrayValues, allSizes, getSpaceProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-dialog",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Dialog",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -64,12 +64,9 @@
|
|
|
64
64
|
"build": "node ../../scripts/build/build.js"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@elliemae/ds-props-helpers": "
|
|
68
|
-
"@elliemae/ds-system": "
|
|
69
|
-
"@xstyled/
|
|
70
|
-
"@xstyled/styled-components": "~3.1.2",
|
|
71
|
-
"@xstyled/system": "~3.1.2",
|
|
72
|
-
"@xstyled/util": "~3.1.0",
|
|
67
|
+
"@elliemae/ds-props-helpers": "3.0.0-next.2",
|
|
68
|
+
"@elliemae/ds-system": "3.0.0-next.2",
|
|
69
|
+
"@xstyled/styled-components": "~3.1.1",
|
|
73
70
|
"react-desc": "~4.1.3"
|
|
74
71
|
},
|
|
75
72
|
"devDependencies": {
|