@autoguru/overdrive 4.1.1 → 4.1.5

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
@@ -1,5 +1,29 @@
1
1
  # @autoguru/overdrive
2
2
 
3
+ ## 4.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 6ae288e: AutoSuggest: Type fixes
8
+
9
+ ## 4.1.4
10
+
11
+ ### Patch Changes
12
+
13
+ - Overdrive: Fixed input ref type
14
+
15
+ ## 4.1.3
16
+
17
+ ### Patch Changes
18
+
19
+ - 9884f4c: Autosuggest: Closes results when enter key is pressed
20
+
21
+ ## 4.1.2
22
+
23
+ ### Patch Changes
24
+
25
+ - e825a3d: useResponsiveValue Accepts any generic type
26
+
3
27
  ## 4.1.1
4
28
 
5
29
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"AutoSuggest.d.ts","sourceRoot":"","sources":["../../../lib/components/AutoSuggest/AutoSuggest.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8B,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIvE,OAAO,EACN,wBAAwB,EAIxB,YAAY,EAEZ,GAAG,EAOH,MAAM,OAAO,CAAC;AAWf,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzC,MAAM,WAAW,gBAAgB,CAAC,WAAW;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED,oBAAY,uBAAuB,CAAC,WAAW,IAAI,CAAC,KAAK,EAAE;IAC1D,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;CAClD,KAAK,YAAY,CAAC;AAiCnB,aAAK,WA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AAuB,CAAC,WAAW,IAAI,CAAC,KAAK,EAAE;IAC1D,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;CAClD,KAAK,YAAY,CAAC;AAiCnB,aAAK,WAAW,CAAC,WAAW,IAAI,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;AAErE,MAAM,WAAW,KAAK,CAAC,WAAW,CACjC,SAAQ,IAAI,CACX,wBAAwB,CAAC,OAAO,SAAS,CAAC,EAC1C,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAC5C;IACD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IAC5C,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEtC,YAAY,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAEpD,QAAQ,CAAC,CAAC,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IACtD,OAAO,CAAC,CAAC,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;CACrD;AAwGD,eAAO,MAAM,WAAW;UAoFS,IAAI,gBAAgB,CAAC;MACjD,YAAY,CAAC"}
@@ -2,7 +2,7 @@ import { ChevronDownIcon, CloseIcon } from '@autoguru/icons';
2
2
  import { wrapEvent } from '@autoguru/utilities';
3
3
  import clsx from 'clsx';
4
4
  import * as React from 'react';
5
- import { forwardRef, useCallback, useEffect, useMemo, useReducer, useRef, useState, } from 'react';
5
+ import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useReducer, useRef, useState, } from 'react';
6
6
  import { useMedia } from '../../hooks/useMedia';
7
7
  import { setRef, useId } from '../../utils';
8
8
  import { Box } from '../Box';
@@ -97,6 +97,8 @@ const inputReducerFactory = (suggestions) => (prevState, action) => {
97
97
  }
98
98
  };
