@empathyco/x-components 3.0.0-alpha.22 → 3.0.0-alpha.23

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/design-system/base.css +4 -1
  3. package/design-system/button-secondary.css +1 -1
  4. package/design-system/default-theme.css +94 -57
  5. package/design-system/dropdown-default.css +68 -33
  6. package/design-system/dropdown-l.css +1 -1
  7. package/design-system/dropdown-m.css +1 -1
  8. package/design-system/dropdown-s.css +1 -1
  9. package/design-system/dropdown-xl.css +1 -1
  10. package/design-system/full-theme.css +1999 -692
  11. package/design-system/list-default.css +2 -15
  12. package/design-system/list-gap.css +61 -1
  13. package/design-system/list-padding.css +52 -1
  14. package/design-system/utilities-background-color.css +7 -7
  15. package/design-system/utilities-border-color.css +7 -7
  16. package/design-system/utilities-border-radius.css +877 -212
  17. package/design-system/utilities-border-width.css +220 -110
  18. package/design-system/utilities-box-shadow.css +11 -11
  19. package/design-system/utilities-font-color.css +7 -14
  20. package/design-system/utilities-margin.css +278 -51
  21. package/design-system/utilities-padding.css +278 -102
  22. package/docs/API-reference/api/x-components.params.md +1 -0
  23. package/docs/API-reference/api/x-components.params.scroll.md +11 -0
  24. package/js/components/base-dropdown.vue.js +2 -2
  25. package/js/components/base-dropdown.vue.js.map +1 -1
  26. package/js/x-modules/url/store/actions/update-url.action.js +20 -2
  27. package/js/x-modules/url/store/actions/update-url.action.js.map +1 -1
  28. package/js/x-modules/url/store/getters/url-params.getter.js +2 -1
  29. package/js/x-modules/url/store/getters/url-params.getter.js.map +1 -1
  30. package/js/x-modules/url/store/module.js +1 -0
  31. package/js/x-modules/url/store/module.js.map +1 -1
  32. package/package.json +2 -2
  33. package/report/x-components.api.json +26 -0
  34. package/report/x-components.api.md +2 -0
  35. package/types/x-modules/url/store/actions/update-url.action.d.ts.map +1 -1
  36. package/types/x-modules/url/store/module.d.ts.map +1 -1
  37. package/types/x-modules/url/store/types.d.ts +1 -0
  38. package/types/x-modules/url/store/types.d.ts.map +1 -1
@@ -1,204 +1,380 @@
1
1
  @use 'sass:string';
2
2
  .x-padding--0 {
3
- padding: 0;
4
- --x-size-padding-utility: 0; }
3
+ padding: 0 !important; }
5
4
 
6
5
  .x-padding--01 {
7
- padding: var(--x-size-base-01);
8
- --x-size-padding-utility: var(--x-size-base-01); }
6
+ padding: var(--x-size-base-01) !important; }
9
7
 
10
8
  .x-padding--02 {
11
- padding: var(--x-size-base-02);
12
- --x-size-padding-utility: var(--x-size-base-02); }
9
+ padding: var(--x-size-base-02) !important; }
13
10
 
14
11
  .x-padding--03 {
15
- padding: var(--x-size-base-03);
16
- --x-size-padding-utility: var(--x-size-base-03); }
12
+ padding: var(--x-size-base-03) !important; }
17
13
 
18
14
  .x-padding--04 {
19
- padding: var(--x-size-base-04);
20
- --x-size-padding-utility: var(--x-size-base-04); }
15
+ padding: var(--x-size-base-04) !important; }
21
16
 
22
17
  .x-padding--05 {
23
- padding: var(--x-size-base-05);
24
- --x-size-padding-utility: var(--x-size-base-05); }
18
+ padding: var(--x-size-base-05) !important; }
25
19
 
26
20
  .x-padding--06 {
27
- padding: var(--x-size-base-06);
28
- --x-size-padding-utility: var(--x-size-base-06); }
21
+ padding: var(--x-size-base-06) !important; }
29
22
 
30
23
  .x-padding--07 {
31
- padding: var(--x-size-base-07);
32
- --x-size-padding-utility: var(--x-size-base-07); }
24
+ padding: var(--x-size-base-07) !important; }
33
25
 
34
26
  .x-padding--08 {
35
- padding: var(--x-size-base-08);
36
- --x-size-padding-utility: var(--x-size-base-08); }
27
+ padding: var(--x-size-base-08) !important; }
37
28
 
38
29
  .x-padding--09 {
39
- padding: var(--x-size-base-09);
40
- --x-size-padding-utility: var(--x-size-base-09); }
30
+ padding: var(--x-size-base-09) !important; }
41
31
 
42
32
  .x-padding--10 {
43
- padding: var(--x-size-base-10);
44
- --x-size-padding-utility: var(--x-size-base-10); }
33
+ padding: var(--x-size-base-10) !important; }
34
+
35
+ .x-padding--11 {
36
+ padding: var(--x-size-base-11) !important; }
37
+
38
+ .x-padding--12 {
39
+ padding: var(--x-size-base-12) !important; }
40
+
41
+ .x-padding--13 {
42
+ padding: var(--x-size-base-13) !important; }
45
43
 
46
44
  .x-padding--top-01 {
47
- padding-top: var(--x-size-base-01);
48
- --x-size-padding-top-utility: var(--x-size-base-01); }
45
+ -webkit-padding-before: var(--x-size-base-01) !important;
46
+ padding-top: var(--x-size-base-01) !important; }
49
47
 
50
48
  .x-padding--bottom-01 {
51
- padding-bottom: var(--x-size-base-01);
52
- --x-size-padding-bottom-utility: var(--x-size-base-01); }
49
+ -webkit-padding-after: var(--x-size-base-01) !important;
50
+ padding-bottom: var(--x-size-base-01) !important; }
51
+
52
+ [dir="ltr"] .x-padding--right-01{
53
+ padding-right: var(--x-size-base-01) !important; }
54
+
55
+ [dir="rtl"] .x-padding--right-01{
56
+ padding-left: var(--x-size-base-01) !important; }
53
57
 
54
58
  .x-padding--right-01 {
55
- padding-right: var(--x-size-base-01);
56
- --x-size-padding-right-utility: var(--x-size-base-01); }
59
+ -webkit-padding-end: var(--x-size-base-01) !important; }
60
+
61
+ [dir="ltr"] .x-padding--left-01{
62
+ padding-left: var(--x-size-base-01) !important; }
63
+
64
+ [dir="rtl"] .x-padding--left-01{
65
+ padding-right: var(--x-size-base-01) !important; }
57
66
 
58
67
  .x-padding--left-01 {
59
- padding-left: var(--x-size-base-01);
60
- --x-size-padding-left-utility: var(--x-size-base-01); }
68
+ -webkit-padding-start: var(--x-size-base-01) !important; }
61
69
 
62
70
  .x-padding--top-02 {
63
- padding-top: var(--x-size-base-02);
64
- --x-size-padding-top-utility: var(--x-size-base-02); }
71
+ -webkit-padding-before: var(--x-size-base-02) !important;
72
+ padding-top: var(--x-size-base-02) !important; }
65
73
 
66
74
  .x-padding--bottom-02 {
67
- padding-bottom: var(--x-size-base-02);
68
- --x-size-padding-bottom-utility: var(--x-size-base-02); }
75
+ -webkit-padding-after: var(--x-size-base-02) !important;
76
+ padding-bottom: var(--x-size-base-02) !important; }
77
+
78
+ [dir="ltr"] .x-padding--right-02{
79
+ padding-right: var(--x-size-base-02) !important; }
80
+
81
+ [dir="rtl"] .x-padding--right-02{
82
+ padding-left: var(--x-size-base-02) !important; }
69
83
 
