@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/dist/index.js CHANGED
@@ -1,181 +1,193 @@
1
- import { jsx as n, jsxs as u, Fragment as k } from "react/jsx-runtime";
2
- import Q, { useState as g, useContext as Z, useEffect as K } from "react";
3
- var U = Object.defineProperty, H = (t, a, o) => a in t ? U(t, a, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[a] = o, N = (t, a, o) => H(t, typeof a != "symbol" ? a + "" : a, o);
4
- class Jn {
5
- constructor(a) {
6
- if (N(this, "config"), N(this, "search", async (o) => {
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 s = this.config.index.join(","), i = `${this.config.endpointURL}/search`, r = {
9
- query: o.query,
10
- mode: o.mode,
11
- app: s
12
- }, e = {
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(i, e)).json();
22
- } catch (s) {
23
- return s;
20
+ return await (await fetch(c, s)).json();
21
+ } catch (a) {
22
+ return a;
24
23
  }
25
- }), !a.endpointURL || !a.index)
24
+ }), !e.endpointURL || !e.index)
26
25
  throw new Error("Endpoint URL and Index value(s) must be provided");
27
- this.config = a;
26
+ this.config = e;
28
27
  }
29
28
  }
30
- const J = {
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: (t) => t,
56
+ setQuery: (n) => n,
37
57
  search: async () => null
38
- }, F = Q.createContext(J), Gn = ({
39
- children: t,
40
- searchcraft: a
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 [o, s] = g(""), [i, r] = g(!1), [e, l] = g(null), c = async () => {
43
- r(!0);
44
- const _ = await a.search({ query: o, mode: "fuzzy" });
45
- l(_), r(!1);
46
- }, h = {
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: a.config.index,
49
- isRequesting: i,
100
+ index: e.config.index,
101
+ isRequesting: r,
50
102
  mode: "fuzzy",
51
- query: o,
52
- search: c,
53
- searchResults: e,
54
- setQuery: s
55
- };
56
- return /* @__PURE__ */ n(F.Provider, { value: h, children: t });
57
- }, v = () => Z(F), G = "_formLTR_dvuqa_5", V = "_formRTL_dvuqa_9", X = "_searchContainer_dvuqa_13", L = {
58
- formLTR: G,
59
- formRTL: V,
60
- searchContainer: X
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 Y(t) {
63
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
130
+ function pt(n) {
131
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
64
132
  }
65
- var D = { exports: {} };
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(t) {
139
+ (function(n) {
72
140
  (function() {
73
- var a = {}.hasOwnProperty;
74
- function o() {
75
- for (var r = "", e = 0; e < arguments.length; e++) {
76
- var l = arguments[e];
77
- l && (r = i(r, s(l)));
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 s(r) {
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 o.apply(null, r);
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 e = "";
158
+ var s = "";
91
159
  for (var l in r)
92
- a.call(r, l) && r[l] && (e = i(e, l));
93
- return e;
160
+ e.call(r, l) && r[l] && (s = c(s, l));
161
+ return s;
94
162
  }
95
- function i(r, e) {
96
- return e ? r ? r + " " + e : r + e : r;
163
+ function c(r, s) {
164
+ return s ? r ? r + " " + s : r + s : r;
97
165
  }
98
- t.exports ? (o.default = o, t.exports = o) : window.classNames = o;
166
+ n.exports ? (i.default = i, n.exports = i) : window.classNames = i;
99
167
  })();
100
- })(D);
101
- var O = D.exports;
102
- const p = /* @__PURE__ */ Y(O), nn = "_button_8jqm2_5", tn = "_spinnerMarginRight_8jqm2_26", en = "_spinnerMarginLeft_8jqm2_32", rn = "_buttonLabel_8jqm2_38", an = "_rightandback_8jqm2_1", b = {
103
- button: nn,
104
- spinnerMarginRight: tn,
105
- spinnerMarginLeft: en,
106
- buttonLabel: rn,
107
- rightandback: an
108
- }, on = "_spinnerContainer_1noam_1", sn = "_spinnerDark_1noam_7", cn = "_spinning_1noam_1", ln = "_spinnerLight_1noam_16", S = {
109
- spinnerContainer: on,
110
- spinnerDark: sn,
111
- spinning: cn,
112
- spinnerLight: ln
113
- }, x = () => /* @__PURE__ */ n("div", { className: S.spinnerContainer, children: /* @__PURE__ */ n("div", { className: S.spinnerLight }) }), I = () => /* @__PURE__ */ n("div", { className: S.spinnerContainer, children: /* @__PURE__ */ n("div", { className: S.spinnerDark }) }), w = ({
114
- className: t,
115
- iconElement: a,
116
- iconOnly: o = !1,
117
- iconPosition: s = "left",
118
- label: i = "Search",
119
- onClick: r
120
- }) => {
121
- const { isRequesting: e } = v();
122
- return /* @__PURE__ */ u(k, { children: [
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
- ] }), q = () => /* @__PURE__ */ u("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", children: [
189
- /* @__PURE__ */ n("title", { children: "Searchcraft Arrow Right Icon" }),
190
- /* @__PURE__ */ n(
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
- ] }), B = ({
201
- onClearInput: t,
202
- rightToLeftOrientation: a = !1
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: o } = v();
205
- return a ? /* @__PURE__ */ n(
265
+ const { isRequesting: i } = S(), { theme: a } = b(), c = a === "light";
266
+ return e ? /* @__PURE__ */ t(
206
267
  "button",
207
268
  {
208
- className: p(
209
- E.inputClearButtonRTL,
269
+ className: L(
270
+ z.inputClearButtonRTL,
210
271
  ".sc-clear-input-button-rtl"
211
272
  ),
212
- onClick: t,
273
+ onClick: n,
213
274
  type: "button",
214
- children: o ? /* @__PURE__ */ n(x, {}) : /* @__PURE__ */ n(M, {})
275
+ children: i ? c ? /* @__PURE__ */ t(J, {}) : /* @__PURE__ */ t(B, {}) : c ? /* @__PURE__ */ t(Z, {}) : /* @__PURE__ */ t(G, {})
215
276
  }
216
- ) : /* @__PURE__ */ n(
277
+ ) : /* @__PURE__ */ t(
217
278
  "button",
218
279
  {
219
- className: p(
220
- E.inputClearButtonLTR,
280
+ className: L(
281
+ z.inputClearButtonLTR,
221
282
  ".sc-clear-input-button-ltr"
222
283
  ),
223
- onClick: t,
284
+ onClick: n,
224
285
  type: "button",
225
- children: o ? /* @__PURE__ */ n(x, {}) : /* @__PURE__ */ n(M, {})
286
+ children: i ? c ? /* @__PURE__ */ t(J, {}) : /* @__PURE__ */ t(B, {}) : c ? /* @__PURE__ */ t(Z, {}) : /* @__PURE__ */ t(G, {})
226
287
  }
227
288
  );
228
- }, gn = "_inputCaptionLTR_xoy9r_5", vn = "_inputCaptionErrorLTR_xoy9r_14", Tn = "_inputCaptionRTL_xoy9r_24", yn = "_inputCaptionErrorRTL_xoy9r_34", T = {
229
- inputCaptionLTR: gn,
230
- inputCaptionErrorLTR: vn,
231
- inputCaptionRTL: Tn,
232
- inputCaptionErrorRTL: yn
233
- }, j = ({
234
- error: t = !1,
235
- inputCaptionClassName: a,
236
- inputCaptionValue: o = "Enter Search",
237
- rightToLeftOrientation: s = !1
238
- }) => s ? /* @__PURE__ */ n(
239
- "p",
240
- {
241
- className: p(
242
- t ? T.inputCaptionErrorRTL : T.inputCaptionRTL,
243
- a
244
- ),
245
- children: o
246
- }
247
- ) : /* @__PURE__ */ n(
248
- "p",
249
- {
250
- className: p(
251
- t ? T.inputCaptionErrorLTR : T.inputCaptionLTR,
252
- a
253
- ),
254
- children: o
255
- }
256
- ), Sn = "_inputIconLTR_cusap_5", In = "_inputIconRTL_cusap_13", y = {
257
- inputIconLTR: Sn,
258
- inputIconRTL: In
259
- }, kn = () => /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
260
- /* @__PURE__ */ n("title", { children: "Searchcraft Search Icon" }),
261
- /* @__PURE__ */ n(
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
- ] }), Nn = () => /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
272
- /* @__PURE__ */ n("title", { children: "Searchcraft Error Search Icon" }),
273
- /* @__PURE__ */ n(
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
- error: t = !1,
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
- className: a ? y.inputIconRTL : y.inputIconLTR,
296
- children: /* @__PURE__ */ n(kn, {})
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: t = !1,
300
- formClassName: a = "",
301
- inputCaptionClassName: o = "",
302
- inputClassName: s = "",
303
- inputCaptionValue: i = "",
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: e,
422
+ onSearchInputChange: s,
306
423
  placeholderValue: l = "Enter Search",
307
- rightToLeftOrientation: c = !1,
308
- query: h = ""
424
+ rightToLeftOrientation: o = !1,
425
+ query: p = ""
309
426
  }) => {
310
- const _ = c ? m.inputContainerRTL : m.inputContainerLTR;
311
- return /* @__PURE__ */ n(
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: p(
315
- _,
316
- a,
431
+ className: L(
432
+ d,
433
+ e,
317
434
  "searchcraft-input-form"
318
435
  ),
319
- children: c ? /* @__PURE__ */ u(k, { children: [
320
- /* @__PURE__ */ n(
436
+ children: o ? /* @__PURE__ */ u(j, { children: [
437
+ /* @__PURE__ */ t(
321
438
  "input",
322
439
  {
323
- className: p(
324
- t ? m.inputErrorRTL : m.inputRTL,
325
- s,
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: e,
446
+ onChange: s,
330
447
  placeholder: l,
331
448
  type: "text",
332
- value: h
449
+ value: p
333
450
  }
334
451
  ),
335
- i && /* @__PURE__ */ n(
336
- j,
452
+ c && /* @__PURE__ */ t(
453
+ q,
337
454
  {
338
- inputCaptionClassName: o,
339
- inputCaptionValue: i,
340
- rightToLeftOrientation: c
455
+ inputCaptionClassName: i,
456
+ inputCaptionValue: c,
457
+ rightToLeftOrientation: o
341
458
  }
342
459
  ),
343
- h.length > 0 && /* @__PURE__ */ n(
344
- B,
460
+ p.length > 0 && /* @__PURE__ */ t(
461
+ $,
345
462
  {
346
463
  onClearInput: r,
347
- rightToLeftOrientation: c
464
+ rightToLeftOrientation: o
348
465
  }
349
466
  ),
350
- /* @__PURE__ */ n(
351
- $,
467
+ /* @__PURE__ */ t(
468
+ A,
352
469
  {
353
- error: t,
354
- rightToLeftOrientation: c
470
+ error: n,
471
+ rightToLeftOrientation: o
355
472
  }
356
473
  )
357
- ] }) : /* @__PURE__ */ u(k, { children: [
358
- /* @__PURE__ */ n(
474
+ ] }) : /* @__PURE__ */ u(j, { children: [
475
+ /* @__PURE__ */ t(
359
476
  "input",
360
477
  {
361
- className: p(
362
- t ? m.inputErrorLTR : m.inputLTR,
363
- s,
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: e,
484
+ onChange: s,
368
485
  placeholder: l,
369
486
  type: "text",
370
- value: h
487
+ value: p
371
488
  }
372
489
  ),
373
- i && /* @__PURE__ */ n(
374
- j,
490
+ c && /* @__PURE__ */ t(
491
+ q,
375
492
  {
376
- inputCaptionClassName: o,
377
- inputCaptionValue: i,
378
- rightToLeftOrientation: c
493
+ inputCaptionClassName: i,
494
+ inputCaptionValue: c,
495
+ rightToLeftOrientation: o
379
496
  }
380
497
  ),
381
- h.length > 0 && /* @__PURE__ */ n(
382
- B,
498
+ p.length > 0 && /* @__PURE__ */ t(
499
+ $,
383
500
  {
384
501
  onClearInput: r,
385
- rightToLeftOrientation: c
502
+ rightToLeftOrientation: o
386
503
  }
387
504
  ),
388
- /* @__PURE__ */ n($, { error: t })
505
+ /* @__PURE__ */ t(A, { error: n })
389
506
  ] })
390
507
  }
391
508
  );
392
- }, xn = "_label_1euwf_5", wn = {
393
- label: xn
394
- }, z = ({
395
- className: t,
396
- label: a = "Enter Search"
397
- }) => /* @__PURE__ */ n(
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 { query: r, setQuery: e } = v(), [l, c] = g(!1), h = (C) => {
412
- C.preventDefault(), r.trim() === "" ? c(!0) : (c(!1), a(r));
413
- }, _ = (C) => e(C.target.value), f = () => e("");
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: i ? L.formRTL : L.formLTR,
418
- onSubmit: h,
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
- }, Xn = ({
441
- autoSearchFormClass: t = "",
442
- handleSubmit: a,
443
- inputCaptionValue: o = "",
444
- labelForInput: s = "Search",
445
- onClearedInput: i = () => {
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: e = !1,
533
+ rightToLeftOrientation: s = !1,
449
534
  searchContainerClass: l = ""
450
535
  }) => {
451
- const { query: c, setQuery: h } = v(), [_, f] = g(!1), C = (R) => {
452
- R.preventDefault(), h(R.currentTarget.value), c !== R.currentTarget.value && f(!0);
453
- }, P = () => {
454
- h(""), i();
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
- K(() => {
457
- if (_)
458
- a(c), f(!1);
541
+ return tt(() => {
542
+ if (m)
543
+ e(o), h(!1);
459
544
  else
460
545
  return;
461
- }, [_, a, c]);
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: p(
467
- W,
468
- t,
549
+ className: L(
550
+ d,
551
+ n,
469
552
  "searchcraft-auto-search-form"
470
553
  ),
471
- onSubmit: (R) => {
472
- R.preventDefault();
554
+ onSubmit: (k) => {
555
+ k.preventDefault();
473
556
  },
474
557
  children: [
475
- /* @__PURE__ */ n(z, { label: s }),
476
- /* @__PURE__ */ n(
558
+ /* @__PURE__ */ t(W, { label: a }),
559
+ /* @__PURE__ */ t(
477
560
  "div",
478
561
  {
479
- className: p(
480
- L.searchContainer,
562
+ className: L(
563
+ D.searchContainer,
481
564
  l,
482
565
  "searchcraft-input-container"
483
566
  ),
484
- children: /* @__PURE__ */ n(
485
- A,
567
+ children: /* @__PURE__ */ t(
568
+ P,
486
569
  {
487
- inputCaptionValue: o,
488
- onClearInput: P,
489
- onSearchInputChange: C,
570
+ inputCaptionValue: i,
571
+ onClearInput: F,
572
+ onSearchInputChange: R,
490
573
  placeholderValue: r,
491
- query: c,
492
- rightToLeftOrientation: e
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
- }, En = () => /* @__PURE__ */ u("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
501
- /* @__PURE__ */ n("title", { children: "Searchcraft Button Icon" }),
502
- /* @__PURE__ */ n(
503
- "path",
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
- d: "M2.725 5.79959L10 10.0079L17.275 5.79959M10 18.3996V9.99959M17.5 13.3329V6.66626C17.4997 6.37399 17.4225 6.08693 17.2763 5.8339C17.13 5.58086 16.9198 5.37073 16.6667 5.22459L10.8333 1.89126C10.58 1.74498 10.2926 1.66797 10 1.66797C9.70744 1.66797 9.42003 1.74498 9.16667 1.89126L3.33333 5.22459C3.08022 5.37073 2.86998 5.58086 2.72372 5.8339C2.57745 6.08693 2.5003 6.37399 2.5 6.66626V13.3329C2.5003 13.6252 2.57745 13.9123 2.72372 14.1653C2.86998 14.4183 3.08022 14.6285 3.33333 14.7746L9.16667 18.1079C9.42003 18.2542 9.70744 18.3312 10 18.3312C10.2926 18.3312 10.58 18.2542 10.8333 18.1079L16.6667 14.7746C16.9198 14.6285 17.13 14.4183 17.2763 14.1653C17.4225 13.9123 17.4997 13.6252 17.5 13.3329Z",
506
- stroke: "white",
507
- strokeWidth: "1.5",
508
- strokeLinecap: "round",
509
- strokeLinejoin: "round"
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
- ] }), Mn = "_resultContainer_10d68_5", qn = "_interactiveResultContainer_10d68_17", Bn = "_interactiveIconLarge_10d68_33", jn = "_interactiveIconSmall_10d68_45", $n = "_imageContainer_10d68_57", Fn = "_contentContainer_10d68_68", Dn = "_image_10d68_57", An = "_heading_10d68_86", zn = "_subheading_10d68_97", Pn = "_bodyContent_10d68_107", Wn = "_button_10d68_117", d = {
513
- resultContainer: Mn,
514
- interactiveResultContainer: qn,
515
- interactiveIconLarge: Bn,
516
- interactiveIconSmall: jn,
517
- imageContainer: $n,
518
- contentContainer: Fn,
519
- image: Dn,
520
- heading: An,
521
- subheading: zn,
522
- bodyContent: Pn,
523
- button: Wn
524
- }, Qn = ({
525
- buttonCallbackFn: t = () => {
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: a = "",
528
- callbackFn: o = () => {
697
+ buttonLabel: e = "",
698
+ callbackFn: i = () => {
529
699
  },
530
- keyDownCallbackFn: s = () => {
700
+ keyDownCallbackFn: a = () => {
531
701
  },
532
- imageAltText: i = "",
702
+ imageAltText: c = "",
533
703
  interactiveResult: r = !1,
534
- imageSrc: e = "",
704
+ imageSrc: s = "",
535
705
  resultBodyContent: l = "",
536
- resultHeading: c = "",
537
- resultSubheading: h = ""
706
+ resultHeading: o = "",
707
+ resultSubheading: p = ""
538
708
  }) => {
539
- const _ = (C) => {
540
- C.stopPropagation(), t();
541
- }, f = () => {
709
+ const { theme: m } = b(), h = m === "light", d = () => {
710
+ n();
711
+ }, R = () => {
542
712
  if (r)
543
- o();
713
+ i();
544
714
  else
545
715
  return;
546
716
  };
547
717
  return /* @__PURE__ */ u(
548
718
  "div",
549
719
  {
550
- className: r ? d.interactiveResultContainer : d.resultContainer,
720
+ className: r ? h ? g.interactiveResultContainerLight : g.interactiveResultContainerDark : g.resultContainer,
551
721
  id: "searchcraft-item",
552
- onClick: f,
553
- onKeyDown: s,
722
+ onClick: R,
723
+ onKeyDown: a,
554
724
  children: [
555
- r && /* @__PURE__ */ n("div", { className: d.interactiveIconLarge, children: /* @__PURE__ */ n(q, {}) }),
556
- /* @__PURE__ */ n("div", { className: d.imageContainer, children: /* @__PURE__ */ n("img", { alt: i, className: d.image, src: e }) }),
557
- /* @__PURE__ */ u("div", { className: d.contentContainer, children: [
558
- /* @__PURE__ */ u("h2", { className: d.heading, children: [
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__ */ n("div", { className: d.interactiveIconSmall, children: /* @__PURE__ */ n(q, {}) })
738
+ r && /* @__PURE__ */ t("div", { className: g.interactiveIconSmall, children: h ? /* @__PURE__ */ t(Q, {}) : /* @__PURE__ */ t(K, {}) })
562
739
  ] }),
563
- /* @__PURE__ */ n("h3", { className: d.subheading, children: h }),
564
- /* @__PURE__ */ n("p", { className: d.bodyContent, children: l }),
565
- /* @__PURE__ */ u("button", { className: d.button, onClick: _, type: "button", children: [
566
- /* @__PURE__ */ n(En, {}),
567
- /* @__PURE__ */ n("span", { children: a })
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
- }, Zn = "_resultsContainer_pfxt4_5", Kn = {
574
- resultsContainer: Zn
575
- }, Yn = () => {
576
- var a, o, s;
577
- const { searchResults: t } = v();
578
- return /* @__PURE__ */ n("div", { className: Kn.resultsContainer, children: (a = t == null ? void 0 : t.data) != null && a.hits ? (s = (o = t == null ? void 0 : t.data) == null ? void 0 : o.hits) == null ? void 0 : s.map((i, r) => {
579
- const { doc: e } = i;
580
- return /* @__PURE__ */ n(
581
- Qn,
582
- {
583
- buttonLabel: "View More",
584
- buttonCallbackFn: () => {
585
- console.log("button callback");
586
- },
587
- callbackFn: () => {
588
- console.log("interactive");
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
- interactiveResult: !0,
591
- imageSrc: e == null ? void 0 : e.poster,
592
- resultBodyContent: e == null ? void 0 : e.overview,
593
- resultHeading: e == null ? void 0 : e.title,
594
- resultSubheading: e == null ? void 0 : e.release_date
595
- },
596
- `${e == null ? void 0 : e.id}-${r}`
597
- );
598
- }) : /* @__PURE__ */ n("div", { children: "no results found" }) });
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
- Xn as AutoSearchForm,
602
- Vn as BaseSearchForm,
603
- Qn as BaseSearchResult,
604
- Yn as BaseSearchResults,
605
- w as Button,
606
- hn as ErrorMessage,
607
- A as Input,
608
- z as InputLabel,
609
- Jn as Searchcraft,
610
- Gn as SearchcraftProvider,
611
- v as useSearchcraft
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