@aurodesignsystem-dev/auro-formkit 0.0.0-pr1422.1 → 0.0.0-pr1423.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.
Files changed (35) hide show
  1. package/components/checkbox/demo/api.min.js +1 -1
  2. package/components/checkbox/demo/index.min.js +1 -1
  3. package/components/checkbox/dist/index.js +1 -1
  4. package/components/checkbox/dist/registered.js +1 -1
  5. package/components/combobox/demo/api.min.js +165 -275
  6. package/components/combobox/demo/index.min.js +165 -275
  7. package/components/combobox/dist/index.js +165 -275
  8. package/components/combobox/dist/registered.js +165 -275
  9. package/components/counter/demo/api.min.js +164 -274
  10. package/components/counter/demo/index.min.js +164 -274
  11. package/components/counter/dist/index.js +164 -274
  12. package/components/counter/dist/registered.js +164 -274
  13. package/components/datepicker/demo/api.min.js +165 -275
  14. package/components/datepicker/demo/index.min.js +165 -275
  15. package/components/datepicker/dist/index.js +165 -275
  16. package/components/datepicker/dist/registered.js +165 -275
  17. package/components/dropdown/demo/api.min.js +164 -274
  18. package/components/dropdown/demo/index.min.js +164 -274
  19. package/components/dropdown/dist/index.js +164 -274
  20. package/components/dropdown/dist/registered.js +164 -274
  21. package/components/form/demo/api.min.js +661 -1101
  22. package/components/form/demo/index.min.js +661 -1101
  23. package/components/input/demo/api.min.js +1 -1
  24. package/components/input/demo/index.min.js +1 -1
  25. package/components/input/dist/index.js +1 -1
  26. package/components/input/dist/registered.js +1 -1
  27. package/components/radio/demo/api.min.js +1 -1
  28. package/components/radio/demo/index.min.js +1 -1
  29. package/components/radio/dist/index.js +1 -1
  30. package/components/radio/dist/registered.js +1 -1
  31. package/components/select/demo/api.min.js +164 -274
  32. package/components/select/demo/index.min.js +164 -274
  33. package/components/select/dist/index.js +164 -274
  34. package/components/select/dist/registered.js +164 -274
  35. package/package.json +2 -2
