@jobber/components 6.44.0 → 6.45.0

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.
@@ -6,7 +6,7 @@ export interface FormFieldWrapperProps extends FormFieldProps {
6
6
  readonly identifier: string;
7
7
  readonly descriptionIdentifier: string;
8
8
  readonly clearable: Clearable;
9
- readonly onClear: () => void;
9
+ readonly onClear?: () => void;
10
10
  readonly showMiniLabel?: boolean;
11
11
  readonly readonly?: boolean;
12
12
  }
@@ -3,7 +3,7 @@ interface ClearActionProps {
3
3
  /**
4
4
  * Click handler
5
5
  */
6
- readonly onClick: () => void;
6
+ readonly onClick?: () => void;
7
7
  readonly visible?: boolean;
8
8
  }
9
9
  export declare function ClearAction({ onClick, visible, }: ClearActionProps): React.ReactElement | null;
@@ -11,6 +11,5 @@ export declare function useSelectActions({ onChange, onBlur, onFocus, }: UseSele
11
11
  handleChange: (event: ChangeEvent<HTMLSelectElement>) => void;
12
12
  handleBlur: () => void;
13
13
  handleFocus: () => void;
14
- handleClear: () => void;
15
14
  };
16
15
  export {};
@@ -47,15 +47,10 @@ function useSelectActions({ onChange, onBlur, onFocus, }) {
47
47
  function handleFocus() {
48
48
  onFocus === null || onFocus === void 0 ? void 0 : onFocus();
49
49
  }
50
- // Noop for SelectRebuilt since onClear is a required prop for FormFieldWrapper
51
- // but Select is not clearable.
52
- // eslint-disable-next-line @typescript-eslint/no-empty-function
53
- function handleClear() { }
54
50
  return {
55
51
  handleChange,
56
52
  handleBlur,
57
53
  handleFocus,
58
- handleClear,
59
54
  };
60
55
  }
61
56
 
@@ -82,7 +77,7 @@ function SelectRebuilt(props) {
82
77
  nameProp: props.name,
83
78
  id: id,
84
79
  });
85
- const { handleChange, handleBlur, handleFocus, handleClear } = useSelectActions({
80
+ const { handleChange, handleBlur, handleFocus } = useSelectActions({
86
81
  onChange: props.onChange,
87
82
  onBlur: props.onBlur,
88
83
  onFocus: props.onFocus,
@@ -100,7 +95,7 @@ function SelectRebuilt(props) {
100
95
  handleChange,
101
96
  handleBlur,
102
97
  handleFocus }));
103
- return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, onClear: handleClear, clearable: "never", maxLength: props.maxLength },
98
+ return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never", maxLength: props.maxLength },
104
99
  React.createElement(React.Fragment, null,
105
100
  React.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: inputStyle }), props.children),
106
101
  React.createElement(FormField.FormFieldPostFix, { variation: "select" }))));
@@ -45,15 +45,10 @@ function useSelectActions({ onChange, onBlur, onFocus, }) {
45
45
  function handleFocus() {
46
46
  onFocus === null || onFocus === void 0 ? void 0 : onFocus();
47
47
  }
48
- // Noop for SelectRebuilt since onClear is a required prop for FormFieldWrapper
49
- // but Select is not clearable.
50
- // eslint-disable-next-line @typescript-eslint/no-empty-function
51
- function handleClear() { }
52
48
  return {
53
49
  handleChange,
54
50
  handleBlur,
55
51
  handleFocus,
56
- handleClear,
57
52
  };
58
53
  }
59
54
 
@@ -80,7 +75,7 @@ function SelectRebuilt(props) {
80
75
  nameProp: props.name,
81
76
  id: id,
82
77
  });
83
- const { handleChange, handleBlur, handleFocus, handleClear } = useSelectActions({
78
+ const { handleChange, handleBlur, handleFocus } = useSelectActions({
84
79
  onChange: props.onChange,
85
80
  onBlur: props.onBlur,
86
81
  onFocus: props.onFocus,
@@ -98,7 +93,7 @@ function SelectRebuilt(props) {
98
93
  handleChange,
99
94
  handleBlur,
100
95
  handleFocus }));
101
- return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, onClear: handleClear, clearable: "never", maxLength: props.maxLength },
96
+ return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never", maxLength: props.maxLength },
102
97
  React__default.createElement(React__default.Fragment, null,
103
98
  React__default.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: inputStyle }), props.children),
104
99
  React__default.createElement(FormFieldPostFix, { variation: "select" }))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.44.0",
3
+ "version": "6.45.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -534,5 +534,5 @@
534
534
  "> 1%",
535
535
  "IE 10"
536
536
  ],
537
- "gitHead": "fe9b52f934d568d14a7e97defddeaf31e8825810"
537
+ "gitHead": "394f1184b5781f5836c3b005363cb5bac40e2884"
538
538
  }