70
84
  .x-padding--right-02 {
71
- padding-right: var(--x-size-base-02);
72
- --x-size-padding-right-utility: var(--x-size-base-02); }
85
+ -webkit-padding-end: var(--x-size-base-02) !important; }
86
+
87
+ [dir="ltr"] .x-padding--left-02{
88
+ padding-left: var(--x-size-base-02) !important; }
89
+
90
+ [dir="rtl"] .x-padding--left-02{
91
+ padding-right: var(--x-size-base-02) !important; }
73
92
 
74
93
  .x-padding--left-02 {
75
- padding-left: var(--x-size-base-02);
76
- --x-size-padding-left-utility: var(--x-size-base-02); }
94
+ -webkit-padding-start: var(--x-size-base-02) !important; }
77
95
 
78
96
  .x-padding--top-03 {
79
- padding-top: var(--x-size-base-03);
80
- --x-size-padding-top-utility: var(--x-size-base-03); }
97
+ -webkit-padding-before: var(--x-size-base-03) !important;
98
+ padding-top: var(--x-size-base-03) !important; }
81
99
 
82
100
  .x-padding--bottom-03 {
83
- padding-bottom: var(--x-size-base-03);
84
- --x-size-padding-bottom-utility: var(--x-size-base-03); }
101
+ -webkit-padding-after: var(--x-size-base-03) !important;
102
+ padding-bottom: var(--x-size-base-03) !important; }
103
+
104
+ [dir="ltr"] .x-padding--right-03{
105
+ padding-right: var(--x-size-base-03) !important; }
106
+
107
+ [dir="rtl"] .x-padding--right-03{
108
+ padding-left: var(--x-size-base-03) !important; }
85
109
 
86
110
  .x-padding--right-03 {
87
- padding-right: var(--x-size-base-03);
88
- --x-size-padding-right-utility: var(--x-size-base-03); }
111
+ -webkit-padding-end: var(--x-size-base-03) !important; }
112
+
113
+ [dir="ltr"] .x-padding--left-03{
114
+ padding-left: var(--x-size-base-03) !important; }
115
+
116
+ [dir="rtl"] .x-padding--left-03{
117
+ padding-right: var(--x-size-base-03) !important; }
89
118
 
90
119
  .x-padding--left-03 {
91
- padding-left: var(--x-size-base-03);
92
- --x-size-padding-left-utility: var(--x-size-base-03); }
120
+ -webkit-padding-start: var(--x-size-base-03) !important; }
93
121
 
94
122
  .x-padding--top-04 {
95
- padding-top: var(--x-size-base-04);
96
- --x-size-padding-top-utility: var(--x-size-base-04); }
123
+ -webkit-padding-before: var(--x-size-base-04) !important;
124
+ padding-top: var(--x-size-base-04) !important; }
97
125
 
98
126
  .x-padding--bottom-04 {
99
- padding-bottom: var(--x-size-base-04);
100
- --x-size-padding-bottom-utility: var(--x-size-base-04); }
127
+ -webkit-padding-after: var(--x-size-base-04) !important;
128
+ padding-bottom: var(--x-size-base-04) !important; }
129
+
130
+ [dir="ltr"] .x-padding--right-04{
131
+ padding-right: var(--x-size-base-04) !important; }
132
+
133
+ [dir="rtl"] .x-padding--right-04{
134
+ padding-left: var(--x-size-base-04) !important; }
101
135
 
102
136
  .x-padding--right-04 {
103
- padding-right: var(--x-size-base-04);
104
- --x-size-padding-right-utility: var(--x-size-base-04); }
137
+ -webkit-padding-end: var(--x-size-base-04) !important; }
138
+
139
+ [dir="ltr"] .x-padding--left-04{
140
+ padding-left: var(--x-size-base-04) !important; }
141
+
142
+ [dir="rtl"] .x-padding--left-04{
143
+ padding-right: var(--x-size-base-04) !important; }
105
144
 
106
145
  .x-padding--left-04 {
107
- padding-left: var(--x-size-base-04);
108
- --x-size-padding-left-utility: var(--x-size-base-04); }
146
+ -webkit-padding-start: var(--x-size-base-04) !important; }
109
147
 
110
148
  .x-padding--top-05 {
111
- padding-top: var(--x-size-base-05);
112
- --x-size-padding-top-utility: var(--x-size-base-05); }
149
+ -webkit-padding-before: var(--x-size-base-05) !important;
150
+ padding-top: var(--x-size-base-05) !important; }
113
151
 
114
152
  .x-padding--bottom-05 {
115
- padding-bottom: var(--x-size-base-05);
116
- --x-size-padding-bottom-utility: var(--x-size-base-05); }
153
+ -webkit-padding-after: var(--x-size-base-05) !important;
154
+ padding-bottom: var(--x-size-base-05) !important; }
155
+
156
+ [dir="ltr"] .x-padding--right-05{
157
+ padding-right: var(--x-size-base-05) !important; }
158
+
159
+ [dir="rtl"] .x-padding--right-05{
160
+ padding-left: var(--x-size-base-05) !important; }
117
161
 
118
162
  .x-padding--right-05 {
119
- padding-right: var(--x-size-base-05);
120
- --x-size-padding-right-utility: var(--x-size-base-05); }
163
+ -webkit-padding-end: var(--x-size-base-05) !important; }
164
+
165
+ [dir="ltr"] .x-padding--left-05{
166
+ padding-left: var(--x-size-base-05) !important; }
167
+
168
+ [dir="rtl"] .x-padding--left-05{
169
+ padding-right: var(--x-size-base-05) !important; }
121
170
 
122
171
  .x-padding--left-05 {
123
- padding-left: var(--x-size-base-05);
124
- --x-size-padding-left-utility: var(--x-size-base-05); }
172
+ -webkit-padding-start: var(--x-size-base-05) !important; }
125
173
 
126
174
  .x-padding--top-06 {
127
- padding-top: var(--x-size-base-06);
128
- --x-size-padding-top-utility: var(--x-size-base-06); }
175
+ -webkit-padding-before: var(--x-size-base-06) !important;
176
+ padding-top: var(--x-size-base-06) !important; }
129
177
 
130
178
  .x-padding--bottom-06 {
131
- padding-bottom: var(--x-size-base-06);
132
- --x-size-padding-bottom-utility: var(--x-size-base-06); }
179
+ -webkit-padding-after: var(--x-size-base-06) !important;
180
+ padding-bottom: var(--x-size-base-06) !important; }
181
+
182
+ [dir="ltr"] .x-padding--right-06{
183
+ padding-right: var(--x-size-base-06) !important; }
184
+
185
+ [dir="rtl"] .x-padding--right-06{
186
+ padding-left: var(--x-size-base-06) !important; }
133
187
 
134
188
  .x-padding--right-06 {
135
- padding-right: var(--x-size-base-06);
136
- --x-size-padding-right-utility: var(--x-size-base-06); }
189
+ -webkit-padding-end: var(--x-size-base-06) !important; }
190
+
191
+ [dir="ltr"] .x-padding--left-06{
192
+ padding-left: var(--x-size-base-06) !important; }
193
+
194
+ [dir="rtl"] .x-padding--left-06{
195
+ padding-right: var(--x-size-base-06) !important; }
137
196
 
138
197
  .x-padding--left-06 {
139
- padding-left: var(--x-size-base-06);
140
- --x-size-padding-left-utility: var(--x-size-base-06); }
198
+ -webkit-padding-start: var(--x-size-base-06) !important; }
141
199
 
