@redsift/design-system 8.0.3 → 8.0.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.
package/index.d.ts CHANGED
@@ -1589,7 +1589,7 @@ interface PillProps extends ComponentProps<'div'>, StylingProps {
1589
1589
  /** Whether the badge should automatically break content. */
1590
1590
  autoBreak?: boolean;
1591
1591
  /** Color variant. The product colors are available but should only be used to display the Pill in the color of another product. To display a Pill with a color of the current product, use `default`. */
1592
- color?: DataVizColorPalette | 'white' | 'black' | 'error' | 'warning' | 'success';
1592
+ color?: DataVizColorPalette | 'white' | 'black' | 'no-data' | 'error' | 'warning' | 'success' | 'error-dark' | 'warning-dark' | 'success-dark';
1593
1593
  }
1594
1594
  type StyledPillProps = Omit<PillProps, 'color' | 'autoBreak'> & {
1595
1595
  $autoBreak: PillProps['autoBreak'];
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { I18nProvider, useLocalizedStringFormatter, useFocusRing, useNumberFormatter, useFocusWithin } from 'react-aria';
2
2
  export { I18nProvider, SSRProvider } from 'react-aria';
3
3
  import * as React from 'react';
4
- import React__default, { useState, useEffect, useContext, useRef, useMemo, useCallback, forwardRef, useReducer, useLayoutEffect, useId as useId$1 } from 'react';
4
+ import React__default, { useState, useEffect, useContext, useMemo, useRef, useCallback, forwardRef, useReducer, useLayoutEffect, useId as useId$1 } from 'react';
5
5
  import classNames from 'classnames';
6
6
  import { mdiClose, mdiAlert, mdiCheckCircle, mdiAlertCircle, mdiInformation, mdiMenu, mdiMenuOpen, mdiChevronDown, mdiChevronRight, mdiChevronUp, mdiCheckboxMarked, mdiMinusBox, mdiCheckboxBlankOutline, mdiPageLast, mdiKeyboardCaps, mdiRadioboxMarked, mdiRadioboxBlank } from '@redsift/icons';
7
7
  import styled, { css, keyframes } from 'styled-components';
@@ -592,77 +592,7 @@ const $704cf1d3b684cc5c$var$defaultContext = {
592
592
  isSSR: false
593
593
  };
594
594
  const $704cf1d3b684cc5c$var$SSRContext = /*#__PURE__*/ (React__default).createContext($704cf1d3b684cc5c$var$defaultContext);
595
- let $704cf1d3b684cc5c$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
596
- let $704cf1d3b684cc5c$var$componentIds = new WeakMap();
597
- function $704cf1d3b684cc5c$var$useCounter(isDisabled = false) {
598
- let ctx = (useContext)($704cf1d3b684cc5c$var$SSRContext);
599
- let ref = (useRef)(null);
600
- // eslint-disable-next-line rulesdir/pure-render
601
- if (ref.current === null && !isDisabled) {
602
- var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner;
603
- // In strict mode, React renders components twice, and the ref will be reset to null on the second render.
604
- // This means our id counter will be incremented twice instead of once. This is a problem because on the
605
- // server, components are only rendered once and so ids generated on the server won't match the client.
606
- // In React 18, useId was introduced to solve this, but it is not available in older versions. So to solve this
607
- // we need to use some React internals to access the underlying Fiber instance, which is stable between renders.
608
- // This is exposed as ReactCurrentOwner in development, which is all we need since StrictMode only runs in development.
609
- // To ensure that we only increment the global counter once, we store the starting id for this component in
610
- // a weak map associated with the Fiber. On the second render, we reset the global counter to this value.
611
- // Since React runs the second render immediately after the first, this is safe.
612
- // @ts-ignore
613
- let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = (React__default).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
614
- if (currentOwner) {
615
- let prevComponentValue = $704cf1d3b684cc5c$var$componentIds.get(currentOwner);
616
- if (prevComponentValue == null) // On the first render, and first call to useId, store the id and state in our weak map.
617
- $704cf1d3b684cc5c$var$componentIds.set(currentOwner, {
618
- id: ctx.current,
619
- state: currentOwner.memoizedState
620
- });
621
- else if (currentOwner.memoizedState !== prevComponentValue.state) {
622
- // On the second render, the memoizedState gets reset by React.
623
- // Reset the counter, and remove from the weak map so we don't
624
- // do this for subsequent useId calls.
625
- ctx.current = prevComponentValue.id;
626
- $704cf1d3b684cc5c$var$componentIds.delete(currentOwner);
627
- }
628
- }
629
- // eslint-disable-next-line rulesdir/pure-render
630
- ref.current = ++ctx.current;
631
- }
632
- // eslint-disable-next-line rulesdir/pure-render
633
- return ref.current;
634
- }
635
- function $704cf1d3b684cc5c$var$useLegacySSRSafeId(defaultId) {
636
- let ctx = (useContext)($704cf1d3b684cc5c$var$SSRContext);
637
- // If we are rendering in a non-DOM environment, and there's no SSRProvider,
638
- // provide a warning to hint to the developer to add one.
639
- if (ctx === $704cf1d3b684cc5c$var$defaultContext && !$704cf1d3b684cc5c$var$canUseDOM) console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
640
- let counter = $704cf1d3b684cc5c$var$useCounter(!!defaultId);
641
- return defaultId || `react-aria${ctx.prefix}-${counter}`;
642
- }
643
- function $704cf1d3b684cc5c$var$useModernSSRSafeId(defaultId) {
644
- // @ts-ignore
645
- let id = (React__default).useId();
646
- let [didSSR] = (useState)($704cf1d3b684cc5c$export$535bd6ca7f90a273());
647
- let prefix = didSSR ? "react-aria" : `react-aria${$704cf1d3b684cc5c$var$defaultContext.prefix}`;
648
- return defaultId || `${prefix}-${id}`;
649
- }
650
- typeof (React__default)["useId"] === "function" ? $704cf1d3b684cc5c$var$useModernSSRSafeId : $704cf1d3b684cc5c$var$useLegacySSRSafeId;
651
- function $704cf1d3b684cc5c$var$getSnapshot() {
652
- return false;
653
- }
654
- function $704cf1d3b684cc5c$var$getServerSnapshot() {
655
- return true;
656
- }
657
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
658
- function $704cf1d3b684cc5c$var$subscribe(onStoreChange) {
659
- // noop
660
- return ()=>{};
661
- }
662
595
  function $704cf1d3b684cc5c$export$535bd6ca7f90a273() {
663
- // In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
664
- if (typeof (React__default)["useSyncExternalStore"] === "function") return (React__default)["useSyncExternalStore"]($704cf1d3b684cc5c$var$subscribe, $704cf1d3b684cc5c$var$getSnapshot, $704cf1d3b684cc5c$var$getServerSnapshot);
665
- // eslint-disable-next-line react-hooks/rules-of-hooks
666
596
  let cur = (useContext)($704cf1d3b684cc5c$var$SSRContext);
667
597
  return cur.isSSR;
668
598
  }
@@ -917,121 +847,6 @@ function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
917
847
  throw new Error("Unexpected hour cycle result");
918
848
  }
