@jobber/components 4.90.1 → 4.90.2
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/InputDate/index.js +5 -4
- package/package.json +2 -2
package/dist/InputDate/index.js
CHANGED
|
@@ -34,7 +34,7 @@ function InputDate(inputProps) {
|
|
|
34
34
|
return (React__default["default"].createElement(DatePicker.DatePicker, { selected: inputProps.value, onChange: inputProps.onChange, disabled: inputProps.disabled, readonly: inputProps.readonly, fullWidth: !inputProps.inline, minDate: inputProps.minDate, maxDate: inputProps.maxDate, smartAutofocus: false, activator: activatorProps => {
|
|
35
35
|
const { onChange, onClick, value } = activatorProps;
|
|
36
36
|
const newActivatorProps = omit__default["default"](activatorProps, ["activator"]);
|
|
37
|
-
const [
|
|
37
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
38
38
|
const suffix = inputProps.showIcon !== false
|
|
39
39
|
? {
|
|
40
40
|
icon: "calendar",
|
|
@@ -48,19 +48,20 @@ function InputDate(inputProps) {
|
|
|
48
48
|
var _a;
|
|
49
49
|
value && ((_a = formFieldActionsRef.current) === null || _a === void 0 ? void 0 : _a.setValue(value));
|
|
50
50
|
}, [value]);
|
|
51
|
+
const showEmptyValueLabel = !value && !isFocused;
|
|
51
52
|
return (
|
|
52
53
|
// We prevent the picker from opening on focus for keyboard navigation, so to maintain a good UX for mouse users we want to open the picker on click
|
|
53
54
|
React__default["default"].createElement("div", { onClick: onClick },
|
|
54
|
-
React__default["default"].createElement(FormField.FormField, Object.assign({}, newActivatorProps, inputProps, { value:
|
|
55
|
+
React__default["default"].createElement(FormField.FormField, Object.assign({}, newActivatorProps, inputProps, { value: showEmptyValueLabel ? inputProps.emptyValueLabel || "" : value, placeholder: inputProps.placeholder, onChange: (_, event) => {
|
|
55
56
|
onChange && onChange(event);
|
|
56
|
-
setShowEmptyPlaceholder(false);
|
|
57
57
|
}, onBlur: () => {
|
|
58
58
|
inputProps.onBlur && inputProps.onBlur();
|
|
59
59
|
activatorProps.onBlur && activatorProps.onBlur();
|
|
60
|
-
|
|
60
|
+
setIsFocused(false);
|
|
61
61
|
}, onFocus: () => {
|
|
62
62
|
inputProps.onFocus && inputProps.onFocus();
|
|
63
63
|
activatorProps.onFocus && activatorProps.onFocus();
|
|
64
|
+
setIsFocused(true);
|
|
64
65
|
}, onKeyUp: event => {
|
|
65
66
|
var _a;
|
|
66
67
|
if (inputProps.showIcon === false &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.90.
|
|
3
|
+
"version": "4.90.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"> 1%",
|
|
83
83
|
"IE 10"
|
|
84
84
|
],
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "0464e85be4140ab4e513e0f64ccdacfaf2891dce"
|
|
86
86
|
}
|