@planningcenter/tapestry-react 2.9.2 → 2.10.0-rc.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/cjs/Badge/Badge.js +19 -7
- package/dist/cjs/Badge/Status.js +52 -77
- package/dist/cjs/Button/Button.js +1 -1
- package/dist/cjs/Calendar/Day.js +5 -2
- package/dist/cjs/Combobox/ComboboxPopover.js +20 -6
- package/dist/cjs/Input/Inline.js +1 -1
- package/dist/cjs/Input/InputBox.js +1 -1
- package/dist/cjs/Menu/Item.js +47 -25
- package/dist/cjs/Modal/Modal.js +4 -3
- package/dist/cjs/NumberField/NumberField.js +112 -31
- package/dist/cjs/NumberField/NumberField.test.js +8 -2
- package/dist/cjs/Portal/Portal.js +2 -1
- package/dist/cjs/Progress/Progress.js +2 -2
- package/dist/cjs/Radio/Radio.js +12 -8
- package/dist/cjs/Toolbar/Toolbar.js +1 -0
- package/dist/cjs/Tooltip/Tooltip.js +4 -2
- package/dist/cjs/Wizard/Wizard.js +4 -4
- package/dist/cjs/system/utils.js +2 -0
- package/dist/esm/Badge/Badge.js +19 -7
- package/dist/esm/Badge/Status.js +52 -77
- package/dist/esm/Button/Button.js +1 -1
- package/dist/esm/Calendar/Day.js +5 -2
- package/dist/esm/Combobox/ComboboxPopover.js +20 -6
- package/dist/esm/Input/Inline.js +1 -1
- package/dist/esm/Input/InputBox.js +1 -1
- package/dist/esm/Menu/Item.js +47 -25
- package/dist/esm/Modal/Modal.js +4 -3
- package/dist/esm/NumberField/NumberField.js +112 -32
- package/dist/esm/NumberField/NumberField.test.js +8 -2
- package/dist/esm/Portal/Portal.js +2 -1
- package/dist/esm/Progress/Progress.js +2 -2
- package/dist/esm/Radio/Radio.js +12 -8
- package/dist/esm/Toolbar/Toolbar.js +2 -1
- package/dist/esm/Tooltip/Tooltip.js +4 -2
- package/dist/esm/Wizard/Wizard.js +4 -4
- package/dist/esm/system/utils.js +2 -0
- package/dist/types/Badge/Status.d.ts +27 -0
- package/dist/types/Button/Button.d.ts +4 -2
- package/dist/types/Modal/Modal.d.ts +23 -0
- package/dist/types/NumberField/NumberField.d.ts +89 -0
- package/dist/types/Progress/Progress.d.ts +12 -0
- package/dist/types/Radio/Radio.d.ts +44 -0
- package/dist/types/Wizard/Wizard.d.ts +63 -0
- package/package.json +3 -1
- package/src/Badge/Badge.js +8 -0
- package/src/Badge/Status.tsx +90 -0
- package/src/Button/Button.tsx +2 -2
- package/src/Calendar/Day.js +11 -0
- package/src/Combobox/ComboboxPopover.js +30 -0
- package/src/Input/Inline.js +1 -1
- package/src/Input/InputBox.js +1 -1
- package/src/Menu/Item.js +15 -0
- package/src/Modal/{Modal.js → Modal.tsx} +8 -9
- package/src/NumberField/NumberField.mdx +13 -0
- package/src/NumberField/NumberField.test.tsx +38 -11
- package/src/NumberField/{NumberField.js → NumberField.tsx} +124 -48
- package/src/Portal/Portal.tsx +1 -0
- package/src/Progress/{Progress.js → Progress.tsx} +3 -4
- package/src/Radio/{Radio.js → Radio.tsx} +21 -15
- package/src/Toolbar/Toolbar.js +1 -0
- package/src/Tooltip/Tooltip.js +8 -1
- package/src/Wizard/{Wizard.js → Wizard.tsx} +42 -35
- package/src/system/utils.js +2 -0
- package/src/Badge/Status.js +0 -101
|
@@ -25,6 +25,7 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
25
25
|
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
26
26
|
|
|
27
27
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
28
|
+
// @ts-ignore error TS2339: Property 'defaultOpen' does not exist on type 'Readonly<Props>'.
|
|
28
29
|
isPopoverOpen: _this.props.defaultOpen || false
|
|
29
30
|
});
|
|
30
31
|
|
|
@@ -37,10 +38,12 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
37
38
|
_defineProperty(_assertThisInitialized(_this), "closeRequestId", null);
|
|
38
39
|
|
|
39
40
|
_defineProperty(_assertThisInitialized(_this), "setItemListRef", function (component) {
|
|
41
|
+
// @ts-ignore error TS2339: Property 'itemList' does not exist on type 'ComboboxPopover'.
|
|
40
42
|
_this.itemList = component;
|
|
41
43
|
});
|
|
42
44
|
|
|
43
45
|
_defineProperty(_assertThisInitialized(_this), "setInputRef", function (component) {
|
|
46
|
+
// @ts-ignore error TS2339: Property 'input' does not exist on type 'ComboboxPopover'.
|
|
44
47
|
_this.input = component;
|
|
45
48
|
});
|
|
46
49
|
|
|
@@ -48,6 +51,7 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
48
51
|
_this.setState({
|
|
49
52
|
isPopoverOpen: true
|
|
50
53
|
}, function () {
|
|
54
|
+
// @ts-ignore error TS2339: Property 'itemList' does not exist on type 'ComboboxPopover'.
|
|
51
55
|
_this.itemList.setHighlightedIndex(0, {
|
|
52
56
|
maybeScrollIntoView: false
|
|
53
57
|
});
|
|
@@ -60,6 +64,7 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
60
64
|
_this.setState({
|
|
61
65
|
isPopoverOpen: false
|
|
62
66
|
}, function () {
|
|
67
|
+
// @ts-ignore error TS2339: Property 'itemList' does not exist on type 'ComboboxPopover'.
|
|
63
68
|
_this.itemList.clearHighlightedIndex();
|
|
64
69
|
});
|
|
65
70
|
});
|
|
@@ -68,9 +73,10 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
68
73
|
_defineProperty(_assertThisInitialized(_this), "handleBlur", function (event) {
|
|
69
74
|
_this.closePopover();
|
|
70
75
|
|
|
71
|
-
_this.inputTouched = false;
|
|
76
|
+
_this.inputTouched = false; // @ts-ignore error TS2339: Property 'onBlur' does not exist on type 'Readonly<Props>'.
|
|
72
77
|
|
|
73
78
|
if (_this.props.onBlur) {
|
|
79
|
+
// @ts-ignore error TS2339: Property 'onBlur' does not exist on type 'Readonly<Props>'.
|
|
74
80
|
_this.props.onBlur(event);
|
|
75
81
|
}
|
|
76
82
|
});
|
|
@@ -78,9 +84,11 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
78
84
|
_defineProperty(_assertThisInitialized(_this), "handleSelect", function (event) {
|
|
79
85
|
if (_this.props.closeOnSelect) {
|
|
80
86
|
_this.closePopover();
|
|
81
|
-
}
|
|
87
|
+
} // @ts-ignore error TS2339: Property 'onSelect' does not exist on type 'Readonly<Props>'.
|
|
88
|
+
|
|
82
89
|
|
|
83
90
|
if (_this.props.onSelect) {
|
|
91
|
+
// @ts-ignore error TS2339: Property 'onSelect' does not exist on type 'Readonly<Props>'.
|
|
84
92
|
_this.props.onSelect(event);
|
|
85
93
|
}
|
|
86
94
|
});
|
|
@@ -91,13 +99,16 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
91
99
|
var _proto = ComboboxPopover.prototype;
|
|
92
100
|
|
|
93
101
|
_proto.componentDidUpdate = function componentDidUpdate(lastProps) {
|
|
94
|
-
if (lastProps.disabled !== lastProps.disabled &&
|
|
102
|
+
if (lastProps.disabled !== lastProps.disabled && // @ts-ignore error TS2339: Property 'disabled' does not exist on type 'Readonly<Props>'.
|
|
103
|
+
this.props.disabled === true) {
|
|
95
104
|
this.closePopover();
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
var isComboboxFocused = document.activeElement === this.inputNode;
|
|
99
108
|
|
|
100
|
-
if (isComboboxFocused &&
|
|
109
|
+
if (isComboboxFocused && // @ts-ignore error TS2339: Property 'value' does not exist on type 'Readonly<Props>'.
|
|
110
|
+
lastProps.value !== this.props.value && // @ts-ignore error TS2339: Property 'value' does not exist on type 'Readonly<Props>'.
|
|
111
|
+
this.props.value.length > 0 && !this.state.isPopoverOpen) {
|
|
101
112
|
this.openPopover();
|
|
102
113
|
}
|
|
103
114
|
};
|
|
@@ -151,6 +162,7 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
151
162
|
}, popoverProps, {
|
|
152
163
|
as: Menu,
|
|
153
164
|
ref: function ref(component) {
|
|
165
|
+
// @ts-ignore error TS2339: Property 'popover' does not exist on type 'ComboboxPopover'.
|
|
154
166
|
_this2.popover = component;
|
|
155
167
|
},
|
|
156
168
|
innerRef: function innerRef(node) {
|
|
@@ -164,7 +176,8 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
164
176
|
relativeTo: relativeTo,
|
|
165
177
|
renderTo: renderTo,
|
|
166
178
|
open: isPopoverOpen,
|
|
167
|
-
onBlur: requestBlur
|
|
179
|
+
onBlur: requestBlur // @ts-ignore error TS2322: Type '(anchorProps: any) => Element' is not assignable to type 'ReactElement<...
|
|
180
|
+
,
|
|
168
181
|
anchorElement: function anchorElement(anchorProps) {
|
|
169
182
|
return /*#__PURE__*/React.createElement(ComboboxInput, _extends({
|
|
170
183
|
ref: _this2.setInputRef,
|
|
@@ -217,7 +230,8 @@ var ComboboxPopover = /*#__PURE__*/function (_Component) {
|
|
|
217
230
|
_this2.closePopover();
|
|
218
231
|
} else {
|
|
219
232
|
_this2.openPopover();
|
|
220
|
-
}
|
|
233
|
+
} // @ts-ignore error TS2339: Property 'input' does not exist on type 'ComboboxPopover'.
|
|
234
|
+
|
|
221
235
|
|
|
222
236
|
_this2.input.focus();
|
|
223
237
|
}
|
package/dist/esm/Input/Inline.js
CHANGED
package/dist/esm/Menu/Item.js
CHANGED
|
@@ -31,10 +31,12 @@ function Item(_ref) {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
if (renderLeft) {
|
|
34
|
+
// @ts-ignore error TS2339: Property 'paddingLeft' does not exist on type
|
|
34
35
|
css.paddingLeft = 5;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
if (renderRight) {
|
|
39
|
+
// @ts-ignore error TS2339: Property 'paddingRight' does not exist on type
|
|
38
40
|
css.paddingRight = 5;
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -43,35 +45,55 @@ function Item(_ref) {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
if (disabled) {
|
|
46
|
-
|
|
48
|
+
// @ts-ignore error TS2339: Property 'cursor' does not exist on type ...
|
|
49
|
+
css.cursor = 'not-allowed'; // @ts-ignore error TS2339: Property 'opacity' does not exist on type ...
|
|
50
|
+
|
|
47
51
|
css.opacity = 0.65;
|
|
48
|
-
} else if (
|
|
52
|
+
} else if ( // @ts-ignore error TS2339: Property 'onClick' does not exist on type '{}'.
|
|
53
|
+
props.onClick || // @ts-ignore error TS2339: Property 'onDoubleClick' does not exist on type '{}'.
|
|
54
|
+
props.onDoubleClick || // @ts-ignore error TS2339: Property 'onMouseDown' does not exist on type '{}'.
|
|
55
|
+
props.onMouseDown || // @ts-ignore error TS2339: Property 'onMouseUp' does not exist on type '{}'.
|
|
56
|
+
props.onMouseUp) {
|
|
57
|
+
// @ts-ignore error TS2339: Property 'cursor' does not exist on type ...
|
|
49
58
|
css.cursor = 'pointer';
|
|
50
59
|
}
|
|
51
60
|
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
return (
|
|
62
|
+
/*#__PURE__*/
|
|
63
|
+
// @ts-ignore error TS2322: Type '{ ... }' is not assignable to type ...
|
|
64
|
+
React.createElement(StackView, _extends({}, css, props), renderLeft && /*#__PURE__*/React.createElement(Box, {
|
|
65
|
+
display: "flex",
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
width: 4,
|
|
69
|
+
height: "100%",
|
|
70
|
+
position: "absolute",
|
|
71
|
+
top: 0,
|
|
72
|
+
left: 0.5
|
|
73
|
+
}, typeof renderLeft === 'function' // @ts-ignore error TS2349: This expression is not callable.
|
|
74
|
+
? renderRight() // @ts-ignore error TS2769: No overload matches this call.
|
|
75
|
+
:
|
|
76
|
+
/*#__PURE__*/
|
|
77
|
+
cloneElement(renderLeft, {
|
|
78
|
+
// @ts-ignore error TS2339: Property 'props' does not exist on type ...
|
|
79
|
+
size: renderLeft.props && renderLeft.props.size || 'md'
|
|
80
|
+
})), children, renderRight && /*#__PURE__*/React.createElement(Box, {
|
|
81
|
+
display: "flex",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
justifyContent: "center",
|
|
84
|
+
width: 4,
|
|
85
|
+
height: "100%",
|
|
86
|
+
position: "absolute",
|
|
87
|
+
top: 0,
|
|
88
|
+
right: 0.5
|
|
89
|
+
}, typeof renderRight === 'function' ? renderRight() // @ts-ignore error TS2769: No overload matches this call.
|
|
90
|
+
:
|
|
91
|
+
/*#__PURE__*/
|
|
92
|
+
cloneElement(renderRight, {
|
|
93
|
+
// @ts-ignore error TS2339: Property 'props' does not exist on type ...
|
|
94
|
+
size: renderRight.props && renderRight.props.size || 'md'
|
|
95
|
+
})))
|
|
96
|
+
);
|
|
75
97
|
}
|
|
76
98
|
|
|
77
99
|
Item.displayName = 'Menu.Item';
|
package/dist/esm/Modal/Modal.js
CHANGED
|
@@ -7,9 +7,10 @@ import { useDocumentEvent } from '../hooks';
|
|
|
7
7
|
import { trapFocus } from '../utils';
|
|
8
8
|
import { useThemeProps } from '../system';
|
|
9
9
|
|
|
10
|
-
function Modal(_ref) {
|
|
10
|
+
var Modal = function Modal(_ref) {
|
|
11
11
|
var children = _ref.children,
|
|
12
|
-
|
|
12
|
+
_ref$closeOnOutsideCl = _ref.closeOnOutsideClick,
|
|
13
|
+
closeOnOutsideClick = _ref$closeOnOutsideCl === void 0 ? false : _ref$closeOnOutsideCl,
|
|
13
14
|
onRequestClose = _ref.onRequestClose,
|
|
14
15
|
open = _ref.open,
|
|
15
16
|
restProps = _objectWithoutPropertiesLoose(_ref, ["children", "closeOnOutsideClick", "onRequestClose", "open"]);
|
|
@@ -53,6 +54,6 @@ function Modal(_ref) {
|
|
|
53
54
|
radius: 8,
|
|
54
55
|
width: "100%"
|
|
55
56
|
}, themeProps), children));
|
|
56
|
-
}
|
|
57
|
+
};
|
|
57
58
|
|
|
58
59
|
export default Modal;
|
|
@@ -7,8 +7,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
7
7
|
|
|
8
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
9
|
|
|
10
|
-
import { createElement, Component } from 'react';
|
|
10
|
+
import React, { createElement, Component } from 'react';
|
|
11
11
|
import InputField from '../Input/InputField';
|
|
12
|
+
import StackView from '../StackView';
|
|
13
|
+
import Button from '../Button';
|
|
12
14
|
import { padNumber, getTabbableSiblings } from '../utils';
|
|
13
15
|
var MIN_VALUE = -Infinity;
|
|
14
16
|
var MAX_VALUE = Infinity;
|
|
@@ -45,7 +47,9 @@ var NumberField = /*#__PURE__*/function (_Component) {
|
|
|
45
47
|
_defineProperty(_assertThisInitialized(_this), "getParsedValues", function (value) {
|
|
46
48
|
return {
|
|
47
49
|
value: Number.parseFloat(value),
|
|
50
|
+
// @ts-ignore Argument of type 'number' is not assignable to parameter of type 'string'.ts(2345)
|
|
48
51
|
minValue: Number.parseFloat(_this.props.min),
|
|
52
|
+
// @ts-ignore Argument of type 'number' is not assignable to parameter of type 'string'.ts(2345)
|
|
49
53
|
maxValue: Number.parseFloat(_this.props.max)
|
|
50
54
|
};
|
|
51
55
|
});
|
|
@@ -80,20 +84,44 @@ var NumberField = /*#__PURE__*/function (_Component) {
|
|
|
80
84
|
maxValue = _this$getParsedValues3.maxValue;
|
|
81
85
|
|
|
82
86
|
if (value < minValue) {
|
|
87
|
+
// @ts-ignore Argument of type 'number' is not assignable to parameter of type 'string'.ts(2345)
|
|
83
88
|
_this.props.onChange(minValue);
|
|
84
89
|
} else if (value > maxValue) {
|
|
90
|
+
// @ts-ignore Argument of type 'number' is not assignable to parameter of type 'string'.ts(2345)
|
|
85
91
|
_this.props.onChange(maxValue);
|
|
86
92
|
} else if (isNaN(event.target.value)) {
|
|
93
|
+
// @ts-ignore Argument of type 'number' is not assignable to parameter of type 'string'.ts(2345)
|
|
87
94
|
_this.props.onChange(_this.clampValue(value));
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
if (_this.props.onBlur) {
|
|
98
|
+
// @ts-ignore
|
|
91
99
|
_this.props.onBlur(event);
|
|
92
100
|
}
|
|
93
101
|
|
|
94
102
|
_this.firstTouch = true;
|
|
95
103
|
});
|
|
96
104
|
|
|
105
|
+
_defineProperty(_assertThisInitialized(_this), "stepValue", function (baseValue, step) {
|
|
106
|
+
var nextValue = _this.clampValue(baseValue + step);
|
|
107
|
+
|
|
108
|
+
var parsedValue = Number.parseFloat( // @ts-ignore Expected 1 arguments, but got 2.ts(2554)
|
|
109
|
+
baseValue.toString().indexOf('.') > -1 ? nextValue.toFixed(2) : nextValue);
|
|
110
|
+
|
|
111
|
+
if (_this.isValueValid(parsedValue)) {
|
|
112
|
+
// @ts-ignore Argument of type 'number' is not assignable to parameter of type 'string'.ts(2345)
|
|
113
|
+
_this.props.onChange(parsedValue);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
_defineProperty(_assertThisInitialized(_this), "incrementValue", function () {
|
|
118
|
+
return _this.stepValue(_this.props.value, _this.props.step);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
_defineProperty(_assertThisInitialized(_this), "decrementValue", function () {
|
|
122
|
+
return _this.stepValue(_this.props.value, -_this.props.step);
|
|
123
|
+
});
|
|
124
|
+
|
|
97
125
|
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
|
|
98
126
|
if (_this.props.ignoredKeys.includes(event.key)) {
|
|
99
127
|
return;
|
|
@@ -104,24 +132,16 @@ var NumberField = /*#__PURE__*/function (_Component) {
|
|
|
104
132
|
step = _this$props.step;
|
|
105
133
|
|
|
106
134
|
var _this$getParsedValues4 = _this.getParsedValues(event.target.value),
|
|
107
|
-
value = _this$getParsedValues4.value
|
|
108
|
-
minValue = _this$getParsedValues4.minValue,
|
|
109
|
-
maxValue = _this$getParsedValues4.maxValue;
|
|
135
|
+
value = _this$getParsedValues4.value;
|
|
110
136
|
|
|
111
137
|
if (isNotAcceptedNumberKey(event) || pad && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
112
138
|
event.preventDefault();
|
|
113
139
|
}
|
|
114
140
|
|
|
115
|
-
if (event.key === 'ArrowUp'
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
var parsedValue = Number.parseFloat(event.target.value.indexOf('.') > -1 ? nextValue.toFixed(2) : nextValue);
|
|
121
|
-
|
|
122
|
-
if (_this.isValueValid(parsedValue)) {
|
|
123
|
-
_this.props.onChange(parsedValue);
|
|
124
|
-
}
|
|
141
|
+
if (event.key === 'ArrowUp') {
|
|
142
|
+
_this.incrementValue();
|
|
143
|
+
} else if (event.key === 'ArrowDown') {
|
|
144
|
+
_this.decrementValue();
|
|
125
145
|
}
|
|
126
146
|
|
|
127
147
|
if (_this.props.onKeyDown) {
|
|
@@ -184,39 +204,30 @@ var NumberField = /*#__PURE__*/function (_Component) {
|
|
|
184
204
|
return autoWidth || (pad && isValueEmpty ? getPadStringSize(pad) : isValueEmpty && placeholder !== undefined ? placeholder : value);
|
|
185
205
|
};
|
|
186
206
|
|
|
187
|
-
_proto.
|
|
207
|
+
_proto.renderInput = function renderInput(restProps) {
|
|
188
208
|
var _this$props3 = this.props,
|
|
189
|
-
autoWidth = _this$props3.autoWidth,
|
|
190
209
|
as = _this$props3.as,
|
|
191
210
|
highlightOnInteraction = _this$props3.highlightOnInteraction,
|
|
192
|
-
ignoredKeys = _this$props3.ignoredKeys,
|
|
193
|
-
min = _this$props3.min,
|
|
194
|
-
max = _this$props3.max,
|
|
195
|
-
moveFocusOnMax = _this$props3.moveFocusOnMax,
|
|
196
|
-
onChange = _this$props3.onChange,
|
|
197
|
-
onBlur = _this$props3.onBlur,
|
|
198
|
-
onInput = _this$props3.onInput,
|
|
199
|
-
onKeyDown = _this$props3.onKeyDown,
|
|
200
211
|
pad = _this$props3.pad,
|
|
201
|
-
value = _this$props3.value
|
|
202
|
-
restProps = _objectWithoutPropertiesLoose(_this$props3, ["autoWidth", "as", "highlightOnInteraction", "ignoredKeys", "min", "max", "moveFocusOnMax", "onChange", "onBlur", "onInput", "onKeyDown", "pad", "value"]);
|
|
203
|
-
|
|
212
|
+
value = _this$props3.value;
|
|
204
213
|
var parsed = this.getParsedValues(value);
|
|
205
214
|
var numberValue = value === null ? '' : value;
|
|
206
215
|
|
|
207
216
|
if (pad && numberValue !== '') {
|
|
208
217
|
numberValue = padNumber(numberValue, pad);
|
|
209
|
-
}
|
|
218
|
+
} // @ts-ignore Property 'min' does not exist on type '{ value: number; minValue: number; maxValue: number; }'.ts(2339)
|
|
219
|
+
|
|
210
220
|
|
|
211
221
|
if (parsed.min !== MIN_VALUE) {
|
|
212
|
-
restProps.min = min;
|
|
213
|
-
}
|
|
222
|
+
restProps.min = this.props.min;
|
|
223
|
+
} // @ts-ignore Property 'max' does not exist on type '{ value: number; minValue: number; maxValue: number; }'.ts(2339)
|
|
224
|
+
|
|
214
225
|
|
|
215
226
|
if (parsed.max !== MAX_VALUE) {
|
|
216
|
-
restProps.max = max;
|
|
227
|
+
restProps.max = this.props.max;
|
|
217
228
|
}
|
|
218
229
|
|
|
219
|
-
if (autoWidth !== false) {
|
|
230
|
+
if (this.props.autoWidth !== false) {
|
|
220
231
|
restProps.autoWidth = this.getAutoWidthValue(numberValue);
|
|
221
232
|
|
|
222
233
|
if (restProps.autoWidth === undefined) {
|
|
@@ -235,11 +246,80 @@ var NumberField = /*#__PURE__*/function (_Component) {
|
|
|
235
246
|
}));
|
|
236
247
|
};
|
|
237
248
|
|
|
249
|
+
_proto.renderInputWithControls = function renderInputWithControls(restProps) {
|
|
250
|
+
var _this2 = this;
|
|
251
|
+
|
|
252
|
+
var inputElement = this.renderInput(restProps);
|
|
253
|
+
|
|
254
|
+
if (this.props.hasControls) {
|
|
255
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, inputElement, /*#__PURE__*/React.createElement(StackView, {
|
|
256
|
+
marginRight: -1,
|
|
257
|
+
marginLeft: 1
|
|
258
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
259
|
+
icon: {
|
|
260
|
+
name: 'general.upCaret'
|
|
261
|
+
},
|
|
262
|
+
hover: {
|
|
263
|
+
backgroundColor: 'grey-1'
|
|
264
|
+
},
|
|
265
|
+
minHeight: 1,
|
|
266
|
+
onClick: function onClick() {
|
|
267
|
+
return _this2.incrementValue();
|
|
268
|
+
},
|
|
269
|
+
paddingVertical: 0.25 // @ts-ignore Type 'string' is not assignable to type 'never'.ts(2322)
|
|
270
|
+
,
|
|
271
|
+
size: "xs",
|
|
272
|
+
title: "Increment by 1",
|
|
273
|
+
theme: "naked"
|
|
274
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
275
|
+
icon: {
|
|
276
|
+
name: 'general.downCaret'
|
|
277
|
+
},
|
|
278
|
+
hover: {
|
|
279
|
+
backgroundColor: 'grey-1'
|
|
280
|
+
},
|
|
281
|
+
minHeight: 1,
|
|
282
|
+
onClick: function onClick() {
|
|
283
|
+
return _this2.decrementValue();
|
|
284
|
+
},
|
|
285
|
+
paddingVertical: 0.25 // @ts-ignore Type 'string' is not assignable to type 'never'.ts(2322)
|
|
286
|
+
,
|
|
287
|
+
size: "xs",
|
|
288
|
+
title: "Decrement by 1",
|
|
289
|
+
theme: "naked"
|
|
290
|
+
})));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return inputElement;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
_proto.render = function render() {
|
|
297
|
+
var _this$props4 = this.props,
|
|
298
|
+
autoWidth = _this$props4.autoWidth,
|
|
299
|
+
as = _this$props4.as,
|
|
300
|
+
hasControls = _this$props4.hasControls,
|
|
301
|
+
highlightOnInteraction = _this$props4.highlightOnInteraction,
|
|
302
|
+
ignoredKeys = _this$props4.ignoredKeys,
|
|
303
|
+
min = _this$props4.min,
|
|
304
|
+
max = _this$props4.max,
|
|
305
|
+
moveFocusOnMax = _this$props4.moveFocusOnMax,
|
|
306
|
+
onChange = _this$props4.onChange,
|
|
307
|
+
onBlur = _this$props4.onBlur,
|
|
308
|
+
onInput = _this$props4.onInput,
|
|
309
|
+
onKeyDown = _this$props4.onKeyDown,
|
|
310
|
+
pad = _this$props4.pad,
|
|
311
|
+
value = _this$props4.value,
|
|
312
|
+
restProps = _objectWithoutPropertiesLoose(_this$props4, ["autoWidth", "as", "hasControls", "highlightOnInteraction", "ignoredKeys", "min", "max", "moveFocusOnMax", "onChange", "onBlur", "onInput", "onKeyDown", "pad", "value"]);
|
|
313
|
+
|
|
314
|
+
return this.props.hasControls ? this.renderInputWithControls(restProps) : this.renderInput(restProps);
|
|
315
|
+
};
|
|
316
|
+
|
|
238
317
|
return NumberField;
|
|
239
318
|
}(Component);
|
|
240
319
|
|
|
241
320
|
_defineProperty(NumberField, "defaultProps", {
|
|
242
321
|
as: InputField,
|
|
322
|
+
hasControls: false,
|
|
243
323
|
ignoredKeys: [],
|
|
244
324
|
min: MIN_VALUE,
|
|
245
325
|
max: MAX_VALUE,
|
|
@@ -16,7 +16,13 @@ describe('value', function () {
|
|
|
16
16
|
|
|
17
17
|
return /*#__PURE__*/React.createElement(NumberField, _extends({}, props, {
|
|
18
18
|
"data-testid": "test",
|
|
19
|
-
value: value
|
|
19
|
+
value: value // @ts-ignore No overload matches this call.
|
|
20
|
+
// Overload 1 of 2, '(props: Props | Readonly<Props>): NumberField', gave the following error.
|
|
21
|
+
// Type 'Dispatch<any>' is not assignable to type '(value: string) => null'.
|
|
22
|
+
// Type 'void' is not assignable to type 'null'.
|
|
23
|
+
// Overload 2 of 2, '(props: Props, context: any): NumberField', gave the following error.
|
|
24
|
+
// Type 'Dispatch<any>' is not assignable to type '(value: string) => null'.ts(2769)
|
|
25
|
+
,
|
|
20
26
|
onChange: setValue
|
|
21
27
|
}));
|
|
22
28
|
};
|
|
@@ -87,7 +93,7 @@ describe('value', function () {
|
|
|
87
93
|
});
|
|
88
94
|
});
|
|
89
95
|
describe('pad', function () {
|
|
90
|
-
it(
|
|
96
|
+
it('add appropriate pad', function () {
|
|
91
97
|
var numberField = setup({
|
|
92
98
|
value: 0,
|
|
93
99
|
pad: 2
|
|
@@ -29,7 +29,8 @@ var Portal = /*#__PURE__*/function (_React$Component) {
|
|
|
29
29
|
_defineProperty(_assertThisInitialized(_this), "_updated", false);
|
|
30
30
|
|
|
31
31
|
return _this;
|
|
32
|
-
}
|
|
32
|
+
} // @ts-ignore error TS2612: Property 'context' will overwrite the base property in 'Component<PortalProps, {}, any>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.
|
|
33
|
+
|
|
33
34
|
|
|
34
35
|
var _proto = Portal.prototype;
|
|
35
36
|
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import Box from '../Box';
|
|
5
5
|
import { useThemeProps } from '../system';
|
|
6
6
|
|
|
7
|
-
function Progress(_ref) {
|
|
7
|
+
var Progress = function Progress(_ref) {
|
|
8
8
|
var value = _ref.value,
|
|
9
9
|
restProps = _objectWithoutPropertiesLoose(_ref, ["value"]);
|
|
10
10
|
|
|
@@ -34,6 +34,6 @@ function Progress(_ref) {
|
|
|
34
34
|
transform: "scaleX(" + value / 100 + ")"
|
|
35
35
|
}
|
|
36
36
|
}));
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
|
|
39
39
|
export default Progress;
|
package/dist/esm/Radio/Radio.js
CHANGED
|
@@ -14,9 +14,8 @@ var iconPaths = {
|
|
|
14
14
|
};
|
|
15
15
|
var radioEmitter = mitt();
|
|
16
16
|
|
|
17
|
-
function Radio(_ref) {
|
|
17
|
+
var Radio = function Radio(_ref) {
|
|
18
18
|
var checked = _ref.checked,
|
|
19
|
-
css = _ref.css,
|
|
20
19
|
disabled = _ref.disabled,
|
|
21
20
|
id = _ref.id,
|
|
22
21
|
label = _ref.label,
|
|
@@ -27,7 +26,7 @@ function Radio(_ref) {
|
|
|
27
26
|
_ref$size = _ref.size,
|
|
28
27
|
size = _ref$size === void 0 ? 'xs' : _ref$size,
|
|
29
28
|
value = _ref.value,
|
|
30
|
-
restProps = _objectWithoutPropertiesLoose(_ref, ["checked", "
|
|
29
|
+
restProps = _objectWithoutPropertiesLoose(_ref, ["checked", "disabled", "id", "label", "name", "onBlur", "onChange", "onFocus", "size", "value"]);
|
|
31
30
|
|
|
32
31
|
var radioTheme = useThemeValue('radio');
|
|
33
32
|
var inputRef = useRef();
|
|
@@ -67,22 +66,27 @@ function Radio(_ref) {
|
|
|
67
66
|
}, restProps), /*#__PURE__*/React.createElement(Box, {
|
|
68
67
|
innerRef: inputRef,
|
|
69
68
|
as: "input",
|
|
70
|
-
type: "radio"
|
|
69
|
+
type: "radio" // @ts-ignore Type 'string | number' is not assignable to type 'string'.
|
|
70
|
+
// Type 'number' is not assignable to type 'string'.ts(2322)
|
|
71
|
+
,
|
|
71
72
|
id: id,
|
|
72
73
|
name: name,
|
|
73
74
|
checked: checked,
|
|
74
75
|
value: value,
|
|
75
76
|
disabled: disabled,
|
|
76
77
|
onChange: function onChange(event) {
|
|
77
|
-
radioEmitter.emit(name, event.target);
|
|
78
|
+
radioEmitter.emit(name, event.target); // @ts-ignore Expected 0 arguments, but got 1.ts(2554)
|
|
79
|
+
|
|
78
80
|
_onChange && _onChange(event);
|
|
79
81
|
},
|
|
80
82
|
onFocus: function onFocus(event) {
|
|
81
|
-
setFocus(true);
|
|
83
|
+
setFocus(true); // @ts-ignore Expected 0 arguments, but got 1.ts(2554)
|
|
84
|
+
|
|
82
85
|
_onFocus && _onFocus(event);
|
|
83
86
|
},
|
|
84
87
|
onBlur: function onBlur(event) {
|
|
85
|
-
setFocus(false);
|
|
88
|
+
setFocus(false); // @ts-ignore Expected 0 arguments, but got 1.ts(2554)
|
|
89
|
+
|
|
86
90
|
_onBlur && _onBlur(event);
|
|
87
91
|
},
|
|
88
92
|
position: "absolute",
|
|
@@ -134,6 +138,6 @@ function Radio(_ref) {
|
|
|
134
138
|
lineHeight: 2.5,
|
|
135
139
|
marginLeft: 0.5
|
|
136
140
|
}, label)));
|
|
137
|
-
}
|
|
141
|
+
};
|
|
138
142
|
|
|
139
143
|
export default Radio;
|
|
@@ -2,7 +2,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
3
3
|
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
-
import React, { Component, Children, cloneElement } from 'react';
|
|
5
|
+
import React, { Component, Children, cloneElement } from 'react'; // @ts-ignore Should this be ReactNode anyway?
|
|
6
|
+
|
|
6
7
|
import Badge from '../Badge';
|
|
7
8
|
import HelperDrawer from '../HelperDrawer';
|
|
8
9
|
import StackView from '../StackView';
|
|
@@ -39,7 +39,9 @@ function Tooltip(props, ref) {
|
|
|
39
39
|
triggerOnFocus = _useThemeProps$trigge === void 0 ? true : _useThemeProps$trigge,
|
|
40
40
|
_useThemeProps$trigge2 = _useThemeProps.triggerOnHover,
|
|
41
41
|
triggerOnHover = _useThemeProps$trigge2 === void 0 ? true : _useThemeProps$trigge2,
|
|
42
|
-
|
|
42
|
+
_useThemeProps$zIndex = _useThemeProps.zIndex,
|
|
43
|
+
zIndex = _useThemeProps$zIndex === void 0 ? 9999 : _useThemeProps$zIndex,
|
|
44
|
+
childProps = _objectWithoutPropertiesLoose(_useThemeProps, ["children", "openDelay", "closeDelay", "defaultOpen", "keepInView", "placement", "popoverProps", "renderTo", "title", "triggerOnFocus", "triggerOnHover", "zIndex"]);
|
|
43
45
|
|
|
44
46
|
var isPageInView = useRef(true);
|
|
45
47
|
var isMouseDown = useRef(false);
|
|
@@ -177,7 +179,7 @@ function Tooltip(props, ref) {
|
|
|
177
179
|
radius: 2,
|
|
178
180
|
backgroundColor: "grey-9",
|
|
179
181
|
color: "rgba(255,255,255,0.94)",
|
|
180
|
-
zIndex:
|
|
182
|
+
zIndex: zIndex
|
|
181
183
|
}, popoverProps, {
|
|
182
184
|
anchorElement: /*#__PURE__*/cloneElement(child, childProps),
|
|
183
185
|
onMouseEnter: createOpenTimeout,
|
|
@@ -19,7 +19,7 @@ import WizardContext from './WizardContext';
|
|
|
19
19
|
|
|
20
20
|
var _ref2 = /*#__PURE__*/React.createElement(Divider, null);
|
|
21
21
|
|
|
22
|
-
function Wizard(props) {
|
|
22
|
+
var Wizard = function Wizard(props) {
|
|
23
23
|
var _useThemeProps = useThemeProps('wizard', props),
|
|
24
24
|
_useThemeProps$autoFo = _useThemeProps.autoFocus,
|
|
25
25
|
autoFocus = _useThemeProps$autoFo === void 0 ? true : _useThemeProps$autoFo,
|
|
@@ -74,7 +74,7 @@ function Wizard(props) {
|
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
|
-
}, [
|
|
77
|
+
}, []);
|
|
78
78
|
var isCurrentStepValid = useCallback(function () {
|
|
79
79
|
var currentStep = steps[activeStepIndex];
|
|
80
80
|
return currentStep && currentStep.valid ? currentStep.valid(payload) : true;
|
|
@@ -88,7 +88,7 @@ function Wizard(props) {
|
|
|
88
88
|
setSendingPayload(true);
|
|
89
89
|
onSubmit(payload, _complete);
|
|
90
90
|
}
|
|
91
|
-
}, [payload]);
|
|
91
|
+
}, [onSubmit, payload]);
|
|
92
92
|
return /*#__PURE__*/React.createElement(WizardContext.Provider, {
|
|
93
93
|
value: {
|
|
94
94
|
activeStepIndex: activeStepIndex,
|
|
@@ -165,6 +165,6 @@ function Wizard(props) {
|
|
|
165
165
|
totalSteps: totalSteps
|
|
166
166
|
})
|
|
167
167
|
}, buttonProps, nextButtonProps))))));
|
|
168
|
-
}
|
|
168
|
+
};
|
|
169
169
|
|
|
170
170
|
export default Wizard;
|
package/dist/esm/system/utils.js
CHANGED
|
@@ -126,6 +126,7 @@ export function useThemeValue(path, defaultValue) {
|
|
|
126
126
|
return path ? get(userTheme, path, defaultValue || get(defaultTheme, path)) : userTheme || defaultTheme;
|
|
127
127
|
}
|
|
128
128
|
export function useThemeProps(path, props) {
|
|
129
|
+
// @ts-ignore error TS2554: Expected 2 arguments, but got 1
|
|
129
130
|
return _objectSpread(_objectSpread({}, useThemeValue(path)), props);
|
|
130
131
|
}
|
|
131
132
|
export function useBoxSize(size) {
|
|
@@ -133,6 +134,7 @@ export function useBoxSize(size) {
|
|
|
133
134
|
size = 'md';
|
|
134
135
|
}
|
|
135
136
|
|
|
137
|
+
// @ts-ignore error TS2554: Expected 2 arguments, but got 1
|
|
136
138
|
var boxSizes = useThemeValue('boxSizes');
|
|
137
139
|
var navigateSize = useCallback(function (amount) {
|
|
138
140
|
var index = Object.keys(boxSizes).indexOf(size);
|