@zohodesk/components 1.0.0-temp-207.3 → 1.0.0-temp-208.1
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/.cli/propValidation_report.html +1 -1
- package/es/AppContainer/AppContainer.js +11 -7
- package/es/AppContainer/props/defaultProps.js +2 -1
- package/es/AppContainer/props/propTypes.js +2 -1
- package/es/Avatar/Avatar.module.css +175 -175
- package/es/AvatarTeam/AvatarTeam.module.css +189 -189
- package/es/Button/css/Button.module.css +527 -527
- package/es/Buttongroup/Buttongroup.module.css +104 -104
- package/es/CheckBox/CheckBox.module.css +157 -157
- package/es/DateTime/DateTime.module.css +248 -248
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +431 -431
- package/es/DropBox/css/DropBox.module.css +58 -58
- package/es/DropDown/DropDownHeading.module.css +53 -53
- package/es/DropDown/DropDownItem.module.css +94 -94
- package/es/Label/Label.module.css +57 -57
- package/es/ListItem/ListItem.module.css +205 -205
- package/es/PopOver/PopOver.module.css +8 -8
- package/es/Radio/Radio.module.css +115 -115
- package/es/Ribbon/Ribbon.module.css +499 -499
- package/es/Switch/Switch.module.css +127 -127
- package/es/Tag/Tag.module.css +253 -253
- package/es/TextBox/TextBox.module.css +196 -196
- package/es/TextBoxIcon/TextBoxIcon.module.css +79 -79
- package/es/Textarea/Textarea.js +24 -152
- package/es/Textarea/Textarea.module.css +140 -191
- package/es/Textarea/props/defaultProps.js +1 -2
- package/es/Textarea/props/propTypes.js +1 -5
- package/es/common/customscroll.module.css +141 -141
- package/lib/AppContainer/AppContainer.js +38 -23
- package/lib/AppContainer/props/defaultProps.js +2 -1
- package/lib/AppContainer/props/propTypes.js +2 -1
- package/lib/Avatar/Avatar.module.css +175 -175
- package/lib/AvatarTeam/AvatarTeam.module.css +189 -189
- package/lib/Button/css/Button.module.css +527 -527
- package/lib/Buttongroup/Buttongroup.module.css +104 -104
- package/lib/CheckBox/CheckBox.module.css +157 -157
- package/lib/DateTime/DateTime.module.css +248 -248
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +431 -431
- package/lib/DropBox/css/DropBox.module.css +58 -58
- package/lib/DropDown/DropDownHeading.module.css +53 -53
- package/lib/DropDown/DropDownItem.module.css +94 -94
- package/lib/Label/Label.module.css +57 -57
- package/lib/ListItem/ListItem.module.css +205 -205
- package/lib/PopOver/PopOver.module.css +8 -8
- package/lib/Radio/Radio.module.css +115 -115
- package/lib/Ribbon/Ribbon.module.css +499 -499
- package/lib/Switch/Switch.module.css +127 -127
- package/lib/Tag/Tag.module.css +253 -253
- package/lib/TextBox/TextBox.module.css +196 -196
- package/lib/TextBoxIcon/TextBoxIcon.module.css +79 -79
- package/lib/Textarea/Textarea.js +43 -189
- package/lib/Textarea/Textarea.module.css +140 -191
- package/lib/Textarea/props/defaultProps.js +1 -2
- package/lib/Textarea/props/propTypes.js +1 -5
- package/lib/common/customscroll.module.css +141 -141
- package/package.json +2 -2
- package/result.json +1 -1
- package/es/Textarea/utils/calculateNodeHeight.js +0 -58
- package/es/Textarea/utils/debounce.js +0 -24
- package/es/Textarea/utils/getSizingData.js +0 -27
- package/es/Textarea/utils/ownerDocument.js +0 -5
- package/es/Textarea/utils/ownerWindow.js +0 -8
- package/es/Textarea/utils/updateState.js +0 -30
- package/lib/Textarea/utils/calculateNodeHeight.js +0 -69
- package/lib/Textarea/utils/debounce.js +0 -33
- package/lib/Textarea/utils/getSizingData.js +0 -37
- package/lib/Textarea/utils/ownerDocument.js +0 -13
- package/lib/Textarea/utils/ownerWindow.js +0 -18
- package/lib/Textarea/utils/updateState.js +0 -36
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import getSizingData from "./getSizingData";
|
|
2
|
-
export default function calculateNodeHeight(_ref) {
|
|
3
|
-
let {
|
|
4
|
-
minRows = 1,
|
|
5
|
-
maxRows = 5,
|
|
6
|
-
textareaEle,
|
|
7
|
-
hiddenTextareaEle
|
|
8
|
-
} = _ref;
|
|
9
|
-
const {
|
|
10
|
-
computedStyle,
|
|
11
|
-
paddingSize,
|
|
12
|
-
borderSize,
|
|
13
|
-
boxSizing
|
|
14
|
-
} = getSizingData(textareaEle);
|
|
15
|
-
const isBorderBox = boxSizing === "border-box"; // If input's width is shrunk and it's not visible, don't sync height.
|
|
16
|
-
|
|
17
|
-
if (computedStyle.width === '0px') {
|
|
18
|
-
return {
|
|
19
|
-
height: 0
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let hiddenTextarea = hiddenTextareaEle;
|
|
24
|
-
hiddenTextarea.style.width = computedStyle.width;
|
|
25
|
-
hiddenTextarea.value = textareaEle.value || textareaEle.placeholder || "x";
|
|
26
|
-
|
|
27
|
-
if (hiddenTextarea.value.slice(-1) === "\n") {
|
|
28
|
-
// // Certain fonts which overflow the line height will cause the textarea
|
|
29
|
-
// // to report a different scrollHeight depending on whether the last line
|
|
30
|
-
// // is empty. Make it non-empty to avoid this issue.
|
|
31
|
-
hiddenTextarea.value += " ";
|
|
32
|
-
} // The height of the inner content
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const innerHeight = hiddenTextarea.scrollHeight; // Measure height of a textarea with a single row
|
|
36
|
-
|
|
37
|
-
hiddenTextarea.value = "x";
|
|
38
|
-
const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize || parseInt(computedStyle.lineHeight); // The height of the outer content
|
|
39
|
-
|
|
40
|
-
let outerHeight = innerHeight;
|
|
41
|
-
|
|
42
|
-
if (minRows) {
|
|
43
|
-
outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (maxRows) {
|
|
47
|
-
outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
outerHeight = Math.max(outerHeight, singleRowHeight); // Take the box sizing into account for applying this value as a style.
|
|
51
|
-
|
|
52
|
-
const height = outerHeight + (isBorderBox ? paddingSize + borderSize : 0);
|
|
53
|
-
const overflow = Math.abs(outerHeight - innerHeight) <= 1;
|
|
54
|
-
return {
|
|
55
|
-
height,
|
|
56
|
-
overflow
|
|
57
|
-
};
|
|
58
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Corresponds to 10 frames at 60 Hz.
|
|
2
|
-
export default function debounce(func) {
|
|
3
|
-
let wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 166;
|
|
4
|
-
let timeout;
|
|
5
|
-
|
|
6
|
-
function debounced() {
|
|
7
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8
|
-
args[_key] = arguments[_key];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const later = () => {
|
|
12
|
-
func.apply(this, args);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
clearTimeout(timeout);
|
|
16
|
-
timeout = setTimeout(later, wait);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
debounced.clear = () => {
|
|
20
|
-
clearTimeout(timeout);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return debounced;
|
|
24
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import ownerWindow from "./ownerWindow";
|
|
2
|
-
|
|
3
|
-
const getStyleValue = value => {
|
|
4
|
-
return parseInt(value, 10) || 0;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const getSizingData = node => {
|
|
8
|
-
const containerWindow = ownerWindow(node);
|
|
9
|
-
const computedStyle = containerWindow.getComputedStyle(node);
|
|
10
|
-
|
|
11
|
-
if (computedStyle === null) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const boxSizing = computedStyle.boxSizing;
|
|
16
|
-
const paddingSize = getStyleValue(computedStyle.paddingBottom) + getStyleValue(computedStyle.paddingTop);
|
|
17
|
-
const borderSize = getStyleValue(computedStyle.borderBottomWidth) + getStyleValue(computedStyle.borderTopWidth);
|
|
18
|
-
return {
|
|
19
|
-
boxSizing,
|
|
20
|
-
paddingSize,
|
|
21
|
-
borderSize,
|
|
22
|
-
containerWindow,
|
|
23
|
-
computedStyle
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default getSizingData;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const updateState = (prevState, newState, renderRef) => {
|
|
2
|
-
const {
|
|
3
|
-
height,
|
|
4
|
-
overflow
|
|
5
|
-
} = newState;
|
|
6
|
-
const renders = renderRef; // Need a large enough difference to update the height.
|
|
7
|
-
// This prevents infinite rendering loop.
|
|
8
|
-
|
|
9
|
-
if (renders.current < 20 && (height > 0 && Math.abs((prevState.height || 0) - height) > 1 || prevState.overflow !== overflow)) {
|
|
10
|
-
renders.current += 1;
|
|
11
|
-
return {
|
|
12
|
-
overflow,
|
|
13
|
-
height
|
|
14
|
-
};
|
|
15
|
-
} // if (process.env.NODE_ENV !== "production") {
|
|
16
|
-
// if (renders.current === 20) {
|
|
17
|
-
// console.error(
|
|
18
|
-
// [
|
|
19
|
-
// "MUI: Too many re-renders. The layout is unstable.",
|
|
20
|
-
// "TextareaAutosize limits the number of renders to prevent an infinite loop."
|
|
21
|
-
// ].join("\n")
|
|
22
|
-
// )
|
|
23
|
-
// }
|
|
24
|
-
// }
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return prevState;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default updateState;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = calculateNodeHeight;
|
|
7
|
-
|
|
8
|
-
var _getSizingData2 = _interopRequireDefault(require("./getSizingData"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function calculateNodeHeight(_ref) {
|
|
13
|
-
var _ref$minRows = _ref.minRows,
|
|
14
|
-
minRows = _ref$minRows === void 0 ? 1 : _ref$minRows,
|
|
15
|
-
_ref$maxRows = _ref.maxRows,
|
|
16
|
-
maxRows = _ref$maxRows === void 0 ? 5 : _ref$maxRows,
|
|
17
|
-
textareaEle = _ref.textareaEle,
|
|
18
|
-
hiddenTextareaEle = _ref.hiddenTextareaEle;
|
|
19
|
-
|
|
20
|
-
var _getSizingData = (0, _getSizingData2["default"])(textareaEle),
|
|
21
|
-
computedStyle = _getSizingData.computedStyle,
|
|
22
|
-
paddingSize = _getSizingData.paddingSize,
|
|
23
|
-
borderSize = _getSizingData.borderSize,
|
|
24
|
-
boxSizing = _getSizingData.boxSizing;
|
|
25
|
-
|
|
26
|
-
var isBorderBox = boxSizing === "border-box"; // If input's width is shrunk and it's not visible, don't sync height.
|
|
27
|
-
|
|
28
|
-
if (computedStyle.width === '0px') {
|
|
29
|
-
return {
|
|
30
|
-
height: 0
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var hiddenTextarea = hiddenTextareaEle;
|
|
35
|
-
hiddenTextarea.style.width = computedStyle.width;
|
|
36
|
-
hiddenTextarea.value = textareaEle.value || textareaEle.placeholder || "x";
|
|
37
|
-
|
|
38
|
-
if (hiddenTextarea.value.slice(-1) === "\n") {
|
|
39
|
-
// // Certain fonts which overflow the line height will cause the textarea
|
|
40
|
-
// // to report a different scrollHeight depending on whether the last line
|
|
41
|
-
// // is empty. Make it non-empty to avoid this issue.
|
|
42
|
-
hiddenTextarea.value += " ";
|
|
43
|
-
} // The height of the inner content
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var innerHeight = hiddenTextarea.scrollHeight; // Measure height of a textarea with a single row
|
|
47
|
-
|
|
48
|
-
hiddenTextarea.value = "x";
|
|
49
|
-
var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize || parseInt(computedStyle.lineHeight); // The height of the outer content
|
|
50
|
-
|
|
51
|
-
var outerHeight = innerHeight;
|
|
52
|
-
|
|
53
|
-
if (minRows) {
|
|
54
|
-
outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (maxRows) {
|
|
58
|
-
outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
outerHeight = Math.max(outerHeight, singleRowHeight); // Take the box sizing into account for applying this value as a style.
|
|
62
|
-
|
|
63
|
-
var height = outerHeight + (isBorderBox ? paddingSize + borderSize : 0);
|
|
64
|
-
var overflow = Math.abs(outerHeight - innerHeight) <= 1;
|
|
65
|
-
return {
|
|
66
|
-
height: height,
|
|
67
|
-
overflow: overflow
|
|
68
|
-
};
|
|
69
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = debounce;
|
|
7
|
-
|
|
8
|
-
// Corresponds to 10 frames at 60 Hz.
|
|
9
|
-
function debounce(func) {
|
|
10
|
-
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 166;
|
|
11
|
-
var timeout;
|
|
12
|
-
|
|
13
|
-
function debounced() {
|
|
14
|
-
var _this = this;
|
|
15
|
-
|
|
16
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17
|
-
args[_key] = arguments[_key];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var later = function later() {
|
|
21
|
-
func.apply(_this, args);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
clearTimeout(timeout);
|
|
25
|
-
timeout = setTimeout(later, wait);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
debounced.clear = function () {
|
|
29
|
-
clearTimeout(timeout);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return debounced;
|
|
33
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _ownerWindow = _interopRequireDefault(require("./ownerWindow"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var getStyleValue = function getStyleValue(value) {
|
|
13
|
-
return parseInt(value, 10) || 0;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
var getSizingData = function getSizingData(node) {
|
|
17
|
-
var containerWindow = (0, _ownerWindow["default"])(node);
|
|
18
|
-
var computedStyle = containerWindow.getComputedStyle(node);
|
|
19
|
-
|
|
20
|
-
if (computedStyle === null) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var boxSizing = computedStyle.boxSizing;
|
|
25
|
-
var paddingSize = getStyleValue(computedStyle.paddingBottom) + getStyleValue(computedStyle.paddingTop);
|
|
26
|
-
var borderSize = getStyleValue(computedStyle.borderBottomWidth) + getStyleValue(computedStyle.borderTopWidth);
|
|
27
|
-
return {
|
|
28
|
-
boxSizing: boxSizing,
|
|
29
|
-
paddingSize: paddingSize,
|
|
30
|
-
borderSize: borderSize,
|
|
31
|
-
containerWindow: containerWindow,
|
|
32
|
-
computedStyle: computedStyle
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
var _default = getSizingData;
|
|
37
|
-
exports["default"] = _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var ownerDocument = function ownerDocument(node) {
|
|
9
|
-
return node && node.ownerDocument || document;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
var _default = ownerDocument;
|
|
13
|
-
exports["default"] = _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _ownerDocument = _interopRequireDefault(require("./ownerDocument"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var ownerWindow = function ownerWindow(node) {
|
|
13
|
-
var document = (0, _ownerDocument["default"])(node);
|
|
14
|
-
return document.defaultView || window;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
var _default = ownerWindow;
|
|
18
|
-
exports["default"] = _default;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var updateState = function updateState(prevState, newState, renderRef) {
|
|
9
|
-
var height = newState.height,
|
|
10
|
-
overflow = newState.overflow;
|
|
11
|
-
var renders = renderRef; // Need a large enough difference to update the height.
|
|
12
|
-
// This prevents infinite rendering loop.
|
|
13
|
-
|
|
14
|
-
if (renders.current < 20 && (height > 0 && Math.abs((prevState.height || 0) - height) > 1 || prevState.overflow !== overflow)) {
|
|
15
|
-
renders.current += 1;
|
|
16
|
-
return {
|
|
17
|
-
overflow: overflow,
|
|
18
|
-
height: height
|
|
19
|
-
};
|
|
20
|
-
} // if (process.env.NODE_ENV !== "production") {
|
|
21
|
-
// if (renders.current === 20) {
|
|
22
|
-
// console.error(
|
|
23
|
-
// [
|
|
24
|
-
// "MUI: Too many re-renders. The layout is unstable.",
|
|
25
|
-
// "TextareaAutosize limits the number of renders to prevent an infinite loop."
|
|
26
|
-
// ].join("\n")
|
|
27
|
-
// )
|
|
28
|
-
// }
|
|
29
|
-
// }
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return prevState;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
var _default = updateState;
|
|
36
|
-
exports["default"] = _default;
|