@graphcommerce/magento-search 9.0.0-canary.73 → 9.0.0-canary.75
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
@@ -26,8 +26,17 @@ export function useProductFiltersProSearchInput<
|
|
26
26
|
|
27
27
|
const internalRef = useRef<HTMLInputElement>(null)
|
28
28
|
const ref = useForkRef(inputRef, internalRef)
|
29
|
+
const initial = useRef(true)
|
29
30
|
|
30
31
|
useEffect(() => {
|
32
|
+
// When page initially loads, fill in the search field with the search param.
|
33
|
+
if (internalRef.current && initial.current && searchParam) {
|
34
|
+
initial.current = false
|
35
|
+
internalRef.current.selectionStart = searchParam.length
|
36
|
+
internalRef.current.selectionEnd = searchParam.length
|
37
|
+
return
|
38
|
+
}
|
39
|
+
|
31
40
|
// When the user is not focussed on the search field and the value gets updated, update the form.
|
32
41
|
if (internalRef.current && internalRef.current !== document.activeElement && searchParam)
|
33
42
|
internalRef.current.value = searchParam
|
@@ -39,6 +48,7 @@ export function useProductFiltersProSearchInput<
|
|
39
48
|
placeholder: t`Search all products...`,
|
40
49
|
name: 'search',
|
41
50
|
type: 'text',
|
51
|
+
defaultValue: searchParam,
|
42
52
|
onKeyDown: (e) => {
|
43
53
|
if (e.key === 'Enter') {
|
44
54
|
const context = globalFormContextRef.current
|
@@ -49,7 +59,7 @@ export function useProductFiltersProSearchInput<
|
|
49
59
|
context.form.setValue('search', e.currentTarget.value)
|
50
60
|
return context.submit()
|
51
61
|
}
|
52
|
-
props?.onKeyDown?.(e)
|
62
|
+
return props?.onKeyDown?.(e)
|
53
63
|
},
|
54
64
|
onChange: async (e) => {
|
55
65
|
const context = globalFormContextRef.current
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@graphcommerce/magento-search",
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
5
|
-
"version": "9.0.0-canary.
|
5
|
+
"version": "9.0.0-canary.75",
|
6
6
|
"sideEffects": false,
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
8
8
|
"eslintConfig": {
|
@@ -12,16 +12,16 @@
|
|
12
12
|
}
|
13
13
|
},
|
14
14
|
"peerDependencies": {
|
15
|
-
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
17
|
-
"@graphcommerce/graphql": "^9.0.0-canary.
|
18
|
-
"@graphcommerce/image": "^9.0.0-canary.
|
19
|
-
"@graphcommerce/magento-product": "^9.0.0-canary.
|
20
|
-
"@graphcommerce/magento-store": "^9.0.0-canary.
|
21
|
-
"@graphcommerce/next-ui": "^9.0.0-canary.
|
22
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
23
|
-
"@graphcommerce/react-hook-form": "^9.0.0-canary.
|
24
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.75",
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.75",
|
17
|
+
"@graphcommerce/graphql": "^9.0.0-canary.75",
|
18
|
+
"@graphcommerce/image": "^9.0.0-canary.75",
|
19
|
+
"@graphcommerce/magento-product": "^9.0.0-canary.75",
|
20
|
+
"@graphcommerce/magento-store": "^9.0.0-canary.75",
|
21
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.75",
|
22
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.75",
|
23
|
+
"@graphcommerce/react-hook-form": "^9.0.0-canary.75",
|
24
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.75",
|
25
25
|
"@lingui/core": "^4.2.1",
|
26
26
|
"@lingui/macro": "^4.2.1",
|
27
27
|
"@lingui/react": "^4.2.1",
|