@jumpgroup/jump-design-system 0.3.52 → 0.3.54
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 +2 -2
- package/dist/cjs/jump-card-ecommerce.cjs.entry.js.map +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-card-ecommerce/jump-card-ecommerce.css +4 -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-card-ecommerce.js +1 -1
- package/dist/components/jump-card-ecommerce.js.map +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 +2 -2
- package/dist/esm/jump-card-ecommerce.entry.js.map +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-00b5b7b1.entry.js +2 -0
- package/dist/jump-design-system/p-00b5b7b1.entry.js.map +1 -0
- 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-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/readme.md +5 -4
- 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-6e26f3ef.entry.js +0 -2
- package/dist/jump-design-system/p-6e26f3ef.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-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
|
@@ -1,46 +1,158 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
export class JumpSearchBar {
|
|
3
3
|
constructor() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
// Gestisce l'evento focus sull'input
|
|
5
|
+
this.handleFocus = () => {
|
|
6
|
+
const searchBarContainer = this.jumpSearchBar.closest('.SearchBar');
|
|
7
|
+
if (searchBarContainer) {
|
|
8
|
+
searchBarContainer.classList.add('focused');
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
// Gestisce l'evento blur sull'input
|
|
12
|
+
this.handleBlur = () => {
|
|
13
|
+
const searchBarContainer = this.jumpSearchBar.closest('.SearchBar');
|
|
14
|
+
if (searchBarContainer) {
|
|
15
|
+
searchBarContainer.classList.remove('focused');
|
|
16
|
+
}
|
|
17
|
+
};
|
|
12
18
|
this.doSearch = () => {
|
|
13
19
|
if (this.jumpSearchBar) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.
|
|
20
|
+
this.searchValue = this.jumpSearchBar.value;
|
|
21
|
+
// Iniziare la ricerca solamente se ci sono almeno tre caratteri
|
|
22
|
+
if (this.searchValue.length >= 3) {
|
|
23
|
+
this.resType = 'results';
|
|
24
|
+
this.innerResults = undefined;
|
|
25
|
+
this.search.emit({ search: this.searchValue });
|
|
26
|
+
// Se il dropdown è chiuso, aprilo. Potrebbe essere chiuso perchè non ci sono recenti
|
|
27
|
+
if (!this.dropdownVisible) {
|
|
28
|
+
this.dropdownVisible = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else if (this.searchValue.length == 0) {
|
|
32
|
+
this.dropdownVisible = false;
|
|
33
|
+
}
|
|
17
34
|
}
|
|
18
35
|
};
|
|
36
|
+
this.dropdownVisible = false;
|
|
37
|
+
this.searchValue = undefined;
|
|
38
|
+
this.resType = 'recents';
|
|
39
|
+
this.innerResults = [];
|
|
40
|
+
this.totalResults = 0;
|
|
41
|
+
this.isExpanded = false;
|
|
19
42
|
this.placeholder = 'Cerca...';
|
|
43
|
+
this.noResultText = 'Nessun risultato corrispondente';
|
|
44
|
+
this.loadingText = 'Sto caricando...';
|
|
45
|
+
this.resultsText = 'risultati';
|
|
46
|
+
this.showAllResText = 'Mostra tutti i risultati';
|
|
20
47
|
this.identifier = 'search-bar';
|
|
21
48
|
this.debounceTime = 500;
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
49
|
+
this.variant = 'outline';
|
|
50
|
+
this.withBtn = false;
|
|
51
|
+
this.recentsTitle = 'Recenti';
|
|
52
|
+
this.recents = [];
|
|
53
|
+
this.results = [];
|
|
54
|
+
this.dropdown = false;
|
|
55
|
+
this.linearIconOnly = false;
|
|
56
|
+
this.dropdownPosition = 'relative';
|
|
57
|
+
}
|
|
58
|
+
searchValueChanged(newValue) {
|
|
59
|
+
if (newValue === '') {
|
|
60
|
+
// Create a new array reference to trigger re-render
|
|
61
|
+
this.innerResults = [...this.recents];
|
|
62
|
+
this.results = [];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/* ---------------------- @LIFECYCLE ------------------------- */
|
|
66
|
+
componentDidLoad() {
|
|
67
|
+
// Aggiungi l'event listener per il clic al di fuori del componente
|
|
68
|
+
document.addEventListener('click', this.handleOutsideClick.bind(this));
|
|
69
|
+
}
|
|
70
|
+
disconnectedCallback() {
|
|
71
|
+
// Rimuovi l'event listener per evitare perdite di memoria
|
|
72
|
+
document.removeEventListener('click', this.handleOutsideClick.bind(this));
|
|
73
|
+
}
|
|
74
|
+
/* -------------------- @LISTEN ------------------------------- */
|
|
75
|
+
addOption(e) {
|
|
76
|
+
let props = e.detail; // es {code: 'sku1', imageUrl: 'https://google.com/'}
|
|
77
|
+
// Aggiungi l'elemento solo a `recents`
|
|
78
|
+
this.recents = [...this.recents, Object.assign({}, props)];
|
|
79
|
+
// Aggiorna `innerResults` basandoti solo su `recents`
|
|
80
|
+
this.innerResults = [...this.recents];
|
|
81
|
+
}
|
|
82
|
+
/* -------------------- @METHOD ------------------------------- */
|
|
83
|
+
/** Imposta i risultati della ricerca all'interno della dropdown */
|
|
84
|
+
async setResults(results, tot) {
|
|
85
|
+
this.results = results;
|
|
86
|
+
this.innerResults = results;
|
|
87
|
+
this.totalResults = tot;
|
|
88
|
+
}
|
|
89
|
+
/* -------------------- LOCAL METHODS ------------------------- */
|
|
90
|
+
handleOutsideClick(event) {
|
|
91
|
+
// Controlla se il clic è fuori dal componente
|
|
92
|
+
if (this.componentRef && !this.componentRef.contains(event.target)) {
|
|
93
|
+
this.dropdownVisible = false;
|
|
94
|
+
}
|
|
24
95
|
}
|
|
25
|
-
/** Used to filters/searchbar */
|
|
26
96
|
debounce(fn, delay = this.debounceTime) {
|
|
27
97
|
let timeoutId;
|
|
28
98
|
return (...args) => {
|
|
29
|
-
// cancel the previous timer
|
|
30
99
|
if (timeoutId) {
|
|
31
100
|
clearTimeout(timeoutId);
|
|
32
101
|
}
|
|
33
|
-
// setup a new timer
|
|
34
102
|
timeoutId = setTimeout(() => {
|
|
35
103
|
fn.apply(null, args);
|
|
36
104
|
}, delay);
|
|
37
105
|
};
|
|
38
106
|
}
|
|
39
107
|
;
|
|
40
|
-
|
|
108
|
+
openDropdown() {
|
|
109
|
+
this.resType = 'recents';
|
|
110
|
+
this.dropdownVisible = true;
|
|
111
|
+
}
|
|
112
|
+
/** Emette l'evento di click su un risultato, mandandone tutti i dati */
|
|
113
|
+
handleResClicked(item) {
|
|
114
|
+
this.resultClicked.emit({ clicked: item });
|
|
115
|
+
}
|
|
116
|
+
/** Emette l'evento quando l'utente clicca sul pulsante (se presente) o nel pulsante del dropdown per vedere tutti i risultati */
|
|
117
|
+
btnOrShowOtherClicked() {
|
|
118
|
+
this.showFullSearch.emit({ search: this.searchValue });
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Se clicco l'icona espando la searchbar ed emetto un evento dedicato
|
|
122
|
+
*/
|
|
123
|
+
expandSearchBar() {
|
|
124
|
+
this.isExpanded = true;
|
|
125
|
+
this.searchbarExpanded.emit();
|
|
126
|
+
}
|
|
127
|
+
/* --------------------- RENDER ------------------------------- */
|
|
128
|
+
renderLinearIconOnly() {
|
|
129
|
+
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 &&
|
|
130
|
+
// Mostra la barra di ricerca con l'animazione di slide
|
|
131
|
+
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()));
|
|
132
|
+
}
|
|
133
|
+
renderDefault() {
|
|
134
|
+
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()));
|
|
135
|
+
}
|
|
136
|
+
renderDropdown() {
|
|
137
|
+
console.log('POSITION', this.dropdownPosition);
|
|
138
|
+
return h("div", { class: "Dropdown " + (this.dropdownPosition == 'absolute' ? 'dropAbsolute' : 'dropRelative') }, (this.resType == 'recents') &&
|
|
139
|
+
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' &&
|
|
140
|
+
h("div", { class: "Dropdown__Results" }, h("div", { class: "ResWrapper" }, this.innerResults === undefined ?
|
|
141
|
+
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)
|
|
142
|
+
:
|
|
143
|
+
(this.innerResults.length > 0 ?
|
|
144
|
+
this.innerResults.map((item) => (h("div", { onClick: () => this.handleResClicked(item), key: item['id'] }, item['img'] && h("img", { src: item['img'], alt: "result" }), item['value'])))
|
|
145
|
+
:
|
|
146
|
+
h("div", { class: "helperText" }, this.noResultText)), (this.innerResults && this.innerResults.length > 0) &&
|
|
147
|
+
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)))));
|
|
148
|
+
}
|
|
41
149
|
render() {
|
|
42
|
-
|
|
43
|
-
|
|
150
|
+
if (this.variant === 'linear' && this.linearIconOnly) {
|
|
151
|
+
return this.renderLinearIconOnly();
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
return this.renderDefault();
|
|
155
|
+
}
|
|
44
156
|
}
|
|
45
157
|
static get is() { return "jump-search-bar"; }
|
|
46
158
|
static get encapsulation() { return "shadow"; }
|
|
@@ -74,6 +186,78 @@ export class JumpSearchBar {
|
|
|
74
186
|
"reflect": false,
|
|
75
187
|
"defaultValue": "'Cerca...'"
|
|
76
188
|
},
|
|
189
|
+
"noResultText": {
|
|
190
|
+
"type": "string",
|
|
191
|
+
"mutable": false,
|
|
192
|
+
"complexType": {
|
|
193
|
+
"original": "string",
|
|
194
|
+
"resolved": "string",
|
|
195
|
+
"references": {}
|
|
196
|
+
},
|
|
197
|
+
"required": false,
|
|
198
|
+
"optional": false,
|
|
199
|
+
"docs": {
|
|
200
|
+
"tags": [],
|
|
201
|
+
"text": ""
|
|
202
|
+
},
|
|
203
|
+
"attribute": "no-result-text",
|
|
204
|
+
"reflect": false,
|
|
205
|
+
"defaultValue": "'Nessun risultato corrispondente'"
|
|
206
|
+
},
|
|
207
|
+
"loadingText": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"mutable": false,
|
|
210
|
+
"complexType": {
|
|
211
|
+
"original": "string",
|
|
212
|
+
"resolved": "string",
|
|
213
|
+
"references": {}
|
|
214
|
+
},
|
|
215
|
+
"required": false,
|
|
216
|
+
"optional": false,
|
|
217
|
+
"docs": {
|
|
218
|
+
"tags": [],
|
|
219
|
+
"text": ""
|
|
220
|
+
},
|
|
221
|
+
"attribute": "loading-text",
|
|
222
|
+
"reflect": false,
|
|
223
|
+
"defaultValue": "'Sto caricando...'"
|
|
224
|
+
},
|
|
225
|
+
"resultsText": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"mutable": false,
|
|
228
|
+
"complexType": {
|
|
229
|
+
"original": "string",
|
|
230
|
+
"resolved": "string",
|
|
231
|
+
"references": {}
|
|
232
|
+
},
|
|
233
|
+
"required": false,
|
|
234
|
+
"optional": false,
|
|
235
|
+
"docs": {
|
|
236
|
+
"tags": [],
|
|
237
|
+
"text": ""
|
|
238
|
+
},
|
|
239
|
+
"attribute": "results-text",
|
|
240
|
+
"reflect": false,
|
|
241
|
+
"defaultValue": "'risultati'"
|
|
242
|
+
},
|
|
243
|
+
"showAllResText": {
|
|
244
|
+
"type": "string",
|
|
245
|
+
"mutable": false,
|
|
246
|
+
"complexType": {
|
|
247
|
+
"original": "string",
|
|
248
|
+
"resolved": "string",
|
|
249
|
+
"references": {}
|
|
250
|
+
},
|
|
251
|
+
"required": false,
|
|
252
|
+
"optional": false,
|
|
253
|
+
"docs": {
|
|
254
|
+
"tags": [],
|
|
255
|
+
"text": ""
|
|
256
|
+
},
|
|
257
|
+
"attribute": "show-all-res-text",
|
|
258
|
+
"reflect": false,
|
|
259
|
+
"defaultValue": "'Mostra tutti i risultati'"
|
|
260
|
+
},
|
|
77
261
|
"identifier": {
|
|
78
262
|
"type": "string",
|
|
79
263
|
"mutable": false,
|
|
@@ -104,13 +288,13 @@ export class JumpSearchBar {
|
|
|
104
288
|
"optional": false,
|
|
105
289
|
"docs": {
|
|
106
290
|
"tags": [],
|
|
107
|
-
"text": "
|
|
291
|
+
"text": ""
|
|
108
292
|
},
|
|
109
293
|
"attribute": "debounce-time",
|
|
110
294
|
"reflect": false,
|
|
111
295
|
"defaultValue": "500"
|
|
112
296
|
},
|
|
113
|
-
"
|
|
297
|
+
"variant": {
|
|
114
298
|
"type": "string",
|
|
115
299
|
"mutable": false,
|
|
116
300
|
"complexType": {
|
|
@@ -122,13 +306,31 @@ export class JumpSearchBar {
|
|
|
122
306
|
"optional": false,
|
|
123
307
|
"docs": {
|
|
124
308
|
"tags": [],
|
|
125
|
-
"text": "
|
|
309
|
+
"text": ""
|
|
126
310
|
},
|
|
127
|
-
"attribute": "
|
|
311
|
+
"attribute": "variant",
|
|
128
312
|
"reflect": false,
|
|
129
|
-
"defaultValue": "'
|
|
313
|
+
"defaultValue": "'outline'"
|
|
130
314
|
},
|
|
131
|
-
"
|
|
315
|
+
"withBtn": {
|
|
316
|
+
"type": "boolean",
|
|
317
|
+
"mutable": false,
|
|
318
|
+
"complexType": {
|
|
319
|
+
"original": "boolean",
|
|
320
|
+
"resolved": "boolean",
|
|
321
|
+
"references": {}
|
|
322
|
+
},
|
|
323
|
+
"required": false,
|
|
324
|
+
"optional": false,
|
|
325
|
+
"docs": {
|
|
326
|
+
"tags": [],
|
|
327
|
+
"text": ""
|
|
328
|
+
},
|
|
329
|
+
"attribute": "with-btn",
|
|
330
|
+
"reflect": false,
|
|
331
|
+
"defaultValue": "false"
|
|
332
|
+
},
|
|
333
|
+
"recentsTitle": {
|
|
132
334
|
"type": "string",
|
|
133
335
|
"mutable": false,
|
|
134
336
|
"complexType": {
|
|
@@ -142,19 +344,170 @@ export class JumpSearchBar {
|
|
|
142
344
|
"tags": [],
|
|
143
345
|
"text": ""
|
|
144
346
|
},
|
|
145
|
-
"attribute": "
|
|
347
|
+
"attribute": "recents-title",
|
|
348
|
+
"reflect": false,
|
|
349
|
+
"defaultValue": "'Recenti'"
|
|
350
|
+
},
|
|
351
|
+
"recents": {
|
|
352
|
+
"type": "unknown",
|
|
353
|
+
"mutable": false,
|
|
354
|
+
"complexType": {
|
|
355
|
+
"original": "Array<object>",
|
|
356
|
+
"resolved": "object[]",
|
|
357
|
+
"references": {
|
|
358
|
+
"Array": {
|
|
359
|
+
"location": "global",
|
|
360
|
+
"id": "global::Array"
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
"required": false,
|
|
365
|
+
"optional": false,
|
|
366
|
+
"docs": {
|
|
367
|
+
"tags": [],
|
|
368
|
+
"text": ""
|
|
369
|
+
},
|
|
370
|
+
"defaultValue": "[]"
|
|
371
|
+
},
|
|
372
|
+
"results": {
|
|
373
|
+
"type": "unknown",
|
|
374
|
+
"mutable": false,
|
|
375
|
+
"complexType": {
|
|
376
|
+
"original": "Array<object>",
|
|
377
|
+
"resolved": "object[]",
|
|
378
|
+
"references": {
|
|
379
|
+
"Array": {
|
|
380
|
+
"location": "global",
|
|
381
|
+
"id": "global::Array"
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"required": false,
|
|
386
|
+
"optional": false,
|
|
387
|
+
"docs": {
|
|
388
|
+
"tags": [],
|
|
389
|
+
"text": ""
|
|
390
|
+
},
|
|
391
|
+
"defaultValue": "[]"
|
|
392
|
+
},
|
|
393
|
+
"dropdown": {
|
|
394
|
+
"type": "boolean",
|
|
395
|
+
"mutable": false,
|
|
396
|
+
"complexType": {
|
|
397
|
+
"original": "boolean",
|
|
398
|
+
"resolved": "boolean",
|
|
399
|
+
"references": {}
|
|
400
|
+
},
|
|
401
|
+
"required": false,
|
|
402
|
+
"optional": false,
|
|
403
|
+
"docs": {
|
|
404
|
+
"tags": [],
|
|
405
|
+
"text": ""
|
|
406
|
+
},
|
|
407
|
+
"attribute": "dropdown",
|
|
146
408
|
"reflect": false,
|
|
147
|
-
"defaultValue": "
|
|
409
|
+
"defaultValue": "false"
|
|
410
|
+
},
|
|
411
|
+
"linearIconOnly": {
|
|
412
|
+
"type": "boolean",
|
|
413
|
+
"mutable": false,
|
|
414
|
+
"complexType": {
|
|
415
|
+
"original": "boolean",
|
|
416
|
+
"resolved": "boolean",
|
|
417
|
+
"references": {}
|
|
418
|
+
},
|
|
419
|
+
"required": false,
|
|
420
|
+
"optional": false,
|
|
421
|
+
"docs": {
|
|
422
|
+
"tags": [],
|
|
423
|
+
"text": ""
|
|
424
|
+
},
|
|
425
|
+
"attribute": "linear-icon-only",
|
|
426
|
+
"reflect": false,
|
|
427
|
+
"defaultValue": "false"
|
|
428
|
+
},
|
|
429
|
+
"dropdownPosition": {
|
|
430
|
+
"type": "string",
|
|
431
|
+
"mutable": false,
|
|
432
|
+
"complexType": {
|
|
433
|
+
"original": "string",
|
|
434
|
+
"resolved": "string",
|
|
435
|
+
"references": {}
|
|
436
|
+
},
|
|
437
|
+
"required": false,
|
|
438
|
+
"optional": false,
|
|
439
|
+
"docs": {
|
|
440
|
+
"tags": [],
|
|
441
|
+
"text": ""
|
|
442
|
+
},
|
|
443
|
+
"attribute": "dropdown-position",
|
|
444
|
+
"reflect": false,
|
|
445
|
+
"defaultValue": "'relative'"
|
|
148
446
|
}
|
|
149
447
|
};
|
|
150
448
|
}
|
|
449
|
+
static get states() {
|
|
450
|
+
return {
|
|
451
|
+
"dropdownVisible": {},
|
|
452
|
+
"searchValue": {},
|
|
453
|
+
"resType": {},
|
|
454
|
+
"innerResults": {},
|
|
455
|
+
"totalResults": {},
|
|
456
|
+
"isExpanded": {}
|
|
457
|
+
};
|
|
458
|
+
}
|
|
151
459
|
static get events() {
|
|
152
460
|
return [{
|
|
461
|
+
"method": "searchbarExpanded",
|
|
462
|
+
"name": "jump-search-bar-expanded",
|
|
463
|
+
"bubbles": true,
|
|
464
|
+
"cancelable": true,
|
|
465
|
+
"composed": true,
|
|
466
|
+
"docs": {
|
|
467
|
+
"tags": [],
|
|
468
|
+
"text": "Evento emesso quando l'utente clicca sull'icona in variant linear e linearIconOnly"
|
|
469
|
+
},
|
|
470
|
+
"complexType": {
|
|
471
|
+
"original": "any",
|
|
472
|
+
"resolved": "any",
|
|
473
|
+
"references": {}
|
|
474
|
+
}
|
|
475
|
+
}, {
|
|
153
476
|
"method": "search",
|
|
154
477
|
"name": "jump-search-bar",
|
|
155
478
|
"bubbles": true,
|
|
156
479
|
"cancelable": true,
|
|
157
480
|
"composed": true,
|
|
481
|
+
"docs": {
|
|
482
|
+
"tags": [],
|
|
483
|
+
"text": "Evento emesso quando l'utente effettua una ricerca \nEmette un oggetto contenenente il valore della ricerca alla chiave 'search'"
|
|
484
|
+
},
|
|
485
|
+
"complexType": {
|
|
486
|
+
"original": "any",
|
|
487
|
+
"resolved": "any",
|
|
488
|
+
"references": {}
|
|
489
|
+
}
|
|
490
|
+
}, {
|
|
491
|
+
"method": "showFullSearch",
|
|
492
|
+
"name": "jump-search-bar-show-all",
|
|
493
|
+
"bubbles": true,
|
|
494
|
+
"cancelable": true,
|
|
495
|
+
"composed": true,
|
|
496
|
+
"docs": {
|
|
497
|
+
"tags": [],
|
|
498
|
+
"text": "Evento emesso quando l'utente clicca sul pulsante (se presente) o nel pulsante del dropdown per vedere tutti i risultati \nEmette un oggetto contenenente il valore della ricerca alla chiave 'search'"
|
|
499
|
+
},
|
|
500
|
+
"complexType": {
|
|
501
|
+
"original": "any",
|
|
502
|
+
"resolved": "any",
|
|
503
|
+
"references": {}
|
|
504
|
+
}
|
|
505
|
+
}, {
|
|
506
|
+
"method": "resultClicked",
|
|
507
|
+
"name": "jump-search-bar-res-clicked",
|
|
508
|
+
"bubbles": true,
|
|
509
|
+
"cancelable": true,
|
|
510
|
+
"composed": true,
|
|
158
511
|
"docs": {
|
|
159
512
|
"tags": [],
|
|
160
513
|
"text": ""
|
|
@@ -166,5 +519,49 @@ export class JumpSearchBar {
|
|
|
166
519
|
}
|
|
167
520
|
}];
|
|
168
521
|
}
|
|
522
|
+
static get methods() {
|
|
523
|
+
return {
|
|
524
|
+
"setResults": {
|
|
525
|
+
"complexType": {
|
|
526
|
+
"signature": "(results: any, tot?: number) => Promise<void>",
|
|
527
|
+
"parameters": [{
|
|
528
|
+
"name": "results",
|
|
529
|
+
"type": "any",
|
|
530
|
+
"docs": ""
|
|
531
|
+
}, {
|
|
532
|
+
"name": "tot",
|
|
533
|
+
"type": "number",
|
|
534
|
+
"docs": ""
|
|
535
|
+
}],
|
|
536
|
+
"references": {
|
|
537
|
+
"Promise": {
|
|
538
|
+
"location": "global",
|
|
539
|
+
"id": "global::Promise"
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
"return": "Promise<void>"
|
|
543
|
+
},
|
|
544
|
+
"docs": {
|
|
545
|
+
"text": "Imposta i risultati della ricerca all'interno della dropdown",
|
|
546
|
+
"tags": []
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
static get watchers() {
|
|
552
|
+
return [{
|
|
553
|
+
"propName": "searchValue",
|
|
554
|
+
"methodName": "searchValueChanged"
|
|
555
|
+
}];
|
|
556
|
+
}
|
|
557
|
+
static get listeners() {
|
|
558
|
+
return [{
|
|
559
|
+
"name": "jump-search-bar-dropdown-item-connected",
|
|
560
|
+
"method": "addOption",
|
|
561
|
+
"target": undefined,
|
|
562
|
+
"capture": false,
|
|
563
|
+
"passive": false
|
|
564
|
+
}];
|
|
565
|
+
}
|
|
169
566
|
}
|
|
170
567
|
//# sourceMappingURL=jump-search-bar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jump-search-bar.js","sourceRoot":"","sources":["../../../src/components/jump-search-bar/jump-search-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAiB,MAAM,eAAe,CAAC;AAO/E,MAAM,OAAO,aAAa;;QA6BxB,iEAAiE;QAEjE,kEAAkE;QAElE,kEAAkE;QAElE,kEAAkE;QAElE;;;WAGG;QACH,aAAQ,GAAG,GAAG,EAAE;YACd,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvB,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;gBAE7C,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;gBACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CA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AQ;gBAC3B,oEAAa,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,OAAO,gBAAY,oBAAe,EAAC,EAAE,EAAC,QAAQ,EAAC,QAAQ,QAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE;oBACvJ,kEAAW,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,kBAAkB,GAAa,CACjD,CAEX,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, Event, EventEmitter } from '@stencil/core';\n\n@Component({\n tag: 'jump-search-bar',\n styleUrl: 'jump-search-bar.scss',\n shadow: true,\n})\nexport class JumpSearchBar {\n /* ---------------------- OWN PROPERTIES ---------------------- */\n\n /* ---------------------- @ELEMENT ---------------------------- */\n jumpSearchBar: HTMLInputElement;\n\n /* ---------------------- @STATE ------------------------- */\n\n /* ---------------------- @PROPERTIES ------------------------- */\n @Prop() placeholder: string = 'Cerca...';\n @Prop() identifier: string = 'search-bar';\n\n /**\n * Variabile per personalizzare il tempo di attesa prima di eseguire la ricerca\n */\n @Prop() debounceTime: number = 500;\n\n /**\n * Se \"Auto\" la ricerca parte automaticamente al termine della digitazione\n * Se \"Manual\" la ricerca parte solo dopo aver premuto invio -> può avere solo stile outline\n */\n @Prop() searchType: string = 'auto' || 'manual';\n\n @Prop() variant: string = 'outline' || 'filled' || 'linear';\n\n /* ---------------------- @EVENTS ------------------------- */\n @Event({ eventName: 'jump-search-bar' }) search: EventEmitter;\n\n\n /* ---------------------- @LIFECYCLE ------------------------- */\n\n /* -------------------- @LISTEN ------------------------------- */\n\n /* -------------------- @METHOD ------------------------------- */\n\n /* -------------------- LOCAL METHODS ------------------------- */\n\n /**\n * se searchType == 'manual' l'utente deve cliccare sul pulsante per eseguire la funzione\n * se searchType == 'auto' la funzione viene eseguita automaticamente al termine della digitazione\n */\n doSearch = () => {\n if (this.jumpSearchBar) {\n const searchValue = this.jumpSearchBar.value;\n\n console.log('doSearch', searchValue);\n this.search.emit({ search: searchValue });\n }\n }\n\n\n /** Used to filters/searchbar */\ndebounce(fn, delay = this.debounceTime) {\n let timeoutId;\n\n return (...args) => {\n // cancel the previous timer\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n // setup a new timer\n timeoutId = setTimeout(() => {\n fn.apply(null, args);\n }, delay);\n };\n};\n\n /* -------------------- RENDER ------------------------- */\n\n render() {\n return (\n <Host \n class={\"JumpSearchBar \" + (this.searchType == 'manual' ? 'manual outline' : (this.searchType + \" \" + this.variant))} \n >\n <input \n placeholder={this.placeholder} \n type=\"search\" id={this.identifier} class=\"search-input\" ref={(el) => { this.jumpSearchBar = el as HTMLInputElement }} \n onInput={this.searchType === 'auto' ? this.debounce(this.doSearch) : undefined}\n />\n {this.searchType === 'manual' &&\n <jump-button variant=\"secondary\" size=\"medium\" name=\"scopri\" value=\"value\" aria-label=\"Scopri di più\" id=\"button\" onlyIcon onClick={() => this.doSearch()}>\n <jump-icon slot=\"suffix\" name=\"magnifying-glass\"></jump-icon>\n </jump-button>\n }\n </Host>\n );\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"jump-search-bar.js","sourceRoot":"","sources":["../../../src/components/jump-search-bar/jump-search-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAO5G,MAAM,OAAO,aAAa;;QA6GxB,qCAAqC;QACrC,gBAAW,GAAG,GAAG,EAAE;YACjB,MAAM,kBAAkB,GAAG,IAAI,CAAC,aAAa,CAAC,O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AO,IAAI,CAAC,oBAAoB,EAAE,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Method, Watch, Listen, State, Host, h, Prop, Event, EventEmitter } from '@stencil/core';\n\n@Component({\n tag: 'jump-search-bar',\n styleUrl: 'jump-search-bar.scss',\n shadow: true,\n})\nexport class JumpSearchBar {\n\n /* ---------------------- @OWN PROPERTIES ------------------------- */\n jumpSearchBar: HTMLInputElement;\n private componentRef: HTMLElement;\n\n /* ---------------------- @STATE ------------------------- */\n @State() dropdownVisible: boolean = false;\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 @State() resType: string = 'recents';\n @State() innerResults: Array<object> = [];\n @State() totalResults: number = 0;\n @State() isExpanded: boolean = false; \n\n /* ---------------------- @PROPERTIES ------------------------- */\n @Prop() placeholder: string = 'Cerca...'; //Il testo del placeholder dell\\'input della searchbar\n @Prop() noResultText: string = 'Nessun risultato corrispondente'; // Il testo da mostrare in caso nessun risultato sia stato recuperato.\n @Prop() loadingText: string = 'Sto caricando...'; // Il testo mostrato durante il caricamento dei risultati.\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 @Prop() identifier: string = 'search-bar'; // Identificatore della searchbar\n @Prop() debounceTime: number = 500; // 'Il tempo di attesa per l\\'invio della ricerca in caso di ricerca automatica. In millisecondi.\n @Prop() variant: string = 'outline'; // Scelta dello stile della barra di ricerca tra filled, linear e outline.\n @Prop() withBtn: boolean = false; // Se true, aggiunge un pulsante alla barra di ricerca\n @Prop() recentsTitle: string = 'Recenti'; // Serve per il titolo del dropwdown quando si vedono le ricerche recenti\n @Prop() recents: Array<object> = []; // Serve per il dropdown quando si vedono le ricerche recenti\n @Prop() results: Array<object> = []; // Serve per il dropdown quando si vedono i risultati della ricerca\n @Prop() dropdown: boolean = false; // Se true, mostra il dropdown con i risultati della ricerca.\n @Prop() linearIconOnly: boolean = false; // Se true, mostra solo l'icona nella barra di ricerca lineare\n @Prop() dropdownPosition: string = 'relative'; // Posizione del dropdown rispetto alla searchbar. \"relative\" o \"absolute\"\n\n\n /* ---------------------- @EVENTS ------------------------- */\n\n /**\n * Evento emesso quando l'utente clicca sull'icona in variant linear e linearIconOnly\n */\n @Event({ eventName: 'jump-search-bar-expanded' }) searchbarExpanded: 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' }) 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-show-all' }) showFullSearch: EventEmitter;\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-res-clicked'}) resultClicked: EventEmitter; \n\n /* ---------------------- @LIFECYCLE ------------------------- */\n componentDidLoad() {\n // Aggiungi l'event listener per il clic al di fuori del componente\n document.addEventListener('click', this.handleOutsideClick.bind(this));\n }\n\n disconnectedCallback() {\n // Rimuovi l'event listener per evitare perdite di memoria\n document.removeEventListener('click', this.handleOutsideClick.bind(this));\n }\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 /* -------------------- @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 handleOutsideClick(event: MouseEvent) {\n // Controlla se il clic è fuori dal componente\n if (this.componentRef && !this.componentRef.contains(event.target as Node)) {\n this.dropdownVisible = false;\n }\n }\n\n // Gestisce l'evento focus sull'input\n handleFocus = () => {\n const searchBarContainer = this.jumpSearchBar.closest('.SearchBar');\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('.SearchBar');\n if (searchBarContainer) {\n searchBarContainer.classList.remove('focused');\n }\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 // Se il dropdown è chiuso, aprilo. Potrebbe essere chiuso perchè non ci sono recenti\n if (!this.dropdownVisible) {\n this.dropdownVisible = true;\n }\n } else if(this.searchValue.length == 0) {\n this.dropdownVisible = false;\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 openDropdown() {\n this.resType = 'recents';\n this.dropdownVisible = true;\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 /** 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 /**\n * Se clicco l'icona espando la searchbar ed emetto un evento dedicato\n */\n expandSearchBar() {\n this.isExpanded = true;\n this.searchbarExpanded.emit();\n }\n\n\n /* --------------------- RENDER ------------------------------- */\n renderLinearIconOnly() {\n return (\n <Host class={\"JumpSearchBar \"} ref={(el) => (this.componentRef = el as HTMLElement)}>\n <div class={\"SearchBar iconOnly \" + this.variant + (this.isExpanded ? \" expanded\" : \"\")}>\n <div class=\"InputWrapper\" onClick={(this.isExpanded && this.dropdown && this.recents.length > 0) ? () => this.openDropdown() : null}>\n <jump-icon\n name=\"magnifying-glass\"\n category=\"light\"\n onClick={() => this.expandSearchBar()}\n ></jump-icon>\n {this.isExpanded &&\n // Mostra la barra di ricerca con l'animazione di slide\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 }\n </div>\n </div>\n {(this.dropdown && this.dropdownVisible) && this.renderDropdown()} \n </Host>\n );\n }\n\n renderDefault() {\n return (\n <Host class={\"JumpSearchBar\"} ref={(el) => (this.componentRef = el as HTMLElement)}>\n <div class={\"SearchBar \" + this.variant + \" \" + (this.withBtn ? \"withBtn\" : \"\") + (this.isExpanded ? \" expanded\" : \"\")}>\n <div class=\"InputWrapper\" onClick={(this.dropdown && this.recents.length > 0) ? () => this.openDropdown() : null}>\n {!this.withBtn && <jump-icon name=\"magnifying-glass\" category=\"light\"></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 </div>\n {this.withBtn && !this.linearIconOnly && (\n <jump-button\n variant=\"secondary\"\n size=\"medium\"\n name=\"scopri\"\n value=\"value\"\n aria-label=\"Scopri di più\"\n id=\"button\"\n onlyIcon\n onClick={() => this.btnOrShowOtherClicked()}\n >\n <jump-icon slot=\"suffix\" name=\"magnifying-glass\"></jump-icon>\n </jump-button>\n )}\n </div>\n {(this.dropdown && this.dropdownVisible) && this.renderDropdown()} \n </Host>\n );\n }\n\n renderDropdown(){\n console.log('POSITION', this.dropdownPosition);\n return <div class={\"Dropdown \" + (this.dropdownPosition == 'absolute' ? 'dropAbsolute' : 'dropRelative' ) }>\n {(this.resType == 'recents') &&\n <div class=\"Dropdown__Recents\">\n <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=\"Dropdown__Results\">\n <div class=\"ResWrapper\">\n {this.innerResults === undefined ?\n <div class=\"helperText\"><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 </div>\n }\n\n render() {\n if (this.variant === 'linear' && this.linearIconOnly) {\n return this.renderLinearIconOnly();\n } else {\n return this.renderDefault();\n }\n }\n}"]}
|