@zohodesk/components 1.0.0-alpha-262 → 1.0.0-alpha-264
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/README.md +9 -0
- package/css_error.log +1 -0
- package/es/DropBox/DropBox.js +69 -243
- package/es/DropBox/DropBoxElement/DropBoxElement.js +118 -0
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +432 -0
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +89 -0
- package/es/DropBox/DropBoxElement/props/defaultProps.js +18 -0
- package/es/DropBox/DropBoxElement/props/propTypes.js +45 -0
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +51 -0
- package/es/DropBox/css/DropBox.module.css +59 -0
- package/es/DropBox/css/cssJSLogic.js +14 -0
- package/es/DropBox/props/defaultProps.js +9 -17
- package/es/DropBox/props/propTypes.js +9 -43
- package/es/ListItem/ListItem.module.css +13 -11
- package/es/css.js +2 -1
- package/es/utils/css/mergeStyle.js +2 -1
- package/lib/DropBox/DropBox.js +67 -276
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +117 -0
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +432 -0
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +72 -0
- package/lib/DropBox/DropBoxElement/props/defaultProps.js +25 -0
- package/lib/DropBox/DropBoxElement/props/propTypes.js +53 -0
- package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +55 -0
- package/lib/DropBox/css/DropBox.module.css +59 -0
- package/lib/DropBox/css/cssJSLogic.js +18 -0
- package/lib/DropBox/props/defaultProps.js +15 -19
- package/lib/DropBox/props/propTypes.js +15 -45
- package/lib/ListItem/ListItem.module.css +13 -11
- package/lib/css.js +2 -1
- package/lib/utils/css/mergeStyle.js +2 -1
- package/package.json +1 -1
- package/docs/external/active-line.js +0 -72
- package/docs/external/autorefresh.js +0 -47
- package/docs/external/codemirror.js +0 -9681
- package/docs/external/css/hopscotch.css +0 -576
- package/docs/external/css/styleGuide.css +0 -1100
- package/docs/external/css.js +0 -466
- package/docs/external/designTokens.js +0 -1
- package/docs/external/foldcode.js +0 -152
- package/docs/external/format.js +0 -129
- package/docs/external/htmlmixed.js +0 -84
- package/docs/external/images/bottom.png +0 -0
- package/docs/external/images/bottombg.jpg +0 -0
- package/docs/external/images/desk.png +0 -0
- package/docs/external/images/desklogo.png +0 -0
- package/docs/external/images/menu.png +0 -0
- package/docs/external/index.html +0 -127
- package/docs/external/javascript.js +0 -422
- package/docs/external/jsx.js +0 -148
- package/docs/external/matchbrackets.js +0 -145
- package/docs/external/xml.js +0 -322
- package/docs/package.json +0 -41
- package/docs/src/index.js +0 -1311
- package/es/DropBox/DropBox.module.css +0 -405
- package/lib/DropBox/DropBox.module.css +0 -405
|
@@ -1,22 +1,14 @@
|
|
|
1
|
+
import { DropBoxElementDefaultProps } from '../DropBoxElement/props/defaultProps';
|
|
1
2
|
export const defaultProps = {
|
|
2
|
-
animationStyle: 'default',
|
|
3
|
-
boxPosition: 'bottomLeft',
|
|
4
|
-
dataId: 'dropBox',
|
|
5
|
-
dataSelectorId: 'dropBox',
|
|
6
|
-
isActive: false,
|
|
7
|
-
isAnimate: false,
|
|
8
|
-
isArrow: true,
|
|
9
|
-
isRadius: true,
|
|
10
|
-
size: 'default',
|
|
11
3
|
needResponsive: true,
|
|
12
|
-
isAbsolutePositioningNeeded: true,
|
|
13
|
-
isBoxPaddingNeed: false,
|
|
14
|
-
isPadding: true,
|
|
15
|
-
customClass: {},
|
|
16
|
-
a11y: {},
|
|
17
|
-
palette: 'default',
|
|
18
|
-
needAutoZindex: true,
|
|
19
4
|
portalId: 'portal1',
|
|
5
|
+
isActive: false,
|
|
6
|
+
isAbsolutePositioningNeeded: true,
|
|
20
7
|
isRestrictScroll: false,
|
|
21
|
-
needFocusScope: false
|
|
8
|
+
needFocusScope: false,
|
|
9
|
+
needAutoZindex: true
|
|
10
|
+
};
|
|
11
|
+
export const DropBoxDefaultProps = {
|
|
12
|
+
...DropBoxElementDefaultProps,
|
|
13
|
+
...defaultProps
|
|
22
14
|
};
|
|
@@ -1,49 +1,15 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import { DropBoxElementPropTypes } from '../DropBoxElement/props/propTypes';
|
|
2
3
|
export const propTypes = {
|
|
3
|
-
animationStyle: PropTypes.oneOf(['default', 'bounce']),
|
|
4
|
-
arrowBottom: PropTypes.number,
|
|
5
|
-
arrowLeft: PropTypes.number,
|
|
6
|
-
arrowPosition: PropTypes.oneOf(['start', 'mid', 'end']),
|
|
7
|
-
arrowRight: PropTypes.number,
|
|
8
|
-
arrowTop: PropTypes.number,
|
|
9
|
-
bottom: PropTypes.number,
|
|
10
|
-
boxPosition: PropTypes.oneOf(['bottomRight', 'bottomLeft', 'bottomCenter', 'topRight', 'topLeft', 'topCenter', 'rightTop', 'rightBottom', 'rightCenter', 'leftTop', 'leftBottom', 'leftCenter']),
|
|
11
|
-
children: PropTypes.element,
|
|
12
|
-
dataId: PropTypes.string,
|
|
13
|
-
dataSelectorId: PropTypes.string,
|
|
14
|
-
forwardRef: PropTypes.object,
|
|
15
|
-
getRef: PropTypes.func,
|
|
16
|
-
isAbsolutePositioningNeeded: PropTypes.bool,
|
|
17
|
-
isActive: PropTypes.bool,
|
|
18
|
-
isAnimate: PropTypes.bool,
|
|
19
|
-
isArrow: PropTypes.bool,
|
|
20
|
-
isBoxPaddingNeed: PropTypes.bool,
|
|
21
|
-
isPadding: PropTypes.bool,
|
|
22
|
-
isRadius: PropTypes.bool,
|
|
23
|
-
left: PropTypes.number,
|
|
24
4
|
needResponsive: PropTypes.bool,
|
|
25
|
-
onClick: PropTypes.func,
|
|
26
|
-
needFocusScope: PropTypes.bool,
|
|
27
|
-
right: PropTypes.number,
|
|
28
|
-
size: PropTypes.oneOf(['mini', 'xmini', 'xsmall', 'small', 'medium', 'large', 'mlarge', 'xlarge', 'xxlarge', 'default']),
|
|
29
|
-
top: PropTypes.number,
|
|
30
|
-
tourId: PropTypes.string,
|
|
31
|
-
htmlId: PropTypes.string,
|
|
32
|
-
tabIndex: PropTypes.number,
|
|
33
|
-
customClass: PropTypes.shape({
|
|
34
|
-
customDropBox: PropTypes.string,
|
|
35
|
-
customMobileDropBox: PropTypes.string,
|
|
36
|
-
customDropBoxWrap: PropTypes.string,
|
|
37
|
-
customMobileDropBoxWrap: PropTypes.string
|
|
38
|
-
}),
|
|
39
|
-
a11y: PropTypes.shape({
|
|
40
|
-
role: PropTypes.string,
|
|
41
|
-
ariaMultiselectable: PropTypes.bool,
|
|
42
|
-
ariaLabelledby: PropTypes.string
|
|
43
|
-
}),
|
|
44
|
-
palette: PropTypes.oneOf(['default', 'dark']),
|
|
45
|
-
needAutoZindex: PropTypes.bool,
|
|
46
5
|
portalId: PropTypes.string,
|
|
6
|
+
isActive: PropTypes.bool,
|
|
7
|
+
isAbsolutePositioningNeeded: PropTypes.bool,
|
|
47
8
|
isRestrictScroll: PropTypes.bool,
|
|
48
|
-
|
|
9
|
+
needFocusScope: PropTypes.bool,
|
|
10
|
+
needAutoZindex: PropTypes.bool
|
|
11
|
+
};
|
|
12
|
+
export const DropBoxPropTypes = {
|
|
13
|
+
...DropBoxElementPropTypes,
|
|
14
|
+
...propTypes
|
|
49
15
|
};
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
--listitem_border_color: var(--zdt_listitem_active_border);
|
|
49
49
|
}
|
|
50
50
|
[dir=ltr] .small {
|
|
51
|
-
--listitem_padding: var(--
|
|
51
|
+
--listitem_padding: var(--zd_size7) var(--zd_size3) var(--zd_size7)
|
|
52
52
|
var(--zd_size5)
|
|
53
|
-
/*rtl: var(--
|
|
53
|
+
/*rtl: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size3)*/;
|
|
54
54
|
}
|
|
55
55
|
[dir=rtl] .small {
|
|
56
|
-
--listitem_padding: var(--
|
|
56
|
+
--listitem_padding: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size3);
|
|
57
57
|
}
|
|
58
58
|
.medium {
|
|
59
|
-
--listitem_padding: var(--
|
|
59
|
+
--listitem_padding: var(--zd_size7) var(--zd_size20);
|
|
60
60
|
--listitem_min_height: var(--zd_size35);
|
|
61
61
|
}
|
|
62
62
|
.large {
|
|
@@ -74,9 +74,11 @@
|
|
|
74
74
|
.children {
|
|
75
75
|
composes: dotted from '../common/common.module.css';
|
|
76
76
|
}
|
|
77
|
+
.value, .multiLineValue {
|
|
78
|
+
line-height: var(--zd_size20);
|
|
79
|
+
}
|
|
77
80
|
.multiLineValue{
|
|
78
81
|
word-break: break-word;
|
|
79
|
-
line-height: var(--zd_size18);
|
|
80
82
|
composes: clamp from '../common/common.module.css'
|
|
81
83
|
}
|
|
82
84
|
.iconBox {
|
|
@@ -183,20 +185,20 @@
|
|
|
183
185
|
display: block;
|
|
184
186
|
}
|
|
185
187
|
[dir=ltr] .smallwithTick {
|
|
186
|
-
--listitem_padding: var(--
|
|
188
|
+
--listitem_padding: var(--zd_size7) var(--zd_size39) var(--zd_size7)
|
|
187
189
|
var(--zd_size5)
|
|
188
|
-
/*rtl: var(--
|
|
190
|
+
/*rtl: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size39)*/;
|
|
189
191
|
}
|
|
190
192
|
[dir=rtl] .smallwithTick {
|
|
191
|
-
--listitem_padding: var(--
|
|
193
|
+
--listitem_padding: var(--zd_size7) var(--zd_size5) var(--zd_size7) var(--zd_size39);
|
|
192
194
|
}
|
|
193
195
|
[dir=ltr] .mediumwithTick {
|
|
194
|
-
--listitem_padding: var(--
|
|
196
|
+
--listitem_padding: var(--zd_size7) var(--zd_size39) var(--zd_size7)
|
|
195
197
|
var(--zd_size20)
|
|
196
|
-
/*rtl: var(--
|
|
198
|
+
/*rtl: var(--zd_size7) var(--zd_size20) var(--zd_size7) var(--zd_size39)*/;
|
|
197
199
|
}
|
|
198
200
|
[dir=rtl] .mediumwithTick {
|
|
199
|
-
--listitem_padding: var(--
|
|
201
|
+
--listitem_padding: var(--zd_size7) var(--zd_size20) var(--zd_size7) var(--zd_size39);
|
|
200
202
|
}
|
|
201
203
|
[dir=ltr] .largewithTick {
|
|
202
204
|
--listitem_padding: var(--zd_size10) var(--zd_size39) var(--zd_size10)
|
package/es/css.js
CHANGED
|
@@ -31,7 +31,8 @@ import './Tag/Tag.module.css';
|
|
|
31
31
|
import './Stencils/Stencils.module.css';
|
|
32
32
|
import './PopOver/PopOver.module.css';
|
|
33
33
|
import './DropDown/DropDown.module.css';
|
|
34
|
-
import './DropBox/DropBox.module.css';
|
|
34
|
+
import './DropBox/css/DropBox.module.css';
|
|
35
|
+
import './DropBox/DropBoxElement/css/DropBoxElement.module.css';
|
|
35
36
|
import './DateTime/DateTime.module.css';
|
|
36
37
|
import './DateTime/DateWidget.module.css';
|
|
37
38
|
import './Card/Card.module.css';
|
|
@@ -3,7 +3,8 @@ const REPLACER_SYMBOL = '$';
|
|
|
3
3
|
// $ startWith is used for replace the existing style.
|
|
4
4
|
// all other will be append
|
|
5
5
|
|
|
6
|
-
export default function mergeStyle(defaultStyle
|
|
6
|
+
export default function mergeStyle(defaultStyle) {
|
|
7
|
+
let customStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7
8
|
let additionalStyle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
8
9
|
// if(!Object.keys(defaultStyle).includes('base')) {
|
|
9
10
|
// throw new Error(`STYLE CUSTOMIZATION RULE - Your style sheet should have "base" class name for customization`);
|
package/lib/DropBox/DropBox.js
CHANGED
|
@@ -4,289 +4,80 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports["default"] =
|
|
7
|
+
exports["default"] = DropBox;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var _propTypes = require("./props/propTypes");
|
|
11
|
-
var _Common = require("../utils/Common");
|
|
9
|
+
var _FocusScope = _interopRequireDefault(require("@zohodesk/a11y/es/FocusScope/FocusScope"));
|
|
12
10
|
var _Modal = _interopRequireDefault(require("../Modal/Modal"));
|
|
13
|
-
var _DropBoxModule = _interopRequireDefault(require("./DropBox.module.css"));
|
|
14
|
-
var _DropBoxPositionMapping = require("./DropBoxPositionMapping.json");
|
|
15
|
-
var _ZindexProvider = require("../Provider/ZindexProvider");
|
|
16
11
|
var _Config = require("../Provider/Config");
|
|
17
12
|
var _LibraryContextInit = _interopRequireDefault(require("../Provider/LibraryContextInit"));
|
|
18
|
-
var
|
|
13
|
+
var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
14
|
+
var _DropBoxElement = _interopRequireDefault(require("./DropBoxElement/DropBoxElement"));
|
|
15
|
+
var _defaultProps = require("./props/defaultProps");
|
|
16
|
+
var _propTypes = require("./props/propTypes");
|
|
17
|
+
var _DropBoxModule = _interopRequireDefault(require("./css/DropBox.module.css"));
|
|
19
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
20
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
21
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
_createClass(DropBoxElement, [{
|
|
46
|
-
key: "getRef",
|
|
47
|
-
value: function getRef(ele) {
|
|
48
|
-
var _this$props = this.props,
|
|
49
|
-
getRef = _this$props.getRef,
|
|
50
|
-
forwardRef = _this$props.forwardRef;
|
|
51
|
-
getRef && getRef(ele);
|
|
52
|
-
if (forwardRef) {
|
|
53
|
-
forwardRef.current = ele;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
key: "render",
|
|
58
|
-
value: function render() {
|
|
59
|
-
var _this$props2 = this.props,
|
|
60
|
-
children = _this$props2.children,
|
|
61
|
-
isAnimate = _this$props2.isAnimate,
|
|
62
|
-
isArrow = _this$props2.isArrow,
|
|
63
|
-
arrowPosition = _this$props2.arrowPosition,
|
|
64
|
-
boxPosition = _this$props2.boxPosition,
|
|
65
|
-
size = _this$props2.size,
|
|
66
|
-
right = _this$props2.right,
|
|
67
|
-
left = _this$props2.left,
|
|
68
|
-
top = _this$props2.top,
|
|
69
|
-
arrowRight = _this$props2.arrowRight,
|
|
70
|
-
arrowLeft = _this$props2.arrowLeft,
|
|
71
|
-
arrowTop = _this$props2.arrowTop,
|
|
72
|
-
arrowBottom = _this$props2.arrowBottom,
|
|
73
|
-
bottom = _this$props2.bottom,
|
|
74
|
-
onClick = _this$props2.onClick,
|
|
75
|
-
isRadius = _this$props2.isRadius,
|
|
76
|
-
animationStyle = _this$props2.animationStyle,
|
|
77
|
-
isActive = _this$props2.isActive,
|
|
78
|
-
dataId = _this$props2.dataId,
|
|
79
|
-
dataSelectorId = _this$props2.dataSelectorId,
|
|
80
|
-
isModel = _this$props2.isModel,
|
|
81
|
-
isAbsolutePositioningNeeded = _this$props2.isAbsolutePositioningNeeded,
|
|
82
|
-
tourId = _this$props2.tourId,
|
|
83
|
-
isBoxPaddingNeed = _this$props2.isBoxPaddingNeed,
|
|
84
|
-
isPadding = _this$props2.isPadding,
|
|
85
|
-
customClass = _this$props2.customClass,
|
|
86
|
-
htmlId = _this$props2.htmlId,
|
|
87
|
-
a11y = _this$props2.a11y,
|
|
88
|
-
direction = _this$props2.direction,
|
|
89
|
-
tabIndex = _this$props2.tabIndex,
|
|
90
|
-
palette = _this$props2.palette,
|
|
91
|
-
positionsOffset = _this$props2.positionsOffset,
|
|
92
|
-
targetOffset = _this$props2.targetOffset,
|
|
93
|
-
zIndexStyle = _this$props2.zIndexStyle,
|
|
94
|
-
customStyle = _this$props2.customStyle,
|
|
95
|
-
subContainerRef = _this$props2.subContainerRef;
|
|
96
|
-
var _ref = this.context || {},
|
|
97
|
-
isReducedMotion = _ref.isReducedMotion;
|
|
98
|
-
if (!isAbsolutePositioningNeeded && size === 'default' && !isActive) {
|
|
99
|
-
isAbsolutePositioningNeeded = true;
|
|
100
|
-
}
|
|
101
|
-
var role = a11y.role,
|
|
102
|
-
ariaMultiselectable = a11y.ariaMultiselectable,
|
|
103
|
-
ariaLabelledby = a11y.ariaLabelledby;
|
|
104
|
-
var _customClass$customDr = customClass.customDropBox,
|
|
105
|
-
customDropBox = _customClass$customDr === void 0 ? '' : _customClass$customDr,
|
|
106
|
-
_customClass$customMo = customClass.customMobileDropBox,
|
|
107
|
-
customMobileDropBox = _customClass$customMo === void 0 ? '' : _customClass$customMo,
|
|
108
|
-
_customClass$customDr2 = customClass.customDropBoxWrap,
|
|
109
|
-
customDropBoxWrap = _customClass$customDr2 === void 0 ? '' : _customClass$customDr2,
|
|
110
|
-
_customClass$customMo2 = customClass.customMobileDropBoxWrap,
|
|
111
|
-
customMobileDropBoxWrap = _customClass$customMo2 === void 0 ? '' : _customClass$customMo2;
|
|
112
|
-
var unit = 'rem';
|
|
113
|
-
var boxstyle = {};
|
|
114
|
-
var arrowstyle = {};
|
|
115
|
-
var needBoxStyle = right || left || top || bottom;
|
|
116
|
-
var needArrowStyle = arrowLeft || arrowRight || arrowTop || arrowBottom;
|
|
117
|
-
if (needBoxStyle) {
|
|
118
|
-
boxstyle = !isModel ? direction === 'rtl' ? {
|
|
119
|
-
right: [(0, _Common.remConvert)(left)] + unit,
|
|
120
|
-
left: [(0, _Common.remConvert)(right)] + unit,
|
|
121
|
-
top: [(0, _Common.remConvert)(top)] + unit,
|
|
122
|
-
bottom: [(0, _Common.remConvert)(bottom)] + unit
|
|
123
|
-
} : {
|
|
124
|
-
right: [(0, _Common.remConvert)(right)] + unit,
|
|
125
|
-
left: [(0, _Common.remConvert)(left)] + unit,
|
|
126
|
-
top: [(0, _Common.remConvert)(top)] + unit,
|
|
127
|
-
bottom: [(0, _Common.remConvert)(bottom)] + unit
|
|
128
|
-
} : {};
|
|
129
|
-
}
|
|
130
|
-
if (needArrowStyle) {
|
|
131
|
-
arrowstyle = !isModel ? direction === 'rtl' ? {
|
|
132
|
-
right: [(0, _Common.remConvert)(arrowLeft)] + unit,
|
|
133
|
-
left: [(0, _Common.remConvert)(arrowRight)] + unit,
|
|
134
|
-
top: [(0, _Common.remConvert)(arrowTop)] + unit,
|
|
135
|
-
bottom: [(0, _Common.remConvert)(arrowBottom)] + unit
|
|
136
|
-
} : {
|
|
137
|
-
right: [(0, _Common.remConvert)(arrowRight)] + unit,
|
|
138
|
-
left: [(0, _Common.remConvert)(arrowLeft)] + unit,
|
|
139
|
-
top: [(0, _Common.remConvert)(arrowTop)] + unit,
|
|
140
|
-
bottom: [(0, _Common.remConvert)(arrowBottom)] + unit
|
|
141
|
-
} : {};
|
|
142
|
-
}
|
|
143
|
-
boxPosition = boxPosition && boxPosition != 'undefined' ? boxPosition : 'bottomCenter';
|
|
144
|
-
var boxDirection = _DropBoxPositionMapping.positionMapping[boxPosition].direction; /*getting box direction*/
|
|
145
|
-
if (isAbsolutePositioningNeeded) {
|
|
146
|
-
arrowPosition = arrowPosition ? arrowPosition : _DropBoxPositionMapping.positionMapping[boxPosition].arrowPosition;
|
|
147
|
-
boxPosition = _DropBoxPositionMapping.positionMapping[boxPosition].positionStyle;
|
|
148
|
-
} else {
|
|
149
|
-
arrowPosition = _DropBoxPositionMapping.positionMapping[boxPosition].arrowPosition;
|
|
150
|
-
}
|
|
151
|
-
var boxClassName = "".concat(_DropBoxModule["default"].main, " ").concat(!isActive ? _DropBoxModule["default"].hidden : '', " ").concat(isModel ? "".concat(_DropBoxModule["default"].responsive, " ").concat(customMobileDropBoxWrap) : "".concat(customDropBoxWrap, " ").concat(size ? _DropBoxModule["default"][size] : '', " ").concat(isActive ? "".concat(isArrow ? "".concat(_DropBoxModule["default"][boxDirection], " ").concat(isAbsolutePositioningNeeded ? _DropBoxModule["default"]["arrow".concat(boxDirection)] : '') : isPadding ? _DropBoxModule["default"]["paddingSpace_".concat(boxDirection)] : '') : '', " ").concat(isAbsolutePositioningNeeded ? "".concat(_DropBoxModule["default"].container, " ").concat(_DropBoxModule["default"][boxPosition]) : _DropBoxModule["default"].fixedContainer));
|
|
152
|
-
var subContainerClass = "".concat(_DropBoxModule["default"].subContainer, " ").concat(isModel ? " ".concat(customMobileDropBox, " ").concat(_DropBoxModule["default"].mobRadius, " ").concat(isActive ? _DropBoxModule["default"].slideUp : '', " ") : "".concat(customDropBox, " ").concat(_DropBoxModule["default"]["".concat(boxDirection, "_shadow")], " ").concat(isRadius ? _DropBoxModule["default"].radius : '', " ").concat(isAnimate && !isReducedMotion && isActive ? animationStyle === 'default' ? _DropBoxModule["default"].fadeIn : _DropBoxModule["default"].bounce : '', " ").concat(isBoxPaddingNeed ? _DropBoxModule["default"].boxPadding : ''));
|
|
153
|
-
|
|
154
|
-
// setting inlineStyle for dropbox
|
|
155
|
-
var inlineStyle = !isModel ? isAbsolutePositioningNeeded ? needBoxStyle && boxstyle : positionsOffset && positionsOffset[boxPosition] || {} : {};
|
|
156
|
-
if (zIndexStyle) {
|
|
157
|
-
inlineStyle = Object.assign({}, inlineStyle, zIndexStyle);
|
|
158
|
-
}
|
|
159
|
-
if (!isModel && !isAbsolutePositioningNeeded && size === 'default' && targetOffset && isActive) {
|
|
160
|
-
inlineStyle = Object.assign({}, inlineStyle, {
|
|
161
|
-
width: targetOffset.width
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
if (customStyle) {
|
|
165
|
-
inlineStyle = Object.assign({}, inlineStyle, customStyle);
|
|
166
|
-
}
|
|
167
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
168
|
-
className: boxClassName,
|
|
169
|
-
"data-id": "".concat(dataId),
|
|
170
|
-
"data-selector-id": dataSelectorId,
|
|
171
|
-
ref: this.getRef,
|
|
172
|
-
style: inlineStyle,
|
|
173
|
-
"data-tour": tourId,
|
|
174
|
-
"data-position": boxPosition,
|
|
175
|
-
id: htmlId,
|
|
176
|
-
role: role,
|
|
177
|
-
"aria-multiselectable": ariaMultiselectable,
|
|
178
|
-
"aria-labelledby": ariaLabelledby,
|
|
179
|
-
tabIndex: tabIndex
|
|
180
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
181
|
-
tabIndex: "-1",
|
|
182
|
-
className: "".concat(subContainerClass, " ").concat(_DropBoxModule["default"]["".concat(palette, "Palette")]),
|
|
183
|
-
onClick: onClick,
|
|
184
|
-
"data-id": "".concat(dataId, "_subcontainer"),
|
|
185
|
-
"data-selector-id": "".concat(dataSelectorId, "_subcontainer"),
|
|
186
|
-
ref: subContainerRef
|
|
187
|
-
}, isModel ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
188
|
-
className: _DropBoxModule["default"].closeBar
|
|
189
|
-
}) : null, isArrow && !isModel && /*#__PURE__*/_react["default"].createElement("div", {
|
|
190
|
-
className: _DropBoxModule["default"][arrowPosition],
|
|
191
|
-
style: needArrowStyle && arrowstyle,
|
|
192
|
-
"data-id": "".concat(dataId, "_arrow"),
|
|
193
|
-
"data-selector-id": "".concat(dataSelectorId, "_arrow")
|
|
194
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
195
|
-
className: _DropBoxModule["default"].arrowShape
|
|
196
|
-
})), children));
|
|
22
|
+
function DropBox(props) {
|
|
23
|
+
var focusRef = (0, _react.useRef)(null);
|
|
24
|
+
var DropBoxContext = (0, _react.useContext)(_LibraryContextInit["default"]);
|
|
25
|
+
var onFreezeClick = function onFreezeClick(e) {
|
|
26
|
+
e && e.stopPropagation();
|
|
27
|
+
};
|
|
28
|
+
var needResponsive = props.needResponsive,
|
|
29
|
+
portalId = props.portalId,
|
|
30
|
+
isActive = props.isActive,
|
|
31
|
+
isAbsolutePositioningNeeded = props.isAbsolutePositioningNeeded,
|
|
32
|
+
isRestrictScroll = props.isRestrictScroll,
|
|
33
|
+
needFocusScope = props.needFocusScope,
|
|
34
|
+
onClose = props.onClose;
|
|
35
|
+
var _ref = DropBoxContext || {},
|
|
36
|
+
direction = _ref.direction;
|
|
37
|
+
var windowWidth,
|
|
38
|
+
mobileWidth = (0, _Config.getLibraryConfig)('mobileWidth'),
|
|
39
|
+
isModel = false;
|
|
40
|
+
if (needResponsive) {
|
|
41
|
+
windowWidth = window.innerWidth;
|
|
42
|
+
if (windowWidth <= mobileWidth) {
|
|
43
|
+
isModel = true;
|
|
197
44
|
}
|
|
198
|
-
}]);
|
|
199
|
-
return DropBoxElement;
|
|
200
|
-
}(_react["default"].Component);
|
|
201
|
-
exports.DropBoxElement = DropBoxElement;
|
|
202
|
-
var DropBox = /*#__PURE__*/function (_React$Component2) {
|
|
203
|
-
_inherits(DropBox, _React$Component2);
|
|
204
|
-
var _super2 = _createSuper(DropBox);
|
|
205
|
-
function DropBox(props) {
|
|
206
|
-
var _this2;
|
|
207
|
-
_classCallCheck(this, DropBox);
|
|
208
|
-
_this2 = _super2.call(this, props);
|
|
209
|
-
_this2.getNextIndex = (0, _ZindexProvider.getZIndex)(_assertThisInitialized(_this2));
|
|
210
|
-
_this2.onFreezeClick = _this2.onFreezeClick.bind(_assertThisInitialized(_this2));
|
|
211
|
-
_this2.createRef = /*#__PURE__*/_react["default"].createRef();
|
|
212
|
-
return _this2;
|
|
213
45
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}, /*#__PURE__*/_react["default"].createElement(DropBoxElement, _extends({
|
|
253
|
-
isModel: isModel,
|
|
254
|
-
direction: direction
|
|
255
|
-
}, this.props, {
|
|
256
|
-
zIndexStyle: zIndexStyle,
|
|
257
|
-
subContainerRef: this.createRef
|
|
258
|
-
}))) : /*#__PURE__*/_react["default"].createElement(DropBoxElement, _extends({
|
|
259
|
-
isModel: isModel,
|
|
260
|
-
direction: direction
|
|
261
|
-
}, this.props, {
|
|
262
|
-
zIndexStyle: zIndexStyle
|
|
263
|
-
}));
|
|
264
|
-
return isModel && isActive ? /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
|
|
265
|
-
portalId: portalId
|
|
266
|
-
}, /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
267
|
-
className: "".concat(_DropBoxModule["default"].freezeLayer, " ").concat(_DropBoxModule["default"].freeze),
|
|
268
|
-
style: zIndexStyle,
|
|
269
|
-
onClick: this.onFreezeClick
|
|
270
|
-
}), dropBoxEle)) : !isAbsolutePositioningNeeded && isActive ? /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
|
|
271
|
-
portalId: portalId
|
|
272
|
-
}, /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, isRestrictScroll ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
273
|
-
className: _DropBoxModule["default"].freezeLayer,
|
|
274
|
-
style: zIndexStyle,
|
|
275
|
-
onClick: this.onFreezeClick
|
|
276
|
-
}) : null, dropBoxEle)) : dropBoxEle;
|
|
277
|
-
}
|
|
278
|
-
}]);
|
|
279
|
-
return DropBox;
|
|
280
|
-
}(_react["default"].Component);
|
|
281
|
-
exports["default"] = DropBox;
|
|
282
|
-
DropBox.propTypes = _propTypes.propTypes;
|
|
283
|
-
DropBox.contextType = _LibraryContextInit["default"];
|
|
284
|
-
DropBox.defaultProps = _defaultProps.defaultProps;
|
|
285
|
-
// if (__DOCS__) {
|
|
286
|
-
// DropBox.docs = {
|
|
287
|
-
// componentGroup: 'Atom',
|
|
288
|
-
// folderName: 'Style Guide',
|
|
289
|
-
// external: true,
|
|
290
|
-
// description: ' '
|
|
291
|
-
// };
|
|
292
|
-
// }
|
|
46
|
+
var _cssJSLogic = (0, _cssJSLogic2["default"])(props),
|
|
47
|
+
zIndexStyle = _cssJSLogic.zIndexStyle;
|
|
48
|
+
var dropBoxEle = needFocusScope ? /*#__PURE__*/_react["default"].createElement(_FocusScope["default"], {
|
|
49
|
+
focusClose: onClose,
|
|
50
|
+
elementRef: focusRef,
|
|
51
|
+
autoFocus: true,
|
|
52
|
+
restoreFocus: true,
|
|
53
|
+
focusArrowLoop: true,
|
|
54
|
+
enableEnterAction: true
|
|
55
|
+
}, /*#__PURE__*/_react["default"].createElement(_DropBoxElement["default"], _extends({
|
|
56
|
+
isModel: isModel,
|
|
57
|
+
direction: direction
|
|
58
|
+
}, props, {
|
|
59
|
+
zIndexStyle: zIndexStyle,
|
|
60
|
+
subContainerRef: focusRef
|
|
61
|
+
}))) : /*#__PURE__*/_react["default"].createElement(_DropBoxElement["default"], _extends({
|
|
62
|
+
isModel: isModel,
|
|
63
|
+
subContainerRef: focusRef,
|
|
64
|
+
direction: direction
|
|
65
|
+
}, props, {
|
|
66
|
+
zIndexStyle: zIndexStyle
|
|
67
|
+
}));
|
|
68
|
+
return isModel && isActive ? /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
|
|
69
|
+
portalId: portalId
|
|
70
|
+
}, /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
71
|
+
className: "".concat(_DropBoxModule["default"].freezeLayer, " ").concat(_DropBoxModule["default"].freeze),
|
|
72
|
+
style: zIndexStyle,
|
|
73
|
+
onClick: onFreezeClick
|
|
74
|
+
}), dropBoxEle)) : !isAbsolutePositioningNeeded && isActive ? /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
|
|
75
|
+
portalId: portalId
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, isRestrictScroll ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
77
|
+
className: _DropBoxModule["default"].freezeLayer,
|
|
78
|
+
style: zIndexStyle,
|
|
79
|
+
onClick: onFreezeClick
|
|
80
|
+
}) : null, dropBoxEle)) : dropBoxEle;
|
|
81
|
+
}
|
|
82
|
+
DropBox.propTypes = _propTypes.DropBoxPropTypes;
|
|
83
|
+
DropBox.defaultProps = _defaultProps.DropBoxDefaultProps;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = DropBoxElement;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _useDropboxPosCalc2 = _interopRequireDefault(require("./useDropboxPosCalc"));
|
|
9
|
+
var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
10
|
+
var _DropBoxPositionMapping = require("../DropBoxPositionMapping.json");
|
|
11
|
+
var _defaultProps = require("./props/defaultProps");
|
|
12
|
+
var _propTypes = require("./props/propTypes");
|
|
13
|
+
var _utils = require("../../utils");
|
|
14
|
+
var _DropBoxElementModule = _interopRequireDefault(require("./css/DropBoxElement.module.css"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
+
function DropBoxElement(props) {
|
|
17
|
+
var children = props.children,
|
|
18
|
+
isAnimate = props.isAnimate,
|
|
19
|
+
isArrow = props.isArrow,
|
|
20
|
+
arrowPosition = props.arrowPosition,
|
|
21
|
+
boxPosition = props.boxPosition,
|
|
22
|
+
size = props.size,
|
|
23
|
+
onClick = props.onClick,
|
|
24
|
+
isActive = props.isActive,
|
|
25
|
+
dataId = props.dataId,
|
|
26
|
+
dataSelectorId = props.dataSelectorId,
|
|
27
|
+
isModel = props.isModel,
|
|
28
|
+
isAbsolutePositioningNeeded = props.isAbsolutePositioningNeeded,
|
|
29
|
+
tourId = props.tourId,
|
|
30
|
+
htmlId = props.htmlId,
|
|
31
|
+
a11y = props.a11y,
|
|
32
|
+
tabIndex = props.tabIndex,
|
|
33
|
+
palette = props.palette,
|
|
34
|
+
subContainerRef = props.subContainerRef,
|
|
35
|
+
customStyle = props.customStyle;
|
|
36
|
+
var FireOnAnimationEnd = function FireOnAnimationEnd() {
|
|
37
|
+
var element = subContainerRef && subContainerRef.current.classList;
|
|
38
|
+
(isAnimate ? _DropBoxElementModule["default"].fadeIn : _DropBoxElementModule["default"].bounce).split(' ').map(function (rmStyle) {
|
|
39
|
+
if (element && element.contains(rmStyle)) {
|
|
40
|
+
element.remove(rmStyle);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var getRef = function getRef(ele) {
|
|
45
|
+
var getRef = props.getRef,
|
|
46
|
+
forwardRef = props.forwardRef;
|
|
47
|
+
getRef && getRef(ele);
|
|
48
|
+
if (forwardRef) {
|
|
49
|
+
forwardRef.current = ele;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
if (!isAbsolutePositioningNeeded && size === 'default' && !isActive) {
|
|
53
|
+
isAbsolutePositioningNeeded = true;
|
|
54
|
+
}
|
|
55
|
+
var role = a11y.role,
|
|
56
|
+
ariaMultiselectable = a11y.ariaMultiselectable,
|
|
57
|
+
ariaLabelledby = a11y.ariaLabelledby;
|
|
58
|
+
boxPosition = boxPosition && boxPosition != 'undefined' ? boxPosition : 'bottomCenter';
|
|
59
|
+
var boxDirection = _DropBoxPositionMapping.positionMapping[boxPosition].direction;
|
|
60
|
+
if (isAbsolutePositioningNeeded) {
|
|
61
|
+
arrowPosition = arrowPosition ? arrowPosition : _DropBoxPositionMapping.positionMapping[boxPosition].arrowPosition;
|
|
62
|
+
boxPosition = _DropBoxPositionMapping.positionMapping[boxPosition].positionStyle;
|
|
63
|
+
} else {
|
|
64
|
+
arrowPosition = _DropBoxPositionMapping.positionMapping[boxPosition].arrowPosition;
|
|
65
|
+
}
|
|
66
|
+
var _useDropboxPosCalc = (0, _useDropboxPosCalc2["default"])(props),
|
|
67
|
+
arrowstyle = _useDropboxPosCalc.arrowstyle,
|
|
68
|
+
boxstyle = _useDropboxPosCalc.boxstyle,
|
|
69
|
+
needBoxStyle = _useDropboxPosCalc.needBoxStyle;
|
|
70
|
+
var mergedStyle = (0, _utils.mergeStyle)(_DropBoxElementModule["default"], customStyle);
|
|
71
|
+
var _cssJSLogic = (0, _cssJSLogic2["default"])({
|
|
72
|
+
props: props,
|
|
73
|
+
style: mergedStyle,
|
|
74
|
+
customState: {
|
|
75
|
+
boxPosition: boxPosition,
|
|
76
|
+
boxDirection: boxDirection,
|
|
77
|
+
boxstyle: boxstyle,
|
|
78
|
+
needBoxStyle: needBoxStyle
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
boxClassName = _cssJSLogic.boxClassName,
|
|
82
|
+
subContainerClass = _cssJSLogic.subContainerClass,
|
|
83
|
+
inlineStyle = _cssJSLogic.inlineStyle;
|
|
84
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
85
|
+
className: boxClassName,
|
|
86
|
+
"data-id": "".concat(dataId),
|
|
87
|
+
"data-selector-id": dataSelectorId,
|
|
88
|
+
ref: getRef,
|
|
89
|
+
style: inlineStyle,
|
|
90
|
+
"data-tour": tourId,
|
|
91
|
+
"data-position": boxPosition,
|
|
92
|
+
id: htmlId,
|
|
93
|
+
role: role,
|
|
94
|
+
"aria-multiselectable": ariaMultiselectable,
|
|
95
|
+
"aria-labelledby": ariaLabelledby,
|
|
96
|
+
tabIndex: tabIndex,
|
|
97
|
+
onAnimationEnd: FireOnAnimationEnd
|
|
98
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
99
|
+
tabIndex: "-1",
|
|
100
|
+
className: "".concat(subContainerClass, " ").concat(_DropBoxElementModule["default"]["".concat(palette, "Palette")]),
|
|
101
|
+
onClick: onClick,
|
|
102
|
+
"data-id": "".concat(dataId, "_subcontainer"),
|
|
103
|
+
"data-selector-id": "".concat(dataSelectorId, "_subcontainer"),
|
|
104
|
+
ref: subContainerRef
|
|
105
|
+
}, isModel ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
106
|
+
className: _DropBoxElementModule["default"].closeBar
|
|
107
|
+
}) : null, isArrow && !isModel && /*#__PURE__*/_react["default"].createElement("div", {
|
|
108
|
+
className: _DropBoxElementModule["default"][arrowPosition],
|
|
109
|
+
style: arrowstyle,
|
|
110
|
+
"data-id": "".concat(dataId, "_arrow"),
|
|
111
|
+
"data-selector-id": "".concat(dataSelectorId, "_arrow")
|
|
112
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
113
|
+
className: _DropBoxElementModule["default"].arrowShape
|
|
114
|
+
})), children));
|
|
115
|
+
}
|
|
116
|
+
DropBoxElement.propTypes = _propTypes.DropBoxElementPropTypes;
|
|
117
|
+
DropBoxElement.defaultProps = _defaultProps.DropBoxElementDefaultProps;
|