@indico-data/design-system 2.34.2 → 2.34.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/lib/index.js CHANGED
@@ -1201,8 +1201,8 @@ const size$2 = function (options) {
1201
1201
  };
1202
1202
  };
1203
1203
 
1204
- function getNodeName$2(node) {
1205
- if (isNode$1(node)) {
1204
+ function getNodeName$3(node) {
1205
+ if (isNode$2(node)) {
1206
1206
  return (node.nodeName || '').toLowerCase();
1207
1207
  }
1208
1208
  // Mocked nodes in testing environments may not be instances of Node. By
@@ -1214,17 +1214,17 @@ function getWindow$3(node) {
1214
1214
  var _node$ownerDocument;
1215
1215
  return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1216
1216
  }
1217
- function getDocumentElement$2(node) {
1217
+ function getDocumentElement$3(node) {
1218
1218
  var _ref;
1219
- return (_ref = (isNode$1(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1219
+ return (_ref = (isNode$2(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1220
1220
  }
1221
- function isNode$1(value) {
1221
+ function isNode$2(value) {
1222
1222
  return value instanceof Node || value instanceof getWindow$3(value).Node;
1223
1223
  }
1224
1224
  function isElement$3(value) {
1225
1225
  return value instanceof Element || value instanceof getWindow$3(value).Element;
1226
1226
  }
1227
- function isHTMLElement$2(value) {
1227
+ function isHTMLElement$3(value) {
1228
1228
  return value instanceof HTMLElement || value instanceof getWindow$3(value).HTMLElement;
1229
1229
  }
1230
1230
  function isShadowRoot$3(value) {
@@ -1240,11 +1240,11 @@ function isOverflowElement$1(element) {
1240
1240
  overflowX,
1241
1241
  overflowY,
1242
1242
  display
1243
- } = getComputedStyle$3(element);
1243
+ } = getComputedStyle$4(element);
1244
1244
  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1245
1245
  }
1246
1246
  function isTableElement$2(element) {
1247
- return ['table', 'td', 'th'].includes(getNodeName$2(element));
1247
+ return ['table', 'td', 'th'].includes(getNodeName$3(element));
1248
1248
  }
1249
1249
  function isTopLayer$1(element) {
1250
1250
  return [':popover-open', ':modal'].some(selector => {
@@ -1257,20 +1257,20 @@ function isTopLayer$1(element) {
1257
1257
  }
1258
1258
  function isContainingBlock$1(elementOrCss) {
1259
1259
  const webkit = isWebKit$1();
1260
- const css = isElement$3(elementOrCss) ? getComputedStyle$3(elementOrCss) : elementOrCss;
1260
+ const css = isElement$3(elementOrCss) ? getComputedStyle$4(elementOrCss) : elementOrCss;
1261
1261
 
1262
1262
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1263
1263
  return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1264
1264
  }
1265
1265
  function getContainingBlock$2(element) {
1266
- let currentNode = getParentNode$2(element);
1267
- while (isHTMLElement$2(currentNode) && !isLastTraversableNode$1(currentNode)) {
1266
+ let currentNode = getParentNode$3(element);
1267
+ while (isHTMLElement$3(currentNode) && !isLastTraversableNode$2(currentNode)) {
1268
1268
  if (isContainingBlock$1(currentNode)) {
1269
1269
  return currentNode;
1270
1270
  } else if (isTopLayer$1(currentNode)) {
1271
1271
  return null;
1272
1272
  }
1273
- currentNode = getParentNode$2(currentNode);
1273
+ currentNode = getParentNode$3(currentNode);
1274
1274
  }
1275
1275
  return null;
1276
1276
  }
@@ -1278,10 +1278,10 @@ function isWebKit$1() {
1278
1278
  if (typeof CSS === 'undefined' || !CSS.supports) return false;
1279
1279
  return CSS.supports('-webkit-backdrop-filter', 'none');
1280
1280
  }
1281
- function isLastTraversableNode$1(node) {
1282
- return ['html', 'body', '#document'].includes(getNodeName$2(node));
1281
+ function isLastTraversableNode$2(node) {
1282
+ return ['html', 'body', '#document'].includes(getNodeName$3(node));
1283
1283
  }
1284
- function getComputedStyle$3(element) {
1284
+ function getComputedStyle$4(element) {
1285
1285
  return getWindow$3(element).getComputedStyle(element);
1286
1286
  }
1287
1287
  function getNodeScroll$2(element) {
@@ -1296,8 +1296,8 @@ function getNodeScroll$2(element) {
1296
1296
  scrollTop: element.scrollY
1297
1297
  };
1298
1298
  }
1299
- function getParentNode$2(node) {
1300
- if (getNodeName$2(node) === 'html') {
1299
+ function getParentNode$3(node) {
1300
+ if (getNodeName$3(node) === 'html') {
1301
1301
  return node;
1302
1302
  }
1303
1303
  const result =
@@ -1308,15 +1308,15 @@ function getParentNode$2(node) {
1308
1308
  // ShadowRoot detected.
1309
1309
  isShadowRoot$3(node) && node.host ||
1310
1310
  // Fallback.
1311
- getDocumentElement$2(node);
1311
+ getDocumentElement$3(node);
1312
1312
  return isShadowRoot$3(result) ? result.host : result;
1313
1313
  }
1314
1314
  function getNearestOverflowAncestor$1(node) {
1315
- const parentNode = getParentNode$2(node);
1316
- if (isLastTraversableNode$1(parentNode)) {
1315
+ const parentNode = getParentNode$3(node);
1316
+ if (isLastTraversableNode$2(parentNode)) {
1317
1317
  return node.ownerDocument ? node.ownerDocument.body : node.body;
1318
1318
  }
1319
- if (isHTMLElement$2(parentNode) && isOverflowElement$1(parentNode)) {
1319
+ if (isHTMLElement$3(parentNode) && isOverflowElement$1(parentNode)) {
1320
1320
  return parentNode;
1321
1321
  }
1322
1322
  return getNearestOverflowAncestor$1(parentNode);
@@ -1343,12 +1343,12 @@ function getFrameElement(win) {
1343
1343
  }
1344
1344
 
1345
1345
  function getCssDimensions$1(element) {
1346
- const css = getComputedStyle$3(element);
1346
+ const css = getComputedStyle$4(element);
1347
1347
  // In testing environments, the `width` and `height` properties are empty
1348
1348
  // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1349
1349
  let width = parseFloat(css.width) || 0;
1350
1350
  let height = parseFloat(css.height) || 0;
1351
- const hasOffset = isHTMLElement$2(element);
1351
+ const hasOffset = isHTMLElement$3(element);
1352
1352
  const offsetWidth = hasOffset ? element.offsetWidth : width;
1353
1353
  const offsetHeight = hasOffset ? element.offsetHeight : height;
1354
1354
  const shouldFallback = round$2(width) !== offsetWidth || round$2(height) !== offsetHeight;
@@ -1369,7 +1369,7 @@ function unwrapElement$1(element) {
1369
1369
 
1370
1370
  function getScale$1(element) {
1371
1371
  const domElement = unwrapElement$1(element);
1372
- if (!isHTMLElement$2(domElement)) {
1372
+ if (!isHTMLElement$3(domElement)) {
1373
1373
  return createCoords$1(1);
1374
1374
  }
1375
1375
  const rect = domElement.getBoundingClientRect();
@@ -1448,7 +1448,7 @@ function getBoundingClientRect$2(element, includeScale, isFixedStrategy, offsetP
1448
1448
  while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1449
1449
  const iframeScale = getScale$1(currentIFrame);
1450
1450
  const iframeRect = currentIFrame.getBoundingClientRect();
1451
- const css = getComputedStyle$3(currentIFrame);
1451
+ const css = getComputedStyle$4(currentIFrame);
1452
1452
  const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1453
1453
  const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1454
1454
  x *= iframeScale.x;
@@ -1477,7 +1477,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect$1(_ref) {
1477
1477
  strategy
1478
1478
  } = _ref;
1479
1479
  const isFixed = strategy === 'fixed';
1480
- const documentElement = getDocumentElement$2(offsetParent);
1480
+ const documentElement = getDocumentElement$3(offsetParent);
1481
1481
  const topLayer = elements ? isTopLayer$1(elements.floating) : false;
1482
1482
  if (offsetParent === documentElement || topLayer && isFixed) {
1483
1483
  return rect;
@@ -1488,12 +1488,12 @@ function convertOffsetParentRelativeRectToViewportRelativeRect$1(_ref) {
1488
1488
  };
1489
1489
  let scale = createCoords$1(1);
1490
1490
  const offsets = createCoords$1(0);
1491
- const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
1491
+ const isOffsetParentAnElement = isHTMLElement$3(offsetParent);
1492
1492
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1493
- if (getNodeName$2(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
1493
+ if (getNodeName$3(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
1494
1494
  scroll = getNodeScroll$2(offsetParent);
1495
1495
  }
1496
- if (isHTMLElement$2(offsetParent)) {
1496
+ if (isHTMLElement$3(offsetParent)) {
1497
1497
  const offsetRect = getBoundingClientRect$2(offsetParent);
1498
1498
  scale = getScale$1(offsetParent);
1499
1499
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -1515,20 +1515,20 @@ function getClientRects$1(element) {
1515
1515
  function getWindowScrollBarX$2(element) {
1516
1516
  // If <html> has a CSS width greater than the viewport, then this will be
1517
1517
  // incorrect for RTL.
1518
- return getBoundingClientRect$2(getDocumentElement$2(element)).left + getNodeScroll$2(element).scrollLeft;
1518
+ return getBoundingClientRect$2(getDocumentElement$3(element)).left + getNodeScroll$2(element).scrollLeft;
1519
1519
  }
1520
1520
 
1521
1521
  // Gets the entire size of the scrollable document area, even extending outside
1522
1522
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1523
1523
  function getDocumentRect$2(element) {
1524
- const html = getDocumentElement$2(element);
1524
+ const html = getDocumentElement$3(element);
1525
1525
  const scroll = getNodeScroll$2(element);
1526
1526
  const body = element.ownerDocument.body;
1527
1527
  const width = max$3(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1528
1528
  const height = max$3(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1529
1529
  let x = -scroll.scrollLeft + getWindowScrollBarX$2(element);
1530
1530
  const y = -scroll.scrollTop;
1531
- if (getComputedStyle$3(body).direction === 'rtl') {
1531
+ if (getComputedStyle$4(body).direction === 'rtl') {
1532
1532
  x += max$3(html.clientWidth, body.clientWidth) - width;
1533
1533
  }
1534
1534
  return {
@@ -1541,7 +1541,7 @@ function getDocumentRect$2(element) {
1541
1541
 
1542
1542
  function getViewportRect$2(element, strategy) {
1543
1543
  const win = getWindow$3(element);
1544
- const html = getDocumentElement$2(element);
1544
+ const html = getDocumentElement$3(element);
1545
1545
  const visualViewport = win.visualViewport;
1546
1546
  let width = html.clientWidth;
1547
1547
  let height = html.clientHeight;
@@ -1569,7 +1569,7 @@ function getInnerBoundingClientRect$2(element, strategy) {
1569
1569
  const clientRect = getBoundingClientRect$2(element, true, strategy === 'fixed');
1570
1570
  const top = clientRect.top + element.clientTop;
1571
1571
  const left = clientRect.left + element.clientLeft;
1572
- const scale = isHTMLElement$2(element) ? getScale$1(element) : createCoords$1(1);
1572
+ const scale = isHTMLElement$3(element) ? getScale$1(element) : createCoords$1(1);
1573
1573
  const width = element.clientWidth * scale.x;
1574
1574
  const height = element.clientHeight * scale.y;
1575
1575
  const x = left * scale.x;
@@ -1586,7 +1586,7 @@ function getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy
1586
1586
  if (clippingAncestor === 'viewport') {
1587
1587
  rect = getViewportRect$2(element, strategy);
1588
1588
  } else if (clippingAncestor === 'document') {
1589
- rect = getDocumentRect$2(getDocumentElement$2(element));
1589
+ rect = getDocumentRect$2(getDocumentElement$3(element));
1590
1590
  } else if (isElement$3(clippingAncestor)) {
1591
1591
  rect = getInnerBoundingClientRect$2(clippingAncestor, strategy);
1592
1592
  } else {
@@ -1600,11 +1600,11 @@ function getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy
1600
1600
  return rectToClientRect$2(rect);
1601
1601
  }
1602
1602
  function hasFixedPositionAncestor$1(element, stopNode) {
1603
- const parentNode = getParentNode$2(element);
1604
- if (parentNode === stopNode || !isElement$3(parentNode) || isLastTraversableNode$1(parentNode)) {
1603
+ const parentNode = getParentNode$3(element);
1604
+ if (parentNode === stopNode || !isElement$3(parentNode) || isLastTraversableNode$2(parentNode)) {
1605
1605
  return false;
1606
1606
  }
1607
- return getComputedStyle$3(parentNode).position === 'fixed' || hasFixedPositionAncestor$1(parentNode, stopNode);
1607
+ return getComputedStyle$4(parentNode).position === 'fixed' || hasFixedPositionAncestor$1(parentNode, stopNode);
1608
1608
  }
1609
1609
 
1610
1610
  // A "clipping ancestor" is an `overflow` element with the characteristic of
@@ -1615,14 +1615,14 @@ function getClippingElementAncestors$1(element, cache) {
1615
1615
  if (cachedResult) {
1616
1616
  return cachedResult;
1617
1617
  }
1618
- let result = getOverflowAncestors$1(element, [], false).filter(el => isElement$3(el) && getNodeName$2(el) !== 'body');
1618
+ let result = getOverflowAncestors$1(element, [], false).filter(el => isElement$3(el) && getNodeName$3(el) !== 'body');
1619
1619
  let currentContainingBlockComputedStyle = null;
1620
- const elementIsFixed = getComputedStyle$3(element).position === 'fixed';
1621
- let currentNode = elementIsFixed ? getParentNode$2(element) : element;
1620
+ const elementIsFixed = getComputedStyle$4(element).position === 'fixed';
1621
+ let currentNode = elementIsFixed ? getParentNode$3(element) : element;
1622
1622
 
1623
1623
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1624
- while (isElement$3(currentNode) && !isLastTraversableNode$1(currentNode)) {
1625
- const computedStyle = getComputedStyle$3(currentNode);
1624
+ while (isElement$3(currentNode) && !isLastTraversableNode$2(currentNode)) {
1625
+ const computedStyle = getComputedStyle$4(currentNode);
1626
1626
  const currentNodeIsContaining = isContainingBlock$1(currentNode);
1627
1627
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1628
1628
  currentContainingBlockComputedStyle = null;
@@ -1635,7 +1635,7 @@ function getClippingElementAncestors$1(element, cache) {
1635
1635
  // Record last containing block for next iteration.
1636
1636
  currentContainingBlockComputedStyle = computedStyle;
1637
1637
  }
1638
- currentNode = getParentNode$2(currentNode);
1638
+ currentNode = getParentNode$3(currentNode);
1639
1639
  }
1640
1640
  cache.set(element, result);
1641
1641
  return result;
@@ -1681,8 +1681,8 @@ function getDimensions$1(element) {
1681
1681
  }
1682
1682
 
1683
1683
  function getRectRelativeToOffsetParent$1(element, offsetParent, strategy) {
1684
- const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
1685
- const documentElement = getDocumentElement$2(offsetParent);
1684
+ const isOffsetParentAnElement = isHTMLElement$3(offsetParent);
1685
+ const documentElement = getDocumentElement$3(offsetParent);
1686
1686
  const isFixed = strategy === 'fixed';
1687
1687
  const rect = getBoundingClientRect$2(element, true, isFixed, offsetParent);
1688
1688
  let scroll = {
@@ -1691,7 +1691,7 @@ function getRectRelativeToOffsetParent$1(element, offsetParent, strategy) {
1691
1691
  };
1692
1692
  const offsets = createCoords$1(0);
1693
1693
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1694
- if (getNodeName$2(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
1694
+ if (getNodeName$3(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
1695
1695
  scroll = getNodeScroll$2(offsetParent);
1696
1696
  }
1697
1697
  if (isOffsetParentAnElement) {
@@ -1713,11 +1713,11 @@ function getRectRelativeToOffsetParent$1(element, offsetParent, strategy) {
1713
1713
  }
1714
1714
 
1715
1715
  function isStaticPositioned$1(element) {
1716
- return getComputedStyle$3(element).position === 'static';
1716
+ return getComputedStyle$4(element).position === 'static';
1717
1717
  }
1718
1718
 
1719
1719
  function getTrueOffsetParent$2(element, polyfill) {
1720
- if (!isHTMLElement$2(element) || getComputedStyle$3(element).position === 'fixed') {
1720
+ if (!isHTMLElement$3(element) || getComputedStyle$4(element).position === 'fixed') {
1721
1721
  return null;
1722
1722
  }
1723
1723
  if (polyfill) {
@@ -1733,13 +1733,13 @@ function getOffsetParent$2(element, polyfill) {
1733
1733
  if (isTopLayer$1(element)) {
1734
1734
  return win;
1735
1735
  }
1736
- if (!isHTMLElement$2(element)) {
1737
- let svgOffsetParent = getParentNode$2(element);
1738
- while (svgOffsetParent && !isLastTraversableNode$1(svgOffsetParent)) {
1736
+ if (!isHTMLElement$3(element)) {
1737
+ let svgOffsetParent = getParentNode$3(element);
1738
+ while (svgOffsetParent && !isLastTraversableNode$2(svgOffsetParent)) {
1739
1739
  if (isElement$3(svgOffsetParent) && !isStaticPositioned$1(svgOffsetParent)) {
1740
1740
  return svgOffsetParent;
1741
1741
  }
1742
- svgOffsetParent = getParentNode$2(svgOffsetParent);
1742
+ svgOffsetParent = getParentNode$3(svgOffsetParent);
1743
1743
  }
1744
1744
  return win;
1745
1745
  }
@@ -1747,7 +1747,7 @@ function getOffsetParent$2(element, polyfill) {
1747
1747
  while (offsetParent && isTableElement$2(offsetParent) && isStaticPositioned$1(offsetParent)) {
1748
1748
  offsetParent = getTrueOffsetParent$2(offsetParent, polyfill);
1749
1749
  }
1750
- if (offsetParent && isLastTraversableNode$1(offsetParent) && isStaticPositioned$1(offsetParent) && !isContainingBlock$1(offsetParent)) {
1750
+ if (offsetParent && isLastTraversableNode$2(offsetParent) && isStaticPositioned$1(offsetParent) && !isContainingBlock$1(offsetParent)) {
1751
1751
  return win;
1752
1752
  }
1753
1753
  return offsetParent || getContainingBlock$2(element) || win;
@@ -1769,12 +1769,12 @@ const getElementRects$1 = async function (data) {
1769
1769
  };
1770
1770
 
1771
1771
  function isRTL$1(element) {
1772
- return getComputedStyle$3(element).direction === 'rtl';
1772
+ return getComputedStyle$4(element).direction === 'rtl';
1773
1773
  }
1774
1774
 
1775
1775
  const platform$1 = {
1776
1776
  convertOffsetParentRelativeRectToViewportRelativeRect: convertOffsetParentRelativeRectToViewportRelativeRect$1,
1777
- getDocumentElement: getDocumentElement$2,
1777
+ getDocumentElement: getDocumentElement$3,
1778
1778
  getClippingRect: getClippingRect$2,
1779
1779
  getOffsetParent: getOffsetParent$2,
1780
1780
  getElementRects: getElementRects$1,
@@ -1789,7 +1789,7 @@ const platform$1 = {
1789
1789
  function observeMove$1(element, onMove) {
1790
1790
  let io = null;
1791
1791
  let timeoutId;
1792
- const root = getDocumentElement$2(element);
1792
+ const root = getDocumentElement$3(element);
1793
1793
  function cleanup() {
1794
1794
  var _io;
1795
1795
  clearTimeout(timeoutId);
@@ -2117,7 +2117,7 @@ function useLatestRef(value) {
2117
2117
  * Provides data to position a floating element.
2118
2118
  * @see https://floating-ui.com/docs/useFloating
2119
2119
  */
2120
- function useFloating(options) {
2120
+ function useFloating$1(options) {
2121
2121
  if (options === void 0) {
2122
2122
  options = {};
2123
2123
  }
@@ -20989,7 +20989,7 @@ const DisplayFormError = ({ message }) => {
20989
20989
  };
20990
20990
 
20991
20991
  const Input = React__namespace.default.forwardRef((_a, ref) => {
20992
- var { name, placeholder, onChange, isRequired, isDisabled, isClearable, errorMessage, helpText, iconName, className } = _a, rest = __rest$1(_a, ["name", "placeholder", "onChange", "isRequired", "isDisabled", "isClearable", "errorMessage", "helpText", "iconName", "className"]);
20992
+ var { name, placeholder, isRequired, isDisabled, isClearable, errorMessage, helpText, iconName, onChange, onBlur, onKeyDown, className } = _a, rest = __rest$1(_a, ["name", "placeholder", "isRequired", "isDisabled", "isClearable", "errorMessage", "helpText", "iconName", "onChange", "onBlur", "onKeyDown", "className"]);
20993
20993
  const hasErrors = errorMessage && errorMessage.length > 0;
20994
20994
  const handleClear = () => {
20995
20995
  onChange({ target: { value: '' } });
@@ -20998,7 +20998,7 @@ const Input = React__namespace.default.forwardRef((_a, ref) => {
20998
20998
  error: hasErrors,
20999
20999
  'input--has-icon': iconName,
21000
21000
  }, className);
21001
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "input-wrapper", children: [iconName && (jsxRuntime.jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsxRuntime.jsx("input", Object.assign({ ref: ref, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, onChange: onChange, className: inputClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), isClearable && !isDisabled && (jsxRuntime.jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
21001
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "input-wrapper", children: [iconName && (jsxRuntime.jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsxRuntime.jsx("input", Object.assign({ ref: ref, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, onChange: onChange, onBlur: onBlur, onKeyDown: onKeyDown, className: inputClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), isClearable && !isDisabled && (jsxRuntime.jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
21002
21002
  });
21003
21003
  const LabeledInput = withLabel(Input);
21004
21004
 
@@ -21026,7 +21026,7 @@ const Textarea = React__namespace.default.forwardRef((_a, ref) => {
21026
21026
  const LabeledTextarea = withLabel(Textarea);
21027
21027
 
21028
21028
  const PasswordInput = React__namespace.default.forwardRef((_a, ref) => {
21029
- var { name, placeholder, onChange, isRequired, isDisabled, errorMessage, helpText, hasShowPassword = true } = _a, rest = __rest$1(_a, ["name", "placeholder", "onChange", "isRequired", "isDisabled", "errorMessage", "helpText", "hasShowPassword"]);
21029
+ var { name, placeholder, onChange, onBlur, onKeyDown, isRequired, isDisabled, errorMessage, helpText, hasShowPassword = true } = _a, rest = __rest$1(_a, ["name", "placeholder", "onChange", "onBlur", "onKeyDown", "isRequired", "isDisabled", "errorMessage", "helpText", "hasShowPassword"]);
21030
21030
  const hasErrors = errorMessage && errorMessage.length > 0;
21031
21031
  const [showPassword, setShowPassword] = React$1.useState(false);
21032
21032
  const handleShowPassword = () => {
@@ -21035,7 +21035,7 @@ const PasswordInput = React__namespace.default.forwardRef((_a, ref) => {
21035
21035
  const inputClasses = classNames('password-input', {
21036
21036
  error: hasErrors,
21037
21037
  }, 'password-input--has-icon');
21038
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "password-input-wrapper", children: [jsxRuntime.jsx(Icon, { name: "lock", "data-testid": `${name}-embedded-icon`, className: "embedded-icon" }), jsxRuntime.jsx("input", Object.assign({ ref: ref, "data-testid": `form-password-input-${name}`, name: name, type: showPassword ? 'text' : 'password', disabled: isDisabled, placeholder: placeholder, onChange: onChange, className: inputClasses, "aria-invalid": hasErrors ? 'true' : 'false', "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), hasShowPassword && (jsxRuntime.jsx(Icon, { name: showPassword ? 'fa-eye-slash' : 'eye', "data-testid": `${name}-${showPassword ? 'hide' : 'show'}-password-icon`, size: "md", onClick: handleShowPassword, className: "toggle-show-password-icon" }))] }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
21038
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "password-input-wrapper", children: [jsxRuntime.jsx(Icon, { name: "lock", "data-testid": `${name}-embedded-icon`, className: "embedded-icon" }), jsxRuntime.jsx("input", Object.assign({ ref: ref, "data-testid": `form-password-input-${name}`, name: name, type: showPassword ? 'text' : 'password', disabled: isDisabled, placeholder: placeholder, onChange: onChange, onBlur: onBlur, onKeyDown: onKeyDown, className: inputClasses, "aria-invalid": hasErrors ? 'true' : 'false', "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), hasShowPassword && (jsxRuntime.jsx(Icon, { name: showPassword ? 'fa-eye-slash' : 'eye', "data-testid": `${name}-${showPassword ? 'hide' : 'show'}-password-icon`, size: "md", onClick: handleShowPassword, className: "toggle-show-password-icon" }))] }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
21039
21039
  });
21040
21040
  const LabeledPasswordInput = withLabel(PasswordInput);
21041
21041
 
@@ -21087,13 +21087,32 @@ const Card = (_a) => {
21087
21087
  return (jsxRuntime.jsxs("div", Object.assign({ className: cardClasses }, rest, { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: "card__header", children: [title && jsxRuntime.jsx("h2", { children: title }), subtitle && jsxRuntime.jsx("p", { children: subtitle })] })), jsxRuntime.jsx("div", { className: "card__content", children: children })] })));
21088
21088
  };
21089
21089
 
21090
+ function getNodeName$2(node) {
21091
+ if (isNode$1(node)) {
21092
+ return (node.nodeName || '').toLowerCase();
21093
+ }
21094
+ // Mocked nodes in testing environments may not be instances of Node. By
21095
+ // returning `#document` an infinite loop won't occur.
21096
+ // https://github.com/floating-ui/floating-ui/issues/2317
21097
+ return '#document';
21098
+ }
21090
21099
  function getWindow$2(node) {
21091
21100
  var _node$ownerDocument;
21092
21101
  return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
21093
21102
  }
21103
+ function getDocumentElement$2(node) {
21104
+ var _ref;
21105
+ return (_ref = (isNode$1(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
21106
+ }
21107
+ function isNode$1(value) {
21108
+ return value instanceof Node || value instanceof getWindow$2(value).Node;
21109
+ }
21094
21110
  function isElement$2(value) {
21095
21111
  return value instanceof Element || value instanceof getWindow$2(value).Element;
21096
21112
  }
21113
+ function isHTMLElement$2(value) {
21114
+ return value instanceof HTMLElement || value instanceof getWindow$2(value).HTMLElement;
21115
+ }
21097
21116
  function isShadowRoot$2(value) {
21098
21117
  // Browsers without `ShadowRoot` support.
21099
21118
  if (typeof ShadowRoot === 'undefined') {
@@ -21101,6 +21120,27 @@ function isShadowRoot$2(value) {
21101
21120
  }
21102
21121
  return value instanceof ShadowRoot || value instanceof getWindow$2(value).ShadowRoot;
21103
21122
  }
21123
+ function isLastTraversableNode$1(node) {
21124
+ return ['html', 'body', '#document'].includes(getNodeName$2(node));
21125
+ }
21126
+ function getComputedStyle$3(element) {
21127
+ return getWindow$2(element).getComputedStyle(element);
21128
+ }
21129
+ function getParentNode$2(node) {
21130
+ if (getNodeName$2(node) === 'html') {
21131
+ return node;
21132
+ }
21133
+ const result =
21134
+ // Step into the shadow DOM of the parent of a slotted node.
21135
+ node.assignedSlot ||
21136
+ // DOM Element detected.
21137
+ node.parentNode ||
21138
+ // ShadowRoot detected.
21139
+ isShadowRoot$2(node) && node.host ||
21140
+ // Fallback.
21141
+ getDocumentElement$2(node);
21142
+ return isShadowRoot$2(result) ? result.host : result;
21143
+ }
21104
21144
 
21105
21145
  function activeElement(doc) {
21106
21146
  let activeElement = doc.activeElement;
@@ -21140,9 +21180,46 @@ function isSafari() {
21140
21180
  // Chrome DevTools does not complain about navigator.vendor
21141
21181
  return /apple/i.test(navigator.vendor);
21142
21182
  }
21183
+ function isMouseLikePointerType(pointerType, strict) {
21184
+ // On some Linux machines with Chromium, mouse inputs return a `pointerType`
21185
+ // of "pen": https://github.com/floating-ui/floating-ui/issues/2015
21186
+ const values = ['mouse', 'pen'];
21187
+ return values.includes(pointerType);
21188
+ }
21189
+ function isReactEvent(event) {
21190
+ return 'nativeEvent' in event;
21191
+ }
21192
+ function isRootElement(element) {
21193
+ return element.matches('html,body');
21194
+ }
21143
21195
  function getDocument(node) {
21144
21196
  return (node == null ? void 0 : node.ownerDocument) || document;
21145
21197
  }
21198
+ function isEventTargetWithin(event, node) {
21199
+ if (node == null) {
21200
+ return false;
21201
+ }
21202
+ if ('composedPath' in event) {
21203
+ return event.composedPath().includes(node);
21204
+ }
21205
+
21206
+ // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't
21207
+ const e = event;
21208
+ return e.target != null && node.contains(e.target);
21209
+ }
21210
+ function getTarget(event) {
21211
+ if ('composedPath' in event) {
21212
+ return event.composedPath()[0];
21213
+ }
21214
+
21215
+ // TS thinks `event` is of type never as it assumes all browsers support
21216
+ // `composedPath()`, but browsers without shadow DOM don't.
21217
+ return event.target;
21218
+ }
21219
+ const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled])," + "[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
21220
+ function isTypeableElement(element) {
21221
+ return isHTMLElement$2(element) && element.matches(TYPEABLE_SELECTOR);
21222
+ }
21146
21223
 
21147
21224
  /*!
21148
21225
  * tabbable 6.2.0
@@ -21727,6 +21804,25 @@ const SafeReact = {
21727
21804
  ...React__namespace
21728
21805
  };
21729
21806
 
21807
+ const useInsertionEffect = SafeReact.useInsertionEffect;
21808
+ const useSafeInsertionEffect = useInsertionEffect || (fn => fn());
21809
+ function useEffectEvent(callback) {
21810
+ const ref = React__namespace.useRef(() => {
21811
+ if (process.env.NODE_ENV !== "production") {
21812
+ throw new Error('Cannot call an event handler while rendering.');
21813
+ }
21814
+ });
21815
+ useSafeInsertionEffect(() => {
21816
+ ref.current = callback;
21817
+ });
21818
+ return React__namespace.useCallback(function () {
21819
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
21820
+ args[_key] = arguments[_key];
21821
+ }
21822
+ return ref.current == null ? void 0 : ref.current(...args);
21823
+ }, []);
21824
+ }
21825
+
21730
21826
  var index = typeof document !== 'undefined' ? React$1.useLayoutEffect : React$1.useEffect;
21731
21827
 
21732
21828
  function _extends$1() {
@@ -21771,12 +21867,81 @@ const useReactId = SafeReact.useId;
21771
21867
  * @see https://floating-ui.com/docs/react-utils#useid
21772
21868
  */
21773
21869
  const useId$1 = useReactId || useFloatingId;
21774
- if (process.env.NODE_ENV !== "production") ;
21870
+
21871
+ let devMessageSet;
21872
+ if (process.env.NODE_ENV !== "production") {
21873
+ devMessageSet = /*#__PURE__*/new Set();
21874
+ }
21875
+ function error() {
21876
+ var _devMessageSet3;
21877
+ for (var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
21878
+ messages[_key2] = arguments[_key2];
21879
+ }
21880
+ const message = "Floating UI: " + messages.join(' ');
21881
+ if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {
21882
+ var _devMessageSet4;
21883
+ (_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);
21884
+ console.error(message);
21885
+ }
21886
+ }
21887
+
21888
+ function createPubSub() {
21889
+ const map = new Map();
21890
+ return {
21891
+ emit(event, data) {
21892
+ var _map$get;
21893
+ (_map$get = map.get(event)) == null || _map$get.forEach(handler => handler(data));
21894
+ },
21895
+ on(event, listener) {
21896
+ map.set(event, [...(map.get(event) || []), listener]);
21897
+ },
21898
+ off(event, listener) {
21899
+ var _map$get2;
21900
+ map.set(event, ((_map$get2 = map.get(event)) == null ? void 0 : _map$get2.filter(l => l !== listener)) || []);
21901
+ }
21902
+ };
21903
+ }
21904
+
21905
+ const FloatingNodeContext = /*#__PURE__*/React__namespace.createContext(null);
21906
+ const FloatingTreeContext = /*#__PURE__*/React__namespace.createContext(null);
21907
+
21908
+ /**
21909
+ * Returns the parent node id for nested floating elements, if available.
21910
+ * Returns `null` for top-level floating elements.
21911
+ */
21912
+ const useFloatingParentNodeId = () => {
21913
+ var _React$useContext;
21914
+ return ((_React$useContext = React__namespace.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
21915
+ };
21916
+
21917
+ /**
21918
+ * Returns the nearest floating tree context, if available.
21919
+ */
21920
+ const useFloatingTree = () => React__namespace.useContext(FloatingTreeContext);
21775
21921
 
21776
21922
  function createAttribute(name) {
21777
21923
  return "data-floating-ui-" + name;
21778
21924
  }
21779
21925
 
21926
+ function getChildren(nodes, id) {
21927
+ let allChildren = nodes.filter(node => {
21928
+ var _node$context;
21929
+ return node.parentId === id && ((_node$context = node.context) == null ? void 0 : _node$context.open);
21930
+ });
21931
+ let currentChildren = allChildren;
21932
+ while (currentChildren.length) {
21933
+ currentChildren = nodes.filter(node => {
21934
+ var _currentChildren;
21935
+ return (_currentChildren = currentChildren) == null ? void 0 : _currentChildren.some(n => {
21936
+ var _node$context2;
21937
+ return node.parentId === n.id && ((_node$context2 = node.context) == null ? void 0 : _node$context2.open);
21938
+ });
21939
+ });
21940
+ allChildren = allChildren.concat(currentChildren);
21941
+ }
21942
+ return allChildren;
21943
+ }
21944
+
21780
21945
  const getTabbableOptions = () => ({
21781
21946
  getShadowRoot: true,
21782
21947
  displayCheck:
@@ -22041,22 +22206,599 @@ function FloatingPortal(props) {
22041
22206
  }
22042
22207
  const usePortalContext = () => React__namespace.useContext(PortalContext);
22043
22208
 
22044
- const useClickOutside = (ref, handler) => {
22045
- React$1.useEffect(() => {
22046
- const listener = (e) => {
22047
- if (!ref.current || ref.current.contains(e.target)) {
22048
- return;
22049
- }
22050
- handler(e);
22051
- };
22052
- document.addEventListener('mousedown', listener);
22053
- document.addEventListener('touchstart', listener);
22054
- return () => {
22055
- document.removeEventListener('mousedown', listener);
22056
- document.removeEventListener('touchstart', listener);
22057
- };
22058
- }, [ref, handler]);
22209
+ function isButtonTarget(event) {
22210
+ return isHTMLElement$2(event.target) && event.target.tagName === 'BUTTON';
22211
+ }
22212
+ function isSpaceIgnored(element) {
22213
+ return isTypeableElement(element);
22214
+ }
22215
+ /**
22216
+ * Opens or closes the floating element when clicking the reference element.
22217
+ * @see https://floating-ui.com/docs/useClick
22218
+ */
22219
+ function useClick(context, props) {
22220
+ if (props === void 0) {
22221
+ props = {};
22222
+ }
22223
+ const {
22224
+ open,
22225
+ onOpenChange,
22226
+ dataRef,
22227
+ elements: {
22228
+ domReference
22229
+ }
22230
+ } = context;
22231
+ const {
22232
+ enabled = true,
22233
+ event: eventOption = 'click',
22234
+ toggle = true,
22235
+ ignoreMouse = false,
22236
+ keyboardHandlers = true
22237
+ } = props;
22238
+ const pointerTypeRef = React__namespace.useRef();
22239
+ const didKeyDownRef = React__namespace.useRef(false);
22240
+ const reference = React__namespace.useMemo(() => ({
22241
+ onPointerDown(event) {
22242
+ pointerTypeRef.current = event.pointerType;
22243
+ },
22244
+ onMouseDown(event) {
22245
+ const pointerType = pointerTypeRef.current;
22246
+
22247
+ // Ignore all buttons except for the "main" button.
22248
+ // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
22249
+ if (event.button !== 0) return;
22250
+ if (eventOption === 'click') return;
22251
+ if (isMouseLikePointerType(pointerType) && ignoreMouse) return;
22252
+ if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'mousedown' : true)) {
22253
+ onOpenChange(false, event.nativeEvent, 'click');
22254
+ } else {
22255
+ // Prevent stealing focus from the floating element
22256
+ event.preventDefault();
22257
+ onOpenChange(true, event.nativeEvent, 'click');
22258
+ }
22259
+ },
22260
+ onClick(event) {
22261
+ const pointerType = pointerTypeRef.current;
22262
+ if (eventOption === 'mousedown' && pointerTypeRef.current) {
22263
+ pointerTypeRef.current = undefined;
22264
+ return;
22265
+ }
22266
+ if (isMouseLikePointerType(pointerType) && ignoreMouse) return;
22267
+ if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'click' : true)) {
22268
+ onOpenChange(false, event.nativeEvent, 'click');
22269
+ } else {
22270
+ onOpenChange(true, event.nativeEvent, 'click');
22271
+ }
22272
+ },
22273
+ onKeyDown(event) {
22274
+ pointerTypeRef.current = undefined;
22275
+ if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) {
22276
+ return;
22277
+ }
22278
+ if (event.key === ' ' && !isSpaceIgnored(domReference)) {
22279
+ // Prevent scrolling
22280
+ event.preventDefault();
22281
+ didKeyDownRef.current = true;
22282
+ }
22283
+ if (event.key === 'Enter') {
22284
+ if (open && toggle) {
22285
+ onOpenChange(false, event.nativeEvent, 'click');
22286
+ } else {
22287
+ onOpenChange(true, event.nativeEvent, 'click');
22288
+ }
22289
+ }
22290
+ },
22291
+ onKeyUp(event) {
22292
+ if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) {
22293
+ return;
22294
+ }
22295
+ if (event.key === ' ' && didKeyDownRef.current) {
22296
+ didKeyDownRef.current = false;
22297
+ if (open && toggle) {
22298
+ onOpenChange(false, event.nativeEvent, 'click');
22299
+ } else {
22300
+ onOpenChange(true, event.nativeEvent, 'click');
22301
+ }
22302
+ }
22303
+ }
22304
+ }), [dataRef, domReference, eventOption, ignoreMouse, keyboardHandlers, onOpenChange, open, toggle]);
22305
+ return React__namespace.useMemo(() => enabled ? {
22306
+ reference
22307
+ } : {}, [enabled, reference]);
22308
+ }
22309
+
22310
+ const bubbleHandlerKeys = {
22311
+ pointerdown: 'onPointerDown',
22312
+ mousedown: 'onMouseDown',
22313
+ click: 'onClick'
22314
+ };
22315
+ const captureHandlerKeys = {
22316
+ pointerdown: 'onPointerDownCapture',
22317
+ mousedown: 'onMouseDownCapture',
22318
+ click: 'onClickCapture'
22059
22319
  };
22320
+ const normalizeProp = normalizable => {
22321
+ var _normalizable$escapeK, _normalizable$outside;
22322
+ return {
22323
+ escapeKey: typeof normalizable === 'boolean' ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false,
22324
+ outsidePress: typeof normalizable === 'boolean' ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true
22325
+ };
22326
+ };
22327
+ /**
22328
+ * Closes the floating element when a dismissal is requested — by default, when
22329
+ * the user presses the `escape` key or outside of the floating element.
22330
+ * @see https://floating-ui.com/docs/useDismiss
22331
+ */
22332
+ function useDismiss(context, props) {
22333
+ if (props === void 0) {
22334
+ props = {};
22335
+ }
22336
+ const {
22337
+ open,
22338
+ onOpenChange,
22339
+ elements,
22340
+ dataRef
22341
+ } = context;
22342
+ const {
22343
+ enabled = true,
22344
+ escapeKey = true,
22345
+ outsidePress: unstable_outsidePress = true,
22346
+ outsidePressEvent = 'pointerdown',
22347
+ referencePress = false,
22348
+ referencePressEvent = 'pointerdown',
22349
+ ancestorScroll = false,
22350
+ bubbles,
22351
+ capture
22352
+ } = props;
22353
+ const tree = useFloatingTree();
22354
+ const outsidePressFn = useEffectEvent(typeof unstable_outsidePress === 'function' ? unstable_outsidePress : () => false);
22355
+ const outsidePress = typeof unstable_outsidePress === 'function' ? outsidePressFn : unstable_outsidePress;
22356
+ const insideReactTreeRef = React__namespace.useRef(false);
22357
+ const endedOrStartedInsideRef = React__namespace.useRef(false);
22358
+ const {
22359
+ escapeKey: escapeKeyBubbles,
22360
+ outsidePress: outsidePressBubbles
22361
+ } = normalizeProp(bubbles);
22362
+ const {
22363
+ escapeKey: escapeKeyCapture,
22364
+ outsidePress: outsidePressCapture
22365
+ } = normalizeProp(capture);
22366
+ const closeOnEscapeKeyDown = useEffectEvent(event => {
22367
+ var _dataRef$current$floa;
22368
+ if (!open || !enabled || !escapeKey || event.key !== 'Escape') {
22369
+ return;
22370
+ }
22371
+ const nodeId = (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId;
22372
+ const children = tree ? getChildren(tree.nodesRef.current, nodeId) : [];
22373
+ if (!escapeKeyBubbles) {
22374
+ event.stopPropagation();
22375
+ if (children.length > 0) {
22376
+ let shouldDismiss = true;
22377
+ children.forEach(child => {
22378
+ var _child$context;
22379
+ if ((_child$context = child.context) != null && _child$context.open && !child.context.dataRef.current.__escapeKeyBubbles) {
22380
+ shouldDismiss = false;
22381
+ return;
22382
+ }
22383
+ });
22384
+ if (!shouldDismiss) {
22385
+ return;
22386
+ }
22387
+ }
22388
+ }
22389
+ onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event, 'escape-key');
22390
+ });
22391
+ const closeOnEscapeKeyDownCapture = useEffectEvent(event => {
22392
+ var _getTarget2;
22393
+ const callback = () => {
22394
+ var _getTarget;
22395
+ closeOnEscapeKeyDown(event);
22396
+ (_getTarget = getTarget(event)) == null || _getTarget.removeEventListener('keydown', callback);
22397
+ };
22398
+ (_getTarget2 = getTarget(event)) == null || _getTarget2.addEventListener('keydown', callback);
22399
+ });
22400
+ const closeOnPressOutside = useEffectEvent(event => {
22401
+ var _dataRef$current$floa2;
22402
+ // Given developers can stop the propagation of the synthetic event,
22403
+ // we can only be confident with a positive value.
22404
+ const insideReactTree = insideReactTreeRef.current;
22405
+ insideReactTreeRef.current = false;
22406
+
22407
+ // When click outside is lazy (`click` event), handle dragging.
22408
+ // Don't close if:
22409
+ // - The click started inside the floating element.
22410
+ // - The click ended inside the floating element.
22411
+ const endedOrStartedInside = endedOrStartedInsideRef.current;
22412
+ endedOrStartedInsideRef.current = false;
22413
+ if (outsidePressEvent === 'click' && endedOrStartedInside) {
22414
+ return;
22415
+ }
22416
+ if (insideReactTree) {
22417
+ return;
22418
+ }
22419
+ if (typeof outsidePress === 'function' && !outsidePress(event)) {
22420
+ return;
22421
+ }
22422
+ const target = getTarget(event);
22423
+ const inertSelector = "[" + createAttribute('inert') + "]";
22424
+ const markers = getDocument(elements.floating).querySelectorAll(inertSelector);
22425
+ let targetRootAncestor = isElement$2(target) ? target : null;
22426
+ while (targetRootAncestor && !isLastTraversableNode$1(targetRootAncestor)) {
22427
+ const nextParent = getParentNode$2(targetRootAncestor);
22428
+ if (isLastTraversableNode$1(nextParent) || !isElement$2(nextParent)) {
22429
+ break;
22430
+ }
22431
+ targetRootAncestor = nextParent;
22432
+ }
22433
+
22434
+ // Check if the click occurred on a third-party element injected after the
22435
+ // floating element rendered.
22436
+ if (markers.length && isElement$2(target) && !isRootElement(target) &&
22437
+ // Clicked on a direct ancestor (e.g. FloatingOverlay).
22438
+ !contains$1(target, elements.floating) &&
22439
+ // If the target root element contains none of the markers, then the
22440
+ // element was injected after the floating element rendered.
22441
+ Array.from(markers).every(marker => !contains$1(targetRootAncestor, marker))) {
22442
+ return;
22443
+ }
22444
+
22445
+ // Check if the click occurred on the scrollbar
22446
+ if (isHTMLElement$2(target) && floating) {
22447
+ // In Firefox, `target.scrollWidth > target.clientWidth` for inline
22448
+ // elements.
22449
+ const canScrollX = target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
22450
+ const canScrollY = target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
22451
+ let xCond = canScrollY && event.offsetX > target.clientWidth;
22452
+
22453
+ // In some browsers it is possible to change the <body> (or window)
22454
+ // scrollbar to the left side, but is very rare and is difficult to
22455
+ // check for. Plus, for modal dialogs with backdrops, it is more
22456
+ // important that the backdrop is checked but not so much the window.
22457
+ if (canScrollY) {
22458
+ const isRTL = getComputedStyle$3(target).direction === 'rtl';
22459
+ if (isRTL) {
22460
+ xCond = event.offsetX <= target.offsetWidth - target.clientWidth;
22461
+ }
22462
+ }
22463
+ if (xCond || canScrollX && event.offsetY > target.clientHeight) {
22464
+ return;
22465
+ }
22466
+ }
22467
+ const nodeId = (_dataRef$current$floa2 = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa2.nodeId;
22468
+ const targetIsInsideChildren = tree && getChildren(tree.nodesRef.current, nodeId).some(node => {
22469
+ var _node$context;
22470
+ return isEventTargetWithin(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating);
22471
+ });
22472
+ if (isEventTargetWithin(event, elements.floating) || isEventTargetWithin(event, elements.domReference) || targetIsInsideChildren) {
22473
+ return;
22474
+ }
22475
+ const children = tree ? getChildren(tree.nodesRef.current, nodeId) : [];
22476
+ if (children.length > 0) {
22477
+ let shouldDismiss = true;
22478
+ children.forEach(child => {
22479
+ var _child$context2;
22480
+ if ((_child$context2 = child.context) != null && _child$context2.open && !child.context.dataRef.current.__outsidePressBubbles) {
22481
+ shouldDismiss = false;
22482
+ return;
22483
+ }
22484
+ });
22485
+ if (!shouldDismiss) {
22486
+ return;
22487
+ }
22488
+ }
22489
+ onOpenChange(false, event, 'outside-press');
22490
+ });
22491
+ const closeOnPressOutsideCapture = useEffectEvent(event => {
22492
+ var _getTarget4;
22493
+ const callback = () => {
22494
+ var _getTarget3;
22495
+ closeOnPressOutside(event);
22496
+ (_getTarget3 = getTarget(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback);
22497
+ };
22498
+ (_getTarget4 = getTarget(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback);
22499
+ });
22500
+ React__namespace.useEffect(() => {
22501
+ if (!open || !enabled) {
22502
+ return;
22503
+ }
22504
+ dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
22505
+ dataRef.current.__outsidePressBubbles = outsidePressBubbles;
22506
+ function onScroll(event) {
22507
+ onOpenChange(false, event, 'ancestor-scroll');
22508
+ }
22509
+ const doc = getDocument(elements.floating);
22510
+ escapeKey && doc.addEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
22511
+ outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
22512
+ let ancestors = [];
22513
+ if (ancestorScroll) {
22514
+ if (isElement$2(elements.domReference)) {
22515
+ ancestors = getOverflowAncestors$1(elements.domReference);
22516
+ }
22517
+ if (isElement$2(elements.floating)) {
22518
+ ancestors = ancestors.concat(getOverflowAncestors$1(elements.floating));
22519
+ }
22520
+ if (!isElement$2(elements.reference) && elements.reference && elements.reference.contextElement) {
22521
+ ancestors = ancestors.concat(getOverflowAncestors$1(elements.reference.contextElement));
22522
+ }
22523
+ }
22524
+
22525
+ // Ignore the visual viewport for scrolling dismissal (allow pinch-zoom)
22526
+ ancestors = ancestors.filter(ancestor => {
22527
+ var _doc$defaultView;
22528
+ return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport);
22529
+ });
22530
+ ancestors.forEach(ancestor => {
22531
+ ancestor.addEventListener('scroll', onScroll, {
22532
+ passive: true
22533
+ });
22534
+ });
22535
+ return () => {
22536
+ escapeKey && doc.removeEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
22537
+ outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
22538
+ ancestors.forEach(ancestor => {
22539
+ ancestor.removeEventListener('scroll', onScroll);
22540
+ });
22541
+ };
22542
+ }, [dataRef, elements, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]);
22543
+ React__namespace.useEffect(() => {
22544
+ insideReactTreeRef.current = false;
22545
+ }, [outsidePress, outsidePressEvent]);
22546
+ const reference = React__namespace.useMemo(() => ({
22547
+ onKeyDown: closeOnEscapeKeyDown,
22548
+ [bubbleHandlerKeys[referencePressEvent]]: event => {
22549
+ if (referencePress) {
22550
+ onOpenChange(false, event.nativeEvent, 'reference-press');
22551
+ }
22552
+ }
22553
+ }), [closeOnEscapeKeyDown, onOpenChange, referencePress, referencePressEvent]);
22554
+ const floating = React__namespace.useMemo(() => ({
22555
+ onKeyDown: closeOnEscapeKeyDown,
22556
+ onMouseDown() {
22557
+ endedOrStartedInsideRef.current = true;
22558
+ },
22559
+ onMouseUp() {
22560
+ endedOrStartedInsideRef.current = true;
22561
+ },
22562
+ [captureHandlerKeys[outsidePressEvent]]: () => {
22563
+ insideReactTreeRef.current = true;
22564
+ }
22565
+ }), [closeOnEscapeKeyDown, outsidePressEvent]);
22566
+ return React__namespace.useMemo(() => enabled ? {
22567
+ reference,
22568
+ floating
22569
+ } : {}, [enabled, reference, floating]);
22570
+ }
22571
+
22572
+ function useFloatingRootContext(options) {
22573
+ const {
22574
+ open = false,
22575
+ onOpenChange: onOpenChangeProp,
22576
+ elements: elementsProp
22577
+ } = options;
22578
+ const floatingId = useId$1();
22579
+ const dataRef = React__namespace.useRef({});
22580
+ const [events] = React__namespace.useState(() => createPubSub());
22581
+ const nested = useFloatingParentNodeId() != null;
22582
+ if (process.env.NODE_ENV !== "production") {
22583
+ const optionDomReference = elementsProp.reference;
22584
+ if (optionDomReference && !isElement$2(optionDomReference)) {
22585
+ error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');
22586
+ }
22587
+ }
22588
+ const [positionReference, setPositionReference] = React__namespace.useState(elementsProp.reference);
22589
+ const onOpenChange = useEffectEvent((open, event, reason) => {
22590
+ dataRef.current.openEvent = open ? event : undefined;
22591
+ events.emit('openchange', {
22592
+ open,
22593
+ event,
22594
+ reason,
22595
+ nested
22596
+ });
22597
+ onOpenChangeProp == null || onOpenChangeProp(open, event, reason);
22598
+ });
22599
+ const refs = React__namespace.useMemo(() => ({
22600
+ setPositionReference
22601
+ }), []);
22602
+ const elements = React__namespace.useMemo(() => ({
22603
+ reference: positionReference || elementsProp.reference || null,
22604
+ floating: elementsProp.floating || null,
22605
+ domReference: elementsProp.reference
22606
+ }), [positionReference, elementsProp.reference, elementsProp.floating]);
22607
+ return React__namespace.useMemo(() => ({
22608
+ dataRef,
22609
+ open,
22610
+ onOpenChange,
22611
+ elements,
22612
+ events,
22613
+ floatingId,
22614
+ refs
22615
+ }), [open, onOpenChange, elements, events, floatingId, refs]);
22616
+ }
22617
+
22618
+ /**
22619
+ * Provides data to position a floating element and context to add interactions.
22620
+ * @see https://floating-ui.com/docs/useFloating
22621
+ */
22622
+ function useFloating(options) {
22623
+ if (options === void 0) {
22624
+ options = {};
22625
+ }
22626
+ const {
22627
+ nodeId
22628
+ } = options;
22629
+ const internalRootContext = useFloatingRootContext({
22630
+ ...options,
22631
+ elements: {
22632
+ reference: null,
22633
+ floating: null,
22634
+ ...options.elements
22635
+ }
22636
+ });
22637
+ const rootContext = options.rootContext || internalRootContext;
22638
+ const computedElements = rootContext.elements;
22639
+ const [_domReference, setDomReference] = React__namespace.useState(null);
22640
+ const [positionReference, _setPositionReference] = React__namespace.useState(null);
22641
+ const optionDomReference = computedElements == null ? void 0 : computedElements.reference;
22642
+ const domReference = optionDomReference || _domReference;
22643
+ const domReferenceRef = React__namespace.useRef(null);
22644
+ const tree = useFloatingTree();
22645
+ index(() => {
22646
+ if (domReference) {
22647
+ domReferenceRef.current = domReference;
22648
+ }
22649
+ }, [domReference]);
22650
+ const position = useFloating$1({
22651
+ ...options,
22652
+ elements: {
22653
+ ...computedElements,
22654
+ ...(positionReference && {
22655
+ reference: positionReference
22656
+ })
22657
+ }
22658
+ });
22659
+ const setPositionReference = React__namespace.useCallback(node => {
22660
+ const computedPositionReference = isElement$2(node) ? {
22661
+ getBoundingClientRect: () => node.getBoundingClientRect(),
22662
+ contextElement: node
22663
+ } : node;
22664
+ // Store the positionReference in state if the DOM reference is specified externally via the
22665
+ // `elements.reference` option. This ensures that it won't be overridden on future renders.
22666
+ _setPositionReference(computedPositionReference);
22667
+ position.refs.setReference(computedPositionReference);
22668
+ }, [position.refs]);
22669
+ const setReference = React__namespace.useCallback(node => {
22670
+ if (isElement$2(node) || node === null) {
22671
+ domReferenceRef.current = node;
22672
+ setDomReference(node);
22673
+ }
22674
+
22675
+ // Backwards-compatibility for passing a virtual element to `reference`
22676
+ // after it has set the DOM reference.
22677
+ if (isElement$2(position.refs.reference.current) || position.refs.reference.current === null ||
22678
+ // Don't allow setting virtual elements using the old technique back to
22679
+ // `null` to support `positionReference` + an unstable `reference`
22680
+ // callback ref.
22681
+ node !== null && !isElement$2(node)) {
22682
+ position.refs.setReference(node);
22683
+ }
22684
+ }, [position.refs]);
22685
+ const refs = React__namespace.useMemo(() => ({
22686
+ ...position.refs,
22687
+ setReference,
22688
+ setPositionReference,
22689
+ domReference: domReferenceRef
22690
+ }), [position.refs, setReference, setPositionReference]);
22691
+ const elements = React__namespace.useMemo(() => ({
22692
+ ...position.elements,
22693
+ domReference: domReference
22694
+ }), [position.elements, domReference]);
22695
+ const context = React__namespace.useMemo(() => ({
22696
+ ...position,
22697
+ ...rootContext,
22698
+ refs,
22699
+ elements,
22700
+ nodeId
22701
+ }), [position, refs, elements, nodeId, rootContext]);
22702
+ index(() => {
22703
+ rootContext.dataRef.current.floatingContext = context;
22704
+ const node = tree == null ? void 0 : tree.nodesRef.current.find(node => node.id === nodeId);
22705
+ if (node) {
22706
+ node.context = context;
22707
+ }
22708
+ });
22709
+ return React__namespace.useMemo(() => ({
22710
+ ...position,
22711
+ context,
22712
+ refs,
22713
+ elements
22714
+ }), [position, refs, elements, context]);
22715
+ }
22716
+
22717
+ const ACTIVE_KEY = 'active';
22718
+ const SELECTED_KEY = 'selected';
22719
+ function mergeProps(userProps, propsList, elementKey) {
22720
+ const map = new Map();
22721
+ const isItem = elementKey === 'item';
22722
+ let domUserProps = userProps;
22723
+ if (isItem && userProps) {
22724
+ const {
22725
+ [ACTIVE_KEY]: _,
22726
+ [SELECTED_KEY]: __,
22727
+ ...validProps
22728
+ } = userProps;
22729
+ domUserProps = validProps;
22730
+ }
22731
+ return {
22732
+ ...(elementKey === 'floating' && {
22733
+ tabIndex: -1
22734
+ }),
22735
+ ...domUserProps,
22736
+ ...propsList.map(value => {
22737
+ const propsOrGetProps = value ? value[elementKey] : null;
22738
+ if (typeof propsOrGetProps === 'function') {
22739
+ return userProps ? propsOrGetProps(userProps) : null;
22740
+ }
22741
+ return propsOrGetProps;
22742
+ }).concat(userProps).reduce((acc, props) => {
22743
+ if (!props) {
22744
+ return acc;
22745
+ }
22746
+ Object.entries(props).forEach(_ref => {
22747
+ let [key, value] = _ref;
22748
+ if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) {
22749
+ return;
22750
+ }
22751
+ if (key.indexOf('on') === 0) {
22752
+ if (!map.has(key)) {
22753
+ map.set(key, []);
22754
+ }
22755
+ if (typeof value === 'function') {
22756
+ var _map$get;
22757
+ (_map$get = map.get(key)) == null || _map$get.push(value);
22758
+ acc[key] = function () {
22759
+ var _map$get2;
22760
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22761
+ args[_key] = arguments[_key];
22762
+ }
22763
+ return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map(fn => fn(...args)).find(val => val !== undefined);
22764
+ };
22765
+ }
22766
+ } else {
22767
+ acc[key] = value;
22768
+ }
22769
+ });
22770
+ return acc;
22771
+ }, {})
22772
+ };
22773
+ }
22774
+ /**
22775
+ * Merges an array of interaction hooks' props into prop getters, allowing
22776
+ * event handler functions to be composed together without overwriting one
22777
+ * another.
22778
+ * @see https://floating-ui.com/docs/useInteractions
22779
+ */
22780
+ function useInteractions(propsList) {
22781
+ if (propsList === void 0) {
22782
+ propsList = [];
22783
+ }
22784
+ const referenceDeps = propsList.map(key => key == null ? void 0 : key.reference);
22785
+ const floatingDeps = propsList.map(key => key == null ? void 0 : key.floating);
22786
+ const itemDeps = propsList.map(key => key == null ? void 0 : key.item);
22787
+ const getReferenceProps = React__namespace.useCallback(userProps => mergeProps(userProps, propsList, 'reference'),
22788
+ // eslint-disable-next-line react-hooks/exhaustive-deps
22789
+ referenceDeps);
22790
+ const getFloatingProps = React__namespace.useCallback(userProps => mergeProps(userProps, propsList, 'floating'),
22791
+ // eslint-disable-next-line react-hooks/exhaustive-deps
22792
+ floatingDeps);
22793
+ const getItemProps = React__namespace.useCallback(userProps => mergeProps(userProps, propsList, 'item'),
22794
+ // eslint-disable-next-line react-hooks/exhaustive-deps
22795
+ itemDeps);
22796
+ return React__namespace.useMemo(() => ({
22797
+ getReferenceProps,
22798
+ getFloatingProps,
22799
+ getItemProps
22800
+ }), [getReferenceProps, getFloatingProps, getItemProps]);
22801
+ }
22060
22802
 
22061
22803
  const defaultOptions$1 = {
22062
22804
  placement: 'bottom-start',
@@ -22078,18 +22820,14 @@ function FloatUI({ children, ariaLabel, isOpen: controlledIsOpen, setIsOpen: con
22078
22820
  if (!React$1.isValidElement(trigger) || !React$1.isValidElement(content)) {
22079
22821
  throw new Error('Both children of FloatUI must be valid React elements.');
22080
22822
  }
22081
- const { x, y, strategy, refs } = useFloating(Object.assign({ elements: {
22823
+ const { refs, floatingStyles, context } = useFloating(Object.assign(Object.assign({}, floatingOptions), { open: isOpen, onOpenChange: setIsOpen, elements: {
22082
22824
  reference: referenceElementRef.current,
22083
- } }, floatingOptions));
22084
- useClickOutside(floatUIContentRef, () => setIsOpen(false));
22085
- const tooltipContent = (jsxRuntime.jsx("div", {
22086
- // Used to position the floating element relative to the reference element
22087
- ref: refs.setFloating, style: {
22088
- position: strategy,
22089
- top: y !== null && y !== void 0 ? y : 0,
22090
- left: x !== null && x !== void 0 ? x : 0,
22091
- }, role: "dialog", "aria-label": ariaLabel, className: "floatui-container", children: jsxRuntime.jsx("div", { ref: floatUIContentRef, className: "floatui-content", children: content }) }));
22092
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: referenceElementRef, onClick: () => setIsOpen(!isOpen), children: trigger }), isOpen &&
22825
+ } }));
22826
+ const click = useClick(context);
22827
+ const dismiss = useDismiss(context);
22828
+ const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss]);
22829
+ const tooltipContent = (jsxRuntime.jsx("div", Object.assign({ ref: refs.setFloating }, getFloatingProps(), { style: floatingStyles, role: "dialog", "aria-label": ariaLabel, className: "floatui-container", children: jsxRuntime.jsx("div", { ref: floatUIContentRef, className: "floatui-content", children: content }) })));
22830
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: trigger })), isOpen &&
22093
22831
  (isPortal ? (jsxRuntime.jsx(FloatingPortal, { id: portalOptions === null || portalOptions === void 0 ? void 0 : portalOptions.rootId, children: tooltipContent })) : (tooltipContent))] }));
22094
22832
  }
22095
22833
 
@@ -43983,5 +44721,5 @@ exports.platform = platform$1;
43983
44721
  exports.shift = shift$2;
43984
44722
  exports.size = size;
43985
44723
  exports.stringUtils = string;
43986
- exports.useFloating = useFloating;
44724
+ exports.useFloating = useFloating$1;
43987
44725
  //# sourceMappingURL=index.js.map