919
849
 
920
- /*
921
- * Copyright 2020 Adobe. All rights reserved.
922
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
923
- * you may not use this file except in compliance with the License. You may obtain a copy
924
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
925
- *
926
- * Unless required by applicable law or agreed to in writing, software distributed under
927
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
928
- * OF ANY KIND, either express or implied. See the License for the specific language
929
- * governing permissions and limitations under the License.
930
- */ /*
931
- * Copyright 2020 Adobe. All rights reserved.
932
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
933
- * you may not use this file except in compliance with the License. You may obtain a copy
934
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
935
- *
936
- * Unless required by applicable law or agreed to in writing, software distributed under
937
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
938
- * OF ANY KIND, either express or implied. See the License for the specific language
939
- * governing permissions and limitations under the License.
940
- */
941
- /*
942
- * Copyright 2020 Adobe. All rights reserved.
943
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
944
- * you may not use this file except in compliance with the License. You may obtain a copy
945
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
946
- *
947
- * Unless required by applicable law or agreed to in writing, software distributed under
948
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
949
- * OF ANY KIND, either express or implied. See the License for the specific language
950
- * governing permissions and limitations under the License.
951
- */
952
- typeof window !== "undefined" ? (React__default).useLayoutEffect : ()=>{};
953
-
954
-
955
- /*
956
- * Copyright 2020 Adobe. All rights reserved.
957
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
958
- * you may not use this file except in compliance with the License. You may obtain a copy
959
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
960
- *
961
- * Unless required by applicable law or agreed to in writing, software distributed under
962
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
963
- * OF ANY KIND, either express or implied. See the License for the specific language
964
- * governing permissions and limitations under the License.
965
- */ // We store a global list of elements that are currently transitioning,
966
- // mapped to a set of CSS properties that are transitioning for that element.
967
- // This is necessary rather than a simple count of transitions because of browser
968
- // bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
969
- // than one or the other. So we need to track what's actually transitioning so that
970
- // we can ignore these duplicate events.
971
- let $bbed8b41f857bcc0$var$transitionsByElement = new Map();
972
- // A list of callbacks to call once there are no transitioning elements.
973
- let $bbed8b41f857bcc0$var$transitionCallbacks = new Set();
974
- function $bbed8b41f857bcc0$var$setupGlobalEvents() {
975
- if (typeof window === "undefined") return;
976
- let onTransitionStart = (e)=>{
977
- // Add the transitioning property to the list for this element.
978
- let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
979
- if (!transitions) {
980
- transitions = new Set();
981
- $bbed8b41f857bcc0$var$transitionsByElement.set(e.target, transitions);
982
- // The transitioncancel event must be registered on the element itself, rather than as a global
983
- // event. This enables us to handle when the node is deleted from the document while it is transitioning.
984
- // In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
985
- e.target.addEventListener("transitioncancel", onTransitionEnd);
986
- }
987
- transitions.add(e.propertyName);
988
- };
989
- let onTransitionEnd = (e)=>{
990
- // Remove property from list of transitioning properties.
991
- let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
992
- if (!properties) return;
993
- properties.delete(e.propertyName);
994
- // If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
995
- if (properties.size === 0) {
996
- e.target.removeEventListener("transitioncancel", onTransitionEnd);
997
- $bbed8b41f857bcc0$var$transitionsByElement.delete(e.target);
998
- }
999
- // If no transitioning elements, call all of the queued callbacks.
1000
- if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
1001
- for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)cb();
1002
- $bbed8b41f857bcc0$var$transitionCallbacks.clear();
1003
- }
1004
- };
1005
- document.body.addEventListener("transitionrun", onTransitionStart);
1006
- document.body.addEventListener("transitionend", onTransitionEnd);
1007
- }
1008
- if (typeof document !== "undefined") {
1009
- if (document.readyState !== "loading") $bbed8b41f857bcc0$var$setupGlobalEvents();
1010
- else document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents);
1011
- }
1012
-
1013
-
1014
-
1015
- /*
1016
- * Copyright 2023 Adobe. All rights reserved.
1017
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1018
- * you may not use this file except in compliance with the License. You may obtain a copy
1019
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
1020
- *
1021
- * Unless required by applicable law or agreed to in writing, software distributed under
1022
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1023
- * OF ANY KIND, either express or implied. See the License for the specific language
1024
- * governing permissions and limitations under the License.
1025
- */ /* eslint-disable rulesdir/pure-render */
1026
- function $5a387cc49350e6db$export$722debc0e56fea39(value, isEqual) {
1027
- // Using a ref during render is ok here because it's only an optimization – both values are equivalent.
1028
- // If a render is thrown away, it'll still work the same no matter if the next render is the same or not.
1029
- let lastValue = (useRef)(null);
1030
- if (value && lastValue.current && isEqual(value, lastValue.current)) value = lastValue.current;
1031
- lastValue.current = value;
1032
- return value;
1033
- }
1034
-
1035
850
  /*
1036
851
  * Copyright 2020 Adobe. All rights reserved.
1037
852
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1069,7 +884,7 @@ try {
1069
884
  unit: "degree"
1070
885
  }).resolvedOptions().style === "unit";
1071
886
  // eslint-disable-next-line no-empty
1072
- } catch (e) {}
887
+ } catch (e1) {}
1073
888
  // Polyfill for units since Safari doesn't support them yet. See https://bugs.webkit.org/show_bug.cgi?id=215438.
1074
889
  // Currently only polyfilling the unit degree in narrow format for ColorSlider in our supported locales.
1075
890
  // Values were determined by switching to each locale manually in Chrome.
@@ -1407,10 +1222,11 @@ function $33bf17300c498528$export$a2f47a3d2973640(options = {}) {
1407
1222
  */
