@faststore/ui 1.5.10 → 1.5.14

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/CHANGELOG.md CHANGED
@@ -3,6 +3,50 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.5.14 (2022-02-22)
7
+
8
+
9
+ ### Features
10
+
11
+ * Ajust SearchInput reference export ([#1155](https://github.com/vtex/faststore/issues/1155)) ([22d632d](https://github.com/vtex/faststore/commit/22d632d02657be5bef7595ad4179e5086eef7580))
12
+
13
+
14
+
15
+
16
+
17
+ ## 1.5.13 (2022-02-22)
18
+
19
+
20
+ ### Features
21
+
22
+ * Ajust SearchInput reference ([#1153](https://github.com/vtex/faststore/issues/1153)) ([c2ee199](https://github.com/vtex/faststore/commit/c2ee199402bc4e9d5846dc50778778e940ac7124))
23
+
24
+
25
+
26
+
27
+
28
+ ## 1.5.12 (2022-02-21)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * allCollections query pagination and pagetype timeout errors ([#1140](https://github.com/vtex/faststore/issues/1140)) ([0150222](https://github.com/vtex/faststore/commit/01502220fb903c62f0b33b9a703fb45daafae141))
34
+
35
+
36
+
37
+
38
+
39
+ ## 1.5.11 (2022-02-18)
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * **gatsby-plugin-nginx:** remove trailing slash from incoming requests ([#1145](https://github.com/vtex/faststore/issues/1145)) ([db6f1e1](https://github.com/vtex/faststore/commit/db6f1e173ec43747bf9cfa244b81d86db8a25ce3))
45
+
46
+
47
+
48
+
49
+
6
50
  ## 1.5.10 (2022-02-17)
7
51
 
8
52
 
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ export type { IncentiveProps } from './atoms/Incentive';
37
37
  export { default as Bullets } from './molecules/Bullets';
38
38
  export type { BulletsProps } from './molecules/Bullets';
39
39
  export { default as SearchInput } from './molecules/SearchInput';
40
- export type { SearchInputProps } from './molecules/SearchInput';
40
+ export type { SearchInputProps, SearchInputRef } from './molecules/SearchInput';
41
41
  export { default as Carousel } from './molecules/Carousel';
42
42
  export type { CarouselProps } from './molecules/Carousel';
43
43
  export { default as IconButton } from './molecules/IconButton';
@@ -20,5 +20,9 @@ export interface SearchInputProps extends InputProps {
20
20
  */
21
21
  testId?: string;
22
22
  }
23
- declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLFormElement>>;
23
+ export interface SearchInputRef {
24
+ inputRef?: HTMLInputElement | null;
25
+ formRef?: HTMLFormElement | null;
26
+ }
27
+ declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<SearchInputRef | null>>;
24
28
  export default SearchInput;
@@ -1,2 +1,2 @@
1
1
  export { default } from './SearchInput';
2
- export type { SearchInputProps } from './SearchInput';
2
+ export type { SearchInputProps, SearchInputRef } from './SearchInput';
@@ -401,26 +401,31 @@ const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
401
401
  testId = 'store-search-input',
402
402
  ...otherProps
403
403
  }, ref) {
404
- const valueRef = React.useRef(null);
404
+ const inputRef = React.useRef(null);
405
+ const formRef = React.useRef(null);
405
406
 
406
407
  const handleSubmit = event => {
407
- var _valueRef$current;
408
+ var _inputRef$current;
408
409
 
409
410
  event.preventDefault();
410
411
 
411
- if (((_valueRef$current = valueRef.current) == null ? void 0 : _valueRef$current.value) !== '') {
412
- onSubmit(valueRef.current.value);
412
+ if (((_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.value) !== '') {
413
+ onSubmit(inputRef.current.value);
413
414
  }
414
415
  };
415
416
 
417
+ React.useImperativeHandle(ref, () => ({
418
+ inputRef: inputRef.current,
419
+ formRef: formRef.current
420
+ }));
416
421
  return React__default.createElement(Form, {
417
- ref: ref,
422
+ ref: formRef,
418
423
  "data-store-search-input": true,
419
424
  "data-testid": testId,
420
425
  onSubmit: handleSubmit,
421
426
  role: "search"
422
427
  }, React__default.createElement(Input, Object.assign({
423
- ref: valueRef,
428
+ ref: inputRef,
424
429
  "aria-label": ariaLabel
425
430
  }, otherProps)), React__default.createElement(Button, {
426
431
  type: "submit",