@@ -1964,19 +1964,11 @@ class AuroFloatingUI {
1964
1964
  * This ensures that the bib content has the same dimensions as the sizer element.
1965
1965
  */
1966
1966
  mirrorSize() {
1967
- const element = this.element;
1968
- if (!element) {
1969
- return;
1970
- }
1971
-
1972
1967
  // mirror the boxsize from bibSizer
1973
- if (element.bibSizer && element.matchWidth && element.bib?.shadowRoot) {
1974
- const sizerStyle = window.getComputedStyle(element.bibSizer);
1975
- const bibContent = element.bib.shadowRoot.querySelector(".container");
1976
- if (!bibContent) {
1977
- return;
1978
- }
1979
-
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");
1980
1972
  if (sizerStyle.width !== "0px") {
1981
1973
  bibContent.style.width = sizerStyle.width;
1982
1974
  }
@@ -1998,14 +1990,9 @@ class AuroFloatingUI {
1998
1990
  * @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
1999
1991
  */
2000
1992
  getPositioningStrategy() {
2001
- const element = this.element;
2002
- if (!element) {
2003
- return this.behavior || "floating";
2004
- }
2005
-
2006
1993
  const breakpoint =
2007
- element.bib?.mobileFullscreenBreakpoint ||
2008
- element.floaterConfig?.fullscreenBreakpoint;
1994
+ this.element.bib.mobileFullscreenBreakpoint ||
1995
+ this.element.floaterConfig?.fullscreenBreakpoint;
2009
1996
  switch (this.behavior) {
2010
1997
  case "tooltip":
2011
1998
  return "floating";
@@ -2016,9 +2003,9 @@ class AuroFloatingUI {
2016
2003
  `(max-width: ${breakpoint})`,
2017
2004
  ).matches;
2018
2005
 
2019
- element.expanded = smallerThanBreakpoint;
2006
+ this.element.expanded = smallerThanBreakpoint;
2020
2007
  }
2021
- if (element.nested) {
2008
+ if (this.element.nested) {
2022
2009
  return "cover";
2023
2010
  }
2024
2011
  return "fullscreen";
@@ -2048,65 +2035,42 @@ class AuroFloatingUI {
2048
2035
  * and applies the calculated position to the bib's style.
2049
2036
  */
2050
2037
  position() {
2051
- const element = this.element;
2052
- if (!element) {
2053
- return;
2054
- }
2055
-
2056
2038
  const strategy = this.getPositioningStrategy();
2057
2039
  this.configureBibStrategy(strategy);
2058
2040
 
2059
2041
  if (strategy === "floating") {
2060
- if (!element.trigger || !element.bib) {
2061
- return;
2062
- }
2063
-
2064
2042
  this.mirrorSize();
2065
2043
  // Define the middlware for the floater configuration
2066
2044
  const middleware = [
2067
- offset(element.floaterConfig?.offset || 0),
2068
- ...(element.floaterConfig?.shift ? [shift()] : []), // Add shift middleware if shift is enabled.
2069
- ...(element.floaterConfig?.flip ? [flip()] : []), // Add flip middleware if flip is enabled.
2070
- ...(element.floaterConfig?.autoPlacement ? [autoPlacement()] : []), // Add autoPlacement middleware if autoPlacement is enabled.
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.
2071
2049
  ];
2072
2050
 
2073
2051
  // Compute the position of the bib
2074
- computePosition(element.trigger, element.bib, {
2075
- strategy: element.floaterConfig?.strategy || "fixed",
2076
- placement: element.floaterConfig?.placement,
2052
+ computePosition(this.element.trigger, this.element.bib, {
2053
+ strategy: this.element.floaterConfig?.strategy || "fixed",
2054
+ placement: this.element.floaterConfig?.placement,
2077
2055
  middleware: middleware || [],
2078
2056
  }).then(({ x, y }) => {
2079
2057
  // eslint-disable-line id-length
2080
- const currentElement = this.element;
2081
- if (!currentElement?.bib) {
2082
- return;
2083
- }
2084
-
2085
- Object.assign(currentElement.bib.style, {
2058
+ Object.assign(this.element.bib.style, {
2086
2059
  left: `${x}px`,
2087
2060
  top: `${y}px`,
2088
2061
  });
2089
2062
  });
2090
2063
  } else if (strategy === "cover") {
2091
- if (!element.parentNode || !element.bib) {
2092
- return;
2093
- }
2094
-
2095
2064
  // Compute the position of the bib
2096
- computePosition(element.parentNode, element.bib, {
2065
+ computePosition(this.element.parentNode, this.element.bib, {
2097
2066
  placement: "bottom-start",
2098
2067
  }).then(({ x, y }) => {
2099
2068
  // eslint-disable-line id-length
2100
- const currentElement = this.element;
2101
- if (!currentElement?.bib || !currentElement.parentNode) {
2102
- return;
2103
- }
2104
-
2105
- Object.assign(currentElement.bib.style, {
2069
+ Object.assign(this.element.bib.style, {
2106
2070
  left: `${x}px`,
2107
- top: `${y - currentElement.parentNode.offsetHeight}px`,
2108
- width: `${currentElement.parentNode.offsetWidth}px`,
2109
- height: `${currentElement.parentNode.offsetHeight}px`,
2071
+ top: `${y - this.element.parentNode.offsetHeight}px`,
2072
+ width: `${this.element.parentNode.offsetWidth}px`,
2073
+ height: `${this.element.parentNode.offsetHeight}px`,
2110
2074
  });
2111
2075
  });
2112
2076
  }
@@ -2118,17 +2082,11 @@ class AuroFloatingUI {
2118
2082
  * @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
2119
2083
  */
2120
2084
  lockScroll(lock = true) {
2121
- const element = this.element;
2122
-
2123
2085
  if (lock) {
2124
- if (!element?.bib) {
2125
- return;
2126
- }
2127
-
2128
2086
  document.body.style.overflow = "hidden"; // hide body's scrollbar
2129
2087
 
2130
2088
  // Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
2131
- element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
2089
+ this.element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
2132
2090
  } else {
2133
2091
  document.body.style.overflow = "";
2134
2092
  }
@@ -2144,24 +2102,20 @@ class AuroFloatingUI {
2144
2102
  * @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
2145
2103
  */
2146
2104
  configureBibStrategy(value) {
2147
- const element = this.element;
2148
- if (!element?.bib) {
2149
- return;
2150
- }
2151
-
2152
2105
  if (value === "fullscreen") {
2153
- element.isBibFullscreen = true;
2106
+ this.element.isBibFullscreen = true;
2154
2107
  // reset the prev position
2155
- element.bib.setAttribute("isfullscreen", "");
2156
- element.bib.style.position = "fixed";
2157
- element.bib.style.top = "0px";
2158
- element.bib.style.left = "0px";
2159
- element.bib.style.width = "";
2160
- element.bib.style.height = "";
2161
- element.style.contain = "";
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 = "";
2162
2115
 
2163
2116
  // reset the size that was mirroring `size` css-part
2164
- const bibContent = element.bib.shadowRoot?.querySelector(".container");
2117
+ const bibContent =
2118
+ this.element.bib.shadowRoot.querySelector(".container");
2165
2119
  if (bibContent) {
2166
2120
  bibContent.style.width = "";
2167
2121
  bibContent.style.height = "";
@@ -2176,14 +2130,14 @@ class AuroFloatingUI {
2176
2130
  }, 0);
2177
2131
  }
2178
2132
 
2179
- if (element.isPopoverVisible) {
2133
+ if (this.element.isPopoverVisible) {
2180
2134
  this.lockScroll(true);
2181
2135
  }
2182
2136
  } else {
2183
- element.bib.style.position = "";
2184
- element.bib.removeAttribute("isfullscreen");
2185
- element.isBibFullscreen = false;
2186
- element.style.contain = "layout";
2137
+ this.element.bib.style.position = "";
2138
+ this.element.bib.removeAttribute("isfullscreen");
2139
+ this.element.isBibFullscreen = false;
2140
+ this.element.style.contain = "layout";
2187
2141
  }
2188
2142
 
2189
2143
  const isChanged = this.strategy && this.strategy !== value;
@@ -2201,21 +2155,16 @@ class AuroFloatingUI {
2201
2155
  },
2202
2156
  );
2203
2157
 
2204
- element.dispatchEvent(event);
2158
+ this.element.dispatchEvent(event);
2205
2159
  }
2206
2160
  }
2207
2161
 
2208
2162
  updateState() {
2209
- const element = this.element;
2210
- if (!element) {
2211
- return;
2212
- }
2213
-
2214
- const isVisible = element.isPopoverVisible;
2163
+ const isVisible = this.element.isPopoverVisible;
2215
2164
  if (!isVisible) {
2216
2165
  this.cleanupHideHandlers();
2217
2166
  try {
2218
- element.cleanup?.();
2167
+ this.element.cleanup?.();
2219
2168
  } catch (error) {
2220
2169
  // Do nothing
2221
2170
  }
@@ -2231,30 +2180,28 @@ class AuroFloatingUI {
2231
2180
  * If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
2232
2181
  */
2233
2182
  handleFocusLoss() {
2234
- const element = this.element;
2235
- if (!element?.bib) {
2236
- return;
2237
- }
2238
-
2239
2183
  // if mouse is being pressed, skip and let click event to handle the action
2240
2184
  if (AuroFloatingUI.isMousePressed) {
2241
2185
  return;
2242
2186
  }
2243
2187
 
2244
2188
  if (
2245
- element.noHideOnThisFocusLoss ||
2246
- element.hasAttribute("noHideOnThisFocusLoss")
2189
+ this.element.noHideOnThisFocusLoss ||
2190
+ this.element.hasAttribute("noHideOnThisFocusLoss")
2247
2191
  ) {
2248
2192
  return;
2249
2193
  }
2250
2194
 
2251
2195
  // if focus is still inside of trigger or bib, do not close
2252
- if (element.matches(":focus") || element.matches(":focus-within")) {
2196
+ if (
2197
+ this.element.matches(":focus") ||
2198
+ this.element.matches(":focus-within")
2199
+ ) {
2253
2200
  return;
2254
2201
  }
2255
2202
 
2256
2203
  // if fullscreen bib is in fullscreen mode, do not close
2257
- if (element.bib.hasAttribute("isfullscreen")) {
2204
+ if (this.element.bib.hasAttribute("isfullscreen")) {
2258
2205
  return;
2259
2206
  }
2260
2207
 
@@ -2262,32 +2209,23 @@ class AuroFloatingUI {
2262
2209
  }
2263
2210
 
2264
2211
  setupHideHandlers() {
2265
- if (!this.element) {
2266
- return;
2267
- }
2268
-
2269
2212
  // Define handlers & store references
2270
2213
  this.focusHandler = () => this.handleFocusLoss();
2271
2214
 
2272
2215
  this.clickHandler = (evt) => {
2273
- const element = this.element;
2274
- if (!element?.bib) {
2275
- return;
2276
- }
2277
-
2278
2216
  // When the bib is fullscreen (modal dialog), don't close on outside
2279
2217
  // clicks. VoiceOver's synthetic click events inside a top-layer modal
2280
2218
  // <dialog> may not include the bib in composedPath(), causing false
2281
2219
  // positives. This mirrors the fullscreen guard in handleFocusLoss().
2282
- if (element.bib.hasAttribute("isfullscreen")) {
2220
+ if (this.element.bib && this.element.bib.hasAttribute("isfullscreen")) {
2283
2221
  return;
2284
2222
  }
2285
2223
 
2286
2224
  if (
2287
- (!evt.composedPath().includes(element.trigger) &&
2288
- !evt.composedPath().includes(element.bib)) ||
2289
- (element.bib.backdrop &&
2290
- evt.composedPath().includes(element.bib.backdrop))
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))
2291
2229
  ) {
2292
2230
  const existedVisibleFloatingUI =
2293
2231
  document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
@@ -2308,12 +2246,7 @@ class AuroFloatingUI {
2308
2246
 
2309
2247
  // ESC key handler
2310
2248
  this.keyDownHandler = (evt) => {
2311
- const element = this.element;
2312
- if (!element) {
2313
- return;
2314
- }
2315
-
2316
- if (evt.key === "Escape" && element.isPopoverVisible) {
2249
+ if (evt.key === "Escape" && this.element.isPopoverVisible) {
2317
2250
  const existedVisibleFloatingUI =
2318
2251
  document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
2319
2252
  if (
@@ -2370,10 +2303,6 @@ class AuroFloatingUI {
2370
2303
  }
2371
2304
 
2372
2305
  updateCurrentExpandedDropdown() {
2373
- if (!this.element) {
2374
- return;
2375
- }
2376
-
2377
2306
  // Close any other dropdown that is already open
2378
2307
  const existedVisibleFloatingUI =
2379
2308
  document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
@@ -2390,34 +2319,25 @@ class AuroFloatingUI {
2390
2319
  }
2391
2320
 
2392
2321
  showBib() {
2393
- const element = this.element;
2394
- if (!element) {
2395
- return;
2396
- }
2397
-
2398
- if (!element.disabled && !this.showing) {
2322
+ if (!this.element.disabled && !this.showing) {
2399
2323
  this.updateCurrentExpandedDropdown();
2400
- element.triggerChevron?.setAttribute("data-expanded", true);
2324
+ this.element.triggerChevron?.setAttribute("data-expanded", true);
2401
2325
 
2402
2326
  // prevent double showing: isPopovervisible gets first and showBib gets called later
2403
2327
  if (!this.showing) {
2404
- if (!element.modal) {
2328
+ if (!this.element.modal) {
2405
2329
  this.setupHideHandlers();
2406
2330
  }
2407
2331
  this.showing = true;
2408
- element.isPopoverVisible = true;
2332
+ this.element.isPopoverVisible = true;
2409
2333
  this.position();
2410
2334
  this.dispatchEventDropdownToggle();
2411
2335
  }
2412
2336
 
2413
- if (!element.bib || (!element.trigger && !element.parentNode)) {
2414
- return;
2415
- }
2416
-
2417
2337
  // Setup auto update to handle resize and scroll
2418
- element.cleanup = autoUpdate(
2419
- element.trigger || element.parentNode,
2420
- element.bib,
2338
+ this.element.cleanup = autoUpdate(
2339
+ this.element.trigger || this.element.parentNode,
2340
+ this.element.bib,
2421
2341
  () => {
2422
2342
  this.position();
2423
2343
  },
@@ -2430,27 +2350,22 @@ class AuroFloatingUI {
2430
2350
  * @param {String} eventType - The event type that triggered the hiding action.
2431
2351
  */
2432
2352
  hideBib(eventType = "unknown") {
2433
- const element = this.element;
2434
- if (!element) {
2435
- return;
2436
- }
2437
-
2438
- if (element.disabled) {
2353
+ if (this.element.disabled) {
2439
2354
  return;
2440
2355
  }
2441
2356
 
2442
2357
  // noToggle dropdowns should not close when the trigger is clicked (the
2443
2358
  // "toggle" behavior), but they CAN still close via other interactions like
2444
2359
  // Escape key or focus loss.
2445
- if (element.noToggle && eventType === "click") {
2360
+ if (this.element.noToggle && eventType === "click") {
2446
2361
  return;
2447
2362
  }
2448
2363
 
2449
2364
  this.lockScroll(false);
2450
- element.triggerChevron?.removeAttribute("data-expanded");
2365
+ this.element.triggerChevron?.removeAttribute("data-expanded");
2451
2366
 
2452
- if (element.isPopoverVisible) {
2453
- element.isPopoverVisible = false;
2367
+ if (this.element.isPopoverVisible) {
2368
+ this.element.isPopoverVisible = false;
2454
2369
  }
2455
2370
  if (this.showing) {
2456
2371
  this.cleanupHideHandlers();
@@ -2470,11 +2385,6 @@ class AuroFloatingUI {
2470
2385
  * @param {String} eventType - The event type that triggered the toggle action.
2471
2386
  */
2472
2387
  dispatchEventDropdownToggle(eventType) {
2473
- const element = this.element;
2474
- if (!element) {
2475
- return;
2476
- }
2477
-
2478
2388
  const event = new CustomEvent(
2479
2389
  this.eventPrefix ? `${this.eventPrefix}-toggled` : "toggled",
2480
2390
  {
@@ -2486,16 +2396,11 @@ class AuroFloatingUI {
2486
2396
  },
2487
2397
  );
2488
2398
 
2489
- element.dispatchEvent(event);
2399
+ this.element.dispatchEvent(event);
2490
2400
  }
2491
2401
 
2492
2402
  handleClick() {
2493
- const element = this.element;
2494
- if (!element) {
2495
- return;
2496
- }
2497
-
2498
- if (element.isPopoverVisible) {
2403
+ if (this.element.isPopoverVisible) {
2499
2404
  this.hideBib("click");
2500
2405
  } else {
2501
2406
  this.showBib();
@@ -2506,66 +2411,63 @@ class AuroFloatingUI {
2506
2411
  {
2507
2412
  composed: true,
2508
2413
  detail: {
2509
- expanded: element.isPopoverVisible,
2414
+ expanded: this.element.isPopoverVisible,
2510
2415
  },
2511
2416
  },
2512
2417
  );
2513
2418
 
2514
- element.dispatchEvent(event);
2419
+ this.element.dispatchEvent(event);
2515
2420
  }
2516
2421
 
2517
2422
  handleEvent(event) {
2518
- const element = this.element;
2519
- if (!element || element.disableEventShow) {
2520
- return;
2521
- }
2522
-
2523
- switch (event.type) {
2524
- case "keydown": {
2525
- // Support both Enter and Space keys for accessibility
2526
- // Space is included as it's expected behavior for interactive elements
2527
-
2528
- const origin = event.composedPath()[0];
2529
- if (
2530
- event.key === "Enter" ||
2531
- (event.key === " " && (!origin || origin.tagName !== "INPUT"))
2532
- ) {
2533
- event.preventDefault();
2534
- this.handleClick();
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;
2535
2438
  }
2536
- break;
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
+ }
2467
+ this.handleClick();
2468
+ break;
2469
+ // Do nothing
2537
2470
  }
2538
- case "mouseenter":
2539
- if (element.hoverToggle) {
2540
- this.showBib();
2541
- }
2542
- break;
2543
- case "mouseleave":
2544
- if (element.hoverToggle) {
2545
- this.hideBib("mouseleave");
2546
- }
2547
- break;
2548
- case "focus":
2549
- if (element.focusShow) {
2550
- /*
2551
- This needs to better handle clicking that gives focus -
2552
- currently it shows and then immediately hides the bib
2553
- */
2554
- this.showBib();
2555
- }
2556
- break;
2557
- case "blur":
2558
- // send this task 100ms later queue to
2559
- // wait a frame in case focus moves within the floating element/bib
2560
- setTimeout(() => this.handleFocusLoss(), 0);
2561
- break;
2562
- case "click":
2563
- if (document.activeElement === document.body) {
2564
- event.currentTarget.focus();
2565
- }
2566
- this.handleClick();
2567
- break;
2568
- // Do nothing
2569
2471
  }
2570
2472
  }
2571
2473
 
@@ -2576,11 +2478,6 @@ class AuroFloatingUI {
2576
2478
  * This prevents the component itself from being focusable when the trigger element already handles focus.
2577
2479
  */
2578
2480
  handleTriggerTabIndex() {
2579
- const element = this.element;
2580
- if (!element) {
2581
- return;
2582
- }
2583
-
2584
2481
  const focusableElementSelectors = [
2585
2482
  "a",
2586
2483
  "button",
@@ -2593,7 +2490,7 @@ class AuroFloatingUI {
2593
2490
  "auro-hyperlink",
2594
2491
  ];
2595
2492
 
2596
- const triggerNode = element.querySelectorAll('[slot="trigger"]')[0];
2493
+ const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
2597
2494
  if (!triggerNode) {
2598
2495
  return;
2599
2496
  }
@@ -2602,13 +2499,13 @@ class AuroFloatingUI {
2602
2499
  focusableElementSelectors.forEach((selector) => {
2603
2500
  // Check if the trigger node element is focusable
2604
2501
  if (triggerNodeTagName === selector) {
2605
- element.tabIndex = -1;
2502
+ this.element.tabIndex = -1;
2606
2503
  return;
2607
2504
  }
2608
2505
 
2609
2506
  // Check if any child is focusable
2610
2507
  if (triggerNode.querySelector(selector)) {
2611
- element.tabIndex = -1;
2508
+ this.element.tabIndex = -1;
2612
2509
  }
2613
2510
  });
2614
2511
  }
@@ -2618,18 +2515,13 @@ class AuroFloatingUI {
2618
2515
  * @param {*} eventPrefix
2619
2516
  */
2620
2517
  regenerateBibId() {
2621
- const element = this.element;
2622
- if (!element) {
2623
- return;
2624
- }
2625
-
2626
- this.id = element.getAttribute("id");
2518
+ this.id = this.element.getAttribute("id");
2627
2519
  if (!this.id) {
2628
2520
  this.id = window.crypto.randomUUID();
2629
- element.setAttribute("id", this.id);
2521
+ this.element.setAttribute("id", this.id);
2630
2522
  }
2631
2523
 
2632
- element.bib?.setAttribute("id", `${this.id}-floater-bib`);
2524
+ this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
2633
2525
  }
2634
2526
 
2635
2527
  configure(elem, eventPrefix, enableKeyboardHandling = true) {
@@ -2641,69 +2533,67 @@ class AuroFloatingUI {
2641
2533
  this.element = elem;
2642
2534
  }
2643
2535
 
2644
- const element = this.element;
2645
- if (!element) {
2646
- return;
2536
+ if (this.behavior !== this.element.behavior) {
2537
+ this.behavior = this.element.behavior;
2647
2538
  }
2648
2539
 
2649
- if (this.behavior !== element.behavior) {
2650
- this.behavior = element.behavior;
2651
- }
2652
-
2653
- if (element.trigger) {
2540
+ if (this.element.trigger) {
2654
2541
  this.disconnect();
2655
2542
  }
2656
- element.trigger =
2657
- element.triggerElement ||
2658
- element.shadowRoot?.querySelector("#trigger") ||
2659
- element.trigger;
2660
- element.bib = element.shadowRoot?.querySelector("#bib") || element.bib;
2661
- element.bibSizer = element.shadowRoot?.querySelector("#bibSizer");
2662
- element.triggerChevron =
2663
- element.shadowRoot?.querySelector("#showStateIcon");
2664
-
2665
- if (element.floaterConfig) {
2666
- element.hoverToggle = element.floaterConfig.hoverToggle;
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
+
2553
+ if (this.element.floaterConfig) {
2554
+ this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
2667
2555
  }
2668
2556
 
2669
2557
  this.regenerateBibId();
2670
2558
  this.handleTriggerTabIndex();
2671
2559
 
2672
2560
  this.handleEvent = this.handleEvent.bind(this);
2673
- if (element.trigger) {
2561
+ if (this.element.trigger) {
2674
2562
  if (this.enableKeyboardHandling) {
2675
- element.trigger.addEventListener("keydown", this.handleEvent);
2563
+ this.element.trigger.addEventListener("keydown", this.handleEvent);
2676
2564
  }
2677
- element.trigger.addEventListener("click", this.handleEvent);
2678
- element.trigger.addEventListener("mouseenter", this.handleEvent);
2679
- element.trigger.addEventListener("mouseleave", this.handleEvent);
2680
- element.trigger.addEventListener("focus", this.handleEvent);
2681
- element.trigger.addEventListener("blur", this.handleEvent);
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);
2682
2570
  }
2683
2571
  }
2684
2572
 
2685
2573
  disconnect() {
2686
2574
  this.cleanupHideHandlers();
2575
+ if (this.element) {
2576
+ this.element.cleanup?.();
2687
2577
 
2688
- const element = this.element;
2689
- if (!element) {
2690
- return;
2691
- }
2692
-
2693
- element.cleanup?.();
2694
-
2695
- if (element.bib && element.shadowRoot) {
2696
- element.shadowRoot.append(element.bib);
2697
- }
2578
+ if (this.element.bib) {
2579
+ this.element.shadowRoot.append(this.element.bib);
2580
+ }
2698
2581
 
2699
- // Remove event & keyboard listeners
2700
- if (element.trigger) {
2701
- element.trigger.removeEventListener("keydown", this.handleEvent);
2702
- element.trigger.removeEventListener("click", this.handleEvent);
2703
- element.trigger.removeEventListener("mouseenter", this.handleEvent);
2704
- element.trigger.removeEventListener("mouseleave", this.handleEvent);
2705
- element.trigger.removeEventListener("focus", this.handleEvent);
2706
- element.trigger.removeEventListener("blur", this.handleEvent);
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
+ }
2707
2597
  }
2708
2598
  }
2709
2599
  }
@@ -3862,7 +3752,7 @@ class AuroHelpText extends i {
3862
3752
  }
3863
3753
  }
3864
3754
 
3865
- var formkitVersion = '202604070549';
3755
+ var formkitVersion = '202604071525';
3866
3756
 
3867
3757
  class AuroElement extends i {
3868
3758
  static get properties() {