@jumpgroup/jump-design-system 0.3.52 → 0.3.53
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-97b3526b.js → index-e91b2b41.js} +26 -4
- package/dist/cjs/index-e91b2b41.js.map +1 -0
- package/dist/cjs/jump-accordion-group.cjs.entry.js +1 -1
- package/dist/cjs/jump-accordion.cjs.entry.js +1 -1
- package/dist/cjs/jump-badge.cjs.entry.js +1 -1
- package/dist/cjs/jump-button_2.cjs.entry.js +1 -1
- package/dist/cjs/jump-card-ecommerce-option.cjs.entry.js +1 -1
- package/dist/cjs/jump-card-ecommerce.cjs.entry.js +1 -1
- package/dist/cjs/jump-card.cjs.entry.js +1 -1
- package/dist/cjs/jump-design-system.cjs.js +2 -2
- package/dist/cjs/jump-filter-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/jump-filter.cjs.entry.js +1 -1
- package/dist/cjs/jump-filtergroup.cjs.entry.js +1 -1
- package/dist/cjs/jump-navbar.cjs.entry.js +1 -1
- package/dist/cjs/jump-pagination-table.cjs.entry.js +1 -1
- package/dist/cjs/jump-pagination.cjs.entry.js +1 -1
- package/dist/cjs/jump-quantity.cjs.entry.js +1 -1
- package/dist/cjs/jump-search-bar-dropdown-item.cjs.entry.js +46 -0
- package/dist/cjs/jump-search-bar-dropdown-item.cjs.entry.js.map +1 -0
- package/dist/cjs/jump-search-bar-mobile.cjs.entry.js +130 -0
- package/dist/cjs/jump-search-bar-mobile.cjs.entry.js.map +1 -0
- package/dist/cjs/jump-search-bar.cjs.entry.js +139 -21
- package/dist/cjs/jump-search-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/jump-tab-item.cjs.entry.js +4 -4
- package/dist/cjs/jump-tab-item.cjs.entry.js.map +1 -1
- package/dist/cjs/jump-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/jump-tab.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/jump-search-bar/jump-search-bar.css +173 -47
- package/dist/collection/components/jump-search-bar/jump-search-bar.js +424 -27
- package/dist/collection/components/jump-search-bar/jump-search-bar.js.map +1 -1
- package/dist/collection/components/jump-search-bar/jump-search-bar.stories.js +320 -49
- package/dist/collection/components/jump-search-bar/jump-search-bar.stories.js.map +1 -1
- package/dist/collection/components/jump-search-bar-dropdown-item/jump-search-bar-dropdown-item.css +3 -0
- package/dist/collection/components/jump-search-bar-dropdown-item/jump-search-bar-dropdown-item.js +122 -0
- package/dist/collection/components/jump-search-bar-dropdown-item/jump-search-bar-dropdown-item.js.map +1 -0
- package/dist/collection/components/jump-search-bar-dropdown-item/jump-search-bar-dropdown-item.stories.js +13 -0
- package/dist/collection/components/jump-search-bar-dropdown-item/jump-search-bar-dropdown-item.stories.js.map +1 -0
- package/dist/collection/components/jump-search-bar-dropdown-item/test/jump-search-bar-dropdown-item.e2e.js +10 -0
- package/dist/collection/components/jump-search-bar-dropdown-item/test/jump-search-bar-dropdown-item.e2e.js.map +1 -0
- package/dist/collection/components/jump-search-bar-dropdown-item/test/jump-search-bar-dropdown-item.spec.js +18 -0
- package/dist/collection/components/jump-search-bar-dropdown-item/test/jump-search-bar-dropdown-item.spec.js.map +1 -0
- package/dist/collection/components/jump-search-bar-mobile/jump-search-bar-mobile.css +91 -0
- package/dist/collection/components/jump-search-bar-mobile/jump-search-bar-mobile.js +414 -0
- package/dist/collection/components/jump-search-bar-mobile/jump-search-bar-mobile.js.map +1 -0
- package/dist/collection/components/jump-search-bar-mobile/jump-search-bar-mobile.stories.js +192 -0
- package/dist/collection/components/jump-search-bar-mobile/jump-search-bar-mobile.stories.js.map +1 -0
- package/dist/collection/components/jump-search-bar-mobile/test/jump-search-bar-mobile.e2e.js +10 -0
- package/dist/collection/components/jump-search-bar-mobile/test/jump-search-bar-mobile.e2e.js.map +1 -0
- package/dist/collection/components/jump-search-bar-mobile/test/jump-search-bar-mobile.spec.js +18 -0
- package/dist/collection/components/jump-search-bar-mobile/test/jump-search-bar-mobile.spec.js.map +1 -0
- package/dist/collection/components/jump-tab/jump-tab.js +1 -1
- package/dist/collection/components/jump-tab-item/jump-tab-item.css +11 -6
- package/dist/collection/components/jump-tab-item/jump-tab-item.js +2 -2
- package/dist/collection/components/jump-tab-panel/jump-tab-panel.js +1 -1
- package/dist/components/jump-search-bar-dropdown-item.d.ts +11 -0
- package/dist/components/jump-search-bar-dropdown-item.js +65 -0
- package/dist/components/jump-search-bar-dropdown-item.js.map +1 -0
- package/dist/components/jump-search-bar-mobile.d.ts +11 -0
- package/dist/components/jump-search-bar-mobile.js +175 -0
- package/dist/components/jump-search-bar-mobile.js.map +1 -0
- package/dist/components/jump-search-bar.js +159 -22
- package/dist/components/jump-search-bar.js.map +1 -1
- package/dist/components/jump-tab-item.js +3 -3
- package/dist/components/jump-tab-item.js.map +1 -1
- package/dist/components/jump-tab-panel.js +1 -1
- package/dist/components/jump-tab.js +1 -1
- package/dist/esm/{index-14b73bd6.js → index-9a1da0f0.js} +26 -4
- package/dist/esm/index-9a1da0f0.js.map +1 -0
- package/dist/esm/jump-accordion-group.entry.js +1 -1
- package/dist/esm/jump-accordion.entry.js +1 -1
- package/dist/esm/jump-badge.entry.js +1 -1
- package/dist/esm/jump-button_2.entry.js +1 -1
- package/dist/esm/jump-card-ecommerce-option.entry.js +1 -1
- package/dist/esm/jump-card-ecommerce.entry.js +1 -1
- package/dist/esm/jump-card.entry.js +1 -1
- package/dist/esm/jump-design-system.js +3 -3
- package/dist/esm/jump-filter-checkbox.entry.js +1 -1
- package/dist/esm/jump-filter.entry.js +1 -1
- package/dist/esm/jump-filtergroup.entry.js +1 -1
- package/dist/esm/jump-navbar.entry.js +1 -1
- package/dist/esm/jump-pagination-table.entry.js +1 -1
- package/dist/esm/jump-pagination.entry.js +1 -1
- package/dist/esm/jump-quantity.entry.js +1 -1
- package/dist/esm/jump-search-bar-dropdown-item.entry.js +42 -0
- package/dist/esm/jump-search-bar-dropdown-item.entry.js.map +1 -0
- package/dist/esm/jump-search-bar-mobile.entry.js +126 -0
- package/dist/esm/jump-search-bar-mobile.entry.js.map +1 -0
- package/dist/esm/jump-search-bar.entry.js +139 -21
- package/dist/esm/jump-search-bar.entry.js.map +1 -1
- package/dist/esm/jump-tab-item.entry.js +4 -4
- package/dist/esm/jump-tab-item.entry.js.map +1 -1
- package/dist/esm/jump-tab-panel.entry.js +2 -2
- package/dist/esm/jump-tab.entry.js +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/jump-design-system/jump-design-system.esm.js +1 -1
- package/dist/jump-design-system/jump-design-system.esm.js.map +1 -1
- package/dist/jump-design-system/{p-18df1585.entry.js → p-02e863db.entry.js} +2 -2
- package/dist/jump-design-system/p-07633158.entry.js +2 -0
- package/dist/jump-design-system/p-07633158.entry.js.map +1 -0
- package/dist/jump-design-system/p-1aa5fb8a.entry.js +2 -0
- package/dist/jump-design-system/p-1aa5fb8a.entry.js.map +1 -0
- package/dist/jump-design-system/{p-6e26f3ef.entry.js → p-1da9811d.entry.js} +2 -2
- package/dist/jump-design-system/p-21aa0095.js +3 -0
- package/dist/jump-design-system/p-21aa0095.js.map +1 -0
- package/dist/jump-design-system/p-2e2bd8a9.entry.js +2 -0
- package/dist/jump-design-system/{p-6f1c7238.entry.js → p-3f6d50d5.entry.js} +2 -2
- package/dist/jump-design-system/{p-8bdb9702.entry.js → p-466e0ade.entry.js} +2 -2
- package/dist/jump-design-system/{p-396d2541.entry.js → p-506950ea.entry.js} +2 -2
- package/dist/jump-design-system/{p-4b284def.entry.js → p-6acb16c6.entry.js} +3 -3
- package/dist/jump-design-system/{p-7b6c9e01.entry.js → p-6b1ab8c3.entry.js} +2 -2
- package/dist/jump-design-system/{p-53129684.entry.js → p-6dc529fc.entry.js} +2 -2
- package/dist/jump-design-system/{p-30c9d7c7.entry.js → p-6e7c80a3.entry.js} +2 -2
- package/dist/jump-design-system/p-8f581228.entry.js +2 -0
- package/dist/jump-design-system/{p-8873623c.entry.js → p-a1c25113.entry.js} +2 -2
- package/dist/jump-design-system/{p-1c882126.entry.js → p-a826c477.entry.js} +2 -2
- package/dist/jump-design-system/{p-e0e82d36.entry.js → p-b03c5b24.entry.js} +2 -2
- package/dist/jump-design-system/{p-174d297f.entry.js → p-bdafe87d.entry.js} +2 -2
- package/dist/jump-design-system/p-c77d216c.entry.js +2 -0
- package/dist/jump-design-system/p-c77d216c.entry.js.map +1 -0
- package/dist/jump-design-system/p-f7c323d2.entry.js +2 -0
- package/dist/jump-design-system/p-f7c323d2.entry.js.map +1 -0
- package/dist/jump-design-system/{p-f371718a.entry.js → p-feb825e0.entry.js} +2 -2
- package/dist/jump-design-system-elements.json +97 -3
- package/dist/types/components/jump-search-bar/jump-search-bar.d.ts +51 -11
- package/dist/types/components/jump-search-bar/jump-search-bar.stories.d.ts +137 -10
- package/dist/types/components/jump-search-bar-dropdown-item/jump-search-bar-dropdown-item.d.ts +10 -0
- package/dist/types/components/jump-search-bar-dropdown-item/jump-search-bar-dropdown-item.stories.d.ts +7 -0
- package/dist/types/components/jump-search-bar-mobile/jump-search-bar-mobile.d.ts +46 -0
- package/dist/types/components/jump-search-bar-mobile/jump-search-bar-mobile.stories.d.ts +131 -0
- package/dist/types/components.d.ts +135 -10
- package/package.json +1 -1
- package/dist/cjs/index-97b3526b.js.map +0 -1
- package/dist/esm/index-14b73bd6.js.map +0 -1
- package/dist/jump-design-system/p-134e548b.entry.js +0 -2
- package/dist/jump-design-system/p-134e548b.entry.js.map +0 -1
- package/dist/jump-design-system/p-1c5db8d3.js +0 -3
- package/dist/jump-design-system/p-1c5db8d3.js.map +0 -1
- package/dist/jump-design-system/p-3dd1f9a0.entry.js +0 -2
- package/dist/jump-design-system/p-5f12bbbb.entry.js +0 -2
- package/dist/jump-design-system/p-6363b6ee.entry.js +0 -2
- package/dist/jump-design-system/p-6363b6ee.entry.js.map +0 -1
- /package/dist/jump-design-system/{p-18df1585.entry.js.map → p-02e863db.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-6e26f3ef.entry.js.map → p-1da9811d.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-3dd1f9a0.entry.js.map → p-2e2bd8a9.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-6f1c7238.entry.js.map → p-3f6d50d5.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-8bdb9702.entry.js.map → p-466e0ade.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-396d2541.entry.js.map → p-506950ea.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-4b284def.entry.js.map → p-6acb16c6.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-7b6c9e01.entry.js.map → p-6b1ab8c3.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-53129684.entry.js.map → p-6dc529fc.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-30c9d7c7.entry.js.map → p-6e7c80a3.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-5f12bbbb.entry.js.map → p-8f581228.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-8873623c.entry.js.map → p-a1c25113.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-1c882126.entry.js.map → p-a826c477.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-e0e82d36.entry.js.map → p-b03c5b24.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-174d297f.entry.js.map → p-bdafe87d.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-f371718a.entry.js.map → p-feb825e0.entry.js.map} +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$3 } from './jump-button2.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './jump-icon2.js';
|
|
4
|
+
|
|
5
|
+
const jumpSearchBarMobileCss = ":host{display:block;position:relative;--jump-search-bar-mobile-focus-color:var(--secondary-standard, #5E79BA);--jump-search-bar-mobile-background-color:var(--gray-ultralight, #FFFFFF);--jump-search-bar-mobile-border-color:var(--neutral-grey-secondary, #707070);font-family:var(--ff-primary)}:host .DropdownWrapper{background-color:var(--jump-search-bar-mobile-background-color);padding:16px;position:fixed;top:0;left:0;height:100vh;z-index:1000;}:host .DropdownWrapper .closeButton{cursor:pointer}:host .DropdownWrapper.open{display:block}:host .DropdownWrapper:not(.open){display:none}:host .DropdownWrapper .InputWrapper{background-color:white;width:100%;display:flex;gap:12px;border-bottom:1px solid var(--jump-search-bar-mobile-border-color);padding-bottom:4px}:host .DropdownWrapper .InputWrapper.focused{border-color:var(--jump-search-bar-mobile-focus-color) !important}:host .DropdownWrapper .InputWrapper.focused jump-icon{color:var(--jump-search-bar-mobile-focus-color) !important}:host .DropdownWrapper .InputWrapper.focused input{outline:none !important}:host .DropdownWrapper input{width:100%;border:none}:host .DropdownWrapper .Results{margin-top:12px}:host .DropdownWrapper .Results__Recents .title{color:#707070;font-size:14px;line-height:20px;padding:8px 0;font-weight:700;display:flex}:host .DropdownWrapper .Results__Results .totalRes{display:flex;justify-content:space-between}:host .DropdownWrapper .Results .ResWrapper{display:flex;flex-direction:column}:host .DropdownWrapper .Results .ResWrapper div{padding:8px 0;color:#707070;font-size:14px;display:flex;gap:12px;align-items:center}:host .DropdownWrapper .Results .ResWrapper div img{width:40px;height:48px;object-fit:cover;border-radius:3px}:host .DropdownWrapper .Results .ResWrapper div:hover{cursor:pointer}:host .DropdownWrapper .Results .ResWrapper .helperText{color:#CBCBCB}:host .DropdownWrapper .Results .ResWrapper .helperText svg{width:25px;height:25px}";
|
|
6
|
+
const JumpSearchBarMobileStyle0 = jumpSearchBarMobileCss;
|
|
7
|
+
|
|
8
|
+
const JumpSearchBarMobile$1 = /*@__PURE__*/ proxyCustomElement(class JumpSearchBarMobile extends HTMLElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.__registerHost();
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.resultClicked = createEvent(this, "jump-search-bar-mobile-res-clicked", 7);
|
|
14
|
+
this.search = createEvent(this, "jump-search-bar-mobile", 7);
|
|
15
|
+
this.showFullSearch = createEvent(this, "jump-search-bar-mobile-show-all", 7);
|
|
16
|
+
// Gestisce l'evento focus sull'input
|
|
17
|
+
this.handleFocus = () => {
|
|
18
|
+
const searchBarContainer = this.jumpSearchBar.closest('.InputWrapper');
|
|
19
|
+
if (searchBarContainer) {
|
|
20
|
+
searchBarContainer.classList.add('focused');
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
// Gestisce l'evento blur sull'input
|
|
24
|
+
this.handleBlur = () => {
|
|
25
|
+
const searchBarContainer = this.jumpSearchBar.closest('.InputWrapper');
|
|
26
|
+
if (searchBarContainer) {
|
|
27
|
+
searchBarContainer.classList.remove('focused');
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
this.doSearch = () => {
|
|
31
|
+
if (this.jumpSearchBar) {
|
|
32
|
+
this.searchValue = this.jumpSearchBar.value;
|
|
33
|
+
// Iniziare la ricerca solamente se ci sono almeno tre caratteri
|
|
34
|
+
if (this.searchValue.length >= 3) {
|
|
35
|
+
this.resType = 'results';
|
|
36
|
+
this.innerResults = undefined;
|
|
37
|
+
this.search.emit({ search: this.searchValue });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
this.isOpen = false;
|
|
42
|
+
this.innerResults = [];
|
|
43
|
+
this.totalResults = 0;
|
|
44
|
+
this.resType = 'recents';
|
|
45
|
+
this.searchValue = undefined;
|
|
46
|
+
this.identifier = 'search-bar-mobile';
|
|
47
|
+
this.placeholder = 'Cerca...';
|
|
48
|
+
this.recents = [];
|
|
49
|
+
this.recentsTitle = 'Recenti';
|
|
50
|
+
this.debounceTime = 500;
|
|
51
|
+
this.loadingText = 'Sto caricando...';
|
|
52
|
+
this.noResultText = 'Nessun risultato corrispondente';
|
|
53
|
+
this.results = [];
|
|
54
|
+
this.resultsText = 'risultati';
|
|
55
|
+
this.showAllResText = 'Mostra tutti i risultati';
|
|
56
|
+
}
|
|
57
|
+
searchValueChanged(newValue) {
|
|
58
|
+
if (newValue === '') {
|
|
59
|
+
// Create a new array reference to trigger re-render
|
|
60
|
+
this.innerResults = [...this.recents];
|
|
61
|
+
this.results = [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/* ---------------------- @EVENTS ------------------------- */
|
|
65
|
+
/* ---------------------- @LIFECYCLE ------------------------- */
|
|
66
|
+
/* -------------------- @LISTEN ------------------------------- */
|
|
67
|
+
addOption(e) {
|
|
68
|
+
let props = e.detail; // es {code: 'sku1', imageUrl: 'https://google.com/'}
|
|
69
|
+
// Aggiungi l'elemento solo a `recents`
|
|
70
|
+
this.recents = [...this.recents, Object.assign({}, props)];
|
|
71
|
+
// Aggiorna `innerResults` basandoti solo su `recents`
|
|
72
|
+
this.innerResults = [...this.recents];
|
|
73
|
+
}
|
|
74
|
+
/* -------------------- @METHOD ------------------------------- */
|
|
75
|
+
/** Imposta i risultati della ricerca all'interno della dropdown */
|
|
76
|
+
async setResults(results, tot) {
|
|
77
|
+
this.results = results;
|
|
78
|
+
this.innerResults = results;
|
|
79
|
+
this.totalResults = tot;
|
|
80
|
+
}
|
|
81
|
+
/* -------------------- LOCAL METHODS ------------------------- */
|
|
82
|
+
openDropdown() {
|
|
83
|
+
console.log('openDropdown');
|
|
84
|
+
this.isOpen = true;
|
|
85
|
+
}
|
|
86
|
+
closeDropdown() {
|
|
87
|
+
this.isOpen = false;
|
|
88
|
+
}
|
|
89
|
+
/** Emette l'evento quando l'utente clicca sul pulsante (se presente) o nel pulsante del dropdown per vedere tutti i risultati */
|
|
90
|
+
btnOrShowOtherClicked() {
|
|
91
|
+
this.showFullSearch.emit({ search: this.searchValue });
|
|
92
|
+
}
|
|
93
|
+
/** Emette l'evento di click su un risultato, mandandone tutti i dati */
|
|
94
|
+
handleResClicked(item) {
|
|
95
|
+
this.resultClicked.emit({ clicked: item });
|
|
96
|
+
}
|
|
97
|
+
debounce(fn, delay = this.debounceTime) {
|
|
98
|
+
let timeoutId;
|
|
99
|
+
return (...args) => {
|
|
100
|
+
if (timeoutId) {
|
|
101
|
+
clearTimeout(timeoutId);
|
|
102
|
+
}
|
|
103
|
+
timeoutId = setTimeout(() => {
|
|
104
|
+
fn.apply(null, args);
|
|
105
|
+
}, delay);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
;
|
|
109
|
+
/* --------------------- RENDER ------------------------------- */
|
|
110
|
+
render() {
|
|
111
|
+
return (h(Host, { key: 'f0535a70395bacabc372999896fc410c948bbed4', class: "JumpSearchBarMobile", ref: (el) => (this.componentRef = el) }, h("jump-icon", { key: '34431a69c6c68f48b5f92b03f5a876f485d66e34', name: "magnifying-glass", category: "light", onClick: () => this.openDropdown() }), h("div", { key: '89575c7a7a1c0a601a589ac451242e591d907a43', class: "DropdownWrapper " + (this.isOpen ? 'open' : '') }, h("div", { key: '633c8543dc2eaf36b7fc61857d7d63aadf852cd8', class: "InputWrapper" }, h("jump-icon", { key: '3c85be9683007c77faf9fe705c382b753dc8d6fb', class: "closeButton", category: "light", name: "arrow-left", onClick: () => this.closeDropdown() }), h("input", { key: '29f98929f8ed596072f1fe31d5820e9bde0a5604', placeholder: this.placeholder, type: "search", id: this.identifier, class: "search-input", ref: (el) => { this.jumpSearchBar = el; }, onInput: this.debounce(this.doSearch), onFocus: this.handleFocus, onBlur: this.handleBlur }), h("jump-icon", { key: '0e577fbdc3cfcc3d1628360487a828437459e01a', name: "magnifying-glass", category: "light" })), h("div", { key: 'da670ec6f527cc0015b42eea74acc355d081e260', class: "Results" }, (this.resType == 'recents') &&
|
|
112
|
+
h("div", { key: 'bb8eed320957070598e1fb57b3db5a7aa0cea4bd', class: "Results__Recents" }, this.recents.length != 0 && h("span", { key: '748a65cfbb955af507acc30a86afa2366b31d99a', class: "title" }, this.recentsTitle), h("div", { key: 'e3fd0b306f42a56a85d1efc4898a4ead272ce15d', class: "ResWrapper" }, this.innerResults.length > 0 && this.innerResults.map((item) => (h("div", { onClick: () => this.handleResClicked(item) }, h("jump-icon", { name: "magnifying-glass", category: "light" }), item['value']))))), this.resType == 'results' &&
|
|
113
|
+
h("div", { key: '29f82834ad14a34547f9f856f045c7cccc9431e0', class: "Results__Results" }, h("div", { key: '1c005fe5f1d9a88c151886eda65f372c52f4710f', class: "ResWrapper" }, this.innerResults === undefined ?
|
|
114
|
+
h("div", { class: "helperText" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 100 100", preserveAspectRatio: "xMidYMid", width: "252", height: "252" }, h("g", null, h("g", { transform: "rotate(0 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.9s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(36 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.8s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(72 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.7s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(108 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.6s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(144 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.5s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(180 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.4s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(216 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.3s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(252 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.2s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(288 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.1s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(324 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "0s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", null))), this.loadingText)
|
|
115
|
+
:
|
|
116
|
+
(this.innerResults.length > 0 ?
|
|
117
|
+
this.innerResults.map((item) => (h("div", { onClick: () => this.handleResClicked(item), key: item['id'] }, item['img'] && h("img", { src: item['img'], alt: "result" }), item['value'])))
|
|
118
|
+
:
|
|
119
|
+
h("div", { class: "helperText" }, this.noResultText)), (this.innerResults && this.innerResults.length > 0) &&
|
|
120
|
+
h("div", { key: '084038e82063eb93fea6ea10d0a405fb7f1e04a8', class: "totalRes" }, h("jump-button", { key: 'f09ae73865768a64e75fcc2b887c4631e3271697', variant: "secondary", size: "small", text: true, onClick: () => this.btnOrShowOtherClicked(), target: "_blank" }, " ", this.showAllResText, " "), this.totalResults && h("div", { key: '66c370a16342ebfe68e3032299bf3da32ed53acd' }, this.totalResults, " ", this.resultsText))))))));
|
|
121
|
+
}
|
|
122
|
+
static get watchers() { return {
|
|
123
|
+
"searchValue": ["searchValueChanged"]
|
|
124
|
+
}; }
|
|
125
|
+
static get style() { return JumpSearchBarMobileStyle0; }
|
|
126
|
+
}, [1, "jump-search-bar-mobile", {
|
|
127
|
+
"identifier": [1],
|
|
128
|
+
"placeholder": [1],
|
|
129
|
+
"recents": [16],
|
|
130
|
+
"recentsTitle": [1, "recents-title"],
|
|
131
|
+
"debounceTime": [2, "debounce-time"],
|
|
132
|
+
"loadingText": [1, "loading-text"],
|
|
133
|
+
"noResultText": [1, "no-result-text"],
|
|
134
|
+
"results": [16],
|
|
135
|
+
"resultsText": [1, "results-text"],
|
|
136
|
+
"showAllResText": [1, "show-all-res-text"],
|
|
137
|
+
"isOpen": [32],
|
|
138
|
+
"innerResults": [32],
|
|
139
|
+
"totalResults": [32],
|
|
140
|
+
"resType": [32],
|
|
141
|
+
"searchValue": [32],
|
|
142
|
+
"setResults": [64]
|
|
143
|
+
}, [[0, "jump-search-bar-dropdown-item-connected", "addOption"]], {
|
|
144
|
+
"searchValue": ["searchValueChanged"]
|
|
145
|
+
}]);
|
|
146
|
+
function defineCustomElement$1() {
|
|
147
|
+
if (typeof customElements === "undefined") {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const components = ["jump-search-bar-mobile", "jump-button", "jump-icon"];
|
|
151
|
+
components.forEach(tagName => { switch (tagName) {
|
|
152
|
+
case "jump-search-bar-mobile":
|
|
153
|
+
if (!customElements.get(tagName)) {
|
|
154
|
+
customElements.define(tagName, JumpSearchBarMobile$1);
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
case "jump-button":
|
|
158
|
+
if (!customElements.get(tagName)) {
|
|
159
|
+
defineCustomElement$3();
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
case "jump-icon":
|
|
163
|
+
if (!customElements.get(tagName)) {
|
|
164
|
+
defineCustomElement$2();
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
} });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const JumpSearchBarMobile = JumpSearchBarMobile$1;
|
|
171
|
+
const defineCustomElement = defineCustomElement$1;
|
|
172
|
+
|
|
173
|
+
export { JumpSearchBarMobile, defineCustomElement };
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=jump-search-bar-mobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"jump-search-bar-mobile.js","mappings":";;;;AAAA,MAAM,sBAAsB,GAAG,q5DAAq5D,CAAC;AACr7D,kCAAe,sBAAsB;;MCMxBA,qBAAmB;;;;;;;;;QAgG9B,gBAAW,GAAG;YACZ,MAAM,kBAAkB,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;YACvE,IAAI,kBAAkB,EAAE;gBACtB,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;aAC7C;SACF,CAAC;;QAGF,eAAU,GAAG;YACX,MAAM,kBAAkB,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;YACvE,IAAI,kBAAkB,EAAE;gBACtB,kBAAkB,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;aAChD;SACF,CAAC;QAOF,aAAQ,GAAG;YACT,IAAI,IAAI,CAAC,aAAa,EAAE;gBACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;;gBAG5C,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC,EAAE;oBAChC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;oBAEzB,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;oBAE9B,IAAI,CAAC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,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,IAC7D,IAAI,CAAC,KAAK,CAAC,IAAI,WAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAC,QAAQ,GAAG,EACrD,IAAI,CAAC,OAAO,CAAC,CACV,CACP,CAAC;;4BAEF,WAAK,KAAK,EAAC,YAAY,IAAE,IAAI,CAAC,YAAY,CAAO,CAClD,EAEF,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;gBACjD,4DAAK,KAAK,EAAC,UAAU,IACnB,oEAAa,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,EAAC,IAAI,QAAC,OAAO,EAAE,MAAM,IAAI,CAAC,qBAAqB,EAAE,EAAE,MAAM,EAAC,QAAQ,SAAG,IAAI,CAAC,cAAc,MAAgB,EACpJ,IAAI,CAAC,YAAY,IAAI,8DAAM,IAAI,CAAC,YAAY,OAAG,IAAI,CAAC,WAAW,CAAO,CACnE,CAEJ,CACF,CAGJ,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["JumpSearchBarMobile"],"sources":["src/components/jump-search-bar-mobile/jump-search-bar-mobile.scss?tag=jump-search-bar-mobile&encapsulation=shadow","src/components/jump-search-bar-mobile/jump-search-bar-mobile.tsx"],"sourcesContent":[":host {\n display: block;\n position: relative;\n\n --jump-search-bar-mobile-focus-color: var(--secondary-standard, #5E79BA);\n --jump-search-bar-mobile-background-color: var(--gray-ultralight, #FFFFFF);\n --jump-search-bar-mobile-border-color: var(--neutral-grey-secondary, #707070);\n\n font-family: var(--ff-primary);\n\n .DropdownWrapper {\n background-color: var(--jump-search-bar-mobile-background-color);\n padding: 16px;\n position: fixed;\n top: 0;\n left: 0;\n //width: 100vw; tengo commentato solo per i test\n height: 100vh;\n z-index: 1000;\n\n .closeButton {\n cursor: pointer;\n }\n\n &.open {\n display: block;\n }\n\n &:not(.open){\n display: none;\n }\n\n\n /* Stile parte interna del dropdown*/\n .InputWrapper {\n background-color: white;\n width: 100%;\n display: flex;\n gap: 12px;\n border-bottom: 1px solid var(--jump-search-bar-mobile-border-color);\n padding-bottom: 4px;\n\n &.focused {\n border-color: var(--jump-search-bar-mobile-focus-color) !important;\n\n jump-icon{\n color: var(--jump-search-bar-mobile-focus-color) !important;\n }\n\n input {\n outline: none !important;\n }\n }\n }\n\n input {\n width: 100%;\n border: none;\n }\n\n .Results {\n margin-top: 12px;\n\n &__Recents {\n .title {\n color: #707070;\n font-size: 14px;\n line-height: 20px;\n padding: 8px 0;\n font-weight: 700;\n display: flex;\n }\n }\n\n &__Results {\n .totalRes {\n display: flex;\n justify-content: space-between;\n }\n }\n\n .ResWrapper {\n display: flex;\n flex-direction: column;\n\n div {\n padding: 8px 0;\n color: #707070;\n font-size: 14px;\n display: flex;\n gap: 12px;\n align-items: center;\n\n img {\n width: 40px;\n height: 48px;\n object-fit: cover;\n border-radius: 3px;\n }\n }\n\n div:hover {\n cursor: pointer;\n }\n\n .helperText {\n color: #CBCBCB;\n\n svg {\n width: 25px;\n height: 25px;\n }\n }\n }\n }\n\n \n }\n}\n","import { Component, Watch, Method, Event, EventEmitter, State, Listen, Host, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'jump-search-bar-mobile',\n styleUrl: 'jump-search-bar-mobile.scss',\n shadow: true,\n})\nexport class JumpSearchBarMobile {\n\n /* ---------------------- @OWN PROPERTIES ------------------------- */\n jumpSearchBar: HTMLInputElement;\n componentRef: HTMLElement;\n\n /* ---------------------- @STATE ------------------------- */\n @State() isOpen: boolean = false;\n @State() innerResults: Array<object> = [];\n @State() totalResults: number = 0;\n @State() resType: string = 'recents';\n \n @State() searchValue: string = undefined;\n\n @Watch('searchValue')\n searchValueChanged(newValue: string) {\n if (newValue === '') {\n // Create a new array reference to trigger re-render\n this.innerResults = [...this.recents];\n this.results = [];\n }\n }\n\n /* ---------------------- @PROPERTIES ------------------------- */\n @Prop() identifier: string = 'search-bar-mobile'; // Identificatore della searchbar\n @Prop() placeholder: string = 'Cerca...'; //Il testo del placeholder dell\\'input della searchbar\n @Prop() recents: Array<object> = []; // Serve per il dropdown quando si vedono le ricerche recenti\n @Prop() recentsTitle: string = 'Recenti'; // Serve per il titolo del dropwdown quando si vedono le ricerche recenti\n @Prop() debounceTime: number = 500; // 'Il tempo di attesa per l\\'invio della ricerca in caso di ricerca automatica. In millisecondi.\n @Prop() loadingText: string = 'Sto caricando...'; // Il testo mostrato durante il caricamento dei risultati.\n @Prop() noResultText: string = 'Nessun risultato corrispondente'; // Il testo da mostrare in caso nessun risultato sia stato recuperato.\n @Prop() results: Array<object> = []; // Serve per il dropdown quando si vedono i risultati della ricerca\n @Prop() resultsText: string = 'risultati'; // Il testo mostrato accanto al numero di risultati totali.\n @Prop() showAllResText: string = 'Mostra tutti i risultati'; // La label da mostrare per il pulsante che mostra tutti i risultati.\n\n /* ---------------------- @EVENTS ------------------------- */\n\n /* ---------------------- @LIFECYCLE ------------------------- */\n\n /* -------------------- @LISTEN ------------------------------- */\n @Listen(\"jump-search-bar-dropdown-item-connected\")\n addOption(e) {\n let props = e.detail; // es {code: 'sku1', imageUrl: 'https://google.com/'}\n\n // Aggiungi l'elemento solo a `recents`\n this.recents = [...this.recents, { ...props }];\n\n // Aggiorna `innerResults` basandoti solo su `recents`\n this.innerResults = [...this.recents];\n }\n\n\n /* \n * Evento da ascoltare per recuperare il dato cliccato\n * Emette un oggetto contenente tutti i dati relativi al risultato cliccato.\n */\n @Event({ eventName: 'jump-search-bar-mobile-res-clicked' }) resultClicked: EventEmitter; \n\n /**\n * Evento emesso quando l'utente effettua una ricerca \n * Emette un oggetto contenenente il valore della ricerca alla chiave 'search'\n * */\n @Event({ eventName: 'jump-search-bar-mobile' }) search: EventEmitter;\n\n /** \n * Evento emesso quando l'utente clicca sul pulsante (se presente) o nel pulsante del dropdown per vedere tutti i risultati \n * Emette un oggetto contenenente il valore della ricerca alla chiave 'search'\n*/\n @Event({ eventName: 'jump-search-bar-mobile-show-all' }) showFullSearch: EventEmitter;\n\n /* -------------------- @METHOD ------------------------------- */\n\n /** Imposta i risultati della ricerca all'interno della dropdown */\n @Method()\n async setResults(results, tot?: number) {\n this.results = results;\n this.innerResults = results;\n this.totalResults = tot;\n }\n\n /* -------------------- LOCAL METHODS ------------------------- */\n openDropdown(){\n console.log('openDropdown');\n this.isOpen = true;\n } \n\n closeDropdown(){\n this.isOpen = false;\n }\n\n /** Emette l'evento quando l'utente clicca sul pulsante (se presente) o nel pulsante del dropdown per vedere tutti i risultati */\n btnOrShowOtherClicked() {\n this.showFullSearch.emit({ search: this.searchValue });\n }\n\n // Gestisce l'evento focus sull'input\n handleFocus = () => {\n const searchBarContainer = this.jumpSearchBar.closest('.InputWrapper');\n if (searchBarContainer) {\n searchBarContainer.classList.add('focused');\n }\n };\n\n // Gestisce l'evento blur sull'input\n handleBlur = () => {\n const searchBarContainer = this.jumpSearchBar.closest('.InputWrapper');\n if (searchBarContainer) {\n searchBarContainer.classList.remove('focused');\n }\n };\n\n /** Emette l'evento di click su un risultato, mandandone tutti i dati */\n handleResClicked(item) {\n this.resultClicked.emit({ clicked: item });\n } \n\n doSearch = () => {\n if (this.jumpSearchBar) {\n this.searchValue = this.jumpSearchBar.value;\n\n // Iniziare la ricerca solamente se ci sono almeno tre caratteri \n if (this.searchValue.length >= 3) {\n this.resType = 'results';\n\n this.innerResults = undefined;\n\n this.search.emit({ search: this.searchValue });\n\n \n }\n }\n };\n\n debounce(fn, delay = this.debounceTime) {\n let timeoutId;\n\n return (...args) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => {\n fn.apply(null, args);\n }, delay);\n };\n };\n\n /* --------------------- RENDER ------------------------------- */\n\n render() {\n return (\n <Host class=\"JumpSearchBarMobile\" ref={(el) => (this.componentRef = el as HTMLElement)}>\n <jump-icon\n name=\"magnifying-glass\"\n category=\"light\"\n onClick={() => this.openDropdown()}\n ></jump-icon>\n <div class={\"DropdownWrapper \" + (this.isOpen ? 'open' : '')}>\n <div class=\"InputWrapper\">\n <jump-icon class=\"closeButton\" category=\"light\" name=\"arrow-left\" onClick={() => this.closeDropdown()}></jump-icon>\n <input\n placeholder={this.placeholder}\n type=\"search\"\n id={this.identifier}\n class=\"search-input\"\n ref={(el) => { this.jumpSearchBar = el as HTMLInputElement }}\n onInput={this.debounce(this.doSearch)}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n <jump-icon name=\"magnifying-glass\" category=\"light\"></jump-icon>\n </div>\n <div class=\"Results\">\n {(this.resType == 'recents') &&\n <div class=\"Results__Recents\">\n {this.recents.length != 0 && <span class=\"title\">{this.recentsTitle}</span>}\n <div class=\"ResWrapper\">\n {this.innerResults.length > 0 && this.innerResults.map((item) => (\n <div onClick={() => this.handleResClicked(item)}>\n <jump-icon name=\"magnifying-glass\" category=\"light\"></jump-icon>\n {item['value']}\n </div>\n ))}\n </div>\n </div>\n }\n {this.resType == 'results' &&\n <div class=\"Results__Results\">\n <div class=\"ResWrapper\">\n {this.innerResults === undefined ?\n <div class=\"helperText\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\" preserveAspectRatio=\"xMidYMid\" width=\"252\" height=\"252\" ><g><g transform=\"rotate(0 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"-0.9s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g transform=\"rotate(36 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"-0.8s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g transform=\"rotate(72 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"-0.7s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g transform=\"rotate(108 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"-0.6s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g transform=\"rotate(144 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"-0.5s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g transform=\"rotate(180 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"-0.4s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g transform=\"rotate(216 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"-0.3s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g transform=\"rotate(252 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"-0.2s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g transform=\"rotate(288 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"-0.1s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g transform=\"rotate(324 50 50)\">\n <rect fill=\"#707070\" height=\"11\" width=\"4\" ry=\"1.87\" rx=\"1.87\" y=\"27.5\" x=\"48\">\n <animate repeatCount=\"indefinite\" begin=\"0s\" dur=\"1s\" keyTimes=\"0;1\" values=\"1;0\" attributeName=\"opacity\"></animate>\n </rect>\n </g><g></g></g></svg>{this.loadingText}</div>\n :\n (this.innerResults.length > 0 ?\n this.innerResults.map((item) => (\n <div onClick={() => this.handleResClicked(item)} key={item['id']}>\n {item['img'] && <img src={item['img']} alt=\"result\" />}\n {item['value']}\n </div>\n ))\n :\n <div class=\"helperText\">{this.noResultText}</div>\n )\n }\n {(this.innerResults && this.innerResults.length > 0) &&\n <div class=\"totalRes\">\n <jump-button variant=\"secondary\" size=\"small\" text onClick={() => this.btnOrShowOtherClicked()} target=\"_blank\"> {this.showAllResText} </jump-button>\n {this.totalResults && <div>{this.totalResults} {this.resultsText}</div>}\n </div>\n }\n </div>\n </div>\n }\n\n </div>\n </div>\n </Host>\n );\n }\n\n}\n"],"version":3}
|
|
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
|
2
2
|
import { d as defineCustomElement$3 } from './jump-button2.js';
|
|
3
3
|
import { d as defineCustomElement$2 } from './jump-icon2.js';
|
|
4
4
|
|
|
5
|
-
const jumpSearchBarCss = ":host{display:
|
|
5
|
+
const jumpSearchBarCss = ":host{display:block;--jump-search-bar-focus-color:var(--secondary-standard, #5E79BA);--jump-search-bar-border-color:var(--neutral-grey-secondary, #707070);--jump-search-bar-bg-color:var(--gray-ultralight, #F8F8F8);--jump-search-bar-dropdown-border-color:var(--neutral-grey-disabled, #CBCBCB);font-family:var(--ff-primary);}:host jump-button{--jump-button-border-radius:0px 3px 3px 0px}:host .SearchBar{position:relative}:host .SearchBar.focused .InputWrapper{border-color:var(--jump-search-bar-focus-color) !important}:host .SearchBar.focused .InputWrapper jump-icon{color:var(--jump-search-bar-focus-color) !important}:host .SearchBar.focused .InputWrapper input{outline:none !important}:host .SearchBar:not(.iconOnly){display:flex;width:100%;}:host .SearchBar:not(.iconOnly) .InputWrapper{width:100%;display:flex}:host .SearchBar:not(.iconOnly) input{width:100%;border:none}:host .SearchBar:not(.iconOnly).outline .InputWrapper{border:1px solid var(--jump-search-bar-border-color);border-radius:3px;padding:12px;gap:8px}:host .SearchBar:not(.iconOnly).outline .InputWrapper jump-icon{color:var(--jump-search-bar-border-color)}:host .SearchBar:not(.iconOnly).outline.withBtn .InputWrapper{border-radius:3px 0px 0px 3px}:host .SearchBar:not(.iconOnly).filled .InputWrapper{border:1px solid var(--jump-search-bar-bg-color);background-color:var(--jump-search-bar-bg-color);border-radius:3px;padding:12px;gap:8px}:host .SearchBar:not(.iconOnly).filled .InputWrapper input{background-color:var(--jump-search-bar-bg-color)}:host .SearchBar:not(.iconOnly).filled .InputWrapper jump-icon{color:var(--jump-search-bar-border-color)}:host .SearchBar:not(.iconOnly).filled.focused.withBtn .InputWrapper{border-radius:3px 0px 0px 3px !important}:host .SearchBar:not(.iconOnly).linear .InputWrapper{border-bottom:1px solid var(--jump-search-bar-border-color);padding-bottom:4px}:host .SearchBar:not(.iconOnly).linear .InputWrapper jump-icon{padding-right:6px}:host .Dropdown{margin-top:10px;border-radius:3px;border:1px solid var(--jump-search-bar-dropdown-border-color);padding:4px 16px;background-color:white}:host .Dropdown.dropAbsolute{position:absolute;box-sizing:border-box;position:absolute;left:0;width:100%}:host .Dropdown.dropRelative{position:relative}:host .Dropdown__Recents .title{color:#707070;font-size:14px;line-height:20px;padding:8px 0;font-weight:700;display:flex}:host .Dropdown__Results .totalRes{display:flex;justify-content:space-between}:host .Dropdown .ResWrapper{display:flex;flex-direction:column}:host .Dropdown .ResWrapper div{padding:8px 0;color:#707070;font-size:14px;display:flex;gap:12px;align-items:center}:host .Dropdown .ResWrapper div img{width:40px;height:48px;object-fit:cover;border-radius:3px}:host .Dropdown .ResWrapper div:hover{cursor:pointer}:host .Dropdown .ResWrapper .helperText{color:#CBCBCB}:host .Dropdown .ResWrapper .helperText svg{width:25px;height:25px}:host .SearchBar.iconOnly.linear{display:flex;width:100%}:host .SearchBar.iconOnly.linear .InputWrapper{width:100%;display:flex;align-items:center;transition:border-bottom 0.3s ease;border-bottom:1px solid transparent;padding-bottom:4px;overflow:hidden;}:host .SearchBar.iconOnly.linear .InputWrapper jump-icon{padding-right:6px;}:host .SearchBar.iconOnly.linear .InputWrapper input{width:0;border:none;transform:translateX(-100%);transition:width 0.3s ease, transform 0.3s ease;animation:none;}:host .SearchBar.iconOnly.linear.expanded .InputWrapper{border-bottom:1px solid var(--jump-search-bar-border-color);transition:border-bottom 0.3s ease;}:host .SearchBar.iconOnly.linear.expanded .InputWrapper input{width:100%;transform:translateX(0);animation:slide-right 0.3s ease forwards;}@keyframes slide-right{from{transform:translateX(-100%);opacity:0}to{transform:translateX(0);opacity:1}}@keyframes border-slide-right{from{border-bottom-width:0}to{border-bottom-width:1px}}";
|
|
6
6
|
const JumpSearchBarStyle0 = jumpSearchBarCss;
|
|
7
7
|
|
|
8
8
|
const JumpSearchBar$1 = /*@__PURE__*/ proxyCustomElement(class JumpSearchBar extends HTMLElement {
|
|
@@ -10,55 +10,192 @@ const JumpSearchBar$1 = /*@__PURE__*/ proxyCustomElement(class JumpSearchBar ext
|
|
|
10
10
|
super();
|
|
11
11
|
this.__registerHost();
|
|
12
12
|
this.__attachShadow();
|
|
13
|
+
this.searchbarExpanded = createEvent(this, "jump-search-bar-expanded", 7);
|
|
13
14
|
this.search = createEvent(this, "jump-search-bar", 7);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
this.showFullSearch = createEvent(this, "jump-search-bar-show-all", 7);
|
|
16
|
+
this.resultClicked = createEvent(this, "jump-search-bar-res-clicked", 7);
|
|
17
|
+
// Gestisce l'evento focus sull'input
|
|
18
|
+
this.handleFocus = () => {
|
|
19
|
+
const searchBarContainer = this.jumpSearchBar.closest('.SearchBar');
|
|
20
|
+
if (searchBarContainer) {
|
|
21
|
+
searchBarContainer.classList.add('focused');
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
// Gestisce l'evento blur sull'input
|
|
25
|
+
this.handleBlur = () => {
|
|
26
|
+
const searchBarContainer = this.jumpSearchBar.closest('.SearchBar');
|
|
27
|
+
if (searchBarContainer) {
|
|
28
|
+
searchBarContainer.classList.remove('focused');
|
|
29
|
+
}
|
|
30
|
+
};
|
|
22
31
|
this.doSearch = () => {
|
|
23
32
|
if (this.jumpSearchBar) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.
|
|
33
|
+
this.searchValue = this.jumpSearchBar.value;
|
|
34
|
+
// Iniziare la ricerca solamente se ci sono almeno tre caratteri
|
|
35
|
+
if (this.searchValue.length >= 3) {
|
|
36
|
+
this.resType = 'results';
|
|
37
|
+
this.innerResults = undefined;
|
|
38
|
+
this.search.emit({ search: this.searchValue });
|
|
39
|
+
// Se il dropdown è chiuso, aprilo. Potrebbe essere chiuso perchè non ci sono recenti
|
|
40
|
+
if (!this.dropdownVisible) {
|
|
41
|
+
this.dropdownVisible = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (this.searchValue.length == 0) {
|
|
45
|
+
this.dropdownVisible = false;
|
|
46
|
+
}
|
|
27
47
|
}
|
|
28
48
|
};
|
|
49
|
+
this.dropdownVisible = false;
|
|
50
|
+
this.searchValue = undefined;
|
|
51
|
+
this.resType = 'recents';
|
|
52
|
+
this.innerResults = [];
|
|
53
|
+
this.totalResults = 0;
|
|
54
|
+
this.isExpanded = false;
|
|
29
55
|
this.placeholder = 'Cerca...';
|
|
56
|
+
this.noResultText = 'Nessun risultato corrispondente';
|
|
57
|
+
this.loadingText = 'Sto caricando...';
|
|
58
|
+
this.resultsText = 'risultati';
|
|
59
|
+
this.showAllResText = 'Mostra tutti i risultati';
|
|
30
60
|
this.identifier = 'search-bar';
|
|
31
61
|
this.debounceTime = 500;
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
62
|
+
this.variant = 'outline';
|
|
63
|
+
this.withBtn = false;
|
|
64
|
+
this.recentsTitle = 'Recenti';
|
|
65
|
+
this.recents = [];
|
|
66
|
+
this.results = [];
|
|
67
|
+
this.dropdown = false;
|
|
68
|
+
this.linearIconOnly = false;
|
|
69
|
+
this.dropdownPosition = 'relative';
|
|
70
|
+
}
|
|
71
|
+
searchValueChanged(newValue) {
|
|
72
|
+
if (newValue === '') {
|
|
73
|
+
// Create a new array reference to trigger re-render
|
|
74
|
+
this.innerResults = [...this.recents];
|
|
75
|
+
this.results = [];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/* ---------------------- @LIFECYCLE ------------------------- */
|
|
79
|
+
componentDidLoad() {
|
|
80
|
+
// Aggiungi l'event listener per il clic al di fuori del componente
|
|
81
|
+
document.addEventListener('click', this.handleOutsideClick.bind(this));
|
|
82
|
+
}
|
|
83
|
+
disconnectedCallback() {
|
|
84
|
+
// Rimuovi l'event listener per evitare perdite di memoria
|
|
85
|
+
document.removeEventListener('click', this.handleOutsideClick.bind(this));
|
|
86
|
+
}
|
|
87
|
+
/* -------------------- @LISTEN ------------------------------- */
|
|
88
|
+
addOption(e) {
|
|
89
|
+
let props = e.detail; // es {code: 'sku1', imageUrl: 'https://google.com/'}
|
|
90
|
+
// Aggiungi l'elemento solo a `recents`
|
|
91
|
+
this.recents = [...this.recents, Object.assign({}, props)];
|
|
92
|
+
// Aggiorna `innerResults` basandoti solo su `recents`
|
|
93
|
+
this.innerResults = [...this.recents];
|
|
94
|
+
}
|
|
95
|
+
/* -------------------- @METHOD ------------------------------- */
|
|
96
|
+
/** Imposta i risultati della ricerca all'interno della dropdown */
|
|
97
|
+
async setResults(results, tot) {
|
|
98
|
+
this.results = results;
|
|
99
|
+
this.innerResults = results;
|
|
100
|
+
this.totalResults = tot;
|
|
101
|
+
}
|
|
102
|
+
/* -------------------- LOCAL METHODS ------------------------- */
|
|
103
|
+
handleOutsideClick(event) {
|
|
104
|
+
// Controlla se il clic è fuori dal componente
|
|
105
|
+
if (this.componentRef && !this.componentRef.contains(event.target)) {
|
|
106
|
+
this.dropdownVisible = false;
|
|
107
|
+
}
|
|
34
108
|
}
|
|
35
|
-
/** Used to filters/searchbar */
|
|
36
109
|
debounce(fn, delay = this.debounceTime) {
|
|
37
110
|
let timeoutId;
|
|
38
111
|
return (...args) => {
|
|
39
|
-
// cancel the previous timer
|
|
40
112
|
if (timeoutId) {
|
|
41
113
|
clearTimeout(timeoutId);
|
|
42
114
|
}
|
|
43
|
-
// setup a new timer
|
|
44
115
|
timeoutId = setTimeout(() => {
|
|
45
116
|
fn.apply(null, args);
|
|
46
117
|
}, delay);
|
|
47
118
|
};
|
|
48
119
|
}
|
|
49
120
|
;
|
|
50
|
-
|
|
121
|
+
openDropdown() {
|
|
122
|
+
this.resType = 'recents';
|
|
123
|
+
this.dropdownVisible = true;
|
|
124
|
+
}
|
|
125
|
+
/** Emette l'evento di click su un risultato, mandandone tutti i dati */
|
|
126
|
+
handleResClicked(item) {
|
|
127
|
+
this.resultClicked.emit({ clicked: item });
|
|
128
|
+
}
|
|
129
|
+
/** Emette l'evento quando l'utente clicca sul pulsante (se presente) o nel pulsante del dropdown per vedere tutti i risultati */
|
|
130
|
+
btnOrShowOtherClicked() {
|
|
131
|
+
this.showFullSearch.emit({ search: this.searchValue });
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Se clicco l'icona espando la searchbar ed emetto un evento dedicato
|
|
135
|
+
*/
|
|
136
|
+
expandSearchBar() {
|
|
137
|
+
this.isExpanded = true;
|
|
138
|
+
this.searchbarExpanded.emit();
|
|
139
|
+
}
|
|
140
|
+
/* --------------------- RENDER ------------------------------- */
|
|
141
|
+
renderLinearIconOnly() {
|
|
142
|
+
return (h(Host, { class: "JumpSearchBar ", ref: (el) => (this.componentRef = el) }, h("div", { class: "SearchBar iconOnly " + this.variant + (this.isExpanded ? " expanded" : "") }, h("div", { class: "InputWrapper", onClick: (this.isExpanded && this.dropdown && this.recents.length > 0) ? () => this.openDropdown() : null }, h("jump-icon", { name: "magnifying-glass", category: "light", onClick: () => this.expandSearchBar() }), this.isExpanded &&
|
|
143
|
+
// Mostra la barra di ricerca con l'animazione di slide
|
|
144
|
+
h("input", { placeholder: this.placeholder, type: "search", id: this.identifier, class: "search-input", ref: (el) => { this.jumpSearchBar = el; }, onInput: this.debounce(this.doSearch), onFocus: this.handleFocus, onBlur: this.handleBlur }))), (this.dropdown && this.dropdownVisible) && this.renderDropdown()));
|
|
145
|
+
}
|
|
146
|
+
renderDefault() {
|
|
147
|
+
return (h(Host, { class: "JumpSearchBar", ref: (el) => (this.componentRef = el) }, h("div", { class: "SearchBar " + this.variant + " " + (this.withBtn ? "withBtn" : "") + (this.isExpanded ? " expanded" : "") }, h("div", { class: "InputWrapper", onClick: (this.dropdown && this.recents.length > 0) ? () => this.openDropdown() : null }, !this.withBtn && h("jump-icon", { name: "magnifying-glass", category: "light" }), h("input", { placeholder: this.placeholder, type: "search", id: this.identifier, class: "search-input", ref: (el) => { this.jumpSearchBar = el; }, onInput: this.debounce(this.doSearch), onFocus: this.handleFocus, onBlur: this.handleBlur })), this.withBtn && !this.linearIconOnly && (h("jump-button", { variant: "secondary", size: "medium", name: "scopri", value: "value", "aria-label": "Scopri di pi\u00F9", id: "button", onlyIcon: true, onClick: () => this.btnOrShowOtherClicked() }, h("jump-icon", { slot: "suffix", name: "magnifying-glass" })))), (this.dropdown && this.dropdownVisible) && this.renderDropdown()));
|
|
148
|
+
}
|
|
149
|
+
renderDropdown() {
|
|
150
|
+
console.log('POSITION', this.dropdownPosition);
|
|
151
|
+
return h("div", { class: "Dropdown " + (this.dropdownPosition == 'absolute' ? 'dropAbsolute' : 'dropRelative') }, (this.resType == 'recents') &&
|
|
152
|
+
h("div", { class: "Dropdown__Recents" }, h("span", { class: "title" }, this.recentsTitle), h("div", { class: "ResWrapper" }, this.innerResults.length > 0 && this.innerResults.map((item) => (h("div", { onClick: () => this.handleResClicked(item) }, h("jump-icon", { name: "magnifying-glass", category: "light" }), item['value']))))), this.resType == 'results' &&
|
|
153
|
+
h("div", { class: "Dropdown__Results" }, h("div", { class: "ResWrapper" }, this.innerResults === undefined ?
|
|
154
|
+
h("div", { class: "helperText" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 100 100", preserveAspectRatio: "xMidYMid", width: "252", height: "252" }, h("g", null, h("g", { transform: "rotate(0 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.9s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(36 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.8s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(72 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.7s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(108 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.6s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(144 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.5s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(180 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.4s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(216 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.3s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(252 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.2s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(288 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "-0.1s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", { transform: "rotate(324 50 50)" }, h("rect", { fill: "#707070", height: "11", width: "4", ry: "1.87", rx: "1.87", y: "27.5", x: "48" }, h("animate", { repeatCount: "indefinite", begin: "0s", dur: "1s", keyTimes: "0;1", values: "1;0", attributeName: "opacity" }))), h("g", null))), this.loadingText)
|
|
155
|
+
:
|
|
156
|
+
(this.innerResults.length > 0 ?
|
|
157
|
+
this.innerResults.map((item) => (h("div", { onClick: () => this.handleResClicked(item), key: item['id'] }, item['img'] && h("img", { src: item['img'], alt: "result" }), item['value'])))
|
|
158
|
+
:
|
|
159
|
+
h("div", { class: "helperText" }, this.noResultText)), (this.innerResults && this.innerResults.length > 0) &&
|
|
160
|
+
h("div", { class: "totalRes" }, h("jump-button", { variant: "secondary", size: "small", text: true, onClick: () => this.btnOrShowOtherClicked(), target: "_blank" }, " ", this.showAllResText, " "), this.totalResults && h("div", null, this.totalResults, " ", this.resultsText)))));
|
|
161
|
+
}
|
|
51
162
|
render() {
|
|
52
|
-
|
|
53
|
-
|
|
163
|
+
if (this.variant === 'linear' && this.linearIconOnly) {
|
|
164
|
+
return this.renderLinearIconOnly();
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return this.renderDefault();
|
|
168
|
+
}
|
|
54
169
|
}
|
|
170
|
+
static get watchers() { return {
|
|
171
|
+
"searchValue": ["searchValueChanged"]
|
|
172
|
+
}; }
|
|
55
173
|
static get style() { return JumpSearchBarStyle0; }
|
|
56
174
|
}, [1, "jump-search-bar", {
|
|
57
175
|
"placeholder": [1],
|
|
176
|
+
"noResultText": [1, "no-result-text"],
|
|
177
|
+
"loadingText": [1, "loading-text"],
|
|
178
|
+
"resultsText": [1, "results-text"],
|
|
179
|
+
"showAllResText": [1, "show-all-res-text"],
|
|
58
180
|
"identifier": [1],
|
|
59
181
|
"debounceTime": [2, "debounce-time"],
|
|
60
|
-
"
|
|
61
|
-
"
|
|
182
|
+
"variant": [1],
|
|
183
|
+
"withBtn": [4, "with-btn"],
|
|
184
|
+
"recentsTitle": [1, "recents-title"],
|
|
185
|
+
"recents": [16],
|
|
186
|
+
"results": [16],
|
|
187
|
+
"dropdown": [4],
|
|
188
|
+
"linearIconOnly": [4, "linear-icon-only"],
|
|
189
|
+
"dropdownPosition": [1, "dropdown-position"],
|
|
190
|
+
"dropdownVisible": [32],
|
|
191
|
+
"searchValue": [32],
|
|
192
|
+
"resType": [32],
|
|
193
|
+
"innerResults": [32],
|
|
194
|
+
"totalResults": [32],
|
|
195
|
+
"isExpanded": [32],
|
|
196
|
+
"setResults": [64]
|
|
197
|
+
}, [[0, "jump-search-bar-dropdown-item-connected", "addOption"]], {
|
|
198
|
+
"searchValue": ["searchValueChanged"]
|
|
62
199
|
}]);
|
|
63
200
|
function defineCustomElement$1() {
|
|
64
201
|
if (typeof customElements === "undefined") {
|