@targetprocess/confirmation 12.10.6 → 12.18.2-alpha.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/dist/confirmation.es.js +47 -66
- package/dist/confirmation.js +47 -66
- package/package.json +3 -3
package/dist/confirmation.es.js
CHANGED
|
@@ -10,24 +10,25 @@ function _classCallCheck(instance, Constructor) {
|
|
|
10
10
|
throw new TypeError("Cannot call a class as a function");
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
function _defineProperties(target, props) {
|
|
15
14
|
for (var i = 0; i < props.length; i++) {
|
|
16
15
|
var descriptor = props[i];
|
|
17
16
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
18
17
|
descriptor.configurable = true;
|
|
19
18
|
if ("value" in descriptor) descriptor.writable = true;
|
|
20
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
19
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
25
23
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
26
24
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
25
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
26
|
+
writable: false
|
|
27
|
+
});
|
|
27
28
|
return Constructor;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
30
|
function _defineProperty(obj, key, value) {
|
|
31
|
+
key = _toPropertyKey(key);
|
|
31
32
|
if (key in obj) {
|
|
32
33
|
Object.defineProperty(obj, key, {
|
|
33
34
|
value: value,
|
|
@@ -38,33 +39,26 @@ function _defineProperty(obj, key, value) {
|
|
|
38
39
|
} else {
|
|
39
40
|
obj[key] = value;
|
|
40
41
|
}
|
|
41
|
-
|
|
42
42
|
return obj;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
44
|
function _extends() {
|
|
46
|
-
_extends = Object.assign
|
|
45
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
47
46
|
for (var i = 1; i < arguments.length; i++) {
|
|
48
47
|
var source = arguments[i];
|
|
49
|
-
|
|
50
48
|
for (var key in source) {
|
|
51
49
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
52
50
|
target[key] = source[key];
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
|
-
|
|
57
54
|
return target;
|
|
58
55
|
};
|
|
59
|
-
|
|
60
56
|
return _extends.apply(this, arguments);
|
|
61
57
|
}
|
|
62
|
-
|
|
63
58
|
function _inherits(subClass, superClass) {
|
|
64
59
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
65
60
|
throw new TypeError("Super expression must either be null or a function");
|
|
66
61
|
}
|
|
67
|
-
|
|
68
62
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
69
63
|
constructor: {
|
|
70
64
|
value: subClass,
|
|
@@ -72,50 +66,42 @@ function _inherits(subClass, superClass) {
|
|
|
72
66
|
configurable: true
|
|
73
67
|
}
|
|
74
68
|
});
|
|
69
|
+
Object.defineProperty(subClass, "prototype", {
|
|
70
|
+
writable: false
|
|
71
|
+
});
|
|
75
72
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
76
73
|
}
|
|
77
|
-
|
|
78
74
|
function _getPrototypeOf(o) {
|
|
79
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
75
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
80
76
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
81
77
|
};
|
|
82
78
|
return _getPrototypeOf(o);
|
|
83
79
|
}
|
|
84
|
-
|
|
85
80
|
function _setPrototypeOf(o, p) {
|
|
86
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
81
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
87
82
|
o.__proto__ = p;
|
|
88
83
|
return o;
|
|
89
84
|
};
|
|
90
|
-
|
|
91
85
|
return _setPrototypeOf(o, p);
|
|
92
86
|
}
|
|
93
|
-
|
|
94
87
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
95
88
|
if (source == null) return {};
|
|
96
89
|
var target = {};
|
|
97
90
|
var sourceKeys = Object.keys(source);
|
|
98
91
|
var key, i;
|
|
99
|
-
|
|
100
92
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
101
93
|
key = sourceKeys[i];
|
|
102
94
|
if (excluded.indexOf(key) >= 0) continue;
|
|
103
95
|
target[key] = source[key];
|
|
104
96
|
}
|
|
105
|
-
|
|
106
97
|
return target;
|
|
107
98
|
}
|
|
108
|
-
|
|
109
99
|
function _objectWithoutProperties(source, excluded) {
|
|
110
100
|
if (source == null) return {};
|
|
111
|
-
|
|
112
101
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
113
|
-
|
|
114
102
|
var key, i;
|
|
115
|
-
|
|
116
103
|
if (Object.getOwnPropertySymbols) {
|
|
117
104
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
118
|
-
|
|
119
105
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
120
106
|
key = sourceSymbolKeys[i];
|
|
121
107
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -123,25 +109,36 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
123
109
|
target[key] = source[key];
|
|
124
110
|
}
|
|
125
111
|
}
|
|
126
|
-
|
|
127
112
|
return target;
|
|
128
113
|
}
|
|
129
|
-
|
|
130
114
|
function _assertThisInitialized(self) {
|
|
131
115
|
if (self === void 0) {
|
|
132
116
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
133
117
|
}
|
|
134
|
-
|
|
135
118
|
return self;
|
|
136
119
|
}
|
|
137
|
-
|
|
138
120
|
function _possibleConstructorReturn(self, call) {
|
|
139
121
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
140
122
|
return call;
|
|
123
|
+
} else if (call !== void 0) {
|
|
124
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
141
125
|
}
|
|
142
|
-
|
|
143
126
|
return _assertThisInitialized(self);
|
|
144
127
|
}
|
|
128
|
+
function _toPrimitive(input, hint) {
|
|
129
|
+
if (typeof input !== "object" || input === null) return input;
|
|
130
|
+
var prim = input[Symbol.toPrimitive];
|
|
131
|
+
if (prim !== undefined) {
|
|
132
|
+
var res = prim.call(input, hint || "default");
|
|
133
|
+
if (typeof res !== "object") return res;
|
|
134
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
135
|
+
}
|
|
136
|
+
return (hint === "string" ? String : Number)(input);
|
|
137
|
+
}
|
|
138
|
+
function _toPropertyKey(arg) {
|
|
139
|
+
var key = _toPrimitive(arg, "string");
|
|
140
|
+
return typeof key === "symbol" ? key : String(key);
|
|
141
|
+
}
|
|
145
142
|
|
|
146
143
|
function styleInject(css, ref) {
|
|
147
144
|
if ( ref === void 0 ) ref = {};
|
|
@@ -170,30 +167,28 @@ function styleInject(css, ref) {
|
|
|
170
167
|
}
|
|
171
168
|
}
|
|
172
169
|
|
|
173
|
-
var css = ".confirmation__confirmation__12-
|
|
174
|
-
var styles = {"confirmation":"confirmation__confirmation__12-
|
|
170
|
+
var css = ".confirmation__confirmation__12-18-2-alpha-1 {\r\n min-width: 200px;\r\n max-width: 280px;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: start;\r\n -ms-flex-align: start;\r\n align-items: flex-start;\r\n}\r\n\r\n .confirmation__icon__confirmation__12-18-2-alpha-1 {\r\n -webkit-box-flex: 0;\r\n -ms-flex: 0 0 auto;\r\n flex: 0 0 auto;\r\n margin-right: var(--SpaceSM, 12px);\r\n border-radius: 50%;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n width: var(--ControlHeightDefault, 24px);\r\n height: var(--ControlHeightDefault, 24px);\r\n }\r\n\r\n .confirmation__inner__confirmation__12-18-2-alpha-1 {\r\n -webkit-box-flex: 1;\r\n -ms-flex: 1 1 auto;\r\n flex: 1 1 auto;\r\n }\r\n\r\n .confirmation__text__confirmation__12-18-2-alpha-1 {\r\n margin-bottom: var(--SpaceM, 16px);\r\n line-height: 1.23;\r\n }\r\n\r\n .confirmation__text--detailed__confirmation__12-18-2-alpha-1 {\r\n font-weight: var(--FontWeightSemibold, 600);\r\n line-height: 1.23;\r\n font-size: var(--FontSizeTitleSubsection, 16px);\r\n margin: var(--SpaceXS, 4px) 0 var(--SpaceS, 8px) 0;\r\n min-width: 200px;\r\n }\r\n\r\n .confirmation__description__confirmation__12-18-2-alpha-1 {\r\n margin-bottom: var(--SpaceM, 16px);\r\n line-height: 1.23;\r\n color: var(--FontColorGray, rgba(0, 0, 0, 0.7));\r\n }\r\n\r\n .confirmation__controls__confirmation__12-18-2-alpha-1 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n margin-bottom: var(--SpaceXS, 4px);\r\n }\r\n\r\n .confirmation__controls__item__confirmation__12-18-2-alpha-1:not(:last-child) {\r\n margin-right: var(--SpaceS, 8px);\r\n }\r\n";
|
|
171
|
+
var styles = {"confirmation":"confirmation__confirmation__12-18-2-alpha-1","confirmation__icon":"confirmation__icon__confirmation__12-18-2-alpha-1","confirmation__inner":"confirmation__inner__confirmation__12-18-2-alpha-1","confirmation__text":"confirmation__text__confirmation__12-18-2-alpha-1","confirmation__text--detailed":"confirmation__text--detailed__confirmation__12-18-2-alpha-1","confirmation__description":"confirmation__description__confirmation__12-18-2-alpha-1","confirmation__controls":"confirmation__controls__confirmation__12-18-2-alpha-1","confirmation__controls__item":"confirmation__controls__item__confirmation__12-18-2-alpha-1"};
|
|
175
172
|
styleInject(css);
|
|
176
173
|
|
|
177
174
|
function uppercaseFirst(input) {
|
|
178
175
|
if (typeof input !== 'string' || input.length === 0) {
|
|
179
176
|
return input;
|
|
180
177
|
}
|
|
181
|
-
|
|
182
178
|
return input.slice(0, 1).toUpperCase() + input.slice(1);
|
|
183
179
|
}
|
|
184
|
-
|
|
185
180
|
var ConfirmationBody = function ConfirmationBody(_ref) {
|
|
186
181
|
var icon = _ref.icon,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
182
|
+
_ref$kind = _ref.kind,
|
|
183
|
+
kind = _ref$kind === void 0 ? 'second' : _ref$kind,
|
|
184
|
+
text = _ref.text,
|
|
185
|
+
description = _ref.description,
|
|
186
|
+
confirmButtonProps = _ref.confirmButtonProps,
|
|
187
|
+
cancelButtonProps = _ref.cancelButtonProps,
|
|
188
|
+
onConfirm = _ref.onConfirm,
|
|
189
|
+
onCancel = _ref.onCancel,
|
|
190
|
+
confirmLabel = _ref.confirmLabel,
|
|
191
|
+
cancelLabel = _ref.cancelLabel;
|
|
197
192
|
return React.createElement(Popover.Body, null, React.createElement("div", {
|
|
198
193
|
className: classNames(styles['confirmation'])
|
|
199
194
|
}, icon && React.createElement("div", {
|
|
@@ -223,6 +218,7 @@ var ConfirmationBody = function ConfirmationBody(_ref) {
|
|
|
223
218
|
onClick: onCancel
|
|
224
219
|
}), cancelLabel))))));
|
|
225
220
|
};
|
|
221
|
+
|
|
226
222
|
/**
|
|
227
223
|
* Confirmation can be used to display any kind of confirmation pop-up
|
|
228
224
|
* as popover with styled content and confirm and cancel buttons.
|
|
@@ -270,59 +266,45 @@ var ConfirmationBody = function ConfirmationBody(_ref) {
|
|
|
270
266
|
* `confirmButtonProps` and `cancelButtonProps` can be used to fine-tune individual button
|
|
271
267
|
* display, if necessary.
|
|
272
268
|
*/
|
|
273
|
-
|
|
274
269
|
var Confirmation = /*#__PURE__*/function (_React$Component) {
|
|
275
270
|
_inherits(Confirmation, _React$Component);
|
|
276
|
-
|
|
277
271
|
function Confirmation() {
|
|
278
272
|
var _getPrototypeOf2;
|
|
279
|
-
|
|
280
273
|
var _this;
|
|
281
|
-
|
|
282
274
|
_classCallCheck(this, Confirmation);
|
|
283
|
-
|
|
284
275
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
285
276
|
args[_key] = arguments[_key];
|
|
286
277
|
}
|
|
287
|
-
|
|
288
278
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Confirmation)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
289
|
-
|
|
290
279
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onConfirm", function () {
|
|
291
280
|
if (_this.props.onConfirm) {
|
|
292
281
|
_this.props.onConfirm();
|
|
293
282
|
}
|
|
294
|
-
|
|
295
283
|
if (_this.props.closeOnAnyAction && _this.setOpened) {
|
|
296
284
|
_this.setOpened(false);
|
|
297
285
|
}
|
|
298
286
|
});
|
|
299
|
-
|
|
300
287
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onCancel", function () {
|
|
301
288
|
if (_this.props.onCancel) {
|
|
302
289
|
_this.props.onCancel();
|
|
303
290
|
}
|
|
304
|
-
|
|
305
291
|
if (_this.props.closeOnAnyAction && _this.setOpened) {
|
|
306
292
|
_this.setOpened(false);
|
|
307
293
|
}
|
|
308
294
|
});
|
|
309
|
-
|
|
310
295
|
return _this;
|
|
311
296
|
}
|
|
312
|
-
|
|
313
297
|
_createClass(Confirmation, [{
|
|
314
298
|
key: "render",
|
|
315
299
|
value: function render() {
|
|
316
300
|
var _this2 = this;
|
|
317
|
-
|
|
318
301
|
var _this$props = this.props,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
302
|
+
popoverOpen = _this$props.isOpen,
|
|
303
|
+
children = _this$props.children,
|
|
304
|
+
popoverPosition = _this$props.popoverPosition,
|
|
305
|
+
cancelOnOuterAction = _this$props.cancelOnOuterAction,
|
|
306
|
+
getContainerElement = _this$props.getContainerElement,
|
|
307
|
+
otherProps = _objectWithoutProperties(_this$props, ["isOpen", "children", "popoverPosition", "cancelOnOuterAction", "getContainerElement"]);
|
|
326
308
|
return React.createElement(Popover, {
|
|
327
309
|
isOpen: popoverOpen,
|
|
328
310
|
getPopoverPosition: popoverPosition,
|
|
@@ -336,7 +318,7 @@ var Confirmation = /*#__PURE__*/function (_React$Component) {
|
|
|
336
318
|
showTip: true
|
|
337
319
|
}, function (_ref2) {
|
|
338
320
|
var isOpen = _ref2.isOpen,
|
|
339
|
-
|
|
321
|
+
setOpened = _ref2.setOpened;
|
|
340
322
|
_this2.setOpened = setOpened;
|
|
341
323
|
return typeof children === 'function' ? children({
|
|
342
324
|
isOpen: isOpen,
|
|
@@ -345,7 +327,6 @@ var Confirmation = /*#__PURE__*/function (_React$Component) {
|
|
|
345
327
|
});
|
|
346
328
|
}
|
|
347
329
|
}]);
|
|
348
|
-
|
|
349
330
|
return Confirmation;
|
|
350
331
|
}(React.Component);
|
|
351
332
|
Confirmation.defaultProps = {
|
package/dist/confirmation.js
CHANGED
|
@@ -15,24 +15,25 @@ function _classCallCheck(instance, Constructor) {
|
|
|
15
15
|
throw new TypeError("Cannot call a class as a function");
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
function _defineProperties(target, props) {
|
|
20
19
|
for (var i = 0; i < props.length; i++) {
|
|
21
20
|
var descriptor = props[i];
|
|
22
21
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
23
22
|
descriptor.configurable = true;
|
|
24
23
|
if ("value" in descriptor) descriptor.writable = true;
|
|
25
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
24
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
30
28
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
31
29
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
30
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
31
|
+
writable: false
|
|
32
|
+
});
|
|
32
33
|
return Constructor;
|
|
33
34
|
}
|
|
34
|
-
|
|
35
35
|
function _defineProperty(obj, key, value) {
|
|
36
|
+
key = _toPropertyKey(key);
|
|
36
37
|
if (key in obj) {
|
|
37
38
|
Object.defineProperty(obj, key, {
|
|
38
39
|
value: value,
|
|
@@ -43,33 +44,26 @@ function _defineProperty(obj, key, value) {
|
|
|
43
44
|
} else {
|
|
44
45
|
obj[key] = value;
|
|
45
46
|
}
|
|
46
|
-
|
|
47
47
|
return obj;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
49
|
function _extends() {
|
|
51
|
-
_extends = Object.assign
|
|
50
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
52
51
|
for (var i = 1; i < arguments.length; i++) {
|
|
53
52
|
var source = arguments[i];
|
|
54
|
-
|
|
55
53
|
for (var key in source) {
|
|
56
54
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
57
55
|
target[key] = source[key];
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
}
|
|
61
|
-
|
|
62
59
|
return target;
|
|
63
60
|
};
|
|
64
|
-
|
|
65
61
|
return _extends.apply(this, arguments);
|
|
66
62
|
}
|
|
67
|
-
|
|
68
63
|
function _inherits(subClass, superClass) {
|
|
69
64
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
70
65
|
throw new TypeError("Super expression must either be null or a function");
|
|
71
66
|
}
|
|
72
|
-
|
|
73
67
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
74
68
|
constructor: {
|
|
75
69
|
value: subClass,
|
|
@@ -77,50 +71,42 @@ function _inherits(subClass, superClass) {
|
|
|
77
71
|
configurable: true
|
|
78
72
|
}
|
|
79
73
|
});
|
|
74
|
+
Object.defineProperty(subClass, "prototype", {
|
|
75
|
+
writable: false
|
|
76
|
+
});
|
|
80
77
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
81
78
|
}
|
|
82
|
-
|
|
83
79
|
function _getPrototypeOf(o) {
|
|
84
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
80
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
85
81
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
86
82
|
};
|
|
87
83
|
return _getPrototypeOf(o);
|
|
88
84
|
}
|
|
89
|
-
|
|
90
85
|
function _setPrototypeOf(o, p) {
|
|
91
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
86
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
92
87
|
o.__proto__ = p;
|
|
93
88
|
return o;
|
|
94
89
|
};
|
|
95
|
-
|
|
96
90
|
return _setPrototypeOf(o, p);
|
|
97
91
|
}
|
|
98
|
-
|
|
99
92
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
100
93
|
if (source == null) return {};
|
|
101
94
|
var target = {};
|
|
102
95
|
var sourceKeys = Object.keys(source);
|
|
103
96
|
var key, i;
|
|
104
|
-
|
|
105
97
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
106
98
|
key = sourceKeys[i];
|
|
107
99
|
if (excluded.indexOf(key) >= 0) continue;
|
|
108
100
|
target[key] = source[key];
|
|
109
101
|
}
|
|
110
|
-
|
|
111
102
|
return target;
|
|
112
103
|
}
|
|
113
|
-
|
|
114
104
|
function _objectWithoutProperties(source, excluded) {
|
|
115
105
|
if (source == null) return {};
|
|
116
|
-
|
|
117
106
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
118
|
-
|
|
119
107
|
var key, i;
|
|
120
|
-
|
|
121
108
|
if (Object.getOwnPropertySymbols) {
|
|
122
109
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
123
|
-
|
|
124
110
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
125
111
|
key = sourceSymbolKeys[i];
|
|
126
112
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -128,25 +114,36 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
128
114
|
target[key] = source[key];
|
|
129
115
|
}
|
|
130
116
|
}
|
|
131
|
-
|
|
132
117
|
return target;
|
|
133
118
|
}
|
|
134
|
-
|
|
135
119
|
function _assertThisInitialized(self) {
|
|
136
120
|
if (self === void 0) {
|
|
137
121
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
138
122
|
}
|
|
139
|
-
|
|
140
123
|
return self;
|
|
141
124
|
}
|
|
142
|
-
|
|
143
125
|
function _possibleConstructorReturn(self, call) {
|
|
144
126
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
145
127
|
return call;
|
|
128
|
+
} else if (call !== void 0) {
|
|
129
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
146
130
|
}
|
|
147
|
-
|
|
148
131
|
return _assertThisInitialized(self);
|
|
149
132
|
}
|
|
133
|
+
function _toPrimitive(input, hint) {
|
|
134
|
+
if (typeof input !== "object" || input === null) return input;
|
|
135
|
+
var prim = input[Symbol.toPrimitive];
|
|
136
|
+
if (prim !== undefined) {
|
|
137
|
+
var res = prim.call(input, hint || "default");
|
|
138
|
+
if (typeof res !== "object") return res;
|
|
139
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
140
|
+
}
|
|
141
|
+
return (hint === "string" ? String : Number)(input);
|
|
142
|
+
}
|
|
143
|
+
function _toPropertyKey(arg) {
|
|
144
|
+
var key = _toPrimitive(arg, "string");
|
|
145
|
+
return typeof key === "symbol" ? key : String(key);
|
|
146
|
+
}
|
|
150
147
|
|
|
151
148
|
function styleInject(css, ref) {
|
|
152
149
|
if ( ref === void 0 ) ref = {};
|
|
@@ -175,30 +172,28 @@ function styleInject(css, ref) {
|
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
174
|
|
|
178
|
-
var css = ".confirmation__confirmation__12-
|
|
179
|
-
var styles = {"confirmation":"confirmation__confirmation__12-
|
|
175
|
+
var css = ".confirmation__confirmation__12-18-2-alpha-1 {\r\n min-width: 200px;\r\n max-width: 280px;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: start;\r\n -ms-flex-align: start;\r\n align-items: flex-start;\r\n}\r\n\r\n .confirmation__icon__confirmation__12-18-2-alpha-1 {\r\n -webkit-box-flex: 0;\r\n -ms-flex: 0 0 auto;\r\n flex: 0 0 auto;\r\n margin-right: var(--SpaceSM, 12px);\r\n border-radius: 50%;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n width: var(--ControlHeightDefault, 24px);\r\n height: var(--ControlHeightDefault, 24px);\r\n }\r\n\r\n .confirmation__inner__confirmation__12-18-2-alpha-1 {\r\n -webkit-box-flex: 1;\r\n -ms-flex: 1 1 auto;\r\n flex: 1 1 auto;\r\n }\r\n\r\n .confirmation__text__confirmation__12-18-2-alpha-1 {\r\n margin-bottom: var(--SpaceM, 16px);\r\n line-height: 1.23;\r\n }\r\n\r\n .confirmation__text--detailed__confirmation__12-18-2-alpha-1 {\r\n font-weight: var(--FontWeightSemibold, 600);\r\n line-height: 1.23;\r\n font-size: var(--FontSizeTitleSubsection, 16px);\r\n margin: var(--SpaceXS, 4px) 0 var(--SpaceS, 8px) 0;\r\n min-width: 200px;\r\n }\r\n\r\n .confirmation__description__confirmation__12-18-2-alpha-1 {\r\n margin-bottom: var(--SpaceM, 16px);\r\n line-height: 1.23;\r\n color: var(--FontColorGray, rgba(0, 0, 0, 0.7));\r\n }\r\n\r\n .confirmation__controls__confirmation__12-18-2-alpha-1 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n margin-bottom: var(--SpaceXS, 4px);\r\n }\r\n\r\n .confirmation__controls__item__confirmation__12-18-2-alpha-1:not(:last-child) {\r\n margin-right: var(--SpaceS, 8px);\r\n }\r\n";
|
|
176
|
+
var styles = {"confirmation":"confirmation__confirmation__12-18-2-alpha-1","confirmation__icon":"confirmation__icon__confirmation__12-18-2-alpha-1","confirmation__inner":"confirmation__inner__confirmation__12-18-2-alpha-1","confirmation__text":"confirmation__text__confirmation__12-18-2-alpha-1","confirmation__text--detailed":"confirmation__text--detailed__confirmation__12-18-2-alpha-1","confirmation__description":"confirmation__description__confirmation__12-18-2-alpha-1","confirmation__controls":"confirmation__controls__confirmation__12-18-2-alpha-1","confirmation__controls__item":"confirmation__controls__item__confirmation__12-18-2-alpha-1"};
|
|
180
177
|
styleInject(css);
|
|
181
178
|
|
|
182
179
|
function uppercaseFirst(input) {
|
|
183
180
|
if (typeof input !== 'string' || input.length === 0) {
|
|
184
181
|
return input;
|
|
185
182
|
}
|
|
186
|
-
|
|
187
183
|
return input.slice(0, 1).toUpperCase() + input.slice(1);
|
|
188
184
|
}
|
|
189
|
-
|
|
190
185
|
var ConfirmationBody = function ConfirmationBody(_ref) {
|
|
191
186
|
var icon = _ref.icon,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
187
|
+
_ref$kind = _ref.kind,
|
|
188
|
+
kind = _ref$kind === void 0 ? 'second' : _ref$kind,
|
|
189
|
+
text = _ref.text,
|
|
190
|
+
description = _ref.description,
|
|
191
|
+
confirmButtonProps = _ref.confirmButtonProps,
|
|
192
|
+
cancelButtonProps = _ref.cancelButtonProps,
|
|
193
|
+
onConfirm = _ref.onConfirm,
|
|
194
|
+
onCancel = _ref.onCancel,
|
|
195
|
+
confirmLabel = _ref.confirmLabel,
|
|
196
|
+
cancelLabel = _ref.cancelLabel;
|
|
202
197
|
return React.createElement(popover.Popover.Body, null, React.createElement("div", {
|
|
203
198
|
className: classNames(styles['confirmation'])
|
|
204
199
|
}, icon && React.createElement("div", {
|
|
@@ -228,6 +223,7 @@ var ConfirmationBody = function ConfirmationBody(_ref) {
|
|
|
228
223
|
onClick: onCancel
|
|
229
224
|
}), cancelLabel))))));
|
|
230
225
|
};
|
|
226
|
+
|
|
231
227
|
/**
|
|
232
228
|
* Confirmation can be used to display any kind of confirmation pop-up
|
|
233
229
|
* as popover with styled content and confirm and cancel buttons.
|
|
@@ -275,59 +271,45 @@ var ConfirmationBody = function ConfirmationBody(_ref) {
|
|
|
275
271
|
* `confirmButtonProps` and `cancelButtonProps` can be used to fine-tune individual button
|
|
276
272
|
* display, if necessary.
|
|
277
273
|
*/
|
|
278
|
-
|
|
279
274
|
var Confirmation = /*#__PURE__*/function (_React$Component) {
|
|
280
275
|
_inherits(Confirmation, _React$Component);
|
|
281
|
-
|
|
282
276
|
function Confirmation() {
|
|
283
277
|
var _getPrototypeOf2;
|
|
284
|
-
|
|
285
278
|
var _this;
|
|
286
|
-
|
|
287
279
|
_classCallCheck(this, Confirmation);
|
|
288
|
-
|
|
289
280
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
290
281
|
args[_key] = arguments[_key];
|
|
291
282
|
}
|
|
292
|
-
|
|
293
283
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Confirmation)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
294
|
-
|
|
295
284
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onConfirm", function () {
|
|
296
285
|
if (_this.props.onConfirm) {
|
|
297
286
|
_this.props.onConfirm();
|
|
298
287
|
}
|
|
299
|
-
|
|
300
288
|
if (_this.props.closeOnAnyAction && _this.setOpened) {
|
|
301
289
|
_this.setOpened(false);
|
|
302
290
|
}
|
|
303
291
|
});
|
|
304
|
-
|
|
305
292
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onCancel", function () {
|
|
306
293
|
if (_this.props.onCancel) {
|
|
307
294
|
_this.props.onCancel();
|
|
308
295
|
}
|
|
309
|
-
|
|
310
296
|
if (_this.props.closeOnAnyAction && _this.setOpened) {
|
|
311
297
|
_this.setOpened(false);
|
|
312
298
|
}
|
|
313
299
|
});
|
|
314
|
-
|
|
315
300
|
return _this;
|
|
316
301
|
}
|
|
317
|
-
|
|
318
302
|
_createClass(Confirmation, [{
|
|
319
303
|
key: "render",
|
|
320
304
|
value: function render() {
|
|
321
305
|
var _this2 = this;
|
|
322
|
-
|
|
323
306
|
var _this$props = this.props,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
307
|
+
popoverOpen = _this$props.isOpen,
|
|
308
|
+
children = _this$props.children,
|
|
309
|
+
popoverPosition = _this$props.popoverPosition,
|
|
310
|
+
cancelOnOuterAction = _this$props.cancelOnOuterAction,
|
|
311
|
+
getContainerElement = _this$props.getContainerElement,
|
|
312
|
+
otherProps = _objectWithoutProperties(_this$props, ["isOpen", "children", "popoverPosition", "cancelOnOuterAction", "getContainerElement"]);
|
|
331
313
|
return React.createElement(popover.Popover, {
|
|
332
314
|
isOpen: popoverOpen,
|
|
333
315
|
getPopoverPosition: popoverPosition,
|
|
@@ -341,7 +323,7 @@ var Confirmation = /*#__PURE__*/function (_React$Component) {
|
|
|
341
323
|
showTip: true
|
|
342
324
|
}, function (_ref2) {
|
|
343
325
|
var isOpen = _ref2.isOpen,
|
|
344
|
-
|
|
326
|
+
setOpened = _ref2.setOpened;
|
|
345
327
|
_this2.setOpened = setOpened;
|
|
346
328
|
return typeof children === 'function' ? children({
|
|
347
329
|
isOpen: isOpen,
|
|
@@ -350,7 +332,6 @@ var Confirmation = /*#__PURE__*/function (_React$Component) {
|
|
|
350
332
|
});
|
|
351
333
|
}
|
|
352
334
|
}]);
|
|
353
|
-
|
|
354
335
|
return Confirmation;
|
|
355
336
|
}(React.Component);
|
|
356
337
|
Confirmation.defaultProps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@targetprocess/confirmation",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.18.2-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/confirmation.js",
|
|
6
6
|
"module": "dist/confirmation.es.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@targetprocess/button": "^12.7.3",
|
|
14
14
|
"@targetprocess/css-variables": "^12.7.3",
|
|
15
|
-
"@targetprocess/popover": "^12.
|
|
15
|
+
"@targetprocess/popover": "^12.18.2-alpha.1",
|
|
16
16
|
"classnames": "^2.2.5",
|
|
17
17
|
"prop-types": "^15.6.0",
|
|
18
18
|
"react": "^16.7.0"
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"sideEffects": false,
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "a0cbd3034253a0be67c3b03434cb8da591701e70"
|
|
25
25
|
}
|