@aurodesignsystem-dev/auro-formkit 0.0.0-pr1425.0 → 0.0.0-pr1428.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/components/checkbox/demo/api.min.js +1 -1
- package/components/checkbox/demo/index.min.js +1 -1
- package/components/checkbox/dist/index.js +1 -1
- package/components/checkbox/dist/registered.js +1 -1
- package/components/combobox/demo/api.min.js +276 -165
- package/components/combobox/demo/index.min.js +276 -165
- package/components/combobox/dist/index.js +276 -165
- package/components/combobox/dist/registered.js +276 -165
- package/components/counter/demo/api.min.js +275 -164
- package/components/counter/demo/index.min.js +275 -164
- package/components/counter/dist/index.js +275 -164
- package/components/counter/dist/registered.js +275 -164
- package/components/datepicker/demo/api.min.js +276 -165
- package/components/datepicker/demo/index.min.js +276 -165
- package/components/datepicker/dist/index.js +276 -165
- package/components/datepicker/dist/registered.js +276 -165
- package/components/dropdown/demo/api.min.js +275 -164
- package/components/dropdown/demo/index.min.js +275 -164
- package/components/dropdown/dist/index.js +275 -164
- package/components/dropdown/dist/registered.js +275 -164
- package/components/form/demo/api.min.js +1105 -661
- package/components/form/demo/index.min.js +1105 -661
- package/components/input/demo/api.min.js +1 -1
- package/components/input/demo/index.min.js +1 -1
- package/components/input/dist/index.js +1 -1
- package/components/input/dist/registered.js +1 -1
- package/components/radio/demo/api.min.js +1 -1
- package/components/radio/demo/index.min.js +1 -1
- package/components/radio/dist/index.js +1 -1
- package/components/radio/dist/registered.js +1 -1
- package/components/select/demo/api.min.js +275 -164
- package/components/select/demo/index.min.js +275 -164
- package/components/select/dist/index.js +275 -164
- package/components/select/dist/registered.js +275 -164
- package/custom-elements.json +244 -244
- package/package.json +2 -2
|
@@ -3168,11 +3168,19 @@ class AuroFloatingUI {
|
|
|
3168
3168
|
* This ensures that the bib content has the same dimensions as the sizer element.
|
|
3169
3169
|
*/
|
|
3170
3170
|
mirrorSize() {
|
|
3171
|
+
const element = this.element;
|
|
3172
|
+
if (!element) {
|
|
3173
|
+
return;
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3171
3176
|
// mirror the boxsize from bibSizer
|
|
3172
|
-
if (
|
|
3173
|
-
const sizerStyle = window.getComputedStyle(
|
|
3174
|
-
const bibContent =
|
|
3175
|
-
|
|
3177
|
+
if (element.bibSizer && element.matchWidth && element.bib?.shadowRoot) {
|
|
3178
|
+
const sizerStyle = window.getComputedStyle(element.bibSizer);
|
|
3179
|
+
const bibContent = element.bib.shadowRoot.querySelector(".container");
|
|
3180
|
+
if (!bibContent) {
|
|
3181
|
+
return;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3176
3184
|
if (sizerStyle.width !== "0px") {
|
|
3177
3185
|
bibContent.style.width = sizerStyle.width;
|
|
3178
3186
|
}
|
|
@@ -3194,9 +3202,14 @@ class AuroFloatingUI {
|
|
|
3194
3202
|
* @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
|
|
3195
3203
|
*/
|
|
3196
3204
|
getPositioningStrategy() {
|
|
3205
|
+
const element = this.element;
|
|
3206
|
+
if (!element) {
|
|
3207
|
+
return "floating";
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3197
3210
|
const breakpoint =
|
|
3198
|
-
|
|
3199
|
-
|
|
3211
|
+
element.bib?.mobileFullscreenBreakpoint ||
|
|
3212
|
+
element.floaterConfig?.fullscreenBreakpoint;
|
|
3200
3213
|
switch (this.behavior) {
|
|
3201
3214
|
case "tooltip":
|
|
3202
3215
|
return "floating";
|
|
@@ -3207,9 +3220,9 @@ class AuroFloatingUI {
|
|
|
3207
3220
|
`(max-width: ${breakpoint})`,
|
|
3208
3221
|
).matches;
|
|
3209
3222
|
|
|
3210
|
-
|
|
3223
|
+
element.expanded = smallerThanBreakpoint;
|
|
3211
3224
|
}
|
|
3212
|
-
if (
|
|
3225
|
+
if (element.nested) {
|
|
3213
3226
|
return "cover";
|
|
3214
3227
|
}
|
|
3215
3228
|
return "fullscreen";
|
|
@@ -3239,42 +3252,65 @@ class AuroFloatingUI {
|
|
|
3239
3252
|
* and applies the calculated position to the bib's style.
|
|
3240
3253
|
*/
|
|
3241
3254
|
position() {
|
|
3255
|
+
const element = this.element;
|
|
3256
|
+
if (!element) {
|
|
3257
|
+
return;
|
|
3258
|
+
}
|
|
3259
|
+
|
|
3242
3260
|
const strategy = this.getPositioningStrategy();
|
|
3243
3261
|
this.configureBibStrategy(strategy);
|
|
3244
3262
|
|
|
3245
3263
|
if (strategy === "floating") {
|
|
3264
|
+
if (!element.trigger || !element.bib) {
|
|
3265
|
+
return;
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3246
3268
|
this.mirrorSize();
|
|
3247
3269
|
// Define the middlware for the floater configuration
|
|
3248
3270
|
const middleware = [
|
|
3249
|
-
offset(
|
|
3250
|
-
...(
|
|
3251
|
-
...(
|
|
3252
|
-
...(
|
|
3271
|
+
offset(element.floaterConfig?.offset || 0),
|
|
3272
|
+
...(element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
|
|
3273
|
+
...(element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
|
|
3274
|
+
...(element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
|
|
3253
3275
|
];
|
|
3254
3276
|
|
|
3255
3277
|
// Compute the position of the bib
|
|
3256
|
-
computePosition(
|
|
3257
|
-
strategy:
|
|
3258
|
-
placement:
|
|
3278
|
+
computePosition(element.trigger, element.bib, {
|
|
3279
|
+
strategy: element.floaterConfig?.strategy || "fixed",
|
|
3280
|
+
placement: element.floaterConfig?.placement,
|
|
3259
3281
|
middleware: middleware || [],
|
|
3260
3282
|
}).then(({ x, y }) => {
|
|
3261
3283
|
// eslint-disable-line id-length
|
|
3262
|
-
|
|
3284
|
+
const currentElement = this.element;
|
|
3285
|
+
if (!currentElement?.bib) {
|
|
3286
|
+
return;
|
|
3287
|
+
}
|
|
3288
|
+
|
|
3289
|
+
Object.assign(currentElement.bib.style, {
|
|
3263
3290
|
left: `${x}px`,
|
|
3264
3291
|
top: `${y}px`,
|
|
3265
3292
|
});
|
|
3266
3293
|
});
|
|
3267
3294
|
} else if (strategy === "cover") {
|
|
3295
|
+
if (!element.parentNode || !element.bib) {
|
|
3296
|
+
return;
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3268
3299
|
// Compute the position of the bib
|
|
3269
|
-
computePosition(
|
|
3300
|
+
computePosition(element.parentNode, element.bib, {
|
|
3270
3301
|
placement: "bottom-start",
|
|
3271
3302
|
}).then(({ x, y }) => {
|
|
3272
3303
|
// eslint-disable-line id-length
|
|
3273
|
-
|
|
3304
|
+
const currentElement = this.element;
|
|
3305
|
+
if (!currentElement?.bib || !currentElement.parentNode) {
|
|
3306
|
+
return;
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
Object.assign(currentElement.bib.style, {
|
|
3274
3310
|
left: `${x}px`,
|
|
3275
|
-
top: `${y -
|
|
3276
|
-
width: `${
|
|
3277
|
-
height: `${
|
|
3311
|
+
top: `${y - currentElement.parentNode.offsetHeight}px`,
|
|
3312
|
+
width: `${currentElement.parentNode.offsetWidth}px`,
|
|
3313
|
+
height: `${currentElement.parentNode.offsetHeight}px`,
|
|
3278
3314
|
});
|
|
3279
3315
|
});
|
|
3280
3316
|
}
|
|
@@ -3286,11 +3322,17 @@ class AuroFloatingUI {
|
|
|
3286
3322
|
* @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
|
|
3287
3323
|
*/
|
|
3288
3324
|
lockScroll(lock = true) {
|
|
3325
|
+
const element = this.element;
|
|
3326
|
+
|
|
3289
3327
|
if (lock) {
|
|
3328
|
+
if (!element?.bib) {
|
|
3329
|
+
return;
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3290
3332
|
document.body.style.overflow = "hidden"; // hide body's scrollbar
|
|
3291
3333
|
|
|
3292
3334
|
// Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
|
|
3293
|
-
|
|
3335
|
+
element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
|
|
3294
3336
|
} else {
|
|
3295
3337
|
document.body.style.overflow = "";
|
|
3296
3338
|
}
|
|
@@ -3306,20 +3348,24 @@ class AuroFloatingUI {
|
|
|
3306
3348
|
* @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
|
|
3307
3349
|
*/
|
|
3308
3350
|
configureBibStrategy(value) {
|
|
3351
|
+
const element = this.element;
|
|
3352
|
+
if (!element?.bib) {
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3309
3356
|
if (value === "fullscreen") {
|
|
3310
|
-
|
|
3357
|
+
element.isBibFullscreen = true;
|
|
3311
3358
|
// reset the prev position
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3359
|
+
element.bib.setAttribute("isfullscreen", "");
|
|
3360
|
+
element.bib.style.position = "fixed";
|
|
3361
|
+
element.bib.style.top = "0px";
|
|
3362
|
+
element.bib.style.left = "0px";
|
|
3363
|
+
element.bib.style.width = "";
|
|
3364
|
+
element.bib.style.height = "";
|
|
3365
|
+
element.style.contain = "";
|
|
3319
3366
|
|
|
3320
3367
|
// reset the size that was mirroring `size` css-part
|
|
3321
|
-
const bibContent =
|
|
3322
|
-
this.element.bib.shadowRoot.querySelector(".container");
|
|
3368
|
+
const bibContent = element.bib.shadowRoot?.querySelector(".container");
|
|
3323
3369
|
if (bibContent) {
|
|
3324
3370
|
bibContent.style.width = "";
|
|
3325
3371
|
bibContent.style.height = "";
|
|
@@ -3334,14 +3380,14 @@ class AuroFloatingUI {
|
|
|
3334
3380
|
}, 0);
|
|
3335
3381
|
}
|
|
3336
3382
|
|
|
3337
|
-
if (
|
|
3383
|
+
if (element.isPopoverVisible) {
|
|
3338
3384
|
this.lockScroll(true);
|
|
3339
3385
|
}
|
|
3340
3386
|
} else {
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3387
|
+
element.bib.style.position = "";
|
|
3388
|
+
element.bib.removeAttribute("isfullscreen");
|
|
3389
|
+
element.isBibFullscreen = false;
|
|
3390
|
+
element.style.contain = "layout";
|
|
3345
3391
|
}
|
|
3346
3392
|
|
|
3347
3393
|
const isChanged = this.strategy && this.strategy !== value;
|
|
@@ -3359,16 +3405,21 @@ class AuroFloatingUI {
|
|
|
3359
3405
|
},
|
|
3360
3406
|
);
|
|
3361
3407
|
|
|
3362
|
-
|
|
3408
|
+
element.dispatchEvent(event);
|
|
3363
3409
|
}
|
|
3364
3410
|
}
|
|
3365
3411
|
|
|
3366
3412
|
updateState() {
|
|
3367
|
-
const
|
|
3413
|
+
const element = this.element;
|
|
3414
|
+
if (!element) {
|
|
3415
|
+
return;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
const isVisible = element.isPopoverVisible;
|
|
3368
3419
|
if (!isVisible) {
|
|
3369
3420
|
this.cleanupHideHandlers();
|
|
3370
3421
|
try {
|
|
3371
|
-
|
|
3422
|
+
element.cleanup?.();
|
|
3372
3423
|
} catch (error) {
|
|
3373
3424
|
// Do nothing
|
|
3374
3425
|
}
|
|
@@ -3384,28 +3435,30 @@ class AuroFloatingUI {
|
|
|
3384
3435
|
* If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
|
|
3385
3436
|
*/
|
|
3386
3437
|
handleFocusLoss() {
|
|
3438
|
+
const element = this.element;
|
|
3439
|
+
if (!element?.bib) {
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3387
3443
|
// if mouse is being pressed, skip and let click event to handle the action
|
|
3388
3444
|
if (AuroFloatingUI.isMousePressed) {
|
|
3389
3445
|
return;
|
|
3390
3446
|
}
|
|
3391
3447
|
|
|
3392
3448
|
if (
|
|
3393
|
-
|
|
3394
|
-
|
|
3449
|
+
element.noHideOnThisFocusLoss ||
|
|
3450
|
+
element.hasAttribute("noHideOnThisFocusLoss")
|
|
3395
3451
|
) {
|
|
3396
3452
|
return;
|
|
3397
3453
|
}
|
|
3398
3454
|
|
|
3399
3455
|
// if focus is still inside of trigger or bib, do not close
|
|
3400
|
-
if (
|
|
3401
|
-
this.element.matches(":focus") ||
|
|
3402
|
-
this.element.matches(":focus-within")
|
|
3403
|
-
) {
|
|
3456
|
+
if (element.matches(":focus") || element.matches(":focus-within")) {
|
|
3404
3457
|
return;
|
|
3405
3458
|
}
|
|
3406
3459
|
|
|
3407
3460
|
// if fullscreen bib is in fullscreen mode, do not close
|
|
3408
|
-
if (
|
|
3461
|
+
if (element.bib.hasAttribute("isfullscreen")) {
|
|
3409
3462
|
return;
|
|
3410
3463
|
}
|
|
3411
3464
|
|
|
@@ -3413,23 +3466,33 @@ class AuroFloatingUI {
|
|
|
3413
3466
|
}
|
|
3414
3467
|
|
|
3415
3468
|
setupHideHandlers() {
|
|
3469
|
+
const element = this.element;
|
|
3470
|
+
if (!element) {
|
|
3471
|
+
return;
|
|
3472
|
+
}
|
|
3473
|
+
|
|
3416
3474
|
// Define handlers & store references
|
|
3417
3475
|
this.focusHandler = () => this.handleFocusLoss();
|
|
3418
3476
|
|
|
3419
3477
|
this.clickHandler = (evt) => {
|
|
3478
|
+
const element = this.element;
|
|
3479
|
+
if (!element?.bib) {
|
|
3480
|
+
return;
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3420
3483
|
// When the bib is fullscreen (modal dialog), don't close on outside
|
|
3421
3484
|
// clicks. VoiceOver's synthetic click events inside a top-layer modal
|
|
3422
3485
|
// <dialog> may not include the bib in composedPath(), causing false
|
|
3423
3486
|
// positives. This mirrors the fullscreen guard in handleFocusLoss().
|
|
3424
|
-
if (
|
|
3487
|
+
if (element.bib.hasAttribute("isfullscreen")) {
|
|
3425
3488
|
return;
|
|
3426
3489
|
}
|
|
3427
3490
|
|
|
3428
3491
|
if (
|
|
3429
|
-
(!evt.composedPath().includes(
|
|
3430
|
-
!evt.composedPath().includes(
|
|
3431
|
-
(
|
|
3432
|
-
evt.composedPath().includes(
|
|
3492
|
+
(!evt.composedPath().includes(element.trigger) &&
|
|
3493
|
+
!evt.composedPath().includes(element.bib)) ||
|
|
3494
|
+
(element.bib.backdrop &&
|
|
3495
|
+
evt.composedPath().includes(element.bib.backdrop))
|
|
3433
3496
|
) {
|
|
3434
3497
|
const existedVisibleFloatingUI =
|
|
3435
3498
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -3450,7 +3513,12 @@ class AuroFloatingUI {
|
|
|
3450
3513
|
|
|
3451
3514
|
// ESC key handler
|
|
3452
3515
|
this.keyDownHandler = (evt) => {
|
|
3453
|
-
|
|
3516
|
+
const element = this.element;
|
|
3517
|
+
if (!element) {
|
|
3518
|
+
return;
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
if (evt.key === "Escape" && element.isPopoverVisible) {
|
|
3454
3522
|
const existedVisibleFloatingUI =
|
|
3455
3523
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
3456
3524
|
if (
|
|
@@ -3507,6 +3575,10 @@ class AuroFloatingUI {
|
|
|
3507
3575
|
}
|
|
3508
3576
|
|
|
3509
3577
|
updateCurrentExpandedDropdown() {
|
|
3578
|
+
if (!this.element) {
|
|
3579
|
+
return;
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3510
3582
|
// Close any other dropdown that is already open
|
|
3511
3583
|
const existedVisibleFloatingUI =
|
|
3512
3584
|
document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
|
|
@@ -3523,25 +3595,34 @@ class AuroFloatingUI {
|
|
|
3523
3595
|
}
|
|
3524
3596
|
|
|
3525
3597
|
showBib() {
|
|
3526
|
-
|
|
3598
|
+
const element = this.element;
|
|
3599
|
+
if (!element) {
|
|
3600
|
+
return;
|
|
3601
|
+
}
|
|
3602
|
+
|
|
3603
|
+
if (!element.bib || (!element.trigger && !element.parentNode)) {
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
if (!element.disabled && !this.showing) {
|
|
3527
3608
|
this.updateCurrentExpandedDropdown();
|
|
3528
|
-
|
|
3609
|
+
element.triggerChevron?.setAttribute("data-expanded", true);
|
|
3529
3610
|
|
|
3530
3611
|
// prevent double showing: isPopovervisible gets first and showBib gets called later
|
|
3531
3612
|
if (!this.showing) {
|
|
3532
|
-
if (!
|
|
3613
|
+
if (!element.modal) {
|
|
3533
3614
|
this.setupHideHandlers();
|
|
3534
3615
|
}
|
|
3535
3616
|
this.showing = true;
|
|
3536
|
-
|
|
3617
|
+
element.isPopoverVisible = true;
|
|
3537
3618
|
this.position();
|
|
3538
3619
|
this.dispatchEventDropdownToggle();
|
|
3539
3620
|
}
|
|
3540
3621
|
|
|
3541
3622
|
// Setup auto update to handle resize and scroll
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3623
|
+
element.cleanup = autoUpdate(
|
|
3624
|
+
element.trigger || element.parentNode,
|
|
3625
|
+
element.bib,
|
|
3545
3626
|
() => {
|
|
3546
3627
|
this.position();
|
|
3547
3628
|
},
|
|
@@ -3554,22 +3635,27 @@ class AuroFloatingUI {
|
|
|
3554
3635
|
* @param {String} eventType - The event type that triggered the hiding action.
|
|
3555
3636
|
*/
|
|
3556
3637
|
hideBib(eventType = "unknown") {
|
|
3557
|
-
|
|
3638
|
+
const element = this.element;
|
|
3639
|
+
if (!element) {
|
|
3640
|
+
return;
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
if (element.disabled) {
|
|
3558
3644
|
return;
|
|
3559
3645
|
}
|
|
3560
3646
|
|
|
3561
3647
|
// noToggle dropdowns should not close when the trigger is clicked (the
|
|
3562
3648
|
// "toggle" behavior), but they CAN still close via other interactions like
|
|
3563
3649
|
// Escape key or focus loss.
|
|
3564
|
-
if (
|
|
3650
|
+
if (element.noToggle && eventType === "click") {
|
|
3565
3651
|
return;
|
|
3566
3652
|
}
|
|
3567
3653
|
|
|
3568
3654
|
this.lockScroll(false);
|
|
3569
|
-
|
|
3655
|
+
element.triggerChevron?.removeAttribute("data-expanded");
|
|
3570
3656
|
|
|
3571
|
-
if (
|
|
3572
|
-
|
|
3657
|
+
if (element.isPopoverVisible) {
|
|
3658
|
+
element.isPopoverVisible = false;
|
|
3573
3659
|
}
|
|
3574
3660
|
if (this.showing) {
|
|
3575
3661
|
this.cleanupHideHandlers();
|
|
@@ -3589,6 +3675,11 @@ class AuroFloatingUI {
|
|
|
3589
3675
|
* @param {String} eventType - The event type that triggered the toggle action.
|
|
3590
3676
|
*/
|
|
3591
3677
|
dispatchEventDropdownToggle(eventType) {
|
|
3678
|
+
const element = this.element;
|
|
3679
|
+
if (!element) {
|
|
3680
|
+
return;
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3592
3683
|
const event = new CustomEvent(
|
|
3593
3684
|
this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
|
|
3594
3685
|
{
|
|
@@ -3600,11 +3691,16 @@ class AuroFloatingUI {
|
|
|
3600
3691
|
},
|
|
3601
3692
|
);
|
|
3602
3693
|
|
|
3603
|
-
|
|
3694
|
+
element.dispatchEvent(event);
|
|
3604
3695
|
}
|
|
3605
3696
|
|
|
3606
3697
|
handleClick() {
|
|
3607
|
-
|
|
3698
|
+
const element = this.element;
|
|
3699
|
+
if (!element) {
|
|
3700
|
+
return;
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
if (element.isPopoverVisible) {
|
|
3608
3704
|
this.hideBib("click");
|
|
3609
3705
|
} else {
|
|
3610
3706
|
this.showBib();
|
|
@@ -3615,63 +3711,66 @@ class AuroFloatingUI {
|
|
|
3615
3711
|
{
|
|
3616
3712
|
composed: true,
|
|
3617
3713
|
detail: {
|
|
3618
|
-
expanded:
|
|
3714
|
+
expanded: element.isPopoverVisible,
|
|
3619
3715
|
},
|
|
3620
3716
|
},
|
|
3621
3717
|
);
|
|
3622
3718
|
|
|
3623
|
-
|
|
3719
|
+
element.dispatchEvent(event);
|
|
3624
3720
|
}
|
|
3625
3721
|
|
|
3626
3722
|
handleEvent(event) {
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
case "mouseenter":
|
|
3644
|
-
if (this.element.hoverToggle) {
|
|
3645
|
-
this.showBib();
|
|
3646
|
-
}
|
|
3647
|
-
break;
|
|
3648
|
-
case "mouseleave":
|
|
3649
|
-
if (this.element.hoverToggle) {
|
|
3650
|
-
this.hideBib("mouseleave");
|
|
3651
|
-
}
|
|
3652
|
-
break;
|
|
3653
|
-
case "focus":
|
|
3654
|
-
if (this.element.focusShow) {
|
|
3655
|
-
/*
|
|
3656
|
-
This needs to better handle clicking that gives focus -
|
|
3657
|
-
currently it shows and then immediately hides the bib
|
|
3658
|
-
*/
|
|
3659
|
-
this.showBib();
|
|
3660
|
-
}
|
|
3661
|
-
break;
|
|
3662
|
-
case "blur":
|
|
3663
|
-
// send this task 100ms later queue to
|
|
3664
|
-
// wait a frame in case focus moves within the floating element/bib
|
|
3665
|
-
setTimeout(() => this.handleFocusLoss(), 0);
|
|
3666
|
-
break;
|
|
3667
|
-
case "click":
|
|
3668
|
-
if (document.activeElement === document.body) {
|
|
3669
|
-
event.currentTarget.focus();
|
|
3670
|
-
}
|
|
3723
|
+
const element = this.element;
|
|
3724
|
+
if (!element || element.disableEventShow) {
|
|
3725
|
+
return;
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
switch (event.type) {
|
|
3729
|
+
case "keydown": {
|
|
3730
|
+
// Support both Enter and Space keys for accessibility
|
|
3731
|
+
// Space is included as it's expected behavior for interactive elements
|
|
3732
|
+
|
|
3733
|
+
const origin = event.composedPath()[0];
|
|
3734
|
+
if (
|
|
3735
|
+
event.key === "Enter" ||
|
|
3736
|
+
(event.key === " " && (!origin || origin.tagName !== "INPUT"))
|
|
3737
|
+
) {
|
|
3738
|
+
event.preventDefault();
|
|
3671
3739
|
this.handleClick();
|
|
3672
|
-
|
|
3673
|
-
|
|
3740
|
+
}
|
|
3741
|
+
break;
|
|
3674
3742
|
}
|
|
3743
|
+
case "mouseenter":
|
|
3744
|
+
if (element.hoverToggle) {
|
|
3745
|
+
this.showBib();
|
|
3746
|
+
}
|
|
3747
|
+
break;
|
|
3748
|
+
case "mouseleave":
|
|
3749
|
+
if (element.hoverToggle) {
|
|
3750
|
+
this.hideBib("mouseleave");
|
|
3751
|
+
}
|
|
3752
|
+
break;
|
|
3753
|
+
case "focus":
|
|
3754
|
+
if (element.focusShow) {
|
|
3755
|
+
/*
|
|
3756
|
+
This needs to better handle clicking that gives focus -
|
|
3757
|
+
currently it shows and then immediately hides the bib
|
|
3758
|
+
*/
|
|
3759
|
+
this.showBib();
|
|
3760
|
+
}
|
|
3761
|
+
break;
|
|
3762
|
+
case "blur":
|
|
3763
|
+
// send this task 100ms later queue to
|
|
3764
|
+
// wait a frame in case focus moves within the floating element/bib
|
|
3765
|
+
setTimeout(() => this.handleFocusLoss(), 0);
|
|
3766
|
+
break;
|
|
3767
|
+
case "click":
|
|
3768
|
+
if (document.activeElement === document.body) {
|
|
3769
|
+
event.currentTarget.focus();
|
|
3770
|
+
}
|
|
3771
|
+
this.handleClick();
|
|
3772
|
+
break;
|
|
3773
|
+
// Do nothing
|
|
3675
3774
|
}
|
|
3676
3775
|
}
|
|
3677
3776
|
|
|
@@ -3682,6 +3781,11 @@ class AuroFloatingUI {
|
|
|
3682
3781
|
* This prevents the component itself from being focusable when the trigger element already handles focus.
|
|
3683
3782
|
*/
|
|
3684
3783
|
handleTriggerTabIndex() {
|
|
3784
|
+
const element = this.element;
|
|
3785
|
+
if (!element) {
|
|
3786
|
+
return;
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3685
3789
|
const focusableElementSelectors = [
|
|
3686
3790
|
"a",
|
|
3687
3791
|
"button",
|
|
@@ -3694,7 +3798,7 @@ class AuroFloatingUI {
|
|
|
3694
3798
|
"auro-hyperlink",
|
|
3695
3799
|
];
|
|
3696
3800
|
|
|
3697
|
-
const triggerNode =
|
|
3801
|
+
const triggerNode = element.querySelectorAll('[slot="trigger"]')[0];
|
|
3698
3802
|
if (!triggerNode) {
|
|
3699
3803
|
return;
|
|
3700
3804
|
}
|
|
@@ -3703,13 +3807,13 @@ class AuroFloatingUI {
|
|
|
3703
3807
|
focusableElementSelectors.forEach((selector) => {
|
|
3704
3808
|
// Check if the trigger node element is focusable
|
|
3705
3809
|
if (triggerNodeTagName === selector) {
|
|
3706
|
-
|
|
3810
|
+
element.tabIndex = -1;
|
|
3707
3811
|
return;
|
|
3708
3812
|
}
|
|
3709
3813
|
|
|
3710
3814
|
// Check if any child is focusable
|
|
3711
3815
|
if (triggerNode.querySelector(selector)) {
|
|
3712
|
-
|
|
3816
|
+
element.tabIndex = -1;
|
|
3713
3817
|
}
|
|
3714
3818
|
});
|
|
3715
3819
|
}
|
|
@@ -3719,13 +3823,18 @@ class AuroFloatingUI {
|
|
|
3719
3823
|
* @param {*} eventPrefix
|
|
3720
3824
|
*/
|
|
3721
3825
|
regenerateBibId() {
|
|
3722
|
-
|
|
3826
|
+
const element = this.element;
|
|
3827
|
+
if (!element) {
|
|
3828
|
+
return;
|
|
3829
|
+
}
|
|
3830
|
+
|
|
3831
|
+
this.id = element.getAttribute("id");
|
|
3723
3832
|
if (!this.id) {
|
|
3724
3833
|
this.id = window.crypto.randomUUID();
|
|
3725
|
-
|
|
3834
|
+
element.setAttribute("id", this.id);
|
|
3726
3835
|
}
|
|
3727
3836
|
|
|
3728
|
-
|
|
3837
|
+
element.bib?.setAttribute("id", `${this.id}-floater-bib`);
|
|
3729
3838
|
}
|
|
3730
3839
|
|
|
3731
3840
|
configure(elem, eventPrefix, enableKeyboardHandling = true) {
|
|
@@ -3737,67 +3846,69 @@ class AuroFloatingUI {
|
|
|
3737
3846
|
this.element = elem;
|
|
3738
3847
|
}
|
|
3739
3848
|
|
|
3740
|
-
|
|
3741
|
-
|
|
3849
|
+
const element = this.element;
|
|
3850
|
+
if (!element) {
|
|
3851
|
+
return;
|
|
3742
3852
|
}
|
|
3743
3853
|
|
|
3744
|
-
if (this.element.
|
|
3854
|
+
if (this.behavior !== element.behavior) {
|
|
3855
|
+
this.behavior = element.behavior;
|
|
3856
|
+
}
|
|
3857
|
+
|
|
3858
|
+
if (element.trigger) {
|
|
3745
3859
|
this.disconnect();
|
|
3746
3860
|
}
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
this.element.shadowRoot.querySelector("#showStateIcon");
|
|
3861
|
+
element.trigger =
|
|
3862
|
+
element.triggerElement ||
|
|
3863
|
+
element.shadowRoot?.querySelector("#trigger") ||
|
|
3864
|
+
element.trigger;
|
|
3865
|
+
element.bib = element.shadowRoot?.querySelector("#bib") || element.bib;
|
|
3866
|
+
element.bibSizer = element.shadowRoot?.querySelector("#bibSizer");
|
|
3867
|
+
element.triggerChevron =
|
|
3868
|
+
element.shadowRoot?.querySelector("#showStateIcon");
|
|
3756
3869
|
|
|
3757
|
-
if (
|
|
3758
|
-
|
|
3870
|
+
if (element.floaterConfig) {
|
|
3871
|
+
element.hoverToggle = element.floaterConfig.hoverToggle;
|
|
3759
3872
|
}
|
|
3760
3873
|
|
|
3761
3874
|
this.regenerateBibId();
|
|
3762
3875
|
this.handleTriggerTabIndex();
|
|
3763
3876
|
|
|
3764
3877
|
this.handleEvent = this.handleEvent.bind(this);
|
|
3765
|
-
if (
|
|
3878
|
+
if (element.trigger) {
|
|
3766
3879
|
if (this.enableKeyboardHandling) {
|
|
3767
|
-
|
|
3880
|
+
element.trigger.addEventListener("keydown", this.handleEvent);
|
|
3768
3881
|
}
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3882
|
+
element.trigger.addEventListener("click", this.handleEvent);
|
|
3883
|
+
element.trigger.addEventListener("mouseenter", this.handleEvent);
|
|
3884
|
+
element.trigger.addEventListener("mouseleave", this.handleEvent);
|
|
3885
|
+
element.trigger.addEventListener("focus", this.handleEvent);
|
|
3886
|
+
element.trigger.addEventListener("blur", this.handleEvent);
|
|
3774
3887
|
}
|
|
3775
3888
|
}
|
|
3776
3889
|
|
|
3777
3890
|
disconnect() {
|
|
3778
3891
|
this.cleanupHideHandlers();
|
|
3779
|
-
if (this.element) {
|
|
3780
|
-
this.element.cleanup?.();
|
|
3781
3892
|
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3893
|
+
const element = this.element;
|
|
3894
|
+
if (!element) {
|
|
3895
|
+
return;
|
|
3896
|
+
}
|
|
3785
3897
|
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
}
|
|
3898
|
+
element.cleanup?.();
|
|
3899
|
+
|
|
3900
|
+
if (element.bib && element.shadowRoot) {
|
|
3901
|
+
element.shadowRoot.append(element.bib);
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
// Remove event & keyboard listeners
|
|
3905
|
+
if (element.trigger) {
|
|
3906
|
+
element.trigger.removeEventListener("keydown", this.handleEvent);
|
|
3907
|
+
element.trigger.removeEventListener("click", this.handleEvent);
|
|
3908
|
+
element.trigger.removeEventListener("mouseenter", this.handleEvent);
|
|
3909
|
+
element.trigger.removeEventListener("mouseleave", this.handleEvent);
|
|
3910
|
+
element.trigger.removeEventListener("focus", this.handleEvent);
|
|
3911
|
+
element.trigger.removeEventListener("blur", this.handleEvent);
|
|
3801
3912
|
}
|
|
3802
3913
|
}
|
|
3803
3914
|
}
|
|
@@ -4925,7 +5036,7 @@ let AuroHelpText$2 = class AuroHelpText extends LitElement {
|
|
|
4925
5036
|
}
|
|
4926
5037
|
};
|
|
4927
5038
|
|
|
4928
|
-
var formkitVersion$2 = '
|
|
5039
|
+
var formkitVersion$2 = '202604081417';
|
|
4929
5040
|
|
|
4930
5041
|
let AuroElement$2 = class AuroElement extends LitElement {
|
|
4931
5042
|
static get properties() {
|
|
@@ -12682,7 +12793,7 @@ let AuroHelpText$1 = class AuroHelpText extends LitElement {
|
|
|
12682
12793
|
}
|
|
12683
12794
|
};
|
|
12684
12795
|
|
|
12685
|
-
var formkitVersion$1 = '
|
|
12796
|
+
var formkitVersion$1 = '202604081417';
|
|
12686
12797
|
|
|
12687
12798
|
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
12688
12799
|
// See LICENSE in the project root for license information.
|
|
@@ -13747,7 +13858,7 @@ class AuroBibtemplate extends LitElement {
|
|
|
13747
13858
|
}
|
|
13748
13859
|
}
|
|
13749
13860
|
|
|
13750
|
-
var formkitVersion = '
|
|
13861
|
+
var formkitVersion = '202604081417';
|
|
13751
13862
|
|
|
13752
13863
|
var styleCss$1 = css`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;text-align:left}:host [auro-dropdown]{--ds-auro-dropdown-trigger-background-color: transparent}:host #inputInBib::part(wrapper){box-shadow:none}:host #inputInBib::part(accent-left){display:none}:host([layout*=classic]) [auro-input]{width:100%}:host([layout*=classic]) [auro-input]::part(helpText){display:none}:host([layout*=classic]) #slotHolder{display:none}`;
|
|
13753
13864
|
|