@acusti/dropdown 0.53.0 → 0.54.0
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/README.md +1 -1
- package/dist/Dropdown.js +174 -261
- package/dist/Dropdown.js.map +1 -1
- package/package.json +1 -2
- package/dist/styles.d.ts +0 -13
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ The three primary design goals for the existence of this component:
|
|
|
27
27
|
and the value of that item at the same time (otherwise, the value is
|
|
28
28
|
the text content of the dropdown item element)
|
|
29
29
|
4. To style your dropdowns, use CSS; there are a
|
|
30
|
-
[collection of CSS custom properties](https://github.com/acusti/uikit/blob/main/packages/dropdown/src/
|
|
30
|
+
[collection of CSS custom properties](https://github.com/acusti/uikit/blob/main/packages/dropdown/src/Dropdown.css)
|
|
31
31
|
used internally to style them if that works best for you, or just
|
|
32
32
|
override the minimal default CSS as appropriate
|
|
33
33
|
3. **Lightweight bundle size** with the bare minimum of dependencies (see
|
package/dist/Dropdown.js
CHANGED
|
@@ -1,111 +1,15 @@
|
|
|
1
1
|
import { c } from "react/compiler-runtime";
|
|
2
|
-
import { SYSTEM_UI_FONT, Style } from "@acusti/styling";
|
|
3
2
|
import useBoundingClientRect from "@acusti/use-bounding-client-rect";
|
|
4
3
|
import useKeyboardEvents, { isEventTargetUsingKeyEvent } from "@acusti/use-keyboard-events";
|
|
5
4
|
import clsx from "clsx";
|
|
6
5
|
import { Children, Fragment, isValidElement, useEffect, useRef, useState } from "react";
|
|
7
6
|
import { getBestMatch } from "@acusti/matchmaking";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
|
|
10
|
-
const ROOT_SELECTOR = `.${ROOT_CLASS_NAME}`;
|
|
11
|
-
const BODY_CLASS_NAME = `${ROOT_CLASS_NAME}-body`;
|
|
12
|
-
const LABEL_CLASS_NAME = `${ROOT_CLASS_NAME}-label`;
|
|
13
|
-
const LABEL_TEXT_CLASS_NAME = `${ROOT_CLASS_NAME}-label-text`;
|
|
14
|
-
const TRIGGER_CLASS_NAME = `${ROOT_CLASS_NAME}-trigger`;
|
|
15
|
-
const BODY_SELECTOR = `.${BODY_CLASS_NAME}`;
|
|
16
|
-
const LABEL_SELECTOR = `.${LABEL_CLASS_NAME}`;
|
|
17
|
-
const LABEL_TEXT_SELECTOR = `.${LABEL_TEXT_CLASS_NAME}`;
|
|
18
|
-
const TRIGGER_SELECTOR = `.${TRIGGER_CLASS_NAME}`;
|
|
19
|
-
const BODY_MAX_HEIGHT_VAR = "--uktdd-body-max-height";
|
|
20
|
-
const BODY_MAX_WIDTH_VAR = "--uktdd-body-max-width";
|
|
21
|
-
const STYLES = `
|
|
22
|
-
:root {
|
|
23
|
-
--uktdd-font-family: ${SYSTEM_UI_FONT};
|
|
24
|
-
--uktdd-body-bg-color: #fff;
|
|
25
|
-
--uktdd-body-bg-color-hover: rgb(105,162,249);
|
|
26
|
-
--uktdd-body-color-hover: #fff;
|
|
27
|
-
--uktdd-body-buffer: 10px;
|
|
28
|
-
${BODY_MAX_HEIGHT_VAR}: calc(100vh - var(--uktdd-body-buffer));
|
|
29
|
-
${BODY_MAX_WIDTH_VAR}: calc(100vw - var(--uktdd-body-buffer));
|
|
30
|
-
--uktdd-body-pad-bottom: 9px;
|
|
31
|
-
--uktdd-body-pad-left: 12px;
|
|
32
|
-
--uktdd-body-pad-right: 12px;
|
|
33
|
-
--uktdd-body-pad-top: 9px;
|
|
34
|
-
--uktdd-label-pad-right: 10px;
|
|
35
|
-
}
|
|
36
|
-
${ROOT_SELECTOR},
|
|
37
|
-
${TRIGGER_SELECTOR} {
|
|
38
|
-
font-family: var(--uktdd-font-family);
|
|
39
|
-
}
|
|
40
|
-
${ROOT_SELECTOR} {
|
|
41
|
-
width: max-content;
|
|
42
|
-
anchor-scope: --uktdd-anchor;
|
|
43
|
-
}
|
|
44
|
-
${ROOT_SELECTOR}.disabled {
|
|
45
|
-
pointer-events: none;
|
|
46
|
-
}
|
|
47
|
-
${ROOT_SELECTOR} > * {
|
|
48
|
-
cursor: default;
|
|
49
|
-
}
|
|
50
|
-
${ROOT_SELECTOR} > :first-child {
|
|
51
|
-
anchor-name: --uktdd-anchor;
|
|
52
|
-
}
|
|
53
|
-
${LABEL_SELECTOR} {
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
}
|
|
57
|
-
${LABEL_TEXT_SELECTOR} {
|
|
58
|
-
padding-right: var(--uktdd-label-pad-right);
|
|
59
|
-
}
|
|
60
|
-
${BODY_SELECTOR} {
|
|
61
|
-
box-sizing: border-box;
|
|
62
|
-
position: absolute;
|
|
63
|
-
position-anchor: --uktdd-anchor;
|
|
64
|
-
top: anchor(bottom);
|
|
65
|
-
left: anchor(left);
|
|
66
|
-
bottom: auto;
|
|
67
|
-
right: auto;
|
|
68
|
-
position-try-fallbacks: --uktdd-top-left, --uktdd-bottom-right, --uktdd-top-right;
|
|
69
|
-
min-height: 50px;
|
|
70
|
-
max-height: var(${BODY_MAX_HEIGHT_VAR});
|
|
71
|
-
min-width: min(50px, 100%);
|
|
72
|
-
max-width: var(${BODY_MAX_WIDTH_VAR});
|
|
73
|
-
overflow: auto;
|
|
74
|
-
z-index: 2;
|
|
75
|
-
padding: var(--uktdd-body-pad-top) var(--uktdd-body-pad-right) var(--uktdd-body-pad-bottom) var(--uktdd-body-pad-left);
|
|
76
|
-
background-color: var(--uktdd-body-bg-color);
|
|
77
|
-
box-shadow: 0 8px 18px rgba(0,0,0,0.25);
|
|
78
|
-
}
|
|
79
|
-
@position-try --uktdd-top-left {
|
|
80
|
-
bottom: anchor(top);
|
|
81
|
-
left: anchor(left);
|
|
82
|
-
top: auto;
|
|
83
|
-
right: auto;
|
|
84
|
-
}
|
|
85
|
-
@position-try --uktdd-bottom-right {
|
|
86
|
-
top: anchor(bottom);
|
|
87
|
-
right: anchor(right);
|
|
88
|
-
bottom: auto;
|
|
89
|
-
left: auto;
|
|
90
|
-
}
|
|
91
|
-
@position-try --uktdd-top-right {
|
|
92
|
-
bottom: anchor(top);
|
|
93
|
-
right: anchor(right);
|
|
94
|
-
top: auto;
|
|
95
|
-
left: auto;
|
|
96
|
-
}
|
|
97
|
-
${BODY_SELECTOR}.has-items {
|
|
98
|
-
user-select: none;
|
|
99
|
-
}
|
|
100
|
-
${BODY_SELECTOR} [data-ukt-active] {
|
|
101
|
-
background-color: var(--uktdd-body-bg-color-hover);
|
|
102
|
-
color: var(--uktdd-body-color-hover);
|
|
103
|
-
}
|
|
104
|
-
`;
|
|
8
|
+
var Dropdown_default = ":root{--uktdd-font-family:system-ui, Segoe UI, Roboto, Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, Helvetica, Arial, sans-serif;--uktdd-body-bg-color:#fff;--uktdd-body-bg-color-hover:#69a2f9;--uktdd-body-color-hover:#fff;--uktdd-body-buffer:10px;--uktdd-body-max-height:calc(100vh - var(--uktdd-body-buffer));--uktdd-body-max-width:calc(100vw - var(--uktdd-body-buffer));--uktdd-body-pad-bottom:9px;--uktdd-body-pad-left:12px;--uktdd-body-pad-right:12px;--uktdd-body-pad-top:9px;--uktdd-body-min-width:min(50px, 100%);--uktdd-label-pad-right:10px}.uktdropdown,.uktdropdown-trigger{font-family:var(--uktdd-font-family)}.uktdropdown{anchor-scope:--uktdd-anchor;width:max-content}.uktdropdown.disabled{pointer-events:none}.uktdropdown>*{cursor:default}.uktdropdown>:first-child{anchor-name:--uktdd-anchor}.uktdropdown-label{align-items:center;display:flex}.uktdropdown-label-text{padding-right:var(--uktdd-label-pad-right)}.uktdropdown-body{box-sizing:border-box;position-anchor:--uktdd-anchor;top:anchor(bottom);left:anchor(left);position-try-fallbacks:--uktdd-top-left, --uktdd-bottom-right, --uktdd-top-right;min-height:50px;max-height:var(--uktdd-body-max-height);min-width:var(--uktdd-body-min-width);max-width:var(--uktdd-body-max-width);z-index:2;padding:var(--uktdd-body-pad-top) var(--uktdd-body-pad-right) var(--uktdd-body-pad-bottom) var(--uktdd-body-pad-left);background-color:var(--uktdd-body-bg-color);position:absolute;bottom:auto;right:auto;overflow:auto;box-shadow:0 8px 18px #00000040}.uktdropdown-body.has-items{-webkit-user-select:none;user-select:none}.uktdropdown-body [data-ukt-active]{background-color:var(--uktdd-body-bg-color-hover);color:var(--uktdd-body-color-hover)}@position-try --uktdd-top-left{bottom: anchor(top); left: anchor(left); top: auto; right: auto;}@position-try --uktdd-bottom-right{top: anchor(bottom); right: anchor(right); bottom: auto; left: auto;}@position-try --uktdd-top-right{bottom: anchor(top); right: anchor(right); top: auto; left: auto;}";
|
|
105
9
|
const ITEM_SELECTOR = `[data-ukt-item], [data-ukt-value]`;
|
|
106
10
|
const getItemElements = (dropdownElement) => {
|
|
107
11
|
if (!dropdownElement) return null;
|
|
108
|
-
const bodyElement = dropdownElement.querySelector(
|
|
12
|
+
const bodyElement = dropdownElement.querySelector(".uktdropdown-body");
|
|
109
13
|
if (!bodyElement) return null;
|
|
110
14
|
let items = bodyElement.querySelectorAll(ITEM_SELECTOR);
|
|
111
15
|
if (items.length) return items;
|
|
@@ -191,8 +95,8 @@ var CHILDREN_ERROR = "@acusti/dropdown requires either 1 child (the dropdown bod
|
|
|
191
95
|
var CLICKABLE_SELECTOR = "button, a[href], input[type=\"button\"], input[type=\"submit\"]";
|
|
192
96
|
var TEXT_INPUT_SELECTOR = "input:not([type=radio]):not([type=checkbox]):not([type=range]),textarea";
|
|
193
97
|
function Dropdown(t0) {
|
|
194
|
-
const $ = c(
|
|
195
|
-
const { allowCreate, allowEmpty: t1, children, className, disabled, hasItems: t2, isOpenOnMount, isSearchable, keepOpenOnSubmit: t3, label, minHeightBody: t4, minWidthBody
|
|
98
|
+
const $ = c(89);
|
|
99
|
+
const { allowCreate, allowEmpty: t1, children, className, disabled, hasItems: t2, isOpenOnMount, isSearchable, keepOpenOnSubmit: t3, label, minHeightBody: t4, minWidthBody, name, onActiveItem, onClick, onClose, onMouseDown, onMouseUp, onOpen, onSubmitItem, placeholder, style: styleFromProps, tabIndex, value } = t0;
|
|
196
100
|
const allowEmpty = t1 === void 0 ? true : t1;
|
|
197
101
|
const hasItems = t2 === void 0 ? true : t2;
|
|
198
102
|
const keepOpenOnSubmit = t3 === void 0 ? !hasItems : t3;
|
|
@@ -225,10 +129,10 @@ function Dropdown(t0) {
|
|
|
225
129
|
const onOpenRef = useRef(onOpen);
|
|
226
130
|
const onSubmitItemRef = useRef(onSubmitItem);
|
|
227
131
|
const valueRef = useRef(value);
|
|
132
|
+
let t5;
|
|
228
133
|
let t6;
|
|
229
|
-
let t7;
|
|
230
134
|
if ($[0] !== allowCreate || $[1] !== allowEmpty || $[2] !== hasItems || $[3] !== isOpen || $[4] !== isOpening || $[5] !== keepOpenOnSubmit || $[6] !== onClose || $[7] !== onOpen || $[8] !== onSubmitItem || $[9] !== value) {
|
|
231
|
-
|
|
135
|
+
t5 = () => {
|
|
232
136
|
allowCreateRef.current = allowCreate;
|
|
233
137
|
allowEmptyRef.current = allowEmpty;
|
|
234
138
|
hasItemsRef.current = hasItems;
|
|
@@ -240,7 +144,7 @@ function Dropdown(t0) {
|
|
|
240
144
|
onSubmitItemRef.current = onSubmitItem;
|
|
241
145
|
valueRef.current = value;
|
|
242
146
|
};
|
|
243
|
-
|
|
147
|
+
t6 = [
|
|
244
148
|
allowCreate,
|
|
245
149
|
allowEmpty,
|
|
246
150
|
hasItems,
|
|
@@ -262,18 +166,18 @@ function Dropdown(t0) {
|
|
|
262
166
|
$[7] = onOpen;
|
|
263
167
|
$[8] = onSubmitItem;
|
|
264
168
|
$[9] = value;
|
|
265
|
-
$[10] =
|
|
266
|
-
$[11] =
|
|
169
|
+
$[10] = t5;
|
|
170
|
+
$[11] = t6;
|
|
267
171
|
} else {
|
|
268
|
-
|
|
269
|
-
|
|
172
|
+
t5 = $[10];
|
|
173
|
+
t6 = $[11];
|
|
270
174
|
}
|
|
271
|
-
useEffect(
|
|
175
|
+
useEffect(t5, t6);
|
|
272
176
|
const isMountedRef = useRef(false);
|
|
177
|
+
let t7;
|
|
273
178
|
let t8;
|
|
274
|
-
let t9;
|
|
275
179
|
if ($[12] !== isOpen) {
|
|
276
|
-
|
|
180
|
+
t7 = () => {
|
|
277
181
|
if (!isMountedRef.current) {
|
|
278
182
|
isMountedRef.current = true;
|
|
279
183
|
if (isOpenRef.current && onOpenRef.current) onOpenRef.current();
|
|
@@ -282,18 +186,18 @@ function Dropdown(t0) {
|
|
|
282
186
|
if (isOpen && onOpenRef.current) onOpenRef.current();
|
|
283
187
|
else if (!isOpen && onCloseRef.current) onCloseRef.current();
|
|
284
188
|
};
|
|
285
|
-
|
|
189
|
+
t8 = [isOpen];
|
|
286
190
|
$[12] = isOpen;
|
|
287
|
-
$[13] =
|
|
288
|
-
$[14] =
|
|
191
|
+
$[13] = t7;
|
|
192
|
+
$[14] = t8;
|
|
289
193
|
} else {
|
|
290
|
-
|
|
291
|
-
|
|
194
|
+
t7 = $[13];
|
|
195
|
+
t8 = $[14];
|
|
292
196
|
}
|
|
293
|
-
useEffect(
|
|
294
|
-
let
|
|
197
|
+
useEffect(t7, t8);
|
|
198
|
+
let t9;
|
|
295
199
|
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
296
|
-
|
|
200
|
+
t9 = () => {
|
|
297
201
|
setIsOpen(false);
|
|
298
202
|
setIsOpening(false);
|
|
299
203
|
mouseDownPositionRef.current = null;
|
|
@@ -302,12 +206,12 @@ function Dropdown(t0) {
|
|
|
302
206
|
closingTimerRef.current = null;
|
|
303
207
|
}
|
|
304
208
|
};
|
|
305
|
-
$[15] =
|
|
306
|
-
} else
|
|
307
|
-
const closeDropdown =
|
|
308
|
-
let
|
|
209
|
+
$[15] = t9;
|
|
210
|
+
} else t9 = $[15];
|
|
211
|
+
const closeDropdown = t9;
|
|
212
|
+
let t10;
|
|
309
213
|
if ($[16] !== dropdownElement) {
|
|
310
|
-
|
|
214
|
+
t10 = (event) => {
|
|
311
215
|
if (isOpenRef.current && !keepOpenOnSubmitRef.current) closingTimerRef.current = setTimeout(closeDropdown, 90);
|
|
312
216
|
if (!hasItemsRef.current) return;
|
|
313
217
|
const element = getActiveItemElement(dropdownElement);
|
|
@@ -343,25 +247,25 @@ function Dropdown(t0) {
|
|
|
343
247
|
});
|
|
344
248
|
};
|
|
345
249
|
$[16] = dropdownElement;
|
|
346
|
-
$[17] =
|
|
347
|
-
} else
|
|
348
|
-
const handleSubmitItem =
|
|
349
|
-
let
|
|
250
|
+
$[17] = t10;
|
|
251
|
+
} else t10 = $[17];
|
|
252
|
+
const handleSubmitItem = t10;
|
|
253
|
+
let t11;
|
|
350
254
|
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
351
|
-
|
|
352
|
-
const { clientX, clientY } =
|
|
255
|
+
t11 = (t12) => {
|
|
256
|
+
const { clientX, clientY } = t12;
|
|
353
257
|
currentInputMethodRef.current = "mouse";
|
|
354
258
|
const initialPosition = mouseDownPositionRef.current;
|
|
355
259
|
if (!initialPosition) return;
|
|
356
260
|
if (Math.abs(initialPosition.clientX - clientX) < 12 && Math.abs(initialPosition.clientY - clientY) < 12) return;
|
|
357
261
|
setIsOpening(false);
|
|
358
262
|
};
|
|
359
|
-
$[18] =
|
|
360
|
-
} else
|
|
361
|
-
const handleMouseMove =
|
|
362
|
-
let
|
|
263
|
+
$[18] = t11;
|
|
264
|
+
} else t11 = $[18];
|
|
265
|
+
const handleMouseMove = t11;
|
|
266
|
+
let t12;
|
|
363
267
|
if ($[19] !== dropdownElement || $[20] !== onActiveItem) {
|
|
364
|
-
|
|
268
|
+
t12 = (event_0) => {
|
|
365
269
|
if (!hasItemsRef.current) return;
|
|
366
270
|
if (currentInputMethodRef.current !== "mouse") return;
|
|
367
271
|
if (!dropdownElement) return;
|
|
@@ -381,12 +285,12 @@ function Dropdown(t0) {
|
|
|
381
285
|
};
|
|
382
286
|
$[19] = dropdownElement;
|
|
383
287
|
$[20] = onActiveItem;
|
|
384
|
-
$[21] =
|
|
385
|
-
} else
|
|
386
|
-
const handleMouseOver =
|
|
387
|
-
let
|
|
288
|
+
$[21] = t12;
|
|
289
|
+
} else t12 = $[21];
|
|
290
|
+
const handleMouseOver = t12;
|
|
291
|
+
let t13;
|
|
388
292
|
if ($[22] !== dropdownElement) {
|
|
389
|
-
|
|
293
|
+
t13 = (event_1) => {
|
|
390
294
|
if (!hasItemsRef.current) return;
|
|
391
295
|
const activeItem = getActiveItemElement(dropdownElement);
|
|
392
296
|
if (!activeItem) return;
|
|
@@ -395,12 +299,12 @@ function Dropdown(t0) {
|
|
|
395
299
|
delete activeItem.dataset.uktActive;
|
|
396
300
|
};
|
|
397
301
|
$[22] = dropdownElement;
|
|
398
|
-
$[23] =
|
|
399
|
-
} else
|
|
400
|
-
const handleMouseOut =
|
|
401
|
-
let
|
|
302
|
+
$[23] = t13;
|
|
303
|
+
} else t13 = $[23];
|
|
304
|
+
const handleMouseOut = t13;
|
|
305
|
+
let t14;
|
|
402
306
|
if ($[24] !== onMouseDown) {
|
|
403
|
-
|
|
307
|
+
t14 = (event_2) => {
|
|
404
308
|
if (onMouseDown) onMouseDown(event_2);
|
|
405
309
|
if (isOpenRef.current) return;
|
|
406
310
|
setIsOpen(true);
|
|
@@ -415,16 +319,16 @@ function Dropdown(t0) {
|
|
|
415
319
|
}, 1e3);
|
|
416
320
|
};
|
|
417
321
|
$[24] = onMouseDown;
|
|
418
|
-
$[25] =
|
|
419
|
-
} else
|
|
420
|
-
const handleMouseDown =
|
|
421
|
-
let
|
|
322
|
+
$[25] = t14;
|
|
323
|
+
} else t14 = $[25];
|
|
324
|
+
const handleMouseDown = t14;
|
|
325
|
+
let t15;
|
|
422
326
|
if ($[26] !== handleSubmitItem || $[27] !== onMouseUp) {
|
|
423
|
-
|
|
327
|
+
t15 = (event_3) => {
|
|
424
328
|
if (onMouseUp) onMouseUp(event_3);
|
|
425
329
|
if (isOpeningRef.current || !isOpenRef.current || closingTimerRef.current != null) return;
|
|
426
330
|
const eventTarget_1 = event_3.target;
|
|
427
|
-
if (!eventTarget_1.closest(
|
|
331
|
+
if (!eventTarget_1.closest(".uktdropdown-body")) {
|
|
428
332
|
if (!isOpeningRef.current && inputElementRef.current !== eventTarget_1.ownerDocument.activeElement) closeDropdown();
|
|
429
333
|
return;
|
|
430
334
|
}
|
|
@@ -433,12 +337,12 @@ function Dropdown(t0) {
|
|
|
433
337
|
};
|
|
434
338
|
$[26] = handleSubmitItem;
|
|
435
339
|
$[27] = onMouseUp;
|
|
436
|
-
$[28] =
|
|
437
|
-
} else
|
|
438
|
-
const handleMouseUp =
|
|
439
|
-
let
|
|
340
|
+
$[28] = t15;
|
|
341
|
+
} else t15 = $[28];
|
|
342
|
+
const handleMouseUp = t15;
|
|
343
|
+
let t16;
|
|
440
344
|
if ($[29] !== dropdownElement || $[30] !== handleSubmitItem || $[31] !== onActiveItem) {
|
|
441
|
-
|
|
345
|
+
t16 = (event_4) => {
|
|
442
346
|
const { altKey, ctrlKey, key, metaKey } = event_4;
|
|
443
347
|
const eventTarget_2 = event_4.target;
|
|
444
348
|
if (!dropdownElement) return;
|
|
@@ -526,22 +430,22 @@ function Dropdown(t0) {
|
|
|
526
430
|
$[29] = dropdownElement;
|
|
527
431
|
$[30] = handleSubmitItem;
|
|
528
432
|
$[31] = onActiveItem;
|
|
529
|
-
$[32] =
|
|
530
|
-
} else
|
|
531
|
-
const handleKeyDown =
|
|
532
|
-
let
|
|
433
|
+
$[32] = t16;
|
|
434
|
+
} else t16 = $[32];
|
|
435
|
+
const handleKeyDown = t16;
|
|
436
|
+
let t17;
|
|
533
437
|
if ($[33] !== handleKeyDown) {
|
|
534
|
-
|
|
438
|
+
t17 = {
|
|
535
439
|
ignoreUsedKeyboardEvents: false,
|
|
536
440
|
onKeyDown: handleKeyDown
|
|
537
441
|
};
|
|
538
442
|
$[33] = handleKeyDown;
|
|
539
|
-
$[34] =
|
|
540
|
-
} else
|
|
541
|
-
useKeyboardEvents(
|
|
542
|
-
let
|
|
443
|
+
$[34] = t17;
|
|
444
|
+
} else t17 = $[34];
|
|
445
|
+
useKeyboardEvents(t17);
|
|
446
|
+
let t18;
|
|
543
447
|
if ($[35] !== isOpenOnMount || $[36] !== onActiveItem) {
|
|
544
|
-
|
|
448
|
+
t18 = (ref) => {
|
|
545
449
|
setDropdownElement(ref);
|
|
546
450
|
if (!ref) return;
|
|
547
451
|
const { ownerDocument } = ref;
|
|
@@ -551,13 +455,13 @@ function Dropdown(t0) {
|
|
|
551
455
|
else inputElement = ref.firstElementChild.querySelector(TEXT_INPUT_SELECTOR);
|
|
552
456
|
inputElementRef.current = inputElement;
|
|
553
457
|
}
|
|
554
|
-
const handleGlobalMouseDown = (
|
|
555
|
-
const { target } =
|
|
458
|
+
const handleGlobalMouseDown = (t19) => {
|
|
459
|
+
const { target } = t19;
|
|
556
460
|
const eventTarget_3 = target;
|
|
557
461
|
if (!ref.contains(eventTarget_3)) closeDropdown();
|
|
558
462
|
};
|
|
559
|
-
const handleGlobalMouseUp = (
|
|
560
|
-
const { target: target_0 } =
|
|
463
|
+
const handleGlobalMouseUp = (t20) => {
|
|
464
|
+
const { target: target_0 } = t20;
|
|
561
465
|
if (!isOpenRef.current || closingTimerRef.current != null) return;
|
|
562
466
|
if (isOpeningRef.current) {
|
|
563
467
|
setIsOpening(false);
|
|
@@ -570,8 +474,8 @@ function Dropdown(t0) {
|
|
|
570
474
|
const eventTarget_4 = target_0;
|
|
571
475
|
if (!ref.contains(eventTarget_4)) closeDropdown();
|
|
572
476
|
};
|
|
573
|
-
const handleGlobalFocusIn = (
|
|
574
|
-
const { target: target_1 } =
|
|
477
|
+
const handleGlobalFocusIn = (t21) => {
|
|
478
|
+
const { target: target_1 } = t21;
|
|
575
479
|
if (!isOpenRef.current) return;
|
|
576
480
|
const eventTarget_5 = target_1;
|
|
577
481
|
if (ref.contains(eventTarget_5) || eventTarget_5.contains(ref)) return;
|
|
@@ -615,25 +519,25 @@ function Dropdown(t0) {
|
|
|
615
519
|
};
|
|
616
520
|
$[35] = isOpenOnMount;
|
|
617
521
|
$[36] = onActiveItem;
|
|
618
|
-
$[37] =
|
|
619
|
-
} else
|
|
620
|
-
const handleRef =
|
|
522
|
+
$[37] = t18;
|
|
523
|
+
} else t18 = $[37];
|
|
524
|
+
const handleRef = t18;
|
|
621
525
|
if (!isValidElement(trigger)) if (isSearchable) {
|
|
622
|
-
const
|
|
623
|
-
let
|
|
526
|
+
const t19 = value ?? "";
|
|
527
|
+
let t20;
|
|
624
528
|
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
625
|
-
|
|
626
|
-
$[38] =
|
|
627
|
-
} else
|
|
628
|
-
let
|
|
629
|
-
if ($[39] !== disabled || $[40] !== name || $[41] !== placeholder || $[42] !==
|
|
630
|
-
|
|
529
|
+
t20 = () => setIsOpen(true);
|
|
530
|
+
$[38] = t20;
|
|
531
|
+
} else t20 = $[38];
|
|
532
|
+
let t21;
|
|
533
|
+
if ($[39] !== disabled || $[40] !== name || $[41] !== placeholder || $[42] !== t19 || $[43] !== tabIndex) {
|
|
534
|
+
t21 = /* @__PURE__ */ jsx("input", {
|
|
631
535
|
autoComplete: "off",
|
|
632
|
-
className:
|
|
633
|
-
defaultValue:
|
|
536
|
+
className: "uktdropdown-trigger",
|
|
537
|
+
defaultValue: t19,
|
|
634
538
|
disabled,
|
|
635
539
|
name,
|
|
636
|
-
onFocus:
|
|
540
|
+
onFocus: t20,
|
|
637
541
|
placeholder,
|
|
638
542
|
ref: inputElementRef,
|
|
639
543
|
tabIndex,
|
|
@@ -642,124 +546,133 @@ function Dropdown(t0) {
|
|
|
642
546
|
$[39] = disabled;
|
|
643
547
|
$[40] = name;
|
|
644
548
|
$[41] = placeholder;
|
|
645
|
-
$[42] =
|
|
549
|
+
$[42] = t19;
|
|
646
550
|
$[43] = tabIndex;
|
|
647
|
-
$[44] =
|
|
648
|
-
} else
|
|
649
|
-
trigger =
|
|
551
|
+
$[44] = t21;
|
|
552
|
+
} else t21 = $[44];
|
|
553
|
+
trigger = t21;
|
|
650
554
|
} else {
|
|
651
|
-
let
|
|
555
|
+
let t19;
|
|
652
556
|
if ($[45] !== trigger) {
|
|
653
|
-
|
|
654
|
-
className:
|
|
557
|
+
t19 = /* @__PURE__ */ jsx("button", {
|
|
558
|
+
className: "uktdropdown-trigger",
|
|
655
559
|
tabIndex: 0,
|
|
656
560
|
type: "button",
|
|
657
561
|
children: trigger
|
|
658
562
|
});
|
|
659
563
|
$[45] = trigger;
|
|
660
|
-
$[46] =
|
|
661
|
-
} else
|
|
662
|
-
trigger =
|
|
564
|
+
$[46] = t19;
|
|
565
|
+
} else t19 = $[46];
|
|
566
|
+
trigger = t19;
|
|
663
567
|
}
|
|
664
568
|
if (label) {
|
|
665
|
-
let
|
|
569
|
+
let t19;
|
|
666
570
|
if ($[47] !== label) {
|
|
667
|
-
|
|
668
|
-
className:
|
|
571
|
+
t19 = /* @__PURE__ */ jsx("div", {
|
|
572
|
+
className: "uktdropdown-label-text",
|
|
669
573
|
children: label
|
|
670
574
|
});
|
|
671
575
|
$[47] = label;
|
|
672
|
-
$[48] =
|
|
673
|
-
} else
|
|
674
|
-
let
|
|
675
|
-
if ($[49] !==
|
|
676
|
-
|
|
677
|
-
className:
|
|
678
|
-
children: [
|
|
576
|
+
$[48] = t19;
|
|
577
|
+
} else t19 = $[48];
|
|
578
|
+
let t20;
|
|
579
|
+
if ($[49] !== t19 || $[50] !== trigger) {
|
|
580
|
+
t20 = /* @__PURE__ */ jsxs("label", {
|
|
581
|
+
className: "uktdropdown-label",
|
|
582
|
+
children: [t19, trigger]
|
|
679
583
|
});
|
|
680
|
-
$[49] =
|
|
584
|
+
$[49] = t19;
|
|
681
585
|
$[50] = trigger;
|
|
682
|
-
$[51] =
|
|
683
|
-
} else
|
|
684
|
-
trigger =
|
|
586
|
+
$[51] = t20;
|
|
587
|
+
} else t20 = $[51];
|
|
588
|
+
trigger = t20;
|
|
685
589
|
}
|
|
686
590
|
const dropdownRect = useBoundingClientRect(dropdownElement);
|
|
687
591
|
const dropdownBodyRect = useBoundingClientRect(dropdownBodyElement);
|
|
688
|
-
let
|
|
592
|
+
let t19;
|
|
689
593
|
if ($[52] !== dropdownBodyElement) {
|
|
690
|
-
|
|
594
|
+
t19 = getBoundingAncestor(dropdownBodyElement);
|
|
691
595
|
$[52] = dropdownBodyElement;
|
|
692
|
-
$[53] =
|
|
693
|
-
} else
|
|
694
|
-
const boundingElementRect = useBoundingClientRect(
|
|
596
|
+
$[53] = t19;
|
|
597
|
+
} else t19 = $[53];
|
|
598
|
+
const boundingElementRect = useBoundingClientRect(t19);
|
|
695
599
|
let maxHeight;
|
|
696
600
|
if (dropdownBodyRect.top != null && dropdownRect.top != null && boundingElementRect.top != null) {
|
|
697
601
|
const maxHeightUp = dropdownBodyRect.bottom - boundingElementRect.top;
|
|
698
602
|
const maxHeightDown = boundingElementRect.bottom - dropdownBodyRect.top;
|
|
699
|
-
let
|
|
603
|
+
let t20;
|
|
700
604
|
if ($[54] !== dropdownBodyRect.top || $[55] !== dropdownRect.top || $[56] !== maxHeightDown || $[57] !== maxHeightUp) {
|
|
701
|
-
|
|
605
|
+
t20 = Math.round(dropdownBodyRect.top > dropdownRect.top ? maxHeightDown : maxHeightUp);
|
|
702
606
|
$[54] = dropdownBodyRect.top;
|
|
703
607
|
$[55] = dropdownRect.top;
|
|
704
608
|
$[56] = maxHeightDown;
|
|
705
609
|
$[57] = maxHeightUp;
|
|
706
|
-
$[58] =
|
|
707
|
-
} else
|
|
708
|
-
maxHeight =
|
|
610
|
+
$[58] = t20;
|
|
611
|
+
} else t20 = $[58];
|
|
612
|
+
maxHeight = t20;
|
|
709
613
|
}
|
|
710
|
-
let
|
|
614
|
+
let t20;
|
|
711
615
|
if ($[59] !== maxHeight || $[60] !== minHeightBody) {
|
|
712
|
-
|
|
616
|
+
t20 = maxHeight != null && maxHeight > minHeightBody ? { "--uktdd-body-max-height": `calc(${maxHeight}px - var(--uktdd-body-buffer))` } : null;
|
|
713
617
|
$[59] = maxHeight;
|
|
714
618
|
$[60] = minHeightBody;
|
|
715
|
-
$[61] =
|
|
716
|
-
} else
|
|
619
|
+
$[61] = t20;
|
|
620
|
+
} else t20 = $[61];
|
|
621
|
+
let t21;
|
|
622
|
+
if ($[62] !== minWidthBody) {
|
|
623
|
+
t21 = minWidthBody != null && minWidthBody > 0 ? { "--uktdd-body-min-width": `${minWidthBody}px` } : null;
|
|
624
|
+
$[62] = minWidthBody;
|
|
625
|
+
$[63] = t21;
|
|
626
|
+
} else t21 = $[63];
|
|
717
627
|
let t22;
|
|
718
|
-
if ($[
|
|
628
|
+
if ($[64] !== styleFromProps || $[65] !== t20 || $[66] !== t21) {
|
|
719
629
|
t22 = {
|
|
720
630
|
...styleFromProps,
|
|
631
|
+
...t20,
|
|
721
632
|
...t21
|
|
722
633
|
};
|
|
723
|
-
$[
|
|
724
|
-
$[
|
|
725
|
-
$[
|
|
726
|
-
|
|
634
|
+
$[64] = styleFromProps;
|
|
635
|
+
$[65] = t20;
|
|
636
|
+
$[66] = t21;
|
|
637
|
+
$[67] = t22;
|
|
638
|
+
} else t22 = $[67];
|
|
727
639
|
const style = t22;
|
|
728
640
|
let t23;
|
|
729
|
-
if ($[
|
|
730
|
-
t23 = /* @__PURE__ */ jsx(
|
|
641
|
+
if ($[68] === Symbol.for("react.memo_cache_sentinel")) {
|
|
642
|
+
t23 = /* @__PURE__ */ jsx("style", {
|
|
731
643
|
href: "@acusti/dropdown/Dropdown",
|
|
732
|
-
|
|
644
|
+
precedence: "medium",
|
|
645
|
+
children: Dropdown_default
|
|
733
646
|
});
|
|
734
|
-
$[
|
|
735
|
-
} else t23 = $[
|
|
647
|
+
$[68] = t23;
|
|
648
|
+
} else t23 = $[68];
|
|
736
649
|
let t24;
|
|
737
|
-
if ($[
|
|
738
|
-
t24 = clsx(
|
|
650
|
+
if ($[69] !== className || $[70] !== disabled || $[71] !== isOpen || $[72] !== isSearchable) {
|
|
651
|
+
t24 = clsx("uktdropdown", className, {
|
|
739
652
|
disabled,
|
|
740
653
|
"is-open": isOpen,
|
|
741
654
|
"is-searchable": isSearchable
|
|
742
655
|
});
|
|
743
|
-
$[
|
|
744
|
-
$[
|
|
745
|
-
$[
|
|
746
|
-
$[
|
|
747
|
-
$[
|
|
748
|
-
} else t24 = $[
|
|
656
|
+
$[69] = className;
|
|
657
|
+
$[70] = disabled;
|
|
658
|
+
$[71] = isOpen;
|
|
659
|
+
$[72] = isSearchable;
|
|
660
|
+
$[73] = t24;
|
|
661
|
+
} else t24 = $[73];
|
|
749
662
|
let t25;
|
|
750
|
-
if ($[
|
|
663
|
+
if ($[74] !== children || $[75] !== childrenCount || $[76] !== isOpen) {
|
|
751
664
|
t25 = isOpen ? /* @__PURE__ */ jsx("div", {
|
|
752
|
-
className:
|
|
665
|
+
className: "uktdropdown-body",
|
|
753
666
|
ref: setDropdownBodyElement,
|
|
754
667
|
children: childrenCount > 1 ? children[1] : children
|
|
755
668
|
}) : null;
|
|
756
|
-
$[
|
|
757
|
-
$[
|
|
758
|
-
$[
|
|
759
|
-
$[
|
|
760
|
-
} else t25 = $[
|
|
669
|
+
$[74] = children;
|
|
670
|
+
$[75] = childrenCount;
|
|
671
|
+
$[76] = isOpen;
|
|
672
|
+
$[77] = t25;
|
|
673
|
+
} else t25 = $[77];
|
|
761
674
|
let t26;
|
|
762
|
-
if ($[
|
|
675
|
+
if ($[78] !== handleMouseDown || $[79] !== handleMouseOut || $[80] !== handleMouseOver || $[81] !== handleMouseUp || $[82] !== handleRef || $[83] !== onClick || $[84] !== style || $[85] !== t24 || $[86] !== t25 || $[87] !== trigger) {
|
|
763
676
|
t26 = /* @__PURE__ */ jsxs(Fragment, { children: [t23, /* @__PURE__ */ jsxs("div", {
|
|
764
677
|
className: t24,
|
|
765
678
|
onClick,
|
|
@@ -772,18 +685,18 @@ function Dropdown(t0) {
|
|
|
772
685
|
style,
|
|
773
686
|
children: [trigger, t25]
|
|
774
687
|
})] });
|
|
775
|
-
$[
|
|
776
|
-
$[
|
|
777
|
-
$[
|
|
778
|
-
$[
|
|
779
|
-
$[
|
|
780
|
-
$[
|
|
781
|
-
$[
|
|
782
|
-
$[
|
|
783
|
-
$[
|
|
784
|
-
$[
|
|
785
|
-
$[
|
|
786
|
-
} else t26 = $[
|
|
688
|
+
$[78] = handleMouseDown;
|
|
689
|
+
$[79] = handleMouseOut;
|
|
690
|
+
$[80] = handleMouseOver;
|
|
691
|
+
$[81] = handleMouseUp;
|
|
692
|
+
$[82] = handleRef;
|
|
693
|
+
$[83] = onClick;
|
|
694
|
+
$[84] = style;
|
|
695
|
+
$[85] = t24;
|
|
696
|
+
$[86] = t25;
|
|
697
|
+
$[87] = trigger;
|
|
698
|
+
$[88] = t26;
|
|
699
|
+
} else t26 = $[88];
|
|
787
700
|
return t26;
|
|
788
701
|
}
|
|
789
702
|
function getBoundingAncestor(element) {
|
package/dist/Dropdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","names":["SYSTEM_UI_FONT","ROOT_CLASS_NAME","ROOT_SELECTOR","BODY_CLASS_NAME","LABEL_CLASS_NAME","LABEL_TEXT_CLASS_NAME","TRIGGER_CLASS_NAME","BODY_SELECTOR","LABEL_SELECTOR","LABEL_TEXT_SELECTOR","TRIGGER_SELECTOR","BODY_MAX_HEIGHT_VAR","BODY_MAX_WIDTH_VAR","STYLES","getBestMatch","SyntheticEvent","Item","BODY_SELECTOR","ITEM_SELECTOR","getItemElements","dropdownElement","HTMLElement","bodyElement","querySelector","items","HTMLCollection","NodeListOf","Element","querySelectorAll","length","children","getActiveItemElement","clearItemElementsState","itemElements","Array","forEach","itemElement","hasAttribute","dataset","uktActive","BaseSetActiveItemPayload","element","event","Event","index","indexAddend","isExactMatch","onActiveItem","payload","text","setActiveItem","Omit","from","lastIndex","currentActiveIndex","findIndex","nextActiveIndex","Math","max","min","itemTexts","map","innerText","textToCompare","toLowerCase","itemText","startsWith","bestMatch","nextActiveItem","setAttribute","label","value","uktValue","parentElement","scrollableParent","isScrollable","scrollHeight","clientHeight","parentRect","getBoundingClientRect","itemRect","isAboveTop","top","isBelowBottom","bottom","scrollTop","Style","useBoundingClientRect","useKeyboardEvents","isEventTargetUsingKeyEvent","clsx","Children","CSSProperties","Fragment","isValidElement","JSX","MouseEvent","ReactMouseEvent","ReactNode","SyntheticEvent","useEffect","useRef","useState","getActiveItemElement","getItemElements","ITEM_SELECTOR","setActiveItem","BODY_CLASS_NAME","BODY_MAX_HEIGHT_VAR","BODY_SELECTOR","LABEL_CLASS_NAME","LABEL_TEXT_CLASS_NAME","ROOT_CLASS_NAME","STYLES","TRIGGER_CLASS_NAME","Item","element","MaybeHTMLElement","event","Event","HTMLElement","label","value","Props","allowCreate","allowEmpty","children","ChildrenTuple","Element","className","disabled","group","hasItems","isOpenOnMount","isSearchable","keepOpenOnSubmit","minHeightBody","minWidthBody","name","onActiveItem","payload","onClick","onClose","onMouseDown","onMouseUp","onOpen","onSubmitItem","placeholder","style","tabIndex","MousePosition","clientX","clientY","TimeoutID","ReturnType","setTimeout","CHILDREN_ERROR","CLICKABLE_SELECTOR","TEXT_INPUT_SELECTOR","Dropdown","t0","$","_c","t1","t2","t3","t4","t5","styleFromProps","undefined","childrenCount","count","Error","console","error","trigger","isOpen","setIsOpen","isOpening","setIsOpening","dropdownElement","setDropdownElement","dropdownBodyElement","setDropdownBodyElement","inputElementRef","closingTimerRef","isOpeningTimerRef","currentInputMethodRef","clearEnteredCharactersTimerRef","enteredCharactersRef","mouseDownPositionRef","allowCreateRef","allowEmptyRef","hasItemsRef","isOpenRef","isOpeningRef","keepOpenOnSubmitRef","onCloseRef","onOpenRef","onSubmitItemRef","valueRef","t6","t7","current","isMountedRef","t8","t9","t10","Symbol","for","clearTimeout","closeDropdown","t11","itemLabel","innerText","ownerDocument","activeElement","blur","nextValue","dataset","uktValue","eventTarget","target","matches","contains","click","clickableElements","querySelectorAll","length","clickableElement","handleSubmitItem","t12","t13","initialPosition","Math","abs","handleMouseMove","event_0","itemElements","eventTarget_0","item","closest","element_0","itemElement","handleMouseOver","t14","event_1","activeItem","eventRelatedTarget","relatedTarget","uktActive","handleMouseOut","t15","event_2","handleMouseDown","t16","event_3","eventTarget_1","handleMouseUp","t17","event_4","altKey","ctrlKey","key","metaKey","eventTarget_2","onEventHandled","stopPropagation","preventDefault","isEventTargetingDropdown","isTargetUsingKeyEvents","isEditingCharacters","test","slice","isExactMatch","text","index","indexAddend","handleKeyDown","t18","ignoreUsedKeyboardEvents","onKeyDown","t19","ref","inputElement","firstElementChild","HTMLInputElement","querySelector","handleGlobalMouseDown","t20","eventTarget_3","handleGlobalMouseUp","t21","target_0","eventTarget_4","handleGlobalFocusIn","t22","target_1","eventTarget_5","document","addEventListener","focus","handleInput","event_5","input","isDeleting","removeEventListener","handleRef","dropdownRect","dropdownBodyRect","getBoundingAncestor","boundingElement","boundingElementRect","maxHeight","top","maxHeightUp","bottom","maxHeightDown","round","t23","t24","t25","t26","parentElement","tagName","getComputedStyle","overflowX"],"sources":["../src/styles.ts","../src/helpers.ts","../src/Dropdown.tsx"],"sourcesContent":["import { SYSTEM_UI_FONT } from '@acusti/styling';\n\nexport const ROOT_CLASS_NAME = 'uktdropdown';\nexport const ROOT_SELECTOR = `.${ROOT_CLASS_NAME}`;\n\nexport const BODY_CLASS_NAME = `${ROOT_CLASS_NAME}-body`;\nexport const LABEL_CLASS_NAME = `${ROOT_CLASS_NAME}-label`;\nexport const LABEL_TEXT_CLASS_NAME = `${ROOT_CLASS_NAME}-label-text`;\nexport const TRIGGER_CLASS_NAME = `${ROOT_CLASS_NAME}-trigger`;\n\nexport const BODY_SELECTOR = `.${BODY_CLASS_NAME}`;\nexport const LABEL_SELECTOR = `.${LABEL_CLASS_NAME}`;\nexport const LABEL_TEXT_SELECTOR = `.${LABEL_TEXT_CLASS_NAME}`;\nexport const TRIGGER_SELECTOR = `.${TRIGGER_CLASS_NAME}`;\n\nexport const BODY_MAX_HEIGHT_VAR = '--uktdd-body-max-height';\nexport const BODY_MAX_WIDTH_VAR = '--uktdd-body-max-width';\n\nexport const STYLES = `\n:root {\n --uktdd-font-family: ${SYSTEM_UI_FONT};\n --uktdd-body-bg-color: #fff;\n --uktdd-body-bg-color-hover: rgb(105,162,249);\n --uktdd-body-color-hover: #fff;\n --uktdd-body-buffer: 10px;\n ${BODY_MAX_HEIGHT_VAR}: calc(100vh - var(--uktdd-body-buffer));\n ${BODY_MAX_WIDTH_VAR}: calc(100vw - var(--uktdd-body-buffer));\n --uktdd-body-pad-bottom: 9px;\n --uktdd-body-pad-left: 12px;\n --uktdd-body-pad-right: 12px;\n --uktdd-body-pad-top: 9px;\n --uktdd-label-pad-right: 10px;\n}\n${ROOT_SELECTOR},\n${TRIGGER_SELECTOR} {\n font-family: var(--uktdd-font-family);\n}\n${ROOT_SELECTOR} {\n width: max-content;\n anchor-scope: --uktdd-anchor;\n}\n${ROOT_SELECTOR}.disabled {\n pointer-events: none;\n}\n${ROOT_SELECTOR} > * {\n cursor: default;\n}\n${ROOT_SELECTOR} > :first-child {\n anchor-name: --uktdd-anchor;\n}\n${LABEL_SELECTOR} {\n display: flex;\n align-items: center;\n}\n${LABEL_TEXT_SELECTOR} {\n padding-right: var(--uktdd-label-pad-right);\n}\n${BODY_SELECTOR} {\n box-sizing: border-box;\n position: absolute;\n position-anchor: --uktdd-anchor;\n top: anchor(bottom);\n left: anchor(left);\n bottom: auto;\n right: auto;\n position-try-fallbacks: --uktdd-top-left, --uktdd-bottom-right, --uktdd-top-right;\n min-height: 50px;\n max-height: var(${BODY_MAX_HEIGHT_VAR});\n min-width: min(50px, 100%);\n max-width: var(${BODY_MAX_WIDTH_VAR});\n overflow: auto;\n z-index: 2;\n padding: var(--uktdd-body-pad-top) var(--uktdd-body-pad-right) var(--uktdd-body-pad-bottom) var(--uktdd-body-pad-left);\n background-color: var(--uktdd-body-bg-color);\n box-shadow: 0 8px 18px rgba(0,0,0,0.25);\n}\n@position-try --uktdd-top-left {\n bottom: anchor(top);\n left: anchor(left);\n top: auto;\n right: auto;\n}\n@position-try --uktdd-bottom-right {\n top: anchor(bottom);\n right: anchor(right);\n bottom: auto;\n left: auto;\n}\n@position-try --uktdd-top-right {\n bottom: anchor(top);\n right: anchor(right);\n top: auto;\n left: auto;\n}\n${BODY_SELECTOR}.has-items {\n user-select: none;\n}\n${BODY_SELECTOR} [data-ukt-active] {\n background-color: var(--uktdd-body-bg-color-hover);\n color: var(--uktdd-body-color-hover);\n}\n`;\n","import { getBestMatch } from '@acusti/matchmaking';\nimport { type SyntheticEvent } from 'react';\n\nimport { type Item } from './Dropdown.js';\nimport { BODY_SELECTOR } from './styles.js';\n\nexport const ITEM_SELECTOR = `[data-ukt-item], [data-ukt-value]`;\n\nexport const getItemElements = (dropdownElement: HTMLElement | null) => {\n if (!dropdownElement) return null;\n\n const bodyElement = dropdownElement.querySelector(BODY_SELECTOR);\n if (!bodyElement) return null;\n\n let items: HTMLCollection | NodeListOf<Element> =\n bodyElement.querySelectorAll(ITEM_SELECTOR);\n\n if (items.length) return items;\n // If no items found via [data-ukt-item] or [data-ukt-value] selector,\n // use first instance of multiple children found\n items = bodyElement.children;\n while (items.length === 1) {\n if (items[0].children == null) break;\n items = items[0].children;\n }\n // If unable to find an element with more than one child, treat direct child as items\n if (items.length === 1) {\n items = bodyElement.children;\n }\n return items;\n};\n\nexport const getActiveItemElement = (dropdownElement: HTMLElement | null) => {\n if (!dropdownElement) return null;\n return dropdownElement.querySelector('[data-ukt-active]') as HTMLElement | null;\n};\n\nconst clearItemElementsState = (itemElements: Array<HTMLElement>) => {\n itemElements.forEach((itemElement) => {\n if (itemElement.hasAttribute('data-ukt-active')) {\n delete itemElement.dataset.uktActive;\n }\n });\n};\n\ntype BaseSetActiveItemPayload = {\n dropdownElement: HTMLElement;\n element?: null;\n event: Event | SyntheticEvent<HTMLElement>;\n index?: null;\n indexAddend?: null;\n isExactMatch?: null;\n onActiveItem?: (payload: Item) => void;\n text?: null;\n};\n\nexport const setActiveItem = ({\n dropdownElement,\n element,\n event,\n index,\n indexAddend,\n isExactMatch,\n onActiveItem,\n text,\n}:\n | ({\n element: HTMLElement;\n } & Omit<BaseSetActiveItemPayload, 'element'>)\n | ({\n index: number;\n } & Omit<BaseSetActiveItemPayload, 'index'>)\n | ({\n indexAddend: number;\n } & Omit<BaseSetActiveItemPayload, 'indexAddend'>)\n | ({\n isExactMatch?: boolean;\n text: string;\n } & Omit<BaseSetActiveItemPayload, 'isExactMatch' | 'text'>)) => {\n const items = getItemElements(dropdownElement);\n if (!items) return;\n\n const itemElements = Array.from(items) as Array<HTMLElement>;\n if (!itemElements.length) return;\n\n const lastIndex = itemElements.length - 1;\n const currentActiveIndex = itemElements.findIndex((itemElement) =>\n itemElement.hasAttribute('data-ukt-active'),\n );\n\n let nextActiveIndex = currentActiveIndex;\n if (typeof index === 'number') {\n // Negative index means count back from the end\n nextActiveIndex = index < 0 ? itemElements.length + index : index;\n }\n\n if (element) {\n nextActiveIndex = itemElements.findIndex(\n (itemElement) => itemElement === element,\n );\n } else if (typeof indexAddend === 'number') {\n // If there’s no currentActiveIndex and we are handling -1, start at lastIndex\n if (currentActiveIndex === -1 && indexAddend === -1) {\n nextActiveIndex = lastIndex;\n } else {\n nextActiveIndex += indexAddend;\n }\n // Keep it within the bounds of the items list\n nextActiveIndex = Math.max(0, Math.min(nextActiveIndex, lastIndex));\n } else if (typeof text === 'string') {\n // If text is empty, clear existing active items and early return\n if (!text) {\n clearItemElementsState(itemElements);\n return;\n }\n\n const itemTexts = itemElements.map((itemElement) => itemElement.innerText);\n if (isExactMatch) {\n const textToCompare = text.toLowerCase();\n nextActiveIndex = itemTexts.findIndex((itemText) =>\n itemText.toLowerCase().startsWith(textToCompare),\n );\n // If isExactMatch is required and no exact match was found, clear active items\n if (nextActiveIndex === -1) {\n clearItemElementsState(itemElements);\n }\n } else {\n const bestMatch = getBestMatch({ items: itemTexts, text });\n nextActiveIndex = itemTexts.findIndex((itemText) => itemText === bestMatch);\n }\n }\n\n const nextActiveItem = items[nextActiveIndex] as HTMLElement | null;\n if (nextActiveItem == null || nextActiveIndex === currentActiveIndex) return;\n\n // Clear any existing active dropdown body item state\n clearItemElementsState(itemElements);\n nextActiveItem.setAttribute('data-ukt-active', '');\n const label = nextActiveItem.innerText;\n const value = nextActiveItem.dataset.uktValue ?? label;\n onActiveItem?.({ element: nextActiveItem, event, label, value });\n // Find closest scrollable parent and ensure that next active item is visible\n let { parentElement } = nextActiveItem;\n let scrollableParent = null;\n while (!scrollableParent && parentElement && parentElement !== dropdownElement) {\n const isScrollable = parentElement.scrollHeight > parentElement.clientHeight + 15;\n if (isScrollable) {\n scrollableParent = parentElement;\n } else {\n parentElement = parentElement.parentElement;\n }\n }\n\n if (scrollableParent) {\n const parentRect = scrollableParent.getBoundingClientRect();\n const itemRect = nextActiveItem.getBoundingClientRect();\n const isAboveTop = itemRect.top < parentRect.top;\n const isBelowBottom = itemRect.bottom > parentRect.bottom;\n if (isAboveTop || isBelowBottom) {\n let { scrollTop } = scrollableParent;\n // Item isn’t fully visible; adjust scrollTop to put item within closest edge\n if (isAboveTop) {\n scrollTop -= parentRect.top - itemRect.top;\n } else {\n scrollTop += itemRect.bottom - parentRect.bottom;\n }\n scrollableParent.scrollTop = scrollTop;\n }\n }\n};\n","/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/mouse-events-have-key-events, jsx-a11y/no-static-element-interactions */\nimport { Style } from '@acusti/styling';\nimport useBoundingClientRect from '@acusti/use-bounding-client-rect';\nimport useKeyboardEvents, {\n isEventTargetUsingKeyEvent,\n} from '@acusti/use-keyboard-events';\nimport clsx from 'clsx';\nimport {\n Children,\n type CSSProperties,\n Fragment,\n isValidElement,\n type JSX,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type SyntheticEvent,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport {\n getActiveItemElement,\n getItemElements,\n ITEM_SELECTOR,\n setActiveItem,\n} from './helpers.js';\nimport {\n BODY_CLASS_NAME,\n BODY_MAX_HEIGHT_VAR,\n BODY_SELECTOR,\n LABEL_CLASS_NAME,\n LABEL_TEXT_CLASS_NAME,\n ROOT_CLASS_NAME,\n STYLES,\n TRIGGER_CLASS_NAME,\n} from './styles.js';\n\nexport type Item = {\n element: MaybeHTMLElement;\n event: Event | SyntheticEvent<HTMLElement>;\n label: string;\n value: string;\n};\n\nexport type Props = {\n /**\n * Boolean indicating if the user can submit a value not already in the\n * dropdown.\n */\n allowCreate?: boolean;\n /**\n * Boolean indicating if the user can submit an empty value (i.e. clear\n * the value). Defaults to true.\n */\n allowEmpty?: boolean;\n /**\n * Can take a single React element or exactly two renderable children.\n */\n children: ChildrenTuple | JSX.Element;\n className?: string;\n disabled?: boolean;\n /**\n * Group identifier string links dropdowns together into a menu\n * (like macOS top menubar).\n */\n group?: string;\n hasItems?: boolean;\n isOpenOnMount?: boolean;\n isSearchable?: boolean;\n keepOpenOnSubmit?: boolean;\n label?: string;\n minHeightBody?: number;\n minWidthBody?: number;\n /**\n * Only usable in conjunction with {isSearchable: true}.\n * Used as search input’s name.\n */\n name?: string;\n onActiveItem?: (payload: Item) => void;\n onClick?: (event: ReactMouseEvent<HTMLElement>) => unknown;\n onClose?: () => unknown;\n onMouseDown?: (event: ReactMouseEvent<HTMLElement>) => unknown;\n onMouseUp?: (event: ReactMouseEvent<HTMLElement>) => unknown;\n onOpen?: () => unknown;\n onSubmitItem?: (payload: Item) => void;\n /**\n * Only usable in conjunction with {isSearchable: true}.\n * Used as search input’s placeholder.\n */\n placeholder?: string;\n style?: CSSProperties;\n /**\n * Only usable in conjunction with {isSearchable: true}.\n * Used as search input’s tabIndex.\n */\n tabIndex?: number;\n /**\n * Used as search input’s value if props.isSearchable === true\n * Used to determine if value has changed to avoid triggering onSubmitItem if not\n */\n value?: string;\n};\n\ntype ChildrenTuple = [ReactNode, ReactNode] | readonly [ReactNode, ReactNode];\n\ntype MaybeHTMLElement = HTMLElement | null;\n\ntype MousePosition = { clientX: number; clientY: number };\n\ntype TimeoutID = ReturnType<typeof setTimeout>;\n\nconst CHILDREN_ERROR =\n '@acusti/dropdown requires either 1 child (the dropdown body) or 2 children: the dropdown trigger and the dropdown body.';\nconst CLICKABLE_SELECTOR = 'button, a[href], input[type=\"button\"], input[type=\"submit\"]';\nconst TEXT_INPUT_SELECTOR =\n 'input:not([type=radio]):not([type=checkbox]):not([type=range]),textarea';\n\nexport default function Dropdown({\n allowCreate,\n allowEmpty = true,\n children,\n className,\n disabled,\n hasItems = true,\n isOpenOnMount,\n isSearchable,\n keepOpenOnSubmit = !hasItems,\n label,\n minHeightBody = 30,\n minWidthBody = 100,\n name,\n onActiveItem,\n onClick,\n onClose,\n onMouseDown,\n onMouseUp,\n onOpen,\n onSubmitItem,\n placeholder,\n style: styleFromProps,\n tabIndex,\n value,\n}: Props) {\n const childrenCount = Children.count(children);\n if (childrenCount !== 1 && childrenCount !== 2) {\n if (childrenCount === 0) {\n throw new Error(CHILDREN_ERROR + ' Received no children.');\n }\n console.error(`${CHILDREN_ERROR} Received ${childrenCount} children.`);\n }\n\n let trigger: React.ReactNode;\n if (childrenCount > 1) {\n trigger = (children as ChildrenTuple)[0];\n }\n\n const [isOpen, setIsOpen] = useState<boolean>(isOpenOnMount ?? false);\n const [isOpening, setIsOpening] = useState<boolean>(!isOpenOnMount);\n const [dropdownElement, setDropdownElement] = useState<MaybeHTMLElement>(null);\n const [dropdownBodyElement, setDropdownBodyElement] =\n useState<MaybeHTMLElement>(null);\n const inputElementRef = useRef<HTMLInputElement | null>(null);\n const closingTimerRef = useRef<null | TimeoutID>(null);\n const isOpeningTimerRef = useRef<null | TimeoutID>(null);\n const currentInputMethodRef = useRef<'keyboard' | 'mouse'>('mouse');\n const clearEnteredCharactersTimerRef = useRef<null | TimeoutID>(null);\n const enteredCharactersRef = useRef<string>('');\n const mouseDownPositionRef = useRef<MousePosition | null>(null);\n\n const allowCreateRef = useRef(allowCreate);\n const allowEmptyRef = useRef(allowEmpty);\n const hasItemsRef = useRef(hasItems);\n const isOpenRef = useRef(isOpen);\n const isOpeningRef = useRef(isOpening);\n const keepOpenOnSubmitRef = useRef(keepOpenOnSubmit);\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n const onSubmitItemRef = useRef(onSubmitItem);\n const valueRef = useRef(value);\n\n useEffect(() => {\n allowCreateRef.current = allowCreate;\n allowEmptyRef.current = allowEmpty;\n hasItemsRef.current = hasItems;\n isOpenRef.current = isOpen;\n isOpeningRef.current = isOpening;\n keepOpenOnSubmitRef.current = keepOpenOnSubmit;\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n onSubmitItemRef.current = onSubmitItem;\n valueRef.current = value;\n }, [\n allowCreate,\n allowEmpty,\n hasItems,\n isOpen,\n isOpening,\n keepOpenOnSubmit,\n onClose,\n onOpen,\n onSubmitItem,\n value,\n ]);\n\n const isMountedRef = useRef(false);\n\n useEffect(() => {\n if (!isMountedRef.current) {\n isMountedRef.current = true;\n // If isOpenOnMount, trigger onOpen right away\n if (isOpenRef.current && onOpenRef.current) {\n onOpenRef.current();\n }\n return;\n }\n\n if (isOpen && onOpenRef.current) {\n onOpenRef.current();\n } else if (!isOpen && onCloseRef.current) {\n onCloseRef.current();\n }\n }, [isOpen]);\n\n const closeDropdown = () => {\n setIsOpen(false);\n setIsOpening(false);\n mouseDownPositionRef.current = null;\n if (closingTimerRef.current != null) {\n clearTimeout(closingTimerRef.current);\n closingTimerRef.current = null;\n }\n };\n\n const handleSubmitItem = (event: Event | React.SyntheticEvent<HTMLElement>) => {\n if (isOpenRef.current && !keepOpenOnSubmitRef.current) {\n // A short timeout before closing is better UX when user selects an item so dropdown\n // doesn’t close before expected. It also enables using <Link />s in the dropdown body.\n closingTimerRef.current = setTimeout(closeDropdown, 90);\n }\n\n if (!hasItemsRef.current) return;\n\n const element = getActiveItemElement(dropdownElement);\n if (!element && !allowCreateRef.current) {\n // If not allowEmpty, don’t allow submitting an empty item\n if (!allowEmptyRef.current) return;\n // If we have an input element as trigger & the user didn’t clear the text, do nothing\n if (inputElementRef.current?.value) return;\n }\n\n let itemLabel = element?.innerText ?? '';\n if (inputElementRef.current) {\n if (!element) {\n itemLabel = inputElementRef.current.value;\n } else {\n inputElementRef.current.value = itemLabel;\n }\n\n if (\n inputElementRef.current ===\n inputElementRef.current.ownerDocument.activeElement\n ) {\n inputElementRef.current.blur();\n }\n }\n\n const nextValue = element?.dataset.uktValue ?? itemLabel;\n // If parent is controlling Dropdown via props.value and nextValue is the same, do nothing\n if (valueRef.current && valueRef.current === nextValue) return;\n\n // If the item is clickable or contains exactly one clickable element, invoke it\n // (but only if the event didn’t already originate from that element)\n if (element) {\n const eventTarget = event.target as HTMLElement;\n\n if (element.matches(CLICKABLE_SELECTOR)) {\n // The item element itself is clickable (e.g., <button data-ukt-value=\"…\">)\n if (element !== eventTarget && !element.contains(eventTarget)) {\n element.click();\n }\n } else {\n // Check if item contains exactly one clickable child element\n const clickableElements = element.querySelectorAll(CLICKABLE_SELECTOR);\n if (clickableElements.length === 1) {\n const clickableElement = clickableElements[0] as HTMLElement;\n if (\n clickableElement !== eventTarget &&\n !clickableElement.contains(eventTarget)\n ) {\n clickableElement.click();\n }\n }\n }\n }\n\n onSubmitItemRef.current?.({\n element,\n event,\n label: itemLabel,\n value: nextValue,\n });\n };\n\n const handleMouseMove = ({ clientX, clientY }: ReactMouseEvent<HTMLElement>) => {\n currentInputMethodRef.current = 'mouse';\n const initialPosition = mouseDownPositionRef.current;\n if (!initialPosition) return;\n if (\n Math.abs(initialPosition.clientX - clientX) < 12 &&\n Math.abs(initialPosition.clientY - clientY) < 12\n ) {\n return;\n }\n setIsOpening(false);\n };\n\n const handleMouseOver = (event: ReactMouseEvent<HTMLElement>) => {\n if (!hasItemsRef.current) return;\n\n // If user isn’t currently using the mouse to navigate the dropdown, do nothing\n if (currentInputMethodRef.current !== 'mouse') return;\n\n // Ensure we have the dropdown root HTMLElement\n if (!dropdownElement) return;\n\n const itemElements = getItemElements(dropdownElement);\n if (!itemElements) return;\n\n const eventTarget = event.target as HTMLElement;\n const item = eventTarget.closest(ITEM_SELECTOR) as MaybeHTMLElement;\n const element = item ?? eventTarget;\n for (const itemElement of itemElements) {\n if (itemElement === element) {\n setActiveItem({ dropdownElement, element, event, onActiveItem });\n return;\n }\n }\n };\n\n const handleMouseOut = (event: ReactMouseEvent<HTMLElement>) => {\n if (!hasItemsRef.current) return;\n const activeItem = getActiveItemElement(dropdownElement);\n if (!activeItem) return;\n const eventRelatedTarget = event.relatedTarget as HTMLElement;\n if (activeItem !== event.target || activeItem.contains(eventRelatedTarget)) {\n return;\n }\n // If user moused out of activeItem (not into a descendant), it’s no longer active\n delete activeItem.dataset.uktActive;\n };\n\n const handleMouseDown = (event: ReactMouseEvent<HTMLElement>) => {\n if (onMouseDown) onMouseDown(event);\n if (isOpenRef.current) return;\n\n setIsOpen(true);\n setIsOpening(true);\n mouseDownPositionRef.current = {\n clientX: event.clientX,\n clientY: event.clientY,\n };\n isOpeningTimerRef.current = setTimeout(() => {\n setIsOpening(false);\n isOpeningTimerRef.current = null;\n }, 1000);\n };\n\n const handleMouseUp = (event: ReactMouseEvent<HTMLElement>) => {\n if (onMouseUp) onMouseUp(event);\n // If dropdown is still opening or isn’t open or is closing, do nothing\n if (\n isOpeningRef.current ||\n !isOpenRef.current ||\n closingTimerRef.current != null\n ) {\n return;\n }\n\n const eventTarget = event.target as HTMLElement;\n // If click was outside dropdown body, don’t trigger submit\n if (!eventTarget.closest(BODY_SELECTOR)) {\n // Don’t close dropdown if isOpening or search input is focused\n if (\n !isOpeningRef.current &&\n inputElementRef.current !== eventTarget.ownerDocument.activeElement\n ) {\n closeDropdown();\n }\n return;\n }\n\n // If dropdown has no items and click was within dropdown body, do nothing\n if (!hasItemsRef.current) return;\n\n handleSubmitItem(event);\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const { altKey, ctrlKey, key, metaKey } = event;\n const eventTarget = event.target as HTMLElement;\n if (!dropdownElement) return;\n\n const onEventHandled = () => {\n event.stopPropagation();\n event.preventDefault();\n currentInputMethodRef.current = 'keyboard';\n };\n\n const isEventTargetingDropdown = dropdownElement.contains(eventTarget);\n\n if (!isOpenRef.current) {\n // If dropdown is closed, don’t handle key events if event target isn’t within dropdown\n if (!isEventTargetingDropdown) return;\n // Open the dropdown on spacebar, enter, or if isSearchable and user hits the ↑/↓ arrows\n if (\n key === ' ' ||\n key === 'Enter' ||\n (hasItemsRef.current && (key === 'ArrowUp' || key === 'ArrowDown'))\n ) {\n onEventHandled();\n setIsOpen(true);\n }\n return;\n }\n\n const isTargetUsingKeyEvents = isEventTargetUsingKeyEvent(event);\n\n // If dropdown isOpen + hasItems & eventTargetNotUsingKeyEvents, handle characters\n if (hasItemsRef.current && !isTargetUsingKeyEvents) {\n let isEditingCharacters = !ctrlKey && !metaKey && /^[A-Za-z0-9]$/.test(key);\n // User could also be editing characters if there are already characters entered\n // and they are hitting delete or spacebar\n if (!isEditingCharacters && enteredCharactersRef.current) {\n isEditingCharacters = key === ' ' || key === 'Backspace';\n }\n\n if (isEditingCharacters) {\n onEventHandled();\n if (key === 'Backspace') {\n enteredCharactersRef.current = enteredCharactersRef.current.slice(\n 0,\n -1,\n );\n } else {\n enteredCharactersRef.current += key;\n }\n\n setActiveItem({\n dropdownElement,\n event,\n // If props.allowCreate, only override the input’s value with an\n // exact text match so user can enter a value not in items\n isExactMatch: allowCreateRef.current,\n onActiveItem,\n text: enteredCharactersRef.current,\n });\n\n if (clearEnteredCharactersTimerRef.current != null) {\n clearTimeout(clearEnteredCharactersTimerRef.current);\n }\n\n clearEnteredCharactersTimerRef.current = setTimeout(() => {\n enteredCharactersRef.current = '';\n clearEnteredCharactersTimerRef.current = null;\n }, 1500);\n\n return;\n }\n }\n\n // If dropdown isOpen, handle submitting the value\n if (key === 'Enter' || (key === ' ' && !inputElementRef.current)) {\n onEventHandled();\n handleSubmitItem(event);\n return;\n }\n\n // If dropdown isOpen, handle closing it on escape or spacebar if !hasItems\n if (\n key === 'Escape' ||\n (isEventTargetingDropdown && key === ' ' && !hasItemsRef.current)\n ) {\n // Close dropdown if hasItems or event target not using key events\n if (hasItemsRef.current || !isTargetUsingKeyEvents) {\n closeDropdown();\n }\n return;\n }\n\n // Handle ↑/↓ arrows\n if (hasItemsRef.current) {\n if (key === 'ArrowUp') {\n onEventHandled();\n if (altKey || metaKey) {\n setActiveItem({ dropdownElement, event, index: 0, onActiveItem });\n } else {\n setActiveItem({\n dropdownElement,\n event,\n indexAddend: -1,\n onActiveItem,\n });\n }\n return;\n }\n if (key === 'ArrowDown') {\n onEventHandled();\n if (altKey || metaKey) {\n // Using a negative index counts back from the end\n setActiveItem({ dropdownElement, event, index: -1, onActiveItem });\n } else {\n setActiveItem({\n dropdownElement,\n event,\n indexAddend: 1,\n onActiveItem,\n });\n }\n return;\n }\n }\n };\n\n useKeyboardEvents({ ignoreUsedKeyboardEvents: false, onKeyDown: handleKeyDown });\n\n const handleRef = (ref: HTMLDivElement | null): (() => void) | void => {\n setDropdownElement(ref);\n if (!ref) return;\n\n const { ownerDocument } = ref;\n let inputElement = inputElementRef.current;\n // Check if trigger is a textual input or textarea element\n if (!inputElement && ref.firstElementChild) {\n if (ref.firstElementChild.matches(TEXT_INPUT_SELECTOR)) {\n inputElement = ref.firstElementChild as HTMLInputElement;\n } else {\n inputElement = ref.firstElementChild.querySelector(TEXT_INPUT_SELECTOR);\n }\n inputElementRef.current = inputElement;\n }\n\n const handleGlobalMouseDown = ({ target }: MouseEvent) => {\n const eventTarget = target as HTMLElement;\n if (!ref.contains(eventTarget)) {\n // Close dropdown on an outside click\n closeDropdown();\n }\n };\n\n const handleGlobalMouseUp = ({ target }: MouseEvent) => {\n if (!isOpenRef.current || closingTimerRef.current != null) return;\n\n // If still isOpening (gets set false 1s after open triggers), set it to false onMouseUp\n if (isOpeningRef.current) {\n setIsOpening(false);\n if (isOpeningTimerRef.current != null) {\n clearTimeout(isOpeningTimerRef.current);\n isOpeningTimerRef.current = null;\n }\n return;\n }\n\n const eventTarget = target as HTMLElement;\n // Only handle mouseup events from outside the dropdown here\n if (!ref.contains(eventTarget)) {\n closeDropdown();\n }\n };\n\n // Close dropdown if any element is focused outside of this dropdown\n const handleGlobalFocusIn = ({ target }: Event) => {\n if (!isOpenRef.current) return;\n\n const eventTarget = target as HTMLElement;\n // If focused element is a descendant or a parent of the dropdown, do nothing\n if (ref.contains(eventTarget) || eventTarget.contains(ref)) {\n return;\n }\n\n closeDropdown();\n };\n\n document.addEventListener('focusin', handleGlobalFocusIn);\n document.addEventListener('mousedown', handleGlobalMouseDown);\n document.addEventListener('mouseup', handleGlobalMouseUp);\n\n if (ownerDocument !== document) {\n ownerDocument.addEventListener('focusin', handleGlobalFocusIn);\n ownerDocument.addEventListener('mousedown', handleGlobalMouseDown);\n ownerDocument.addEventListener('mouseup', handleGlobalMouseUp);\n }\n\n // If dropdown should be open on mount, focus it\n if (isOpenOnMount) {\n ref.focus();\n }\n\n const handleInput = (event: Event) => {\n if (!isOpenRef.current) setIsOpen(true);\n\n const input = event.target as HTMLInputElement;\n const isDeleting = enteredCharactersRef.current.length > input.value.length;\n enteredCharactersRef.current = input.value;\n // When deleting text, if there’s already an active item and\n // input isn’t empty, preserve the active item, else update it\n if (isDeleting && input.value.length && getActiveItemElement(ref)) {\n return;\n }\n\n setActiveItem({\n dropdownElement: ref,\n event,\n // If props.allowCreate, only override the input’s value with an\n // exact text match so user can enter a value not in items\n isExactMatch: allowCreateRef.current,\n onActiveItem,\n text: enteredCharactersRef.current,\n });\n };\n\n if (inputElement) {\n inputElement.addEventListener('input', handleInput);\n }\n\n return () => {\n document.removeEventListener('focusin', handleGlobalFocusIn);\n document.removeEventListener('mousedown', handleGlobalMouseDown);\n document.removeEventListener('mouseup', handleGlobalMouseUp);\n\n if (ownerDocument !== document) {\n ownerDocument.removeEventListener('focusin', handleGlobalFocusIn);\n ownerDocument.removeEventListener('mousedown', handleGlobalMouseDown);\n ownerDocument.removeEventListener('mouseup', handleGlobalMouseUp);\n }\n\n if (inputElement) {\n inputElement.removeEventListener('input', handleInput);\n }\n };\n };\n\n if (!isValidElement(trigger)) {\n if (isSearchable) {\n trigger = (\n <input\n autoComplete=\"off\"\n className={TRIGGER_CLASS_NAME}\n defaultValue={value ?? ''}\n disabled={disabled}\n name={name}\n onFocus={() => setIsOpen(true)}\n placeholder={placeholder}\n ref={inputElementRef}\n tabIndex={tabIndex}\n type=\"text\"\n />\n );\n } else {\n trigger = (\n <button className={TRIGGER_CLASS_NAME} tabIndex={0} type=\"button\">\n {trigger}\n </button>\n );\n }\n }\n\n if (label) {\n trigger = (\n <label className={LABEL_CLASS_NAME}>\n <div className={LABEL_TEXT_CLASS_NAME}>{label}</div>\n {trigger}\n </label>\n );\n }\n\n const dropdownRect = useBoundingClientRect(dropdownElement);\n const dropdownBodyRect = useBoundingClientRect(dropdownBodyElement);\n const boundingElement = getBoundingAncestor(dropdownBodyElement);\n const boundingElementRect = useBoundingClientRect(boundingElement);\n let maxHeight;\n if (\n dropdownBodyRect.top != null &&\n dropdownRect.top != null &&\n boundingElementRect.top != null\n ) {\n const maxHeightUp = dropdownBodyRect.bottom - boundingElementRect.top;\n const maxHeightDown = boundingElementRect.bottom - dropdownBodyRect.top;\n maxHeight = Math.round(\n dropdownBodyRect.top > dropdownRect.top ? maxHeightDown : maxHeightUp,\n );\n }\n\n const style = {\n ...styleFromProps,\n ...(maxHeight != null && maxHeight > minHeightBody\n ? { [BODY_MAX_HEIGHT_VAR]: `calc(${maxHeight}px - var(--uktdd-body-buffer))` }\n : null),\n };\n\n return (\n <Fragment>\n <Style href=\"@acusti/dropdown/Dropdown\">{STYLES}</Style>\n <div\n className={clsx(ROOT_CLASS_NAME, className, {\n disabled,\n 'is-open': isOpen,\n 'is-searchable': isSearchable,\n })}\n onClick={onClick}\n onMouseDown={handleMouseDown}\n onMouseMove={handleMouseMove}\n onMouseOut={handleMouseOut}\n onMouseOver={handleMouseOver}\n onMouseUp={handleMouseUp}\n ref={handleRef}\n style={style}\n >\n {trigger}\n {/* TODO next version of Dropdown should use <Activity> for body https://react.dev/reference/react/Activity */}\n {isOpen ? (\n <div className={BODY_CLASS_NAME} ref={setDropdownBodyElement}>\n {childrenCount > 1 ? (children as ChildrenTuple)[1] : children}\n </div>\n ) : null}\n </div>\n </Fragment>\n );\n}\n\nfunction getBoundingAncestor(element?: MaybeHTMLElement): MaybeHTMLElement {\n while (element?.parentElement) {\n // If we’ve reached the body, use that as boundingElement\n if (element.parentElement.tagName === 'BODY') return element.parentElement;\n // Only need to check one overflow direction, because if either direction\n // is not visible, neither can be visible\n if (getComputedStyle(element.parentElement).overflowX !== 'visible') {\n return element.parentElement;\n }\n\n element = element.parentElement as MaybeHTMLElement;\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;AAEA,MAAaC,kBAAkB;AAC/B,MAAaC,gBAAgB,IAAID;AAEjC,MAAaE,kBAAkB,GAAGF,gBAAe;AACjD,MAAaG,mBAAmB,GAAGH,gBAAe;AAClD,MAAaI,wBAAwB,GAAGJ,gBAAe;AACvD,MAAaK,qBAAqB,GAAGL,gBAAe;AAEpD,MAAaM,gBAAgB,IAAIJ;AACjC,MAAaK,iBAAiB,IAAIJ;AAClC,MAAaK,sBAAsB,IAAIJ;AACvC,MAAaK,mBAAmB,IAAIJ;AAEpC,MAAaK,sBAAsB;AACnC,MAAaC,qBAAqB;AAElC,MAAaC,SAAS;;yBAEGb,eAAc;;;;;IAKnCW,oBAAmB;IACnBC,mBAAkB;;;;;;;EAOpBV,cAAa;EACbQ,iBAAgB;;;EAGhBR,cAAa;;;;EAIbA,cAAa;;;EAGbA,cAAa;;;EAGbA,cAAa;;;EAGbM,eAAc;;;;EAIdC,oBAAmB;;;EAGnBF,cAAa;;;;;;;;;;oBAUKI,oBAAmB;;mBAEpBC,mBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;EAyBnCL,cAAa;;;EAGbA,cAAa;;;;;AC3Ff,MAAaW,gBAAgB;AAE7B,MAAaC,mBAAmBC,oBAAwC;AACpE,KAAI,CAACA,gBAAiB,QAAO;CAE7B,MAAME,cAAcF,gBAAgB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MAAA0F;AAAA1F,IAAA,MAAAmF;AAAAnF,IAAA,MAAAiG;AAAAjG,IAAA,MAAAkJ;AAAAlJ,IAAA,MAAApB;AAAAoB,IAAA,MAAAb;AAAAa,IAAA,MAAA+J;AAAA/J,IAAA,MAAAgK;AAAAhK,IAAA,MAAAc;AAAAd,IAAA,MAAAiK;OAAAA,OAAAjK,EAAA;AAAA,QAzBXiK;;AA6BR,SAASZ,oBAAoBlM,SAA8C;AACvE,QAAOA,SAAS+M,eAAe;AAE3B,MAAI/M,QAAQ+M,cAAcC,YAAY,OAAQ,QAAOhN,QAAQ+M;AAG7D,MAAIE,iBAAiBjN,QAAQ+M,cAAc,CAACG,cAAc,UACtD,QAAOlN,QAAQ+M;AAGnB/M,YAAUA,QAAQ+M;;AAGtB,QAAO"}
|
|
1
|
+
{"version":3,"file":"Dropdown.js","names":["getBestMatch","SyntheticEvent","Item","ITEM_SELECTOR","getItemElements","dropdownElement","HTMLElement","bodyElement","querySelector","items","HTMLCollection","NodeListOf","Element","querySelectorAll","length","children","getActiveItemElement","clearItemElementsState","itemElements","Array","forEach","itemElement","hasAttribute","dataset","uktActive","BaseSetActiveItemPayload","element","event","Event","index","indexAddend","isExactMatch","onActiveItem","payload","text","setActiveItem","Omit","from","lastIndex","currentActiveIndex","findIndex","nextActiveIndex","Math","max","min","itemTexts","map","innerText","textToCompare","toLowerCase","itemText","startsWith","bestMatch","nextActiveItem","setAttribute","label","value","uktValue","parentElement","scrollableParent","isScrollable","scrollHeight","clientHeight","parentRect","getBoundingClientRect","itemRect","isAboveTop","top","isBelowBottom","bottom","scrollTop","useBoundingClientRect","useKeyboardEvents","isEventTargetUsingKeyEvent","clsx","Children","CSSProperties","Fragment","isValidElement","JSX","MouseEvent","ReactMouseEvent","ReactNode","SyntheticEvent","useEffect","useRef","useState","styles","getActiveItemElement","getItemElements","ITEM_SELECTOR","setActiveItem","Item","element","MaybeHTMLElement","event","Event","HTMLElement","label","value","Props","allowCreate","allowEmpty","children","ChildrenTuple","Element","className","disabled","group","hasItems","isOpenOnMount","isSearchable","keepOpenOnSubmit","minHeightBody","minWidthBody","name","onActiveItem","payload","onClick","onClose","onMouseDown","onMouseUp","onOpen","onSubmitItem","placeholder","style","tabIndex","MousePosition","clientX","clientY","TimeoutID","ReturnType","setTimeout","CHILDREN_ERROR","CLICKABLE_SELECTOR","TEXT_INPUT_SELECTOR","Dropdown","t0","$","_c","t1","t2","t3","t4","styleFromProps","undefined","childrenCount","count","Error","console","error","trigger","isOpen","setIsOpen","isOpening","setIsOpening","dropdownElement","setDropdownElement","dropdownBodyElement","setDropdownBodyElement","inputElementRef","closingTimerRef","isOpeningTimerRef","currentInputMethodRef","clearEnteredCharactersTimerRef","enteredCharactersRef","mouseDownPositionRef","allowCreateRef","allowEmptyRef","hasItemsRef","isOpenRef","isOpeningRef","keepOpenOnSubmitRef","onCloseRef","onOpenRef","onSubmitItemRef","valueRef","t5","t6","current","isMountedRef","t7","t8","t9","Symbol","for","clearTimeout","closeDropdown","t10","itemLabel","innerText","ownerDocument","activeElement","blur","nextValue","dataset","uktValue","eventTarget","target","matches","contains","click","clickableElements","querySelectorAll","length","clickableElement","handleSubmitItem","t11","t12","initialPosition","Math","abs","handleMouseMove","event_0","itemElements","eventTarget_0","item","closest","element_0","itemElement","handleMouseOver","t13","event_1","activeItem","eventRelatedTarget","relatedTarget","uktActive","handleMouseOut","t14","event_2","handleMouseDown","t15","event_3","eventTarget_1","handleMouseUp","t16","event_4","altKey","ctrlKey","key","metaKey","eventTarget_2","onEventHandled","stopPropagation","preventDefault","isEventTargetingDropdown","isTargetUsingKeyEvents","isEditingCharacters","test","slice","isExactMatch","text","index","indexAddend","handleKeyDown","t17","ignoreUsedKeyboardEvents","onKeyDown","t18","ref","inputElement","firstElementChild","HTMLInputElement","querySelector","handleGlobalMouseDown","t19","eventTarget_3","handleGlobalMouseUp","t20","target_0","eventTarget_4","handleGlobalFocusIn","t21","target_1","eventTarget_5","document","addEventListener","focus","handleInput","event_5","input","isDeleting","removeEventListener","handleRef","dropdownRect","dropdownBodyRect","getBoundingAncestor","boundingElement","boundingElementRect","maxHeight","top","maxHeightUp","bottom","maxHeightDown","round","t22","t23","t24","t25","t26","parentElement","tagName","getComputedStyle","overflowX"],"sources":["../src/Dropdown.css?inline","../src/helpers.ts","../src/Dropdown.tsx"],"sourcesContent":[":root {\n --uktdd-font-family:\n system-ui, Segoe UI, Roboto, Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue,\n Helvetica, Arial, sans-serif;\n --uktdd-body-bg-color: #fff;\n --uktdd-body-bg-color-hover: rgb(105, 162, 249);\n --uktdd-body-color-hover: #fff;\n --uktdd-body-buffer: 10px;\n --uktdd-body-max-height: calc(100vh - var(--uktdd-body-buffer));\n --uktdd-body-max-width: calc(100vw - var(--uktdd-body-buffer));\n --uktdd-body-pad-bottom: 9px;\n --uktdd-body-pad-left: 12px;\n --uktdd-body-pad-right: 12px;\n --uktdd-body-pad-top: 9px;\n --uktdd-body-min-width: min(50px, 100%);\n --uktdd-label-pad-right: 10px;\n}\n\n.uktdropdown,\n.uktdropdown-trigger {\n font-family: var(--uktdd-font-family);\n}\n\n.uktdropdown {\n width: max-content;\n anchor-scope: --uktdd-anchor;\n\n &.disabled {\n pointer-events: none;\n }\n\n > * {\n cursor: default;\n }\n\n > :first-child {\n anchor-name: --uktdd-anchor;\n }\n}\n\n.uktdropdown-label {\n display: flex;\n align-items: center;\n}\n\n.uktdropdown-label-text {\n padding-right: var(--uktdd-label-pad-right);\n}\n\n.uktdropdown-body {\n box-sizing: border-box;\n position: absolute;\n position-anchor: --uktdd-anchor;\n top: anchor(bottom);\n left: anchor(left);\n bottom: auto;\n right: auto;\n position-try-fallbacks: --uktdd-top-left, --uktdd-bottom-right, --uktdd-top-right;\n min-height: 50px;\n max-height: var(--uktdd-body-max-height);\n min-width: var(--uktdd-body-min-width);\n max-width: var(--uktdd-body-max-width);\n overflow: auto;\n z-index: 2;\n padding: var(--uktdd-body-pad-top) var(--uktdd-body-pad-right)\n var(--uktdd-body-pad-bottom) var(--uktdd-body-pad-left);\n background-color: var(--uktdd-body-bg-color);\n box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);\n\n &.has-items {\n user-select: none;\n }\n\n [data-ukt-active] {\n background-color: var(--uktdd-body-bg-color-hover);\n color: var(--uktdd-body-color-hover);\n }\n}\n\n@position-try --uktdd-top-left {\n bottom: anchor(top);\n left: anchor(left);\n top: auto;\n right: auto;\n}\n\n@position-try --uktdd-bottom-right {\n top: anchor(bottom);\n right: anchor(right);\n bottom: auto;\n left: auto;\n}\n\n@position-try --uktdd-top-right {\n bottom: anchor(top);\n right: anchor(right);\n top: auto;\n left: auto;\n}\n","import { getBestMatch } from '@acusti/matchmaking';\nimport { type SyntheticEvent } from 'react';\n\nimport { type Item } from './Dropdown.js';\n\nexport const ITEM_SELECTOR = `[data-ukt-item], [data-ukt-value]`;\n\nexport const getItemElements = (dropdownElement: HTMLElement | null) => {\n if (!dropdownElement) return null;\n\n const bodyElement = dropdownElement.querySelector('.uktdropdown-body');\n if (!bodyElement) return null;\n\n let items: HTMLCollection | NodeListOf<Element> =\n bodyElement.querySelectorAll(ITEM_SELECTOR);\n\n if (items.length) return items;\n // If no items found via [data-ukt-item] or [data-ukt-value] selector,\n // use first instance of multiple children found\n items = bodyElement.children;\n while (items.length === 1) {\n if (items[0].children == null) break;\n items = items[0].children;\n }\n // If unable to find an element with more than one child, treat direct child as items\n if (items.length === 1) {\n items = bodyElement.children;\n }\n return items;\n};\n\nexport const getActiveItemElement = (dropdownElement: HTMLElement | null) => {\n if (!dropdownElement) return null;\n return dropdownElement.querySelector('[data-ukt-active]') as HTMLElement | null;\n};\n\nconst clearItemElementsState = (itemElements: Array<HTMLElement>) => {\n itemElements.forEach((itemElement) => {\n if (itemElement.hasAttribute('data-ukt-active')) {\n delete itemElement.dataset.uktActive;\n }\n });\n};\n\ntype BaseSetActiveItemPayload = {\n dropdownElement: HTMLElement;\n element?: null;\n event: Event | SyntheticEvent<HTMLElement>;\n index?: null;\n indexAddend?: null;\n isExactMatch?: null;\n onActiveItem?: (payload: Item) => void;\n text?: null;\n};\n\nexport const setActiveItem = ({\n dropdownElement,\n element,\n event,\n index,\n indexAddend,\n isExactMatch,\n onActiveItem,\n text,\n}:\n | ({\n element: HTMLElement;\n } & Omit<BaseSetActiveItemPayload, 'element'>)\n | ({\n index: number;\n } & Omit<BaseSetActiveItemPayload, 'index'>)\n | ({\n indexAddend: number;\n } & Omit<BaseSetActiveItemPayload, 'indexAddend'>)\n | ({\n isExactMatch?: boolean;\n text: string;\n } & Omit<BaseSetActiveItemPayload, 'isExactMatch' | 'text'>)) => {\n const items = getItemElements(dropdownElement);\n if (!items) return;\n\n const itemElements = Array.from(items) as Array<HTMLElement>;\n if (!itemElements.length) return;\n\n const lastIndex = itemElements.length - 1;\n const currentActiveIndex = itemElements.findIndex((itemElement) =>\n itemElement.hasAttribute('data-ukt-active'),\n );\n\n let nextActiveIndex = currentActiveIndex;\n if (typeof index === 'number') {\n // Negative index means count back from the end\n nextActiveIndex = index < 0 ? itemElements.length + index : index;\n }\n\n if (element) {\n nextActiveIndex = itemElements.findIndex(\n (itemElement) => itemElement === element,\n );\n } else if (typeof indexAddend === 'number') {\n // If there’s no currentActiveIndex and we are handling -1, start at lastIndex\n if (currentActiveIndex === -1 && indexAddend === -1) {\n nextActiveIndex = lastIndex;\n } else {\n nextActiveIndex += indexAddend;\n }\n // Keep it within the bounds of the items list\n nextActiveIndex = Math.max(0, Math.min(nextActiveIndex, lastIndex));\n } else if (typeof text === 'string') {\n // If text is empty, clear existing active items and early return\n if (!text) {\n clearItemElementsState(itemElements);\n return;\n }\n\n const itemTexts = itemElements.map((itemElement) => itemElement.innerText);\n if (isExactMatch) {\n const textToCompare = text.toLowerCase();\n nextActiveIndex = itemTexts.findIndex((itemText) =>\n itemText.toLowerCase().startsWith(textToCompare),\n );\n // If isExactMatch is required and no exact match was found, clear active items\n if (nextActiveIndex === -1) {\n clearItemElementsState(itemElements);\n }\n } else {\n const bestMatch = getBestMatch({ items: itemTexts, text });\n nextActiveIndex = itemTexts.findIndex((itemText) => itemText === bestMatch);\n }\n }\n\n const nextActiveItem = items[nextActiveIndex] as HTMLElement | null;\n if (nextActiveItem == null || nextActiveIndex === currentActiveIndex) return;\n\n // Clear any existing active dropdown body item state\n clearItemElementsState(itemElements);\n nextActiveItem.setAttribute('data-ukt-active', '');\n const label = nextActiveItem.innerText;\n const value = nextActiveItem.dataset.uktValue ?? label;\n onActiveItem?.({ element: nextActiveItem, event, label, value });\n // Find closest scrollable parent and ensure that next active item is visible\n let { parentElement } = nextActiveItem;\n let scrollableParent = null;\n while (!scrollableParent && parentElement && parentElement !== dropdownElement) {\n const isScrollable = parentElement.scrollHeight > parentElement.clientHeight + 15;\n if (isScrollable) {\n scrollableParent = parentElement;\n } else {\n parentElement = parentElement.parentElement;\n }\n }\n\n if (scrollableParent) {\n const parentRect = scrollableParent.getBoundingClientRect();\n const itemRect = nextActiveItem.getBoundingClientRect();\n const isAboveTop = itemRect.top < parentRect.top;\n const isBelowBottom = itemRect.bottom > parentRect.bottom;\n if (isAboveTop || isBelowBottom) {\n let { scrollTop } = scrollableParent;\n // Item isn’t fully visible; adjust scrollTop to put item within closest edge\n if (isAboveTop) {\n scrollTop -= parentRect.top - itemRect.top;\n } else {\n scrollTop += itemRect.bottom - parentRect.bottom;\n }\n scrollableParent.scrollTop = scrollTop;\n }\n }\n};\n","/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/mouse-events-have-key-events, jsx-a11y/no-static-element-interactions */\nimport useBoundingClientRect from '@acusti/use-bounding-client-rect';\nimport useKeyboardEvents, {\n isEventTargetUsingKeyEvent,\n} from '@acusti/use-keyboard-events';\nimport clsx from 'clsx';\nimport {\n Children,\n type CSSProperties,\n Fragment,\n isValidElement,\n type JSX,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type SyntheticEvent,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport styles from './Dropdown.css?inline';\nimport {\n getActiveItemElement,\n getItemElements,\n ITEM_SELECTOR,\n setActiveItem,\n} from './helpers.js';\n\nexport type Item = {\n element: MaybeHTMLElement;\n event: Event | SyntheticEvent<HTMLElement>;\n label: string;\n value: string;\n};\n\nexport type Props = {\n /**\n * Boolean indicating if the user can submit a value not already in the\n * dropdown.\n */\n allowCreate?: boolean;\n /**\n * Boolean indicating if the user can submit an empty value (i.e. clear\n * the value). Defaults to true.\n */\n allowEmpty?: boolean;\n /**\n * Can take a single React element or exactly two renderable children.\n */\n children: ChildrenTuple | JSX.Element;\n className?: string;\n disabled?: boolean;\n /**\n * Group identifier string links dropdowns together into a menu\n * (like macOS top menubar).\n */\n group?: string;\n hasItems?: boolean;\n isOpenOnMount?: boolean;\n isSearchable?: boolean;\n keepOpenOnSubmit?: boolean;\n label?: string;\n minHeightBody?: number;\n minWidthBody?: number;\n /**\n * Only usable in conjunction with {isSearchable: true}.\n * Used as search input’s name.\n */\n name?: string;\n onActiveItem?: (payload: Item) => void;\n onClick?: (event: ReactMouseEvent<HTMLElement>) => unknown;\n onClose?: () => unknown;\n onMouseDown?: (event: ReactMouseEvent<HTMLElement>) => unknown;\n onMouseUp?: (event: ReactMouseEvent<HTMLElement>) => unknown;\n onOpen?: () => unknown;\n onSubmitItem?: (payload: Item) => void;\n /**\n * Only usable in conjunction with {isSearchable: true}.\n * Used as search input’s placeholder.\n */\n placeholder?: string;\n style?: CSSProperties;\n /**\n * Only usable in conjunction with {isSearchable: true}.\n * Used as search input’s tabIndex.\n */\n tabIndex?: number;\n /**\n * Used as search input’s value if props.isSearchable === true\n * Used to determine if value has changed to avoid triggering onSubmitItem if not\n */\n value?: string;\n};\n\ntype ChildrenTuple = [ReactNode, ReactNode] | readonly [ReactNode, ReactNode];\n\ntype MaybeHTMLElement = HTMLElement | null;\n\ntype MousePosition = { clientX: number; clientY: number };\n\ntype TimeoutID = ReturnType<typeof setTimeout>;\n\nconst CHILDREN_ERROR =\n '@acusti/dropdown requires either 1 child (the dropdown body) or 2 children: the dropdown trigger and the dropdown body.';\nconst CLICKABLE_SELECTOR = 'button, a[href], input[type=\"button\"], input[type=\"submit\"]';\nconst TEXT_INPUT_SELECTOR =\n 'input:not([type=radio]):not([type=checkbox]):not([type=range]),textarea';\n\nexport default function Dropdown({\n allowCreate,\n allowEmpty = true,\n children,\n className,\n disabled,\n hasItems = true,\n isOpenOnMount,\n isSearchable,\n keepOpenOnSubmit = !hasItems,\n label,\n minHeightBody = 30,\n minWidthBody,\n name,\n onActiveItem,\n onClick,\n onClose,\n onMouseDown,\n onMouseUp,\n onOpen,\n onSubmitItem,\n placeholder,\n style: styleFromProps,\n tabIndex,\n value,\n}: Props) {\n const childrenCount = Children.count(children);\n if (childrenCount !== 1 && childrenCount !== 2) {\n if (childrenCount === 0) {\n throw new Error(CHILDREN_ERROR + ' Received no children.');\n }\n console.error(`${CHILDREN_ERROR} Received ${childrenCount} children.`);\n }\n\n let trigger: React.ReactNode;\n if (childrenCount > 1) {\n trigger = (children as ChildrenTuple)[0];\n }\n\n const [isOpen, setIsOpen] = useState<boolean>(isOpenOnMount ?? false);\n const [isOpening, setIsOpening] = useState<boolean>(!isOpenOnMount);\n const [dropdownElement, setDropdownElement] = useState<MaybeHTMLElement>(null);\n const [dropdownBodyElement, setDropdownBodyElement] =\n useState<MaybeHTMLElement>(null);\n const inputElementRef = useRef<HTMLInputElement | null>(null);\n const closingTimerRef = useRef<null | TimeoutID>(null);\n const isOpeningTimerRef = useRef<null | TimeoutID>(null);\n const currentInputMethodRef = useRef<'keyboard' | 'mouse'>('mouse');\n const clearEnteredCharactersTimerRef = useRef<null | TimeoutID>(null);\n const enteredCharactersRef = useRef<string>('');\n const mouseDownPositionRef = useRef<MousePosition | null>(null);\n\n const allowCreateRef = useRef(allowCreate);\n const allowEmptyRef = useRef(allowEmpty);\n const hasItemsRef = useRef(hasItems);\n const isOpenRef = useRef(isOpen);\n const isOpeningRef = useRef(isOpening);\n const keepOpenOnSubmitRef = useRef(keepOpenOnSubmit);\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n const onSubmitItemRef = useRef(onSubmitItem);\n const valueRef = useRef(value);\n\n useEffect(() => {\n allowCreateRef.current = allowCreate;\n allowEmptyRef.current = allowEmpty;\n hasItemsRef.current = hasItems;\n isOpenRef.current = isOpen;\n isOpeningRef.current = isOpening;\n keepOpenOnSubmitRef.current = keepOpenOnSubmit;\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n onSubmitItemRef.current = onSubmitItem;\n valueRef.current = value;\n }, [\n allowCreate,\n allowEmpty,\n hasItems,\n isOpen,\n isOpening,\n keepOpenOnSubmit,\n onClose,\n onOpen,\n onSubmitItem,\n value,\n ]);\n\n const isMountedRef = useRef(false);\n\n useEffect(() => {\n if (!isMountedRef.current) {\n isMountedRef.current = true;\n // If isOpenOnMount, trigger onOpen right away\n if (isOpenRef.current && onOpenRef.current) {\n onOpenRef.current();\n }\n return;\n }\n\n if (isOpen && onOpenRef.current) {\n onOpenRef.current();\n } else if (!isOpen && onCloseRef.current) {\n onCloseRef.current();\n }\n }, [isOpen]);\n\n const closeDropdown = () => {\n setIsOpen(false);\n setIsOpening(false);\n mouseDownPositionRef.current = null;\n if (closingTimerRef.current != null) {\n clearTimeout(closingTimerRef.current);\n closingTimerRef.current = null;\n }\n };\n\n const handleSubmitItem = (event: Event | React.SyntheticEvent<HTMLElement>) => {\n if (isOpenRef.current && !keepOpenOnSubmitRef.current) {\n // A short timeout before closing is better UX when user selects an item so dropdown\n // doesn’t close before expected. It also enables using <Link />s in the dropdown body.\n closingTimerRef.current = setTimeout(closeDropdown, 90);\n }\n\n if (!hasItemsRef.current) return;\n\n const element = getActiveItemElement(dropdownElement);\n if (!element && !allowCreateRef.current) {\n // If not allowEmpty, don’t allow submitting an empty item\n if (!allowEmptyRef.current) return;\n // If we have an input element as trigger & the user didn’t clear the text, do nothing\n if (inputElementRef.current?.value) return;\n }\n\n let itemLabel = element?.innerText ?? '';\n if (inputElementRef.current) {\n if (!element) {\n itemLabel = inputElementRef.current.value;\n } else {\n inputElementRef.current.value = itemLabel;\n }\n\n if (\n inputElementRef.current ===\n inputElementRef.current.ownerDocument.activeElement\n ) {\n inputElementRef.current.blur();\n }\n }\n\n const nextValue = element?.dataset.uktValue ?? itemLabel;\n // If parent is controlling Dropdown via props.value and nextValue is the same, do nothing\n if (valueRef.current && valueRef.current === nextValue) return;\n\n // If the item is clickable or contains exactly one clickable element, invoke it\n // (but only if the event didn’t already originate from that element)\n if (element) {\n const eventTarget = event.target as HTMLElement;\n\n if (element.matches(CLICKABLE_SELECTOR)) {\n // The item element itself is clickable (e.g., <button data-ukt-value=\"…\">)\n if (element !== eventTarget && !element.contains(eventTarget)) {\n element.click();\n }\n } else {\n // Check if item contains exactly one clickable child element\n const clickableElements = element.querySelectorAll(CLICKABLE_SELECTOR);\n if (clickableElements.length === 1) {\n const clickableElement = clickableElements[0] as HTMLElement;\n if (\n clickableElement !== eventTarget &&\n !clickableElement.contains(eventTarget)\n ) {\n clickableElement.click();\n }\n }\n }\n }\n\n onSubmitItemRef.current?.({\n element,\n event,\n label: itemLabel,\n value: nextValue,\n });\n };\n\n const handleMouseMove = ({ clientX, clientY }: ReactMouseEvent<HTMLElement>) => {\n currentInputMethodRef.current = 'mouse';\n const initialPosition = mouseDownPositionRef.current;\n if (!initialPosition) return;\n if (\n Math.abs(initialPosition.clientX - clientX) < 12 &&\n Math.abs(initialPosition.clientY - clientY) < 12\n ) {\n return;\n }\n setIsOpening(false);\n };\n\n const handleMouseOver = (event: ReactMouseEvent<HTMLElement>) => {\n if (!hasItemsRef.current) return;\n\n // If user isn’t currently using the mouse to navigate the dropdown, do nothing\n if (currentInputMethodRef.current !== 'mouse') return;\n\n // Ensure we have the dropdown root HTMLElement\n if (!dropdownElement) return;\n\n const itemElements = getItemElements(dropdownElement);\n if (!itemElements) return;\n\n const eventTarget = event.target as HTMLElement;\n const item = eventTarget.closest(ITEM_SELECTOR) as MaybeHTMLElement;\n const element = item ?? eventTarget;\n for (const itemElement of itemElements) {\n if (itemElement === element) {\n setActiveItem({ dropdownElement, element, event, onActiveItem });\n return;\n }\n }\n };\n\n const handleMouseOut = (event: ReactMouseEvent<HTMLElement>) => {\n if (!hasItemsRef.current) return;\n const activeItem = getActiveItemElement(dropdownElement);\n if (!activeItem) return;\n const eventRelatedTarget = event.relatedTarget as HTMLElement;\n if (activeItem !== event.target || activeItem.contains(eventRelatedTarget)) {\n return;\n }\n // If user moused out of activeItem (not into a descendant), it’s no longer active\n delete activeItem.dataset.uktActive;\n };\n\n const handleMouseDown = (event: ReactMouseEvent<HTMLElement>) => {\n if (onMouseDown) onMouseDown(event);\n if (isOpenRef.current) return;\n\n setIsOpen(true);\n setIsOpening(true);\n mouseDownPositionRef.current = {\n clientX: event.clientX,\n clientY: event.clientY,\n };\n isOpeningTimerRef.current = setTimeout(() => {\n setIsOpening(false);\n isOpeningTimerRef.current = null;\n }, 1000);\n };\n\n const handleMouseUp = (event: ReactMouseEvent<HTMLElement>) => {\n if (onMouseUp) onMouseUp(event);\n // If dropdown is still opening or isn’t open or is closing, do nothing\n if (\n isOpeningRef.current ||\n !isOpenRef.current ||\n closingTimerRef.current != null\n ) {\n return;\n }\n\n const eventTarget = event.target as HTMLElement;\n // If click was outside dropdown body, don’t trigger submit\n if (!eventTarget.closest('.uktdropdown-body')) {\n // Don’t close dropdown if isOpening or search input is focused\n if (\n !isOpeningRef.current &&\n inputElementRef.current !== eventTarget.ownerDocument.activeElement\n ) {\n closeDropdown();\n }\n return;\n }\n\n // If dropdown has no items and click was within dropdown body, do nothing\n if (!hasItemsRef.current) return;\n\n handleSubmitItem(event);\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const { altKey, ctrlKey, key, metaKey } = event;\n const eventTarget = event.target as HTMLElement;\n if (!dropdownElement) return;\n\n const onEventHandled = () => {\n event.stopPropagation();\n event.preventDefault();\n currentInputMethodRef.current = 'keyboard';\n };\n\n const isEventTargetingDropdown = dropdownElement.contains(eventTarget);\n\n if (!isOpenRef.current) {\n // If dropdown is closed, don’t handle key events if event target isn’t within dropdown\n if (!isEventTargetingDropdown) return;\n // Open the dropdown on spacebar, enter, or if isSearchable and user hits the ↑/↓ arrows\n if (\n key === ' ' ||\n key === 'Enter' ||\n (hasItemsRef.current && (key === 'ArrowUp' || key === 'ArrowDown'))\n ) {\n onEventHandled();\n setIsOpen(true);\n }\n return;\n }\n\n const isTargetUsingKeyEvents = isEventTargetUsingKeyEvent(event);\n\n // If dropdown isOpen + hasItems & eventTargetNotUsingKeyEvents, handle characters\n if (hasItemsRef.current && !isTargetUsingKeyEvents) {\n let isEditingCharacters = !ctrlKey && !metaKey && /^[A-Za-z0-9]$/.test(key);\n // User could also be editing characters if there are already characters entered\n // and they are hitting delete or spacebar\n if (!isEditingCharacters && enteredCharactersRef.current) {\n isEditingCharacters = key === ' ' || key === 'Backspace';\n }\n\n if (isEditingCharacters) {\n onEventHandled();\n if (key === 'Backspace') {\n enteredCharactersRef.current = enteredCharactersRef.current.slice(\n 0,\n -1,\n );\n } else {\n enteredCharactersRef.current += key;\n }\n\n setActiveItem({\n dropdownElement,\n event,\n // If props.allowCreate, only override the input’s value with an\n // exact text match so user can enter a value not in items\n isExactMatch: allowCreateRef.current,\n onActiveItem,\n text: enteredCharactersRef.current,\n });\n\n if (clearEnteredCharactersTimerRef.current != null) {\n clearTimeout(clearEnteredCharactersTimerRef.current);\n }\n\n clearEnteredCharactersTimerRef.current = setTimeout(() => {\n enteredCharactersRef.current = '';\n clearEnteredCharactersTimerRef.current = null;\n }, 1500);\n\n return;\n }\n }\n\n // If dropdown isOpen, handle submitting the value\n if (key === 'Enter' || (key === ' ' && !inputElementRef.current)) {\n onEventHandled();\n handleSubmitItem(event);\n return;\n }\n\n // If dropdown isOpen, handle closing it on escape or spacebar if !hasItems\n if (\n key === 'Escape' ||\n (isEventTargetingDropdown && key === ' ' && !hasItemsRef.current)\n ) {\n // Close dropdown if hasItems or event target not using key events\n if (hasItemsRef.current || !isTargetUsingKeyEvents) {\n closeDropdown();\n }\n return;\n }\n\n // Handle ↑/↓ arrows\n if (hasItemsRef.current) {\n if (key === 'ArrowUp') {\n onEventHandled();\n if (altKey || metaKey) {\n setActiveItem({ dropdownElement, event, index: 0, onActiveItem });\n } else {\n setActiveItem({\n dropdownElement,\n event,\n indexAddend: -1,\n onActiveItem,\n });\n }\n return;\n }\n if (key === 'ArrowDown') {\n onEventHandled();\n if (altKey || metaKey) {\n // Using a negative index counts back from the end\n setActiveItem({ dropdownElement, event, index: -1, onActiveItem });\n } else {\n setActiveItem({\n dropdownElement,\n event,\n indexAddend: 1,\n onActiveItem,\n });\n }\n return;\n }\n }\n };\n\n useKeyboardEvents({ ignoreUsedKeyboardEvents: false, onKeyDown: handleKeyDown });\n\n const handleRef = (ref: HTMLDivElement | null): (() => void) | void => {\n setDropdownElement(ref);\n if (!ref) return;\n\n const { ownerDocument } = ref;\n let inputElement = inputElementRef.current;\n // Check if trigger is a textual input or textarea element\n if (!inputElement && ref.firstElementChild) {\n if (ref.firstElementChild.matches(TEXT_INPUT_SELECTOR)) {\n inputElement = ref.firstElementChild as HTMLInputElement;\n } else {\n inputElement = ref.firstElementChild.querySelector(TEXT_INPUT_SELECTOR);\n }\n inputElementRef.current = inputElement;\n }\n\n const handleGlobalMouseDown = ({ target }: MouseEvent) => {\n const eventTarget = target as HTMLElement;\n if (!ref.contains(eventTarget)) {\n // Close dropdown on an outside click\n closeDropdown();\n }\n };\n\n const handleGlobalMouseUp = ({ target }: MouseEvent) => {\n if (!isOpenRef.current || closingTimerRef.current != null) return;\n\n // If still isOpening (gets set false 1s after open triggers), set it to false onMouseUp\n if (isOpeningRef.current) {\n setIsOpening(false);\n if (isOpeningTimerRef.current != null) {\n clearTimeout(isOpeningTimerRef.current);\n isOpeningTimerRef.current = null;\n }\n return;\n }\n\n const eventTarget = target as HTMLElement;\n // Only handle mouseup events from outside the dropdown here\n if (!ref.contains(eventTarget)) {\n closeDropdown();\n }\n };\n\n // Close dropdown if any element is focused outside of this dropdown\n const handleGlobalFocusIn = ({ target }: Event) => {\n if (!isOpenRef.current) return;\n\n const eventTarget = target as HTMLElement;\n // If focused element is a descendant or a parent of the dropdown, do nothing\n if (ref.contains(eventTarget) || eventTarget.contains(ref)) {\n return;\n }\n\n closeDropdown();\n };\n\n document.addEventListener('focusin', handleGlobalFocusIn);\n document.addEventListener('mousedown', handleGlobalMouseDown);\n document.addEventListener('mouseup', handleGlobalMouseUp);\n\n if (ownerDocument !== document) {\n ownerDocument.addEventListener('focusin', handleGlobalFocusIn);\n ownerDocument.addEventListener('mousedown', handleGlobalMouseDown);\n ownerDocument.addEventListener('mouseup', handleGlobalMouseUp);\n }\n\n // If dropdown should be open on mount, focus it\n if (isOpenOnMount) {\n ref.focus();\n }\n\n const handleInput = (event: Event) => {\n if (!isOpenRef.current) setIsOpen(true);\n\n const input = event.target as HTMLInputElement;\n const isDeleting = enteredCharactersRef.current.length > input.value.length;\n enteredCharactersRef.current = input.value;\n // When deleting text, if there’s already an active item and\n // input isn’t empty, preserve the active item, else update it\n if (isDeleting && input.value.length && getActiveItemElement(ref)) {\n return;\n }\n\n setActiveItem({\n dropdownElement: ref,\n event,\n // If props.allowCreate, only override the input’s value with an\n // exact text match so user can enter a value not in items\n isExactMatch: allowCreateRef.current,\n onActiveItem,\n text: enteredCharactersRef.current,\n });\n };\n\n if (inputElement) {\n inputElement.addEventListener('input', handleInput);\n }\n\n return () => {\n document.removeEventListener('focusin', handleGlobalFocusIn);\n document.removeEventListener('mousedown', handleGlobalMouseDown);\n document.removeEventListener('mouseup', handleGlobalMouseUp);\n\n if (ownerDocument !== document) {\n ownerDocument.removeEventListener('focusin', handleGlobalFocusIn);\n ownerDocument.removeEventListener('mousedown', handleGlobalMouseDown);\n ownerDocument.removeEventListener('mouseup', handleGlobalMouseUp);\n }\n\n if (inputElement) {\n inputElement.removeEventListener('input', handleInput);\n }\n };\n };\n\n if (!isValidElement(trigger)) {\n if (isSearchable) {\n trigger = (\n <input\n autoComplete=\"off\"\n className=\"uktdropdown-trigger\"\n defaultValue={value ?? ''}\n disabled={disabled}\n name={name}\n onFocus={() => setIsOpen(true)}\n placeholder={placeholder}\n ref={inputElementRef}\n tabIndex={tabIndex}\n type=\"text\"\n />\n );\n } else {\n trigger = (\n <button className=\"uktdropdown-trigger\" tabIndex={0} type=\"button\">\n {trigger}\n </button>\n );\n }\n }\n\n if (label) {\n trigger = (\n <label className=\"uktdropdown-label\">\n <div className=\"uktdropdown-label-text\">{label}</div>\n {trigger}\n </label>\n );\n }\n\n const dropdownRect = useBoundingClientRect(dropdownElement);\n const dropdownBodyRect = useBoundingClientRect(dropdownBodyElement);\n const boundingElement = getBoundingAncestor(dropdownBodyElement);\n const boundingElementRect = useBoundingClientRect(boundingElement);\n let maxHeight;\n if (\n dropdownBodyRect.top != null &&\n dropdownRect.top != null &&\n boundingElementRect.top != null\n ) {\n const maxHeightUp = dropdownBodyRect.bottom - boundingElementRect.top;\n const maxHeightDown = boundingElementRect.bottom - dropdownBodyRect.top;\n maxHeight = Math.round(\n dropdownBodyRect.top > dropdownRect.top ? maxHeightDown : maxHeightUp,\n );\n }\n\n const style = {\n ...styleFromProps,\n ...(maxHeight != null && maxHeight > minHeightBody\n ? {\n '--uktdd-body-max-height': `calc(${maxHeight}px - var(--uktdd-body-buffer))`,\n }\n : null),\n ...(minWidthBody != null && minWidthBody > 0\n ? { '--uktdd-body-min-width': `${minWidthBody}px` }\n : null),\n };\n\n return (\n <Fragment>\n <style href=\"@acusti/dropdown/Dropdown\" precedence=\"medium\">\n {styles}\n </style>\n <div\n className={clsx('uktdropdown', className, {\n disabled,\n 'is-open': isOpen,\n 'is-searchable': isSearchable,\n })}\n onClick={onClick}\n onMouseDown={handleMouseDown}\n onMouseMove={handleMouseMove}\n onMouseOut={handleMouseOut}\n onMouseOver={handleMouseOver}\n onMouseUp={handleMouseUp}\n ref={handleRef}\n style={style}\n >\n {trigger}\n {/* TODO next version of Dropdown should use <Activity> for body https://react.dev/reference/react/Activity */}\n {isOpen ? (\n <div className=\"uktdropdown-body\" ref={setDropdownBodyElement}>\n {childrenCount > 1 ? (children as ChildrenTuple)[1] : children}\n </div>\n ) : null}\n </div>\n </Fragment>\n );\n}\n\nfunction getBoundingAncestor(element?: MaybeHTMLElement): MaybeHTMLElement {\n while (element?.parentElement) {\n // If we’ve reached the body, use that as boundingElement\n if (element.parentElement.tagName === 'BODY') return element.parentElement;\n // Only need to check one overflow direction, because if either direction\n // is not visible, neither can be visible\n if (getComputedStyle(element.parentElement).overflowX !== 'visible') {\n return element.parentElement;\n }\n\n element = element.parentElement as MaybeHTMLElement;\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;ACKA,MAAaG,gBAAgB;AAE7B,MAAaC,mBAAmBC,oBAAwC;AACpE,KAAI,CAACA,gBAAiB,QAAO;CAE7B,MAAME,cAAcF,gBAAgBG,cAAc,oBAAoB;AACtE,KAAI,CAACD,YAAa,QAAO;CAEzB,IAAIE,QACAF,YAAYM,iBAAiBV,cAAc;AAE/C,KAAIM,MAAMK,OAAQ,QAAOL;AAGzBA,SAAQF,YAAYQ;AACpB,QAAON,MAAMK,WAAW,GAAG;AACvB,MAAIL,MAAM,GAAGM,YAAY,KAAM;AAC/BN,UAAQA,MAAM,GAAGM;;AAGrB,KAAIN,MAAMK,WAAW,EACjBL,SAAQF,YAAYQ;AAExB,QAAON;;AAGX,MAAaO,wBAAwBX,oBAAwC;AACzE,KAAI,CAACA,gBAAiB,QAAO;AAC7B,QAAOA,gBAAgBG,cAAc,oBAAoB;;AAG7D,IAAMS,0BAA0BC,iBAAqC;AACjEA,cAAaE,SAASC,gBAAgB;AAClC,MAAIA,YAAYC,aAAa,kBAAkB,CAC3C,QAAOD,YAAYE,QAAQC;GAEjC;;AAcN,MAAaW,iBAAiB,EAC1B9B,iBACAqB,SACAC,OACAE,OACAC,aACAC,cACAC,cACAE,WAcmE;CACnE,MAAMzB,QAAQL,gBAAg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UACtD,QAAOlN,QAAQ+M;AAGnB/M,YAAUA,QAAQ+M;;AAGtB,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acusti/dropdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": "./dist/Dropdown.js",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@acusti/matchmaking": "^0.10.0",
|
|
60
|
-
"@acusti/styling": "^2.1.0",
|
|
61
60
|
"@acusti/use-bounding-client-rect": "^2.0.1",
|
|
62
61
|
"@acusti/use-keyboard-events": "^0.11.0",
|
|
63
62
|
"clsx": "^2"
|
package/dist/styles.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const ROOT_CLASS_NAME = "uktdropdown";
|
|
2
|
-
export declare const ROOT_SELECTOR = ".uktdropdown";
|
|
3
|
-
export declare const BODY_CLASS_NAME = "uktdropdown-body";
|
|
4
|
-
export declare const LABEL_CLASS_NAME = "uktdropdown-label";
|
|
5
|
-
export declare const LABEL_TEXT_CLASS_NAME = "uktdropdown-label-text";
|
|
6
|
-
export declare const TRIGGER_CLASS_NAME = "uktdropdown-trigger";
|
|
7
|
-
export declare const BODY_SELECTOR = ".uktdropdown-body";
|
|
8
|
-
export declare const LABEL_SELECTOR = ".uktdropdown-label";
|
|
9
|
-
export declare const LABEL_TEXT_SELECTOR = ".uktdropdown-label-text";
|
|
10
|
-
export declare const TRIGGER_SELECTOR = ".uktdropdown-trigger";
|
|
11
|
-
export declare const BODY_MAX_HEIGHT_VAR = "--uktdd-body-max-height";
|
|
12
|
-
export declare const BODY_MAX_WIDTH_VAR = "--uktdd-body-max-width";
|
|
13
|
-
export declare const STYLES = "\n:root {\n --uktdd-font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n --uktdd-body-bg-color: #fff;\n --uktdd-body-bg-color-hover: rgb(105,162,249);\n --uktdd-body-color-hover: #fff;\n --uktdd-body-buffer: 10px;\n --uktdd-body-max-height: calc(100vh - var(--uktdd-body-buffer));\n --uktdd-body-max-width: calc(100vw - var(--uktdd-body-buffer));\n --uktdd-body-pad-bottom: 9px;\n --uktdd-body-pad-left: 12px;\n --uktdd-body-pad-right: 12px;\n --uktdd-body-pad-top: 9px;\n --uktdd-label-pad-right: 10px;\n}\n.uktdropdown,\n.uktdropdown-trigger {\n font-family: var(--uktdd-font-family);\n}\n.uktdropdown {\n width: max-content;\n anchor-scope: --uktdd-anchor;\n}\n.uktdropdown.disabled {\n pointer-events: none;\n}\n.uktdropdown > * {\n cursor: default;\n}\n.uktdropdown > :first-child {\n anchor-name: --uktdd-anchor;\n}\n.uktdropdown-label {\n display: flex;\n align-items: center;\n}\n.uktdropdown-label-text {\n padding-right: var(--uktdd-label-pad-right);\n}\n.uktdropdown-body {\n box-sizing: border-box;\n position: absolute;\n position-anchor: --uktdd-anchor;\n top: anchor(bottom);\n left: anchor(left);\n bottom: auto;\n right: auto;\n position-try-fallbacks: --uktdd-top-left, --uktdd-bottom-right, --uktdd-top-right;\n min-height: 50px;\n max-height: var(--uktdd-body-max-height);\n min-width: min(50px, 100%);\n max-width: var(--uktdd-body-max-width);\n overflow: auto;\n z-index: 2;\n padding: var(--uktdd-body-pad-top) var(--uktdd-body-pad-right) var(--uktdd-body-pad-bottom) var(--uktdd-body-pad-left);\n background-color: var(--uktdd-body-bg-color);\n box-shadow: 0 8px 18px rgba(0,0,0,0.25);\n}\n@position-try --uktdd-top-left {\n bottom: anchor(top);\n left: anchor(left);\n top: auto;\n right: auto;\n}\n@position-try --uktdd-bottom-right {\n top: anchor(bottom);\n right: anchor(right);\n bottom: auto;\n left: auto;\n}\n@position-try --uktdd-top-right {\n bottom: anchor(top);\n right: anchor(right);\n top: auto;\n left: auto;\n}\n.uktdropdown-body.has-items {\n user-select: none;\n}\n.uktdropdown-body [data-ukt-active] {\n background-color: var(--uktdd-body-bg-color-hover);\n color: var(--uktdd-body-color-hover);\n}\n";
|