react-ai-search-bar 1.0.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 ADDED
@@ -0,0 +1,30 @@
1
+ # react-ai-search-bar
2
+
3
+ > Made with create-react-library
4
+
5
+ [![NPM](https://img.shields.io/npm/v/react-ai-search-bar.svg)](https://www.npmjs.com/package/react-ai-search-bar) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install --save react-ai-search-bar
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```jsx
16
+ import React, { Component } from 'react'
17
+
18
+ import SearchBar from 'react-ai-search-bar'
19
+ import 'react-ai-search-bar/dist/index.css'
20
+
21
+ class Example extends Component {
22
+ render() {
23
+ return <SearchBar />
24
+ }
25
+ }
26
+ ```
27
+
28
+ ## License
29
+
30
+ MIT © [shauryabahuguna-tmpl](https://github.com/shauryabahuguna-tmpl)
package/dist/index.css ADDED
@@ -0,0 +1,272 @@
1
+ /* add css module styles here (optional) */
2
+
3
+ ._1Lxpd {
4
+ font-size: 2em;
5
+ width: 100%;
6
+ display: flex;
7
+ flex-direction: row;
8
+ justify-content: flex-start;
9
+ align-items: center;
10
+ }
11
+
12
+ ._34uzV {
13
+ position: relative;
14
+ flex: 1;
15
+ display: flex;
16
+ }
17
+
18
+ ._2IYfc {
19
+ padding-left: 35px;
20
+ padding-right: 75px;
21
+ padding-block: 8px;
22
+ flex: 1;
23
+ border-radius: 10px;
24
+ border: 0.5px solid gray;
25
+ }
26
+
27
+ ._2IYfc:focus {
28
+ outline: none;
29
+ }
30
+
31
+ ._2IYfc::-moz-placeholder {
32
+ opacity: 1;
33
+ -moz-transition: opacity 0.3s ease;
34
+ transition: opacity 0.3s ease; /* Adjust the duration and timing function as needed */
35
+ }
36
+
37
+ ._2IYfc::placeholder {
38
+ opacity: 1;
39
+ transition: opacity 0.3s ease; /* Adjust the duration and timing function as needed */
40
+ }
41
+
42
+ ._2IYfc._3Pehp::-moz-placeholder {
43
+ opacity: 0;
44
+ }
45
+
46
+ ._2IYfc._3Pehp::placeholder {
47
+ opacity: 0;
48
+ }
49
+
50
+ ._XSvp1 {
51
+ position: absolute;
52
+ z-index: 9999999;
53
+ top: 60px;
54
+ left: 0;
55
+ width: 100%;
56
+ transition: top 0.4s ease-in-out;
57
+ display: flex;
58
+ }
59
+
60
+ ._3nKdd {
61
+ border-radius: 5px;
62
+ min-height: 300px;
63
+ max-height: calc(100vh - 2em);
64
+ margin-inline: 1em;
65
+ flex: 1;
66
+ display: flex;
67
+
68
+ @media (max-width: 768px) {
69
+ margin-inline: 0.3em;
70
+ }
71
+ }
72
+
73
+ ._3UPkY {
74
+ top: 60px; /* slide down animation */
75
+ }
76
+
77
+ ._1VsJA {
78
+ top: -1000px; /* slide up animation */
79
+ }
80
+
81
+ ._1jBqv {
82
+ flex: 1;
83
+ border-radius: 5px;
84
+ padding: 1em 3em;
85
+ -webkit-backdrop-filter: brightness(0.4) blur(15px);
86
+ backdrop-filter: brightness(0.4) blur(15px);
87
+ color: white;
88
+ border: 1px solid rgba(255, 255, 255, 0.7);
89
+ box-shadow: 0px 9px 30px rgba(255, 149, 5, 0.3);
90
+ font-size: 18px;
91
+ overflow-y: auto;
92
+
93
+ @media (max-width: 768px) {
94
+ padding: 1em 0.7em;
95
+ }
96
+ }
97
+
98
+ ._1jBqv._3gN_3 {
99
+ -webkit-backdrop-filter: brightness(15) blur(20px);
100
+ backdrop-filter: brightness(15) blur(20px);
101
+ border: 1px solid rgba(0, 0, 0, 0.7);
102
+ color: black;
103
+ }
104
+
105
+ ._1dkPH {
106
+ position: absolute;
107
+ top: 50%;
108
+ transform: translate(50%, -50%);
109
+ /* left: 5px; */
110
+ }
111
+
112
+ ._3R7RF {
113
+ position: absolute;
114
+ top: 50%;
115
+ transform: translate(-13%, -50%);
116
+ right: 0;
117
+ display: flex;
118
+ justify-content: center;
119
+ align-items: center;
120
+ background-color: white;
121
+ border-radius: 7px;
122
+ border: 1px solid gray;
123
+ padding: 3px 10px;
124
+ }
125
+
126
+ ._2I1sI {
127
+ cursor: pointer;
128
+ position: absolute;
129
+ top: 50%;
130
+ transform: translate(-340%, -50%);
131
+ right: 0;
132
+ }
133
+
134
+ ._3R7RF._7huYs {
135
+ cursor: pointer;
136
+ background-color: black;
137
+ border-radius: 7px;
138
+ border: 1px solid black;
139
+ }
140
+
141
+ ._2RbY_ {
142
+ margin-bottom: 2em;
143
+ font-size: 16px;
144
+
145
+ @media (max-width: 768px) {
146
+ font-size: 14px;
147
+ }
148
+ }
149
+
150
+ ._2PVO1 {
151
+ display: grid;
152
+ grid-template-columns: repeat(2, 1fr);
153
+ -moz-column-gap: 10px;
154
+ column-gap: 10px;
155
+ row-gap: 15px;
156
+ margin-bottom: 2em;
157
+
158
+ @media (max-width: 768px) {
159
+ grid-template-columns: repeat(1, 1fr);
160
+ row-gap: 5px;
161
+ }
162
+
163
+ }
164
+
165
+ ._ZmP22 {
166
+ border: 1px solid rgba(255, 255, 255, 0.1);
167
+ padding: 0.5em;
168
+ border-radius: calc(5px + 0.5em);
169
+ text-decoration: none;
170
+ background-color: rgba(0, 0, 0, 0.2);
171
+ display: flex;
172
+ justify-content: flex-start;
173
+ align-items: center;
174
+ opacity: 0;
175
+ animation: _3uImN 0.5s ease forwards;
176
+ animation-delay: calc(0.3s * var(--index));
177
+ color: white;
178
+ position: relative;
179
+ }
180
+
181
+ ._ZmP22._3gN_3 {
182
+ color: black;
183
+ background-color: rgba(0, 0, 0, 0.1);
184
+ }
185
+
186
+ ._ZmP22 img {
187
+ height: 90px;
188
+ width: 90px;
189
+ border-radius: 5px;
190
+ margin-right: 20px;
191
+
192
+ @media (max-width: 768px) {
193
+ height: 60px;
194
+ width: 60px;
195
+ margin-right: 20px;
196
+ }
197
+ }
198
+
199
+ ._2jwZj h3 {
200
+ margin-top: 0;
201
+ margin-bottom: 10px;
202
+ font-size: 18px;
203
+ @media (max-width: 768px) {
204
+ font-size: 16px;
205
+ }
206
+ }
207
+
208
+ ._2jwZj p {
209
+ margin: 0;
210
+ font-size: 16px;
211
+ @media (max-width: 768px) {
212
+ font-size: 12px;
213
+ }
214
+ }
215
+
216
+ ._2Ipdz {
217
+ position: absolute;
218
+ top: 10px;
219
+ right: 10px;
220
+ }
221
+
222
+ ._tWHtY {
223
+ display: flex;
224
+ flex-direction: row;
225
+ flex-wrap: wrap;
226
+ align-items: center;
227
+ justify-content: flex-start;
228
+ gap: 10px;
229
+ margin-bottom: 1em;
230
+ }
231
+
232
+ ._3wV-k {
233
+ font-size: 14px;
234
+ margin: 0;
235
+ margin-bottom: 1em;
236
+ color: #FFFFFF;
237
+ }
238
+
239
+ ._3wV-k._3gN_3 {
240
+ color: #000000;
241
+ }
242
+
243
+ ._2Yhzo {
244
+ animation: _3uImN 0.5s ease forwards;
245
+ animation-delay: calc(0.3s * var(--index));
246
+ background-color: grey;
247
+ border-radius: 10px;
248
+ color: #FFFFFF;
249
+ cursor: pointer;
250
+ opacity: 0;
251
+ padding: 0.5em 1em;
252
+ border: 1px solid rgba(255, 255, 255, 0.1);
253
+ background-color: rgba(0, 0, 0, 0.2);
254
+ font-size: 14px;
255
+ text-align: start;
256
+ }
257
+
258
+ ._2Yhzo._3gN_3 {
259
+ color: #000000;
260
+ background-color: rgba(0, 0, 0, 0.1);
261
+ }
262
+
263
+ @keyframes _3uImN {
264
+ from {
265
+ opacity: 0;
266
+ transform: translateY(20px);
267
+ }
268
+ to {
269
+ opacity: 1;
270
+ transform: translateY(0);
271
+ }
272
+ }
package/dist/index.js ADDED
@@ -0,0 +1,201 @@
1
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
2
+
3
+ var React = require('react');
4
+ var React__default = _interopDefault(React);
5
+ var reactFeather = require('react-feather');
6
+ var DOMPurify = _interopDefault(require('dompurify'));
7
+
8
+ var styles = {"container":"_1Lxpd","inputContainer":"_34uzV","input":"_2IYfc","placeholderHidden":"_3Pehp","searchOverlay":"_XSvp1","searchResultBox":"_3nKdd","slideDown":"_3UPkY","slideUp":"_1VsJA","innerSearch":"_1jBqv","light":"_3gN_3","searchIcon":"_1dkPH","sendButton":"_3R7RF","close":"_2I1sI","iconActive":"_7huYs","message":"_2RbY_","cardContainer":"_2PVO1","singleCard":"_ZmP22","fadeIn":"_3uImN","content":"_2jwZj","linkIcon":"_2Ipdz","buttonContainer":"_tWHtY","suggested":"_3wV-k","followUp":"_2Yhzo"};
9
+
10
+ var SearchBar = function SearchBar(_ref) {
11
+ var placeholder = _ref.placeholder,
12
+ theme = _ref.theme;
13
+ var _useState = React.useState(''),
14
+ input = _useState[0],
15
+ setInput = _useState[1];
16
+ var _useState2 = React.useState(false),
17
+ searched = _useState2[0],
18
+ setSearched = _useState2[1];
19
+ var _useState3 = React.useState(''),
20
+ displayedText = _useState3[0],
21
+ setDisplayedText = _useState3[1];
22
+ var _useState4 = React.useState([]),
23
+ displayedProducts = _useState4[0],
24
+ setDisplayedProducts = _useState4[1];
25
+ var _useState5 = React.useState([]),
26
+ displayedFollowUp = _useState5[0],
27
+ setDisplayedFollowUp = _useState5[1];
28
+ var _useState6 = React.useState(0),
29
+ currentPlaceholderIndex = _useState6[0],
30
+ setCurrentPlaceholderIndex = _useState6[1];
31
+ var _useState7 = React.useState(true),
32
+ showPlaceholder = _useState7[0],
33
+ setShowPlaceholder = _useState7[1];
34
+ var searchTheme = theme || 'dark';
35
+ var sample = {
36
+ message: "Greetings, fellow traveler of the digital domain! \uD83D\uDE80 Step into the boundless expanse of AI-powered wonders,\n where the realms of imagination and innovation converge. Here, amidst the vast circuits of virtuality, you're not just a visitor;\n you're a pioneer forging paths into the future. In this grand sanctuary of artificial intelligence, the horizon stretches endlessly,\n offering limitless opportunities to explore, create, and learn. Whether you're a seasoned adventurer or a curious newcomer,\n you're embraced by the warmth of knowledge and the thrill of discovery.",
37
+ options: [{
38
+ title: 'Product 1',
39
+ image_link: 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',
40
+ link: 'https://example.com/product1',
41
+ description: 'Description of Product 1'
42
+ }, {
43
+ title: 'Product 2',
44
+ image_link: 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',
45
+ link: 'https://example.com/product2',
46
+ description: 'Description of Product 2'
47
+ }, {
48
+ title: 'Product 3',
49
+ image_link: 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',
50
+ link: 'https://example.com/product3',
51
+ description: 'Description of Product 3'
52
+ }],
53
+ followup_questions: ['Would you like more information about any specific product?', 'Are you looking for anything else?', 'How can I assist you further?']
54
+ };
55
+ var handleInputChange = function handleInputChange(e) {
56
+ setInput(e.target.value);
57
+ };
58
+ var handleSendClick = function handleSendClick(e) {
59
+ setSearched(true);
60
+ };
61
+ var handleSendClickKeyboard = function handleSendClickKeyboard(e) {
62
+ if (e.keyCode === 13) {
63
+ setSearched(true);
64
+ }
65
+ };
66
+ React.useEffect(function () {
67
+ if (input === '') {
68
+ setSearched(false);
69
+ setDisplayedText('');
70
+ setDisplayedProducts([]);
71
+ setDisplayedFollowUp([]);
72
+ }
73
+ }, [input]);
74
+ var handleClear = function handleClear() {
75
+ setInput('');
76
+ setSearched(false);
77
+ setDisplayedText('');
78
+ setDisplayedProducts([]);
79
+ setDisplayedFollowUp([]);
80
+ };
81
+ var SetNextQuestion = function SetNextQuestion(question) {
82
+ setInput(question);
83
+ };
84
+ React.useEffect(function () {
85
+ if (Array.isArray(placeholder) && placeholder.length > 1) {
86
+ var timer = setInterval(function () {
87
+ setShowPlaceholder(false);
88
+ setTimeout(function () {
89
+ setCurrentPlaceholderIndex(function (prevIndex) {
90
+ return (prevIndex + 1) % placeholder.length;
91
+ });
92
+ setShowPlaceholder(true);
93
+ }, 300);
94
+ }, 3000);
95
+ return function () {
96
+ return clearInterval(timer);
97
+ };
98
+ }
99
+ }, [placeholder]);
100
+ React.useEffect(function () {
101
+ if (searched) {
102
+ var index = 0;
103
+ var interval = setInterval(function () {
104
+ setDisplayedText(function (prevText) {
105
+ return prevText + sample.message[index];
106
+ });
107
+ index++;
108
+ if (index === sample.message.length) {
109
+ var _sample$options, _sample$followup_ques;
110
+ clearInterval(interval);
111
+ if ((sample === null || sample === void 0 ? void 0 : (_sample$options = sample.options) === null || _sample$options === void 0 ? void 0 : _sample$options.length) > 0) {
112
+ setDisplayedProducts(sample === null || sample === void 0 ? void 0 : sample.options);
113
+ }
114
+ if ((sample === null || sample === void 0 ? void 0 : (_sample$followup_ques = sample.followup_questions) === null || _sample$followup_ques === void 0 ? void 0 : _sample$followup_ques.length) > 0) {
115
+ setDisplayedFollowUp(sample === null || sample === void 0 ? void 0 : sample.followup_questions);
116
+ }
117
+ }
118
+ }, 30);
119
+ return function () {
120
+ return clearInterval(interval);
121
+ };
122
+ }
123
+ }, [searched, sample.message]);
124
+ var currentPlaceholder = Array.isArray(placeholder) ? placeholder[currentPlaceholderIndex] : placeholder;
125
+ return /*#__PURE__*/React__default.createElement("div", {
126
+ className: styles.container
127
+ }, /*#__PURE__*/React__default.createElement("div", {
128
+ className: styles.inputContainer
129
+ }, /*#__PURE__*/React__default.createElement(reactFeather.Search, {
130
+ className: styles.searchIcon,
131
+ color: "grey",
132
+ size: 18
133
+ }), /*#__PURE__*/React__default.createElement("input", {
134
+ className: styles.input + " " + (showPlaceholder ? '' : styles.placeholderHidden),
135
+ value: input,
136
+ onChange: handleInputChange,
137
+ placeholder: currentPlaceholder || 'Hi, How can I help you?',
138
+ onKeyDown: input ? handleSendClickKeyboard : null
139
+ }), input ? /*#__PURE__*/React__default.createElement(reactFeather.XCircle, {
140
+ className: styles.close,
141
+ color: "grey",
142
+ size: 16,
143
+ onClick: handleClear
144
+ }) : null, /*#__PURE__*/React__default.createElement("button", {
145
+ onClick: input ? handleSendClick : null,
146
+ className: styles.sendButton + " " + (input ? styles.iconActive : null),
147
+ disabled: !input
148
+ }, /*#__PURE__*/React__default.createElement(reactFeather.Send, {
149
+ color: input ? 'white' : 'grey',
150
+ size: 16
151
+ }))), /*#__PURE__*/React__default.createElement("div", {
152
+ className: styles.searchOverlay + " " + (searched ? styles.slideDown : styles.slideUp)
153
+ }, /*#__PURE__*/React__default.createElement("div", {
154
+ className: styles.searchResultBox
155
+ }, /*#__PURE__*/React__default.createElement("div", {
156
+ className: styles.innerSearch + " " + (searchTheme === 'light' ? styles.light : '')
157
+ }, /*#__PURE__*/React__default.createElement("p", {
158
+ className: styles.message,
159
+ dangerouslySetInnerHTML: {
160
+ __html: DOMPurify.sanitize(displayedText)
161
+ }
162
+ }), (displayedProducts === null || displayedProducts === void 0 ? void 0 : displayedProducts.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
163
+ className: styles.cardContainer
164
+ }, displayedProducts.map(function (e, index) {
165
+ return /*#__PURE__*/React__default.createElement("a", {
166
+ className: styles.singleCard + " " + (searchTheme === 'light' ? styles.light : ''),
167
+ href: e.link,
168
+ key: index,
169
+ style: {
170
+ '--index': index
171
+ }
172
+ }, /*#__PURE__*/React__default.createElement("img", {
173
+ src: e.image_link,
174
+ alt: "abc",
175
+ target: "_blank"
176
+ }), /*#__PURE__*/React__default.createElement("div", {
177
+ className: styles.content
178
+ }, e.title ? /*#__PURE__*/React__default.createElement("h3", null, e.title) : null, e.description ? /*#__PURE__*/React__default.createElement("p", null, e.description) : null), /*#__PURE__*/React__default.createElement(reactFeather.ExternalLink, {
179
+ size: 18,
180
+ className: styles.linkIcon
181
+ }));
182
+ })) : null, (displayedFollowUp === null || displayedFollowUp === void 0 ? void 0 : displayedFollowUp.length) > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("p", {
183
+ className: styles.suggested + " " + (searchTheme === 'light' ? styles.light : '')
184
+ }, "Suggested Questions:", ' '), /*#__PURE__*/React__default.createElement("div", {
185
+ className: styles.buttonContainer
186
+ }, displayedFollowUp.map(function (question, index) {
187
+ return /*#__PURE__*/React__default.createElement("button", {
188
+ className: styles.followUp + " " + (searchTheme === 'light' ? styles.light : ''),
189
+ key: index,
190
+ style: {
191
+ '--index': index
192
+ },
193
+ onClick: function onClick() {
194
+ return SetNextQuestion(question);
195
+ }
196
+ }, question);
197
+ }))) : null))));
198
+ };
199
+
200
+ exports.SearchBar = SearchBar;
201
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react'\nimport styles from './styles.module.css'\nimport {\n Search,\n Send,\n XCircle as Cross,\n ExternalLink as Link\n} from 'react-feather'\nimport DOMPurify from 'dompurify'\n\nexport const SearchBar = ({ placeholder, theme }) => {\n const [input, setInput] = useState('')\n const [searched, setSearched] = useState(false)\n const [displayedText, setDisplayedText] = useState('')\n const [displayedProducts, setDisplayedProducts] = useState([])\n const [displayedFollowUp, setDisplayedFollowUp] = useState([])\n const [currentPlaceholderIndex, setCurrentPlaceholderIndex] = useState(0)\n const [showPlaceholder, setShowPlaceholder] = useState(true)\n const searchTheme = theme || 'dark'\n\n const sample = {\n message: `Greetings, fellow traveler of the digital domain! 🚀 Step into the boundless expanse of AI-powered wonders,\n where the realms of imagination and innovation converge. Here, amidst the vast circuits of virtuality, you're not just a visitor;\n you're a pioneer forging paths into the future. In this grand sanctuary of artificial intelligence, the horizon stretches endlessly,\n offering limitless opportunities to explore, create, and learn. Whether you're a seasoned adventurer or a curious newcomer,\n you're embraced by the warmth of knowledge and the thrill of discovery.`,\n options: [\n {\n title: 'Product 1',\n image_link:\n 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',\n link: 'https://example.com/product1',\n description: 'Description of Product 1'\n },\n {\n title: 'Product 2',\n image_link:\n 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',\n link: 'https://example.com/product2',\n description: 'Description of Product 2'\n },\n {\n title: 'Product 3',\n image_link:\n 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',\n link: 'https://example.com/product3',\n description: 'Description of Product 3'\n }\n ],\n followup_questions: [\n 'Would you like more information about any specific product?',\n 'Are you looking for anything else?',\n 'How can I assist you further?'\n ]\n }\n\n const handleInputChange = (e) => {\n setInput(e.target.value)\n }\n\n const handleSendClick = (e) => {\n setSearched(true)\n }\n\n const handleSendClickKeyboard = (e) => {\n if (e.keyCode === 13) {\n setSearched(true)\n }\n }\n\n useEffect(() => {\n if (input === '') {\n setSearched(false)\n setDisplayedText('')\n setDisplayedProducts([])\n setDisplayedFollowUp([])\n }\n }, [input])\n\n const handleClear = () => {\n setInput('')\n setSearched(false)\n setDisplayedText('')\n setDisplayedProducts([])\n setDisplayedFollowUp([])\n }\n\n const SetNextQuestion = (question) => {\n setInput(question)\n }\n\n useEffect(() => {\n if (Array.isArray(placeholder) && placeholder.length > 1) {\n const timer = setInterval(() => {\n setShowPlaceholder(false)\n setTimeout(() => {\n setCurrentPlaceholderIndex(\n (prevIndex) => (prevIndex + 1) % placeholder.length\n )\n setShowPlaceholder(true)\n }, 300) // Delay to allow time for the transition\n }, 3000) // Change placeholder every 3 seconds\n\n return () => clearInterval(timer)\n }\n }, [placeholder])\n\n useEffect(() => {\n if (searched) {\n let index = 0\n const interval = setInterval(() => {\n setDisplayedText((prevText) => prevText + sample.message[index])\n index++\n if (index === sample.message.length) {\n clearInterval(interval)\n if (sample?.options?.length > 0) {\n setDisplayedProducts(sample?.options)\n }\n if (sample?.followup_questions?.length > 0) {\n setDisplayedFollowUp(sample?.followup_questions)\n }\n }\n }, 30)\n return () => clearInterval(interval)\n }\n }, [searched, sample.message])\n\n const currentPlaceholder = Array.isArray(placeholder)\n ? placeholder[currentPlaceholderIndex]\n : placeholder\n\n return (\n <div className={styles.container}>\n <div className={styles.inputContainer}>\n <Search className={styles.searchIcon} color='grey' size={18} />\n <input\n className={`${styles.input} ${\n showPlaceholder ? '' : styles.placeholderHidden\n }`}\n value={input}\n onChange={handleInputChange}\n placeholder={currentPlaceholder || 'Hi, How can I help you?'}\n onKeyDown={input ? handleSendClickKeyboard : null}\n />\n {input ? (\n <Cross\n className={styles.close}\n color='grey'\n size={16}\n onClick={handleClear}\n />\n ) : null}\n <button\n onClick={input ? handleSendClick : null}\n className={`${styles.sendButton} ${input ? styles.iconActive : null}`}\n disabled={!input}\n >\n <Send color={input ? 'white' : 'grey'} size={16} />\n </button>\n </div>\n <div\n className={`${styles.searchOverlay} ${\n searched ? styles.slideDown : styles.slideUp\n }`}\n >\n <div className={styles.searchResultBox}>\n <div\n className={`${styles.innerSearch} ${\n searchTheme === 'light' ? styles.light : ''\n }`}\n >\n <p\n className={styles.message}\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(displayedText)\n }}\n />\n {displayedProducts?.length > 0 ? (\n <div className={styles.cardContainer}>\n {displayedProducts.map((e, index) => {\n return (\n <a\n className={`${styles.singleCard} ${\n searchTheme === 'light' ? styles.light : ''\n }`}\n href={e.link}\n key={index}\n style={{ '--index': index }}\n >\n <img src={e.image_link} alt='abc' target='_blank' />\n <div className={styles.content}>\n {e.title ? <h3>{e.title}</h3> : null}\n {e.description ? <p>{e.description}</p> : null}\n </div>\n <Link size={18} className={styles.linkIcon} />\n </a>\n )\n })}\n </div>\n ) : null}\n {displayedFollowUp?.length > 0 ? (\n <React.Fragment>\n <p\n className={`${styles.suggested} ${\n searchTheme === 'light' ? styles.light : ''\n }`}\n >\n Suggested Questions:{' '}\n </p>\n <div className={styles.buttonContainer}>\n {displayedFollowUp.map((question, index) => {\n return (\n <button\n className={`${styles.followUp} ${\n searchTheme === 'light' ? styles.light : ''\n }`}\n key={index}\n style={{ '--index': index }}\n onClick={() => SetNextQuestion(question)}\n >\n {question}\n </button>\n )\n })}\n </div>\n </React.Fragment>\n ) : null}\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],"names":["SearchBar","_ref","placeholder","theme","_useState","useState","input","setInput","_useState2","searched","setSearched","_useState3","displayedText","setDisplayedText","_useState4","displayedProducts","setDisplayedProducts","_useState5","displayedFollowUp","setDisplayedFollowUp","_useState6","currentPlaceholderIndex","setCurrentPlaceholderIndex","_useState7","showPlaceholder","setShowPlaceholder","searchTheme","sample","message","options","title","image_link","link","description","followup_questions","handleInputChange","e","target","value","handleSendClick","handleSendClickKeyboard","keyCode","useEffect","handleClear","SetNextQuestion","question","Array","isArray","length","timer","setInterval","setTimeout","prevIndex","clearInterval","index","interval","prevText","_sample$options","_sample$followup_ques","currentPlaceholder","React","createElement","className","styles","container","inputContainer","Search","searchIcon","color","size","placeholderHidden","onChange","onKeyDown","Cross","close","onClick","sendButton","iconActive","disabled","Send","searchOverlay","slideDown","slideUp","searchResultBox","innerSearch","light","dangerouslySetInnerHTML","__html","DOMPurify","sanitize","cardContainer","map","singleCard","href","key","style","src","alt","content","Link","linkIcon","Fragment","suggested","buttonContainer","followUp"],"mappings":";;;;;;;;;IAUaA,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAA+B;EAAA,IAAzBC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;EAC5C,IAAAC,SAAA,GAA0BC,cAAQ,CAAC,EAAE,CAAC;IAA/BC,KAAK,GAAAF,SAAA;IAAEG,QAAQ,GAAAH,SAAA;EACtB,IAAAI,UAAA,GAAgCH,cAAQ,CAAC,KAAK,CAAC;IAAxCI,QAAQ,GAAAD,UAAA;IAAEE,WAAW,GAAAF,UAAA;EAC5B,IAAAG,UAAA,GAA0CN,cAAQ,CAAC,EAAE,CAAC;IAA/CO,aAAa,GAAAD,UAAA;IAAEE,gBAAgB,GAAAF,UAAA;EACtC,IAAAG,UAAA,GAAkDT,cAAQ,CAAC,EAAE,CAAC;IAAvDU,iBAAiB,GAAAD,UAAA;IAAEE,oBAAoB,GAAAF,UAAA;EAC9C,IAAAG,UAAA,GAAkDZ,cAAQ,CAAC,EAAE,CAAC;IAAvDa,iBAAiB,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AAK,OAAO,GAAGqC,MAAM,CAACsB,KAAK,GAAG,EAAE;KAE9C,sBACqB,EAAC,GACpB,CAAC,eACJzB,cAAA,CAAAC,aAAA;IAAKC,SAAS,EAAEC,MAAM,CAACwC;KACpBrF,iBAAiB,CAACyE,GAAG,CAAC,UAAC9C,QAAQ,EAAES,KAAK,EAAK;IAC1C,oBACEM,cAAA,CAAAC,aAAA;MACEC,SAAS,EAAKC,MAAM,CAACyC,QAAQ,UAC3B9E,WAAW,KAAK,OAAO,GAAGqC,MAAM,CAACsB,KAAK,GAAG,EAAE,CAC1C;MACHS,GAAG,EAAExC,KAAM;MACXyC,KAAK,EAAE;QAAE,SAAS,EAAEzC;OAAQ;MAC5BqB,OAAO,EAAE,SAAAA;QAAA,OAAM/B,eAAe,CAACC,QAAQ,CAAC;;OAEvCA,QACK,CAAC;GAEZ,CACE,CACS,CAAC,GACf,IACD,CACF,CACF,CACF,CAAC;AAEV,CAAC;;;;"}
@@ -0,0 +1,198 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { Search, XCircle, Send, ExternalLink } from 'react-feather';
3
+ import DOMPurify from 'dompurify';
4
+
5
+ var styles = {"container":"_1Lxpd","inputContainer":"_34uzV","input":"_2IYfc","placeholderHidden":"_3Pehp","searchOverlay":"_XSvp1","searchResultBox":"_3nKdd","slideDown":"_3UPkY","slideUp":"_1VsJA","innerSearch":"_1jBqv","light":"_3gN_3","searchIcon":"_1dkPH","sendButton":"_3R7RF","close":"_2I1sI","iconActive":"_7huYs","message":"_2RbY_","cardContainer":"_2PVO1","singleCard":"_ZmP22","fadeIn":"_3uImN","content":"_2jwZj","linkIcon":"_2Ipdz","buttonContainer":"_tWHtY","suggested":"_3wV-k","followUp":"_2Yhzo"};
6
+
7
+ var SearchBar = function SearchBar(_ref) {
8
+ var placeholder = _ref.placeholder,
9
+ theme = _ref.theme;
10
+ var _useState = useState(''),
11
+ input = _useState[0],
12
+ setInput = _useState[1];
13
+ var _useState2 = useState(false),
14
+ searched = _useState2[0],
15
+ setSearched = _useState2[1];
16
+ var _useState3 = useState(''),
17
+ displayedText = _useState3[0],
18
+ setDisplayedText = _useState3[1];
19
+ var _useState4 = useState([]),
20
+ displayedProducts = _useState4[0],
21
+ setDisplayedProducts = _useState4[1];
22
+ var _useState5 = useState([]),
23
+ displayedFollowUp = _useState5[0],
24
+ setDisplayedFollowUp = _useState5[1];
25
+ var _useState6 = useState(0),
26
+ currentPlaceholderIndex = _useState6[0],
27
+ setCurrentPlaceholderIndex = _useState6[1];
28
+ var _useState7 = useState(true),
29
+ showPlaceholder = _useState7[0],
30
+ setShowPlaceholder = _useState7[1];
31
+ var searchTheme = theme || 'dark';
32
+ var sample = {
33
+ message: "Greetings, fellow traveler of the digital domain! \uD83D\uDE80 Step into the boundless expanse of AI-powered wonders,\n where the realms of imagination and innovation converge. Here, amidst the vast circuits of virtuality, you're not just a visitor;\n you're a pioneer forging paths into the future. In this grand sanctuary of artificial intelligence, the horizon stretches endlessly,\n offering limitless opportunities to explore, create, and learn. Whether you're a seasoned adventurer or a curious newcomer,\n you're embraced by the warmth of knowledge and the thrill of discovery.",
34
+ options: [{
35
+ title: 'Product 1',
36
+ image_link: 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',
37
+ link: 'https://example.com/product1',
38
+ description: 'Description of Product 1'
39
+ }, {
40
+ title: 'Product 2',
41
+ image_link: 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',
42
+ link: 'https://example.com/product2',
43
+ description: 'Description of Product 2'
44
+ }, {
45
+ title: 'Product 3',
46
+ image_link: 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',
47
+ link: 'https://example.com/product3',
48
+ description: 'Description of Product 3'
49
+ }],
50
+ followup_questions: ['Would you like more information about any specific product?', 'Are you looking for anything else?', 'How can I assist you further?']
51
+ };
52
+ var handleInputChange = function handleInputChange(e) {
53
+ setInput(e.target.value);
54
+ };
55
+ var handleSendClick = function handleSendClick(e) {
56
+ setSearched(true);
57
+ };
58
+ var handleSendClickKeyboard = function handleSendClickKeyboard(e) {
59
+ if (e.keyCode === 13) {
60
+ setSearched(true);
61
+ }
62
+ };
63
+ useEffect(function () {
64
+ if (input === '') {
65
+ setSearched(false);
66
+ setDisplayedText('');
67
+ setDisplayedProducts([]);
68
+ setDisplayedFollowUp([]);
69
+ }
70
+ }, [input]);
71
+ var handleClear = function handleClear() {
72
+ setInput('');
73
+ setSearched(false);
74
+ setDisplayedText('');
75
+ setDisplayedProducts([]);
76
+ setDisplayedFollowUp([]);
77
+ };
78
+ var SetNextQuestion = function SetNextQuestion(question) {
79
+ setInput(question);
80
+ };
81
+ useEffect(function () {
82
+ if (Array.isArray(placeholder) && placeholder.length > 1) {
83
+ var timer = setInterval(function () {
84
+ setShowPlaceholder(false);
85
+ setTimeout(function () {
86
+ setCurrentPlaceholderIndex(function (prevIndex) {
87
+ return (prevIndex + 1) % placeholder.length;
88
+ });
89
+ setShowPlaceholder(true);
90
+ }, 300);
91
+ }, 3000);
92
+ return function () {
93
+ return clearInterval(timer);
94
+ };
95
+ }
96
+ }, [placeholder]);
97
+ useEffect(function () {
98
+ if (searched) {
99
+ var index = 0;
100
+ var interval = setInterval(function () {
101
+ setDisplayedText(function (prevText) {
102
+ return prevText + sample.message[index];
103
+ });
104
+ index++;
105
+ if (index === sample.message.length) {
106
+ var _sample$options, _sample$followup_ques;
107
+ clearInterval(interval);
108
+ if ((sample === null || sample === void 0 ? void 0 : (_sample$options = sample.options) === null || _sample$options === void 0 ? void 0 : _sample$options.length) > 0) {
109
+ setDisplayedProducts(sample === null || sample === void 0 ? void 0 : sample.options);
110
+ }
111
+ if ((sample === null || sample === void 0 ? void 0 : (_sample$followup_ques = sample.followup_questions) === null || _sample$followup_ques === void 0 ? void 0 : _sample$followup_ques.length) > 0) {
112
+ setDisplayedFollowUp(sample === null || sample === void 0 ? void 0 : sample.followup_questions);
113
+ }
114
+ }
115
+ }, 30);
116
+ return function () {
117
+ return clearInterval(interval);
118
+ };
119
+ }
120
+ }, [searched, sample.message]);
121
+ var currentPlaceholder = Array.isArray(placeholder) ? placeholder[currentPlaceholderIndex] : placeholder;
122
+ return /*#__PURE__*/React.createElement("div", {
123
+ className: styles.container
124
+ }, /*#__PURE__*/React.createElement("div", {
125
+ className: styles.inputContainer
126
+ }, /*#__PURE__*/React.createElement(Search, {
127
+ className: styles.searchIcon,
128
+ color: "grey",
129
+ size: 18
130
+ }), /*#__PURE__*/React.createElement("input", {
131
+ className: styles.input + " " + (showPlaceholder ? '' : styles.placeholderHidden),
132
+ value: input,
133
+ onChange: handleInputChange,
134
+ placeholder: currentPlaceholder || 'Hi, How can I help you?',
135
+ onKeyDown: input ? handleSendClickKeyboard : null
136
+ }), input ? /*#__PURE__*/React.createElement(XCircle, {
137
+ className: styles.close,
138
+ color: "grey",
139
+ size: 16,
140
+ onClick: handleClear
141
+ }) : null, /*#__PURE__*/React.createElement("button", {
142
+ onClick: input ? handleSendClick : null,
143
+ className: styles.sendButton + " " + (input ? styles.iconActive : null),
144
+ disabled: !input
145
+ }, /*#__PURE__*/React.createElement(Send, {
146
+ color: input ? 'white' : 'grey',
147
+ size: 16
148
+ }))), /*#__PURE__*/React.createElement("div", {
149
+ className: styles.searchOverlay + " " + (searched ? styles.slideDown : styles.slideUp)
150
+ }, /*#__PURE__*/React.createElement("div", {
151
+ className: styles.searchResultBox
152
+ }, /*#__PURE__*/React.createElement("div", {
153
+ className: styles.innerSearch + " " + (searchTheme === 'light' ? styles.light : '')
154
+ }, /*#__PURE__*/React.createElement("p", {
155
+ className: styles.message,
156
+ dangerouslySetInnerHTML: {
157
+ __html: DOMPurify.sanitize(displayedText)
158
+ }
159
+ }), (displayedProducts === null || displayedProducts === void 0 ? void 0 : displayedProducts.length) > 0 ? /*#__PURE__*/React.createElement("div", {
160
+ className: styles.cardContainer
161
+ }, displayedProducts.map(function (e, index) {
162
+ return /*#__PURE__*/React.createElement("a", {
163
+ className: styles.singleCard + " " + (searchTheme === 'light' ? styles.light : ''),
164
+ href: e.link,
165
+ key: index,
166
+ style: {
167
+ '--index': index
168
+ }
169
+ }, /*#__PURE__*/React.createElement("img", {
170
+ src: e.image_link,
171
+ alt: "abc",
172
+ target: "_blank"
173
+ }), /*#__PURE__*/React.createElement("div", {
174
+ className: styles.content
175
+ }, e.title ? /*#__PURE__*/React.createElement("h3", null, e.title) : null, e.description ? /*#__PURE__*/React.createElement("p", null, e.description) : null), /*#__PURE__*/React.createElement(ExternalLink, {
176
+ size: 18,
177
+ className: styles.linkIcon
178
+ }));
179
+ })) : null, (displayedFollowUp === null || displayedFollowUp === void 0 ? void 0 : displayedFollowUp.length) > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
180
+ className: styles.suggested + " " + (searchTheme === 'light' ? styles.light : '')
181
+ }, "Suggested Questions:", ' '), /*#__PURE__*/React.createElement("div", {
182
+ className: styles.buttonContainer
183
+ }, displayedFollowUp.map(function (question, index) {
184
+ return /*#__PURE__*/React.createElement("button", {
185
+ className: styles.followUp + " " + (searchTheme === 'light' ? styles.light : ''),
186
+ key: index,
187
+ style: {
188
+ '--index': index
189
+ },
190
+ onClick: function onClick() {
191
+ return SetNextQuestion(question);
192
+ }
193
+ }, question);
194
+ }))) : null))));
195
+ };
196
+
197
+ export { SearchBar };
198
+ //# sourceMappingURL=index.modern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.modern.js","sources":["../src/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react'\nimport styles from './styles.module.css'\nimport {\n Search,\n Send,\n XCircle as Cross,\n ExternalLink as Link\n} from 'react-feather'\nimport DOMPurify from 'dompurify'\n\nexport const SearchBar = ({ placeholder, theme }) => {\n const [input, setInput] = useState('')\n const [searched, setSearched] = useState(false)\n const [displayedText, setDisplayedText] = useState('')\n const [displayedProducts, setDisplayedProducts] = useState([])\n const [displayedFollowUp, setDisplayedFollowUp] = useState([])\n const [currentPlaceholderIndex, setCurrentPlaceholderIndex] = useState(0)\n const [showPlaceholder, setShowPlaceholder] = useState(true)\n const searchTheme = theme || 'dark'\n\n const sample = {\n message: `Greetings, fellow traveler of the digital domain! 🚀 Step into the boundless expanse of AI-powered wonders,\n where the realms of imagination and innovation converge. Here, amidst the vast circuits of virtuality, you're not just a visitor;\n you're a pioneer forging paths into the future. In this grand sanctuary of artificial intelligence, the horizon stretches endlessly,\n offering limitless opportunities to explore, create, and learn. Whether you're a seasoned adventurer or a curious newcomer,\n you're embraced by the warmth of knowledge and the thrill of discovery.`,\n options: [\n {\n title: 'Product 1',\n image_link:\n 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',\n link: 'https://example.com/product1',\n description: 'Description of Product 1'\n },\n {\n title: 'Product 2',\n image_link:\n 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',\n link: 'https://example.com/product2',\n description: 'Description of Product 2'\n },\n {\n title: 'Product 3',\n image_link:\n 'https://cdn.pixabay.com/photo/2016/05/05/02/37/sunset-1373171_1280.jpg',\n link: 'https://example.com/product3',\n description: 'Description of Product 3'\n }\n ],\n followup_questions: [\n 'Would you like more information about any specific product?',\n 'Are you looking for anything else?',\n 'How can I assist you further?'\n ]\n }\n\n const handleInputChange = (e) => {\n setInput(e.target.value)\n }\n\n const handleSendClick = (e) => {\n setSearched(true)\n }\n\n const handleSendClickKeyboard = (e) => {\n if (e.keyCode === 13) {\n setSearched(true)\n }\n }\n\n useEffect(() => {\n if (input === '') {\n setSearched(false)\n setDisplayedText('')\n setDisplayedProducts([])\n setDisplayedFollowUp([])\n }\n }, [input])\n\n const handleClear = () => {\n setInput('')\n setSearched(false)\n setDisplayedText('')\n setDisplayedProducts([])\n setDisplayedFollowUp([])\n }\n\n const SetNextQuestion = (question) => {\n setInput(question)\n }\n\n useEffect(() => {\n if (Array.isArray(placeholder) && placeholder.length > 1) {\n const timer = setInterval(() => {\n setShowPlaceholder(false)\n setTimeout(() => {\n setCurrentPlaceholderIndex(\n (prevIndex) => (prevIndex + 1) % placeholder.length\n )\n setShowPlaceholder(true)\n }, 300) // Delay to allow time for the transition\n }, 3000) // Change placeholder every 3 seconds\n\n return () => clearInterval(timer)\n }\n }, [placeholder])\n\n useEffect(() => {\n if (searched) {\n let index = 0\n const interval = setInterval(() => {\n setDisplayedText((prevText) => prevText + sample.message[index])\n index++\n if (index === sample.message.length) {\n clearInterval(interval)\n if (sample?.options?.length > 0) {\n setDisplayedProducts(sample?.options)\n }\n if (sample?.followup_questions?.length > 0) {\n setDisplayedFollowUp(sample?.followup_questions)\n }\n }\n }, 30)\n return () => clearInterval(interval)\n }\n }, [searched, sample.message])\n\n const currentPlaceholder = Array.isArray(placeholder)\n ? placeholder[currentPlaceholderIndex]\n : placeholder\n\n return (\n <div className={styles.container}>\n <div className={styles.inputContainer}>\n <Search className={styles.searchIcon} color='grey' size={18} />\n <input\n className={`${styles.input} ${\n showPlaceholder ? '' : styles.placeholderHidden\n }`}\n value={input}\n onChange={handleInputChange}\n placeholder={currentPlaceholder || 'Hi, How can I help you?'}\n onKeyDown={input ? handleSendClickKeyboard : null}\n />\n {input ? (\n <Cross\n className={styles.close}\n color='grey'\n size={16}\n onClick={handleClear}\n />\n ) : null}\n <button\n onClick={input ? handleSendClick : null}\n className={`${styles.sendButton} ${input ? styles.iconActive : null}`}\n disabled={!input}\n >\n <Send color={input ? 'white' : 'grey'} size={16} />\n </button>\n </div>\n <div\n className={`${styles.searchOverlay} ${\n searched ? styles.slideDown : styles.slideUp\n }`}\n >\n <div className={styles.searchResultBox}>\n <div\n className={`${styles.innerSearch} ${\n searchTheme === 'light' ? styles.light : ''\n }`}\n >\n <p\n className={styles.message}\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(displayedText)\n }}\n />\n {displayedProducts?.length > 0 ? (\n <div className={styles.cardContainer}>\n {displayedProducts.map((e, index) => {\n return (\n <a\n className={`${styles.singleCard} ${\n searchTheme === 'light' ? styles.light : ''\n }`}\n href={e.link}\n key={index}\n style={{ '--index': index }}\n >\n <img src={e.image_link} alt='abc' target='_blank' />\n <div className={styles.content}>\n {e.title ? <h3>{e.title}</h3> : null}\n {e.description ? <p>{e.description}</p> : null}\n </div>\n <Link size={18} className={styles.linkIcon} />\n </a>\n )\n })}\n </div>\n ) : null}\n {displayedFollowUp?.length > 0 ? (\n <React.Fragment>\n <p\n className={`${styles.suggested} ${\n searchTheme === 'light' ? styles.light : ''\n }`}\n >\n Suggested Questions:{' '}\n </p>\n <div className={styles.buttonContainer}>\n {displayedFollowUp.map((question, index) => {\n return (\n <button\n className={`${styles.followUp} ${\n searchTheme === 'light' ? styles.light : ''\n }`}\n key={index}\n style={{ '--index': index }}\n onClick={() => SetNextQuestion(question)}\n >\n {question}\n </button>\n )\n })}\n </div>\n </React.Fragment>\n ) : null}\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],"names":["SearchBar","_ref","placeholder","theme","_useState","useState","input","setInput","_useState2","searched","setSearched","_useState3","displayedText","setDisplayedText","_useState4","displayedProducts","setDisplayedProducts","_useState5","displayedFollowUp","setDisplayedFollowUp","_useState6","currentPlaceholderIndex","setCurrentPlaceholderIndex","_useState7","showPlaceholder","setShowPlaceholder","searchTheme","sample","message","options","title","image_link","link","description","followup_questions","handleInputChange","e","target","value","handleSendClick","handleSendClickKeyboard","keyCode","useEffect","handleClear","SetNextQuestion","question","Array","isArray","length","timer","setInterval","setTimeout","prevIndex","clearInterval","index","interval","prevText","_sample$options","_sample$followup_ques","currentPlaceholder","React","createElement","className","styles","container","inputContainer","Search","searchIcon","color","size","placeholderHidden","onChange","onKeyDown","Cross","close","onClick","sendButton","iconActive","disabled","Send","searchOverlay","slideDown","slideUp","searchResultBox","innerSearch","light","dangerouslySetInnerHTML","__html","DOMPurify","sanitize","cardContainer","map","singleCard","href","key","style","src","alt","content","Link","linkIcon","Fragment","suggested","buttonContainer","followUp"],"mappings":";;;;;;IAUaA,SAAS,GAAG,SAAZA,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,0 +1,59 @@
1
+ {
2
+ "name": "react-ai-search-bar",
3
+ "version": "1.0.0",
4
+ "description": "Made with create-react-library",
5
+ "author": "shauryabahuguna-tmpl",
6
+ "license": "MIT",
7
+ "repository": "shauryabahuguna-tmpl/react-ai-search-bar",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.modern.js",
10
+ "source": "src/index.js",
11
+ "engines": {
12
+ "node": ">=10"
13
+ },
14
+ "scripts": {
15
+ "build": "microbundle-crl --no-compress --format modern,cjs",
16
+ "start": "microbundle-crl watch --no-compress --format modern,cjs",
17
+ "prepare": "run-s build",
18
+ "test": "run-s test:unit test:lint test:build",
19
+ "test:build": "run-s build",
20
+ "test:lint": "eslint .",
21
+ "test:unit": "cross-env CI=1 react-scripts test --env=jsdom",
22
+ "test:watch": "react-scripts test --env=jsdom",
23
+ "predeploy": "cd example && npm install && npm run build",
24
+ "deploy": "gh-pages -d example/build"
25
+ },
26
+ "peerDependencies": {
27
+ "react": "^16.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "babel-eslint": "^10.0.3",
31
+ "cross-env": "^7.0.2",
32
+ "eslint": "^6.8.0",
33
+ "eslint-config-prettier": "^6.7.0",
34
+ "eslint-config-standard": "^14.1.0",
35
+ "eslint-config-standard-react": "^9.2.0",
36
+ "eslint-plugin-import": "^2.18.2",
37
+ "eslint-plugin-node": "^11.0.0",
38
+ "eslint-plugin-prettier": "^3.1.1",
39
+ "eslint-plugin-promise": "^4.2.1",
40
+ "eslint-plugin-react": "^7.17.0",
41
+ "eslint-plugin-standard": "^4.0.1",
42
+ "gh-pages": "^2.2.0",
43
+ "microbundle-crl": "^0.13.10",
44
+ "npm-run-all": "^4.1.5",
45
+ "prettier": "^2.0.4",
46
+ "react": "^16.13.1",
47
+ "react-dom": "^16.13.1",
48
+ "react-scripts": "^3.4.1"
49
+ },
50
+ "files": [
51
+ "dist"
52
+ ],
53
+ "dependencies": {
54
+ "react-feather": "^2.0.10"
55
+ },
56
+ "publishConfig": {
57
+ "@shauryabahuguna-tmpl:registry": "https://npm.pkg.github.com"
58
+ }
59
+ }