@entur/dropdown 9.0.2 → 9.1.1
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/Dropdown.d.ts +77 -2
- package/dist/NativeDropdown.d.ts +48 -2
- package/dist/SearchableDropdown.d.ts +31 -1
- package/dist/dropdown.cjs +32 -6
- package/dist/dropdown.cjs.map +1 -1
- package/dist/dropdown.mjs +33 -7
- package/dist/dropdown.mjs.map +1 -1
- package/dist/styles.css +24 -116
- package/dist/useFloatingRef.d.ts +27 -0
- package/package.json +10 -10
package/dist/styles.css
CHANGED
|
@@ -2,42 +2,26 @@
|
|
|
2
2
|
--eds-dropdown:1;
|
|
3
3
|
}.eds-dropdown__list{
|
|
4
4
|
position:absolute;
|
|
5
|
-
|
|
6
|
-
-moz-box-sizing:border-box;
|
|
7
|
-
box-sizing:border-box;
|
|
5
|
+
box-sizing:border-box;
|
|
8
6
|
overflow-y:auto;
|
|
9
7
|
z-index:20;
|
|
10
8
|
padding:0;
|
|
11
9
|
margin:0;
|
|
12
10
|
list-style:none;
|
|
13
11
|
border:0.125rem solid var(--components-form-basemenu-border);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
border-radius:0.25rem;
|
|
17
|
-
-webkit-box-shadow:0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
|
|
18
|
-
-moz-box-shadow:0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
|
|
19
|
-
box-shadow:0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
|
|
12
|
+
border-radius:0.25rem;
|
|
13
|
+
box-shadow:0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
|
|
20
14
|
cursor:default;
|
|
21
15
|
width:min(95dvw, 100%);
|
|
22
|
-
max-height:15rem;
|
|
23
16
|
max-height:var(--list-max-height, 15rem);
|
|
24
17
|
}
|
|
25
18
|
.eds-dropdown__list:focus{
|
|
26
19
|
outline:none;
|
|
27
20
|
}
|
|
28
21
|
.eds-dropdown__list__item{
|
|
29
|
-
display:-webkit-box;
|
|
30
|
-
display:-webkit-flex;
|
|
31
|
-
display:-moz-box;
|
|
32
22
|
display:flex;
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-moz-box-align:center;
|
|
36
|
-
align-items:center;
|
|
37
|
-
-webkit-box-pack:start;
|
|
38
|
-
-webkit-justify-content:flex-start;
|
|
39
|
-
-moz-box-pack:start;
|
|
40
|
-
justify-content:flex-start;
|
|
23
|
+
align-items:center;
|
|
24
|
+
justify-content:flex-start;
|
|
41
25
|
padding:0.75rem 1rem;
|
|
42
26
|
font-family:inherit;
|
|
43
27
|
font-size:1rem;
|
|
@@ -51,10 +35,7 @@
|
|
|
51
35
|
border-bottom:none;
|
|
52
36
|
}
|
|
53
37
|
.eds-dropdown__list__item__text{
|
|
54
|
-
|
|
55
|
-
-webkit-flex:1;
|
|
56
|
-
-moz-box-flex:1;
|
|
57
|
-
flex:1;
|
|
38
|
+
flex:1;
|
|
58
39
|
cursor:default;
|
|
59
40
|
}
|
|
60
41
|
.eds-dropdown__list__item__icon{
|
|
@@ -141,8 +122,7 @@
|
|
|
141
122
|
}
|
|
142
123
|
.eds-dropdown__selected-item-tag__text{
|
|
143
124
|
text-wrap:nowrap;
|
|
144
|
-
|
|
145
|
-
text-overflow:ellipsis;
|
|
125
|
+
text-overflow:ellipsis;
|
|
146
126
|
overflow-x:hidden;
|
|
147
127
|
}
|
|
148
128
|
.eds-contrast .eds-dropdown .eds-icon-button{
|
|
@@ -160,16 +140,9 @@
|
|
|
160
140
|
background-color:var(--components-button-iconbutton-standard-active);
|
|
161
141
|
}
|
|
162
142
|
.eds-dropdown__appendix{
|
|
163
|
-
display:-webkit-box;
|
|
164
|
-
display:-webkit-flex;
|
|
165
|
-
display:-moz-box;
|
|
166
143
|
display:flex;
|
|
167
|
-
-
|
|
168
|
-
|
|
169
|
-
-moz-box-align:center;
|
|
170
|
-
align-items:center;
|
|
171
|
-
-webkit-align-self:flex-start;
|
|
172
|
-
align-self:flex-start;
|
|
144
|
+
align-items:center;
|
|
145
|
+
align-self:flex-start;
|
|
173
146
|
margin-top:0.25rem;
|
|
174
147
|
gap:0.25rem;
|
|
175
148
|
}
|
|
@@ -187,32 +160,15 @@
|
|
|
187
160
|
margin-right:-0.75rem;
|
|
188
161
|
}
|
|
189
162
|
.eds-dropdown__appendix__toggle-button--open svg{
|
|
190
|
-
|
|
191
|
-
-moz-transform:rotate(180deg);
|
|
192
|
-
-o-transform:rotate(180deg);
|
|
193
|
-
transform:rotate(180deg);
|
|
163
|
+
transform:rotate(180deg);
|
|
194
164
|
}
|
|
195
165
|
.eds-dropdown__appendix__toggle-button svg{
|
|
196
|
-
-webkit-transition:-webkit-transform ease-in-out 0.1s;
|
|
197
|
-
transition:-webkit-transform ease-in-out 0.1s;
|
|
198
|
-
-o-transition:-o-transform ease-in-out 0.1s;
|
|
199
|
-
-moz-transition:transform ease-in-out 0.1s, -moz-transform ease-in-out 0.1s;
|
|
200
166
|
transition:transform ease-in-out 0.1s;
|
|
201
|
-
transition:transform ease-in-out 0.1s, -webkit-transform ease-in-out 0.1s, -moz-transform ease-in-out 0.1s, -o-transform ease-in-out 0.1s;
|
|
202
167
|
}
|
|
203
168
|
.eds-dropdown__appendix__toggle-button--loading-dots{
|
|
204
|
-
-
|
|
205
|
-
-webkit-align-items:center;
|
|
206
|
-
-moz-box-align:center;
|
|
207
|
-
align-items:center;
|
|
208
|
-
display:-webkit-box;
|
|
209
|
-
display:-webkit-flex;
|
|
210
|
-
display:-moz-box;
|
|
169
|
+
align-items:center;
|
|
211
170
|
display:flex;
|
|
212
|
-
-
|
|
213
|
-
-webkit-justify-content:center;
|
|
214
|
-
-moz-box-pack:center;
|
|
215
|
-
justify-content:center;
|
|
171
|
+
justify-content:center;
|
|
216
172
|
height:100%;
|
|
217
173
|
width:1.5rem;
|
|
218
174
|
margin-left:0.25rem;
|
|
@@ -236,39 +192,23 @@
|
|
|
236
192
|
cursor:text;
|
|
237
193
|
}
|
|
238
194
|
.eds-dropdown__input{
|
|
239
|
-
|
|
240
|
-
-webkit-flex:1;
|
|
241
|
-
-moz-box-flex:1;
|
|
242
|
-
flex:1;
|
|
195
|
+
flex:1;
|
|
243
196
|
width:0;
|
|
244
197
|
}
|
|
245
198
|
.eds-dropdown__input--hidden{
|
|
246
|
-
|
|
247
|
-
-webkit-flex:0;
|
|
248
|
-
-moz-box-flex:0;
|
|
249
|
-
flex:0;
|
|
199
|
+
flex:0;
|
|
250
200
|
}
|
|
251
201
|
.eds-dropdown__input__wrapper{
|
|
252
|
-
|
|
253
|
-
-webkit-flex:1 1 auto;
|
|
254
|
-
-moz-box-flex:1;
|
|
255
|
-
flex:1 1 auto;
|
|
256
|
-
display:-webkit-box;
|
|
257
|
-
display:-webkit-flex;
|
|
258
|
-
display:-moz-box;
|
|
202
|
+
flex:1 1 auto;
|
|
259
203
|
display:flex;
|
|
260
204
|
}
|
|
261
205
|
.eds-dropdown__selected-item{
|
|
262
|
-
|
|
263
|
-
-webkit-flex:1;
|
|
264
|
-
-moz-box-flex:1;
|
|
265
|
-
flex:1;
|
|
206
|
+
flex:1;
|
|
266
207
|
height:100%;
|
|
267
208
|
min-height:2.75rem;
|
|
268
209
|
padding:1.25rem 0rem 0.25rem;
|
|
269
210
|
overflow-x:hidden;
|
|
270
|
-
|
|
271
|
-
text-overflow:ellipsis;
|
|
211
|
+
text-overflow:ellipsis;
|
|
272
212
|
line-height:1rem;
|
|
273
213
|
}
|
|
274
214
|
.eds-dropdown__selected-item:focus{
|
|
@@ -279,60 +219,31 @@
|
|
|
279
219
|
}
|
|
280
220
|
.eds-dropdown--searchable__selected-item{
|
|
281
221
|
position:relative;
|
|
282
|
-
|
|
283
|
-
-webkit-flex:1;
|
|
284
|
-
-moz-box-flex:1;
|
|
285
|
-
flex:1;
|
|
222
|
+
flex:1;
|
|
286
223
|
overflow-x:hidden;
|
|
287
|
-
|
|
288
|
-
text-overflow:ellipsis;
|
|
224
|
+
text-overflow:ellipsis;
|
|
289
225
|
padding:1.375rem 0rem 0.3rem;
|
|
290
226
|
white-space:nowrap;
|
|
291
227
|
line-height:1rem;
|
|
292
228
|
font-family:inherit;
|
|
293
229
|
}
|
|
294
230
|
.eds-dropdown--searchable__selected-item--hidden{
|
|
295
|
-
|
|
296
|
-
-webkit-flex:0;
|
|
297
|
-
-moz-box-flex:0;
|
|
298
|
-
flex:0;
|
|
299
|
-
}
|
|
300
|
-
.eds-dropdown--searchable :not(.eds-dropdown--searchable__selected-item--hidden) + ::-webkit-input-placeholder{
|
|
301
|
-
-webkit-transition:none;
|
|
302
|
-
transition:none;
|
|
303
|
-
}
|
|
304
|
-
.eds-dropdown--searchable :not(.eds-dropdown--searchable__selected-item--hidden) + :-moz-placeholder{
|
|
305
|
-
-moz-transition:none;
|
|
306
|
-
transition:none;
|
|
231
|
+
flex:0;
|
|
307
232
|
}
|
|
308
233
|
.eds-dropdown--searchable :not(.eds-dropdown--searchable__selected-item--hidden) + ::-moz-placeholder{
|
|
309
234
|
-moz-transition:none;
|
|
310
235
|
transition:none;
|
|
311
236
|
}
|
|
312
|
-
.eds-dropdown--searchable :not(.eds-dropdown--searchable__selected-item--hidden) + ::-ms-input-placeholder{
|
|
313
|
-
-ms-transition:none;
|
|
314
|
-
transition:none;
|
|
315
|
-
}
|
|
316
237
|
.eds-dropdown--searchable :not(.eds-dropdown--searchable__selected-item--hidden) + ::placeholder{
|
|
317
|
-
-webkit-transition:none;
|
|
318
|
-
-o-transition:none;
|
|
319
|
-
-moz-transition:none;
|
|
320
238
|
transition:none;
|
|
321
239
|
}
|
|
322
240
|
.eds-dropdown--multiselect{
|
|
323
241
|
cursor:text;
|
|
324
242
|
}
|
|
325
243
|
.eds-dropdown--multiselect__selected-items-and-input{
|
|
326
|
-
display:-webkit-box;
|
|
327
|
-
display:-webkit-flex;
|
|
328
|
-
display:-moz-box;
|
|
329
244
|
display:flex;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
-webkit-box-flex:1;
|
|
333
|
-
-webkit-flex:1;
|
|
334
|
-
-moz-box-flex:1;
|
|
335
|
-
flex:1;
|
|
245
|
+
flex-wrap:wrap;
|
|
246
|
+
flex:1;
|
|
336
247
|
gap:0.5rem;
|
|
337
248
|
min-width:0;
|
|
338
249
|
}
|
|
@@ -340,14 +251,11 @@
|
|
|
340
251
|
padding:1.25rem 0rem 0.25rem;
|
|
341
252
|
}
|
|
342
253
|
.eds-dropdown--multiselect__selected-items-and-input--filled .eds-dropdown__input{
|
|
343
|
-
padding:
|
|
344
|
-
padding:initial;
|
|
254
|
+
padding:unset;
|
|
345
255
|
min-height:1.5rem;
|
|
346
256
|
}
|
|
347
257
|
.eds-dropdown--multiselect__selected-items-and-input--filled .eds-tag-chip:focus{
|
|
348
|
-
|
|
349
|
-
-moz-box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
|
|
350
|
-
box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
|
|
258
|
+
box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
|
|
351
259
|
}
|
|
352
260
|
.eds-dropdown--multiselect__selected-items-and-input--filled .eds-tag-chip__close-button svg{
|
|
353
261
|
width:1rem;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps floating-ui's `setReference` / `setFloating` in a stable ref callback
|
|
3
|
+
* that ignores detach calls, so the menu cannot get stuck in a render loop.
|
|
4
|
+
*
|
|
5
|
+
* The loop, step by step:
|
|
6
|
+
*
|
|
7
|
+
* 1. downshift's prop getters build a new ref callback on every render.
|
|
8
|
+
* 2. When a callback ref changes identity, React detaches the old one
|
|
9
|
+
* (`ref(null)`) and attaches the new one (`ref(node)`).
|
|
10
|
+
* 3. `setReference` and `setFloating` are state setters, so those two calls
|
|
11
|
+
* trigger two renders — which build a new ref callback again.
|
|
12
|
+
*
|
|
13
|
+
* While the menu is open that never settles and React throws
|
|
14
|
+
* "Maximum update depth exceeded".
|
|
15
|
+
*
|
|
16
|
+
* Skipping the `null` call breaks the loop: floating-ui's own identity check
|
|
17
|
+
* then bails on the re-attach, so no state is set and no render follows.
|
|
18
|
+
* Skipping it is safe because these elements stay mounted and are hidden with
|
|
19
|
+
* `display: none` — a detach here never means the element is gone.
|
|
20
|
+
*
|
|
21
|
+
* The returned callback keeps one identity for the component's lifetime, so it
|
|
22
|
+
* cannot become the churn it prevents. `setElement` is read through a ref to
|
|
23
|
+
* keep that true even when a caller passes a new function each render; the
|
|
24
|
+
* trade-off is that a new `setElement` takes effect on the next attach rather
|
|
25
|
+
* than immediately.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useFloatingRef<ElementType extends HTMLElement>(setElement: (node: ElementType | null) => void): (node: ElementType | null) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur/dropdown",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.1",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/dropdown.cjs",
|
|
6
6
|
"module": "dist/dropdown.mjs",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"react-dom": ">=18.0.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@entur/a11y": "^0.3.
|
|
30
|
-
"@entur/button": "^5.0.
|
|
31
|
-
"@entur/chip": "^0.11.
|
|
32
|
-
"@entur/form": "^10.
|
|
33
|
-
"@entur/icons": "^10.0.
|
|
34
|
-
"@entur/loader": "^0.8.
|
|
35
|
-
"@entur/tokens": "^4.0
|
|
36
|
-
"@entur/tooltip": "^6.0.
|
|
29
|
+
"@entur/a11y": "^0.3.3",
|
|
30
|
+
"@entur/button": "^5.0.4",
|
|
31
|
+
"@entur/chip": "^0.11.4",
|
|
32
|
+
"@entur/form": "^10.1.1",
|
|
33
|
+
"@entur/icons": "^10.0.3",
|
|
34
|
+
"@entur/loader": "^0.8.4",
|
|
35
|
+
"@entur/tokens": "^4.1.0",
|
|
36
|
+
"@entur/tooltip": "^6.0.4",
|
|
37
37
|
"@entur/utils": "^0.15.0",
|
|
38
38
|
"@floating-ui/react-dom": "^2.1.6",
|
|
39
39
|
"classnames": "^2.5.1",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"./dist/styles.css": "./dist/styles.css",
|
|
63
63
|
"./package.json": "./package.json"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "fa179e7f6a360139e5ee0ffcb35718ef197eab06"
|
|
66
66
|
}
|