142
200
  .x-padding--top-07 {
143
- padding-top: var(--x-size-base-07);
144
- --x-size-padding-top-utility: var(--x-size-base-07); }
201
+ -webkit-padding-before: var(--x-size-base-07) !important;
202
+ padding-top: var(--x-size-base-07) !important; }
145
203
 
146
204
  .x-padding--bottom-07 {
147
- padding-bottom: var(--x-size-base-07);
148
- --x-size-padding-bottom-utility: var(--x-size-base-07); }
205
+ -webkit-padding-after: var(--x-size-base-07) !important;
206
+ padding-bottom: var(--x-size-base-07) !important; }
207
+
208
+ [dir="ltr"] .x-padding--right-07{
209
+ padding-right: var(--x-size-base-07) !important; }
210
+
211
+ [dir="rtl"] .x-padding--right-07{
212
+ padding-left: var(--x-size-base-07) !important; }
149
213
 
150
214
  .x-padding--right-07 {
151
- padding-right: var(--x-size-base-07);
152
- --x-size-padding-right-utility: var(--x-size-base-07); }
215
+ -webkit-padding-end: var(--x-size-base-07) !important; }
216
+
217
+ [dir="ltr"] .x-padding--left-07{
218
+ padding-left: var(--x-size-base-07) !important; }
219
+
220
+ [dir="rtl"] .x-padding--left-07{
221
+ padding-right: var(--x-size-base-07) !important; }
153
222
 
154
223
  .x-padding--left-07 {
155
- padding-left: var(--x-size-base-07);
156
- --x-size-padding-left-utility: var(--x-size-base-07); }
224
+ -webkit-padding-start: var(--x-size-base-07) !important; }
157
225
 
158
226
  .x-padding--top-08 {
159
- padding-top: var(--x-size-base-08);
160
- --x-size-padding-top-utility: var(--x-size-base-08); }
227
+ -webkit-padding-before: var(--x-size-base-08) !important;
228
+ padding-top: var(--x-size-base-08) !important; }
161
229
 
162
230
  .x-padding--bottom-08 {
163
- padding-bottom: var(--x-size-base-08);
164
- --x-size-padding-bottom-utility: var(--x-size-base-08); }
231
+ -webkit-padding-after: var(--x-size-base-08) !important;
232
+ padding-bottom: var(--x-size-base-08) !important; }
233
+
234
+ [dir="ltr"] .x-padding--right-08{
235
+ padding-right: var(--x-size-base-08) !important; }
236
+
237
+ [dir="rtl"] .x-padding--right-08{
238
+ padding-left: var(--x-size-base-08) !important; }
165
239
 
166
240
  .x-padding--right-08 {
167
- padding-right: var(--x-size-base-08);
168
- --x-size-padding-right-utility: var(--x-size-base-08); }
241
+ -webkit-padding-end: var(--x-size-base-08) !important; }
242
+
243
+ [dir="ltr"] .x-padding--left-08{
244
+ padding-left: var(--x-size-base-08) !important; }
245
+
246
+ [dir="rtl"] .x-padding--left-08{
247
+ padding-right: var(--x-size-base-08) !important; }
169
248
 
170
249
  .x-padding--left-08 {
171
- padding-left: var(--x-size-base-08);
172
- --x-size-padding-left-utility: var(--x-size-base-08); }
250
+ -webkit-padding-start: var(--x-size-base-08) !important; }
173
251
 
174
252
  .x-padding--top-09 {
175
- padding-top: var(--x-size-base-09);
176
- --x-size-padding-top-utility: var(--x-size-base-09); }
253
+ -webkit-padding-before: var(--x-size-base-09) !important;
254
+ padding-top: var(--x-size-base-09) !important; }
177
255
 
178
256
  .x-padding--bottom-09 {
179
- padding-bottom: var(--x-size-base-09);
180
- --x-size-padding-bottom-utility: var(--x-size-base-09); }
257
+ -webkit-padding-after: var(--x-size-base-09) !important;
258
+ padding-bottom: var(--x-size-base-09) !important; }
259
+
260
+ [dir="ltr"] .x-padding--right-09{
261
+ padding-right: var(--x-size-base-09) !important; }
262
+
263
+ [dir="rtl"] .x-padding--right-09{
264
+ padding-left: var(--x-size-base-09) !important; }
181
265
 
182
266
  .x-padding--right-09 {
183
- padding-right: var(--x-size-base-09);
184
- --x-size-padding-right-utility: var(--x-size-base-09); }
267
+ -webkit-padding-end: var(--x-size-base-09) !important; }
268
+
269
+ [dir="ltr"] .x-padding--left-09{
270
+ padding-left: var(--x-size-base-09) !important; }
271
+
272
+ [dir="rtl"] .x-padding--left-09{
273
+ padding-right: var(--x-size-base-09) !important; }
185
274
 
186
275
  .x-padding--left-09 {
187
- padding-left: var(--x-size-base-09);
188
- --x-size-padding-left-utility: var(--x-size-base-09); }
276
+ -webkit-padding-start: var(--x-size-base-09) !important; }
189
277
 
190
278
  .x-padding--top-10 {
191
- padding-top: var(--x-size-base-10);
192
- --x-size-padding-top-utility: var(--x-size-base-10); }
279
+ -webkit-padding-before: var(--x-size-base-10) !important;
280
+ padding-top: var(--x-size-base-10) !important; }
193
281
 
194
282
  .x-padding--bottom-10 {
195
- padding-bottom: var(--x-size-base-10);
196
- --x-size-padding-bottom-utility: var(--x-size-base-10); }
283
+ -webkit-padding-after: var(--x-size-base-10) !important;
284
+ padding-bottom: var(--x-size-base-10) !important; }
285
+
286
+ [dir="ltr"] .x-padding--right-10{
287
+ padding-right: var(--x-size-base-10) !important; }
288
+
289
+ [dir="rtl"] .x-padding--right-10{
290
+ padding-left: var(--x-size-base-10) !important; }
197
291
 
198
292
  .x-padding--right-10 {
199
- padding-right: var(--x-size-base-10);
200
- --x-size-padding-right-utility: var(--x-size-base-10); }
293
+ -webkit-padding-end: var(--x-size-base-10) !important; }
294
+
295
+ [dir="ltr"] .x-padding--left-10{
296
+ padding-left: var(--x-size-base-10) !important; }
297
+
298
+ [dir="rtl"] .x-padding--left-10{
299
+ padding-right: var(--x-size-base-10) !important; }
201
300
 
