@constructor-io/constructorio-ui-autocomplete 1.2.1 → 1.2.3
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 +21 -4
- package/lib/cjs/constants.js +2 -2
- package/lib/mjs/constants.js +2 -2
- package/lib/types/constants.d.ts +1 -1
- package/package.json +9 -5
- package/lib/mjs/components/Autocomplete/Autocomplete.css +0 -110
- /package/lib/{cjs/components/Autocomplete/Autocomplete.css → styles.css} +0 -0
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ There are two main methods for consuming this UI Library in a React project:
|
|
|
17
17
|
The `CioAutocomplete` component handles state management, data fetching, and rendering logic.
|
|
18
18
|
|
|
19
19
|
```jsx
|
|
20
|
-
import { CioAutocomplete } from 'constructorio-ui-autocomplete';
|
|
20
|
+
import { CioAutocomplete } from '@constructor-io/constructorio-ui-autocomplete';
|
|
21
21
|
|
|
22
22
|
function YourComponent() {
|
|
23
23
|
return (
|
|
@@ -32,7 +32,7 @@ function YourComponent() {
|
|
|
32
32
|
The `useCioAutocomplete` hook handles state management and data fetching, but leaves rendering logic up to you.
|
|
33
33
|
|
|
34
34
|
```jsx
|
|
35
|
-
import { useCioAutocomplete } from 'constructorio-ui-autocomplete';
|
|
35
|
+
import { useCioAutocomplete } from '@constructor-io/constructorio-ui-autocomplete';
|
|
36
36
|
|
|
37
37
|
function YourComponent() {
|
|
38
38
|
const {
|
|
@@ -106,13 +106,13 @@ By default, importing react components or hooks from this library does not pull
|
|
|
106
106
|
If you wish to use some starter styles from this library, add an import statement similar to the example import statement below:
|
|
107
107
|
|
|
108
108
|
```js
|
|
109
|
-
import '
|
|
109
|
+
import '@constructor-io/constructorio-ui-autocomplete/styles.css';
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
> Note: the path and syntax in this example may change slightly depending on your module bundling strategy
|
|
113
113
|
|
|
114
114
|
- These starter styles can be used as a foundation to build on top of, or just as a reference for you to replace completely.
|
|
115
|
-
- To opt out of all default styling, do not import the `
|
|
115
|
+
- To opt out of all default styling, do not import the `styles.css` stylesheet.
|
|
116
116
|
- All starter styles in this library are scoped within the `.cio-autocomplete` css selector.
|
|
117
117
|
- These starter styles are intended to be extended by layering in your own css rules
|
|
118
118
|
- If you like, you can override the container's className like so:
|
|
@@ -120,6 +120,23 @@ import 'node_modules/@constructor-io/constructorio-ui-autocomplete/lib/mjs/compo
|
|
|
120
120
|
- If you like, you can pass additional className(s) of your choosing like so:
|
|
121
121
|
`autocompleteClassName='cio-autocomplete custom-autocomplete-container'`
|
|
122
122
|
|
|
123
|
+
## Troubleshooting
|
|
124
|
+
|
|
125
|
+
### Known Issues
|
|
126
|
+
|
|
127
|
+
**ESLint**
|
|
128
|
+
|
|
129
|
+
There is a known issue with ESLint where it fails to resolve the paths exposed in the `exports` statement of NPM packages. If you are receiving the following error, you can safely disable ESLint using `// eslint-disable-line` for that line.
|
|
130
|
+
|
|
131
|
+
`Unable to resolve path to module '@constructor-io/constructorio-ui-autocomplete/styles.css'`
|
|
132
|
+
|
|
133
|
+
Relevant open issues:
|
|
134
|
+
|
|
135
|
+
[Issue 1868](https://github.com/import-js/eslint-plugin-import/issues/1868)
|
|
136
|
+
|
|
137
|
+
[Issue 1810](https://github.com/import-js/eslint-plugin-import/issues/1810)
|
|
138
|
+
|
|
139
|
+
|
|
123
140
|
## Local Development
|
|
124
141
|
|
|
125
142
|
### Development scripts
|
package/lib/cjs/constants.js
CHANGED
|
@@ -125,12 +125,12 @@ By default, importing react components or hooks from this library does not pull
|
|
|
125
125
|
If you wish to use some starter styles from this library, add an import statement similar to the example import statement below:
|
|
126
126
|
|
|
127
127
|
\`
|
|
128
|
-
import '
|
|
128
|
+
import '@constructor-io/constructorio-ui-autocomplete/styles.css';
|
|
129
129
|
\`
|
|
130
130
|
|
|
131
131
|
<i></i>
|
|
132
132
|
|
|
133
|
-
- To opt out of all default styling, do not import the \`
|
|
133
|
+
- To opt out of all default styling, do not import the \`styles.css\` stylesheet.
|
|
134
134
|
- The path and syntax in the example above may change depending on your module bundling strategy
|
|
135
135
|
- These starter styles can be used as a foundation to build on top of, or just as a reference for you to replace completely.
|
|
136
136
|
- All starter styles in this library are scoped within the \`.cio-autocomplete\` css selector.
|
package/lib/mjs/constants.js
CHANGED
|
@@ -121,12 +121,12 @@ By default, importing react components or hooks from this library does not pull
|
|
|
121
121
|
If you wish to use some starter styles from this library, add an import statement similar to the example import statement below:
|
|
122
122
|
|
|
123
123
|
\`
|
|
124
|
-
import '
|
|
124
|
+
import '@constructor-io/constructorio-ui-autocomplete/styles.css';
|
|
125
125
|
\`
|
|
126
126
|
|
|
127
127
|
<i></i>
|
|
128
128
|
|
|
129
|
-
- To opt out of all default styling, do not import the \`
|
|
129
|
+
- To opt out of all default styling, do not import the \`styles.css\` stylesheet.
|
|
130
130
|
- The path and syntax in the example above may change depending on your module bundling strategy
|
|
131
131
|
- These starter styles can be used as a foundation to build on top of, or just as a reference for you to replace completely.
|
|
132
132
|
- All starter styles in this library are scoped within the \`.cio-autocomplete\` css selector.
|
package/lib/types/constants.d.ts
CHANGED
|
@@ -22,4 +22,4 @@ export declare const onSubmitDefault: (submitEvent: AutocompleteSubmitEvent) =>
|
|
|
22
22
|
export declare const zeroStateSectionsDescription = "Use `zeroStateSections` to show suggestions after a user applies focus to the search input field and before they start typing a query";
|
|
23
23
|
export declare const openOnFocusDescription = "Use `openOnFocus: false` to show suggestions after a user clears their query, but not when they initially apply focus to the search input field";
|
|
24
24
|
export declare const multipleSectionsDescription = "Use as many different `recommendations` and `custom` sections as you'd like and in whatever order you would like!";
|
|
25
|
-
export declare const customStylesDescription = "\nBy default, importing react components or hooks from this library does not pull any css into your project.\n\nIf you wish to use some starter styles from this library, add an import statement similar to the example import statement below:\n\n`\nimport '
|
|
25
|
+
export declare const customStylesDescription = "\nBy default, importing react components or hooks from this library does not pull any css into your project.\n\nIf you wish to use some starter styles from this library, add an import statement similar to the example import statement below:\n\n`\nimport '@constructor-io/constructorio-ui-autocomplete/styles.css';\n`\n\n<i></i>\n\n- To opt out of all default styling, do not import the `styles.css` stylesheet.\n- The path and syntax in the example above may change depending on your module bundling strategy\n- These starter styles can be used as a foundation to build on top of, or just as a reference for you to replace completely.\n- All starter styles in this library are scoped within the `.cio-autocomplete` css selector.\n- These starter styles are intended to be extended by layering in your own css rules\n- If you like, you can override the container's className like so:\n`autocompleteClassName='custom-autocomplete-container'`\n- If you like, you can pass additional className(s) of your choosing like so:\n`autocompleteClassName='cio-autocomplete custom-autocomplete-container'`\n\n\n```css\n/* Custom Style Sheet */\n.cio-autocomplete.custom-autocomplete-styles form {\n height: 44px;\n width: 600px;\n border-radius: 8px;\n background-color: rgb(247, 247, 247);\n}\n\n.cio-autocomplete.custom-autocomplete-styles .cio-input {\n font-weight: bold;\n}\n\n.cio-autocomplete.custom-autocomplete-styles .cio-form button {\n width: 44px;\n}\n\n.cio-autocomplete.custom-autocomplete-styles .cio-clear-btn {\n right: 24px;\n}\n\n.cio-autocomplete.custom-autocomplete-styles .cio-sectionName {\n margin: 5px 3px;\n}\n\n.cio-autocomplete.custom-autocomplete-styles .cio-results {\n width: 620px;\n max-height: 334px;\n overflow: hidden;\n border-radius: 0px 0px 8px 8px;\n color: rgb(51, 51, 51);\n}\n\n.cio-autocomplete.custom-autocomplete-styles .Products p {\n padding: 5px 5px 0;\n}\n```\n";
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructor-io/constructorio-ui-autocomplete",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Constructor.io Autocomplete UI library for web applications",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
7
7
|
"exports": {
|
|
8
|
+
"./styles.css": {
|
|
9
|
+
"import": "./lib/styles.css",
|
|
10
|
+
"require": "./lib/styles.css"
|
|
11
|
+
},
|
|
8
12
|
".": {
|
|
9
13
|
"import": "./lib/mjs/index.js",
|
|
10
14
|
"require": "./lib/cjs/index.js"
|
|
@@ -14,7 +18,7 @@
|
|
|
14
18
|
"types": "lib/types/index.d.ts",
|
|
15
19
|
"scripts": {
|
|
16
20
|
"lint": "eslint src --ext js,ts,jsx,tsx",
|
|
17
|
-
"copy-
|
|
21
|
+
"copy-styles": "cp src/styles.css lib/styles.css",
|
|
18
22
|
"prepare": "husky install",
|
|
19
23
|
"dev": "storybook dev -p 6006",
|
|
20
24
|
"storybook:ci": "storybook dev --ci --quiet -p 6006",
|
|
@@ -23,8 +27,9 @@
|
|
|
23
27
|
"test-storybook:ci": "start-server-and-test storybook:ci http://localhost:6006 test-storybook",
|
|
24
28
|
"build-storybook": "storybook build -o 'docs'",
|
|
25
29
|
"serve-built-storybook": "npx http-server docs",
|
|
26
|
-
"version": "
|
|
27
|
-
"
|
|
30
|
+
"verify-node-version": "chmod +x ./scripts/verify-node-version.sh && ./scripts/verify-node-version.sh",
|
|
31
|
+
"version": "npm run verify-node-version && npm run build-storybook && git add -u ./docs && git add ./docs/* && npm run compile",
|
|
32
|
+
"compile": "rm -rf lib && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && npm run copy-styles"
|
|
28
33
|
},
|
|
29
34
|
"author": "constructor.io",
|
|
30
35
|
"license": "MIT",
|
|
@@ -58,7 +63,6 @@
|
|
|
58
63
|
"@types/react-dom": "^18.0.6",
|
|
59
64
|
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
|
60
65
|
"@typescript-eslint/parser": "^5.38.0",
|
|
61
|
-
"copyfiles": "^2.4.1",
|
|
62
66
|
"downshift": "^7.0.5",
|
|
63
67
|
"eslint": "^8.23.1",
|
|
64
68
|
"eslint-config-airbnb": "^19.0.4",
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/* Autosuggest Container */
|
|
2
|
-
.cio-autocomplete {
|
|
3
|
-
position: relative;
|
|
4
|
-
height: 2rem;
|
|
5
|
-
padding: 20px;
|
|
6
|
-
font-family: Arial, Helvetica, sans-serif;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/* Autosuggest Form */
|
|
10
|
-
.cio-autocomplete .cio-form {
|
|
11
|
-
position: relative;
|
|
12
|
-
height: 100%;
|
|
13
|
-
width: 24rem;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.cio-autocomplete .cio-input {
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
border: 1px solid gray;
|
|
20
|
-
padding: 0 10px;
|
|
21
|
-
border-radius: 3px;
|
|
22
|
-
font-size: 1rem;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.cio-autocomplete .cio-submit-btn,
|
|
26
|
-
.cio-autocomplete .cio-clear-btn {
|
|
27
|
-
position: absolute;
|
|
28
|
-
top: 1px;
|
|
29
|
-
bottom: -1px;
|
|
30
|
-
right: -21px;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.cio-autocomplete button:disabled {
|
|
35
|
-
cursor: not-allowed;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.cio-autocomplete .cio-submit-btn {
|
|
39
|
-
right: -21px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.cio-autocomplete .cio-clear-btn {
|
|
43
|
-
right: 10px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.cio-autocomplete .cio-icon {
|
|
47
|
-
display: flex;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* Autosuggest Results */
|
|
52
|
-
.cio-autocomplete .cio-results {
|
|
53
|
-
position: absolute;
|
|
54
|
-
background-color: white;
|
|
55
|
-
gap: 20px;
|
|
56
|
-
padding-left: 0px;
|
|
57
|
-
list-style: none;
|
|
58
|
-
display: flex;
|
|
59
|
-
flex-direction: row;
|
|
60
|
-
z-index: 1000;
|
|
61
|
-
margin-top: 5px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.cio-autocomplete .cio-sectionName {
|
|
65
|
-
margin: 15px 0;
|
|
66
|
-
font-size: 1rem;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.cio-autocomplete .cio-section-items {
|
|
70
|
-
padding: 0;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.cio-autocomplete .cio-item-SearchSuggestions {
|
|
74
|
-
flex-direction: column;
|
|
75
|
-
min-width: 160px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.cio-autocomplete .cio-item {
|
|
79
|
-
flex: 1;
|
|
80
|
-
display: flex;
|
|
81
|
-
flex-direction: column;
|
|
82
|
-
cursor: pointer;
|
|
83
|
-
list-style: none;
|
|
84
|
-
padding: 5px;
|
|
85
|
-
border-bottom: 3px solid transparent;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.cio-autocomplete .cio-item[aria-selected='true'] {
|
|
89
|
-
background-color: hsl(0, 0%, 90%);
|
|
90
|
-
border-radius: 4px;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.cio-autocomplete .Products .cio-item {
|
|
94
|
-
display: inline-flex;
|
|
95
|
-
align-items: center;
|
|
96
|
-
width: 25%;
|
|
97
|
-
height: 140px;
|
|
98
|
-
padding: 5px 0;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.cio-autocomplete .cio-item p {
|
|
102
|
-
margin: 0;
|
|
103
|
-
overflow: hidden;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.cio-autocomplete .cio-item img {
|
|
107
|
-
width: 100%;
|
|
108
|
-
max-width: 100px;
|
|
109
|
-
max-height: 100px;
|
|
110
|
-
}
|
|
File without changes
|