@jobber/components 4.23.64-featautoc.2 → 4.23.64

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, "inputRef" | "invalid" | "name" | "onBlur" | "onFocus" | "prefix" | "size" | "suffix" | "validations"> {
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
  */
@@ -40,5 +40,9 @@ interface AutocompleteProps extends Pick<FormFieldProps, "inputRef" | "invalid"
40
40
  */
41
41
  readonly placeholder: string;
42
42
  }
43
- export declare function Autocomplete({ initialOptions, value, allowFreeForm, size, debounce: debounceRate, onChange, getOptions, placeholder, onBlur, onFocus, validations, ...inputProps }: AutocompleteProps): JSX.Element;
43
+ /**
44
+ * Max statements disabled here to make room for the
45
+ * debounce functions.
46
+ */
47
+ export declare function Autocomplete({ initialOptions, value, allowFreeForm, size, invalid, debounce: debounceRate, onChange, getOptions, placeholder, onBlur, onFocus, name, validations, }: AutocompleteProps): JSX.Element;
44
48
  export {};
@@ -145,14 +145,16 @@ function useRepositionMenu(attachTo, visible = false) {
145
145
  return Object.assign(Object.assign({}, popper), { menuRef, setMenuRef, targetWidth });
146
146
  }
147
147
 
148
- // Max statements increased to make room for the debounce functions
149
- /* eslint max-statements: ["error", 14] */
150
- function Autocomplete(_a) {
151
- var _b;
152
- var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, validations } = _a, inputProps = tslib_es6.__rest(_a, ["initialOptions", "value", "allowFreeForm", "size", "debounce", "onChange", "getOptions", "placeholder", "onBlur", "onFocus", "validations"]);
148
+ /**
149
+ * Max statements disabled here to make room for the
150
+ * debounce functions.
151
+ */
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, name, validations, }) {
154
+ var _a;
153
155
  const [options, setOptions] = React.useState(initialOptions);
154
156
  const [menuVisible, setMenuVisible] = React.useState(false);
155
- const [inputText, setInputText] = React.useState((_b = value === null || value === void 0 ? void 0 : value.label) !== null && _b !== void 0 ? _b : "");
157
+ const [inputText, setInputText] = React.useState((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
156
158
  const autocompleteRef = React.useRef(null);
157
159
  const delayedSearch = debounce__default["default"](updateSearch, debounceRate);
158
160
  React.useEffect(() => {
@@ -164,7 +166,7 @@ function Autocomplete(_a) {
164
166
  updateInput((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
165
167
  }, [value]);
166
168
  return (React__default["default"].createElement("div", { className: styles.autocomplete, ref: autocompleteRef },
167
- React__default["default"].createElement(InputText.InputText, Object.assign({ autocomplete: false, size: size, value: inputText, onChange: handleInputChange, placeholder: placeholder, onFocus: handleInputFocus, onBlur: handleInputBlur, validations: validations }, inputProps)),
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 }),
168
170
  menuVisible && (React__default["default"].createElement(Menu, { attachTo: autocompleteRef, visible: menuVisible && options.length > 0, options: options, selectedOption: value, onOptionSelect: handleMenuChange }))));
169
171
  function updateInput(newText) {
170
172
  setInputText(newText);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.23.64-featautoc.2+e25b098b",
3
+ "version": "4.23.64",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "@jobber/design": "^0.44.4",
23
- "@jobber/formatters": "^0.2.2",
23
+ "@jobber/formatters": "*",
24
24
  "@jobber/hooks": "^2.1.5",
25
25
  "@popperjs/core": "^2.0.6",
26
26
  "@std-proposal/temporal": "0.0.1",
@@ -83,5 +83,5 @@
83
83
  "> 1%",
84
84
  "IE 10"
85
85
  ],
86
- "gitHead": "e25b098bea1d7607eceaaf849eb56b9be81428e3"
86
+ "gitHead": "fe459edec09b396c48a92a1878a19d084f27d75a"
87
87
  }