202
301
  .x-padding--left-10 {
203
- padding-left: var(--x-size-base-10);
204
- --x-size-padding-left-utility: var(--x-size-base-10); }
302
+ -webkit-padding-start: var(--x-size-base-10) !important; }
303
+
304
+ .x-padding--top-11 {
305
+ -webkit-padding-before: var(--x-size-base-11) !important;
306
+ padding-top: var(--x-size-base-11) !important; }
307
+
308
+ .x-padding--bottom-11 {
309
+ -webkit-padding-after: var(--x-size-base-11) !important;
310
+ padding-bottom: var(--x-size-base-11) !important; }
311
+
312
+ [dir="ltr"] .x-padding--right-11{
313
+ padding-right: var(--x-size-base-11) !important; }
314
+
315
+ [dir="rtl"] .x-padding--right-11{
316
+ padding-left: var(--x-size-base-11) !important; }
317
+
318
+ .x-padding--right-11 {
319
+ -webkit-padding-end: var(--x-size-base-11) !important; }
320
+
321
+ [dir="ltr"] .x-padding--left-11{
322
+ padding-left: var(--x-size-base-11) !important; }
323
+
324
+ [dir="rtl"] .x-padding--left-11{
325
+ padding-right: var(--x-size-base-11) !important; }
326
+
327
+ .x-padding--left-11 {
328
+ -webkit-padding-start: var(--x-size-base-11) !important; }
329
+
330
+ .x-padding--top-12 {
331
+ -webkit-padding-before: var(--x-size-base-12) !important;
332
+ padding-top: var(--x-size-base-12) !important; }
333
+
334
+ .x-padding--bottom-12 {
335
+ -webkit-padding-after: var(--x-size-base-12) !important;
336
+ padding-bottom: var(--x-size-base-12) !important; }
337
+
338
+ [dir="ltr"] .x-padding--right-12{
339
+ padding-right: var(--x-size-base-12) !important; }
340
+
341
+ [dir="rtl"] .x-padding--right-12{
342
+ padding-left: var(--x-size-base-12) !important; }
343
+
344
+ .x-padding--right-12 {
345
+ -webkit-padding-end: var(--x-size-base-12) !important; }
346
+
347
+ [dir="ltr"] .x-padding--left-12{
348
+ padding-left: var(--x-size-base-12) !important; }
349
+
350
+ [dir="rtl"] .x-padding--left-12{
351
+ padding-right: var(--x-size-base-12) !important; }
352
+
353
+ .x-padding--left-12 {
354
+ -webkit-padding-start: var(--x-size-base-12) !important; }
355
+
356
+ .x-padding--top-13 {
357
+ -webkit-padding-before: var(--x-size-base-13) !important;
358
+ padding-top: var(--x-size-base-13) !important; }
359
+
360
+ .x-padding--bottom-13 {
361
+ -webkit-padding-after: var(--x-size-base-13) !important;
362
+ padding-bottom: var(--x-size-base-13) !important; }
363
+
364
+ [dir="ltr"] .x-padding--right-13{
365
+ padding-right: var(--x-size-base-13) !important; }
366
+
367
+ [dir="rtl"] .x-padding--right-13{
368
+ padding-left: var(--x-size-base-13) !important; }
369
+
370
+ .x-padding--right-13 {
371
+ -webkit-padding-end: var(--x-size-base-13) !important; }
372
+
373
+ [dir="ltr"] .x-padding--left-13{
374
+ padding-left: var(--x-size-base-13) !important; }
375
+
376
+ [dir="rtl"] .x-padding--left-13{
377
+ padding-right: var(--x-size-base-13) !important; }
378
+
379
+ .x-padding--left-13 {
380
+ -webkit-padding-start: var(--x-size-base-13) !important; }
@@ -20,5 +20,6 @@ export interface Params
20
20
  | [page](./x-components.params.page.md) | number | |
21
21
  | [query](./x-components.params.query.md) | string | |
22
22
  | [relatedTags](./x-components.params.relatedtags.md) | string\[\] | |
23
+ | [scroll](./x-components.params.scroll.md) | number | |
23
24
  | [sort](./x-components.params.sort.md) | string | |
24
25
 
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [Params](./x-components.params.md) &gt; [scroll](./x-components.params.scroll.md)
4
+
5
+ ## Params.scroll property
6
+
7
+ <b>Signature:</b>
8
+
9
+ ```typescript
10
+ scroll: number;
11
+ ```
@@ -193,11 +193,11 @@ __vue_render__._withStripped = true;
193
193
  /* style */
194
194
  var __vue_inject_styles__ = function (inject) {
195
195
  if (!inject) { return }
196
- inject("data-v-6fde3ef0_0", { source: ".x-dropdown[data-v-6fde3ef0] {\n position: relative;\n}\n.x-dropdown__items-list[data-v-6fde3ef0] {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n left: 0;\n top: 100%;\n}", map: undefined, media: undefined });
196
+ inject("data-v-1046e888_0", { source: ".x-dropdown[data-v-1046e888] {\n position: relative;\n}\n.x-dropdown__items-list[data-v-1046e888] {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n top: calc(100% + var(--x-size-gap-dropdown-default, 0));\n}", map: undefined, media: undefined });
197
197
 
198
198
  };
199
199
  /* scoped */
200
- var __vue_scope_id__ = "data-v-6fde3ef0";
200
+ var __vue_scope_id__ = "data-v-1046e888";
201
201
  /* module identifier */
202
202
  var __vue_module_identifier__ = undefined;
203
203
  /* functional template */
