@zohodesk/dot 1.0.0-temp-222.1 → 1.0.0-temp-220.4
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 +2 -3
- package/es/form/fields/Fields.module.css +3 -8
- package/es/form/fields/RadioField/RadioField.js +14 -40
- package/es/form/fields/RadioField/__tests__/RadioField.spec.js +0 -33
- package/es/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +66 -562
- package/es/form/fields/RadioField/props/defaultProps.js +0 -1
- package/es/form/fields/RadioField/props/propTypes.js +0 -6
- package/es/version2/GlobalNotification/GlobalNotification.js +46 -7
- package/es/version2/GlobalNotification/__tests__/GlobalNotification.spec.js +9 -0
- package/es/version2/GlobalNotification/props/propTypes.js +4 -3
- package/es/version2/GlobalNotification/utils/constants.js +6 -0
- package/lib/form/fields/Fields.module.css +3 -8
- package/lib/form/fields/RadioField/RadioField.js +15 -39
- package/lib/form/fields/RadioField/__tests__/RadioField.spec.js +0 -33
- package/lib/form/fields/RadioField/__tests__/__snapshots__/RadioField.spec.js.snap +66 -562
- package/lib/form/fields/RadioField/props/defaultProps.js +0 -1
- package/lib/form/fields/RadioField/props/propTypes.js +0 -6
- package/lib/version2/GlobalNotification/GlobalNotification.js +68 -18
- package/lib/version2/GlobalNotification/__tests__/GlobalNotification.spec.js +10 -0
- package/lib/version2/GlobalNotification/props/propTypes.js +4 -3
- package/lib/version2/GlobalNotification/utils/constants.js +13 -0
- package/package.json +6 -6
|
@@ -32,12 +32,6 @@ var propTypes = {
|
|
|
32
32
|
validationRuleMessage: _propTypes["default"].string,
|
|
33
33
|
validationRulePalette: _propTypes["default"].string,
|
|
34
34
|
variant: _propTypes["default"].oneOf(['primary', 'default', 'secondary']),
|
|
35
|
-
customClass: {
|
|
36
|
-
customWrapperClass: _propTypes["default"].string,
|
|
37
|
-
customLabelClass: _propTypes["default"].string,
|
|
38
|
-
customRadioWrapperClass: _propTypes["default"].string,
|
|
39
|
-
customRadioClass: _propTypes["default"].string
|
|
40
|
-
},
|
|
41
35
|
customProps: _propTypes["default"].shape({
|
|
42
36
|
LabelProps: _propTypes["default"].object,
|
|
43
37
|
RadioProps: _propTypes["default"].object,
|
|
@@ -27,10 +27,20 @@ var _Layout = require("@zohodesk/components/es/Layout");
|
|
|
27
27
|
|
|
28
28
|
var _Common = require("@zohodesk/components/es/utils/Common");
|
|
29
29
|
|
|
30
|
+
var _getCurrentTime = _interopRequireDefault(require("@zohodesk/utils/es/getCurrentTime"));
|
|
31
|
+
|
|
32
|
+
var _constants = require("./utils/constants");
|
|
33
|
+
|
|
30
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
31
35
|
|
|
32
36
|
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); }
|
|
33
37
|
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
43
|
+
|
|
34
44
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
45
|
|
|
36
46
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -67,30 +77,61 @@ var GlobalNotification = /*#__PURE__*/function (_React$Component) {
|
|
|
67
77
|
shadowClose: true
|
|
68
78
|
};
|
|
69
79
|
_this.onClose = _this.onClose.bind(_assertThisInitialized(_this));
|
|
80
|
+
_this.getNotiifcationData = _this.getNotiifcationData.bind(_assertThisInitialized(_this));
|
|
81
|
+
_this.handleStatusChange = _this.handleStatusChange.bind(_assertThisInitialized(_this));
|
|
70
82
|
return _this;
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
_createClass(GlobalNotification, [{
|
|
74
86
|
key: "componentDidMount",
|
|
75
87
|
value: function componentDidMount() {
|
|
88
|
+
var _this2 = this;
|
|
89
|
+
|
|
76
90
|
var _this$props = this.props,
|
|
77
91
|
hideMessage = _this$props.hideMessage,
|
|
78
92
|
hideTime = _this$props.hideTime,
|
|
79
93
|
id = _this$props.id,
|
|
80
94
|
needAutoClose = _this$props.needAutoClose;
|
|
95
|
+
this.handleStatusChange(_constants.STATUS.MOUNTED);
|
|
81
96
|
|
|
82
97
|
if (needAutoClose) {
|
|
83
98
|
this.hideMessageTimer = setTimeout(function () {
|
|
84
99
|
hideMessage(id);
|
|
100
|
+
|
|
101
|
+
_this2.handleStatusChange(_constants.STATUS.DISMISSING);
|
|
85
102
|
}, hideTime);
|
|
86
103
|
}
|
|
87
104
|
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "componentDidUpdate",
|
|
107
|
+
value: function componentDidUpdate(prevProps) {
|
|
108
|
+
if (prevProps.id === this.props.id && (prevProps.message !== this.props.message || prevProps.type !== this.props.type)) {
|
|
109
|
+
this.handleStatusChange(_constants.STATUS.UPDATED);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
88
112
|
}, {
|
|
89
113
|
key: "componentWillUnmount",
|
|
90
114
|
value: function componentWillUnmount() {
|
|
91
115
|
if (this.hideMessageTimer) {
|
|
92
116
|
clearTimeout(this.hideMessageTimer);
|
|
93
117
|
}
|
|
118
|
+
|
|
119
|
+
this.handleStatusChange(_constants.STATUS.UNMOUNTED);
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "handleStatusChange",
|
|
123
|
+
value: function handleStatusChange(status) {
|
|
124
|
+
var onStatusChange = this.props.onStatusChange;
|
|
125
|
+
|
|
126
|
+
if (typeof onStatusChange == 'function') {
|
|
127
|
+
var notificationData = this.getNotiifcationData();
|
|
128
|
+
var currentTime = (0, _getCurrentTime["default"])();
|
|
129
|
+
onStatusChange(_objectSpread(_objectSpread({
|
|
130
|
+
status: status
|
|
131
|
+
}, notificationData), {}, {
|
|
132
|
+
time: currentTime
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
94
135
|
}
|
|
95
136
|
}, {
|
|
96
137
|
key: "onClose",
|
|
@@ -102,42 +143,51 @@ var GlobalNotification = /*#__PURE__*/function (_React$Component) {
|
|
|
102
143
|
this.setState({
|
|
103
144
|
shadowClose: false
|
|
104
145
|
});
|
|
146
|
+
this.handleStatusChange(_constants.STATUS.DISMISSING);
|
|
105
147
|
hideMessage && hideMessage(id);
|
|
106
148
|
onClose && onClose(e);
|
|
107
149
|
}
|
|
108
150
|
}, {
|
|
109
|
-
key: "
|
|
110
|
-
value: function
|
|
151
|
+
key: "getNotiifcationData",
|
|
152
|
+
value: function getNotiifcationData() {
|
|
111
153
|
var _this$props3 = this.props,
|
|
112
|
-
type = _this$props3.type,
|
|
113
|
-
message = _this$props3.message,
|
|
114
|
-
hideMessage = _this$props3.hideMessage,
|
|
115
|
-
onClick = _this$props3.onClick,
|
|
116
|
-
_this$props3$i18nKeys = _this$props3.i18nKeys,
|
|
117
|
-
i18nKeys = _this$props3$i18nKeys === void 0 ? {} : _this$props3$i18nKeys,
|
|
118
|
-
customProps = _this$props3.customProps,
|
|
119
|
-
dataSelectorId = _this$props3.dataSelectorId,
|
|
120
154
|
id = _this$props3.id,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
155
|
+
type = _this$props3.type,
|
|
156
|
+
message = _this$props3.message;
|
|
157
|
+
return {
|
|
158
|
+
id: id,
|
|
159
|
+
type: type,
|
|
160
|
+
message: message
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "render",
|
|
165
|
+
value: function render() {
|
|
166
|
+
var _this$props4 = this.props,
|
|
167
|
+
hideMessage = _this$props4.hideMessage,
|
|
168
|
+
onClick = _this$props4.onClick,
|
|
169
|
+
_this$props4$i18nKeys = _this$props4.i18nKeys,
|
|
170
|
+
i18nKeys = _this$props4$i18nKeys === void 0 ? {} : _this$props4$i18nKeys,
|
|
171
|
+
customProps = _this$props4.customProps,
|
|
172
|
+
dataSelectorId = _this$props4.dataSelectorId,
|
|
173
|
+
needShadow = _this$props4.needShadow,
|
|
174
|
+
shadowCount = _this$props4.shadowCount,
|
|
175
|
+
eleRef = _this$props4.eleRef;
|
|
124
176
|
var shadowClose = this.state.shadowClose;
|
|
125
177
|
var _i18nKeys$closeTitle = i18nKeys.closeTitle,
|
|
126
178
|
closeTitle = _i18nKeys$closeTitle === void 0 ? 'Close' : _i18nKeys$closeTitle;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
message: message,
|
|
179
|
+
var notificationData = this.getNotiifcationData();
|
|
180
|
+
return /*#__PURE__*/_react["default"].createElement(GlobalNotificationUI, _extends({}, notificationData, {
|
|
130
181
|
hideMessage: hideMessage,
|
|
131
182
|
onClick: onClick,
|
|
132
183
|
closeTitle: closeTitle,
|
|
133
184
|
customProps: customProps,
|
|
134
185
|
dataSelectorId: dataSelectorId,
|
|
135
|
-
id: id,
|
|
136
186
|
shadowCount: shadowCount,
|
|
137
187
|
onClose: this.onClose,
|
|
138
188
|
needShadow: shadowClose && needShadow,
|
|
139
189
|
eleRef: eleRef
|
|
140
|
-
});
|
|
190
|
+
}));
|
|
141
191
|
}
|
|
142
192
|
}]);
|
|
143
193
|
|
|
@@ -6,6 +6,8 @@ var _react2 = require("@testing-library/react");
|
|
|
6
6
|
|
|
7
7
|
var _GlobalNotification = _interopRequireDefault(require("../GlobalNotification"));
|
|
8
8
|
|
|
9
|
+
var _constants = require("../utils/constants");
|
|
10
|
+
|
|
9
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
12
|
|
|
11
13
|
describe('GlobalNotification', function () {
|
|
@@ -15,4 +17,12 @@ describe('GlobalNotification', function () {
|
|
|
15
17
|
|
|
16
18
|
expect(asFragment()).toMatchSnapshot();
|
|
17
19
|
});
|
|
20
|
+
});
|
|
21
|
+
describe('GlobalNotification Constants', function () {
|
|
22
|
+
test('should have correct constant values', function () {
|
|
23
|
+
expect(_constants.STATUS.MOUNTED).toBe('mounted');
|
|
24
|
+
expect(_constants.STATUS.UPDATED).toBe('updated');
|
|
25
|
+
expect(_constants.STATUS.DISMISSING).toBe('dismissing');
|
|
26
|
+
expect(_constants.STATUS.UNMOUNTED).toBe('unmounted');
|
|
27
|
+
});
|
|
18
28
|
});
|
|
@@ -20,12 +20,13 @@ var propTypes = {
|
|
|
20
20
|
customProps: _propTypes["default"].shape({
|
|
21
21
|
ExtraProps: _propTypes["default"].object
|
|
22
22
|
}),
|
|
23
|
-
id: _propTypes["default"].
|
|
23
|
+
id: _propTypes["default"].string,
|
|
24
24
|
hideTime: _propTypes["default"].number,
|
|
25
25
|
needAutoClose: _propTypes["default"].bool,
|
|
26
26
|
isCollapseView: _propTypes["default"].bool,
|
|
27
27
|
shadowCount: _propTypes["default"].number,
|
|
28
|
-
needShadow: _propTypes["default"].bool
|
|
28
|
+
needShadow: _propTypes["default"].bool,
|
|
29
|
+
onStatusChange: _propTypes["default"].func
|
|
29
30
|
};
|
|
30
31
|
exports.propTypes = propTypes;
|
|
31
32
|
var UI_propTypes = {
|
|
@@ -39,7 +40,7 @@ var UI_propTypes = {
|
|
|
39
40
|
}),
|
|
40
41
|
needShadow: _propTypes["default"].bool,
|
|
41
42
|
shadowCount: _propTypes["default"].number,
|
|
42
|
-
id: _propTypes["default"].
|
|
43
|
+
id: _propTypes["default"].string,
|
|
43
44
|
onClose: _propTypes["default"].func
|
|
44
45
|
};
|
|
45
46
|
exports.UI_propTypes = UI_propTypes;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.STATUS = void 0;
|
|
7
|
+
var STATUS = {
|
|
8
|
+
MOUNTED: 'mounted',
|
|
9
|
+
UNMOUNTED: 'unmounted',
|
|
10
|
+
UPDATED: 'updated',
|
|
11
|
+
DISMISSING: 'dismissing'
|
|
12
|
+
};
|
|
13
|
+
exports.STATUS = STATUS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/dot",
|
|
3
|
-
"version": "1.0.0-temp-
|
|
3
|
+
"version": "1.0.0-temp-220.4",
|
|
4
4
|
"main": "lib/index",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"sstest": "react-cli sstest",
|
|
40
40
|
"common_package_build": "cd ../common && npm run build && cd ../dot",
|
|
41
41
|
"docs": "npm run css:review && review:props && react-cli docs",
|
|
42
|
-
"prepublishOnly": "node prePublish.js && npm run css:review && npm run review:props",
|
|
42
|
+
"prepublishOnly": "node prePublish.js && npm run downloadOnly && npm run css:review && npm run review:props",
|
|
43
43
|
"postpublish": "node postPublish.js",
|
|
44
44
|
"test-clean": "react-cli clean ./coverage && react-cli clean ./unittest react-cli clean ./es && react-cli clean ./lib && react-cli clean ./package-lock.json && react-cli clean ./result.json",
|
|
45
45
|
"download": "npm run downloadOnly && cd ../ && npm run download",
|
|
@@ -73,17 +73,17 @@
|
|
|
73
73
|
"@zohodesk-private/node-plugins": "1.1.13",
|
|
74
74
|
"@zohodesk-private/react-prop-validator": "1.2.3",
|
|
75
75
|
"@zohodesk/a11y": "2.3.8",
|
|
76
|
-
"@zohodesk/components": "1.
|
|
76
|
+
"@zohodesk/components": "1.5.2",
|
|
77
77
|
"@zohodesk/hooks": "2.0.6",
|
|
78
78
|
"@zohodesk/icons": "1.1.4",
|
|
79
79
|
"@zohodesk/layout": "^3.1.0",
|
|
80
80
|
"@zohodesk/svg": "1.2.5",
|
|
81
|
-
"@zohodesk/utils": "1.
|
|
81
|
+
"@zohodesk/utils": "1.0.0-temp-1.4",
|
|
82
82
|
"@zohodesk/variables": "1.2.0",
|
|
83
83
|
"@zohodesk/virtualizer": "1.0.13",
|
|
84
84
|
"react-sortable-hoc": "^0.8.3",
|
|
85
85
|
"velocity-react": "1.4.3",
|
|
86
|
-
"@zohodesk/dotkit": "1.0.
|
|
86
|
+
"@zohodesk/dotkit": "1.0.0-temp-1.9",
|
|
87
87
|
"@zohodesk/react-cli": "1.1.27"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"@zohodesk/virtualizer": "1.0.13",
|
|
96
96
|
"react-sortable-hoc": "^0.8.3",
|
|
97
97
|
"@zohodesk/hooks": "2.0.6",
|
|
98
|
-
"@zohodesk/utils": "1.
|
|
98
|
+
"@zohodesk/utils": "1.0.0-temp-1.4",
|
|
99
99
|
"@zohodesk/a11y": "2.3.8",
|
|
100
100
|
"@zohodesk/layout": "3.1.0"
|
|
101
101
|
}
|