@constructor-io/constructorio-ui-autocomplete 1.28.2 → 1.29.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.
- package/README.md +44 -69
- package/dist/constructorio-ui-autocomplete-bundled.js +11 -11
- package/lib/cjs/components/Autocomplete/SearchInput/SearchInput.js +3 -2
- package/lib/cjs/components/Autocomplete/SectionItemsList/SectionItemsList.js +2 -1
- package/lib/cjs/hooks/useCioAutocomplete.js +18 -13
- package/lib/cjs/hooks/useFetchRecommendationPod.js +4 -1
- package/lib/cjs/hooks/useSections/index.js +1 -0
- package/lib/cjs/utils/dataAttributeHelpers.js +141 -0
- package/lib/cjs/version.js +1 -1
- package/lib/mjs/components/Autocomplete/SearchInput/SearchInput.js +2 -1
- package/lib/mjs/components/Autocomplete/SectionItemsList/SectionItemsList.js +2 -1
- package/lib/mjs/hooks/useCioAutocomplete.js +16 -16
- package/lib/mjs/hooks/useFetchRecommendationPod.js +3 -1
- package/lib/mjs/hooks/useSections/index.js +1 -0
- package/lib/mjs/utils/dataAttributeHelpers.js +133 -0
- package/lib/mjs/version.js +1 -1
- package/lib/types/components/Autocomplete/CioAutocompleteProvider.d.ts +3 -1
- package/lib/types/hooks/useCioAutocomplete.d.ts +3 -1
- package/lib/types/hooks/useSections/index.d.ts +2 -1
- package/lib/types/types.d.ts +2 -0
- package/lib/types/utils/dataAttributeHelpers.d.ts +75 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,67 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<h1>Autocomplete UI</h1>
|
|
5
|
-
|
|
6
|
-
<p align="center" style="font-size: 1.2rem;">Lightweight, minimalistic, and fully customizable autocomplete component for fast, accessible, and flexible search experiences with <a href='https://constructor.com/solutions/search'>Constructor.io's autosuggest services</a>. 🚀</p>
|
|
7
|
-
|
|
8
|
-
[**Read The Docs**](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component--docs)
|
|
9
|
-
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
<hr />
|
|
13
|
-
<div align="center">
|
|
1
|
+
# Autocomplete UI
|
|
2
|
+
Lightweight, minimalistic, and fully customizable autocomplete component for fast, accessible, and flexible search experiences with [Constructor.io's autosuggest services](https://constructor.com/solutions/search)
|
|
14
3
|
|
|
15
4
|

|
|
16
5
|
[](https://www.npmjs.com/package/@constructor-io/constructorio-ui-autocomplete)
|
|
17
6
|
[](https://github.com/Constructor-io/constructorio-ui-autocomplete/blob/main/LICENSE)
|
|
18
7
|
|
|
19
|
-
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## Documentation
|
|
11
|
+
|
|
12
|
+
View the full component documentation and live examples in [Storybook](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component--docs)
|
|
20
13
|
|
|
21
|
-
</div>
|
|
22
14
|
|
|
23
15
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
24
16
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
25
17
|
## 📌 Table of Contents
|
|
26
18
|
|
|
27
|
-
- [
|
|
28
|
-
- [
|
|
29
|
-
- [
|
|
30
|
-
- [
|
|
31
|
-
- [
|
|
32
|
-
|
|
19
|
+
- [Overview](#overview)
|
|
20
|
+
- [Installation & Quick Start](#installation--quick-start)
|
|
21
|
+
- [Basic Usage (React)](#basic-usage-react)
|
|
22
|
+
- [Integration Modes](#integration-modes)
|
|
23
|
+
- [Shopify](#shopify)
|
|
24
|
+
- [Installation & Quick Start](#installation--quick-start-1)
|
|
25
|
+
- [🛍️ Shopify-Specific Defaults](#-shopify-specific-defaults)
|
|
33
26
|
- [Bundle (Vanilla JS)](#bundle-vanilla-js)
|
|
34
|
-
|
|
35
|
-
- [
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
38
|
-
- [
|
|
39
|
-
- [
|
|
40
|
-
- [🔗 Complementary Resources](#-complementary-resources)
|
|
41
|
-
- [🤝 Contributing](#-contributing)
|
|
42
|
-
- [📜 License](#-license)
|
|
27
|
+
- [Installation & Quick Start](#installation--quick-start-2)
|
|
28
|
+
- [Customization](#customization)
|
|
29
|
+
- [Troubleshooting](#troubleshooting)
|
|
30
|
+
- [Complementary Resources](#complementary-resources)
|
|
31
|
+
- [Contributing](#contributing)
|
|
32
|
+
- [License](#license)
|
|
43
33
|
|
|
44
34
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
|
|
37
|
+
## Overview
|
|
38
|
+
|
|
39
|
+
Autocomplete UI provides a lightweight and customizable autocomplete component. It enables developers to quickly implement fast, accessible search experiences with Constructor.io's autosuggest services.
|
|
47
40
|
|
|
48
41
|
- 🔌 Easy Integration – Quickly integrate with your app as a plug-and-play React component
|
|
49
42
|
- ⚡ Lightweight & Fast – Tiny bundle size, optimized for speed
|
|
50
|
-
- 🎨 Customizable UI – With
|
|
51
|
-
- ⌨️ Keyboard Navigation – Fully supports accessible keyboard
|
|
43
|
+
- 🎨 Customizable UI – With minimal styles, and supports for custom markup
|
|
44
|
+
- ⌨️ Keyboard Navigation – Fully supports accessible keyboard navigation
|
|
52
45
|
- ♿ Accessible (a11y) – Built-in ARIA support for screen readers
|
|
53
46
|
- 🛡 Written in TypeScript with type safety
|
|
54
47
|
|
|
48
|
+
**[Explore full documentation →](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component--docs)**
|
|
55
49
|
|
|
56
|
-
##
|
|
50
|
+
## Installation & Quick Start
|
|
57
51
|
|
|
58
|
-
### ⚡ Installation & Quick Start
|
|
59
52
|
Install the library
|
|
60
53
|
|
|
61
54
|
```sh
|
|
62
55
|
npm i @constructor-io/constructorio-ui-autocomplete
|
|
63
56
|
```
|
|
64
57
|
|
|
58
|
+
### Basic Usage (React)
|
|
65
59
|
Import and use the `CioAutocomplete` component
|
|
66
60
|
|
|
67
61
|
```tsx
|
|
@@ -74,13 +68,17 @@ function YourComponent() {
|
|
|
74
68
|
<CioAutocomplete
|
|
75
69
|
apiKey="key_M57QS8SMPdLdLx4x"
|
|
76
70
|
onSubmit={(e) => {console.log(e)}}
|
|
71
|
+
/>
|
|
77
72
|
</div>
|
|
78
73
|
);
|
|
74
|
+
}
|
|
79
75
|
```
|
|
80
76
|
|
|
81
|
-
##
|
|
77
|
+
## Integration Modes
|
|
82
78
|
|
|
83
|
-
###
|
|
79
|
+
### Shopify
|
|
80
|
+
|
|
81
|
+
#### Installation & Quick Start
|
|
84
82
|
|
|
85
83
|
The Constructor autocomplete component is available as part of the [Constructor.io Shopify App](https://apps.shopify.com/constructor-connect)
|
|
86
84
|
|
|
@@ -90,9 +88,9 @@ After installing the app, you can use the Constructor autocomplete component by
|
|
|
90
88
|
|
|
91
89
|
For more in depth instructions, check out the [Shopify documentation](https://docs.constructor.com/docs/integrating-with-constructor-platform-connectors-frontend-connectors-shopify-ui).
|
|
92
90
|
|
|
93
|
-
|
|
91
|
+
#### 🛍️ Shopify-Specific Defaults
|
|
94
92
|
|
|
95
|
-
|
|
93
|
+
If you are using the Constructor autocomplete component inside Shopify without using the [Constructor.io Shopify App](https://apps.shopify.com/constructor-connect), you can use the `useShopifyDefaults` prop to enable automatic navigation handling:
|
|
96
94
|
|
|
97
95
|
```tsx
|
|
98
96
|
<CioAutocomplete
|
|
@@ -116,7 +114,7 @@ When integrating with Shopify themes, you can use the `useShopifyDefaults` prop
|
|
|
116
114
|
## Bundle (Vanilla JS)
|
|
117
115
|
This is a framework agnostic method that can be used in any JavaScript project. The CioAutocomplete function provides a simple interface to inject an entire Autocomplete UI into the provided selector. In addition to Autocomplete component props, this function also accepts a selector and includeCSS.
|
|
118
116
|
|
|
119
|
-
|
|
117
|
+
#### Installation & Quick Start
|
|
120
118
|
|
|
121
119
|
Install the library
|
|
122
120
|
|
|
@@ -138,17 +136,7 @@ CioAutocomplete({
|
|
|
138
136
|
</script>
|
|
139
137
|
```
|
|
140
138
|
|
|
141
|
-
##
|
|
142
|
-
|
|
143
|
-
Ready-to-use, copy-paste examples with explanations.
|
|
144
|
-
|
|
145
|
-
- [Full Featured example](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component--docs#full-featured-and-styled-example)
|
|
146
|
-
- [Render Search Suggestions](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component-sections--docs#render-search-suggestions)
|
|
147
|
-
- [Render Product Suggestions](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component-sections--docs#render-suggested-products)
|
|
148
|
-
|
|
149
|
-
🔹 For more examples check the [full examples](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component--docs)
|
|
150
|
-
|
|
151
|
-
## 🎨 Customization
|
|
139
|
+
## Customization
|
|
152
140
|
|
|
153
141
|
CSS styles are not imported by default. Add this to your code to import basic styles
|
|
154
142
|
|
|
@@ -193,15 +181,7 @@ Then you can modify styles like so
|
|
|
193
181
|
}
|
|
194
182
|
```
|
|
195
183
|
|
|
196
|
-
##
|
|
197
|
-
|
|
198
|
-
- [Terms With Group Suggestions](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component-advanced-parameters--docs#terms-with-group-suggestions)
|
|
199
|
-
- [Filtered Suggestions](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component-advanced-parameters--docs#filtered-suggestions)
|
|
200
|
-
- [Terms With Images And Counts](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component-advanced-parameters--docs#terms-with-images-and-counts)
|
|
201
|
-
|
|
202
|
-
🔹 For more advanced use cases check the [full documentation](https://constructor-io.github.io/constructorio-ui-autocomplete/?path=/docs/autocomplete-component-advanced-parameters--docs)
|
|
203
|
-
|
|
204
|
-
## 🛠 Troubleshooting
|
|
184
|
+
## Troubleshooting
|
|
205
185
|
|
|
206
186
|
Common issues and solutions.
|
|
207
187
|
|
|
@@ -273,27 +253,22 @@ Common issues and solutions.
|
|
|
273
253
|
|
|
274
254
|
💬 Need help? Join our [GitHub Discussions](https://github.com/Constructor-io/constructorio-ui-autocomplete/discussions)
|
|
275
255
|
|
|
276
|
-
##
|
|
277
|
-
|
|
278
|
-
<!-- TODO: reference the API docs from storybook -->
|
|
279
|
-
- Full API docs: Click here
|
|
280
|
-
|
|
281
|
-
## 🔗 Complementary Resources
|
|
256
|
+
## Complementary Resources
|
|
282
257
|
|
|
283
258
|
- 📖 Full Documentation: [Storybook](https://constructor-io.github.io/constructorio-ui-autocomplete/)
|
|
284
259
|
- 📦 JS Client: [SDK Documentation](https://constructor-io.github.io/constructorio-client-javascript/module-autocomplete.html#~getAutocompleteResults)
|
|
285
260
|
- 🛒 Shopify App: [App Store Link](https://apps.shopify.com/constructor-connect)
|
|
286
261
|
- 🌐 Constructor's REST API: [Autocomplete](https://docs.constructor.com/reference/v1-autocomplete-get-autocomplete-results)
|
|
287
262
|
|
|
288
|
-
##
|
|
263
|
+
## Contributing
|
|
289
264
|
|
|
290
265
|
1. Fork the repo & create a new branch.
|
|
291
266
|
2. Run `npm install` to install dependencies.
|
|
292
267
|
3. After making the desired changes, run `npm run tests && npm run lint` locally.
|
|
293
268
|
4. Submit a PR for review.
|
|
294
269
|
|
|
295
|
-
##
|
|
270
|
+
## License
|
|
296
271
|
|
|
297
272
|
[MIT License](./LICENSE)
|
|
298
273
|
|
|
299
|
-
Copyright (c) 2022-present Constructor.io Corporation
|
|
274
|
+
Copyright (c) 2022-present Constructor.io Corporation
|