@@ -1 +1 @@
1
- {"version":3,"file":"base-dropdown.vue.js","sources":["../../../src/components/base-dropdown.vue"],"sourcesContent":["<template>\n <div\n @keydown=\"updateSearchBuffer\"\n @keydown.down.prevent=\"highlightNextItem\"\n @keydown.up.prevent=\"highlightPreviousItem\"\n :class=\"dropdownCSSClasses\"\n class=\"x-dropdown\"\n >\n <button\n @click=\"toggle\"\n @keydown.up.down.prevent.stop=\"open\"\n aria-haspopup=\"listbox\"\n class=\"x-dropdown__toggle\"\n data-test=\"dropdown-toggle\"\n >\n <!--\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {string|number|Identifiable} item - The item data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n -->\n <slot v-if=\"$scopedSlots.toggle\" :isOpen=\"isOpen\" :item=\"value\" name=\"toggle\" />\n <slot v-else :item=\"value\" name=\"item\" />\n </button>\n\n <component :is=\"animation\">\n <ul\n v-if=\"isOpen\"\n @keydown.end=\"highlightLastItem\"\n @keydown.esc=\"close\"\n @keydown.home=\"highlightFirstItem\"\n :aria-expanded=\"isOpen.toString()\"\n class=\"x-dropdown__items-list\"\n role=\"listbox\"\n >\n <li v-for=\"(item, index) in items\" :key=\"item.id || item\" class=\"x-dropdown__list-item\">\n <button\n ref=\"itemButtons\"\n @click=\"emitSelectedItemChanged(item)\"\n :aria-selected=\"(index === highlightedItemIndex).toString()\"\n :aria-current=\"(item === value).toString()\"\n :class=\"itemsCSSClasses[index]\"\n class=\"x-dropdown__item\"\n data-test=\"dropdown-item\"\n role=\"option\"\n tabindex=\"-1\"\n >\n <!--\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {string|number|Identifiable} item - Item to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n -->\n <slot\n :isHighlighted=\"index === highlightedItemIndex\"\n :isSelected=\"item === value\"\n :item=\"item\"\n name=\"item\"\n />\n </button>\n </li>\n </ul>\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Identifiable } from '@empathyco/x-types';\n import { Component, Prop, Watch } from 'vue-property-decorator';\n import Vue from 'vue';\n import { normalizeString } from '../utils/normalize';\n import { isInRange } from '../utils/number';\n import { debounce } from '../utils/debounce';\n import { VueCSSClasses } from '../utils/types';\n import { NoElement } from './no-element';\n\n type DropdownItem = string | number | Identifiable;\n\n /**\n * Dropdown component that mimics a Select element behavior, but with the option\n * to customize the toggle button and each item contents.\n *\n * @public\n */\n @Component({\n components: {\n NoElement\n },\n model: {\n event: 'change'\n }\n })\n export default class BaseDropdown extends Vue {\n /**\n * List of items to display.\n *\n * @public\n */\n @Prop({ required: true })\n public items!: DropdownItem[];\n\n /**\n * The selected item.\n *\n * @public\n */\n @Prop({ required: true })\n public value!: DropdownItem | null;\n\n /**\n * Animation component to use for expanding the dropdown. This is a single element animation,\n * so only `<transition>` components are allowed.\n *\n * @public\n */\n @Prop({ default: 'NoElement' })\n public animation!: typeof Vue | string;\n\n /**\n * Time to wait without receiving any keystroke before resetting the items search query.\n *\n * @public\n */\n @Prop({ default: 1000 })\n public searchTimeoutMs!: number;\n\n public $refs!: {\n /** Array containing the dropdown list buttons HTMLElements. */\n itemButtons: HTMLButtonElement[];\n };\n\n /**\n * Property to track whether the dropdown is expanded and displaying the full\n * list of items, or closed.\n *\n * @internal\n */\n protected isOpen = false;\n\n /**\n * Index of the element that has the focus in the list. -1 means no element has focus.\n *\n * @internal\n */\n protected highlightedItemIndex = -1;\n\n /**\n * String to search for the first element that starts with it.\n *\n * @internal\n */\n protected searchBuffer = '';\n\n /**\n * Resets the search buffer after a certain time has passed.\n *\n * @internal\n */\n protected restartResetSearchTimeout!: () => void;\n\n /**\n * Dynamic CSS classes to add to the dropdown root element.\n *\n * @returns An object containing the CSS classes to add to the dropdown root element.\n * @internal\n */\n protected get dropdownCSSClasses(): VueCSSClasses {\n return {\n 'x-dropdown--is-open': this.isOpen\n };\n }\n\n /**\n * Dynamic CSS classes to add to each one of the items.\n *\n * @returns An object containing the CSS classes to add to each item.\n * @internal\n */\n protected get itemsCSSClasses(): VueCSSClasses[] {\n return this.items.map((item, index) => {\n return {\n 'x-dropdown__item--is-selected': this.value === item,\n 'x-dropdown__item--is-highlighted': this.highlightedItemIndex === index\n };\n });\n }\n\n /**\n * If the dropdown is destroyed before removing the document listeners, it ensures that they\n * are removed too.\n *\n * @internal\n */\n protected beforeDestroy(): void {\n this.removeDocumentCloseListeners();\n }\n\n /**\n * Opens the dropdown.\n *\n * @internal\n */\n protected open(): void {\n this.isOpen = true;\n }\n\n /**\n * Closes the dropdown.\n *\n * @internal\n */\n protected close(): void {\n this.isOpen = false;\n }\n\n /**\n * If the dropdown is opened it closes it. If it is closed it opens it.\n *\n * @internal\n */\n protected toggle(): void {\n this.isOpen = !this.isOpen;\n }\n\n /**\n * Emits the event that the selected item has changed.\n *\n * @param item - The new selected item.\n * @internal\n */\n protected emitSelectedItemChanged(item: DropdownItem): void {\n this.$emit('change', item);\n this.close();\n }\n\n /**\n * Highlights the item after the one that is currently highlighted.\n *\n * @internal\n */\n protected highlightNextItem(): void {\n this.open();\n this.highlightedItemIndex = (this.highlightedItemIndex + 1) % this.items.length;\n }\n\n /**\n * Highlights the item before the one that is currently highlighted.\n *\n * @internal\n */\n protected highlightPreviousItem(): void {\n this.open();\n this.highlightedItemIndex =\n this.highlightedItemIndex > 0 ? this.highlightedItemIndex - 1 : this.items.length - 1;\n }\n\n /**\n * Highlights the first of the provided items.\n *\n * @internal\n */\n protected highlightFirstItem(): void {\n this.highlightedItemIndex = 0;\n }\n\n /**\n * Highlights the last of the provided items.\n *\n * @internal\n */\n protected highlightLastItem(): void {\n this.highlightedItemIndex = this.items.length - 1;\n }\n\n /**\n * Updates the variable that is used to search in the filters.\n *\n * @param event - The event coming from the user typing.\n * @internal\n */\n protected updateSearchBuffer(event: KeyboardEvent): void {\n if (/^\\w$/.test(event.key)) {\n const key = event.key;\n this.searchBuffer += key;\n this.restartResetSearchTimeout();\n }\n }\n\n /**\n * Highlights the item that matches the search buffer. To do so it checks the list buttons\n * text content. It highlights items folowing this priority:\n * - If an element is already highlighted, it starts searching from that element.\n * - If no element is found starting from the previously highlighted, it returns the first one.\n * - If no element is found matching the search query it highlights the first element.\n *\n * @param search - The search string to find in the HTML.\n * @internal\n */\n @Watch('searchBuffer')\n protected highlightMatchingItem(search: string): void {\n if (search) {\n const normalizedSearch = normalizeString(search);\n const matchingIndices = this.$refs.itemButtons.reduce<number[]>(\n (matchingIndices, button, index) => {\n const safeButtonWordCharacters = button.textContent!.replace(/[^\\w]/g, '');\n const normalizedButtonText = normalizeString(safeButtonWordCharacters);\n if (normalizedButtonText.startsWith(normalizedSearch)) {\n matchingIndices.push(index);\n }\n return matchingIndices;\n },\n []\n );\n this.highlightedItemIndex =\n // First matching item starting to search from the current highlighted element\n matchingIndices.find(index => index >= this.highlightedItemIndex) ??\n // First matching item\n matchingIndices[0] ??\n // First item\n 0;\n }\n }\n\n /**\n * Resets the search buffer.\n *\n * @internal\n */\n protected resetSearch(): void {\n this.searchBuffer = '';\n }\n\n /** Updates the debounced function to reset the search.\n *\n * @param searchTimeoutMs - The new milliseconds that have to pass without typing before\n * resetting the search.\n * @internal\n */\n @Watch('searchTimeoutMs', { immediate: true })\n protected updateSearchTimeout(searchTimeoutMs: number): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.restartResetSearchTimeout = debounce(this.resetSearch, searchTimeoutMs);\n }\n\n /**\n * Focuses the DOM element which matches the `highlightedItemIndex`.\n *\n * @param highlightedItemIndex - The index of the HTML element to focus.\n * @internal\n */\n @Watch('highlightedItemIndex', { immediate: true })\n protected focusHighlightedItem(highlightedItemIndex: number): void {\n this.$nextTick(() => {\n if (this.$refs.itemButtons && isInRange(highlightedItemIndex, [0, this.items.length - 1])) {\n const newItem = this.$refs.itemButtons[this.highlightedItemIndex];\n newItem.focus();\n }\n });\n }\n\n /**\n * When the dropdown is open it sets the focused element to the one that is selected.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n * @internal\n */\n @Watch('isOpen')\n protected updateHighlightedItem(isOpen: boolean): void {\n if (isOpen) {\n this.highlightedItemIndex = this.value === null ? 0 : this.items.indexOf(this.value);\n } else {\n this.highlightedItemIndex = -1;\n }\n }\n\n /**\n * Adds and removes listeners to close the dropdown when it loses the focus.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n * @internal\n */\n @Watch('isOpen')\n protected syncCloseListeners(isOpen: boolean): void {\n /*\n * Because there is an issue with Firefox in macOS and Safari that doesn't focus the target\n * element of the `mousedown` events, the `focusout` event `relatedTarget` property can't be\n * used to detect whether or not the user has blurred the dropdown. The hack here is to use\n * document listeners that have the side effect of losing the focus.\n */\n if (isOpen) {\n this.addDocumentCloseListeners();\n } else {\n this.removeDocumentCloseListeners();\n }\n }\n\n /**\n * Adds listeners to the document element to detect if the focus has moved out from the\n * dropdown.\n *\n * @internal\n */\n protected addDocumentCloseListeners(): void {\n /* eslint-disable @typescript-eslint/unbound-method */\n document.addEventListener('mousedown', this.closeIfEventIsOutOfDropdown);\n document.addEventListener('touchstart', this.closeIfEventIsOutOfDropdown);\n document.addEventListener('focusin', this.closeIfEventIsOutOfDropdown);\n /* eslint-enable @typescript-eslint/unbound-method */\n }\n\n /**\n * Removes the listeners of the document element to detect if the focus has moved out from the\n * dropdown.\n *\n * @internal\n */\n protected removeDocumentCloseListeners(): void {\n /* eslint-disable @typescript-eslint/unbound-method */\n document.removeEventListener('mousedown', this.closeIfEventIsOutOfDropdown);\n document.removeEventListener('touchstart', this.closeIfEventIsOutOfDropdown);\n document.removeEventListener('focusin', this.closeIfEventIsOutOfDropdown);\n /* eslint-enable @typescript-eslint/unbound-method */\n }\n\n /**\n * Closes the dropdown if the passed event has happened on an element out of the dropdown.\n *\n * @param event - The event to check if it has happen out of the dropdown component.\n */\n protected closeIfEventIsOutOfDropdown(event: MouseEvent | TouchEvent | FocusEvent): void {\n if (!this.$el.contains(event.target as HTMLElement)) {\n this.close();\n }\n }\n }\n</script>\n\n<style lang=\"scss\" scoped>\n .x-dropdown {\n position: relative;\n\n &__items-list {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n left: 0;\n top: 100%;\n }\n }\n</style>\n\n<docs lang=\"mdx\">\n# Example\n\nThe `Dropdown` component is a simple yet customizable select component. The component needs to work\nthe list of items available to select, which are passed using the `items` prop, and the selected\nitem, which is passed in using the `value` prop.\n\nThe supported items must be an array that can contain unique strings, unique numbers, or objects\nwith a unique `id` property.\n\nThe content of each item can be customized using the `item` slot, which apart from the data of the\nitem, it also receives via prop if the element is selected or highlighted.\n\nThere `toggle` slot can be used to customize the button that opens the dropdown. If this is not\nprovided, the `item` slot will be used for that.\n\n```vue\n<template>\n <BaseDropdown :items=\"items\" v-model=\"value\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}️</template>\n\n <template #item=\"{ item, isSelected, isHighlighted }\">\n <span v-if=\"isHighlighted\">🟢</span>\n <span v-if=\"isSelected\">✅</span>\n <span>{{ item }}</span>\n </template>\n </BaseDropdown>\n</template>\n\n<script>\n import { BaseDropdown } from '@empathyco/x-components';\n\n export default {\n name: 'DropdownTest',\n components: {\n BaseDropdown\n },\n data() {\n return {\n items: ['a', 2, { id: '3' }],\n value: ['a']\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["const"],"mappings":";;;;;AAEAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-dropdown.vue.js","sources":["../../../src/components/base-dropdown.vue"],"sourcesContent":["<template>\n <div\n @keydown=\"updateSearchBuffer\"\n @keydown.down.prevent=\"highlightNextItem\"\n @keydown.up.prevent=\"highlightPreviousItem\"\n :class=\"dropdownCSSClasses\"\n class=\"x-dropdown\"\n >\n <button\n @click=\"toggle\"\n @keydown.up.down.prevent.stop=\"open\"\n aria-haspopup=\"listbox\"\n class=\"x-dropdown__toggle\"\n data-test=\"dropdown-toggle\"\n >\n <!--\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {string|number|Identifiable} item - The item data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n -->\n <slot v-if=\"$scopedSlots.toggle\" :isOpen=\"isOpen\" :item=\"value\" name=\"toggle\" />\n <slot v-else :item=\"value\" name=\"item\" />\n </button>\n\n <component :is=\"animation\">\n <ul\n v-if=\"isOpen\"\n @keydown.end=\"highlightLastItem\"\n @keydown.esc=\"close\"\n @keydown.home=\"highlightFirstItem\"\n :aria-expanded=\"isOpen.toString()\"\n class=\"x-dropdown__items-list\"\n role=\"listbox\"\n >\n <li v-for=\"(item, index) in items\" :key=\"item.id || item\" class=\"x-dropdown__list-item\">\n <button\n ref=\"itemButtons\"\n @click=\"emitSelectedItemChanged(item)\"\n :aria-selected=\"(index === highlightedItemIndex).toString()\"\n :aria-current=\"(item === value).toString()\"\n :class=\"itemsCSSClasses[index]\"\n class=\"x-dropdown__item\"\n data-test=\"dropdown-item\"\n role=\"option\"\n tabindex=\"-1\"\n >\n <!--\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {string|number|Identifiable} item - Item to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n -->\n <slot\n :isHighlighted=\"index === highlightedItemIndex\"\n :isSelected=\"item === value\"\n :item=\"item\"\n name=\"item\"\n />\n </button>\n </li>\n </ul>\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Identifiable } from '@empathyco/x-types';\n import { Component, Prop, Watch } from 'vue-property-decorator';\n import Vue from 'vue';\n import { normalizeString } from '../utils/normalize';\n import { isInRange } from '../utils/number';\n import { debounce } from '../utils/debounce';\n import { VueCSSClasses } from '../utils/types';\n import { NoElement } from './no-element';\n\n type DropdownItem = string | number | Identifiable;\n\n /**\n * Dropdown component that mimics a Select element behavior, but with the option\n * to customize the toggle button and each item contents.\n *\n * @public\n */\n @Component({\n components: {\n NoElement\n },\n model: {\n event: 'change'\n }\n })\n export default class BaseDropdown extends Vue {\n /**\n * List of items to display.\n *\n * @public\n */\n @Prop({ required: true })\n public items!: DropdownItem[];\n\n /**\n * The selected item.\n *\n * @public\n */\n @Prop({ required: true })\n public value!: DropdownItem | null;\n\n /**\n * Animation component to use for expanding the dropdown. This is a single element animation,\n * so only `<transition>` components are allowed.\n *\n * @public\n */\n @Prop({ default: 'NoElement' })\n public animation!: typeof Vue | string;\n\n /**\n * Time to wait without receiving any keystroke before resetting the items search query.\n *\n * @public\n */\n @Prop({ default: 1000 })\n public searchTimeoutMs!: number;\n\n public $refs!: {\n /** Array containing the dropdown list buttons HTMLElements. */\n itemButtons: HTMLButtonElement[];\n };\n\n /**\n * Property to track whether the dropdown is expanded and displaying the full\n * list of items, or closed.\n *\n * @internal\n */\n protected isOpen = false;\n\n /**\n * Index of the element that has the focus in the list. -1 means no element has focus.\n *\n * @internal\n */\n protected highlightedItemIndex = -1;\n\n /**\n * String to search for the first element that starts with it.\n *\n * @internal\n */\n protected searchBuffer = '';\n\n /**\n * Resets the search buffer after a certain time has passed.\n *\n * @internal\n */\n protected restartResetSearchTimeout!: () => void;\n\n /**\n * Dynamic CSS classes to add to the dropdown root element.\n *\n * @returns An object containing the CSS classes to add to the dropdown root element.\n * @internal\n */\n protected get dropdownCSSClasses(): VueCSSClasses {\n return {\n 'x-dropdown--is-open': this.isOpen\n };\n }\n\n /**\n * Dynamic CSS classes to add to each one of the items.\n *\n * @returns An object containing the CSS classes to add to each item.\n * @internal\n */\n protected get itemsCSSClasses(): VueCSSClasses[] {\n return this.items.map((item, index) => {\n return {\n 'x-dropdown__item--is-selected': this.value === item,\n 'x-dropdown__item--is-highlighted': this.highlightedItemIndex === index\n };\n });\n }\n\n /**\n * If the dropdown is destroyed before removing the document listeners, it ensures that they\n * are removed too.\n *\n * @internal\n */\n protected beforeDestroy(): void {\n this.removeDocumentCloseListeners();\n }\n\n /**\n * Opens the dropdown.\n *\n * @internal\n */\n protected open(): void {\n this.isOpen = true;\n }\n\n /**\n * Closes the dropdown.\n *\n * @internal\n */\n protected close(): void {\n this.isOpen = false;\n }\n\n /**\n * If the dropdown is opened it closes it. If it is closed it opens it.\n *\n * @internal\n */\n protected toggle(): void {\n this.isOpen = !this.isOpen;\n }\n\n /**\n * Emits the event that the selected item has changed.\n *\n * @param item - The new selected item.\n * @internal\n */\n protected emitSelectedItemChanged(item: DropdownItem): void {\n this.$emit('change', item);\n this.close();\n }\n\n /**\n * Highlights the item after the one that is currently highlighted.\n *\n * @internal\n */\n protected highlightNextItem(): void {\n this.open();\n this.highlightedItemIndex = (this.highlightedItemIndex + 1) % this.items.length;\n }\n\n /**\n * Highlights the item before the one that is currently highlighted.\n *\n * @internal\n */\n protected highlightPreviousItem(): void {\n this.open();\n this.highlightedItemIndex =\n this.highlightedItemIndex > 0 ? this.highlightedItemIndex - 1 : this.items.length - 1;\n }\n\n /**\n * Highlights the first of the provided items.\n *\n * @internal\n */\n protected highlightFirstItem(): void {\n this.highlightedItemIndex = 0;\n }\n\n /**\n * Highlights the last of the provided items.\n *\n * @internal\n */\n protected highlightLastItem(): void {\n this.highlightedItemIndex = this.items.length - 1;\n }\n\n /**\n * Updates the variable that is used to search in the filters.\n *\n * @param event - The event coming from the user typing.\n * @internal\n */\n protected updateSearchBuffer(event: KeyboardEvent): void {\n if (/^\\w$/.test(event.key)) {\n const key = event.key;\n this.searchBuffer += key;\n this.restartResetSearchTimeout();\n }\n }\n\n /**\n * Highlights the item that matches the search buffer. To do so it checks the list buttons\n * text content. It highlights items folowing this priority:\n * - If an element is already highlighted, it starts searching from that element.\n * - If no element is found starting from the previously highlighted, it returns the first one.\n * - If no element is found matching the search query it highlights the first element.\n *\n * @param search - The search string to find in the HTML.\n * @internal\n */\n @Watch('searchBuffer')\n protected highlightMatchingItem(search: string): void {\n if (search) {\n const normalizedSearch = normalizeString(search);\n const matchingIndices = this.$refs.itemButtons.reduce<number[]>(\n (matchingIndices, button, index) => {\n const safeButtonWordCharacters = button.textContent!.replace(/[^\\w]/g, '');\n const normalizedButtonText = normalizeString(safeButtonWordCharacters);\n if (normalizedButtonText.startsWith(normalizedSearch)) {\n matchingIndices.push(index);\n }\n return matchingIndices;\n },\n []\n );\n this.highlightedItemIndex =\n // First matching item starting to search from the current highlighted element\n matchingIndices.find(index => index >= this.highlightedItemIndex) ??\n // First matching item\n matchingIndices[0] ??\n // First item\n 0;\n }\n }\n\n /**\n * Resets the search buffer.\n *\n * @internal\n */\n protected resetSearch(): void {\n this.searchBuffer = '';\n }\n\n /** Updates the debounced function to reset the search.\n *\n * @param searchTimeoutMs - The new milliseconds that have to pass without typing before\n * resetting the search.\n * @internal\n */\n @Watch('searchTimeoutMs', { immediate: true })\n protected updateSearchTimeout(searchTimeoutMs: number): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.restartResetSearchTimeout = debounce(this.resetSearch, searchTimeoutMs);\n }\n\n /**\n * Focuses the DOM element which matches the `highlightedItemIndex`.\n *\n * @param highlightedItemIndex - The index of the HTML element to focus.\n * @internal\n */\n @Watch('highlightedItemIndex', { immediate: true })\n protected focusHighlightedItem(highlightedItemIndex: number): void {\n this.$nextTick(() => {\n if (this.$refs.itemButtons && isInRange(highlightedItemIndex, [0, this.items.length - 1])) {\n const newItem = this.$refs.itemButtons[this.highlightedItemIndex];\n newItem.focus();\n }\n });\n }\n\n /**\n * When the dropdown is open it sets the focused element to the one that is selected.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n * @internal\n */\n @Watch('isOpen')\n protected updateHighlightedItem(isOpen: boolean): void {\n if (isOpen) {\n this.highlightedItemIndex = this.value === null ? 0 : this.items.indexOf(this.value);\n } else {\n this.highlightedItemIndex = -1;\n }\n }\n\n /**\n * Adds and removes listeners to close the dropdown when it loses the focus.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n * @internal\n */\n @Watch('isOpen')\n protected syncCloseListeners(isOpen: boolean): void {\n /*\n * Because there is an issue with Firefox in macOS and Safari that doesn't focus the target\n * element of the `mousedown` events, the `focusout` event `relatedTarget` property can't be\n * used to detect whether or not the user has blurred the dropdown. The hack here is to use\n * document listeners that have the side effect of losing the focus.\n */\n if (isOpen) {\n this.addDocumentCloseListeners();\n } else {\n this.removeDocumentCloseListeners();\n }\n }\n\n /**\n * Adds listeners to the document element to detect if the focus has moved out from the\n * dropdown.\n *\n * @internal\n */\n protected addDocumentCloseListeners(): void {\n /* eslint-disable @typescript-eslint/unbound-method */\n document.addEventListener('mousedown', this.closeIfEventIsOutOfDropdown);\n document.addEventListener('touchstart', this.closeIfEventIsOutOfDropdown);\n document.addEventListener('focusin', this.closeIfEventIsOutOfDropdown);\n /* eslint-enable @typescript-eslint/unbound-method */\n }\n\n /**\n * Removes the listeners of the document element to detect if the focus has moved out from the\n * dropdown.\n *\n * @internal\n */\n protected removeDocumentCloseListeners(): void {\n /* eslint-disable @typescript-eslint/unbound-method */\n document.removeEventListener('mousedown', this.closeIfEventIsOutOfDropdown);\n document.removeEventListener('touchstart', this.closeIfEventIsOutOfDropdown);\n document.removeEventListener('focusin', this.closeIfEventIsOutOfDropdown);\n /* eslint-enable @typescript-eslint/unbound-method */\n }\n\n /**\n * Closes the dropdown if the passed event has happened on an element out of the dropdown.\n *\n * @param event - The event to check if it has happen out of the dropdown component.\n */\n protected closeIfEventIsOutOfDropdown(event: MouseEvent | TouchEvent | FocusEvent): void {\n if (!this.$el.contains(event.target as HTMLElement)) {\n this.close();\n }\n }\n }\n</script>\n\n<style lang=\"scss\" scoped>\n .x-dropdown {\n position: relative;\n\n &__items-list {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n top: calc(100% + var(--x-size-gap-dropdown-default, 0));\n }\n }\n</style>\n\n<docs lang=\"mdx\">\n# Example\n\nThe `Dropdown` component is a simple yet customizable select component. The component needs to work\nthe list of items available to select, which are passed using the `items` prop, and the selected\nitem, which is passed in using the `value` prop.\n\nThe supported items must be an array that can contain unique strings, unique numbers, or objects\nwith a unique `id` property.\n\nThe content of each item can be customized using the `item` slot, which apart from the data of the\nitem, it also receives via prop if the element is selected or highlighted.\n\nThere `toggle` slot can be used to customize the button that opens the dropdown. If this is not\nprovided, the `item` slot will be used for that.\n\n```vue\n<template>\n <BaseDropdown :items=\"items\" v-model=\"value\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}️</template>\n\n <template #item=\"{ item, isSelected, isHighlighted }\">\n <span v-if=\"isHighlighted\">🟢</span>\n <span v-if=\"isSelected\">✅</span>\n <span>{{ item }}</span>\n </template>\n </BaseDropdown>\n</template>\n\n<script>\n import { BaseDropdown } from '@empathyco/x-components';\n\n export default {\n name: 'DropdownTest',\n components: {\n BaseDropdown\n },\n data() {\n return {\n items: ['a', 2, { id: '3' }],\n value: ['a']\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["const"],"mappings":";;;;;AAEAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -12,6 +12,7 @@ import { forEach, reduce } from '../../../../utils/object.js';
12
12
  var updateUrl = function (_a) {
13
13
  var _b = _a.getters, urlParams = _b.urlParams, urlMappedParamNames = _b.urlMappedParamNames;
14
14
  var url = new URL(window.location.href);
15
+ var oldParams = url.searchParams;
15
16
  forEach(urlMappedParamNames, function (_, value) {
16
17
  url.searchParams.delete(value);
17
18
  });
@@ -27,8 +28,25 @@ var updateUrl = function (_a) {
27
28
  }
28
29
  return url;
29
30
  }, url);
30
- window.history.replaceState(__assign({}, window.history.state), document.title, url.href);
31
- };
31
+ if (pushableParamsChanged(urlParams, oldParams)) {
32
+ window.history.pushState(__assign({}, window.history.state), document.title, url.href);
33
+ }
34
+ else {
35
+ window.history.replaceState(__assign({}, window.history.state), document.title, url.href);
36
+ }
37
+ };
38
+ /**
39
+ * Checks if the pushable params have changed.
40
+ *
41
+ * @param urlParams - The new Url params.
42
+ * @param oldValues - The old Url params.
43
+ *
44
+ * @returns True if the param has changed.
45
+ */
46
+ function pushableParamsChanged(urlParams, oldValues) {
47
+ var pushableParams = ['scroll'];
48
+ return pushableParams.some(function (key) { return oldValues.has(key) && oldValues.get(key) !== urlParams[key]; });
49
+ }
32
50
 
