@jumpgroup/jump-design-system 0.3.71 → 0.3.72
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/jump-design-system.cjs.js +1 -1
- package/dist/cjs/jump-filter-range.cjs.entry.js +109 -0
- package/dist/cjs/jump-filter-range.cjs.entry.js.map +1 -0
- package/dist/cjs/jump-filter-select.cjs.entry.js +1 -1
- package/dist/cjs/jump-filter-switch.cjs.entry.js +1 -1
- package/dist/cjs/jump-filtergroup.cjs.entry.js +3 -3
- package/dist/cjs/jump-navbar.cjs.entry.js +5 -5
- package/dist/cjs/jump-pagination-table.cjs.entry.js +3 -3
- package/dist/cjs/jump-pagination.cjs.entry.js +3 -3
- package/dist/cjs/jump-quantity.cjs.entry.js +3 -3
- package/dist/cjs/jump-search-bar-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/jump-search-bar-mobile.cjs.entry.js +4 -4
- package/dist/cjs/jump-side-cart-example.cjs.entry.js +1 -1
- package/dist/cjs/jump-tab-item.cjs.entry.js +2 -2
- package/dist/cjs/jump-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/jump-tab.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/jump-filter-range/jump-filter-range.css +99 -0
- package/dist/collection/components/jump-filter-range/jump-filter-range.js +393 -0
- package/dist/collection/components/jump-filter-range/jump-filter-range.js.map +1 -0
- package/dist/collection/components/jump-filter-range/jump-filter-range.stories.js +90 -0
- package/dist/collection/components/jump-filter-range/jump-filter-range.stories.js.map +1 -0
- package/dist/collection/components/jump-filter-select/jump-filter-select.js +1 -1
- package/dist/collection/components/jump-filter-switch/jump-filter-switch.js +1 -1
- package/dist/collection/components/jump-filtergroup/jump-filtergroup.js +3 -3
- package/dist/collection/components/jump-navbar/jump-navbar.js +5 -5
- package/dist/collection/components/jump-pagination/jump-pagination.js +3 -3
- package/dist/collection/components/jump-pagination-table/jump-pagination-table.js +3 -3
- package/dist/collection/components/jump-quantity/jump-quantity.js +3 -3
- package/dist/collection/components/jump-search-bar-dropdown-item/jump-search-bar-dropdown-item.js +1 -1
- package/dist/collection/components/jump-search-bar-mobile/jump-search-bar-mobile.js +4 -4
- package/dist/collection/components/jump-side-cart/jump-side-cart.example.js +1 -1
- package/dist/collection/components/jump-tab/jump-tab.js +1 -1
- 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-filter-range.d.ts +11 -0
- package/dist/components/jump-filter-range.js +141 -0
- package/dist/components/jump-filter-range.js.map +1 -0
- package/dist/components/jump-filter-select.js +1 -1
- package/dist/components/jump-filter-switch.js +1 -1
- package/dist/components/jump-filtergroup.js +3 -3
- package/dist/components/jump-navbar.js +5 -5
- package/dist/components/jump-pagination-table.js +3 -3
- package/dist/components/jump-pagination.js +3 -3
- package/dist/components/jump-quantity.js +3 -3
- package/dist/components/jump-search-bar-dropdown-item.js +1 -1
- package/dist/components/jump-search-bar-mobile.js +4 -4
- package/dist/components/jump-side-cart-example.js +1 -1
- package/dist/components/jump-tab-item.js +2 -2
- package/dist/components/jump-tab-panel.js +1 -1
- package/dist/components/jump-tab.js +1 -1
- package/dist/esm/jump-design-system.js +1 -1
- package/dist/esm/jump-filter-range.entry.js +105 -0
- package/dist/esm/jump-filter-range.entry.js.map +1 -0
- package/dist/esm/jump-filter-select.entry.js +1 -1
- package/dist/esm/jump-filter-switch.entry.js +1 -1
- package/dist/esm/jump-filtergroup.entry.js +3 -3
- package/dist/esm/jump-navbar.entry.js +5 -5
- package/dist/esm/jump-pagination-table.entry.js +3 -3
- package/dist/esm/jump-pagination.entry.js +3 -3
- package/dist/esm/jump-quantity.entry.js +3 -3
- package/dist/esm/jump-search-bar-dropdown-item.entry.js +1 -1
- package/dist/esm/jump-search-bar-mobile.entry.js +4 -4
- package/dist/esm/jump-side-cart-example.entry.js +1 -1
- package/dist/esm/jump-tab-item.entry.js +2 -2
- package/dist/esm/jump-tab-panel.entry.js +1 -1
- package/dist/esm/jump-tab.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- 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-2e274d20.entry.js → p-048d87ee.entry.js} +2 -2
- package/dist/jump-design-system/{p-9279b124.entry.js → p-1f824808.entry.js} +2 -2
- package/dist/jump-design-system/{p-617c7cd7.entry.js → p-48bb1cbf.entry.js} +2 -2
- package/dist/jump-design-system/{p-fa2a10bf.entry.js → p-5092836a.entry.js} +2 -2
- package/dist/jump-design-system/{p-35f2032b.entry.js → p-5fb2a919.entry.js} +2 -2
- package/dist/jump-design-system/{p-19c6ab3f.entry.js → p-6134b84b.entry.js} +2 -2
- package/dist/jump-design-system/p-64024e67.entry.js +2 -0
- package/dist/jump-design-system/{p-4706eba4.entry.js → p-6e497dd6.entry.js} +2 -2
- package/dist/jump-design-system/{p-089b9c5c.entry.js → p-916742f5.entry.js} +2 -2
- package/dist/jump-design-system/{p-7a2bc23d.entry.js → p-ae1435a6.entry.js} +2 -2
- package/dist/jump-design-system/{p-0cdca5df.entry.js → p-b03b8328.entry.js} +2 -2
- package/dist/jump-design-system/p-c19c86c7.entry.js +2 -0
- package/dist/jump-design-system/p-c19c86c7.entry.js.map +1 -0
- package/dist/jump-design-system/{p-0432b242.entry.js → p-cdc53aae.entry.js} +2 -2
- package/dist/jump-design-system/{p-b8b28d8b.entry.js → p-d40c487f.entry.js} +2 -2
- package/dist/jump-design-system-elements.json +45 -0
- package/dist/types/components/jump-filter-range/jump-filter-range.d.ts +39 -0
- package/dist/types/components/jump-filter-range/jump-filter-range.stories.d.ts +46 -0
- package/dist/types/components.d.ts +114 -0
- package/package.json +1 -1
- package/dist/jump-design-system/p-cb9ab473.entry.js +0 -2
- /package/dist/jump-design-system/{p-2e274d20.entry.js.map → p-048d87ee.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-9279b124.entry.js.map → p-1f824808.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-617c7cd7.entry.js.map → p-48bb1cbf.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-fa2a10bf.entry.js.map → p-5092836a.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-35f2032b.entry.js.map → p-5fb2a919.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-19c6ab3f.entry.js.map → p-6134b84b.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-cb9ab473.entry.js.map → p-64024e67.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-4706eba4.entry.js.map → p-6e497dd6.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-089b9c5c.entry.js.map → p-916742f5.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-7a2bc23d.entry.js.map → p-ae1435a6.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-0cdca5df.entry.js.map → p-b03b8328.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-0432b242.entry.js.map → p-cdc53aae.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-b8b28d8b.entry.js.map → p-d40c487f.entry.js.map} +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--jump-range-track-height: 4px;
|
|
3
|
+
--jump-range-thumb-color: var(--neutral-white, #ffffff);
|
|
4
|
+
--jump-range-thumb-size: 18px;
|
|
5
|
+
--jump-range-fill-color: var(--secondary-standard, #5e79ba);
|
|
6
|
+
--jump-range-track-color: var(--gray-ultralight, #f8f8f8);
|
|
7
|
+
display: block;
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host(.is-disabled) {
|
|
12
|
+
opacity: 0.5;
|
|
13
|
+
cursor: not-allowed;
|
|
14
|
+
--jump-range-fill-color: var(--gray-light, #e0e0e0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.label-container {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
margin-bottom: 0.75rem;
|
|
21
|
+
font-size: 0.9em;
|
|
22
|
+
color: #333;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.slider-container {
|
|
26
|
+
position: relative;
|
|
27
|
+
height: var(--jump-range-thumb-size);
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.slider-track,
|
|
33
|
+
.slider-fill {
|
|
34
|
+
position: absolute;
|
|
35
|
+
left: 0;
|
|
36
|
+
height: var(--jump-range-track-height);
|
|
37
|
+
border-radius: var(--jump-range-track-height);
|
|
38
|
+
width: 100%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.slider-track {
|
|
42
|
+
background-color: var(--jump-range-track-color);
|
|
43
|
+
z-index: 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.slider-fill {
|
|
47
|
+
background-color: var(--jump-range-fill-color);
|
|
48
|
+
z-index: 2;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.range-input {
|
|
52
|
+
-webkit-appearance: none;
|
|
53
|
+
-moz-appearance: none;
|
|
54
|
+
appearance: none;
|
|
55
|
+
position: absolute;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: var(--jump-range-thumb-size);
|
|
58
|
+
background: transparent;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
margin: 0;
|
|
61
|
+
z-index: 3;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
input[type=range]::-webkit-slider-thumb {
|
|
65
|
+
-webkit-appearance: none;
|
|
66
|
+
height: var(--jump-range-thumb-size);
|
|
67
|
+
width: var(--jump-range-thumb-size);
|
|
68
|
+
border-radius: 50%;
|
|
69
|
+
background: var(--jump-range-thumb-color);
|
|
70
|
+
border: 1px solid #ccc;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
pointer-events: auto;
|
|
73
|
+
margin-top: calc((var(--jump-range-thumb-size) - var(--jump-range-track-height)) / -2);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
input[type=range]::-moz-range-thumb {
|
|
77
|
+
-moz-appearance: none;
|
|
78
|
+
height: var(--jump-range-thumb-size);
|
|
79
|
+
width: var(--jump-range-thumb-size);
|
|
80
|
+
border-radius: 50%;
|
|
81
|
+
background: var(--jump-range-thumb-color);
|
|
82
|
+
border: 1px solid #ccc;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
pointer-events: auto;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
input[type=range]::-webkit-slider-runnable-track {
|
|
88
|
+
-webkit-appearance: none;
|
|
89
|
+
height: var(--jump-range-track-height);
|
|
90
|
+
background: transparent;
|
|
91
|
+
border: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
input[type=range]::-moz-range-track {
|
|
95
|
+
-moz-appearance: none;
|
|
96
|
+
height: var(--jump-range-track-height);
|
|
97
|
+
background: transparent;
|
|
98
|
+
border: none;
|
|
99
|
+
}
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
const MIN_GAP = 0;
|
|
3
|
+
export class JumpFilterRange {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.handleMinInput = (event) => {
|
|
6
|
+
const input = event.target;
|
|
7
|
+
let newMinVal = parseInt(input.value, 10);
|
|
8
|
+
if (newMinVal > this.maxVal - MIN_GAP) {
|
|
9
|
+
newMinVal = this.maxVal - MIN_GAP;
|
|
10
|
+
input.value = newMinVal.toString();
|
|
11
|
+
}
|
|
12
|
+
this.minVal = newMinVal;
|
|
13
|
+
this.emitChangeEvents();
|
|
14
|
+
};
|
|
15
|
+
this.handleMaxInput = (event) => {
|
|
16
|
+
const input = event.target;
|
|
17
|
+
let newMaxVal = parseInt(input.value, 10);
|
|
18
|
+
if (newMaxVal < this.minVal + MIN_GAP) {
|
|
19
|
+
newMaxVal = this.minVal + MIN_GAP;
|
|
20
|
+
input.value = newMaxVal.toString();
|
|
21
|
+
}
|
|
22
|
+
this.maxVal = newMaxVal;
|
|
23
|
+
this.emitChangeEvents();
|
|
24
|
+
};
|
|
25
|
+
this.name = 'range-filter';
|
|
26
|
+
this.labelMinBefore = 'Min:';
|
|
27
|
+
this.labelMinAfter = '';
|
|
28
|
+
this.labelMaxBefore = 'Max:';
|
|
29
|
+
this.labelMaxAfter = '';
|
|
30
|
+
this.min = 0;
|
|
31
|
+
this.max = 100;
|
|
32
|
+
this.step = 1;
|
|
33
|
+
this.value = [];
|
|
34
|
+
this.disabled = false;
|
|
35
|
+
this.minVal = undefined;
|
|
36
|
+
this.maxVal = undefined;
|
|
37
|
+
}
|
|
38
|
+
valueWatcher(newValue) {
|
|
39
|
+
this.setComponentValues(newValue);
|
|
40
|
+
}
|
|
41
|
+
componentWillLoad() {
|
|
42
|
+
this.setComponentValues(this.value);
|
|
43
|
+
}
|
|
44
|
+
setComponentValues(values) {
|
|
45
|
+
if (values && values.length === 2) {
|
|
46
|
+
this.minVal = values[0];
|
|
47
|
+
this.maxVal = values[1];
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.minVal = this.min;
|
|
51
|
+
this.maxVal = this.max;
|
|
52
|
+
}
|
|
53
|
+
this.value = [this.minVal, this.maxVal];
|
|
54
|
+
}
|
|
55
|
+
emitChangeEvents() {
|
|
56
|
+
const currentValues = [this.minVal, this.maxVal];
|
|
57
|
+
this.value = currentValues;
|
|
58
|
+
const eventDetail = { name: this.name, values: currentValues };
|
|
59
|
+
this.rangeChange.emit(eventDetail);
|
|
60
|
+
this.filterChange.emit(eventDetail);
|
|
61
|
+
}
|
|
62
|
+
getFillStyle() {
|
|
63
|
+
const range = this.max - this.min;
|
|
64
|
+
if (range === 0)
|
|
65
|
+
return { left: '0%', width: '0%' };
|
|
66
|
+
const leftPercent = ((this.minVal - this.min) / range) * 100;
|
|
67
|
+
const rightPercent = ((this.maxVal - this.min) / range) * 100;
|
|
68
|
+
return { left: `${leftPercent}%`, width: `${rightPercent - leftPercent}%` };
|
|
69
|
+
}
|
|
70
|
+
async setValue(values, emitEvent = true) {
|
|
71
|
+
if (this.disabled || !values || values.length !== 2) {
|
|
72
|
+
return this.getValues();
|
|
73
|
+
}
|
|
74
|
+
this.setComponentValues(values);
|
|
75
|
+
if (emitEvent) {
|
|
76
|
+
this.emitChangeEvents();
|
|
77
|
+
}
|
|
78
|
+
return this.getValues();
|
|
79
|
+
}
|
|
80
|
+
async getValues() {
|
|
81
|
+
return [this.minVal, this.maxVal];
|
|
82
|
+
}
|
|
83
|
+
async getName() {
|
|
84
|
+
return this.name;
|
|
85
|
+
}
|
|
86
|
+
render() {
|
|
87
|
+
return (h(Host, { key: '7db1339ac56ae016c5a050a7266bbc353b33bdb0', class: { 'is-disabled': this.disabled } }, h("div", { key: '81be4dbe27ecb9a0ae7e2ec8aa83630d8caf21b0', class: "label-container" }, h("label", { key: 'fc8ad6c1e5e2cef6aca4c3abe3358d51c23a05e8', class: "label-min" }, this.labelMinBefore, " ", this.minVal, this.labelMinAfter), h("label", { key: '5c21deff42c6e9e6b6bfd560b3f5af158ccdedbb', class: "label-max" }, this.labelMaxBefore, " ", this.maxVal, this.labelMaxAfter)), h("div", { key: '799c8f97eaecfffe4940e0b36879024cba0c0610', class: "slider-container" }, h("div", { key: 'f9f344075857009d4bbb9c6ed882363099d5fba9', class: "slider-track" }), h("div", { key: '0f7a60252ca1d39a43a8c5e98b4fd93daa80a4c9', class: "slider-fill", style: this.getFillStyle() }), h("input", { key: '0318aec31145df2a4193eefcb43011ab7df3464d', type: "range", min: this.min, max: this.max, step: this.step, value: this.minVal, onInput: this.handleMinInput, disabled: this.disabled, class: "range-input", "aria-label": this.labelMinBefore }), h("input", { key: '5340fe9c8ac6658d58cafcd95182cc7562571aee', type: "range", min: this.min, max: this.max, step: this.step, value: this.maxVal, onInput: this.handleMaxInput, disabled: this.disabled, class: "range-input", "aria-label": this.labelMaxBefore }))));
|
|
88
|
+
}
|
|
89
|
+
static get is() { return "jump-filter-range"; }
|
|
90
|
+
static get encapsulation() { return "shadow"; }
|
|
91
|
+
static get originalStyleUrls() {
|
|
92
|
+
return {
|
|
93
|
+
"$": ["jump-filter-range.scss"]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
static get styleUrls() {
|
|
97
|
+
return {
|
|
98
|
+
"$": ["jump-filter-range.css"]
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
static get properties() {
|
|
102
|
+
return {
|
|
103
|
+
"name": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"mutable": false,
|
|
106
|
+
"complexType": {
|
|
107
|
+
"original": "string",
|
|
108
|
+
"resolved": "string",
|
|
109
|
+
"references": {}
|
|
110
|
+
},
|
|
111
|
+
"required": false,
|
|
112
|
+
"optional": false,
|
|
113
|
+
"docs": {
|
|
114
|
+
"tags": [],
|
|
115
|
+
"text": "Nome identificativo del filtro, utilizzato negli eventi"
|
|
116
|
+
},
|
|
117
|
+
"attribute": "name",
|
|
118
|
+
"reflect": false,
|
|
119
|
+
"defaultValue": "'range-filter'"
|
|
120
|
+
},
|
|
121
|
+
"labelMinBefore": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"mutable": false,
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "string",
|
|
126
|
+
"resolved": "string",
|
|
127
|
+
"references": {}
|
|
128
|
+
},
|
|
129
|
+
"required": false,
|
|
130
|
+
"optional": false,
|
|
131
|
+
"docs": {
|
|
132
|
+
"tags": [],
|
|
133
|
+
"text": "Testo da mostrare prima del valore minimo."
|
|
134
|
+
},
|
|
135
|
+
"attribute": "label-min-before",
|
|
136
|
+
"reflect": false,
|
|
137
|
+
"defaultValue": "'Min:'"
|
|
138
|
+
},
|
|
139
|
+
"labelMinAfter": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"mutable": false,
|
|
142
|
+
"complexType": {
|
|
143
|
+
"original": "string",
|
|
144
|
+
"resolved": "string",
|
|
145
|
+
"references": {}
|
|
146
|
+
},
|
|
147
|
+
"required": false,
|
|
148
|
+
"optional": false,
|
|
149
|
+
"docs": {
|
|
150
|
+
"tags": [],
|
|
151
|
+
"text": "Testo da mostrare dopo il valore minimo (es. unit\u00E0 di misura)."
|
|
152
|
+
},
|
|
153
|
+
"attribute": "label-min-after",
|
|
154
|
+
"reflect": false,
|
|
155
|
+
"defaultValue": "''"
|
|
156
|
+
},
|
|
157
|
+
"labelMaxBefore": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"mutable": false,
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "string",
|
|
162
|
+
"resolved": "string",
|
|
163
|
+
"references": {}
|
|
164
|
+
},
|
|
165
|
+
"required": false,
|
|
166
|
+
"optional": false,
|
|
167
|
+
"docs": {
|
|
168
|
+
"tags": [],
|
|
169
|
+
"text": "Testo da mostrare prima del valore massimo."
|
|
170
|
+
},
|
|
171
|
+
"attribute": "label-max-before",
|
|
172
|
+
"reflect": false,
|
|
173
|
+
"defaultValue": "'Max:'"
|
|
174
|
+
},
|
|
175
|
+
"labelMaxAfter": {
|
|
176
|
+
"type": "string",
|
|
177
|
+
"mutable": false,
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "string",
|
|
180
|
+
"resolved": "string",
|
|
181
|
+
"references": {}
|
|
182
|
+
},
|
|
183
|
+
"required": false,
|
|
184
|
+
"optional": false,
|
|
185
|
+
"docs": {
|
|
186
|
+
"tags": [],
|
|
187
|
+
"text": "Testo da mostrare dopo il valore massimo (es. unit\u00E0 di misura)."
|
|
188
|
+
},
|
|
189
|
+
"attribute": "label-max-after",
|
|
190
|
+
"reflect": false,
|
|
191
|
+
"defaultValue": "''"
|
|
192
|
+
},
|
|
193
|
+
"min": {
|
|
194
|
+
"type": "number",
|
|
195
|
+
"mutable": false,
|
|
196
|
+
"complexType": {
|
|
197
|
+
"original": "number",
|
|
198
|
+
"resolved": "number",
|
|
199
|
+
"references": {}
|
|
200
|
+
},
|
|
201
|
+
"required": false,
|
|
202
|
+
"optional": false,
|
|
203
|
+
"docs": {
|
|
204
|
+
"tags": [],
|
|
205
|
+
"text": "Il valore minimo possibile per lo slider"
|
|
206
|
+
},
|
|
207
|
+
"attribute": "min",
|
|
208
|
+
"reflect": false,
|
|
209
|
+
"defaultValue": "0"
|
|
210
|
+
},
|
|
211
|
+
"max": {
|
|
212
|
+
"type": "number",
|
|
213
|
+
"mutable": false,
|
|
214
|
+
"complexType": {
|
|
215
|
+
"original": "number",
|
|
216
|
+
"resolved": "number",
|
|
217
|
+
"references": {}
|
|
218
|
+
},
|
|
219
|
+
"required": false,
|
|
220
|
+
"optional": false,
|
|
221
|
+
"docs": {
|
|
222
|
+
"tags": [],
|
|
223
|
+
"text": "Il valore massimo possibile per lo slider"
|
|
224
|
+
},
|
|
225
|
+
"attribute": "max",
|
|
226
|
+
"reflect": false,
|
|
227
|
+
"defaultValue": "100"
|
|
228
|
+
},
|
|
229
|
+
"step": {
|
|
230
|
+
"type": "number",
|
|
231
|
+
"mutable": false,
|
|
232
|
+
"complexType": {
|
|
233
|
+
"original": "number",
|
|
234
|
+
"resolved": "number",
|
|
235
|
+
"references": {}
|
|
236
|
+
},
|
|
237
|
+
"required": false,
|
|
238
|
+
"optional": false,
|
|
239
|
+
"docs": {
|
|
240
|
+
"tags": [],
|
|
241
|
+
"text": "L'incremento tra i valori dello slider"
|
|
242
|
+
},
|
|
243
|
+
"attribute": "step",
|
|
244
|
+
"reflect": false,
|
|
245
|
+
"defaultValue": "1"
|
|
246
|
+
},
|
|
247
|
+
"value": {
|
|
248
|
+
"type": "unknown",
|
|
249
|
+
"mutable": true,
|
|
250
|
+
"complexType": {
|
|
251
|
+
"original": "number[]",
|
|
252
|
+
"resolved": "number[]",
|
|
253
|
+
"references": {}
|
|
254
|
+
},
|
|
255
|
+
"required": false,
|
|
256
|
+
"optional": false,
|
|
257
|
+
"docs": {
|
|
258
|
+
"tags": [],
|
|
259
|
+
"text": "I valori iniziali dello slider, come array [min, max]"
|
|
260
|
+
},
|
|
261
|
+
"defaultValue": "[]"
|
|
262
|
+
},
|
|
263
|
+
"disabled": {
|
|
264
|
+
"type": "boolean",
|
|
265
|
+
"mutable": false,
|
|
266
|
+
"complexType": {
|
|
267
|
+
"original": "boolean",
|
|
268
|
+
"resolved": "boolean",
|
|
269
|
+
"references": {}
|
|
270
|
+
},
|
|
271
|
+
"required": false,
|
|
272
|
+
"optional": false,
|
|
273
|
+
"docs": {
|
|
274
|
+
"tags": [],
|
|
275
|
+
"text": "Stato disabilitato dello slider"
|
|
276
|
+
},
|
|
277
|
+
"attribute": "disabled",
|
|
278
|
+
"reflect": true,
|
|
279
|
+
"defaultValue": "false"
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
static get states() {
|
|
284
|
+
return {
|
|
285
|
+
"minVal": {},
|
|
286
|
+
"maxVal": {}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
static get events() {
|
|
290
|
+
return [{
|
|
291
|
+
"method": "rangeChange",
|
|
292
|
+
"name": "jump-range-change",
|
|
293
|
+
"bubbles": true,
|
|
294
|
+
"cancelable": true,
|
|
295
|
+
"composed": true,
|
|
296
|
+
"docs": {
|
|
297
|
+
"tags": [],
|
|
298
|
+
"text": ""
|
|
299
|
+
},
|
|
300
|
+
"complexType": {
|
|
301
|
+
"original": "any",
|
|
302
|
+
"resolved": "any",
|
|
303
|
+
"references": {}
|
|
304
|
+
}
|
|
305
|
+
}, {
|
|
306
|
+
"method": "filterChange",
|
|
307
|
+
"name": "jump-filterchange",
|
|
308
|
+
"bubbles": true,
|
|
309
|
+
"cancelable": true,
|
|
310
|
+
"composed": true,
|
|
311
|
+
"docs": {
|
|
312
|
+
"tags": [],
|
|
313
|
+
"text": ""
|
|
314
|
+
},
|
|
315
|
+
"complexType": {
|
|
316
|
+
"original": "any",
|
|
317
|
+
"resolved": "any",
|
|
318
|
+
"references": {}
|
|
319
|
+
}
|
|
320
|
+
}];
|
|
321
|
+
}
|
|
322
|
+
static get methods() {
|
|
323
|
+
return {
|
|
324
|
+
"setValue": {
|
|
325
|
+
"complexType": {
|
|
326
|
+
"signature": "(values: number[], emitEvent?: boolean) => Promise<number[]>",
|
|
327
|
+
"parameters": [{
|
|
328
|
+
"name": "values",
|
|
329
|
+
"type": "number[]",
|
|
330
|
+
"docs": ""
|
|
331
|
+
}, {
|
|
332
|
+
"name": "emitEvent",
|
|
333
|
+
"type": "boolean",
|
|
334
|
+
"docs": ""
|
|
335
|
+
}],
|
|
336
|
+
"references": {
|
|
337
|
+
"Promise": {
|
|
338
|
+
"location": "global",
|
|
339
|
+
"id": "global::Promise"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"return": "Promise<number[]>"
|
|
343
|
+
},
|
|
344
|
+
"docs": {
|
|
345
|
+
"text": "",
|
|
346
|
+
"tags": []
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
"getValues": {
|
|
350
|
+
"complexType": {
|
|
351
|
+
"signature": "() => Promise<number[]>",
|
|
352
|
+
"parameters": [],
|
|
353
|
+
"references": {
|
|
354
|
+
"Promise": {
|
|
355
|
+
"location": "global",
|
|
356
|
+
"id": "global::Promise"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"return": "Promise<number[]>"
|
|
360
|
+
},
|
|
361
|
+
"docs": {
|
|
362
|
+
"text": "",
|
|
363
|
+
"tags": []
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"getName": {
|
|
367
|
+
"complexType": {
|
|
368
|
+
"signature": "() => Promise<string>",
|
|
369
|
+
"parameters": [],
|
|
370
|
+
"references": {
|
|
371
|
+
"Promise": {
|
|
372
|
+
"location": "global",
|
|
373
|
+
"id": "global::Promise"
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
"return": "Promise<string>"
|
|
377
|
+
},
|
|
378
|
+
"docs": {
|
|
379
|
+
"text": "",
|
|
380
|
+
"tags": []
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
static get elementRef() { return "host"; }
|
|
386
|
+
static get watchers() {
|
|
387
|
+
return [{
|
|
388
|
+
"propName": "value",
|
|
389
|
+
"methodName": "valueWatcher"
|
|
390
|
+
}];
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=jump-filter-range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jump-filter-range.js","sourceRoot":"","sources":["../../../src/components/jump-filter-range/jump-filter-range.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAgB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7G,MAAM,OAAO,GAAG,CAAC,CAAC;AAOlB,MAAM,OAAO,eAAe;;QAuDlB,mBAAc,GAAG,CAAC,KAAY,EAAE,EAAE;YACxC,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;YAC/C,IAAI,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC1C,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC;gBACtC,SAAS,GAAG,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;gBAClC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;YACrC,CAAC;YACD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC,CAAC;QAEM,mBAAc,GAAG,CAAC,KAAY,EAAE,EAAE;YACxC,MAAM,KAAK,GAAG,KAAK,CAAC,MAA0B,CAAC;YAC/C,IAAI,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC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gBAEP,IAAI,CAAC,cAAc,GAC/B,CACE,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Prop, h, Event, EventEmitter, Method, State, Watch, Element } from '@stencil/core';\n\nconst MIN_GAP = 0;\n\n@Component({\n tag: 'jump-filter-range',\n styleUrl: 'jump-filter-range.scss',\n shadow: true,\n})\nexport class JumpFilterRange {\n @Element() host: HTMLElement;\n\n /** Nome identificativo del filtro, utilizzato negli eventi */\n @Prop() name: string = 'range-filter';\n\n // --- Props delle etichette modificate ---\n /** Testo da mostrare prima del valore minimo. */\n @Prop() labelMinBefore: string = 'Min:';\n /** Testo da mostrare dopo il valore minimo (es. unità di misura). */\n @Prop() labelMinAfter: string = '';\n\n /** Testo da mostrare prima del valore massimo. */\n @Prop() labelMaxBefore: string = 'Max:';\n /** Testo da mostrare dopo il valore massimo (es. unità di misura). */\n @Prop() labelMaxAfter: string = '';\n // --- Fine props modificate ---\n\n /** Il valore minimo possibile per lo slider */\n @Prop() min: number = 0;\n /** Il valore massimo possibile per lo slider */\n @Prop() max: number = 100;\n /** L'incremento tra i valori dello slider */\n @Prop() step: number = 1;\n /** I valori iniziali dello slider, come array [min, max] */\n @Prop({ mutable: true }) value: number[] = [];\n /** Stato disabilitato dello slider */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n @State() minVal: number;\n @State() maxVal: number;\n\n @Watch('value')\n valueWatcher(newValue: number[]) {\n this.setComponentValues(newValue);\n }\n\n @Event({ eventName: 'jump-range-change' }) rangeChange: EventEmitter;\n @Event({ eventName: 'jump-filterchange' }) filterChange: EventEmitter;\n\n componentWillLoad() {\n this.setComponentValues(this.value);\n }\n\n private setComponentValues(values: number[]) {\n if (values && values.length === 2) {\n this.minVal = values[0];\n this.maxVal = values[1];\n } else {\n this.minVal = this.min;\n this.maxVal = this.max;\n }\n this.value = [this.minVal, this.maxVal];\n }\n\n private handleMinInput = (event: Event) => {\n const input = event.target as HTMLInputElement;\n let newMinVal = parseInt(input.value, 10);\n if (newMinVal > this.maxVal - MIN_GAP) {\n newMinVal = this.maxVal - MIN_GAP;\n input.value = newMinVal.toString();\n }\n this.minVal = newMinVal;\n this.emitChangeEvents();\n };\n\n private handleMaxInput = (event: Event) => {\n const input = event.target as HTMLInputElement;\n let newMaxVal = parseInt(input.value, 10);\n if (newMaxVal < this.minVal + MIN_GAP) {\n newMaxVal = this.minVal + MIN_GAP;\n input.value = newMaxVal.toString();\n }\n this.maxVal = newMaxVal;\n this.emitChangeEvents();\n };\n\n private emitChangeEvents() {\n const currentValues = [this.minVal, this.maxVal];\n this.value = currentValues;\n const eventDetail = { name: this.name, values: currentValues };\n this.rangeChange.emit(eventDetail);\n this.filterChange.emit(eventDetail);\n }\n\n private getFillStyle() {\n const range = this.max - this.min;\n if (range === 0) return { left: '0%', width: '0%' };\n const leftPercent = ((this.minVal - this.min) / range) * 100;\n const rightPercent = ((this.maxVal - this.min) / range) * 100;\n return { left: `${leftPercent}%`, width: `${rightPercent - leftPercent}%` };\n }\n\n @Method()\n async setValue(values: number[], emitEvent: boolean = true): Promise<number[]> {\n if (this.disabled || !values || values.length !== 2) {\n return this.getValues();\n }\n this.setComponentValues(values);\n if (emitEvent) {\n this.emitChangeEvents();\n }\n return this.getValues();\n }\n \n @Method()\n async getValues(): Promise<number[]> {\n return [this.minVal, this.maxVal];\n }\n\n @Method()\n async getName(): Promise<string> {\n return this.name;\n }\n\n render() {\n return (\n <Host class={{ 'is-disabled': this.disabled }}>\n <div class=\"label-container\">\n {/* Etichetta MIN aggiornata */}\n <label class=\"label-min\">\n {this.labelMinBefore} {this.minVal}{this.labelMinAfter}\n </label>\n \n {/* Etichetta MAX aggiornata */}\n <label class=\"label-max\">\n {this.labelMaxBefore} {this.maxVal}{this.labelMaxAfter}\n </label>\n </div>\n <div class=\"slider-container\">\n <div class=\"slider-track\"></div>\n <div class=\"slider-fill\" style={this.getFillStyle()}></div>\n <input\n type=\"range\"\n min={this.min} max={this.max} step={this.step}\n value={this.minVal}\n onInput={this.handleMinInput}\n disabled={this.disabled}\n class=\"range-input\"\n // aria-label aggiornato\n aria-label={this.labelMinBefore}\n />\n <input\n type=\"range\"\n min={this.min} max={this.max} step={this.step}\n value={this.maxVal}\n onInput={this.handleMaxInput}\n disabled={this.disabled}\n class=\"range-input\"\n // aria-label aggiornato\n aria-label={this.labelMaxBefore}\n />\n </div>\n </Host>\n );\n }\n}"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { generateAttributesFromArgs, formatHtml } from "../../utils/utils";
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Components/Filters/JumpFilterRange',
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
name: { control: 'text' },
|
|
19
|
+
labelMinBefore: { control: 'text', description: "Testo prima del valore minimo." },
|
|
20
|
+
labelMinAfter: { control: 'text', description: "Testo dopo il valore minimo (es. €)." },
|
|
21
|
+
labelMaxBefore: { control: 'text', description: "Testo prima del valore massimo." },
|
|
22
|
+
labelMaxAfter: { control: 'text', description: "Testo dopo il valore massimo (es. €)." },
|
|
23
|
+
min: { control: 'number' },
|
|
24
|
+
max: { control: 'number' },
|
|
25
|
+
step: { control: 'number' },
|
|
26
|
+
value: { control: 'object' },
|
|
27
|
+
disabled: { control: 'boolean' },
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const Template = (args) => {
|
|
31
|
+
const { value } = args, rest = __rest(args, ["value"]);
|
|
32
|
+
const attributes = generateAttributesFromArgs(rest);
|
|
33
|
+
const valueAttribute = value ? `value='${JSON.stringify(value)}'` : '';
|
|
34
|
+
return formatHtml(`<jump-filter-range ${attributes} ${valueAttribute}></jump-filter-range>`);
|
|
35
|
+
};
|
|
36
|
+
export const Default = Template.bind({});
|
|
37
|
+
Default.args = {
|
|
38
|
+
name: 'default-range',
|
|
39
|
+
labelMinBefore: 'Min:',
|
|
40
|
+
labelMinAfter: '',
|
|
41
|
+
labelMaxBefore: 'Max:',
|
|
42
|
+
labelMaxAfter: '',
|
|
43
|
+
min: 0,
|
|
44
|
+
max: 100,
|
|
45
|
+
step: 1,
|
|
46
|
+
value: [25, 75],
|
|
47
|
+
disabled: false,
|
|
48
|
+
};
|
|
49
|
+
// --- NUOVA STORIA AGGIUNTA ---
|
|
50
|
+
export const PriceRange = Template.bind({});
|
|
51
|
+
PriceRange.args = {
|
|
52
|
+
name: 'price-filter',
|
|
53
|
+
labelMinBefore: 'Prezzo da',
|
|
54
|
+
labelMinAfter: '€',
|
|
55
|
+
labelMaxBefore: 'a',
|
|
56
|
+
labelMaxAfter: '€',
|
|
57
|
+
min: 0,
|
|
58
|
+
max: 1500,
|
|
59
|
+
step: 10,
|
|
60
|
+
value: [250, 900],
|
|
61
|
+
disabled: false, // Come richiesto, non è disabilitato
|
|
62
|
+
};
|
|
63
|
+
// -----------------------------
|
|
64
|
+
export const Percentage = Template.bind({});
|
|
65
|
+
Percentage.args = {
|
|
66
|
+
name: 'satisfaction-range',
|
|
67
|
+
labelMinBefore: 'Soddisfazione da',
|
|
68
|
+
labelMinAfter: '%',
|
|
69
|
+
labelMaxBefore: 'a',
|
|
70
|
+
labelMaxAfter: '%',
|
|
71
|
+
min: 0,
|
|
72
|
+
max: 100,
|
|
73
|
+
step: 1,
|
|
74
|
+
value: [20, 80],
|
|
75
|
+
};
|
|
76
|
+
export const OnlyValues = Template.bind({});
|
|
77
|
+
OnlyValues.args = {
|
|
78
|
+
name: 'satisfaction-range',
|
|
79
|
+
labelMinBefore: '',
|
|
80
|
+
labelMinAfter: '',
|
|
81
|
+
labelMaxBefore: '',
|
|
82
|
+
labelMaxAfter: '',
|
|
83
|
+
min: 0,
|
|
84
|
+
max: 100,
|
|
85
|
+
step: 1,
|
|
86
|
+
value: [20, 80],
|
|
87
|
+
};
|
|
88
|
+
export const Disabled = Template.bind({});
|
|
89
|
+
Disabled.args = Object.assign(Object.assign({}, PriceRange.args), { name: 'disabled-price-filter', disabled: true });
|
|
90
|
+
//# sourceMappingURL=jump-filter-range.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jump-filter-range.stories.js","sourceRoot":"","sources":["../../../src/components/jump-filter-range/jump-filter-range.stories.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE3E,eAAe;IACb,KAAK,EAAE,oCAAoC;IAC3C,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QACzB,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,gCAAgC,EAAE;QAClF,aAAa,EAAE,EAAE,OAAO,EAAE,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AC,EAAE,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,mCAER,UAAU,CAAC,IAAI,KAClB,IAAI,EAAE,uBAAuB,EAC7B,QAAQ,EAAE,IAAI,GACf,CAAC","sourcesContent":["import { generateAttributesFromArgs, formatHtml } from '../../utils/utils';\n\nexport default {\n title: 'Components/Filters/JumpFilterRange',\n tags: ['autodocs'],\n argTypes: {\n name: { control: 'text' },\n labelMinBefore: { control: 'text', description: \"Testo prima del valore minimo.\" },\n labelMinAfter: { control: 'text', description: \"Testo dopo il valore minimo (es. €).\" },\n labelMaxBefore: { control: 'text', description: \"Testo prima del valore massimo.\" },\n labelMaxAfter: { control: 'text', description: \"Testo dopo il valore massimo (es. €).\" },\n min: { control: 'number' },\n max: { control: 'number' },\n step: { control: 'number' },\n value: { control: 'object' },\n disabled: { control: 'boolean' },\n },\n};\n\nconst Template = (args) => {\n const { value, ...rest } = args;\n const attributes = generateAttributesFromArgs(rest);\n const valueAttribute = value ? `value='${JSON.stringify(value)}'` : '';\n return formatHtml(`<jump-filter-range ${attributes} ${valueAttribute}></jump-filter-range>`);\n};\n\nexport const Default = Template.bind({});\nDefault.args = {\n name: 'default-range',\n labelMinBefore: 'Min:',\n labelMinAfter: '',\n labelMaxBefore: 'Max:',\n labelMaxAfter: '',\n min: 0,\n max: 100,\n step: 1,\n value: [25, 75],\n disabled: false,\n};\n\n// --- NUOVA STORIA AGGIUNTA ---\nexport const PriceRange = Template.bind({});\nPriceRange.args = {\n name: 'price-filter',\n labelMinBefore: 'Prezzo da',\n labelMinAfter: '€',\n labelMaxBefore: 'a',\n labelMaxAfter: '€',\n min: 0,\n max: 1500,\n step: 10,\n value: [250, 900],\n disabled: false, // Come richiesto, non è disabilitato\n};\n// -----------------------------\n\nexport const Percentage = Template.bind({});\nPercentage.args = {\n name: 'satisfaction-range',\n labelMinBefore: 'Soddisfazione da',\n labelMinAfter: '%',\n labelMaxBefore: 'a',\n labelMaxAfter: '%',\n min: 0,\n max: 100,\n step: 1,\n value: [20, 80],\n};\n\nexport const OnlyValues = Template.bind({});\nOnlyValues.args = {\n name: 'satisfaction-range',\n labelMinBefore: '',\n labelMinAfter: '',\n labelMaxBefore: '',\n labelMaxAfter: '',\n min: 0,\n max: 100,\n step: 1,\n value: [20, 80],\n};\n\nexport const Disabled = Template.bind({});\nDisabled.args = {\n // Usiamo i valori di PriceRange ma in stato disabilitato\n ...PriceRange.args,\n name: 'disabled-price-filter',\n disabled: true,\n};"]}
|
|
@@ -169,7 +169,7 @@ export class JumpFilterSelect {
|
|
|
169
169
|
}
|
|
170
170
|
render() {
|
|
171
171
|
const optionsArray = this.getOptionsArray();
|
|
172
|
-
return (h(Host, { key: '
|
|
172
|
+
return (h(Host, { key: 'b20f199ca8f48e9e3c068605a752a3c0d4e890f7', ref: (host) => (this.host = host) }, this.label && (h("div", { key: '040d2a5c5c97ed1a1fef948d00c260224adcf1da', class: "select-label" }, this.label)), h("sl-select", { key: '79b62f0c01b8a75a9bdd357395896db1c6ed0c1b', value: this.value, placeholder: this.placeholder, disabled: this.disabled, multiple: this.multiple, required: this.required, loading: this.loading, ref: (el) => (this.el = el) }, !this.hasSlottedOptions && optionsArray.map(option => (h("sl-option", { value: option.value }, option.label))), h("slot", { key: '7f4e8595fe45ddbd9d5957e819a06667e819f322' }))));
|
|
173
173
|
}
|
|
174
174
|
static get is() { return "jump-filter-select"; }
|
|
175
175
|
static get encapsulation() { return "shadow"; }
|
|
@@ -138,7 +138,7 @@ export class JumpFilterSwitch {
|
|
|
138
138
|
return this.name;
|
|
139
139
|
}
|
|
140
140
|
render() {
|
|
141
|
-
return (h(Host, { key: '
|
|
141
|
+
return (h(Host, { key: 'f7e5939637497219f44aa6ba22acb4a68937d019', ref: (host) => (this.host = host) }, this.value && this.label && (h("sl-switch", { key: '4025228df5c5b4ef987d8ee70cb613ef9c993d9b', value: this.value, ref: (el) => (this.el = el), checked: this.checked, disabled: this.disabled }, this.label))));
|
|
142
142
|
}
|
|
143
143
|
static get is() { return "jump-filter-switch"; }
|
|
144
144
|
static get encapsulation() { return "shadow"; }
|
|
@@ -126,10 +126,10 @@ export class JumpFiltergroup {
|
|
|
126
126
|
//this.toggleHiddenItems();
|
|
127
127
|
}
|
|
128
128
|
render() {
|
|
129
|
-
return (h(Host, { key: '
|
|
130
|
-
h("jump-button", { key: '
|
|
129
|
+
return (h(Host, { key: 'd48d500b033b0706d566bf2fc288af58647ced44' }, this.heading && h("h5", { key: '61a498d5c8f5f4e619565942fac2f42e35c249b8' }, this.heading), h("div", { key: '8e39330b5c1fdcb1921667831bc2eeb24f503e5c', class: "filterGroup" }, h("slot", { key: '01694d0edb05bf1e4939bd6397f2f9a475f0e0f1', ref: (el) => (this.slotItemsWrapper = el) })), this.inputs.length > this.maxElements &&
|
|
130
|
+
h("jump-button", { key: 'ba5452865b1ff2e5ecb61e481be9e593882b6a13', variant: "primary", size: "small", text: true, name: this.label, "aria-label": this.label, ref: (showMoreBtn) => {
|
|
131
131
|
this.showMoreBtn = showMoreBtn;
|
|
132
|
-
}, onClick: () => this.handleShowMore() }, this.label, h("jump-icon", { key: '
|
|
132
|
+
}, onClick: () => this.handleShowMore() }, this.label, h("jump-icon", { key: '8219159cbd596cc6cefa6b07440fb4c5cdbacd03', slot: "suffix", name: !this.showMore ? 'chevron-down' : 'chevron-up' }))));
|
|
133
133
|
}
|
|
134
134
|
static get is() { return "jump-filtergroup"; }
|
|
135
135
|
static get encapsulation() { return "shadow"; }
|