@searchcraft/javascript-sdk 0.1.8 → 0.1.9
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/cjs/{index-7b49313c.js → index-d0e71432.js} +10 -4
- package/dist/cjs/index-d0e71432.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{searchcraft-auto-search-form_13.cjs.entry.js → searchcraft-auto-search-form_16.cjs.entry.js} +180 -12
- package/dist/cjs/searchcraft-auto-search-form_16.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +3 -3
- package/dist/cjs/searchcraft-button-icon.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-button.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +2 -2
- package/dist/cjs/{store-3d577aac.js → store-3f6eab7d.js} +110 -42
- package/dist/cjs/store-3f6eab7d.js.map +1 -0
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +7 -4
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -1
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +131 -0
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -0
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +35 -0
- package/dist/collection/components/searchcraft-input/searchcraft-input.js +21 -2
- package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -1
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +97 -0
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -0
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +75 -0
- package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +1 -1
- package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +1 -1
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +79 -0
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -0
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +38 -0
- package/dist/collection/provider/store.js +35 -2
- package/dist/collection/provider/store.js.map +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/{p-a3ea7edc.js → p-05cd002d.js} +2 -2
- package/dist/components/{p-a3ea7edc.js.map → p-05cd002d.js.map} +1 -1
- package/dist/components/{p-85d96d9b.js → p-25bd714c.js} +2 -2
- package/dist/components/{p-85d96d9b.js.map → p-25bd714c.js.map} +1 -1
- package/dist/components/{p-62f37242.js → p-37df2122.js} +16 -11
- package/dist/components/p-37df2122.js.map +1 -0
- package/dist/components/{p-f3af2b04.js → p-3cbac2bb.js} +2 -2
- package/dist/components/{p-f3af2b04.js.map → p-3cbac2bb.js.map} +1 -1
- package/dist/components/{p-07fba086.js → p-403f6115.js} +5 -5
- package/dist/components/{p-07fba086.js.map → p-403f6115.js.map} +1 -1
- package/dist/components/{p-04bad430.js → p-50ca3fe4.js} +3 -3
- package/dist/components/{p-04bad430.js.map → p-50ca3fe4.js.map} +1 -1
- package/dist/components/{p-3ea9ba3a.js → p-574e8e3c.js} +3 -3
- package/dist/components/{p-3ea9ba3a.js.map → p-574e8e3c.js.map} +1 -1
- package/dist/components/{p-9c617862.js → p-5aa6335f.js} +110 -42
- package/dist/components/p-5aa6335f.js.map +1 -0
- package/dist/components/{p-d33fdd81.js → p-71dff048.js} +2 -2
- package/dist/components/{p-d33fdd81.js.map → p-71dff048.js.map} +1 -1
- package/dist/components/{p-d73bc01d.js → p-9bb9d6f0.js} +2 -2
- package/dist/components/{p-d73bc01d.js.map → p-9bb9d6f0.js.map} +1 -1
- package/dist/components/{p-c14731ca.js → p-c9629cc3.js} +2 -2
- package/dist/components/{p-c14731ca.js.map → p-c9629cc3.js.map} +1 -1
- package/dist/components/{p-af65953e.js → p-c9cd5533.js} +6 -2
- package/dist/components/p-c9cd5533.js.map +1 -0
- package/dist/components/{p-781a9a8c.js → p-e0e0fc94.js} +3 -3
- package/dist/components/{p-781a9a8c.js.map → p-e0e0fc94.js.map} +1 -1
- package/dist/components/{p-6b1d0cba.js → p-f2e41d24.js} +3 -3
- package/dist/components/{p-6b1d0cba.js.map → p-f2e41d24.js.map} +1 -1
- package/dist/components/searchcraft-auto-search-form.js +20 -17
- package/dist/components/searchcraft-auto-search-form.js.map +1 -1
- package/dist/components/searchcraft-base-search-form.js +14 -14
- package/dist/components/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +4 -4
- package/dist/components/searchcraft-base-search-results.js.map +1 -1
- package/dist/components/searchcraft-button-icon.js +1 -1
- package/dist/components/searchcraft-button.js +1 -1
- package/dist/components/searchcraft-clear-icon-set.js +1 -1
- package/dist/components/searchcraft-clear-input-button.js +1 -1
- package/dist/components/searchcraft-error-message.js +1 -1
- package/dist/components/searchcraft-filters-list.d.ts +11 -0
- package/dist/components/searchcraft-filters-list.js +103 -0
- package/dist/components/searchcraft-filters-list.js.map +1 -0
- package/dist/components/searchcraft-input-caption.js +1 -1
- package/dist/components/searchcraft-input-icon.js +1 -1
- package/dist/components/searchcraft-input-label.js +1 -1
- package/dist/components/searchcraft-input.js +1 -1
- package/dist/components/searchcraft-search-icon-set.js +1 -1
- package/dist/components/searchcraft-slider.d.ts +11 -0
- package/dist/components/searchcraft-slider.js +72 -0
- package/dist/components/searchcraft-slider.js.map +1 -0
- package/dist/components/searchcraft-spinner-dark.js +1 -1
- package/dist/components/searchcraft-spinner-light.js +1 -1
- package/dist/components/searchcraft-toggle-button.d.ts +11 -0
- package/dist/components/searchcraft-toggle-button.js +71 -0
- package/dist/components/searchcraft-toggle-button.js.map +1 -0
- package/dist/esm/{index-e4a4f86d.js → index-92040c37.js} +10 -4
- package/dist/esm/index-92040c37.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{searchcraft-auto-search-form_13.entry.js → searchcraft-auto-search-form_16.entry.js} +178 -13
- package/dist/esm/searchcraft-auto-search-form_16.entry.js.map +1 -0
- package/dist/esm/searchcraft-base-search-form.entry.js +3 -3
- package/dist/esm/searchcraft-button-icon.entry.js +1 -1
- package/dist/esm/searchcraft-button.entry.js +1 -1
- package/dist/esm/searchcraft-javascript-sdk.js +3 -3
- package/dist/esm/{store-03dc618f.js → store-5f6f8445.js} +110 -42
- package/dist/esm/store-5f6f8445.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/{p-6a17384e.entry.js → p-02f632b6.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-e6f6972c.js → p-05369654.js} +3 -3
- package/dist/searchcraft-javascript-sdk/p-05369654.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-5aa6335f.js +11 -0
- package/dist/searchcraft-javascript-sdk/p-5aa6335f.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-639d019b.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/{p-6c825f8c.entry.js.map → p-639d019b.entry.js.map} +1 -1
- package/dist/searchcraft-javascript-sdk/p-73265750.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-73265750.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/{p-98eab6f9.entry.js → p-81eaebdc.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
- package/dist/types/components/searchcraft-auto-search-form/searchcraft-auto-search-form.d.ts +1 -0
- package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +23 -0
- package/dist/types/components/searchcraft-input/searchcraft-input.d.ts +2 -0
- package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +11 -0
- package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +12 -0
- package/dist/types/components.d.ts +71 -0
- package/dist/types/provider/store.d.ts +17 -5
- package/package.json +1 -1
- package/dist/cjs/index-7b49313c.js.map +0 -1
- package/dist/cjs/searchcraft-auto-search-form_13.cjs.entry.js.map +0 -1
- package/dist/cjs/store-3d577aac.js.map +0 -1
- package/dist/components/p-62f37242.js.map +0 -1
- package/dist/components/p-9c617862.js.map +0 -1
- package/dist/components/p-af65953e.js.map +0 -1
- package/dist/esm/index-e4a4f86d.js.map +0 -1
- package/dist/esm/searchcraft-auto-search-form_13.entry.js.map +0 -1
- package/dist/esm/store-03dc618f.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-6c825f8c.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-9c617862.js +0 -11
- package/dist/searchcraft-javascript-sdk/p-9c617862.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-bc3c001e.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-bc3c001e.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e6f6972c.js.map +0 -1
- /package/dist/searchcraft-javascript-sdk/{p-6a17384e.entry.js.map → p-02f632b6.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-98eab6f9.entry.js.map → p-81eaebdc.entry.js.map} +0 -0
|
@@ -26,20 +26,53 @@ const useSearchcraftStore = create((set, get) => {
|
|
|
26
26
|
query: '',
|
|
27
27
|
isRequesting: false,
|
|
28
28
|
searchResults: null,
|
|
29
|
+
facets: null,
|
|
30
|
+
selectedFilters: [], // Initialize selected filters as an empty array
|
|
31
|
+
searchParams: {
|
|
32
|
+
mode: 'fuzzy',
|
|
33
|
+
sort: 'desc',
|
|
34
|
+
},
|
|
29
35
|
setQuery: (query) => set({ query }),
|
|
30
36
|
setSearchResults: (results) => set({ searchResults: results }),
|
|
37
|
+
setFacets: (facets) => set({ facets }),
|
|
38
|
+
setSelectedFilters: (filters) => set({ selectedFilters: filters }), // Update the selected filters
|
|
31
39
|
setIsRequesting: (isRequesting) => set({ isRequesting }),
|
|
40
|
+
setSearchParams: (params) => set((state) => ({
|
|
41
|
+
searchParams: Object.assign(Object.assign({}, state.searchParams), params),
|
|
42
|
+
})),
|
|
43
|
+
setYearsRange: (yearsRange) => set((state) => ({
|
|
44
|
+
searchParams: Object.assign(Object.assign({}, state.searchParams), { yearsRange }),
|
|
45
|
+
})),
|
|
32
46
|
search: async () => {
|
|
33
|
-
const { query, setIsRequesting, setSearchResults } = get();
|
|
47
|
+
const { query, selectedFilters, setIsRequesting, setSearchResults, setFacets, searchParams, } = get();
|
|
34
48
|
if (!searchcraft) {
|
|
35
49
|
throw new Error('Searchcraft instance is not initialized.');
|
|
36
50
|
}
|
|
37
51
|
setIsRequesting(true);
|
|
38
52
|
log(LogLevel.INFO, `Starting search with query: "${query}"`);
|
|
39
53
|
try {
|
|
40
|
-
const
|
|
54
|
+
const counts = selectedFilters.reduce((acc, filter) => {
|
|
55
|
+
const cleanedFilter = filter.replace(/^section:/, ''); // Remove 'section:' prefix
|
|
56
|
+
acc[cleanedFilter] = 1; // Assign a dummy count of 1 (or use actual values if available)
|
|
57
|
+
return acc;
|
|
58
|
+
}, {});
|
|
59
|
+
console.log(counts);
|
|
60
|
+
const searchRequest = {
|
|
61
|
+
query,
|
|
62
|
+
mode: searchParams.mode,
|
|
63
|
+
sort: searchParams.sort,
|
|
64
|
+
facets: selectedFilters.length > 0 ? { section: { counts } } : null,
|
|
65
|
+
yearsRange: searchParams.yearsRange,
|
|
66
|
+
};
|
|
67
|
+
console.log('Search Request:', searchRequest);
|
|
68
|
+
const results = await searchcraft.search(searchRequest);
|
|
41
69
|
setSearchResults(results);
|
|
70
|
+
console.log(results.data.facets);
|
|
71
|
+
// Extract facets from the results and update the state
|
|
72
|
+
const updatedFacets = results.data.facets || null;
|
|
73
|
+
setFacets(updatedFacets);
|
|
42
74
|
log(LogLevel.DEBUG, `Search results: ${JSON.stringify(results)}`);
|
|
75
|
+
log(LogLevel.DEBUG, `Updated facets: ${JSON.stringify(updatedFacets)}`);
|
|
43
76
|
}
|
|
44
77
|
catch (error) {
|
|
45
78
|
console.error(`Search failed: ${error.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/provider/store.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAEL,WAAW,EACX,QAAQ,
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/provider/store.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAEL,WAAW,EACX,QAAQ,GAGT,MAAM,mBAAmB,CAAC;AA+B3B,sCAAsC;AACtC,MAAM,mBAAmB,GAAG,MAAM,CAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAChE,IAAI,WAAW,GAA2B,IAAI,CAAC;IAC/C,IAAI,gBAAgB,GAAuB,IAAI,CAAC;IAEhD,MAAM,GAAG,GAAG,CAAC,KAAe,EAAE,OAAe,EAAE,EAAE;QAC/C,IAAI,gBAAgB,EAAE,CAAC;YACrB,QAAQ,KAAK,EAAE,CAAC;gBACd,KAAK,QAAQ,CAAC,KAAK;oBACjB,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBAChC,MAAM;gBACR,KAAK,QAAQ,CAAC,IAAI;oBAChB,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBAC/B,MAAM;gBACR,KAAK,QAAQ,CAAC,IAAI;oBAChB,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBAC/B,MAAM;gBACR,KAAK,QAAQ,CAAC,KAAK;oBACjB,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBAChC,MAAM;YACV,CAAC;QACH,CAAC;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","sourcesContent":["import { create } from 'zustand';\nimport {\n type CoreSDK as SearchcraftCore,\n SDKDebugger,\n LogLevel,\n type SearchcraftResponse,\n type Facets,\n} from '@searchcraft/core';\n\ninterface ThemeState {\n theme: 'light' | 'dark';\n toggleTheme: () => void;\n}\n\ninterface SearchParams {\n mode: 'fuzzy' | 'normal';\n sort: 'asc' | 'desc';\n yearsRange?: [number, number];\n}\n\ninterface SearchcraftState {\n query: string;\n isRequesting: boolean;\n searchResults: SearchcraftResponse | null;\n facets: Facets | null;\n selectedFilters: string[]; // Add this to store selected filters\n searchParams: SearchParams;\n setQuery: (query: string) => void;\n setSearchResults: (results: SearchcraftResponse | null) => void;\n setFacets: (facets: Facets) => void;\n setSelectedFilters: (filters: string[]) => void; // Update selected filters\n setIsRequesting: (isRequesting: boolean) => void;\n setSearchParams: (params: Partial<SearchParams>) => void;\n setYearsRange: (yearsRange: [number, number]) => void;\n search: () => Promise<void>;\n initialize: (searchcraft: SearchcraftCore, debug?: boolean) => void;\n}\n\n// Zustand store for Searchcraft state\nconst useSearchcraftStore = create<SearchcraftState>((set, get) => {\n let searchcraft: SearchcraftCore | null = null;\n let debuggerInstance: SDKDebugger | null = null;\n\n const log = (level: LogLevel, message: string) => {\n if (debuggerInstance) {\n switch (level) {\n case LogLevel.DEBUG:\n debuggerInstance.debug(message);\n break;\n case LogLevel.INFO:\n debuggerInstance.info(message);\n break;\n case LogLevel.WARN:\n debuggerInstance.warn(message);\n break;\n case LogLevel.ERROR:\n debuggerInstance.error(message);\n break;\n }\n }\n };\n\n return {\n query: '',\n isRequesting: false,\n searchResults: null,\n facets: null,\n selectedFilters: [], // Initialize selected filters as an empty array\n searchParams: {\n mode: 'fuzzy',\n sort: 'desc',\n },\n setQuery: (query) => set({ query }),\n setSearchResults: (results) => set({ searchResults: results }),\n setFacets: (facets) => set({ facets }),\n setSelectedFilters: (filters) => set({ selectedFilters: filters }), // Update the selected filters\n setIsRequesting: (isRequesting) => set({ isRequesting }),\n setSearchParams: (params) =>\n set((state) => ({\n searchParams: {\n ...state.searchParams,\n ...params,\n },\n })),\n setYearsRange: (yearsRange) =>\n set((state) => ({\n searchParams: {\n ...state.searchParams,\n yearsRange,\n },\n })),\n search: async () => {\n const {\n query,\n selectedFilters,\n setIsRequesting,\n setSearchResults,\n setFacets,\n searchParams,\n } = get();\n if (!searchcraft) {\n throw new Error('Searchcraft instance is not initialized.');\n }\n setIsRequesting(true);\n log(LogLevel.INFO, `Starting search with query: \"${query}\"`);\n\n try {\n const counts: Record<string, number> = selectedFilters.reduce(\n (acc, filter) => {\n const cleanedFilter = filter.replace(/^section:/, ''); // Remove 'section:' prefix\n acc[cleanedFilter] = 1; // Assign a dummy count of 1 (or use actual values if available)\n return acc;\n },\n {} as Record<string, number>,\n );\n\n console.log(counts);\n\n const searchRequest = {\n query,\n mode: searchParams.mode,\n sort: searchParams.sort,\n facets: selectedFilters.length > 0 ? { section: { counts } } : null,\n yearsRange: searchParams.yearsRange,\n };\n\n console.log('Search Request:', searchRequest);\n\n const results = await searchcraft.search(searchRequest);\n setSearchResults(results);\n console.log(results.data.facets);\n\n // Extract facets from the results and update the state\n const updatedFacets = results.data.facets || null;\n setFacets(updatedFacets);\n\n log(LogLevel.DEBUG, `Search results: ${JSON.stringify(results)}`);\n log(LogLevel.DEBUG, `Updated facets: ${JSON.stringify(updatedFacets)}`);\n } catch (error) {\n console.error(`Search failed: ${(error as Error).message}`);\n log(\n LogLevel.ERROR,\n `Search failed with error: ${(error as Error).message}`,\n );\n } finally {\n setIsRequesting(false);\n }\n },\n initialize: (searchcraftInstance, debug = false) => {\n searchcraft = searchcraftInstance;\n debuggerInstance = debug\n ? new SDKDebugger({ logLevel: LogLevel.DEBUG })\n : null;\n\n log(LogLevel.INFO, 'Searchcraft store initialized.');\n },\n };\n});\n\n// Zustand store for Theme state\nconst useThemeStore = create<ThemeState>((set) => ({\n theme: 'light',\n toggleTheme: () =>\n set((state) => ({ theme: state.theme === 'light' ? 'dark' : 'light' })),\n}));\n\n// Export the Zustand stores for use in Stencil components\nexport { useSearchcraftStore, useThemeStore };\n"]}
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-
|
|
1
|
+
export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-c9cd5533.js';
|
|
2
2
|
export { e as extractDynamicProperties, p as parseCustomStyles, a as parseSearchKeys, s as serializeStyles } from './p-17c94ac1.js';
|
|
3
|
-
export { u as useSearchcraftStore, a as useThemeStore } from './p-
|
|
3
|
+
export { u as useSearchcraftStore, a as useThemeStore } from './p-5aa6335f.js';
|
|
4
4
|
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h } from './p-
|
|
1
|
+
import { p as proxyCustomElement, H, h } from './p-c9cd5533.js';
|
|
2
2
|
|
|
3
3
|
const SearchcraftClearIconSet = /*@__PURE__*/ proxyCustomElement(class SearchcraftClearIconSet extends H {
|
|
4
4
|
constructor() {
|
|
@@ -41,4 +41,4 @@ defineCustomElement();
|
|
|
41
41
|
|
|
42
42
|
export { SearchcraftClearIconSet as S, defineCustomElement as d };
|
|
43
43
|
|
|
44
|
-
//# sourceMappingURL=p-
|
|
44
|
+
//# sourceMappingURL=p-05cd002d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-05cd002d.js","mappings":";;MAMa,uBAAuB;;;;;oBAMhC,aAAa;;IAEf,MAAM;QACJ,QAAQ,IAAI,CAAC,IAAI;YACf,KAAK,aAAa;gBAChB,QACE,WACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,aAAO,EAAE,EAAC,YAAY,yCAA2C,EACjE,YACE,CAAC,EAAC,uIAAuI,EACzI,MAAM,EAAC,OAAO,kBACD,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EACN;YACJ,KAAK,YAAY;gBACf,QACE,WACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,aAAO,EAAE,EAAC,YAAY,wCAA0C,EAChE,YACE,CAAC,EAAC,uIAAuI,EACzI,MAAM,EAAC,OAAO,kBACD,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EACN;YACJ,KAAK,aAAa;gBAChB,QACE,WACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,aAAO,EAAE,EAAC,YAAY,yCAA2C,EACjE,YACE,CAAC,EAAC,uCAAuC,EACzC,MAAM,EAAC,SAAS,kBACH,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EACN;YACJ,KAAK,YAAY;gBACf,QACE,WACE,KAAK,EAAC,GAAG,EACT,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,aAAO,EAAE,EAAC,YAAY,wCAA0C,EAChE,YACE,CAAC,EAAC,qBAAqB,EACvB,MAAM,EAAC,SAAS,kBACH,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,EACN;YAEJ;gBACE,OAAO,IAAI,CAAC;SACf;KACF;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/assets/searchcraft-clear-icon-set.tsx"],"sourcesContent":["import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-clear-icon-set',\n shadow: true,\n})\nexport class SearchcraftClearIconSet {\n /**\n * Type of the icon to display.\n * Options: 'clear-light', 'clear-dark', 'arrow-light', 'arrow-dark'\n */\n @Prop() type: 'clear-light' | 'clear-dark' | 'arrow-light' | 'arrow-dark' =\n 'clear-light';\n\n render() {\n switch (this.type) {\n case 'clear-light':\n return (\n <svg\n width='22'\n height='22'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Clear Input Icon Light</title>\n <path\n 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'\n stroke='black'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n case 'clear-dark':\n return (\n <svg\n width='22'\n height='22'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Clear Input Icon Dark</title>\n <path\n 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'\n stroke='white'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n case 'arrow-light':\n return (\n <svg\n width='20'\n height='21'\n viewBox='0 0 20 21'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Arrow Right Icon Light</title>\n <path\n d='M7.5 15.0444L12.5 10.0444L7.5 5.04443'\n stroke='#737373'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n case 'arrow-dark':\n return (\n <svg\n width='8'\n height='12'\n viewBox='0 0 8 12'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>Searchcraft Arrow Right Icon Dark</title>\n <path\n d='M1.5 11L6.5 6L1.5 1'\n stroke='#BFBFBF'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n\n default:\n return null;\n }\n }\n}\n"],"version":3}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h } from './p-
|
|
1
|
+
import { p as proxyCustomElement, H, h } from './p-c9cd5533.js';
|
|
2
2
|
import { c as classNames } from './p-5cdc6210.js';
|
|
3
3
|
|
|
4
4
|
const searchcraftInputCaptionModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputCaptionLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040}.inputCaptionDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6}.inputCaptionErrorLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.inputCaptionErrorDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}.inputCaptionLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040;text-align:right}.inputCaptionDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6;text-align:right}.inputCaptionErrorLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000;text-align:right}.inputCaptionErrorDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3;text-align:right}";
|
|
@@ -58,4 +58,4 @@ defineCustomElement();
|
|
|
58
58
|
|
|
59
59
|
export { SearchcraftInputCaption as S, defineCustomElement as d };
|
|
60
60
|
|
|
61
|
-
//# sourceMappingURL=p-
|
|
61
|
+
//# sourceMappingURL=p-25bd714c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-25bd714c.js","mappings":";;;AAAA,MAAM,gCAAgC,GAAG,8oCAA8oC,CAAC;AACxrC,sCAAe,gCAAgC;;MCOlC,uBAAuB;;;;;;qCAED,EAAE;iCACP,cAAc;sCACT,KAAK;qBACrB,OAAO;;IAEhB,YAAY;QAClB,OAAO,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC;KAC/B;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,sBAAsB,IAChC,SACE,KAAK,EAAE,UAAU,CACf,IAAI,CAAC,KAAK;kBACN,IAAI,CAAC,YAAY;sBACf,2BAA2B;sBAC3B,0BAA0B;kBAC5B,IAAI,CAAC,YAAY;sBACf,sBAAsB;sBACtB,qBAAqB,EAC3B,IAAI,CAAC,qBAAqB,EAC1B,4BAA4B,CAC7B,IAEA,IAAI,CAAC,iBAAiB,CACrB,KAEJ,SACE,KAAK,EAAE,UAAU,CACf,IAAI,CAAC,KAAK;kBACN,IAAI,CAAC,YAAY;sBACf,2BAA2B;sBAC3B,0BAA0B;kBAC5B,IAAI,CAAC,YAAY;sBACf,sBAAsB;sBACtB,qBAAqB,EAC3B,IAAI,CAAC,qBAAqB,EAC1B,4BAA4B,CAC7B,IAEA,IAAI,CAAC,iBAAiB,CACrB,CACL,CAAC;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-input-caption/searchcraft-input-caption.module.scss?tag=searchcraft-input-caption&encapsulation=shadow","src/components/searchcraft-input-caption/searchcraft-input-caption.tsx"],"sourcesContent":["@import '../../utils/theme';\n\n:root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n@mixin input-caption-base {\n font-family: var(--font-stack);\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n margin-top: 4px;\n}\n\n@mixin input-caption-base-light {\n @include input-caption-base;\n color: $light-input-caption-color;\n}\n\n@mixin input-caption-base-dark {\n @include input-caption-base;\n color: $dark-input-caption-color;\n}\n\n.inputCaptionLightLTR {\n @include input-caption-base-light;\n}\n\n.inputCaptionDarkLTR {\n @include input-caption-base-dark;\n}\n\n.inputCaptionErrorLightLTR {\n @include input-caption-base;\n color: $light-input-caption-color-error;\n}\n\n.inputCaptionErrorDarkLTR {\n @include input-caption-base;\n color: $dark-input-caption-color-error;\n}\n\n.inputCaptionLightRTL {\n @include input-caption-base-light;\n text-align: right;\n}\n\n.inputCaptionDarkRTL {\n @include input-caption-base-dark;\n text-align: right;\n}\n\n.inputCaptionErrorLightRTL {\n @include input-caption-base;\n color: $light-input-caption-color-error;\n text-align: right;\n}\n\n.inputCaptionErrorDarkRTL {\n @include input-caption-base;\n color: $dark-input-caption-color-error;\n text-align: right;\n}","import { Component, Prop, h, State } from '@stencil/core';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'searchcraft-input-caption',\n styleUrl: 'searchcraft-input-caption.module.scss',\n shadow: true,\n})\nexport class SearchcraftInputCaption {\n @Prop() error?: boolean;\n @Prop() inputCaptionClassName? = '';\n @Prop() inputCaptionValue = 'Enter Search';\n @Prop() rightToLeftOrientation = false;\n @State() theme = 'light';\n\n private isLightTheme() {\n return this.theme === 'light';\n }\n\n render() {\n return this.rightToLeftOrientation ? (\n <p\n class={classNames(\n this.error\n ? this.isLightTheme\n ? 'inputCaptionErrorLightRTL'\n : 'inputCaptionErrorDarkRTL'\n : this.isLightTheme\n ? 'inputCaptionLightRTL'\n : 'inputCaptionDarkRTL',\n this.inputCaptionClassName,\n '.searchcraft-input-caption',\n )}\n >\n {this.inputCaptionValue}\n </p>\n ) : (\n <p\n class={classNames(\n this.error\n ? this.isLightTheme\n ? 'inputCaptionErrorLightLTR'\n : 'inputCaptionErrorDarkLTR'\n : this.isLightTheme\n ? 'inputCaptionLightLTR'\n : 'inputCaptionDarkLTR',\n this.inputCaptionClassName,\n '.searchcraft-input-caption',\n )}\n >\n {this.inputCaptionValue}\n </p>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './p-
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './p-c9cd5533.js';
|
|
2
2
|
import { c as classNames } from './p-5cdc6210.js';
|
|
3
3
|
import { p as parseCustomStyles } from './p-17c94ac1.js';
|
|
4
|
-
import { d as defineCustomElement$7 } from './p-
|
|
5
|
-
import { d as defineCustomElement$6 } from './p-
|
|
6
|
-
import { d as defineCustomElement$5 } from './p-
|
|
7
|
-
import { d as defineCustomElement$4 } from './p-
|
|
8
|
-
import { d as defineCustomElement$3 } from './p-
|
|
9
|
-
import { d as defineCustomElement$2 } from './p-
|
|
10
|
-
import { d as defineCustomElement$1 } from './p-
|
|
4
|
+
import { d as defineCustomElement$7 } from './p-05cd002d.js';
|
|
5
|
+
import { d as defineCustomElement$6 } from './p-403f6115.js';
|
|
6
|
+
import { d as defineCustomElement$5 } from './p-25bd714c.js';
|
|
7
|
+
import { d as defineCustomElement$4 } from './p-f2e41d24.js';
|
|
8
|
+
import { d as defineCustomElement$3 } from './p-71dff048.js';
|
|
9
|
+
import { d as defineCustomElement$2 } from './p-50ca3fe4.js';
|
|
10
|
+
import { d as defineCustomElement$1 } from './p-e0e0fc94.js';
|
|
11
11
|
|
|
12
12
|
const searchcraftInputModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputContainerLTR{position:relative;width:100%}.inputContainerRTL{position:relative;width:100%;margin-left:8px}.inputLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-right:8px;padding-left:36px;padding-right:16px}.inputLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightLTR::placeholder{color:#737373}.inputLightLTR:focus{outline:2px solid #000}.inputDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-right:8px;padding-left:36px;padding-right:16px}.inputDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkLTR::placeholder{color:#BFBFBF}.inputDarkLTR:focus{outline:2px solid #FFF}.inputErrorLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightLTR::placeholder{color:#737373}.inputErrorLightLTR:focus{outline:2px solid #000}.inputErrorLightLTR:focus-visible{outline:2px solid #c00}.inputErrorDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkLTR::placeholder{color:#BFBFBF}.inputErrorDarkLTR:focus{outline:2px solid #FFF}.inputErrorDarkLTR:focus-visible{outline:2px solid #FFB3B3}.inputLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightRTL::placeholder{color:#737373}.inputLightRTL:focus{outline:2px solid #000}.inputDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkRTL::placeholder{color:#BFBFBF}.inputDarkRTL:focus{outline:2px solid #FFF}.inputErrorLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightRTL::placeholder{color:#737373}.inputErrorLightRTL:focus{outline:2px solid #000}.inputErrorLightRTL:focus-visible{outline:2px solid #c00}.inputErrorDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkRTL::placeholder{color:#BFBFBF}.inputErrorDarkRTL:focus{outline:2px solid #FFF}.inputErrorDarkRTL:focus-visible{outline:2px solid #FFB3B3}.inputWrapper{align-items:center;display:flex;position:relative;width:100%}";
|
|
13
13
|
const SearchcraftInputStyle0 = searchcraftInputModuleCss;
|
|
@@ -19,6 +19,7 @@ const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput
|
|
|
19
19
|
this.__attachShadow();
|
|
20
20
|
this.clearInput = createEvent(this, "clearInput", 7);
|
|
21
21
|
this.searchInputChange = createEvent(this, "searchInputChange", 7);
|
|
22
|
+
this.inputKeyUp = createEvent(this, "inputKeyUp", 7);
|
|
22
23
|
this.customStyles = {};
|
|
23
24
|
this.error = false;
|
|
24
25
|
this.formClassName = '';
|
|
@@ -40,6 +41,10 @@ const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput
|
|
|
40
41
|
const input = event.target;
|
|
41
42
|
this.searchInputChange.emit(input.value);
|
|
42
43
|
}
|
|
44
|
+
handleInputKeyUp(event) {
|
|
45
|
+
const input = event.target;
|
|
46
|
+
this.inputKeyUp.emit(input.value);
|
|
47
|
+
}
|
|
43
48
|
handleClearInput() {
|
|
44
49
|
if (this.clearInput) {
|
|
45
50
|
this.clearInput.emit();
|
|
@@ -60,11 +65,11 @@ const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput
|
|
|
60
65
|
const placeholderStyle = {
|
|
61
66
|
fontSize: validatedCustomStyles.placeholderFontSize || '16px',
|
|
62
67
|
};
|
|
63
|
-
return (h("div", { key: '
|
|
68
|
+
return (h("div", { key: 'ca2698b808ef606d890817f6b8c133503663570e', class: classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (h(Fragment, null, h("input", { class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
|
|
64
69
|
#searchcraft-input-id::placeholder {
|
|
65
70
|
font-size: ${placeholderStyle.fontSize};
|
|
66
71
|
}
|
|
67
|
-
`), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (h("div", { class: 'inputWrapper' }, h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }), h("input", { class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
|
|
72
|
+
`), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (h("div", { class: 'inputWrapper' }, h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }), h("input", { class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
|
|
68
73
|
#searchcraft-input-id::placeholder {
|
|
69
74
|
font-size: ${placeholderStyle.fontSize};
|
|
70
75
|
}
|
|
@@ -138,4 +143,4 @@ defineCustomElement();
|
|
|
138
143
|
|
|
139
144
|
export { SearchcraftInput as S, defineCustomElement as d };
|
|
140
145
|
|
|
141
|
-
//# sourceMappingURL=p-
|
|
146
|
+
//# sourceMappingURL=p-37df2122.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-37df2122.js","mappings":";;;;;;;;;;;AAAA,MAAM,yBAAyB,GAAG,2sHAA2sH,CAAC;AAC9uH,+BAAe,yBAAyB;;MCsB3B,gBAAgB;;;;;;;;4BAC6B,EAAE;qBAC1C,KAAK;6BACG,EAAE;qCACM,EAAE;iCACN,EAAE;8BACL,EAAE;+BACD,EAAE;8BACH,EAAE;4BACJ,KAAK;gCACD,cAAc;sCACR,KAAK;qBACtB,EAAE;qBAMD,OAAO;;IAExB,IAAY,YAAY;QACtB,OAAO,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC;KAC/B;IAED,iBAAiB,CAAC,KAAY;QAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;QAC/C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC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D,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,GACnD,CACH,EACA,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,KACpB,sCACE,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,GACnD,CACH,CACG,CACP,CACG,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-input/searchcraft-input.module.scss?tag=searchcraft-input&encapsulation=shadow","src/components/searchcraft-input/searchcraft-input.tsx"],"sourcesContent":["@import '../../utils/theme';\n\n:root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n@mixin input-container-base {\n position: relative;\n width: 100%;\n}\n\n@mixin input-base {\n border: none;\n border-radius: 8px;\n font-family: var(--font-stack);\n outline: none;\n padding-bottom: 15px;\n padding-top: 15px;\n width: 100%;\n\n &::placeholder {\n font-family: var(--font-stack);\n font-size: 16px;\n }\n}\n\n@mixin input-base-light {\n @include input-base;\n background-color: $light-input-background-color;\n color: $light-input-label-color;\n\n &::placeholder {\n color: $light-input-placeholder-color;\n }\n\n &:focus {\n outline: 2px solid $light-input-outline-focus;\n }\n}\n\n@mixin input-base-dark {\n @include input-base;\n background-color: $dark-input-background-color;\n color: $dark-input-label-color;\n\n &::placeholder {\n color: $dark-input-placeholder-color;\n }\n\n &:focus {\n outline: 2px solid $dark-input-outline-focus;\n }\n}\n\n@mixin input-error-base-light {\n @include input-base-light;\n outline: 2px solid $light-input-error-outline;\n\n &:focus-visible {\n outline: 2px solid $light-input-error-outline,\n }\n}\n\n@mixin input-error-base-dark {\n @include input-base-dark;\n outline: 2px solid $dark-input-error-outline;\n\n &:focus-visible {\n outline: 2px solid $dark-input-error-outline;\n }\n}\n\n.inputContainerLTR {\n @include input-container-base;\n}\n\n.inputContainerRTL {\n @include input-container-base;\n margin-left: 8px;\n}\n\n@mixin align-LTR {\n margin-right: 8px;\n padding-left: 36px;\n padding-right: 16px;\n}\n\n.inputLightLTR {\n @include input-base-light;\n @include align-LTR;\n}\n\n.inputDarkLTR {\n @include input-base-dark;\n @include align-LTR;\n}\n\n.inputErrorLightLTR {\n @include input-error-base-light;\n @include align-LTR;\n}\n\n.inputErrorDarkLTR {\n @include input-error-base-dark;\n @include align-LTR;\n}\n\n@mixin align-RTL {\n margin-left: 8px;\n padding-left: 16px;\n padding-right: 36px;\n text-align: right;\n}\n\n.inputLightRTL {\n @include input-base-light;\n @include align-RTL;\n}\n\n.inputDarkRTL {\n @include input-base-dark;\n @include align-RTL;\n}\n\n.inputErrorLightRTL {\n @include input-error-base-light;\n @include align-RTL;\n}\n\n.inputErrorDarkRTL {\n @include input-error-base-dark;\n @include align-RTL;\n}\n\n.inputWrapper {\n align-items: center;\n display: flex;\n position: relative;\n width: 100%;\n}\n","import {\n Component,\n h,\n Prop,\n State,\n Event,\n Fragment,\n type EventEmitter,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\nimport { parseCustomStyles } from '@utils/utils';\n\nexport interface ScInputCustomEvent<T> extends CustomEvent<T> {\n detail: T;\n target: HTMLSearchcraftInputElement;\n}\n\n@Component({\n tag: 'searchcraft-input',\n styleUrl: 'searchcraft-input.module.scss',\n shadow: true,\n})\nexport class SearchcraftInput {\n @Prop() customStyles: string | Record<string, string> = {};\n @Prop() error = false;\n @Prop() formClassName = '';\n @Prop() inputCaptionClassName = '';\n @Prop() inputCaptionValue = '';\n @Prop() inputClassName = '';\n @Prop() inputIconHeight = 20;\n @Prop() inputIconWidth = 20;\n @Prop() isRequesting = false;\n @Prop() placeholderValue = 'Enter Search';\n @Prop() rightToLeftOrientation = false;\n @Prop() query = '';\n\n @Event() clearInput: EventEmitter<void>;\n @Event() searchInputChange: EventEmitter<string>;\n @Event() inputKeyUp: EventEmitter<string>;\n\n @State() theme = 'light';\n\n private get isLightTheme() {\n return this.theme === 'light';\n }\n\n handleInputChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.searchInputChange.emit(input.value);\n }\n\n handleInputKeyUp(event: KeyboardEvent) {\n const input = event.target as HTMLInputElement;\n this.inputKeyUp.emit(input.value);\n }\n\n handleClearInput() {\n if (this.clearInput) {\n this.clearInput.emit();\n }\n }\n\n render() {\n const containerClassName = this.rightToLeftOrientation\n ? 'inputContainerRTL'\n : 'inputContainerLTR';\n\n const inputClassName = classNames(\n this.error\n ? this.isLightTheme\n ? 'inputErrorLightRTL'\n : 'inputErrorDarkRTL'\n : this.isLightTheme\n ? 'inputLightLTR'\n : 'inputDarkLTR',\n 'searchcraft-input',\n );\n\n const validatedCustomStyles = parseCustomStyles(this.customStyles);\n\n const placeholderStyle = {\n fontSize: validatedCustomStyles.placeholderFontSize || '16px',\n };\n return (\n <div\n class={classNames(\n containerClassName,\n this.formClassName,\n 'searchcraft-input-form',\n )}\n >\n {this.rightToLeftOrientation ? (\n <Fragment>\n <input\n class={classNames(inputClassName, 'searchcraft-input')}\n id='searchcraft-input-id'\n onChange={this.handleInputChange.bind(this)}\n onKeyUp={this.handleInputKeyUp.bind(this)}\n placeholder={this.placeholderValue}\n type='text'\n value={this.query}\n style={validatedCustomStyles}\n />\n <style>\n {`\n #searchcraft-input-id::placeholder {\n font-size: ${placeholderStyle.fontSize};\n }\n `}\n </style>\n {this.inputCaptionValue && (\n <searchcraft-input-caption\n inputCaptionClassName={this.inputCaptionClassName}\n inputCaptionValue={this.inputCaptionValue}\n rightToLeftOrientation={this.rightToLeftOrientation}\n />\n )}\n {this.query.length > 0 && (\n <searchcraft-clear-input-button\n isRequesting={this.isRequesting}\n onClearInput={this.handleClearInput}\n rightToLeftOrientation={this.rightToLeftOrientation}\n />\n )}\n <searchcraft-input-icon\n error={this.error}\n height={this.inputIconHeight}\n rightToLeftOrientation={this.rightToLeftOrientation}\n width={this.inputIconWidth}\n />\n </Fragment>\n ) : (\n <div class='inputWrapper'>\n <searchcraft-input-icon\n error={this.error}\n height={this.inputIconHeight}\n rightToLeftOrientation={this.rightToLeftOrientation}\n width={this.inputIconWidth}\n />\n <input\n class={classNames(inputClassName, 'searchcraft-input')}\n id='searchcraft-input-id'\n onChange={this.handleInputChange.bind(this)}\n onKeyUp={this.handleInputKeyUp.bind(this)}\n placeholder={this.placeholderValue}\n type='text'\n value={this.query}\n style={validatedCustomStyles}\n />\n <style>\n {`\n #searchcraft-input-id::placeholder {\n font-size: ${placeholderStyle.fontSize};\n }\n `}\n </style>\n {this.inputCaptionValue && (\n <searchcraft-input-caption\n inputCaptionClassName={this.inputCaptionClassName}\n inputCaptionValue={this.inputCaptionValue}\n rightToLeftOrientation={this.rightToLeftOrientation}\n />\n )}\n {this.query.length > 0 && (\n <searchcraft-clear-input-button\n isRequesting={this.isRequesting}\n onClearInput={this.handleClearInput}\n rightToLeftOrientation={this.rightToLeftOrientation}\n />\n )}\n </div>\n )}\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, c as createEvent, h } from './p-
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h } from './p-c9cd5533.js';
|
|
2
2
|
|
|
3
3
|
const searchcraftBaseSearchResultModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{background-color:#FAFAFA;align-items:flex-start;border-radius:16px;display:flex;position:relative;flex-direction:column;gap:16px;padding:8px}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{background-color:#2E2E2E;align-items:flex-start;border-radius:16px;display:flex;position:relative;flex-direction:column;gap:16px;padding:8px}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{position:absolute;right:5px;top:-2px;display:inline-block}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-height:540px;max-width:100%}@media (min-width: 600px){.imageContainer{max-height:175px}}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.imageLight{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0px;position:relative;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0px;position:relative;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}";
|
|
4
4
|
const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
|
|
@@ -83,4 +83,4 @@ defineCustomElement();
|
|
|
83
83
|
|
|
84
84
|
export { SearchcraftBaseSearchResult as S, defineCustomElement as d };
|
|
85
85
|
|
|
86
|
-
//# sourceMappingURL=p-
|
|
86
|
+
//# sourceMappingURL=p-3cbac2bb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-3cbac2bb.js","mappings":";;AAAA,MAAM,oCAAoC,GAAG,0zFAA0zF,CAAC;AACx2F,0CAAe,oCAAoC;;MCMtC,2BAA2B;;;;;;;;QAa7B,mBAAc,GAAe,SAAQ,CAAC;QACtC,oBAAe,GAAe,SAAQ,CAAC;QACvC,mBAAc,GAAe,SAAQ,CAAC;QAEvC,sBAAiB,GAAG;YAC1B,IAAI,CAAC,cAAc,EAAE,CAAC;SACvB,CAAC;QAEM,yBAAoB,GAAG;YAC7B,IAAI,IAAI,CAAC,aAAa,EAAE;gBACtB,IAAI,CAAC,cAAc,EAAE,CAAC;aACvB;SACF,CAAC;0BAxBmB,EAAE;gCACI,EAAE;2BACP,EAAE;6BACA,KAAK;8BACJ,EAAE;gCACA,EAAE;+BACH,EAAE;2BACN,EAAE;8BACC,EAAE;yBACW,OAAO;4BACtB,IAAI;;IAgBnB,WAAW;QACjB,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACtC;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;YACrD,OAAO,EAAE,CAAC;SACX;KACF;IAED,MAAM;QACJ,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAElC,QACE,4DACE,KAAK,EACH,IAAI,CAAC,aAAa;kBACd,YAAY;sBACV,iCAAiC;sBACjC,gCAAgC;kBAClC,iBAAiB,EAEvB,KAAK,EAAE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AEZ,IAAI,CAAC,UAAU,CACT,CACV,CACG,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.module.scss?tag=searchcraft-base-search-result&encapsulation=shadow","src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["@import '../../utils/theme';\n\n:root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n@mixin interactive-result-container-base {\n align-items: flex-start;\n border-radius: 16px;\n display: flex;\n position: relative;\n flex-direction: column;\n gap: 16px;\n padding: 8px;\n\n @media (min-width: 600px) {\n flex-direction: row;\n }\n}\n\n.interactiveResultContainerLight {\n background-color: $light-search-result-container-background;\n @include interactive-result-container-base;\n}\n\n.interactiveResultContainerDark {\n background-color: $dark-search-result-container-background;\n @include interactive-result-container-base;\n}\n\n.resultContainer {\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n @media (min-width: 600px) {\n flex-direction: row;\n }\n}\n\n.interactiveIconLarge {\n display: inline-block;\n position: absolute;\n right: 5px;\n top: 8px;\n\n\n @media (max-width: 600px) {\n display: none;\n }\n}\n\n.interactiveIconSmall {\n position: absolute;\n right: 5px;\n top: -2px;\n display: inline-block;\n\n\n @media (min-width: 600px) {\n display: none;\n }\n}\n\n.imageContainer {\n max-height: 540px;\n max-width: 100%;\n\n @media (min-width: 600px) {\n max-height: 175px;\n }\n}\n\n.contentContainer {\n max-height: 100%;\n max-width: 100%;\n\n @media (min-width: 600px) {\n max-width: 50%;\n }\n}\n\n@mixin image-base {\n aspect-ratio: 2 / 1;\n border-radius: 8px;\n max-height: 100%;\n max-width: 100%;\n}\n\n.imageLight {\n @include image-base;\n border: 1px solid $light-search-result-image-border;\n}\n\n.imageDark {\n @include image-base;\n border: 1px solid $dark-search-result-image-border;\n}\n\n@mixin heading-base {\n font-family: var(--font-stack);\n font-size: 16px;\n font-weight: 700;\n line-height: 20px;\n margin-bottom: 4px;\n margin-top: 0px;\n position: relative;\n}\n\n.headingLight {\n @include heading-base;\n color: $light-search-result-heading-color;\n}\n\n.headingDark {\n @include heading-base;\n color: $dark-search-result-heading-color;\n}\n\n@mixin subheading-base {\n font-family: var(--font-stack);\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n margin-bottom: 4px;\n margin-top: 0px;\n}\n\n.subheadingLight {\n @include subheading-base;\n color: $light-search-result-subheading-color;\n}\n\n.subheadingDark {\n @include subheading-base;\n color: $dark-search-result-subheading-color\n}\n\n@mixin body-content-base {\n font-family: var(--font-stack);\n font-size: 16px;\n font-weight: 400;\n line-height: 20px;\n margin-bottom: 4px;\n margin-top: 0px;\n}\n\n.primaryContentLight {\n @include body-content-base;\n color: $light-search-result-body-content-color;\n}\n\n.primaryContentDark {\n @include body-content-base;\n color: $dark-search-result-body-content-color;\n}\n\n.secondaryContentLight {\n @include body-content-base;\n color: $light-search-result-body-content-color;\n}\n\n.secondaryContentDark {\n @include body-content-base;\n color: $dark-search-result-body-content-color;\n}\n\n.tertiaryContentLight {\n @include body-content-base;\n color: $light-search-result-body-content-color;\n}\n\n.tertiaryContentDark {\n @include body-content-base;\n color: $dark-search-result-body-content-color;\n}","import { Component, Event, h, Prop } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-base-search-result',\n styleUrl: 'searchcraft-base-search-result.module.scss',\n shadow: true,\n})\nexport class SearchcraftBaseSearchResult {\n @Prop() buttonText = ''; // Label for the button\n @Prop() imageDescription = ''; // Alternative text for the image\n @Prop() imageSource = ''; // Source URL for the image\n @Prop() isInteractive = false; // Determines if the result is interactive\n @Prop() primaryContent = ''; // Primary body content\n @Prop() secondaryContent = ''; // Secondary body content\n @Prop() tertiaryContent = ''; // Tertiary body content\n @Prop() headingText = ''; // Text for the heading\n @Prop() subheadingText = ''; // Text for the subheading\n @Prop() themeMode: 'light' | 'dark' = 'light'; // Light or dark theme context\n @Prop() customStyles = '{}'; // New string prop for serialized styles.\n\n @Event() buttonCallback: () => void = () => {}; // Callback for button click\n @Event() keyDownCallback: () => void = () => {}; // Callback for key down event\n @Event() resultCallback: () => void = () => {}; // Callback for result container click\n\n private handleButtonClick = () => {\n this.buttonCallback();\n };\n\n private handleContainerClick = () => {\n if (this.isInteractive) {\n this.resultCallback();\n }\n };\n\n private parseStyles(): Record<string, { [key: string]: string }> {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n\n render() {\n const isLightTheme = this.themeMode === 'light';\n const styles = this.parseStyles();\n\n return (\n <div\n class={\n this.isInteractive\n ? isLightTheme\n ? 'interactiveResultContainerLight'\n : 'interactiveResultContainerDark'\n : 'resultContainer'\n }\n style={styles.container || {}}\n tabindex='0'\n onClick={this.handleContainerClick}\n onKeyDown={this.keyDownCallback}\n >\n <div class='imageContainer'>\n <img\n alt={this.imageDescription}\n src={this.imageSource}\n style={styles.image || {}}\n class={isLightTheme ? 'imageLight' : 'imageDark'}\n />\n </div>\n <div class='contentContainer'>\n <h2\n style={styles.heading || {}}\n class={isLightTheme ? 'headingLight' : 'headingDark'}\n >\n {this.headingText}\n </h2>\n <h3\n style={styles.subheading || {}}\n class={isLightTheme ? 'subheadingLight' : 'subheadingDark'}\n >\n {this.subheadingText}\n </h3>\n <p\n style={styles.primaryContent || {}}\n class={isLightTheme ? 'primaryContentLight' : 'primaryContentDark'}\n >\n {this.primaryContent}\n </p>\n <div>\n <p\n style={styles.secondaryContent || {}}\n class={\n isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark'\n }\n >\n {this.secondaryContent}\n </p>\n <p\n style={styles.tertiaryContent || {}}\n class={\n isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark'\n }\n >\n {this.tertiaryContent}\n </p>\n </div>\n {this.buttonText && (\n <button\n onClick={this.handleButtonClick}\n style={styles.button || {}}\n type='button'\n >\n {this.buttonText}\n </button>\n )}\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, c as createEvent, h } from './p-
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h } from './p-c9cd5533.js';
|
|
2
2
|
import { c as classNames } from './p-5cdc6210.js';
|
|
3
|
-
import { d as defineCustomElement$3 } from './p-
|
|
4
|
-
import { d as defineCustomElement$2 } from './p-
|
|
5
|
-
import { d as defineCustomElement$1 } from './p-
|
|
3
|
+
import { d as defineCustomElement$3 } from './p-05cd002d.js';
|
|
4
|
+
import { d as defineCustomElement$2 } from './p-50ca3fe4.js';
|
|
5
|
+
import { d as defineCustomElement$1 } from './p-e0e0fc94.js';
|
|
6
6
|
|
|
7
7
|
const searchcraftClearInputButtonModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputClearButtonLTR{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;padding:0;position:absolute;right:25px;top:50%;transform:translateY(-50%);width:20px}.inputClearButtonRTL{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;left:25px;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:20px}";
|
|
8
8
|
const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
|
|
@@ -66,4 +66,4 @@ defineCustomElement();
|
|
|
66
66
|
|
|
67
67
|
export { SearchcraftClearInputButton as S, defineCustomElement as d };
|
|
68
68
|
|
|
69
|
-
//# sourceMappingURL=p-
|
|
69
|
+
//# sourceMappingURL=p-403f6115.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-403f6115.js","mappings":";;;;;;AAAA,MAAM,oCAAoC,GAAG,mcAAmc,CAAC;AACjf,0CAAe,oCAAoC;;MCctC,2BAA2B;;;;;;;QAc9B,qBAAgB,GAAG,CAAC,KAAiB;YAC3C,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;SACxB,CAAC;4BAhBsB,KAAK;sCACI,KAAK;qBAKrB,OAAO;;IAEhB,YAAY;QAClB,OAAO,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC;KAC/B;IAQD,MAAM;QACJ,OAAO,IAAI,CAAC,sBAAsB,IAChC,cACE,KAAK,EAAE,UAAU,CAAC,qBAAqB,EAAE,4BAA4B,CAAC,EACtE,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,IAChB,IAAI,CAAC,YAAY,IACf,oCAA6B,KAE7B,mCAA4B,CAC7B,IACC,IAAI,CAAC,YAAY,IACnB,kCAA4B,IAAI,EAAC,aAAa,GAAG,KAEjD,kCAA4B,IAAI,EAAC,YAAY,GAAG,CACjD,CACM,KAET,cACE,KAAK,EAAE,UAAU,CAAC,qBAAqB,EAAE,4BAA4B,CAAC,EACtE,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,IAChB,IAAI,CAAC,YAAY,IACf,oCAA6B,KAE7B,mCAA4B,CAC7B,IACC,IAAI,CAAC,YAAY,IACnB,kCAA4B,IAAI,EAAC,aAAa,GAAG,KAEjD,kCAA4B,IAAI,EAAC,YAAY,GAAG,CACjD,CACM,CACV,CAAC;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.scss?tag=searchcraft-clear-input-button&encapsulation=shadow","src/components/searchcraft-clear-input-button/searchcraft-clear-input-button.tsx"],"sourcesContent":[":root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n.inputClearButtonLTR {\n align-items: center;\n background: none;\n border: none;\n display: flex;\n height: 20px;\n justify-content: center;\n padding: 0;\n position: absolute;\n right: 25px;\n top: 50%;\n transform: translateY(-50%);\n width: 20px;\n}\n\n.inputClearButtonRTL {\n align-items: center;\n background: none;\n border: none;\n display: flex;\n height: 20px;\n justify-content: center;\n left: 25px;\n padding: 0;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 20px;\n}","import {\n Component,\n Event,\n type EventEmitter,\n Prop,\n h,\n State,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'searchcraft-clear-input-button',\n styleUrl: 'searchcraft-clear-input-button.module.scss',\n shadow: true,\n})\nexport class SearchcraftClearInputButton {\n @Prop() isRequesting? = false;\n @Prop() rightToLeftOrientation = false;\n\n // Updated `clearInput` to an EventEmitter\n @Event() clearInput: EventEmitter<void>;\n\n @State() theme = 'light';\n\n private isLightTheme() {\n return this.theme === 'light';\n }\n\n // Added a click handler to emit the event\n private handleClearClick = (event: MouseEvent) => {\n event.preventDefault(); // Prevent default if necessary\n this.clearInput.emit(); // Emit the event\n };\n\n render() {\n return this.rightToLeftOrientation ? (\n <button\n class={classNames('inputClearButtonRTL', '.sc-clear-input-button-rtl')}\n onClick={this.handleClearClick}\n type='button'\n >\n {this.isRequesting ? (\n this.isLightTheme ? (\n <searchcraft-spinner-light />\n ) : (\n <searchcraft-spinner-dark />\n )\n ) : this.isLightTheme ? (\n <searchcraft-clear-icon-set type='clear-light' />\n ) : (\n <searchcraft-clear-icon-set type='clear-dark' />\n )}\n </button>\n ) : (\n <button\n class={classNames('inputClearButtonLTR', '.sc-clear-input-button-ltr')}\n onClick={this.handleClearClick}\n type='button'\n >\n {this.isRequesting ? (\n this.isLightTheme ? (\n <searchcraft-spinner-light />\n ) : (\n <searchcraft-spinner-dark />\n )\n ) : this.isLightTheme ? (\n <searchcraft-clear-icon-set type='clear-light' />\n ) : (\n <searchcraft-clear-icon-set type='clear-dark' />\n )}\n </button>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h } from './p-
|
|
1
|
+
import { p as proxyCustomElement, H, h } from './p-c9cd5533.js';
|
|
2
2
|
|
|
3
3
|
const searchcraftSpinnerDarkModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerDark{height:100%;width:100%;background:conic-gradient(#000 50%, #FFFFFF);clip-path:circle(50%);mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);animation:spinning 1s linear infinite}.spinnerLight{height:100%;width:100%;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);animation:spinning 1s linear infinite}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
|
|
4
4
|
const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
|
|
@@ -10,7 +10,7 @@ const SearchcraftSpinnerDark = /*@__PURE__*/ proxyCustomElement(class Searchcraf
|
|
|
10
10
|
this.__attachShadow();
|
|
11
11
|
}
|
|
12
12
|
render() {
|
|
13
|
-
return (h("div", { key: '
|
|
13
|
+
return (h("div", { key: 'fa6235c4bf182daac64d41cd04a995aa3476b59a', class: 'spinnerContainer' }, h("div", { key: '68532114a4f25a5d12c8514e5c6d2984a68573af', class: 'spinnerDark' })));
|
|
14
14
|
}
|
|
15
15
|
static get style() { return SearchcraftSpinnerDarkStyle0; }
|
|
16
16
|
}, [1, "searchcraft-spinner-dark"]);
|
|
@@ -31,4 +31,4 @@ defineCustomElement();
|
|
|
31
31
|
|
|
32
32
|
export { SearchcraftSpinnerDark as S, defineCustomElement as d };
|
|
33
33
|
|
|
34
|
-
//# sourceMappingURL=p-
|
|
34
|
+
//# sourceMappingURL=p-50ca3fe4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-50ca3fe4.js","mappings":";;AAAA,MAAM,+BAA+B,GAAG,sqBAAsqB,CAAC;AAC/sB,qCAAe,+BAA+B;;MCMjC,sBAAsB;;;;;;IACjC,MAAM;QACJ,QACE,4DAAK,KAAK,EAAC,kBAAkB,IAC3B,4DAAK,KAAK,EAAC,aAAa,GAAG,CACvB,EACN;KACH;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.scss?tag=searchcraft-spinner-dark&encapsulation=shadow","src/components/searchcraft-spinner-dark/searchcraft-spinner-dark.tsx"],"sourcesContent":["$spinner-size: 20px;\n\n.spinnerContainer {\n background-color: transparent;\n height: $spinner-size;\n width: $spinner-size;\n}\n\n.spinnerDark {\n height: 100%;\n width: 100%;\n background: conic-gradient(#000 50%, #FFFFFF);\n clip-path: circle(50%);\n mask-image: radial-gradient(circle at center, rgba(0,0,0,0) calc($spinner-size/3), rgba(0,0,0,1) calc($spinner-size/3));\n animation: spinning 1s linear infinite;\n}\n\n.spinnerLight {\n height: 100%;\n width: 100%;\n background: conic-gradient(#737373 50%, #FFFFFF);\n clip-path: circle(50%);\n mask-image: radial-gradient(circle at center, rgba(0,0,0,0) calc($spinner-size/3), rgba(0,0,0,1) calc($spinner-size/3));\n animation: spinning 1s linear infinite;\n}\n\n@keyframes spinning {\n 0% { transform: rotate(0deg); }\n 50% {transform: rotate(180deg);}\n 100% { transform: rotate(360deg); }\n}","import { Component, h } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-spinner-dark',\n styleUrl: 'searchcraft-spinner-dark.module.scss',\n shadow: true,\n})\nexport class SearchcraftSpinnerDark {\n render() {\n return (\n <div class='spinnerContainer'>\n <div class='spinnerDark' />\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './p-
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, F as Fragment } from './p-c9cd5533.js';
|
|
2
2
|
import { c as classNames } from './p-5cdc6210.js';
|
|
3
|
-
import { d as defineCustomElement$1 } from './p-
|
|
3
|
+
import { d as defineCustomElement$1 } from './p-50ca3fe4.js';
|
|
4
4
|
|
|
5
5
|
const searchcraftButtonModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.buttonLight{border-radius:8px;display:flex;font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;padding:11px 20px;position:relative;background-color:#000;border:1px solid #E6E6E6;color:#FFF}.buttonLight:hover{cursor:pointer}.buttonLight:hover{background-color:#2E2E2E}.buttonLight:focus{outline:2px solid #000000}.buttonDark{border-radius:8px;display:flex;font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;padding:11px 20px;position:relative;background-color:#FFF;border:1px solid #404040;color:#292929}.buttonDark:hover{cursor:pointer}.buttonDark:hover{background-color:#FAFAFA}.buttonDark:focus{outline:2px solid #404040}.spinnerMarginRight{left:4px;margin-right:4px;position:absolute}.spinnerMarginLeft{left:4px;margin-left:4px;position:absolute}.buttonLabel{animation:right-and-back 0.2s;margin-left:4px;position:relative}@keyframes right-and-back{0%{right:-6px}50%{right:-12px}75%{right:-6px}100%{right:0px}}";
|
|
6
6
|
const SearchcraftButtonStyle0 = searchcraftButtonModuleCss;
|
|
@@ -59,4 +59,4 @@ defineCustomElement();
|
|
|
59
59
|
|
|
60
60
|
export { SearchcraftButton as S, defineCustomElement as d };
|
|
61
61
|
|
|
62
|
-
//# sourceMappingURL=p-
|
|
62
|
+
//# sourceMappingURL=p-574e8e3c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-574e8e3c.js","mappings":";;;;AAAA,MAAM,0BAA0B,GAAG,y/BAAy/B,CAAC;AAC7hC,gCAAe,0BAA0B;;MCe5B,iBAAiB;;;;;;QAepB,gBAAW,GAAG;YACpB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;SACzB,CAAC;;wBAfiB,KAAK;4BACD,MAAM;qBACb,QAAQ;4BAIA,KAAK;qBACZ,OAAO;;IAEhB,cAAc;QACpB,OAAO,IAAI,CAAC,KAAK,KAAK,OAAO,GAAG,aAAa,GAAG,YAAY,CAAC;KAC9D;IAMD,MAAM;QACJ,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAE1C,QACE,EAAC,QAAQ,uDACN,IAAI,CAAC,QAAQ,IACZ,cACE,KAAK,EAAE,UAAU,CAAC,WAAW,EAAE,oBAAoB,CAAC,EACpD,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,IAChB,mCAA4B,KAE5B,IAAI,CAAC,WAAW,CACjB,CACM,KAET,cACE,KAAK,EAAE,UAAU,CAAC,WAAW,EAAE,oBAAoB,CAAC,EACpD,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,KAAK,MAAM,IAAI,IAAI,CAAC,YAAY,IAChD,WAAK,KAAK,EAAC,sBAAsB,IAC/B,mCAA4B,CACxB,KAEN,IAAI,CAAC,WAAW,CACjB,EACD,YACE,KAAK,EAAE,UAAU,CACf,IAAI,CAAC,YAAY,IAAI,cAAc,EACnC,0BAA0B,CAC3B,IAEA,IAAI,CAAC,KAAK,CACN,CACA,CACV,CACQ,EACX;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-button/searchcraft-button.module.scss?tag=searchcraft-button&encapsulation=shadow","src/components/searchcraft-button/searchcraft-button.tsx"],"sourcesContent":["@import '../../utils/theme';\n\n:root {\n --font-stack: Helvetica, Arial, sans-serif;\n}\n\n@mixin button-base {\n border-radius: 8px;\n display: flex;\n font-family: var(--font-stack);\n font-size: 16px;\n font-weight: 700;\n line-height: 20px;\n padding: 11px 20px;\n position: relative;\n\n &:hover {\n cursor: pointer;\n }\n}\n\n.buttonLight {\n @include button-base;\n background-color: $light-background;\n border: 1px solid $light-button-border;\n color: $light-button-color;\n\n &:hover {\n background-color: $light-button-hover;\n }\n\n &:focus {\n outline: 2px solid $light-button-outline-focus;\n }\n}\n\n.buttonDark {\n @include button-base;\n background-color: $dark-background;\n border: 1px solid $dark-button-border;\n color: $dark-button-color;\n\n &:hover {\n background-color: $dark-button-hover;\n }\n\n &:focus {\n outline: 2px solid $dark-button-outline-focus;\n }\n}\n\n.spinnerMarginRight {\n left: 4px;\n margin-right: 4px;\n position: absolute;\n}\n\n.spinnerMarginLeft {\n left: 4px;\n margin-left: 4px;\n position: absolute;\n}\n\n.buttonLabel {\n animation: right-and-back .2s;\n margin-left: 4px;\n position: relative;\n}\n\n@keyframes right-and-back {\n 0% { right: -6px; }\n 50% { right: -12px; }\n 75% { right: -6px; }\n 100% {right: 0px; }\n}","import {\n Component,\n Event,\n type EventEmitter,\n Prop,\n h,\n State,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'searchcraft-button',\n styleUrl: 'searchcraft-button.module.scss',\n shadow: true,\n})\nexport class SearchcraftButton {\n @Prop() iconElement?: Element;\n @Prop() iconOnly = false;\n @Prop() iconPosition = 'left';\n @Prop() label = 'Search';\n\n @Event() buttonClick!: EventEmitter<void>;\n\n @State() isRequesting = false;\n @State() theme = 'light';\n\n private getButtonStyle() {\n return this.theme === 'light' ? 'buttonLight' : 'buttonDark';\n }\n\n private handleClick = () => {\n this.buttonClick.emit(); // Emit the event instead of calling a function\n };\n\n render() {\n const buttonStyle = this.getButtonStyle();\n\n return (\n <Fragment>\n {this.iconOnly ? (\n <button\n class={classNames(buttonStyle, 'searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.isRequesting ? (\n <searchcraft-spinner-dark />\n ) : (\n this.iconElement\n )}\n </button>\n ) : (\n <button\n class={classNames(buttonStyle, 'searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.iconPosition === 'left' && this.isRequesting ? (\n <div class='spinner-margin-right'>\n <searchcraft-spinner-dark />\n </div>\n ) : (\n this.iconElement\n )}\n <span\n class={classNames(\n this.isRequesting && 'button-label',\n 'searchcraft-button-label',\n )}\n >\n {this.label}\n </span>\n </button>\n )}\n </Fragment>\n );\n }\n}\n"],"version":3}
|