99
99
  export const AutoSuggest = forwardRef(function AutoSuggest({ autoFocus = false, autoWidth = false, inlineOptions = false, fieldIcon, suggestions, value, onChange: incomingOnChange, onEnter, itemRenderer = defaultItemRenderer, onBlur: incomingOnBlur, onFocus: incomingOnFocus, onKeyDown, onClick, ...textInputProps }, ref) {
100
+ const inputRef = useRef();
101
+ useImperativeHandle(ref, () => inputRef.current);
100
102
  const [isDesktop] = useMedia(['desktop'], false);
101
103
  const [isFocused, setIsFocused] = useState(false);
102
104
  const [showModal, setShowModal] = useState(false);
@@ -115,7 +117,9 @@ export const AutoSuggest = forwardRef(function AutoSuggest({ autoFocus = false,
115
117
  },
116
118
  onKeyUp: (event) => {
117
119
  if (event.key === 'Enter' && typeof onEnter === 'function') {
118
- onEnter(value);
120
+ setShowModal(false);
121
+ setIsFocused(false);
122
+ inputRef.current?.blur();
119
123
  }
120
124
  },
121
125
  itemRenderer,
@@ -132,7 +136,7 @@ export const AutoSuggest = forwardRef(function AutoSuggest({ autoFocus = false,
132
136
  setShowModal(false);
133
137
  setIsFocused(false);
134
138
  }, [setShowModal]);
135
- return !inlineOptions && !isDesktop && showModal ? (React.createElement(AutoSuggestFullscreenInput, { ...props, isFocused: isFocused, inlineOptions: true, fieldIcon: fieldIcon, autoFocus: autoFocus, closeModal: closeModal })) : (React.createElement(AutoSuggestInput, { ref: ref, ...props, isFocused: isFocused, inlineOptions: inlineOptions, fieldIcon: fieldIcon, autoFocus: autoFocus, autoWidth: autoWidth }));
139
+ return !inlineOptions && !isDesktop && showModal ? (React.createElement(AutoSuggestFullscreenInput, { ...props, isFocused: isFocused, inlineOptions: true, fieldIcon: fieldIcon, autoFocus: autoFocus, closeModal: closeModal })) : (React.createElement(AutoSuggestInput, { ref: inputRef, ...props, isFocused: isFocused, inlineOptions: inlineOptions, fieldIcon: fieldIcon, autoFocus: autoFocus, autoWidth: autoWidth }));
136
140
  });
137
141
  const AutoSuggestFullscreenInput = forwardRef(function AutoSuggestFullscreenInput({ closeModal, ...props }, ref) {
138
142
  const [showPortal, setShowPortal] = useState(false);
@@ -1,3 +1,3 @@
1
1
  import { ResponsiveProp } from '../../utils/responsiveProps.css';
2
- export declare function useResponsiveValue<T extends string | number | boolean>(responsiveValue: ResponsiveProp<T>, fallbackCase?: boolean): T;
2
+ export declare function useResponsiveValue<T extends string | number | boolean | {}>(responsiveValue: ResponsiveProp<T>, fallbackCase?: boolean): T;
3
3
  //# sourceMappingURL=useResponsiveValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResponsiveValue.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useResponsiveValue/useResponsiveValue.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,EACrE,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,EAClC,YAAY,UAAQ,GAClB,CAAC,CAYH"}
1
+ {"version":3,"file":"useResponsiveValue.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useResponsiveValue/useResponsiveValue.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,EAAE,EAC1E,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,EAClC,YAAY,UAAQ,GAClB,CAAC,CAYH"}
@@ -2,6 +2,6 @@ import { breakpoints } from '../themes/makeTheme';
2
2
  export declare type ResponsiveProp<T> = T | T[];
3
3
  declare type BreakpointStyleMap = Record<keyof typeof breakpoints, any>;
4
4
  export declare const resolveResponsiveStyle: <Tokens extends string | number>(responsiveArgument: ResponsiveProp<Tokens>, breakpointTokenMap: Record<Tokens, BreakpointStyleMap>) => any;
5
- export declare function getEarliestKnownToken<Tokens extends string | number | boolean>(responsiveArgument: Tokens[], counter: number): Tokens;
5
+ export declare function getEarliestKnownToken<Tokens extends string | number | boolean | {}>(responsiveArgument: Tokens[], counter: number): Tokens;
6
6
  export {};
7
7
  //# sourceMappingURL=resolveResponsiveProps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveResponsiveProps.d.ts","sourceRoot":"","sources":["../../lib/utils/resolveResponsiveProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,oBAAY,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAExC,aAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,OAAO,WAAW,EAAE,GAAG,CAAC,CAAC;AAShE,eAAO,MAAM,sBAAsB,6IAalC,CAAC;AAwBF,wBAAgB,qBAAqB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,EAC7E,kBAAkB,EAAE,MAAM,EAAE,EAC5B,OAAO,EAAE,MAAM,GACb,MAAM,CAaR"}
1
+ {"version":3,"file":"resolveResponsiveProps.d.ts","sourceRoot":"","sources":["../../lib/utils/resolveResponsiveProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,oBAAY,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAExC,aAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,OAAO,WAAW,EAAE,GAAG,CAAC,CAAC;AAShE,eAAO,MAAM,sBAAsB,6IAalC,CAAC;AAwBF,wBAAgB,qBAAqB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,EAAE,EAClF,kBAAkB,EAAE,MAAM,EAAE,EAC5B,OAAO,EAAE,MAAM,GACb,MAAM,CAaR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.1.1",
3
+ "version": "4.1.5",
4
4
  "description": "Overdrive is a product component library, and design system for AutoGuru.",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",