@jobber/components 4.13.1 → 4.14.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.
|
@@ -3,7 +3,7 @@ import { XOR } from "ts-xor";
|
|
|
3
3
|
import { GroupOption, Option } from "./Option";
|
|
4
4
|
import { FormFieldProps } from "../FormField";
|
|
5
5
|
type OptionCollection = XOR<Option[], GroupOption[]>;
|
|
6
|
-
interface AutocompleteProps extends Pick<FormFieldProps, "size" | "onBlur" | "onFocus" | "invalid"> {
|
|
6
|
+
interface AutocompleteProps extends Pick<FormFieldProps, "size" | "onBlur" | "onFocus" | "invalid" | "name" | "validations"> {
|
|
7
7
|
/**
|
|
8
8
|
* Initial options to show when user first focuses the Autocomplete
|
|
9
9
|
*/
|
|
@@ -44,5 +44,5 @@ interface AutocompleteProps extends Pick<FormFieldProps, "size" | "onBlur" | "on
|
|
|
44
44
|
* Max statements disabled here to make room for the
|
|
45
45
|
* debounce functions.
|
|
46
46
|
*/
|
|
47
|
-
export declare function Autocomplete({ initialOptions, value, allowFreeForm, size, invalid, debounce: debounceRate, onChange, getOptions, placeholder, onBlur, onFocus, }: AutocompleteProps): JSX.Element;
|
|
47
|
+
export declare function Autocomplete({ initialOptions, value, allowFreeForm, size, invalid, debounce: debounceRate, onChange, getOptions, placeholder, onBlur, onFocus, name, validations, }: AutocompleteProps): JSX.Element;
|
|
48
48
|
export {};
|
|
@@ -150,7 +150,7 @@ function useRepositionMenu(attachTo, visible = false) {
|
|
|
150
150
|
* debounce functions.
|
|
151
151
|
*/
|
|
152
152
|
// eslint-disable-next-line max-statements
|
|
153
|
-
function Autocomplete({ initialOptions = [], value, allowFreeForm = true, size = undefined, invalid, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, }) {
|
|
153
|
+
function Autocomplete({ initialOptions = [], value, allowFreeForm = true, size = undefined, invalid, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, name, validations, }) {
|
|
154
154
|
var _a;
|
|
155
155
|
const [options, setOptions] = React.useState(initialOptions);
|
|
156
156
|
const [menuVisible, setMenuVisible] = React.useState(false);
|
|
@@ -166,7 +166,7 @@ function Autocomplete({ initialOptions = [], value, allowFreeForm = true, size =
|
|
|
166
166
|
updateInput((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
|
|
167
167
|
}, [value]);
|
|
168
168
|
return (React__default["default"].createElement("div", { className: styles.autocomplete, ref: autocompleteRef },
|
|
169
|
-
React__default["default"].createElement(InputText.InputText, { autocomplete: false, size: size, invalid: invalid, value: inputText, onChange: handleInputChange, placeholder: placeholder, onFocus: handleInputFocus, onBlur: handleInputBlur }),
|
|
169
|
+
React__default["default"].createElement(InputText.InputText, { autocomplete: false, size: size, invalid: invalid, value: inputText, onChange: handleInputChange, placeholder: placeholder, onFocus: handleInputFocus, onBlur: handleInputBlur, name: name, validations: validations }),
|
|
170
170
|
menuVisible && (React__default["default"].createElement(Menu, { attachTo: autocompleteRef, visible: menuVisible && options.length > 0, options: options, selectedOption: value, onOptionSelect: handleMenuChange }))));
|
|
171
171
|
function updateInput(newText) {
|
|
172
172
|
setInputText(newText);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"> 1%",
|
|
84
84
|
"IE 10"
|
|
85
85
|
],
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "829d4fcd134dc6a9d3b2a0cd0890d0599ded1d08"
|
|
87
87
|
}
|