33
51
  export { updateUrl };
34
52
  //# sourceMappingURL=update-url.action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-url.action.js","sources":["../../../../../../src/x-modules/url/store/actions/update-url.action.ts"],"sourcesContent":["import { forEach, reduce } from '../../../../utils/object';\nimport { UrlXStoreModule } from '../types';\n\n/**\n * Default implementation for the {@link UrlActions.updateUrl}.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,\n * provided by Vuex.\n *\n * @internal\n */\nexport const updateUrl: UrlXStoreModule['actions']['updateUrl'] = ({\n getters: { urlParams, urlMappedParamNames }\n}) => {\n const url = new URL(window.location.href);\n\n forEach(urlMappedParamNames, (_, value) => {\n url.searchParams.delete(value);\n });\n\n reduce(\n urlParams,\n (url, paramKey, paramValue) => {\n const newKey = urlMappedParamNames[paramKey];\n\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(newKey, value.toString());\n });\n } else {\n url.searchParams.set(newKey, paramValue.toString());\n }\n return url;\n },\n url\n );\n window.history.replaceState({ ...window.history.state }, document.title, url.href);\n};\n"],"names":[],"mappings":";;;AAGA;;;;;;;;IAQa,SAAS,GAA4C,UAAC,EAElE;QADC,eAA2C,EAAhC,SAAS,eAAA,EAAE,mBAAmB,yBAAA;IAEzC,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE1C,OAAO,CAAC,mBAAmB,EAAE,UAAC,CAAC,EAAE,KAAK;QACpC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAChC,CAAC,CAAC;IAEH,MAAM,CACJ,SAAS,EACT,UAAC,GAAG,EAAE,QAAQ,EAAE,UAAU;QACxB,IAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAE7C,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC7B,UAAU,CAAC,OAAO,CAAC,UAAA,KAAK;gBACtB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;aACnD,CAAC,CAAC;SACJ;aAAM;YACL,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;SACrD;QACD,OAAO,GAAG,CAAC;KACZ,EACD,GAAG,CACJ,CAAC;IACF,MAAM,CAAC,OAAO,CAAC,YAAY,cAAM,MAAM,CAAC,OAAO,CAAC,KAAK,GAAI,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;AACrF;;;;"}
