@aurodesignsystem-dev/auro-formkit 0.0.0-pr1424.2 → 0.0.0-pr1424.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +133 -183
  3. package/components/checkbox/demo/api.min.js +3 -3
  4. package/components/checkbox/demo/index.min.js +3 -3
  5. package/components/checkbox/dist/index.js +3 -3
  6. package/components/checkbox/dist/registered.js +3 -3
  7. package/components/combobox/demo/api.html +1 -0
  8. package/components/combobox/demo/api.js +3 -1
  9. package/components/combobox/demo/api.md +75 -0
  10. package/components/combobox/demo/api.min.js +314 -172
  11. package/components/combobox/demo/index.min.js +301 -171
  12. package/components/combobox/dist/comboboxKeyboardStrategy.d.ts +1 -1
  13. package/components/combobox/dist/index.js +291 -171
  14. package/components/combobox/dist/registered.js +291 -171
  15. package/components/counter/demo/api.html +3 -0
  16. package/components/counter/demo/api.js +4 -0
  17. package/components/counter/demo/api.md +130 -0
  18. package/components/counter/demo/api.min.js +320 -167
  19. package/components/counter/demo/index.min.js +300 -167
  20. package/components/counter/dist/counterGroupKeyboardStrategy.d.ts +3 -0
  21. package/components/counter/dist/index.js +300 -167
  22. package/components/counter/dist/registered.js +300 -167
  23. package/components/datepicker/demo/api.html +1 -0
  24. package/components/datepicker/demo/api.js +2 -0
  25. package/components/datepicker/demo/api.md +57 -0
  26. package/components/datepicker/demo/api.min.js +376 -171
  27. package/components/datepicker/demo/index.min.js +364 -171
  28. package/components/datepicker/dist/datepickerKeyboardStrategy.d.ts +3 -1
  29. package/components/datepicker/dist/index.js +364 -171
  30. package/components/datepicker/dist/registered.js +364 -171
  31. package/components/dropdown/demo/api.html +1 -0
  32. package/components/dropdown/demo/api.js +2 -0
  33. package/components/dropdown/demo/api.md +95 -0
  34. package/components/dropdown/demo/api.min.js +296 -165
  35. package/components/dropdown/demo/index.min.js +276 -165
  36. package/components/dropdown/dist/index.js +276 -165
  37. package/components/dropdown/dist/registered.js +276 -165
  38. package/components/form/demo/api.min.js +1254 -684
  39. package/components/form/demo/index.min.js +1254 -684
  40. package/components/input/demo/api.min.js +1 -1
  41. package/components/input/demo/index.min.js +1 -1
  42. package/components/input/dist/index.js +1 -1
  43. package/components/input/dist/registered.js +1 -1
  44. package/components/menu/demo/api.md +1 -0
  45. package/components/menu/demo/api.min.js +10 -0
  46. package/components/menu/demo/index.min.js +10 -0
  47. package/components/menu/dist/auro-menuoption.d.ts +9 -0
  48. package/components/menu/dist/index.js +10 -0
  49. package/components/menu/dist/registered.js +10 -0
  50. package/components/radio/demo/api.min.js +2 -2
  51. package/components/radio/demo/index.min.js +2 -2
  52. package/components/radio/dist/index.js +2 -2
  53. package/components/radio/dist/registered.js +2 -2
  54. package/components/select/demo/api.html +1 -0
  55. package/components/select/demo/api.js +2 -0
  56. package/components/select/demo/api.md +76 -0
  57. package/components/select/demo/api.min.js +306 -169
  58. package/components/select/demo/index.min.js +293 -169
  59. package/components/select/dist/index.js +283 -169
  60. package/components/select/dist/registered.js +283 -169
  61. package/custom-elements.json +48 -3
  62. package/package.json +5 -3
@@ -85,6 +85,25 @@ function inDialogExample() {
85
85
  });
86
86
  }
87
87
 
