@jobber/components 4.90.1-JOB-89349.4 → 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.
@@ -32,10 +32,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
32
32
  function InputDate(inputProps) {
33
33
  const formFieldActionsRef = React.useRef(null);
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
- var _a;
36
35
  const { onChange, onClick, value } = activatorProps;
37
36
  const newActivatorProps = omit__default["default"](activatorProps, ["activator"]);
38
- const [showEmptyPlaceholder, setShowEmptyPlaceholder] = React.useState(!value);
37
+ const [isFocused, setIsFocused] = React.useState(false);
39
38
  const suffix = inputProps.showIcon !== false
40
39
  ? {
41
40
  icon: "calendar",
@@ -45,20 +44,24 @@ function InputDate(inputProps) {
45
44
  : undefined;
46
45
  // Set form field to formatted date string immediately, to avoid validations
47
46
  // triggering incorrectly when it blurs (to handle the datepicker UI click)
48
- value && ((_a = formFieldActionsRef.current) === null || _a === void 0 ? void 0 : _a.setValue(value));
47
+ React.useEffect(() => {
48
+ var _a;
49
+ value && ((_a = formFieldActionsRef.current) === null || _a === void 0 ? void 0 : _a.setValue(value));
50
+ }, [value]);
51
+ const showEmptyValueLabel = !value && !isFocused;
49
52
  return (
50
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
51
54
  React__default["default"].createElement("div", { onClick: onClick },
52
- React__default["default"].createElement(FormField.FormField, Object.assign({}, newActivatorProps, inputProps, { value: showEmptyPlaceholder ? inputProps.emptyValueLabel : value, placeholder: inputProps.placeholder, onChange: (_, event) => {
55
+ React__default["default"].createElement(FormField.FormField, Object.assign({}, newActivatorProps, inputProps, { value: showEmptyValueLabel ? inputProps.emptyValueLabel || "" : value, placeholder: inputProps.placeholder, onChange: (_, event) => {
53
56
  onChange && onChange(event);
54
- setShowEmptyPlaceholder(false);
55
57
  }, onBlur: () => {
56
58
  inputProps.onBlur && inputProps.onBlur();
57
59
  activatorProps.onBlur && activatorProps.onBlur();
58
- setShowEmptyPlaceholder(!value);
60
+ setIsFocused(false);
59
61
  }, onFocus: () => {
60
62
  inputProps.onFocus && inputProps.onFocus();
61
63
  activatorProps.onFocus && activatorProps.onFocus();
64
+ setIsFocused(true);
62
65
  }, onKeyUp: event => {
63
66
  var _a;
64
67
  if (inputProps.showIcon === false &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.90.1-JOB-89349.4+a278aa27",
3
+ "version": "4.90.2",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,8 +19,8 @@
19
19
  "dist/*"
20
20
  ],
21
21
  "dependencies": {
22
- "@jobber/design": "^0.56.1-JOB-89349.50+a278aa27",
23
- "@jobber/formatters": "^0.2.2",
22
+ "@jobber/design": "^0.56.0",
23
+ "@jobber/formatters": "*",
24
24
  "@jobber/hooks": "^2.9.4",
25
25
  "@popperjs/core": "^2.0.6",
26
26
  "@std-proposal/temporal": "0.0.1",
@@ -82,5 +82,5 @@
82
82
  "> 1%",
83
83
  "IE 10"
84
84
  ],
85
- "gitHead": "a278aa27395eaf829657420110d8e3f517c45443"
85
+ "gitHead": "0464e85be4140ab4e513e0f64ccdacfaf2891dce"
86
86
  }