1
+ {"version":3,"file":"update-url.action.js","sources":["../../../../../../src/x-modules/url/store/actions/update-url.action.ts"],"sourcesContent":["import { Dictionary } from '../../../../utils';\nimport { forEach, reduce } from '../../../../utils/object';\nimport { UrlParamValue, UrlXStoreModule } from '../types';\n\n/**\n * Default implementation for the {@link UrlActions.updateUrl}.\n *\n * @param context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,\n * provided by Vuex.\n *\n * @internal\n */\nexport const updateUrl: UrlXStoreModule['actions']['updateUrl'] = ({\n getters: { urlParams, urlMappedParamNames }\n}) => {\n const url = new URL(window.location.href);\n const oldParams = url.searchParams;\n\n forEach(urlMappedParamNames, (_, value) => {\n url.searchParams.delete(value);\n });\n\n reduce(\n urlParams,\n (url, paramKey, paramValue) => {\n const newKey = urlMappedParamNames[paramKey];\n\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(newKey, value.toString());\n });\n } else {\n url.searchParams.set(newKey, paramValue.toString());\n }\n return url;\n },\n url\n );\n\n if (pushableParamsChanged(urlParams, oldParams)) {\n window.history.pushState({ ...window.history.state }, document.title, url.href);\n } else {\n window.history.replaceState({ ...window.history.state }, document.title, url.href);\n }\n};\n\n/**\n * Checks if the pushable params have changed.\n *\n * @param urlParams - The new Url params.\n * @param oldValues - The old Url params.\n *\n * @returns True if the param has changed.\n */\nfunction pushableParamsChanged(\n urlParams: Dictionary<UrlParamValue>,\n oldValues: URLSearchParams\n): boolean {\n const pushableParams = ['scroll'];\n return pushableParams.some(key => oldValues.has(key) && oldValues.get(key) !== urlParams[key]);\n}\n"],"names":[],"mappings":";;;AAIA;;;;;;;;IAQa,SAAS,GAA4C,UAAC,EAElE;QADC,eAA2C,EAAhC,SAAS,eAAA,EAAE,mBAAmB,yBAAA;IAEzC,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAM,SAAS,GAAG,GAAG,CAAC,YAAY,CAAC;IAEnC,OAAO,CAAC,mBAAmB,EAAE,UAAC,CAAC,EAAE,KAAK;QACpC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAChC,CAAC,CAAC;IAEH,MAAM,CACJ,SAAS,EACT,UAAC,GAAG,EAAE,QAAQ,EAAE,UAAU;QACxB,IAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAE7C,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC7B,UAAU,CAAC,OAAO,CAAC,UAAA,KAAK;gBACtB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;aACnD,CAAC,CAAC;SACJ;aAAM;YACL,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;SACrD;QACD,OAAO,GAAG,CAAC;KACZ,EACD,GAAG,CACJ,CAAC;IAEF,IAAI,qBAAqB,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE;QAC/C,MAAM,CAAC,OAAO,CAAC,SAAS,cAAM,MAAM,CAAC,OAAO,CAAC,KAAK,GAAI,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;KACjF;SAAM;QACL,MAAM,CAAC,OAAO,CAAC,YAAY,cAAM,MAAM,CAAC,OAAO,CAAC,KAAK,GAAI,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;KACpF;AACH,EAAE;AAEF;;;;;;;;AAQA,SAAS,qBAAqB,CAC5B,SAAoC,EACpC,SAA0B;IAE1B,IAAM,cAAc,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClC,OAAO,cAAc,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,GAAA,CAAC,CAAC;AACjG;;;;"}