88
+ function inDrawerExample() {
89
+ const openBtn = document.querySelector("#dropdown-drawer-opener");
90
+ const closeBtn = document.querySelector("#in-drawer-dismiss-btn");
91
+ const dropdown = document.querySelector("#in-drawer-dropdown");
92
+
93
+ openBtn?.addEventListener("click", () => {
94
+ const drawer = document.querySelector("#dropdown-drawer");
95
+ if (drawer.hasAttribute('open')) {
96
+ drawer.removeAttribute('open');
97
+ } else {
98
+ drawer.setAttribute('open', true);
99
+ }
100
+ });
101
+
102
+ closeBtn?.addEventListener("click", () => {
103
+ dropdown?.hide();
104
+ });
105
+ }
106
+
88
107
  /**
89
108
  * @license
90
109
  * Copyright 2017 Google LLC
@@ -1964,11 +1983,19 @@ class AuroFloatingUI {
1964
1983
  * This ensures that the bib content has the same dimensions as the sizer element.
1965
1984
  */
1966
1985
  mirrorSize() {
1986
+ const element = this.element;
1987
+ if (!element) {
1988
+ return;
1989
+ }
1990
+
1967
1991
  // mirror the boxsize from bibSizer
1968
- if (this.element.bibSizer && this.element.matchWidth) {
1969
- const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1970
- const bibContent =
1971
- this.element.bib.shadowRoot.querySelector(".container");
1992
+ if (element.bibSizer && element.matchWidth && element.bib?.shadowRoot) {
1993
+ const sizerStyle = window.getComputedStyle(element.bibSizer);
1994
+ const bibContent = element.bib.shadowRoot.querySelector(".container");
1995
+ if (!bibContent) {
1996
+ return;
1997
+ }
1998
+
1972
1999
  if (sizerStyle.width !== "0px") {
1973
2000
  bibContent.style.width = sizerStyle.width;
1974
2001
  }
@@ -1990,9 +2017,14 @@ class AuroFloatingUI {
1990
2017
  * @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
1991
2018
  */
1992
2019
  getPositioningStrategy() {
2020
+ const element = this.element;
2021
+ if (!element) {
2022
+ return "floating";
2023
+ }
2024
+
1993
2025
  const breakpoint =
1994
- this.element.bib.mobileFullscreenBreakpoint ||
1995
- this.element.floaterConfig?.fullscreenBreakpoint;
2026
+ element.bib?.mobileFullscreenBreakpoint ||
2027
+ element.floaterConfig?.fullscreenBreakpoint;
1996
2028
  switch (this.behavior) {
1997
2029
  case "tooltip":
1998
2030
  return "floating";
@@ -2003,9 +2035,9 @@ class AuroFloatingUI {
2003
2035
  `(max-width: ${breakpoint})`,
2004
2036
  ).matches;
2005
2037
 
2006
- this.element.expanded = smallerThanBreakpoint;
2038
+ element.expanded = smallerThanBreakpoint;
2007
2039
  }
2008
- if (this.element.nested) {
2040
+ if (element.nested) {
2009
2041
  return "cover";
2010
2042
  }
2011
2043
  return "fullscreen";
@@ -2035,42 +2067,65 @@ class AuroFloatingUI {
2035
2067
  * and applies the calculated position to the bib's style.
2036
2068
  */
2037
2069
  position() {
2070
+ const element = this.element;
2071
+ if (!element) {
2072
+ return;
2073
+ }
2074
+
2038
2075
  const strategy = this.getPositioningStrategy();
2039
2076
  this.configureBibStrategy(strategy);
2040
2077
 
2041
2078
  if (strategy === "floating") {
2079
+ if (!element.trigger || !element.bib) {
2080
+ return;
2081
+ }
2082
+
2042
2083
  this.mirrorSize();
2043
2084
  // Define the middlware for the floater configuration
2044
2085
  const middleware = [
2045
- offset(this.element.floaterConfig?.offset || 0),
2046
- ...(this.element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
2047
- ...(this.element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
2048
- ...(this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
2086
+ offset(element.floaterConfig?.offset || 0),
2087
+ ...(element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
2088
+ ...(element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
2089
+ ...(element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
2049
2090
  ];
2050
2091
 
2051
2092
  // Compute the position of the bib
2052
- computePosition(this.element.trigger, this.element.bib, {
2053
- strategy: this.element.floaterConfig?.strategy || "fixed",
2054
- placement: this.element.floaterConfig?.placement,
2093
+ computePosition(element.trigger, element.bib, {
2094
+ strategy: element.floaterConfig?.strategy || "fixed",
2095
+ placement: element.floaterConfig?.placement,
2055
2096
  middleware: middleware || [],
2056
2097
  }).then(({ x, y }) => {
2057
2098
  // eslint-disable-line id-length
2058
- Object.assign(this.element.bib.style, {
2099
+ const currentElement = this.element;
2100
+ if (!currentElement?.bib) {
2101
+ return;
2102
+ }
2103
+
2104
+ Object.assign(currentElement.bib.style, {
2059
2105
  left: `${x}px`,
2060
2106
  top: `${y}px`,
2061
2107
  });
2062
2108
  });
2063
2109
  } else if (strategy === "cover") {
2110
+ if (!element.parentNode || !element.bib) {
2111
+ return;
2112
+ }
2113
+
2064
2114
  // Compute the position of the bib
2065
- computePosition(this.element.parentNode, this.element.bib, {
2115
+ computePosition(element.parentNode, element.bib, {
2066
2116
  placement: "bottom-start",
2067
2117
  }).then(({ x, y }) => {
2068
2118
  // eslint-disable-line id-length
2069
- Object.assign(this.element.bib.style, {
2119
+ const currentElement = this.element;
2120
+ if (!currentElement?.bib || !currentElement.parentNode) {
2121
+ return;
2122
+ }
2123
+
2124
+ Object.assign(currentElement.bib.style, {
2070
2125
  left: `${x}px`,
2071
- top: `${y - this.element.parentNode.offsetHeight}px`,
2072
- width: `${this.element.parentNode.offsetWidth}px`,
2073
- height: `${this.element.parentNode.offsetHeight}px`,
2126
+ top: `${y - currentElement.parentNode.offsetHeight}px`,
2127
+ width: `${currentElement.parentNode.offsetWidth}px`,
2128
+ height: `${currentElement.parentNode.offsetHeight}px`,
2074
2129
  });
2075
2130
  });
2076
2131
  }
@@ -2082,11 +2137,17 @@ class AuroFloatingUI {
2082
2137
  * @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
2083
2138
  */
2084
2139
  lockScroll(lock = true) {
2140
+ const element = this.element;
2141
+
2085
2142
  if (lock) {
2143
+ if (!element?.bib) {
2144
+ return;
2145
+ }
2146
+
2086
2147
  document.body.style.overflow = "hidden"; // hide body's scrollbar
2087
2148
 
2088
2149
  // Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
2089
- this.element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
2150
+ element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
2090
2151
  } else {
2091
2152
  document.body.style.overflow = "";
2092
2153
  }
@@ -2102,20 +2163,24 @@ class AuroFloatingUI {
2102
2163
  * @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
2103
2164
  */
2104
2165
  configureBibStrategy(value) {
2166
+ const element = this.element;
2167
+ if (!element?.bib) {
2168
+ return;
2169
+ }
2170
+
2105
2171
  if (value === "fullscreen") {
2106
- this.element.isBibFullscreen = true;
2172
+ element.isBibFullscreen = true;
2107
2173
  // reset the prev position
2108
- this.element.bib.setAttribute("isfullscreen", "");
2109
- this.element.bib.style.position = "fixed";
2110
- this.element.bib.style.top = "0px";
2111
- this.element.bib.style.left = "0px";
2112
- this.element.bib.style.width = "";
2113
- this.element.bib.style.height = "";
2114
- this.element.style.contain = "";
2174
+ element.bib.setAttribute("isfullscreen", "");
2175
+ element.bib.style.position = "fixed";
2176
+ element.bib.style.top = "0px";
2177
+ element.bib.style.left = "0px";
2178
+ element.bib.style.width = "";
2179
+ element.bib.style.height = "";
2180
+ element.style.contain = "";
2115
2181
 
2116
2182
  // reset the size that was mirroring `size` css-part
2117
- const bibContent =
2118
- this.element.bib.shadowRoot.querySelector(".container");
2183
+ const bibContent = element.bib.shadowRoot?.querySelector(".container");
2119
2184
  if (bibContent) {
2120
2185
  bibContent.style.width = "";
2121
2186
  bibContent.style.height = "";
@@ -2130,14 +2195,14 @@ class AuroFloatingUI {
2130
2195
  }, 0);
2131
2196
  }
2132
2197
 
2133
- if (this.element.isPopoverVisible) {
2198
+ if (element.isPopoverVisible) {
2134
2199
  this.lockScroll(true);
2135
2200
  }
2136
2201
  } else {
2137
- this.element.bib.style.position = "";
2138
- this.element.bib.removeAttribute("isfullscreen");
2139
- this.element.isBibFullscreen = false;
2140
- this.element.style.contain = "layout";
2202
+ element.bib.style.position = "";
2203
+ element.bib.removeAttribute("isfullscreen");
2204
+ element.isBibFullscreen = false;
2205
+ element.style.contain = "layout";
2141
2206
  }
2142
2207
 
2143
2208
  const isChanged = this.strategy && this.strategy !== value;
@@ -2155,16 +2220,21 @@ class AuroFloatingUI {
2155
2220
  },
2156
2221
  );
2157
2222
 
2158
- this.element.dispatchEvent(event);
2223
+ element.dispatchEvent(event);
2159
2224
  }
2160
2225
  }
2161
2226
 
2162
2227
  updateState() {
2163
- const isVisible = this.element.isPopoverVisible;
2228
+ const element = this.element;
2229
+ if (!element) {
2230
+ return;
2231
+ }
2232
+
2233
+ const isVisible = element.isPopoverVisible;
2164
2234
  if (!isVisible) {
2165
2235
  this.cleanupHideHandlers();
2166
2236
  try {
2167
- this.element.cleanup?.();
2237
+ element.cleanup?.();
2168
2238
  } catch (error) {
2169
2239
  // Do nothing
2170
2240
  }
@@ -2180,28 +2250,30 @@ class AuroFloatingUI {
2180
2250
  * If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
2181
2251
  */
2182
2252
  handleFocusLoss() {
2253
+ const element = this.element;
2254
+ if (!element?.bib) {
2255
+ return;
2256
+ }
2257
+
2183
2258
  // if mouse is being pressed, skip and let click event to handle the action
2184
2259
  if (AuroFloatingUI.isMousePressed) {
2185
2260
  return;
2186
2261
  }
2187
2262
 
2188
2263
  if (
2189
- this.element.noHideOnThisFocusLoss ||
2190
- this.element.hasAttribute("noHideOnThisFocusLoss")
2264
+ element.noHideOnThisFocusLoss ||
2265
+ element.hasAttribute("noHideOnThisFocusLoss")
2191
2266
  ) {
2192
2267
  return;
2193
2268
  }
2194
2269
 
2195
2270
  // if focus is still inside of trigger or bib, do not close
2196
- if (
2197
- this.element.matches(":focus") ||
2198
- this.element.matches(":focus-within")
2199
- ) {
2271
+ if (element.matches(":focus") || element.matches(":focus-within")) {
2200
2272
  return;
2201
2273
  }
2202
2274
 
2203
2275
  // if fullscreen bib is in fullscreen mode, do not close
2204
- if (this.element.bib.hasAttribute("isfullscreen")) {
2276
+ if (element.bib.hasAttribute("isfullscreen")) {
2205
2277
  return;
2206
2278
  }
2207
2279
 
@@ -2209,23 +2281,33 @@ class AuroFloatingUI {
2209
2281
  }
2210
2282
 
2211
2283
  setupHideHandlers() {
2284
+ const element = this.element;
2285
+ if (!element) {
2286
+ return;
2287
+ }
2288
+
2212
2289
  // Define handlers & store references
2213
2290
  this.focusHandler = () => this.handleFocusLoss();
2214
2291
 
2215
2292
  this.clickHandler = (evt) => {
2293
+ const element = this.element;
2294
+ if (!element?.bib) {
2295
+ return;
2296
+ }
2297
+
2216
2298
  // When the bib is fullscreen (modal dialog), don't close on outside
2217
2299
  // clicks. VoiceOver's synthetic click events inside a top-layer modal
2218
2300
  // <dialog> may not include the bib in composedPath(), causing false
2219
2301
  // positives. This mirrors the fullscreen guard in handleFocusLoss().
2220
- if (this.element.bib && this.element.bib.hasAttribute("isfullscreen")) {
2302
+ if (element.bib.hasAttribute("isfullscreen")) {
2221
2303
  return;
2222
2304
  }
2223
2305
 
2224
2306
  if (
2225
- (!evt.composedPath().includes(this.element.trigger) &&
2226
- !evt.composedPath().includes(this.element.bib)) ||
2227
- (this.element.bib.backdrop &&
2228
- evt.composedPath().includes(this.element.bib.backdrop))
2307
+ (!evt.composedPath().includes(element.trigger) &&
2308
+ !evt.composedPath().includes(element.bib)) ||
2309
+ (element.bib.backdrop &&
2310
+ evt.composedPath().includes(element.bib.backdrop))
2229
2311
  ) {
2230
2312
  const existedVisibleFloatingUI =
2231
2313
  document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
@@ -2246,7 +2328,12 @@ class AuroFloatingUI {
2246
2328
 
2247
2329
  // ESC key handler
2248
2330
  this.keyDownHandler = (evt) => {
2249
- if (evt.key === "Escape" && this.element.isPopoverVisible) {
2331
+ const element = this.element;
2332
+ if (!element) {
2333
+ return;
2334
+ }
2335
+
2336
+ if (evt.key === "Escape" && element.isPopoverVisible) {
2250
2337
  const existedVisibleFloatingUI =
2251
2338
  document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
2252
2339
  if (
@@ -2303,6 +2390,10 @@ class AuroFloatingUI {
2303
2390
  }
2304
2391
 
2305
2392
  updateCurrentExpandedDropdown() {
2393
+ if (!this.element) {
2394
+ return;
2395
+ }
2396
+
2306
2397
  // Close any other dropdown that is already open
2307
2398
  const existedVisibleFloatingUI =
2308
2399
  document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
@@ -2319,25 +2410,34 @@ class AuroFloatingUI {
2319
2410
  }
2320
2411
 
2321
2412
  showBib() {
2322
- if (!this.element.disabled && !this.showing) {
2413
+ const element = this.element;
2414
+ if (!element) {
2415
+ return;
2416
+ }
2417
+
2418
+ if (!element.bib || (!element.trigger && !element.parentNode)) {
2419
+ return;
2420
+ }
2421
+
2422
+ if (!element.disabled && !this.showing) {
2323
2423
  this.updateCurrentExpandedDropdown();
2324
- this.element.triggerChevron?.setAttribute("data-expanded", true);
2424
+ element.triggerChevron?.setAttribute("data-expanded", true);
2325
2425
 
2326
2426
  // prevent double showing: isPopovervisible gets first and showBib gets called later
2327
2427
  if (!this.showing) {
2328
- if (!this.element.modal) {
2428
+ if (!element.modal) {
2329
2429
  this.setupHideHandlers();
2330
2430
  }
2331
2431
  this.showing = true;
2332
- this.element.isPopoverVisible = true;
2432
+ element.isPopoverVisible = true;
2333
2433
  this.position();
2334
2434
  this.dispatchEventDropdownToggle();
2335
2435
  }
2336
2436
 
2337
2437
  // Setup auto update to handle resize and scroll
2338
- this.element.cleanup = autoUpdate(
2339
- this.element.trigger || this.element.parentNode,
2340
- this.element.bib,
2438
+ element.cleanup = autoUpdate(
2439
+ element.trigger || element.parentNode,
2440
+ element.bib,
2341
2441
  () => {
2342
2442
  this.position();
2343
2443
  },
@@ -2350,22 +2450,27 @@ class AuroFloatingUI {
2350
2450
  * @param {String} eventType - The event type that triggered the hiding action.
2351
2451
  */
2352
2452
  hideBib(eventType = "unknown") {
2353
- if (this.element.disabled) {
2453
+ const element = this.element;
2454
+ if (!element) {
2455
+ return;
2456
+ }
2457
+
2458
+ if (element.disabled) {
2354
2459
  return;
2355
2460
  }
2356
2461
 
2357
2462
  // noToggle dropdowns should not close when the trigger is clicked (the
2358
2463
  // "toggle" behavior), but they CAN still close via other interactions like
2359
2464
  // Escape key or focus loss.
2360
- if (this.element.noToggle && eventType === "click") {
2465
+ if (element.noToggle && eventType === "click") {
2361
2466
  return;
2362
2467
  }
2363
2468
 
2364
2469
  this.lockScroll(false);
2365
- this.element.triggerChevron?.removeAttribute("data-expanded");
2470
+ element.triggerChevron?.removeAttribute("data-expanded");
2366
2471
 
2367
- if (this.element.isPopoverVisible) {
2368
- this.element.isPopoverVisible = false;
2472
+ if (element.isPopoverVisible) {
2473
+ element.isPopoverVisible = false;
2369
2474
  }
2370
2475
  if (this.showing) {
2371
2476
  this.cleanupHideHandlers();
@@ -2385,6 +2490,11 @@ class AuroFloatingUI {
2385
2490
  * @param {String} eventType - The event type that triggered the toggle action.
2386
2491
  */
2387
2492
  dispatchEventDropdownToggle(eventType) {
2493
+ const element = this.element;
2494
+ if (!element) {
2495
+ return;
2496
+ }
2497
+
2388
2498
  const event = new CustomEvent(
2389
2499
  this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
2390
2500
  {
@@ -2396,11 +2506,16 @@ class AuroFloatingUI {
2396
2506
  },
2397
2507
  );
2398
2508
 
2399
- this.element.dispatchEvent(event);
2509
+ element.dispatchEvent(event);
2400
2510
  }
2401
2511
 
2402
2512
  handleClick() {
2403
- if (this.element.isPopoverVisible) {
2513
+ const element = this.element;
2514
+ if (!element) {
2515
+ return;
2516
+ }
2517
+
2518
+ if (element.isPopoverVisible) {
2404
2519
  this.hideBib("click");
2405
2520
  } else {
2406
2521
  this.showBib();
@@ -2411,63 +2526,66 @@ class AuroFloatingUI {
2411
2526
  {
2412
2527
  composed: true,
2413
2528
  detail: {
2414
- expanded: this.element.isPopoverVisible,
2529
+ expanded: element.isPopoverVisible,
2415
2530
  },
2416
2531
  },
2417
2532
  );
2418
2533
 
2419
- this.element.dispatchEvent(event);
2534
+ element.dispatchEvent(event);
2420
2535
  }
2421
2536
 
2422
2537
  handleEvent(event) {
2423
- if (!this.element.disableEventShow) {
2424
- switch (event.type) {
2425
- case "keydown": {
2426
- // Support both Enter and Space keys for accessibility
2427
- // Space is included as it's expected behavior for interactive elements
2428
-
2429
- const origin = event.composedPath()[0];
2430
- if (
2431
- event.key === "Enter" ||
2432
- (event.key === " " && (!origin || origin.tagName !== "INPUT"))
2433
- ) {
2434
- event.preventDefault();
2435
- this.handleClick();
2436
- }
2437
- break;
2438
- }
2439
- case "mouseenter":
2440
- if (this.element.hoverToggle) {
2441
- this.showBib();
2442
- }
2443
- break;
2444
- case "mouseleave":
2445
- if (this.element.hoverToggle) {
2446
- this.hideBib("mouseleave");
2447
- }
2448
- break;
2449
- case "focus":
2450
- if (this.element.focusShow) {
2451
- /*
2452
- This needs to better handle clicking that gives focus -
2453
- currently it shows and then immediately hides the bib
2454
- */
2455
- this.showBib();
2456
- }
2457
- break;
2458
- case "blur":
2459
- // send this task 100ms later queue to
2460
- // wait a frame in case focus moves within the floating element/bib
2461
- setTimeout(() => this.handleFocusLoss(), 0);
2462
- break;
2463
- case "click":
2464
- if (document.activeElement === document.body) {
2465
- event.currentTarget.focus();
2466
- }
2538
+ const element = this.element;
2539
+ if (!element || element.disableEventShow) {
2540
+ return;
2541
+ }
2542
+
2543
+ switch (event.type) {
2544
+ case "keydown": {
2545
+ // Support both Enter and Space keys for accessibility
2546
+ // Space is included as it's expected behavior for interactive elements
2547
+
2548
+ const origin = event.composedPath()[0];
2549
+ if (
2550
+ event.key === "Enter" ||
2551
+ (event.key === " " && (!origin || origin.tagName !== "INPUT"))
2552
+ ) {
2553
+ event.preventDefault();
2467
2554
  this.handleClick();
2468
- break;
2469
- // Do nothing
2555
+ }
2556
+ break;
2470
2557
  }
2558
+ case "mouseenter":
2559
+ if (element.hoverToggle) {
2560
+ this.showBib();
2561
+ }
2562
+ break;
2563
+ case "mouseleave":
2564
+ if (element.hoverToggle) {
2565
+ this.hideBib("mouseleave");
2566
+ }
2567
+ break;
2568
+ case "focus":
2569
+ if (element.focusShow) {
2570
+ /*
2571
+ This needs to better handle clicking that gives focus -
2572
+ currently it shows and then immediately hides the bib
2573
+ */
2574
+ this.showBib();
2575
+ }
2576
+ break;
2577
+ case "blur":
2578
+ // send this task 100ms later queue to
2579
+ // wait a frame in case focus moves within the floating element/bib
2580
+ setTimeout(() => this.handleFocusLoss(), 0);
2581
+ break;
2582
+ case "click":
2583
+ if (document.activeElement === document.body) {
2584
+ event.currentTarget.focus();
2585
+ }
2586
+ this.handleClick();
2587
+ break;
2588
+ // Do nothing
2471
2589
  }
2472
2590
  }
2473
2591
 
@@ -2478,6 +2596,11 @@ class AuroFloatingUI {
2478
2596
  * This prevents the component itself from being focusable when the trigger element already handles focus.
2479
2597
  */
2480
2598
  handleTriggerTabIndex() {
2599
+ const element = this.element;
2600
+ if (!element) {
2601
+ return;
2602
+ }
2603
+
2481
2604
  const focusableElementSelectors = [
2482
2605
  "a",
2483
2606
  "button",
@@ -2490,7 +2613,7 @@ class AuroFloatingUI {
2490
2613
  "auro-hyperlink",
2491
2614
  ];
2492
2615
 
2493
- const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
2616
+ const triggerNode = element.querySelectorAll('[slot="trigger"]')[0];
2494
2617
  if (!triggerNode) {
2495
2618
  return;
2496
2619
  }
@@ -2499,13 +2622,13 @@ class AuroFloatingUI {
2499
2622
  focusableElementSelectors.forEach((selector) => {
2500
2623
  // Check if the trigger node element is focusable
2501
2624
  if (triggerNodeTagName === selector) {
2502
- this.element.tabIndex = -1;
2625
+ element.tabIndex = -1;
2503
2626
  return;
2504
2627
  }
2505
2628
 
2506
2629
  // Check if any child is focusable
2507
2630
  if (triggerNode.querySelector(selector)) {
2508
- this.element.tabIndex = -1;
2631
+ element.tabIndex = -1;
2509
2632
  }
2510
2633
  });
2511
2634
  }
@@ -2515,13 +2638,18 @@ class AuroFloatingUI {
2515
2638
  * @param {*} eventPrefix
2516
2639
  */
2517
2640
  regenerateBibId() {
2518
- this.id = this.element.getAttribute("id");
2641
+ const element = this.element;
2642
+ if (!element) {
2643
+ return;
2644
+ }
2645
+
2646
+ this.id = element.getAttribute("id");
2519
2647
  if (!this.id) {
2520
2648
  this.id = window.crypto.randomUUID();
2521
- this.element.setAttribute("id", this.id);
2649
+ element.setAttribute("id", this.id);
2522
2650
  }
2523
2651
 
2524
- this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
2652
+ element.bib?.setAttribute("id", `${this.id}-floater-bib`);
2525
2653
  }
2526
2654
 
2527
2655
  configure(elem, eventPrefix, enableKeyboardHandling = true) {
@@ -2533,67 +2661,69 @@ class AuroFloatingUI {
2533
2661
  this.element = elem;
2534
2662
  }
2535
2663
 
2536
- if (this.behavior !== this.element.behavior) {
2537
- this.behavior = this.element.behavior;
2664
+ const element = this.element;
2665
+ if (!element) {
2666
+ return;
2538
2667
  }
2539
2668
 
2540
- if (this.element.trigger) {
2541
- this.disconnect();
2669
+ if (this.behavior !== element.behavior) {
2670
+ this.behavior = element.behavior;
2542
2671
  }
2543
- this.element.trigger =
2544
- this.element.triggerElement ||
2545
- this.element.shadowRoot.querySelector("#trigger") ||
2546
- this.element.trigger;
2547
- this.element.bib =
2548
- this.element.shadowRoot.querySelector("#bib") || this.element.bib;
2549
- this.element.bibSizer = this.element.shadowRoot.querySelector("#bibSizer");
2550
- this.element.triggerChevron =
2551
- this.element.shadowRoot.querySelector("#showStateIcon");
2552
2672
 
2553
- if (this.element.floaterConfig) {
2554
- this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
2673
+ if (element.trigger) {
2674
+ this.disconnect();
2675
+ }
2676
+ element.trigger =
2677
+ element.triggerElement ||
2678
+ element.shadowRoot?.querySelector("#trigger") ||
2679
+ element.trigger;
2680
+ element.bib = element.shadowRoot?.querySelector("#bib") || element.bib;
2681
+ element.bibSizer = element.shadowRoot?.querySelector("#bibSizer");
2682
+ element.triggerChevron =
2683
+ element.shadowRoot?.querySelector("#showStateIcon");
2684
+
2685
+ if (element.floaterConfig) {
2686
+ element.hoverToggle = element.floaterConfig.hoverToggle;
2555
2687
  }
2556
2688
 
2557
2689
  this.regenerateBibId();
2558
2690
  this.handleTriggerTabIndex();
2559
2691
 
2560
2692
  this.handleEvent = this.handleEvent.bind(this);
2561
- if (this.element.trigger) {
2693
+ if (element.trigger) {
2562
2694
  if (this.enableKeyboardHandling) {
2563
- this.element.trigger.addEventListener("keydown", this.handleEvent);
2695
+ element.trigger.addEventListener("keydown", this.handleEvent);
2564
2696
  }
2565
- this.element.trigger.addEventListener("click", this.handleEvent);
2566
- this.element.trigger.addEventListener("mouseenter", this.handleEvent);
2567
- this.element.trigger.addEventListener("mouseleave", this.handleEvent);
2568
- this.element.trigger.addEventListener("focus", this.handleEvent);
2569
- this.element.trigger.addEventListener("blur", this.handleEvent);
2697
+ element.trigger.addEventListener("click", this.handleEvent);
2698
+ element.trigger.addEventListener("mouseenter", this.handleEvent);
2699
+ element.trigger.addEventListener("mouseleave", this.handleEvent);
2700
+ element.trigger.addEventListener("focus", this.handleEvent);
2701
+ element.trigger.addEventListener("blur", this.handleEvent);
2570
2702
  }
2571
2703
  }
2572
2704
 
2573
2705
  disconnect() {
2574
2706
  this.cleanupHideHandlers();
2575
- if (this.element) {
2576
- this.element.cleanup?.();
2577
2707
 
2578
- if (this.element.bib) {
2579
- this.element.shadowRoot.append(this.element.bib);
2580
- }
2708
+ const element = this.element;
2709
+ if (!element) {
2710
+ return;
2711
+ }
2581
2712
 
2582
- // Remove event & keyboard listeners
2583
- if (this.element?.trigger) {
2584
- this.element.trigger.removeEventListener("keydown", this.handleEvent);
2585
- this.element.trigger.removeEventListener("click", this.handleEvent);
2586
- this.element.trigger.removeEventListener(
2587
- "mouseenter",
2588
- this.handleEvent,
2589
- );
2590
- this.element.trigger.removeEventListener(
2591
- "mouseleave",
2592
- this.handleEvent,
2593
- );
2594
- this.element.trigger.removeEventListener("focus", this.handleEvent);
2595
- this.element.trigger.removeEventListener("blur", this.handleEvent);
2596
- }
2713
+ element.cleanup?.();
2714
+
2715
+ if (element.bib && element.shadowRoot) {
2716
+ element.shadowRoot.append(element.bib);
2717
+ }
2718
+
2719
+ // Remove event & keyboard listeners
2720
+ if (element.trigger) {
2721
+ element.trigger.removeEventListener("keydown", this.handleEvent);
2722
+ element.trigger.removeEventListener("click", this.handleEvent);
2723
+ element.trigger.removeEventListener("mouseenter", this.handleEvent);
2724
+ element.trigger.removeEventListener("mouseleave", this.handleEvent);
2725
+ element.trigger.removeEventListener("focus", this.handleEvent);
2726
+ element.trigger.removeEventListener("blur", this.handleEvent);
2597
2727
  }
2598
2728
  }
2599
2729
  }
@@ -3752,7 +3882,7 @@ class AuroHelpText extends i {
3752
3882
  }
3753
3883
  }
3754
3884
 
3755
- var formkitVersion = '202604072212';
3885
+ var formkitVersion = '202604091759';
3756
3886
 
3757
3887
  class AuroElement extends i {
3758
3888
  static get properties() {
@@ -3858,7 +3988,7 @@ class AuroElement extends i {
3858
3988
  }
3859
3989
  }
3860
3990
 
3861
- // Copyright (c) 2026 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
3991
+ // Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
3862
3992
  // See LICENSE in the project root for license information.
3863
3993
 
3864
3994
 
@@ -4895,6 +5025,7 @@ function initExamples() {
4895
5025
  hideExample();
4896
5026
  showExample();
4897
5027
  inDialogExample();
5028
+ inDrawerExample();
4898
5029
  }
4899
5030
 
4900
5031
  export { initExamples };