1408
1223
 
1409
1224
 
1410
-
1411
1225
  function $896ba0a80a8f4d36$export$85fd5fdf27bacc79(options) {
1412
1226
  // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.
1413
- options = ($5a387cc49350e6db$export$722debc0e56fea39)(options, $896ba0a80a8f4d36$var$isEqual);
1227
+ let lastOptions = (useRef)(null);
1228
+ if (options && lastOptions.current && $896ba0a80a8f4d36$var$isEqual(options, lastOptions.current)) options = lastOptions.current;
1229
+ lastOptions.current = options;
1414
1230
  let { locale: locale } = ($18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
1415
1231
  return (useMemo)(()=>new ($fb18d541ea1ad717$export$ad991b66133851cf)(locale, options), [
1416
1232
  locale,
@@ -6312,11 +6128,11 @@ const StyledPill = styled.div`
6312
6128
  ${$color === 'black' ? 'background-color: var(--redsift-color-neutral-black);' : $color === 'white' ? css`
6313
6129
  background-color: var(--redsift-color-neutral-white);
6314
6130
  border: 1px solid #d6d6d6;
6315
- ` : $color === 'error' ? 'background-color: var(--redsift-data-viz-color-red-light);' : $color === 'warning' ? 'background-color: var(--redsift-data-viz-color-orange-light);' : $color === 'success' ? 'background-color: var(--redsift-data-viz-color-green-light);' : `background-color: var(--redsift-data-viz-color-${$color}-light);`}
6131
+ ` : $color === 'no-data' ? 'background-color: var(--redsift-color-neutral-midgrey);' : $color === 'error' ? 'background-color: var(--redsift-data-viz-color-red-lighter);' : $color === 'warning' ? 'background-color: var(--redsift-data-viz-color-orange-lighter);' : $color === 'success' ? 'background-color: var(--redsift-data-viz-color-green-lighter);' : $color === 'error-dark' ? 'background-color: var(--redsift-data-viz-color-red-default);' : $color === 'warning-dark' ? 'background-color: var(--redsift-data-viz-color-orange-default);' : $color === 'success-dark' ? 'background-color: var(--redsift-data-viz-color-green-default);' : `background-color: var(--redsift-data-viz-color-${$color}-light);`}
6316
6132
 
6317
6133
  &,
6318
6134
  .redsift-icon {
6319
- color: var(--redsift-color-neutral-${$color === 'black' ? 'white' : 'black'});
6135
+ color: var(--redsift-color-neutral-${['black', 'warning-dark', 'success-dark'].includes($color) ? 'white' : 'black'});
6320
6136
  }
6321
6137
  `;
6322
6138
  }}}
@@ -6441,7 +6257,7 @@ DetailedCardSectionItem.defaultProps = DEFAULT_PROPS$e;
6441
6257
  DetailedCardSectionItem.displayName = COMPONENT_NAME$e;
6442
6258
 
6443
6259
  /*!
6444
- * tabbable 6.2.0
6260
+ * tabbable 6.1.2
6445
6261
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
6446
6262
  */
6447
6263
  // NOTE: separate `:not()` selectors has broader browser support than the newer
@@ -6621,27 +6437,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
6621
6437
  }
6622
6438
  return candidates;
6623
6439
  };
6624
-
6625
- /**
6626
- * @private
6627
- * Determines if the node has an explicitly specified `tabindex` attribute.
6628
- * @param {HTMLElement} node
6629
- * @returns {boolean} True if so; false if not.
6630
- */
6631
- var hasTabIndex = function hasTabIndex(node) {
6632
- return !isNaN(parseInt(node.getAttribute('tabindex'), 10));
6633
- };
6634
-
6635
- /**
6636
- * Determine the tab index of a given node.
6637
- * @param {HTMLElement} node
6638
- * @returns {number} Tab order (negative, 0, or positive number).
6639
- * @throws {Error} If `node` is falsy.
6640
- */
6641
- var getTabIndex = function getTabIndex(node) {
6642
- if (!node) {
6643
- throw new Error('No node provided');
6644
- }
6440
+ var getTabindex = function getTabindex(node, isScope) {
6645
6441
  if (node.tabIndex < 0) {
6646
6442
  // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
6647
6443
  // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
@@ -6650,28 +6446,16 @@ var getTabIndex = function getTabIndex(node) {
6650
6446
  // order, consider their tab index to be 0.
6651
6447
  // Also browsers do not return `tabIndex` correctly for contentEditable nodes;
6652
6448
  // so if they don't have a tabindex attribute specifically set, assume it's 0.
6653
- if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
6449
+ //
6450
+ // isScope is positive for custom element with shadow root or slot that by default
6451
+ // have tabIndex -1, but need to be sorted by document order in order for their
6452
+ // content to be inserted in the correct position
6453
+ if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
6654
6454
  return 0;
6655
6455
  }
6656
6456
  }
6657
6457
  return node.tabIndex;
6658
6458
  };
6659
-
6660
- /**
6661
- * Determine the tab index of a given node __for sort order purposes__.
6662
- * @param {HTMLElement} node
6663
- * @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default,
6664
- * has tabIndex -1, but needs to be sorted by document order in order for its content to be
6665
- * inserted into the correct sort position.
6666
- * @returns {number} Tab order (negative, 0, or positive number).
6667
- */
6668
- var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) {
6669
- var tabIndex = getTabIndex(node);
6670
- if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
6671
- return 0;
6672
- }
6673
- return tabIndex;
6674
- };
6675
6459
  var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
6676
6460
  return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
6677
6461
  };
@@ -6914,7 +6698,7 @@ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(o
6914
6698
  return true;
6915
6699
  };
6916
6700
  var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
6917
- if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
6701
+ if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
6918
6702
  return false;
6919
6703
  }
6920
6704
  return true;
@@ -6939,7 +6723,7 @@ var sortByOrder = function sortByOrder(candidates) {
6939
6723
  candidates.forEach(function (item, i) {
6940
6724
  var isScope = !!item.scopeParent;
6941
6725
  var element = isScope ? item.scopeParent : item;
6942
- var candidateTabindex = getSortOrderTabIndex(element, isScope);
6726
+ var candidateTabindex = getTabindex(element, isScope);
6943
6727
  var elements = isScope ? sortByOrder(item.candidates) : element;
6944
6728
  if (candidateTabindex === 0) {
6945
6729
  isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
@@ -6958,18 +6742,18 @@ var sortByOrder = function sortByOrder(candidates) {
6958
6742
  return acc;
6959
6743
  }, []).concat(regularTabbables);
6960
6744
  };
6961
- var tabbable = function tabbable(container, options) {
6745
+ var tabbable = function tabbable(el, options) {
6962
6746
  options = options || {};
6963
6747
  var candidates;
6964
6748
  if (options.getShadowRoot) {
6965
- candidates = getCandidatesIteratively([container], options.includeContainer, {
6749
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
6966
6750
  filter: isNodeMatchingSelectorTabbable.bind(null, options),
6967
6751
  flatten: false,
6968
6752
  getShadowRoot: options.getShadowRoot,
6969
6753
  shadowRootFilter: isValidShadowRootTabbable
6970
6754
  });
6971
6755
  } else {
6972
- candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
6756
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
6973
6757
  }
6974
6758
  return sortByOrder(candidates);
6975
6759
  };
@@ -7311,7 +7095,7 @@ const arrow$1 = options => ({
7311
7095
  [axis]: coords[axis] - alignmentOffset,
7312
7096
  data: {
7313
7097
  [axis]: offset,
7314
- centerOffset: center - offset + alignmentOffset
7098
+ centerOffset: center - offset
7315
7099
  }
7316
7100
  };
7317
7101
  }
@@ -7657,13 +7441,7 @@ function isNode(value) {
7657
7441
  return value instanceof getWindow$1(value).Node;
7658
7442
  }
7659
7443
  function getNodeName(node) {
7660
- if (isNode(node)) {
7661
- return (node.nodeName || '').toLowerCase();
7662
- }
7663
- // Mocked nodes in testing environments may not be instances of Node. By
7664
- // returning `#document` an infinite loop won't occur.
7665
- // https://github.com/floating-ui/floating-ui/issues/2317
7666
- return '#document';
7444
+ return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
7667
7445
  }
7668
7446
 
7669
7447
  function isHTMLElement$1(value) {
@@ -7677,7 +7455,8 @@ function isShadowRoot$1(node) {
7677
7455
  if (typeof ShadowRoot === 'undefined') {
7678
7456
  return false;
7679
7457
  }
7680
- return node instanceof getWindow$1(node).ShadowRoot || node instanceof ShadowRoot;
7458
+ const OwnElement = getWindow$1(node).ShadowRoot;
7459
+ return node instanceof OwnElement || node instanceof ShadowRoot;
7681
7460
  }
7682
7461
  function isOverflowElement(element) {
7683
7462
  const {
@@ -7709,11 +7488,6 @@ function isLastTraversableNode(node) {
7709
7488
  const min = Math.min;
7710
7489
  const max = Math.max;
7711
7490
  const round = Math.round;
7712
- const floor = Math.floor;
7713
- const createEmptyCoords = v => ({
7714
- x: v,
7715
- y: v
7716
- });
7717
7491
 
7718
7492
  function getCssDimensions(element) {
7719
7493
  const css = getComputedStyle$1(element);
@@ -7732,7 +7506,7 @@ function getCssDimensions(element) {
7732
7506
  return {
7733
7507
  width,
7734
7508
  height,
7735
- $: shouldFallback
7509
+ fallback: shouldFallback
7736
7510
  };
7737
7511
  }
7738
7512
 
@@ -7740,19 +7514,23 @@ function unwrapElement(element) {
7740
7514
  return !isElement$1(element) ? element.contextElement : element;
7741
7515
  }
7742
7516
 
7517
+ const FALLBACK_SCALE = {
7518
+ x: 1,
7519
+ y: 1
7520
+ };
7743
7521
  function getScale(element) {
7744
7522
  const domElement = unwrapElement(element);
7745
7523
  if (!isHTMLElement$1(domElement)) {
7746
- return createEmptyCoords(1);
7524
+ return FALLBACK_SCALE;
7747
7525
  }
7748
7526
  const rect = domElement.getBoundingClientRect();
7749
7527
  const {
7750
7528
  width,
7751
7529
  height,
7752
- $
7530
+ fallback
7753
7531
  } = getCssDimensions(domElement);
7754
- let x = ($ ? round(rect.width) : rect.width) / width;
7755
- let y = ($ ? round(rect.height) : rect.height) / height;
7532
+ let x = (fallback ? round(rect.width) : rect.width) / width;
7533
+ let y = (fallback ? round(rect.height) : rect.height) / height;
7756
7534
 
7757
7535
  // 0, NaN, or Infinity should always fallback to 1.
7758
7536
 
@@ -7768,7 +7546,10 @@ function getScale(element) {
7768
7546
  };
7769
7547
  }
7770
7548
 
7771
- const noOffsets = /*#__PURE__*/createEmptyCoords(0);
7549
+ const noOffsets = {
7550
+ x: 0,
7551
+ y: 0
7552
+ };
7772
7553
  function getVisualOffsets(element, isFixed, floatingOffsetParent) {
7773
7554
  var _win$visualViewport, _win$visualViewport2;
7774
7555
  if (isFixed === void 0) {
@@ -7796,7 +7577,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
7796
7577
  }
7797
7578
  const clientRect = element.getBoundingClientRect();
7798
7579
  const domElement = unwrapElement(element);
7799
- let scale = createEmptyCoords(1);
7580
+ let scale = FALLBACK_SCALE;
7800
7581
  if (includeScale) {
7801
7582
  if (offsetParent) {
7802
7583
  if (isElement$1(offsetParent)) {
@@ -7819,14 +7600,14 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
7819
7600
  const iframeScale = getScale(currentIFrame);
7820
7601
  const iframeRect = currentIFrame.getBoundingClientRect();
7821
7602
  const css = getComputedStyle(currentIFrame);
7822
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
7823
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
7603
+ iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
7604
+ iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
7824
7605
  x *= iframeScale.x;
7825
7606
  y *= iframeScale.y;
7826
7607
  width *= iframeScale.x;
7827
7608
  height *= iframeScale.y;
7828
- x += left;
7829
- y += top;
7609
+ x += iframeRect.x;
7610
+ y += iframeRect.y;
7830
7611
  currentIFrame = getWindow$1(currentIFrame).frameElement;
7831
7612
  }
7832
7613
  }
@@ -7870,8 +7651,14 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
7870
7651
  scrollLeft: 0,
7871
7652
  scrollTop: 0
7872
7653
  };
7873
- let scale = createEmptyCoords(1);
7874
- const offsets = createEmptyCoords(0);
7654
+ let scale = {
7655
+ x: 1,
7656
+ y: 1
7657
+ };
7658
+ const offsets = {
7659
+ x: 0,
7660
+ y: 0
7661
+ };
7875
7662
  if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
7876
7663
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
7877
7664
  scroll = getNodeScroll(offsetParent);
@@ -7937,7 +7724,9 @@ function getParentNode(node) {
7937
7724
  function getNearestOverflowAncestor(node) {
7938
7725
  const parentNode = getParentNode(node);
7939
7726
  if (isLastTraversableNode(parentNode)) {
7940
- return node.ownerDocument ? node.ownerDocument.body : node.body;
7727
+ // `getParentNode` will never return a `Document` due to the fallback
7728
+ // check, so it's either the <html> or <body> element.
7729
+ return parentNode.ownerDocument.body;
7941
7730
  }
7942
7731
  if (isHTMLElement$1(parentNode) && isOverflowElement(parentNode)) {
7943
7732
  return parentNode;
@@ -7989,7 +7778,10 @@ function getInnerBoundingClientRect(element, strategy) {
7989
7778
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
7990
7779
  const top = clientRect.top + element.clientTop;
7991
7780
  const left = clientRect.left + element.clientLeft;
7992
- const scale = isHTMLElement$1(element) ? getScale(element) : createEmptyCoords(1);
7781
+ const scale = isHTMLElement$1(element) ? getScale(element) : {
7782
+ x: 1,
7783
+ y: 1
7784
+ };
7993
7785
  const width = element.clientWidth * scale.x;
7994
7786
  const height = element.clientHeight * scale.y;
7995
7787
  const x = left * scale.x;
@@ -8140,7 +7932,10 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
8140
7932
  scrollLeft: 0,
8141
7933
  scrollTop: 0
8142
7934
  };
8143
- const offsets = createEmptyCoords(0);
7935
+ const offsets = {
7936
+ x: 0,
7937
+ y: 0
7938
+ };
8144
7939
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
8145
7940
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
8146
7941
  scroll = getNodeScroll(offsetParent);
@@ -8190,67 +7985,6 @@ const platform = {
8190
7985
  isRTL: element => getComputedStyle$1(element).direction === 'rtl'
8191
7986
  };
8192
7987
 
8193
- // https://samthor.au/2021/observing-dom/
8194
- function observeMove(element, onMove) {
8195
- let io = null;
8196
- let timeoutId;
8197
- const root = getDocumentElement(element);
8198
- function cleanup() {
8199
- clearTimeout(timeoutId);
8200
- io && io.disconnect();
8201
- io = null;
8202
- }
8203
- function refresh(skip, threshold) {
8204
- if (skip === void 0) {
8205
- skip = false;
8206
- }
8207
- if (threshold === void 0) {
8208
- threshold = 1;
8209
- }
8210
- cleanup();
8211
- const {
8212
- left,
8213
- top,
8214
- width,
8215
- height
8216
- } = element.getBoundingClientRect();
8217
- if (!skip) {
8218
- onMove();
8219
- }
8220
- if (!width || !height) {
8221
- return;
8222
- }
8223
- const insetTop = floor(top);
8224
- const insetRight = floor(root.clientWidth - (left + width));
8225
- const insetBottom = floor(root.clientHeight - (top + height));
8226
- const insetLeft = floor(left);
8227
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
8228
- let isFirstUpdate = true;
8229
- io = new IntersectionObserver(entries => {
8230
- const ratio = entries[0].intersectionRatio;
8231
- if (ratio !== threshold) {
8232
- if (!isFirstUpdate) {
8233
- return refresh();
8234
- }
8235
- if (!ratio) {
8236
- timeoutId = setTimeout(() => {
8237
- refresh(false, 1e-7);
8238
- }, 100);
8239
- } else {
8240
- refresh(false, ratio);
8241
- }
8242
- }
8243
- isFirstUpdate = false;
8244
- }, {
8245
- rootMargin,
8246
- threshold: max(0, min(1, threshold)) || 1
8247
- });
8248
- io.observe(element);
8249
- }
8250
- refresh(true);
8251
- return cleanup;
8252
- }
8253
-
8254
7988
  /**
8255
7989
  * Automatically updates the position of the floating element when necessary.
8256
7990
  * Should only be called when the floating element is mounted on the DOM or
@@ -8267,25 +8001,29 @@ function autoUpdate(reference, floating, update, options) {
8267
8001
  ancestorScroll = true,
8268
8002
  ancestorResize = true,
8269
8003
  elementResize = true,
8270
- layoutShift = typeof IntersectionObserver === 'function',
8271
8004
  animationFrame = false
8272
8005
  } = options;
8273
- const referenceEl = unwrapElement(reference);
8274
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
8006
+ const ancestors = ancestorScroll || ancestorResize ? [...(isElement$1(reference) ? getOverflowAncestors(reference) : reference.contextElement ? getOverflowAncestors(reference.contextElement) : []), ...getOverflowAncestors(floating)] : [];
8275
8007
  ancestors.forEach(ancestor => {
8276
- ancestorScroll && ancestor.addEventListener('scroll', update, {
8277
- passive: true
8278
- });
8008
+ // ignores Window, checks for [object VisualViewport]
8009
+ const isVisualViewport = !isElement$1(ancestor) && ancestor.toString().includes('V');
8010
+ if (ancestorScroll && (animationFrame ? isVisualViewport : true)) {
8011
+ ancestor.addEventListener('scroll', update, {
8012
+ passive: true
8013
+ });
8014
+ }
8279
8015
  ancestorResize && ancestor.addEventListener('resize', update);
8280
8016
  });
8281
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
8282
- let resizeObserver = null;
8017
+ let observer = null;
8283
8018
  if (elementResize) {
8284
- resizeObserver = new ResizeObserver(update);
8285
- if (referenceEl && !animationFrame) {
8286
- resizeObserver.observe(referenceEl);
8019
+ observer = new ResizeObserver(() => {
8020
+ update();
8021
+ });
8022
+ isElement$1(reference) && !animationFrame && observer.observe(reference);
8023
+ if (!isElement$1(reference) && reference.contextElement && !animationFrame) {
8024
+ observer.observe(reference.contextElement);
8287
8025
  }
8288
- resizeObserver.observe(floating);
8026
+ observer.observe(floating);
8289
8027
  }
8290
8028
  let frameId;
8291
8029
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
@@ -8302,13 +8040,13 @@ function autoUpdate(reference, floating, update, options) {
8302
8040
  }
8303
8041
  update();
8304
8042
  return () => {
8043
+ var _observer;
8305
8044
  ancestors.forEach(ancestor => {
8306
8045
  ancestorScroll && ancestor.removeEventListener('scroll', update);
8307
8046
  ancestorResize && ancestor.removeEventListener('resize', update);
8308
8047
  });
8309
- cleanupIo && cleanupIo();
8310
- resizeObserver && resizeObserver.disconnect();
8311
- resizeObserver = null;
8048
+ (_observer = observer) == null ? void 0 : _observer.disconnect();
8049
+ observer = null;
8312
8050
  if (animationFrame) {
8313
8051
  cancelAnimationFrame(frameId);
8314
8052
  }