@searchcraft/react-sdk 0.1.2 → 0.1.4
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 +108 -54
- package/dist/index.d.ts +43 -12
- package/dist/index.js +621 -414
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,181 +1,193 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
var
|
|
4
|
-
class
|
|
5
|
-
constructor(
|
|
6
|
-
if (N(this, "config"), N(this, "search", async (
|
|
1
|
+
import { jsx as t, jsxs as u, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Y, useContext as V, useState as y, useMemo as U, useEffect as tt, useCallback as at } from "react";
|
|
3
|
+
var st = Object.defineProperty, ct = (n, e, i) => e in n ? st(n, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : n[e] = i, N = (n, e, i) => ct(n, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
class yn {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
if (N(this, "config"), N(this, "search", async (i) => {
|
|
7
7
|
try {
|
|
8
|
-
const
|
|
9
|
-
query:
|
|
10
|
-
mode:
|
|
11
|
-
app:
|
|
12
|
-
},
|
|
8
|
+
const a = this.config.index.join(","), c = `${this.config.endpointURL}/search`, r = {
|
|
9
|
+
query: i.query,
|
|
10
|
+
mode: i.mode,
|
|
11
|
+
app: a
|
|
12
|
+
}, s = {
|
|
13
13
|
method: "POST",
|
|
14
14
|
headers: {
|
|
15
15
|
"Content-Type": "application/json",
|
|
16
|
-
"Access-Control-Allow-Origin": "*",
|
|
17
16
|
Authorization: this.config.apiKey ? `${this.config.apiKey}` : ""
|
|
18
17
|
},
|
|
19
18
|
body: JSON.stringify(r)
|
|
20
19
|
};
|
|
21
|
-
return await (await fetch(
|
|
22
|
-
} catch (
|
|
23
|
-
return
|
|
20
|
+
return await (await fetch(c, s)).json();
|
|
21
|
+
} catch (a) {
|
|
22
|
+
return a;
|
|
24
23
|
}
|
|
25
|
-
}), !
|
|
24
|
+
}), !e.endpointURL || !e.index)
|
|
26
25
|
throw new Error("Endpoint URL and Index value(s) must be provided");
|
|
27
|
-
this.config =
|
|
26
|
+
this.config = e;
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
|
|
29
|
+
var _ = /* @__PURE__ */ ((n) => (n[n.DEBUG = 0] = "DEBUG", n[n.INFO = 1] = "INFO", n[n.WARN = 2] = "WARN", n[n.ERROR = 3] = "ERROR", n))(_ || {});
|
|
30
|
+
class ht {
|
|
31
|
+
constructor(e) {
|
|
32
|
+
N(this, "logLevel"), N(this, "logFormatter"), this.logLevel = e.logLevel || 1, this.logFormatter = e.logFormatter || this.defaultFormatter;
|
|
33
|
+
}
|
|
34
|
+
defaultFormatter(e, i) {
|
|
35
|
+
return `[${_[e]}] ${(/* @__PURE__ */ new Date()).toISOString()}: ${i}`;
|
|
36
|
+
}
|
|
37
|
+
debug(e) {
|
|
38
|
+
this.logLevel <= 0 && console.log(this.logFormatter(0, e));
|
|
39
|
+
}
|
|
40
|
+
info(e) {
|
|
41
|
+
this.logLevel <= 1 && console.info(this.logFormatter(1, e));
|
|
42
|
+
}
|
|
43
|
+
warn(e) {
|
|
44
|
+
this.logLevel <= 2 && console.warn(this.logFormatter(2, e));
|
|
45
|
+
}
|
|
46
|
+
error(e) {
|
|
47
|
+
this.logLevel <= 3 && console.error(this.logFormatter(3, e));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const lt = {
|
|
31
51
|
error: null,
|
|
32
52
|
index: [""],
|
|
33
53
|
isRequesting: !1,
|
|
34
54
|
mode: "fuzzy",
|
|
35
55
|
query: "",
|
|
36
|
-
setQuery: (
|
|
56
|
+
setQuery: (n) => n,
|
|
37
57
|
search: async () => null
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
|
|
58
|
+
}, nt = Y(lt), et = Y(
|
|
59
|
+
void 0
|
|
60
|
+
), ut = ({
|
|
61
|
+
children: n,
|
|
62
|
+
searchcraft: e,
|
|
63
|
+
debug: i = !1
|
|
41
64
|
}) => {
|
|
42
|
-
const [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
65
|
+
const [a, c] = y(""), [r, s] = y(!1), [l, o] = y(null), [p, m] = y("light"), h = U(() => i ? new ht({ logLevel: _.DEBUG }) : null, [i]), d = (v, I) => {
|
|
66
|
+
if (h)
|
|
67
|
+
switch (v) {
|
|
68
|
+
case _.DEBUG:
|
|
69
|
+
h.debug(I);
|
|
70
|
+
break;
|
|
71
|
+
case _.INFO:
|
|
72
|
+
h.info(I);
|
|
73
|
+
break;
|
|
74
|
+
case _.WARN:
|
|
75
|
+
h.warn(I);
|
|
76
|
+
break;
|
|
77
|
+
case _.ERROR:
|
|
78
|
+
h.error(I);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}, R = async () => {
|
|
82
|
+
d(_.INFO, `Starting search with query: "${a}"`), s(!0);
|
|
83
|
+
try {
|
|
84
|
+
const v = await e.search({ query: a, mode: "fuzzy" });
|
|
85
|
+
o(v), d(_.DEBUG, `Search results: ${JSON.stringify(v)}`);
|
|
86
|
+
} catch (v) {
|
|
87
|
+
d(
|
|
88
|
+
_.ERROR,
|
|
89
|
+
`Search failed with error: ${v.message}`
|
|
90
|
+
);
|
|
91
|
+
} finally {
|
|
92
|
+
s(!1);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
tt(() => (d(_.INFO, "SearchcraftProvider mounted."), () => {
|
|
96
|
+
d(_.INFO, "SearchcraftProvider unmounted.");
|
|
97
|
+
}), [h]);
|
|
98
|
+
const F = {
|
|
47
99
|
error: null,
|
|
48
|
-
index:
|
|
49
|
-
isRequesting:
|
|
100
|
+
index: e.config.index,
|
|
101
|
+
isRequesting: r,
|
|
50
102
|
mode: "fuzzy",
|
|
51
|
-
query:
|
|
52
|
-
search:
|
|
53
|
-
searchResults:
|
|
54
|
-
setQuery:
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
103
|
+
query: a,
|
|
104
|
+
search: R,
|
|
105
|
+
searchResults: l,
|
|
106
|
+
setQuery: c
|
|
107
|
+
}, k = at(() => {
|
|
108
|
+
m((v) => v === "light" ? "dark" : "light");
|
|
109
|
+
}, []), ot = U(
|
|
110
|
+
() => ({
|
|
111
|
+
theme: p,
|
|
112
|
+
toggleTheme: k
|
|
113
|
+
}),
|
|
114
|
+
[p, k]
|
|
115
|
+
);
|
|
116
|
+
return /* @__PURE__ */ t(nt.Provider, { value: F, children: /* @__PURE__ */ t(et.Provider, { value: ot, children: n }) });
|
|
117
|
+
}, S = () => {
|
|
118
|
+
const n = V(nt);
|
|
119
|
+
if (!n)
|
|
120
|
+
throw new Error(
|
|
121
|
+
"Searchcraft compound components must be used within Searchcraft.Provider"
|
|
122
|
+
);
|
|
123
|
+
return n;
|
|
124
|
+
}, b = () => {
|
|
125
|
+
const n = V(et);
|
|
126
|
+
if (!n)
|
|
127
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
128
|
+
return n;
|
|
61
129
|
};
|
|
62
|
-
function
|
|
63
|
-
return
|
|
130
|
+
function pt(n) {
|
|
131
|
+
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
64
132
|
}
|
|
65
|
-
var
|
|
133
|
+
var rt = { exports: {} };
|
|
66
134
|
/*!
|
|
67
135
|
Copyright (c) 2018 Jed Watson.
|
|
68
136
|
Licensed under the MIT License (MIT), see
|
|
69
137
|
http://jedwatson.github.io/classnames
|
|
70
138
|
*/
|
|
71
|
-
(function(
|
|
139
|
+
(function(n) {
|
|
72
140
|
(function() {
|
|
73
|
-
var
|
|
74
|
-
function
|
|
75
|
-
for (var r = "",
|
|
76
|
-
var l = arguments[
|
|
77
|
-
l && (r =
|
|
141
|
+
var e = {}.hasOwnProperty;
|
|
142
|
+
function i() {
|
|
143
|
+
for (var r = "", s = 0; s < arguments.length; s++) {
|
|
144
|
+
var l = arguments[s];
|
|
145
|
+
l && (r = c(r, a(l)));
|
|
78
146
|
}
|
|
79
147
|
return r;
|
|
80
148
|
}
|
|
81
|
-
function
|
|
149
|
+
function a(r) {
|
|
82
150
|
if (typeof r == "string" || typeof r == "number")
|
|
83
151
|
return r;
|
|
84
152
|
if (typeof r != "object")
|
|
85
153
|
return "";
|
|
86
154
|
if (Array.isArray(r))
|
|
87
|
-
return
|
|
155
|
+
return i.apply(null, r);
|
|
88
156
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
89
157
|
return r.toString();
|
|
90
|
-
var
|
|
158
|
+
var s = "";
|
|
91
159
|
for (var l in r)
|
|
92
|
-
|
|
93
|
-
return
|
|
160
|
+
e.call(r, l) && r[l] && (s = c(s, l));
|
|
161
|
+
return s;
|
|
94
162
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
163
|
+
function c(r, s) {
|
|
164
|
+
return s ? r ? r + " " + s : r + s : r;
|
|
97
165
|
}
|
|
98
|
-
|
|
166
|
+
n.exports ? (i.default = i, n.exports = i) : window.classNames = i;
|
|
99
167
|
})();
|
|
100
|
-
})(
|
|
101
|
-
var
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
o && /* @__PURE__ */ n(
|
|
124
|
-
"button",
|
|
125
|
-
{
|
|
126
|
-
className: p(
|
|
127
|
-
b.button,
|
|
128
|
-
t,
|
|
129
|
-
".searchcraft-button"
|
|
130
|
-
),
|
|
131
|
-
onClick: r,
|
|
132
|
-
type: "submit",
|
|
133
|
-
children: e ? /* @__PURE__ */ n(I, {}) : a
|
|
134
|
-
}
|
|
135
|
-
),
|
|
136
|
-
!o && /* @__PURE__ */ u(
|
|
137
|
-
"button",
|
|
138
|
-
{
|
|
139
|
-
className: p(
|
|
140
|
-
b.button,
|
|
141
|
-
t,
|
|
142
|
-
".searchcraft-button"
|
|
143
|
-
),
|
|
144
|
-
onClick: r,
|
|
145
|
-
type: "submit",
|
|
146
|
-
children: [
|
|
147
|
-
s === "left" && e ? /* @__PURE__ */ n("div", { className: b.spinnerMarginRight, children: /* @__PURE__ */ n(I, {}) }) : a,
|
|
148
|
-
/* @__PURE__ */ n(
|
|
149
|
-
"span",
|
|
150
|
-
{
|
|
151
|
-
className: p(
|
|
152
|
-
e && b.buttonLabel,
|
|
153
|
-
t,
|
|
154
|
-
".searchcraft-button-label"
|
|
155
|
-
),
|
|
156
|
-
children: i
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
s === "right" && e ? /* @__PURE__ */ n("div", { className: b.spinnerMarginLeft, children: /* @__PURE__ */ n(I, {}) }) : a
|
|
160
|
-
]
|
|
161
|
-
}
|
|
162
|
-
)
|
|
163
|
-
] });
|
|
164
|
-
}, un = "_errorMessage_12dc9_5", pn = {
|
|
165
|
-
errorMessage: un
|
|
166
|
-
}, hn = ({ className: t, errorMessage: a }) => /* @__PURE__ */ n("p", { className: p(pn.errorMessage, t), children: a || "Search term is required." }), dn = "_inputContainerLTR_s1rq8_5", _n = "_inputContainerRTL_s1rq8_9", Cn = "_inputLTR_s1rq8_14", fn = "_inputRTL_s1rq8_35", mn = "_inputErrorLTR_s1rq8_57", Ln = "_inputErrorRTL_s1rq8_82", m = {
|
|
167
|
-
inputContainerLTR: dn,
|
|
168
|
-
inputContainerRTL: _n,
|
|
169
|
-
inputLTR: Cn,
|
|
170
|
-
inputRTL: fn,
|
|
171
|
-
inputErrorLTR: mn,
|
|
172
|
-
inputErrorRTL: Ln
|
|
173
|
-
}, Rn = "_inputClearButtonLTR_t63ei_5", bn = "_inputClearButtonRTL_t63ei_19", E = {
|
|
174
|
-
inputClearButtonLTR: Rn,
|
|
175
|
-
inputClearButtonRTL: bn
|
|
176
|
-
}, M = () => /* @__PURE__ */ u("svg", { width: "22", height: "22", viewBox: "0 0 22 22", fill: "none", children: [
|
|
177
|
-
/* @__PURE__ */ n("title", { children: "Searchcraft Clear Input Icon" }),
|
|
178
|
-
/* @__PURE__ */ n(
|
|
168
|
+
})(rt);
|
|
169
|
+
var gt = rt.exports;
|
|
170
|
+
const L = /* @__PURE__ */ pt(gt), Lt = "_formLTR_dvuqa_5", dt = "_formRTL_dvuqa_9", _t = "_searchContainer_dvuqa_13", D = {
|
|
171
|
+
formLTR: Lt,
|
|
172
|
+
formRTL: dt,
|
|
173
|
+
searchContainer: _t
|
|
174
|
+
}, ft = "_inputContainerLTR_1nio0_5", mt = "_inputContainerRTL_1nio0_9", Ct = "_inputLightLTR_1nio0_14", Rt = "_inputDarkLTR_1nio0_38", kt = "_inputErrorLightLTR_1nio0_62", vt = "_inputErrorDarkLTR_1nio0_90", Tt = "_inputLightRTL_1nio0_118", bt = "_inputDarkRTL_1nio0_143", yt = "_inputErrorLightRTL_1nio0_168", Dt = "_inputErrorDarkRTL_1nio0_197", C = {
|
|
175
|
+
inputContainerLTR: ft,
|
|
176
|
+
inputContainerRTL: mt,
|
|
177
|
+
inputLightLTR: Ct,
|
|
178
|
+
inputDarkLTR: Rt,
|
|
179
|
+
inputErrorLightLTR: kt,
|
|
180
|
+
inputErrorDarkLTR: vt,
|
|
181
|
+
inputLightRTL: Tt,
|
|
182
|
+
inputDarkRTL: bt,
|
|
183
|
+
inputErrorLightRTL: yt,
|
|
184
|
+
inputErrorDarkRTL: Dt
|
|
185
|
+
}, St = "_inputClearButtonLTR_t63ei_5", It = "_inputClearButtonRTL_t63ei_19", z = {
|
|
186
|
+
inputClearButtonLTR: St,
|
|
187
|
+
inputClearButtonRTL: It
|
|
188
|
+
}, Z = () => /* @__PURE__ */ u("svg", { width: "22", height: "22", viewBox: "0 0 22 22", fill: "none", children: [
|
|
189
|
+
/* @__PURE__ */ t("title", { children: "Searchcraft Clear Input Icon Light" }),
|
|
190
|
+
/* @__PURE__ */ t(
|
|
179
191
|
"path",
|
|
180
192
|
{
|
|
181
193
|
d: "M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z",
|
|
@@ -185,9 +197,31 @@ const p = /* @__PURE__ */ Y(O), nn = "_button_8jqm2_5", tn = "_spinnerMarginRigh
|
|
|
185
197
|
strokeLinejoin: "round"
|
|
186
198
|
}
|
|
187
199
|
)
|
|
188
|
-
] }),
|
|
189
|
-
|
|
190
|
-
|
|
200
|
+
] }), G = () => /* @__PURE__ */ u(
|
|
201
|
+
"svg",
|
|
202
|
+
{
|
|
203
|
+
width: "22",
|
|
204
|
+
height: "22",
|
|
205
|
+
viewBox: "0 0 22 22",
|
|
206
|
+
fill: "none",
|
|
207
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ t("title", { children: "Searchcraft Clear Input Icon Dark" }),
|
|
210
|
+
/* @__PURE__ */ t(
|
|
211
|
+
"path",
|
|
212
|
+
{
|
|
213
|
+
d: "M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z",
|
|
214
|
+
stroke: "white",
|
|
215
|
+
strokeWidth: "1.5",
|
|
216
|
+
strokeLinecap: "round",
|
|
217
|
+
strokeLinejoin: "round"
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
), Q = () => /* @__PURE__ */ u("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", children: [
|
|
223
|
+
/* @__PURE__ */ t("title", { children: "Searchcraft Arrow Right Icon Light" }),
|
|
224
|
+
/* @__PURE__ */ t(
|
|
191
225
|
"path",
|
|
192
226
|
{
|
|
193
227
|
d: "M7.5 15.0444L12.5 10.0444L7.5 5.04443",
|
|
@@ -197,68 +231,104 @@ const p = /* @__PURE__ */ Y(O), nn = "_button_8jqm2_5", tn = "_spinnerMarginRigh
|
|
|
197
231
|
strokeLinejoin: "round"
|
|
198
232
|
}
|
|
199
233
|
)
|
|
200
|
-
] }),
|
|
201
|
-
|
|
202
|
-
|
|
234
|
+
] }), K = () => /* @__PURE__ */ u(
|
|
235
|
+
"svg",
|
|
236
|
+
{
|
|
237
|
+
width: "8",
|
|
238
|
+
height: "12",
|
|
239
|
+
viewBox: "0 0 8 12",
|
|
240
|
+
fill: "none",
|
|
241
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
242
|
+
children: [
|
|
243
|
+
/* @__PURE__ */ t("title", { children: "Searchcraft Arrow Right Icon Dark" }),
|
|
244
|
+
/* @__PURE__ */ t(
|
|
245
|
+
"path",
|
|
246
|
+
{
|
|
247
|
+
d: "M1.5 11L6.5 6L1.5 1",
|
|
248
|
+
stroke: "#BFBFBF",
|
|
249
|
+
strokeWidth: "1.5",
|
|
250
|
+
strokeLinecap: "round",
|
|
251
|
+
strokeLinejoin: "round"
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
), wt = "_spinnerContainer_1noam_1", Et = "_spinnerDark_1noam_7", Nt = "_spinning_1noam_1", xt = "_spinnerLight_1noam_16", x = {
|
|
257
|
+
spinnerContainer: wt,
|
|
258
|
+
spinnerDark: Et,
|
|
259
|
+
spinning: Nt,
|
|
260
|
+
spinnerLight: xt
|
|
261
|
+
}, J = () => /* @__PURE__ */ t("div", { className: x.spinnerContainer, children: /* @__PURE__ */ t("div", { className: x.spinnerLight }) }), B = () => /* @__PURE__ */ t("div", { className: x.spinnerContainer, children: /* @__PURE__ */ t("div", { className: x.spinnerDark }) }), $ = ({
|
|
262
|
+
onClearInput: n,
|
|
263
|
+
rightToLeftOrientation: e = !1
|
|
203
264
|
}) => {
|
|
204
|
-
const { isRequesting:
|
|
205
|
-
return
|
|
265
|
+
const { isRequesting: i } = S(), { theme: a } = b(), c = a === "light";
|
|
266
|
+
return e ? /* @__PURE__ */ t(
|
|
206
267
|
"button",
|
|
207
268
|
{
|
|
208
|
-
className:
|
|
209
|
-
|
|
269
|
+
className: L(
|
|
270
|
+
z.inputClearButtonRTL,
|
|
210
271
|
".sc-clear-input-button-rtl"
|
|
211
272
|
),
|
|
212
|
-
onClick:
|
|
273
|
+
onClick: n,
|
|
213
274
|
type: "button",
|
|
214
|
-
children:
|
|
275
|
+
children: i ? c ? /* @__PURE__ */ t(J, {}) : /* @__PURE__ */ t(B, {}) : c ? /* @__PURE__ */ t(Z, {}) : /* @__PURE__ */ t(G, {})
|
|
215
276
|
}
|
|
216
|
-
) : /* @__PURE__ */
|
|
277
|
+
) : /* @__PURE__ */ t(
|
|
217
278
|
"button",
|
|
218
279
|
{
|
|
219
|
-
className:
|
|
220
|
-
|
|
280
|
+
className: L(
|
|
281
|
+
z.inputClearButtonLTR,
|
|
221
282
|
".sc-clear-input-button-ltr"
|
|
222
283
|
),
|
|
223
|
-
onClick:
|
|
284
|
+
onClick: n,
|
|
224
285
|
type: "button",
|
|
225
|
-
children:
|
|
286
|
+
children: i ? c ? /* @__PURE__ */ t(J, {}) : /* @__PURE__ */ t(B, {}) : c ? /* @__PURE__ */ t(Z, {}) : /* @__PURE__ */ t(G, {})
|
|
226
287
|
}
|
|
227
288
|
);
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
289
|
+
}, Bt = "_inputCaptionLightLTR_f6rxj_5", Mt = "_inputCaptionDarkLTR_f6rxj_14", Ft = "_inputCaptionErrorLightLTR_f6rxj_23", jt = "_inputCaptionErrorDarkLTR_f6rxj_32", $t = "_inputCaptionLightRTL_f6rxj_41", qt = "_inputCaptionDarkRTL_f6rxj_51", At = "_inputCaptionErrorLightRTL_f6rxj_61", Pt = "_inputCaptionErrorDarkRTL_f6rxj_71", T = {
|
|
290
|
+
inputCaptionLightLTR: Bt,
|
|
291
|
+
inputCaptionDarkLTR: Mt,
|
|
292
|
+
inputCaptionErrorLightLTR: Ft,
|
|
293
|
+
inputCaptionErrorDarkLTR: jt,
|
|
294
|
+
inputCaptionLightRTL: $t,
|
|
295
|
+
inputCaptionDarkRTL: qt,
|
|
296
|
+
inputCaptionErrorLightRTL: At,
|
|
297
|
+
inputCaptionErrorDarkRTL: Pt
|
|
298
|
+
}, q = ({
|
|
299
|
+
error: n = !1,
|
|
300
|
+
inputCaptionClassName: e,
|
|
301
|
+
inputCaptionValue: i = "Enter Search",
|
|
302
|
+
rightToLeftOrientation: a = !1
|
|
303
|
+
}) => {
|
|
304
|
+
const { theme: c } = b(), r = c === "light";
|
|
305
|
+
return a ? /* @__PURE__ */ t(
|
|
306
|
+
"p",
|
|
307
|
+
{
|
|
308
|
+
className: L(
|
|
309
|
+
n ? r ? T.inputCaptionErrorLightRTL : T.inputCaptionErrorDarkRTL : r ? T.inputCaptionLightRTL : T.inputCaptionDarkRTL,
|
|
310
|
+
e,
|
|
311
|
+
".searchcraft-input-caption"
|
|
312
|
+
),
|
|
313
|
+
children: i
|
|
314
|
+
}
|
|
315
|
+
) : /* @__PURE__ */ t(
|
|
316
|
+
"p",
|
|
317
|
+
{
|
|
318
|
+
className: L(
|
|
319
|
+
n ? r ? T.inputCaptionErrorLightLTR : T.inputCaptionErrorDarkLTR : r ? T.inputCaptionLightLTR : T.inputCaptionDarkLTR,
|
|
320
|
+
e,
|
|
321
|
+
".searchcraft-input-caption"
|
|
322
|
+
),
|
|
323
|
+
children: i
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}, Wt = "_inputIconLTR_cusap_5", Ot = "_inputIconRTL_cusap_13", w = {
|
|
327
|
+
inputIconLTR: Wt,
|
|
328
|
+
inputIconRTL: Ot
|
|
329
|
+
}, Ut = () => /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
|
|
330
|
+
/* @__PURE__ */ t("title", { children: "Searchcraft Search Icon Light" }),
|
|
331
|
+
/* @__PURE__ */ t(
|
|
262
332
|
"path",
|
|
263
333
|
{
|
|
264
334
|
d: "M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z",
|
|
@@ -268,9 +338,31 @@ const p = /* @__PURE__ */ Y(O), nn = "_button_8jqm2_5", tn = "_spinnerMarginRigh
|
|
|
268
338
|
strokeLinejoin: "round"
|
|
269
339
|
}
|
|
270
340
|
)
|
|
271
|
-
] }),
|
|
272
|
-
|
|
273
|
-
|
|
341
|
+
] }), zt = () => /* @__PURE__ */ u(
|
|
342
|
+
"svg",
|
|
343
|
+
{
|
|
344
|
+
width: "18",
|
|
345
|
+
height: "18",
|
|
346
|
+
viewBox: "0 0 18 18",
|
|
347
|
+
fill: "none",
|
|
348
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
349
|
+
children: [
|
|
350
|
+
/* @__PURE__ */ t("title", { children: "Searchcraft Search Icon Dark" }),
|
|
351
|
+
/* @__PURE__ */ t(
|
|
352
|
+
"path",
|
|
353
|
+
{
|
|
354
|
+
d: "M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z",
|
|
355
|
+
stroke: "#E6E6E6",
|
|
356
|
+
strokeWidth: "1.5",
|
|
357
|
+
strokeLinecap: "round",
|
|
358
|
+
strokeLinejoin: "round"
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
]
|
|
362
|
+
}
|
|
363
|
+
), Zt = () => /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
|
|
364
|
+
/* @__PURE__ */ t("title", { children: "Searchcraft Error Search Icon Light" }),
|
|
365
|
+
/* @__PURE__ */ t(
|
|
274
366
|
"path",
|
|
275
367
|
{
|
|
276
368
|
d: "M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z",
|
|
@@ -280,216 +372,207 @@ const p = /* @__PURE__ */ Y(O), nn = "_button_8jqm2_5", tn = "_spinnerMarginRigh
|
|
|
280
372
|
strokeLinejoin: "round"
|
|
281
373
|
}
|
|
282
374
|
)
|
|
283
|
-
] }),
|
|
284
|
-
|
|
285
|
-
rightToLeftOrientation: a = !1
|
|
286
|
-
}) => t ? /* @__PURE__ */ n(
|
|
287
|
-
"div",
|
|
288
|
-
{
|
|
289
|
-
className: a ? y.inputIconRTL : y.inputIconLTR,
|
|
290
|
-
children: /* @__PURE__ */ n(Nn, {})
|
|
291
|
-
}
|
|
292
|
-
) : /* @__PURE__ */ n(
|
|
293
|
-
"div",
|
|
375
|
+
] }), Gt = () => /* @__PURE__ */ u(
|
|
376
|
+
"svg",
|
|
294
377
|
{
|
|
295
|
-
|
|
296
|
-
|
|
378
|
+
width: "18",
|
|
379
|
+
height: "18",
|
|
380
|
+
viewBox: "0 0 18 18",
|
|
381
|
+
fill: "none",
|
|
382
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
383
|
+
children: [
|
|
384
|
+
/* @__PURE__ */ t("title", { children: "Searchcraft Error Search Icon Dark" }),
|
|
385
|
+
/* @__PURE__ */ t(
|
|
386
|
+
"path",
|
|
387
|
+
{
|
|
388
|
+
d: "M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z",
|
|
389
|
+
stroke: "#BFBFBF",
|
|
390
|
+
strokeWidth: "1.5",
|
|
391
|
+
strokeLinecap: "round",
|
|
392
|
+
strokeLinejoin: "round"
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
]
|
|
297
396
|
}
|
|
298
397
|
), A = ({
|
|
299
|
-
error:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
398
|
+
error: n = !1,
|
|
399
|
+
rightToLeftOrientation: e = !1
|
|
400
|
+
}) => {
|
|
401
|
+
const { theme: i } = b(), a = i === "light";
|
|
402
|
+
return n ? /* @__PURE__ */ t(
|
|
403
|
+
"div",
|
|
404
|
+
{
|
|
405
|
+
className: e ? w.inputIconRTL : w.inputIconLTR,
|
|
406
|
+
children: a ? /* @__PURE__ */ t(Zt, {}) : /* @__PURE__ */ t(Gt, {})
|
|
407
|
+
}
|
|
408
|
+
) : /* @__PURE__ */ t(
|
|
409
|
+
"div",
|
|
410
|
+
{
|
|
411
|
+
className: e ? w.inputIconRTL : w.inputIconLTR,
|
|
412
|
+
children: a ? /* @__PURE__ */ t(Ut, {}) : /* @__PURE__ */ t(zt, {})
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
}, P = ({
|
|
416
|
+
error: n = !1,
|
|
417
|
+
formClassName: e = "",
|
|
418
|
+
inputCaptionClassName: i = "",
|
|
419
|
+
inputClassName: a = "",
|
|
420
|
+
inputCaptionValue: c = "",
|
|
304
421
|
onClearInput: r,
|
|
305
|
-
onSearchInputChange:
|
|
422
|
+
onSearchInputChange: s,
|
|
306
423
|
placeholderValue: l = "Enter Search",
|
|
307
|
-
rightToLeftOrientation:
|
|
308
|
-
query:
|
|
424
|
+
rightToLeftOrientation: o = !1,
|
|
425
|
+
query: p = ""
|
|
309
426
|
}) => {
|
|
310
|
-
const
|
|
311
|
-
return /* @__PURE__ */
|
|
427
|
+
const { theme: m } = b(), h = m === "light", d = o ? C.inputContainerRTL : C.inputContainerLTR;
|
|
428
|
+
return /* @__PURE__ */ t(
|
|
312
429
|
"div",
|
|
313
430
|
{
|
|
314
|
-
className:
|
|
315
|
-
|
|
316
|
-
|
|
431
|
+
className: L(
|
|
432
|
+
d,
|
|
433
|
+
e,
|
|
317
434
|
"searchcraft-input-form"
|
|
318
435
|
),
|
|
319
|
-
children:
|
|
320
|
-
/* @__PURE__ */
|
|
436
|
+
children: o ? /* @__PURE__ */ u(j, { children: [
|
|
437
|
+
/* @__PURE__ */ t(
|
|
321
438
|
"input",
|
|
322
439
|
{
|
|
323
|
-
className:
|
|
324
|
-
|
|
325
|
-
|
|
440
|
+
className: L(
|
|
441
|
+
n ? h ? C.inputErrorLightRTL : C.inputErrorDarkRTL : h ? C.inputLightRTL : C.inputDarkRTL,
|
|
442
|
+
a,
|
|
326
443
|
"searchcraft-input"
|
|
327
444
|
),
|
|
328
445
|
id: "searchcraft-input-id",
|
|
329
|
-
onChange:
|
|
446
|
+
onChange: s,
|
|
330
447
|
placeholder: l,
|
|
331
448
|
type: "text",
|
|
332
|
-
value:
|
|
449
|
+
value: p
|
|
333
450
|
}
|
|
334
451
|
),
|
|
335
|
-
|
|
336
|
-
|
|
452
|
+
c && /* @__PURE__ */ t(
|
|
453
|
+
q,
|
|
337
454
|
{
|
|
338
|
-
inputCaptionClassName:
|
|
339
|
-
inputCaptionValue:
|
|
340
|
-
rightToLeftOrientation:
|
|
455
|
+
inputCaptionClassName: i,
|
|
456
|
+
inputCaptionValue: c,
|
|
457
|
+
rightToLeftOrientation: o
|
|
341
458
|
}
|
|
342
459
|
),
|
|
343
|
-
|
|
344
|
-
|
|
460
|
+
p.length > 0 && /* @__PURE__ */ t(
|
|
461
|
+
$,
|
|
345
462
|
{
|
|
346
463
|
onClearInput: r,
|
|
347
|
-
rightToLeftOrientation:
|
|
464
|
+
rightToLeftOrientation: o
|
|
348
465
|
}
|
|
349
466
|
),
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
|
|
467
|
+
/* @__PURE__ */ t(
|
|
468
|
+
A,
|
|
352
469
|
{
|
|
353
|
-
error:
|
|
354
|
-
rightToLeftOrientation:
|
|
470
|
+
error: n,
|
|
471
|
+
rightToLeftOrientation: o
|
|
355
472
|
}
|
|
356
473
|
)
|
|
357
|
-
] }) : /* @__PURE__ */ u(
|
|
358
|
-
/* @__PURE__ */
|
|
474
|
+
] }) : /* @__PURE__ */ u(j, { children: [
|
|
475
|
+
/* @__PURE__ */ t(
|
|
359
476
|
"input",
|
|
360
477
|
{
|
|
361
|
-
className:
|
|
362
|
-
|
|
363
|
-
|
|
478
|
+
className: L(
|
|
479
|
+
n ? h ? C.inputErrorLightLTR : C.inputErrorDarkLTR : h ? C.inputLightLTR : C.inputDarkLTR,
|
|
480
|
+
a,
|
|
364
481
|
"searchcraft-input"
|
|
365
482
|
),
|
|
366
483
|
id: "searchcraft-input-id",
|
|
367
|
-
onChange:
|
|
484
|
+
onChange: s,
|
|
368
485
|
placeholder: l,
|
|
369
486
|
type: "text",
|
|
370
|
-
value:
|
|
487
|
+
value: p
|
|
371
488
|
}
|
|
372
489
|
),
|
|
373
|
-
|
|
374
|
-
|
|
490
|
+
c && /* @__PURE__ */ t(
|
|
491
|
+
q,
|
|
375
492
|
{
|
|
376
|
-
inputCaptionClassName:
|
|
377
|
-
inputCaptionValue:
|
|
378
|
-
rightToLeftOrientation:
|
|
493
|
+
inputCaptionClassName: i,
|
|
494
|
+
inputCaptionValue: c,
|
|
495
|
+
rightToLeftOrientation: o
|
|
379
496
|
}
|
|
380
497
|
),
|
|
381
|
-
|
|
382
|
-
|
|
498
|
+
p.length > 0 && /* @__PURE__ */ t(
|
|
499
|
+
$,
|
|
383
500
|
{
|
|
384
501
|
onClearInput: r,
|
|
385
|
-
rightToLeftOrientation:
|
|
502
|
+
rightToLeftOrientation: o
|
|
386
503
|
}
|
|
387
504
|
),
|
|
388
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ t(A, { error: n })
|
|
389
506
|
] })
|
|
390
507
|
}
|
|
391
508
|
);
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
"label",
|
|
399
|
-
{
|
|
400
|
-
className: p(wn.label, t),
|
|
401
|
-
htmlFor: "searchcraft-input-id",
|
|
402
|
-
children: a
|
|
403
|
-
}
|
|
404
|
-
), Vn = ({
|
|
405
|
-
errorMessage: t,
|
|
406
|
-
handleSubmit: a,
|
|
407
|
-
labelForInput: o = "Search",
|
|
408
|
-
placeholderValue: s = "Enter Search Term",
|
|
409
|
-
rightToLeftOrientation: i = !1
|
|
509
|
+
}, Qt = "_labelLight_14iga_5", Kt = "_labelDark_14iga_14", H = {
|
|
510
|
+
labelLight: Qt,
|
|
511
|
+
labelDark: Kt
|
|
512
|
+
}, W = ({
|
|
513
|
+
className: n,
|
|
514
|
+
label: e = "Enter Search"
|
|
410
515
|
}) => {
|
|
411
|
-
const {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
return /* @__PURE__ */ u(
|
|
415
|
-
"form",
|
|
516
|
+
const { theme: i } = b(), a = i === "light" ? H.labelLight : H.labelDark;
|
|
517
|
+
return /* @__PURE__ */ t(
|
|
518
|
+
"label",
|
|
416
519
|
{
|
|
417
|
-
className:
|
|
418
|
-
|
|
419
|
-
children:
|
|
420
|
-
/* @__PURE__ */ n(z, { label: o }),
|
|
421
|
-
/* @__PURE__ */ u("div", { className: L.searchContainer, children: [
|
|
422
|
-
i && /* @__PURE__ */ n(w, {}),
|
|
423
|
-
/* @__PURE__ */ n(
|
|
424
|
-
A,
|
|
425
|
-
{
|
|
426
|
-
error: l,
|
|
427
|
-
onClearInput: f,
|
|
428
|
-
onSearchInputChange: _,
|
|
429
|
-
placeholderValue: s,
|
|
430
|
-
query: r,
|
|
431
|
-
rightToLeftOrientation: i
|
|
432
|
-
}
|
|
433
|
-
),
|
|
434
|
-
!i && /* @__PURE__ */ n(w, {})
|
|
435
|
-
] }),
|
|
436
|
-
l && /* @__PURE__ */ n(hn, { errorMessage: t })
|
|
437
|
-
]
|
|
520
|
+
className: L(a, n),
|
|
521
|
+
htmlFor: "searchcraft-input-id",
|
|
522
|
+
children: e
|
|
438
523
|
}
|
|
439
524
|
);
|
|
440
|
-
},
|
|
441
|
-
autoSearchFormClass:
|
|
442
|
-
handleSubmit:
|
|
443
|
-
inputCaptionValue:
|
|
444
|
-
labelForInput:
|
|
445
|
-
|
|
525
|
+
}, Jt = ({
|
|
526
|
+
autoSearchFormClass: n = "",
|
|
527
|
+
handleSubmit: e,
|
|
528
|
+
inputCaptionValue: i = "",
|
|
529
|
+
labelForInput: a = "Search",
|
|
530
|
+
onClearInput: c = () => {
|
|
446
531
|
},
|
|
447
532
|
placeholderValue: r = "Search here",
|
|
448
|
-
rightToLeftOrientation:
|
|
533
|
+
rightToLeftOrientation: s = !1,
|
|
449
534
|
searchContainerClass: l = ""
|
|
450
535
|
}) => {
|
|
451
|
-
const { query:
|
|
452
|
-
|
|
453
|
-
},
|
|
454
|
-
|
|
536
|
+
const { query: o, setQuery: p } = S(), [m, h] = y(!1), d = s ? D.formRTL : D.formLTR, R = (k) => {
|
|
537
|
+
k.preventDefault(), p(k.currentTarget.value), o !== k.currentTarget.value && h(!0);
|
|
538
|
+
}, F = () => {
|
|
539
|
+
p(""), c();
|
|
455
540
|
};
|
|
456
|
-
|
|
457
|
-
if (
|
|
458
|
-
|
|
541
|
+
return tt(() => {
|
|
542
|
+
if (m)
|
|
543
|
+
e(o), h(!1);
|
|
459
544
|
else
|
|
460
545
|
return;
|
|
461
|
-
}, [
|
|
462
|
-
const W = e ? L.formRTL : L.formLTR;
|
|
463
|
-
return /* @__PURE__ */ u(
|
|
546
|
+
}, [m, e, o]), /* @__PURE__ */ u(
|
|
464
547
|
"form",
|
|
465
548
|
{
|
|
466
|
-
className:
|
|
467
|
-
|
|
468
|
-
|
|
549
|
+
className: L(
|
|
550
|
+
d,
|
|
551
|
+
n,
|
|
469
552
|
"searchcraft-auto-search-form"
|
|
470
553
|
),
|
|
471
|
-
onSubmit: (
|
|
472
|
-
|
|
554
|
+
onSubmit: (k) => {
|
|
555
|
+
k.preventDefault();
|
|
473
556
|
},
|
|
474
557
|
children: [
|
|
475
|
-
/* @__PURE__ */
|
|
476
|
-
/* @__PURE__ */
|
|
558
|
+
/* @__PURE__ */ t(W, { label: a }),
|
|
559
|
+
/* @__PURE__ */ t(
|
|
477
560
|
"div",
|
|
478
561
|
{
|
|
479
|
-
className:
|
|
480
|
-
|
|
562
|
+
className: L(
|
|
563
|
+
D.searchContainer,
|
|
481
564
|
l,
|
|
482
565
|
"searchcraft-input-container"
|
|
483
566
|
),
|
|
484
|
-
children: /* @__PURE__ */
|
|
485
|
-
|
|
567
|
+
children: /* @__PURE__ */ t(
|
|
568
|
+
P,
|
|
486
569
|
{
|
|
487
|
-
inputCaptionValue:
|
|
488
|
-
onClearInput:
|
|
489
|
-
onSearchInputChange:
|
|
570
|
+
inputCaptionValue: i,
|
|
571
|
+
onClearInput: F,
|
|
572
|
+
onSearchInputChange: R,
|
|
490
573
|
placeholderValue: r,
|
|
491
|
-
query:
|
|
492
|
-
rightToLeftOrientation:
|
|
574
|
+
query: o,
|
|
575
|
+
rightToLeftOrientation: s
|
|
493
576
|
}
|
|
494
577
|
)
|
|
495
578
|
}
|
|
@@ -497,117 +580,241 @@ const p = /* @__PURE__ */ Y(O), nn = "_button_8jqm2_5", tn = "_spinnerMarginRigh
|
|
|
497
580
|
]
|
|
498
581
|
}
|
|
499
582
|
);
|
|
500
|
-
},
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
583
|
+
}, Ht = "_buttonLight_97gf2_5", Xt = "_buttonDark_97gf2_28", Yt = "_spinnerMarginRight_97gf2_51", Vt = "_spinnerMarginLeft_97gf2_57", tn = "_buttonLabel_97gf2_63", E = {
|
|
584
|
+
buttonLight: Ht,
|
|
585
|
+
buttonDark: Xt,
|
|
586
|
+
spinnerMarginRight: Yt,
|
|
587
|
+
spinnerMarginLeft: Vt,
|
|
588
|
+
buttonLabel: tn,
|
|
589
|
+
"right-and-back": "_right-and-back_97gf2_1"
|
|
590
|
+
}, M = ({
|
|
591
|
+
className: n,
|
|
592
|
+
iconElement: e,
|
|
593
|
+
iconOnly: i = !1,
|
|
594
|
+
iconPosition: a = "left",
|
|
595
|
+
label: c = "Search",
|
|
596
|
+
onClick: r
|
|
597
|
+
}) => {
|
|
598
|
+
const { isRequesting: s } = S(), { theme: l } = b(), o = l === "light" ? E.buttonLight : E.buttonDark;
|
|
599
|
+
return /* @__PURE__ */ u(j, { children: [
|
|
600
|
+
i && /* @__PURE__ */ t(
|
|
601
|
+
"button",
|
|
602
|
+
{
|
|
603
|
+
className: L(o, n, ".searchcraft-button"),
|
|
604
|
+
onClick: r,
|
|
605
|
+
type: "submit",
|
|
606
|
+
children: s ? /* @__PURE__ */ t(B, {}) : e
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
!i && /* @__PURE__ */ u(
|
|
610
|
+
"button",
|
|
611
|
+
{
|
|
612
|
+
className: L(o, n, ".searchcraft-button"),
|
|
613
|
+
onClick: r,
|
|
614
|
+
type: "submit",
|
|
615
|
+
children: [
|
|
616
|
+
a === "left" && s ? /* @__PURE__ */ t("div", { className: E.spinnerMarginRight, children: /* @__PURE__ */ t(B, {}) }) : e,
|
|
617
|
+
/* @__PURE__ */ t(
|
|
618
|
+
"span",
|
|
619
|
+
{
|
|
620
|
+
className: L(
|
|
621
|
+
s && E.buttonLabel,
|
|
622
|
+
n,
|
|
623
|
+
".searchcraft-button-label"
|
|
624
|
+
),
|
|
625
|
+
children: c
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
)
|
|
631
|
+
] });
|
|
632
|
+
}, nn = "_errorMessageLight_1endn_5", en = "_errorMessageDark_1endn_14", X = {
|
|
633
|
+
errorMessageLight: nn,
|
|
634
|
+
errorMessageDark: en
|
|
635
|
+
}, O = ({ className: n, errorMessage: e }) => {
|
|
636
|
+
const { theme: i } = b(), a = i === "light" ? X.errorMessageLight : X.errorMessageDark;
|
|
637
|
+
return /* @__PURE__ */ t("p", { className: L(a, n), children: e || "Search term is required." });
|
|
638
|
+
}, rn = ({
|
|
639
|
+
errorMessage: n,
|
|
640
|
+
handleSubmit: e,
|
|
641
|
+
labelForInput: i = "Search",
|
|
642
|
+
onClearInput: a = () => {
|
|
643
|
+
},
|
|
644
|
+
placeholderValue: c = "Enter Search Term",
|
|
645
|
+
rightToLeftOrientation: r = !1
|
|
646
|
+
}) => {
|
|
647
|
+
const { query: s, setQuery: l } = S(), [o, p] = y(!1), m = (R) => {
|
|
648
|
+
R.preventDefault(), s.trim() === "" ? p(!0) : (p(!1), e(s));
|
|
649
|
+
}, h = (R) => l(R.target.value), d = () => {
|
|
650
|
+
l(""), a();
|
|
651
|
+
};
|
|
652
|
+
return /* @__PURE__ */ u(
|
|
653
|
+
"form",
|
|
504
654
|
{
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
655
|
+
className: r ? D.formRTL : D.formLTR,
|
|
656
|
+
onSubmit: m,
|
|
657
|
+
children: [
|
|
658
|
+
/* @__PURE__ */ t(W, { label: i }),
|
|
659
|
+
/* @__PURE__ */ u("div", { className: D.searchContainer, children: [
|
|
660
|
+
r && /* @__PURE__ */ t(M, {}),
|
|
661
|
+
/* @__PURE__ */ t(
|
|
662
|
+
P,
|
|
663
|
+
{
|
|
664
|
+
error: o,
|
|
665
|
+
onClearInput: d,
|
|
666
|
+
onSearchInputChange: h,
|
|
667
|
+
placeholderValue: c,
|
|
668
|
+
query: s,
|
|
669
|
+
rightToLeftOrientation: r
|
|
670
|
+
}
|
|
671
|
+
),
|
|
672
|
+
!r && /* @__PURE__ */ t(M, {})
|
|
673
|
+
] }),
|
|
674
|
+
o && /* @__PURE__ */ t(O, { errorMessage: n })
|
|
675
|
+
]
|
|
510
676
|
}
|
|
511
|
-
)
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
677
|
+
);
|
|
678
|
+
}, on = "_interactiveResultContainerLight_vyyhe_5", an = "_interactiveResultContainerDark_vyyhe_21", sn = "_resultContainer_vyyhe_37", cn = "_interactiveIconLarge_vyyhe_49", hn = "_interactiveIconSmall_vyyhe_61", ln = "_imageContainer_vyyhe_73", un = "_contentContainer_vyyhe_84", pn = "_imageLight_vyyhe_94", gn = "_imageDark_vyyhe_102", Ln = "_headingLight_vyyhe_110", dn = "_headingDark_vyyhe_121", _n = "_subheadingLight_vyyhe_132", fn = "_subheadingDark_vyyhe_142", mn = "_bodyContentLight_vyyhe_152", Cn = "_bodyContentDark_vyyhe_162", g = {
|
|
679
|
+
interactiveResultContainerLight: on,
|
|
680
|
+
interactiveResultContainerDark: an,
|
|
681
|
+
resultContainer: sn,
|
|
682
|
+
interactiveIconLarge: cn,
|
|
683
|
+
interactiveIconSmall: hn,
|
|
684
|
+
imageContainer: ln,
|
|
685
|
+
contentContainer: un,
|
|
686
|
+
imageLight: pn,
|
|
687
|
+
imageDark: gn,
|
|
688
|
+
headingLight: Ln,
|
|
689
|
+
headingDark: dn,
|
|
690
|
+
subheadingLight: _n,
|
|
691
|
+
subheadingDark: fn,
|
|
692
|
+
bodyContentLight: mn,
|
|
693
|
+
bodyContentDark: Cn
|
|
694
|
+
}, it = ({
|
|
695
|
+
buttonCallbackFn: n = () => {
|
|
526
696
|
},
|
|
527
|
-
buttonLabel:
|
|
528
|
-
callbackFn:
|
|
697
|
+
buttonLabel: e = "",
|
|
698
|
+
callbackFn: i = () => {
|
|
529
699
|
},
|
|
530
|
-
keyDownCallbackFn:
|
|
700
|
+
keyDownCallbackFn: a = () => {
|
|
531
701
|
},
|
|
532
|
-
imageAltText:
|
|
702
|
+
imageAltText: c = "",
|
|
533
703
|
interactiveResult: r = !1,
|
|
534
|
-
imageSrc:
|
|
704
|
+
imageSrc: s = "",
|
|
535
705
|
resultBodyContent: l = "",
|
|
536
|
-
resultHeading:
|
|
537
|
-
resultSubheading:
|
|
706
|
+
resultHeading: o = "",
|
|
707
|
+
resultSubheading: p = ""
|
|
538
708
|
}) => {
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
},
|
|
709
|
+
const { theme: m } = b(), h = m === "light", d = () => {
|
|
710
|
+
n();
|
|
711
|
+
}, R = () => {
|
|
542
712
|
if (r)
|
|
543
|
-
|
|
713
|
+
i();
|
|
544
714
|
else
|
|
545
715
|
return;
|
|
546
716
|
};
|
|
547
717
|
return /* @__PURE__ */ u(
|
|
548
718
|
"div",
|
|
549
719
|
{
|
|
550
|
-
className: r ?
|
|
720
|
+
className: r ? h ? g.interactiveResultContainerLight : g.interactiveResultContainerDark : g.resultContainer,
|
|
551
721
|
id: "searchcraft-item",
|
|
552
|
-
onClick:
|
|
553
|
-
onKeyDown:
|
|
722
|
+
onClick: R,
|
|
723
|
+
onKeyDown: a,
|
|
554
724
|
children: [
|
|
555
|
-
r && /* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
c,
|
|
725
|
+
r && /* @__PURE__ */ t("div", { className: g.interactiveIconLarge, children: h ? /* @__PURE__ */ t(Q, {}) : /* @__PURE__ */ t(K, {}) }),
|
|
726
|
+
/* @__PURE__ */ t("div", { className: g.imageContainer, children: /* @__PURE__ */ t(
|
|
727
|
+
"img",
|
|
728
|
+
{
|
|
729
|
+
alt: c,
|
|
730
|
+
className: h ? g.imageLight : g.imageDark,
|
|
731
|
+
src: s
|
|
732
|
+
}
|
|
733
|
+
) }),
|
|
734
|
+
/* @__PURE__ */ u("div", { className: g.contentContainer, children: [
|
|
735
|
+
/* @__PURE__ */ u("h2", { className: h ? g.headingLight : g.headingDark, children: [
|
|
736
|
+
o,
|
|
560
737
|
" ",
|
|
561
|
-
r && /* @__PURE__ */
|
|
738
|
+
r && /* @__PURE__ */ t("div", { className: g.interactiveIconSmall, children: h ? /* @__PURE__ */ t(Q, {}) : /* @__PURE__ */ t(K, {}) })
|
|
562
739
|
] }),
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
740
|
+
/* @__PURE__ */ t(
|
|
741
|
+
"h3",
|
|
742
|
+
{
|
|
743
|
+
className: h ? g.subheadingLight : g.subheadingDark,
|
|
744
|
+
children: p
|
|
745
|
+
}
|
|
746
|
+
),
|
|
747
|
+
/* @__PURE__ */ t(
|
|
748
|
+
"p",
|
|
749
|
+
{
|
|
750
|
+
className: h ? g.bodyContentLight : g.bodyContentDark,
|
|
751
|
+
children: l
|
|
752
|
+
}
|
|
753
|
+
),
|
|
754
|
+
/* @__PURE__ */ t(M, { label: e, onClick: d })
|
|
569
755
|
] })
|
|
570
756
|
]
|
|
571
757
|
}
|
|
572
758
|
);
|
|
573
|
-
},
|
|
574
|
-
resultsContainer:
|
|
575
|
-
},
|
|
576
|
-
var a,
|
|
577
|
-
const { searchResults:
|
|
578
|
-
return /* @__PURE__ */
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
759
|
+
}, Rn = "_resultsContainer_684vx_5", kn = {
|
|
760
|
+
resultsContainer: Rn
|
|
761
|
+
}, vn = () => {
|
|
762
|
+
var i, a, c, r;
|
|
763
|
+
const { searchResults: n, query: e } = S();
|
|
764
|
+
return /* @__PURE__ */ u("div", { className: kn.resultsContainer, children: [
|
|
765
|
+
(a = (i = n == null ? void 0 : n.data) == null ? void 0 : i.hits) == null ? void 0 : a.map((s, l) => {
|
|
766
|
+
const { doc: o } = s;
|
|
767
|
+
return /* @__PURE__ */ t(
|
|
768
|
+
it,
|
|
769
|
+
{
|
|
770
|
+
buttonLabel: "View More",
|
|
771
|
+
buttonCallbackFn: () => {
|
|
772
|
+
console.log("button callback");
|
|
773
|
+
},
|
|
774
|
+
callbackFn: () => {
|
|
775
|
+
console.log("interactive element");
|
|
776
|
+
},
|
|
777
|
+
interactiveResult: !0,
|
|
778
|
+
imageSrc: o == null ? void 0 : o.poster,
|
|
779
|
+
resultBodyContent: o == null ? void 0 : o.overview,
|
|
780
|
+
resultHeading: o == null ? void 0 : o.title,
|
|
781
|
+
resultSubheading: o == null ? void 0 : o.release_date
|
|
589
782
|
},
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
};
|
|
783
|
+
`${o == null ? void 0 : o.id}-${l}`
|
|
784
|
+
);
|
|
785
|
+
}),
|
|
786
|
+
e.length > 0 && ((r = (c = n == null ? void 0 : n.data) == null ? void 0 : c.hits) == null ? void 0 : r.length) === 0 && /* @__PURE__ */ t(
|
|
787
|
+
O,
|
|
788
|
+
{
|
|
789
|
+
errorMessage: `No search results found for ${e} query`
|
|
790
|
+
}
|
|
791
|
+
)
|
|
792
|
+
] });
|
|
793
|
+
}, f = () => null;
|
|
794
|
+
f.AutoSearchForm = Jt;
|
|
795
|
+
f.BaseSearchForm = rn;
|
|
796
|
+
f.BaseSearchResult = it;
|
|
797
|
+
f.BaseSearchResults = vn;
|
|
798
|
+
f.Button = M;
|
|
799
|
+
f.ClearInputButton = $;
|
|
800
|
+
f.ErrorMessage = O;
|
|
801
|
+
f.Input = P;
|
|
802
|
+
f.InputCaption = q;
|
|
803
|
+
f.InputIcon = A;
|
|
804
|
+
f.InputLabel = W;
|
|
805
|
+
f.Provider = ut;
|
|
600
806
|
export {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
807
|
+
Jt as AutoSearchForm,
|
|
808
|
+
rn as BaseSearchForm,
|
|
809
|
+
it as BaseSearchResult,
|
|
810
|
+
vn as BaseSearchResults,
|
|
811
|
+
M as Button,
|
|
812
|
+
O as ErrorMessage,
|
|
813
|
+
P as Input,
|
|
814
|
+
W as InputLabel,
|
|
815
|
+
yn as SearchcraftCore,
|
|
816
|
+
f as default,
|
|
817
|
+
S as useSearchcraft,
|
|
818
|
+
b as useTheme
|
|
612
819
|
};
|
|
613
820
|
//# sourceMappingURL=index.js.map
|