@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
package/README.md
CHANGED
|
@@ -32,6 +32,15 @@ In this Package, we Provide Some Basic Components to Build Web App
|
|
|
32
32
|
- TextBoxIcon
|
|
33
33
|
- Tooltip
|
|
34
34
|
|
|
35
|
+
|
|
36
|
+
# 1.0.0-alpha-264
|
|
37
|
+
|
|
38
|
+
- **DropBox** - customStyle renamed to customInlineStyle and migrarted to functional UCL component
|
|
39
|
+
|
|
40
|
+
# 1.0.0-alpha-263
|
|
41
|
+
|
|
42
|
+
- **ListItem, ListItemWithAvatar, ListItemWithCheckbox, ListItemWithIcon, ListItemWithRadio** - Line height changed 20px and Padding also changed.
|
|
43
|
+
|
|
35
44
|
# 1.0.0-alpha-262
|
|
36
45
|
|
|
37
46
|
- **ListItem, ListItemWithAvatar, ListItemWithCheckbox, ListItemWithIcon, ListItemWithRadio** - Added New Prop `needMultiLineText`
|
package/css_error.log
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Component Package error log:
|
package/es/DropBox/DropBox.js
CHANGED
|
@@ -1,251 +1,77 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
import React, { Fragment } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import { propTypes } from './props/propTypes';
|
|
5
|
-
import { remConvert } from '../utils/Common';
|
|
2
|
+
import React, { useRef, Fragment, useContext } from 'react';
|
|
3
|
+
import FocusScope from '@zohodesk/a11y/es/FocusScope/FocusScope';
|
|
6
4
|
import Modal from '../Modal/Modal';
|
|
7
|
-
import style from './DropBox.module.css';
|
|
8
|
-
import { positionMapping } from './DropBoxPositionMapping.json';
|
|
9
|
-
import { getZIndex } from '../Provider/ZindexProvider';
|
|
10
5
|
import { getLibraryConfig } from '../Provider/Config';
|
|
11
6
|
import LibraryContext from '../Provider/LibraryContextInit';
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
forwardRef
|
|
22
|
-
} = this.props;
|
|
23
|
-
getRef && getRef(ele);
|
|
24
|
-
if (forwardRef) {
|
|
25
|
-
forwardRef.current = ele;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
render() {
|
|
29
|
-
let {
|
|
30
|
-
children,
|
|
31
|
-
isAnimate,
|
|
32
|
-
isArrow,
|
|
33
|
-
arrowPosition,
|
|
34
|
-
boxPosition,
|
|
35
|
-
size,
|
|
36
|
-
right,
|
|
37
|
-
left,
|
|
38
|
-
top,
|
|
39
|
-
arrowRight,
|
|
40
|
-
arrowLeft,
|
|
41
|
-
arrowTop,
|
|
42
|
-
arrowBottom,
|
|
43
|
-
bottom,
|
|
44
|
-
onClick,
|
|
45
|
-
isRadius,
|
|
46
|
-
animationStyle,
|
|
47
|
-
isActive,
|
|
48
|
-
dataId,
|
|
49
|
-
dataSelectorId,
|
|
50
|
-
isModel,
|
|
51
|
-
isAbsolutePositioningNeeded,
|
|
52
|
-
tourId,
|
|
53
|
-
isBoxPaddingNeed,
|
|
54
|
-
isPadding,
|
|
55
|
-
customClass,
|
|
56
|
-
htmlId,
|
|
57
|
-
a11y,
|
|
58
|
-
direction,
|
|
59
|
-
tabIndex,
|
|
60
|
-
palette,
|
|
61
|
-
positionsOffset,
|
|
62
|
-
targetOffset,
|
|
63
|
-
zIndexStyle,
|
|
64
|
-
customStyle,
|
|
65
|
-
subContainerRef
|
|
66
|
-
} = this.props;
|
|
67
|
-
let {
|
|
68
|
-
isReducedMotion
|
|
69
|
-
} = this.context || {};
|
|
70
|
-
if (!isAbsolutePositioningNeeded && size === 'default' && !isActive) {
|
|
71
|
-
isAbsolutePositioningNeeded = true;
|
|
72
|
-
}
|
|
73
|
-
const {
|
|
74
|
-
role,
|
|
75
|
-
ariaMultiselectable,
|
|
76
|
-
ariaLabelledby
|
|
77
|
-
} = a11y;
|
|
78
|
-
const {
|
|
79
|
-
customDropBox = '',
|
|
80
|
-
customMobileDropBox = '',
|
|
81
|
-
customDropBoxWrap = '',
|
|
82
|
-
customMobileDropBoxWrap = ''
|
|
83
|
-
} = customClass;
|
|
84
|
-
const unit = 'rem';
|
|
85
|
-
let boxstyle = {};
|
|
86
|
-
let arrowstyle = {};
|
|
87
|
-
const needBoxStyle = right || left || top || bottom;
|
|
88
|
-
const needArrowStyle = arrowLeft || arrowRight || arrowTop || arrowBottom;
|
|
89
|
-
if (needBoxStyle) {
|
|
90
|
-
boxstyle = !isModel ? direction === 'rtl' ? {
|
|
91
|
-
right: [remConvert(left)] + unit,
|
|
92
|
-
left: [remConvert(right)] + unit,
|
|
93
|
-
top: [remConvert(top)] + unit,
|
|
94
|
-
bottom: [remConvert(bottom)] + unit
|
|
95
|
-
} : {
|
|
96
|
-
right: [remConvert(right)] + unit,
|
|
97
|
-
left: [remConvert(left)] + unit,
|
|
98
|
-
top: [remConvert(top)] + unit,
|
|
99
|
-
bottom: [remConvert(bottom)] + unit
|
|
100
|
-
} : {};
|
|
101
|
-
}
|
|
102
|
-
if (needArrowStyle) {
|
|
103
|
-
arrowstyle = !isModel ? direction === 'rtl' ? {
|
|
104
|
-
right: [remConvert(arrowLeft)] + unit,
|
|
105
|
-
left: [remConvert(arrowRight)] + unit,
|
|
106
|
-
top: [remConvert(arrowTop)] + unit,
|
|
107
|
-
bottom: [remConvert(arrowBottom)] + unit
|
|
108
|
-
} : {
|
|
109
|
-
right: [remConvert(arrowRight)] + unit,
|
|
110
|
-
left: [remConvert(arrowLeft)] + unit,
|
|
111
|
-
top: [remConvert(arrowTop)] + unit,
|
|
112
|
-
bottom: [remConvert(arrowBottom)] + unit
|
|
113
|
-
} : {};
|
|
114
|
-
}
|
|
115
|
-
boxPosition = boxPosition && boxPosition != 'undefined' ? boxPosition : 'bottomCenter';
|
|
116
|
-
const boxDirection = positionMapping[boxPosition].direction; /*getting box direction*/
|
|
117
|
-
if (isAbsolutePositioningNeeded) {
|
|
118
|
-
arrowPosition = arrowPosition ? arrowPosition : positionMapping[boxPosition].arrowPosition;
|
|
119
|
-
boxPosition = positionMapping[boxPosition].positionStyle;
|
|
120
|
-
} else {
|
|
121
|
-
arrowPosition = positionMapping[boxPosition].arrowPosition;
|
|
122
|
-
}
|
|
123
|
-
const boxClassName = `${style.main} ${!isActive ? style.hidden : ''} ${isModel ? `${style.responsive} ${customMobileDropBoxWrap}` : `${customDropBoxWrap} ${size ? style[size] : ''} ${isActive ? `${isArrow ? `${style[boxDirection]} ${isAbsolutePositioningNeeded ? style[`arrow${boxDirection}`] : ''}` : isPadding ? style[`paddingSpace_${boxDirection}`] : ''}` : ''} ${isAbsolutePositioningNeeded ? `${style.container} ${style[boxPosition]}` : style.fixedContainer}`}`;
|
|
124
|
-
const subContainerClass = `${style.subContainer} ${isModel ? ` ${customMobileDropBox} ${style.mobRadius} ${isActive ? style.slideUp : ''} ` : `${customDropBox} ${style[`${boxDirection}_shadow`]} ${isRadius ? style.radius : ''} ${isAnimate && !isReducedMotion && isActive ? animationStyle === 'default' ? style.fadeIn : style.bounce : ''} ${isBoxPaddingNeed ? style.boxPadding : ''}`}`;
|
|
125
|
-
|
|
126
|
-
// setting inlineStyle for dropbox
|
|
127
|
-
let inlineStyle = !isModel ? isAbsolutePositioningNeeded ? needBoxStyle && boxstyle : positionsOffset && positionsOffset[boxPosition] || {} : {};
|
|
128
|
-
if (zIndexStyle) {
|
|
129
|
-
inlineStyle = Object.assign({}, inlineStyle, zIndexStyle);
|
|
130
|
-
}
|
|
131
|
-
if (!isModel && !isAbsolutePositioningNeeded && size === 'default' && targetOffset && isActive) {
|
|
132
|
-
inlineStyle = Object.assign({}, inlineStyle, {
|
|
133
|
-
width: targetOffset.width
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
if (customStyle) {
|
|
137
|
-
inlineStyle = Object.assign({}, inlineStyle, customStyle);
|
|
138
|
-
}
|
|
139
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
140
|
-
className: boxClassName,
|
|
141
|
-
"data-id": `${dataId}`,
|
|
142
|
-
"data-selector-id": dataSelectorId,
|
|
143
|
-
ref: this.getRef,
|
|
144
|
-
style: inlineStyle,
|
|
145
|
-
"data-tour": tourId,
|
|
146
|
-
"data-position": boxPosition,
|
|
147
|
-
id: htmlId,
|
|
148
|
-
role: role,
|
|
149
|
-
"aria-multiselectable": ariaMultiselectable,
|
|
150
|
-
"aria-labelledby": ariaLabelledby,
|
|
151
|
-
tabIndex: tabIndex
|
|
152
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
153
|
-
tabIndex: "-1",
|
|
154
|
-
className: `${subContainerClass} ${style[`${palette}Palette`]}`,
|
|
155
|
-
onClick: onClick,
|
|
156
|
-
"data-id": `${dataId}_subcontainer`,
|
|
157
|
-
"data-selector-id": `${dataSelectorId}_subcontainer`,
|
|
158
|
-
ref: subContainerRef
|
|
159
|
-
}, isModel ? /*#__PURE__*/React.createElement("div", {
|
|
160
|
-
className: style.closeBar
|
|
161
|
-
}) : null, isArrow && !isModel && /*#__PURE__*/React.createElement("div", {
|
|
162
|
-
className: style[arrowPosition],
|
|
163
|
-
style: needArrowStyle && arrowstyle,
|
|
164
|
-
"data-id": `${dataId}_arrow`,
|
|
165
|
-
"data-selector-id": `${dataSelectorId}_arrow`
|
|
166
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
167
|
-
className: style.arrowShape
|
|
168
|
-
})), children));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
export default class DropBox extends React.Component {
|
|
172
|
-
constructor(props) {
|
|
173
|
-
super(props);
|
|
174
|
-
this.getNextIndex = getZIndex(this);
|
|
175
|
-
this.onFreezeClick = this.onFreezeClick.bind(this);
|
|
176
|
-
this.createRef = /*#__PURE__*/React.createRef();
|
|
177
|
-
}
|
|
178
|
-
onFreezeClick(e) {
|
|
7
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
8
|
+
import DropBoxElement from './DropBoxElement/DropBoxElement';
|
|
9
|
+
import { DropBoxDefaultProps } from './props/defaultProps';
|
|
10
|
+
import { DropBoxPropTypes } from './props/propTypes';
|
|
11
|
+
import style from './css/DropBox.module.css';
|
|
12
|
+
export default function DropBox(props) {
|
|
13
|
+
const focusRef = useRef(null);
|
|
14
|
+
const DropBoxContext = useContext(LibraryContext);
|
|
15
|
+
const onFreezeClick = e => {
|
|
179
16
|
e && e.stopPropagation();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
17
|
+
};
|
|
18
|
+
const {
|
|
19
|
+
needResponsive,
|
|
20
|
+
portalId,
|
|
21
|
+
isActive,
|
|
22
|
+
isAbsolutePositioningNeeded,
|
|
23
|
+
isRestrictScroll,
|
|
24
|
+
needFocusScope,
|
|
25
|
+
onClose
|
|
26
|
+
} = props;
|
|
27
|
+
const {
|
|
28
|
+
direction
|
|
29
|
+
} = DropBoxContext || {};
|
|
30
|
+
let windowWidth,
|
|
31
|
+
mobileWidth = getLibraryConfig('mobileWidth'),
|
|
32
|
+
isModel = false;
|
|
33
|
+
if (needResponsive) {
|
|
34
|
+
windowWidth = window.innerWidth;
|
|
35
|
+
if (windowWidth <= mobileWidth) {
|
|
36
|
+
isModel = true;
|
|
200
37
|
}
|
|
201
|
-
const zIndexStyle = isActive && needAutoZindex ? {
|
|
202
|
-
zIndex: this.getNextIndex()
|
|
203
|
-
} : {};
|
|
204
|
-
const {
|
|
205
|
-
direction
|
|
206
|
-
} = this.context || {};
|
|
207
|
-
const dropBoxEle = needFocusScope ? /*#__PURE__*/React.createElement(FocusScope, {
|
|
208
|
-
focusClose: onClose,
|
|
209
|
-
elementRef: this.createRef,
|
|
210
|
-
autoFocus: true,
|
|
211
|
-
restoreFocus: true,
|
|
212
|
-
focusArrowLoop: true,
|
|
213
|
-
enableEnterAction: true
|
|
214
|
-
}, /*#__PURE__*/React.createElement(DropBoxElement, _extends({
|
|
215
|
-
isModel: isModel,
|
|
216
|
-
direction: direction
|
|
217
|
-
}, this.props, {
|
|
218
|
-
zIndexStyle: zIndexStyle,
|
|
219
|
-
subContainerRef: this.createRef
|
|
220
|
-
}))) : /*#__PURE__*/React.createElement(DropBoxElement, _extends({
|
|
221
|
-
isModel: isModel,
|
|
222
|
-
direction: direction
|
|
223
|
-
}, this.props, {
|
|
224
|
-
zIndexStyle: zIndexStyle
|
|
225
|
-
}));
|
|
226
|
-
return isModel && isActive ? /*#__PURE__*/React.createElement(Modal, {
|
|
227
|
-
portalId: portalId
|
|
228
|
-
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
229
|
-
className: `${style.freezeLayer} ${style.freeze}`,
|
|
230
|
-
style: zIndexStyle,
|
|
231
|
-
onClick: this.onFreezeClick
|
|
232
|
-
}), dropBoxEle)) : !isAbsolutePositioningNeeded && isActive ? /*#__PURE__*/React.createElement(Modal, {
|
|
233
|
-
portalId: portalId
|
|
234
|
-
}, /*#__PURE__*/React.createElement(Fragment, null, isRestrictScroll ? /*#__PURE__*/React.createElement("div", {
|
|
235
|
-
className: style.freezeLayer,
|
|
236
|
-
style: zIndexStyle,
|
|
237
|
-
onClick: this.onFreezeClick
|
|
238
|
-
}) : null, dropBoxEle)) : dropBoxEle;
|
|
239
38
|
}
|
|
39
|
+
const {
|
|
40
|
+
zIndexStyle
|
|
41
|
+
} = cssJSLogic(props);
|
|
42
|
+
const dropBoxEle = needFocusScope ? /*#__PURE__*/React.createElement(FocusScope, {
|
|
43
|
+
focusClose: onClose,
|
|
44
|
+
elementRef: focusRef,
|
|
45
|
+
autoFocus: true,
|
|
46
|
+
restoreFocus: true,
|
|
47
|
+
focusArrowLoop: true,
|
|
48
|
+
enableEnterAction: true
|
|
49
|
+
}, /*#__PURE__*/React.createElement(DropBoxElement, _extends({
|
|
50
|
+
isModel: isModel,
|
|
51
|
+
direction: direction
|
|
52
|
+
}, props, {
|
|
53
|
+
zIndexStyle: zIndexStyle,
|
|
54
|
+
subContainerRef: focusRef
|
|
55
|
+
}))) : /*#__PURE__*/React.createElement(DropBoxElement, _extends({
|
|
56
|
+
isModel: isModel,
|
|
57
|
+
subContainerRef: focusRef,
|
|
58
|
+
direction: direction
|
|
59
|
+
}, props, {
|
|
60
|
+
zIndexStyle: zIndexStyle
|
|
61
|
+
}));
|
|
62
|
+
return isModel && isActive ? /*#__PURE__*/React.createElement(Modal, {
|
|
63
|
+
portalId: portalId
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: `${style.freezeLayer} ${style.freeze}`,
|
|
66
|
+
style: zIndexStyle,
|
|
67
|
+
onClick: onFreezeClick
|
|
68
|
+
}), dropBoxEle)) : !isAbsolutePositioningNeeded && isActive ? /*#__PURE__*/React.createElement(Modal, {
|
|
69
|
+
portalId: portalId
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Fragment, null, isRestrictScroll ? /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: style.freezeLayer,
|
|
72
|
+
style: zIndexStyle,
|
|
73
|
+
onClick: onFreezeClick
|
|
74
|
+
}) : null, dropBoxEle)) : dropBoxEle;
|
|
240
75
|
}
|
|
241
|
-
DropBox.propTypes =
|
|
242
|
-
DropBox.
|
|
243
|
-
DropBox.defaultProps = defaultProps;
|
|
244
|
-
// if (__DOCS__) {
|
|
245
|
-
// DropBox.docs = {
|
|
246
|
-
// componentGroup: 'Atom',
|
|
247
|
-
// folderName: 'Style Guide',
|
|
248
|
-
// external: true,
|
|
249
|
-
// description: ' '
|
|
250
|
-
// };
|
|
251
|
-
// }
|
|
76
|
+
DropBox.propTypes = DropBoxPropTypes;
|
|
77
|
+
DropBox.defaultProps = DropBoxDefaultProps;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import useDropboxPosCalc from './useDropboxPosCalc';
|
|
3
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
4
|
+
import { positionMapping } from '../DropBoxPositionMapping.json';
|
|
5
|
+
import { DropBoxElementDefaultProps } from './props/defaultProps';
|
|
6
|
+
import { DropBoxElementPropTypes } from './props/propTypes';
|
|
7
|
+
import { mergeStyle } from '../../utils';
|
|
8
|
+
import style from './css/DropBoxElement.module.css';
|
|
9
|
+
export default function DropBoxElement(props) {
|
|
10
|
+
let {
|
|
11
|
+
children,
|
|
12
|
+
isAnimate,
|
|
13
|
+
isArrow,
|
|
14
|
+
arrowPosition,
|
|
15
|
+
boxPosition,
|
|
16
|
+
size,
|
|
17
|
+
onClick,
|
|
18
|
+
isActive,
|
|
19
|
+
dataId,
|
|
20
|
+
dataSelectorId,
|
|
21
|
+
isModel,
|
|
22
|
+
isAbsolutePositioningNeeded,
|
|
23
|
+
tourId,
|
|
24
|
+
htmlId,
|
|
25
|
+
a11y,
|
|
26
|
+
tabIndex,
|
|
27
|
+
palette,
|
|
28
|
+
subContainerRef,
|
|
29
|
+
customStyle
|
|
30
|
+
} = props;
|
|
31
|
+
const FireOnAnimationEnd = () => {
|
|
32
|
+
let element = subContainerRef && subContainerRef.current.classList;
|
|
33
|
+
(isAnimate ? style.fadeIn : style.bounce).split(' ').map(rmStyle => {
|
|
34
|
+
if (element && element.contains(rmStyle)) {
|
|
35
|
+
element.remove(rmStyle);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const getRef = ele => {
|
|
40
|
+
const {
|
|
41
|
+
getRef,
|
|
42
|
+
forwardRef
|
|
43
|
+
} = props;
|
|
44
|
+
getRef && getRef(ele);
|
|
45
|
+
if (forwardRef) {
|
|
46
|
+
forwardRef.current = ele;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
if (!isAbsolutePositioningNeeded && size === 'default' && !isActive) {
|
|
50
|
+
isAbsolutePositioningNeeded = true;
|
|
51
|
+
}
|
|
52
|
+
const {
|
|
53
|
+
role,
|
|
54
|
+
ariaMultiselectable,
|
|
55
|
+
ariaLabelledby
|
|
56
|
+
} = a11y;
|
|
57
|
+
boxPosition = boxPosition && boxPosition != 'undefined' ? boxPosition : 'bottomCenter';
|
|
58
|
+
const boxDirection = positionMapping[boxPosition].direction;
|
|
59
|
+
if (isAbsolutePositioningNeeded) {
|
|
60
|
+
arrowPosition = arrowPosition ? arrowPosition : positionMapping[boxPosition].arrowPosition;
|
|
61
|
+
boxPosition = positionMapping[boxPosition].positionStyle;
|
|
62
|
+
} else {
|
|
63
|
+
arrowPosition = positionMapping[boxPosition].arrowPosition;
|
|
64
|
+
}
|
|
65
|
+
const {
|
|
66
|
+
arrowstyle,
|
|
67
|
+
boxstyle,
|
|
68
|
+
needBoxStyle
|
|
69
|
+
} = useDropboxPosCalc(props);
|
|
70
|
+
const mergedStyle = mergeStyle(style, customStyle);
|
|
71
|
+
const {
|
|
72
|
+
boxClassName,
|
|
73
|
+
subContainerClass,
|
|
74
|
+
inlineStyle
|
|
75
|
+
} = cssJSLogic({
|
|
76
|
+
props,
|
|
77
|
+
style: mergedStyle,
|
|
78
|
+
customState: {
|
|
79
|
+
boxPosition,
|
|
80
|
+
boxDirection,
|
|
81
|
+
boxstyle,
|
|
82
|
+
needBoxStyle
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: boxClassName,
|
|
87
|
+
"data-id": `${dataId}`,
|
|
88
|
+
"data-selector-id": dataSelectorId,
|
|
89
|
+
ref: getRef,
|
|
90
|
+
style: inlineStyle,
|
|
91
|
+
"data-tour": tourId,
|
|
92
|
+
"data-position": boxPosition,
|
|
93
|
+
id: htmlId,
|
|
94
|
+
role: role,
|
|
95
|
+
"aria-multiselectable": ariaMultiselectable,
|
|
96
|
+
"aria-labelledby": ariaLabelledby,
|
|
97
|
+
tabIndex: tabIndex,
|
|
98
|
+
onAnimationEnd: FireOnAnimationEnd
|
|
99
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
tabIndex: "-1",
|
|
101
|
+
className: `${subContainerClass} ${style[`${palette}Palette`]}`,
|
|
102
|
+
onClick: onClick,
|
|
103
|
+
"data-id": `${dataId}_subcontainer`,
|
|
104
|
+
"data-selector-id": `${dataSelectorId}_subcontainer`,
|
|
105
|
+
ref: subContainerRef
|
|
106
|
+
}, isModel ? /*#__PURE__*/React.createElement("div", {
|
|
107
|
+
className: style.closeBar
|
|
108
|
+
}) : null, isArrow && !isModel && /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
className: style[arrowPosition],
|
|
110
|
+
style: arrowstyle,
|
|
111
|
+
"data-id": `${dataId}_arrow`,
|
|
112
|
+
"data-selector-id": `${dataSelectorId}_arrow`
|
|
113
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: style.arrowShape
|
|
115
|
+
})), children));
|
|
116
|
+
}
|
|
117
|
+
DropBoxElement.propTypes = DropBoxElementPropTypes;
|
|
118
|
+
DropBoxElement.defaultProps = DropBoxElementDefaultProps;
|