@haiilo/catalyst 10.28.2 → 10.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/catalyst/catalyst.css +3 -1
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/index.esm.js +1 -1
  5. package/dist/catalyst/p-41a50f19.entry.js +10 -0
  6. package/dist/catalyst/p-41a50f19.entry.js.map +1 -0
  7. package/dist/catalyst/{p-e5aee21d.js → p-9500d6fb.js} +1 -1
  8. package/dist/catalyst/{p-e5aee21d.js.map → p-9500d6fb.js.map} +1 -1
  9. package/dist/catalyst/scss/core/_notification.scss +4 -1
  10. package/dist/catalyst/scss/utils/_elevation.mixins.scss +8 -2
  11. package/dist/cjs/cat-alert_30.cjs.entry.js +274 -180
  12. package/dist/cjs/cat-alert_30.cjs.entry.js.map +1 -1
  13. package/dist/cjs/catalyst.cjs.js +1 -1
  14. package/dist/cjs/index.cjs.js +1 -1
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/cjs/{of-aaee31a6.js → of-958251e4.js} +1 -1
  17. package/dist/cjs/{of-aaee31a6.js.map → of-958251e4.js.map} +1 -1
  18. package/dist/collection/components/cat-button/cat-button.css +1 -1
  19. package/dist/collection/components/cat-date/cat-date.js +8 -7
  20. package/dist/collection/components/cat-date/cat-date.js.map +1 -1
  21. package/dist/collection/components/cat-date-inline/cat-date-inline.js +10 -8
  22. package/dist/collection/components/cat-date-inline/cat-date-inline.js.map +1 -1
  23. package/dist/collection/components/cat-date-inline/cat-date-locale.js +2 -4
  24. package/dist/collection/components/cat-date-inline/cat-date-locale.js.map +1 -1
  25. package/dist/collection/components/cat-datepicker/cat-datepicker.js +9 -8
  26. package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -1
  27. package/dist/collection/components/cat-dropdown/cat-dropdown.js +1 -1
  28. package/dist/collection/components/cat-input/cat-input.js +8 -4
  29. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  30. package/dist/collection/components/cat-select/cat-select.js +1 -1
  31. package/dist/collection/components/cat-textarea/cat-textarea.js +25 -3
  32. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  33. package/dist/collection/components/cat-time/cat-time.js +8 -7
  34. package/dist/collection/components/cat-time/cat-time.js.map +1 -1
  35. package/dist/collection/components/cat-tooltip/cat-tooltip.css +18 -9
  36. package/dist/collection/scss/core/_notification.scss +4 -1
  37. package/dist/collection/scss/utils/_elevation.mixins.scss +8 -2
  38. package/dist/components/cat-button2.js +1 -1
  39. package/dist/components/cat-button2.js.map +1 -1
  40. package/dist/components/cat-date-inline2.js +12 -12
  41. package/dist/components/cat-date-inline2.js.map +1 -1
  42. package/dist/components/cat-date.js +3 -3
  43. package/dist/components/cat-date.js.map +1 -1
  44. package/dist/components/cat-datepicker.js +4 -4
  45. package/dist/components/cat-datepicker.js.map +1 -1
  46. package/dist/components/cat-dropdown2.js +169 -118
  47. package/dist/components/cat-dropdown2.js.map +1 -1
  48. package/dist/components/cat-input2.js +7 -4
  49. package/dist/components/cat-input2.js.map +1 -1
  50. package/dist/components/cat-textarea.js +8 -3
  51. package/dist/components/cat-textarea.js.map +1 -1
  52. package/dist/components/cat-time.js +3 -3
  53. package/dist/components/cat-time.js.map +1 -1
  54. package/dist/components/cat-tooltip.js +1 -1
  55. package/dist/components/cat-tooltip.js.map +1 -1
  56. package/dist/components/floating-ui.dom.esm.js +67 -29
  57. package/dist/components/floating-ui.dom.esm.js.map +1 -1
  58. package/dist/components/loglevel.js.map +1 -1
  59. package/dist/esm/cat-alert_30.entry.js +274 -180
  60. package/dist/esm/cat-alert_30.entry.js.map +1 -1
  61. package/dist/esm/catalyst.js +1 -1
  62. package/dist/esm/index.js +2 -2
  63. package/dist/esm/loader.js +1 -1
  64. package/dist/esm/{of-acb1f3a9.js → of-e4ec2eb4.js} +1 -1
  65. package/dist/esm/{of-acb1f3a9.js.map → of-e4ec2eb4.js.map} +1 -1
  66. package/dist/types/components/cat-date/cat-date.d.ts +1 -1
  67. package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +1 -1
  68. package/dist/types/components/cat-input/cat-input.d.ts +2 -0
  69. package/dist/types/components/cat-textarea/cat-textarea.d.ts +6 -0
  70. package/dist/types/components/cat-time/cat-time.d.ts +1 -1
  71. package/dist/types/components.d.ts +11 -3
  72. package/package.json +8 -8
  73. package/dist/catalyst/p-ee89e395.entry.js +0 -10
  74. package/dist/catalyst/p-ee89e395.entry.js.map +0 -1
@@ -1228,7 +1228,7 @@ function isOverflowElement(element) {
1228
1228
  function isTableElement(element) {
1229
1229
  return ['table', 'td', 'th'].includes(getNodeName(element));
1230
1230
  }
1231
- function isTopLayer$1(element) {
1231
+ function isTopLayer(element) {
1232
1232
  return [':popover-open', ':modal'].some(selector => {
1233
1233
  try {
1234
1234
  return element.matches(selector);
@@ -1242,14 +1242,15 @@ function isContainingBlock(elementOrCss) {
1242
1242
  const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
1243
1243
 
1244
1244
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1245
- 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));
1245
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
1246
+ return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1246
1247
  }
1247
1248
  function getContainingBlock(element) {
1248
1249
  let currentNode = getParentNode(element);
1249
1250
  while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1250
1251
  if (isContainingBlock(currentNode)) {
1251
1252
  return currentNode;
1252
- } else if (isTopLayer$1(currentNode)) {
1253
+ } else if (isTopLayer(currentNode)) {
1253
1254
  return null;
1254
1255
  }
1255
1256
  currentNode = getParentNode(currentNode);
@@ -1426,7 +1427,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
1426
1427
  const win = getWindow(domElement);
1427
1428
  const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1428
1429
  let currentWin = win;
1429
- let currentIFrame = currentWin.frameElement;
1430
+ let currentIFrame = getFrameElement(currentWin);
1430
1431
  while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1431
1432
  const iframeScale = getScale(currentIFrame);
1432
1433
  const iframeRect = currentIFrame.getBoundingClientRect();
@@ -1440,7 +1441,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
1440
1441
  x += left;
1441
1442
  y += top;
1442
1443
  currentWin = getWindow(currentIFrame);
1443
- currentIFrame = currentWin.frameElement;
1444
+ currentIFrame = getFrameElement(currentWin);
1444
1445
  }
1445
1446
  }
1446
1447
  return rectToClientRect({
@@ -1451,15 +1452,29 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
1451
1452
  });
1452
1453
  }
1453
1454
 
1454
- const topLayerSelectors = [':popover-open', ':modal'];
1455
- function isTopLayer(element) {
1456
- return topLayerSelectors.some(selector => {
1457
- try {
1458
- return element.matches(selector);
1459
- } catch (e) {
1460
- return false;
1461
- }
1462
- });
1455
+ // If <html> has a CSS width greater than the viewport, then this will be
1456
+ // incorrect for RTL.
1457
+ function getWindowScrollBarX(element, rect) {
1458
+ const leftScroll = getNodeScroll(element).scrollLeft;
1459
+ if (!rect) {
1460
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1461
+ }
1462
+ return rect.left + leftScroll;
1463
+ }
1464
+
1465
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1466
+ if (ignoreScrollbarX === void 0) {
1467
+ ignoreScrollbarX = false;
1468
+ }
1469
+ const htmlRect = documentElement.getBoundingClientRect();
1470
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
1471
+ // RTL <body> scrollbar.
1472
+ getWindowScrollBarX(documentElement, htmlRect));
1473
+ const y = htmlRect.top + scroll.scrollTop;
1474
+ return {
1475
+ x,
1476
+ y
1477
+ };
1463
1478
  }
1464
1479
 
1465
1480
  function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
@@ -1493,11 +1508,12 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1493
1508
  offsets.y = offsetRect.y + offsetParent.clientTop;
1494
1509
  }
1495
1510
  }
1511
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1496
1512
  return {
1497
1513
  width: rect.width * scale.x,
1498
1514
  height: rect.height * scale.y,
1499
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1500
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1515
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1516
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1501
1517
  };
1502
1518
  }
1503
1519
 
@@ -1505,12 +1521,6 @@ function getClientRects(element) {
1505
1521
  return Array.from(element.getClientRects());
1506
1522
  }
1507
1523
 
1508
- function getWindowScrollBarX(element) {
1509
- // If <html> has a CSS width greater than the viewport, then this will be
1510
- // incorrect for RTL.
1511
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1512
- }
1513
-
1514
1524
  // Gets the entire size of the scrollable document area, even extending outside
1515
1525
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1516
1526
  function getDocumentRect(element) {
@@ -1585,9 +1595,10 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
1585
1595
  } else {
1586
1596
  const visualOffsets = getVisualOffsets(element);
1587
1597
  rect = {
1588
- ...clippingAncestor,
1589
1598
  x: clippingAncestor.x - visualOffsets.x,
1590
- y: clippingAncestor.y - visualOffsets.y
1599
+ y: clippingAncestor.y - visualOffsets.y,
1600
+ width: clippingAncestor.width,
1601
+ height: clippingAncestor.height
1591
1602
  };
1592
1603
  }
1593
1604
  return rectToClientRect(rect);
@@ -1692,11 +1703,14 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1692
1703
  offsets.x = offsetRect.x + offsetParent.clientLeft;
1693
1704
  offsets.y = offsetRect.y + offsetParent.clientTop;
1694
1705
  } else if (documentElement) {
1706
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1707
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1695
1708
  offsets.x = getWindowScrollBarX(documentElement);
1696
1709
  }
1697
1710
  }
1698
- const x = rect.left + scroll.scrollLeft - offsets.x;
1699
- const y = rect.top + scroll.scrollTop - offsets.y;
1711
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1712
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1713
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1700
1714
  return {
1701
1715
  x,
1702
1716
  y,
@@ -1716,7 +1730,16 @@ function getTrueOffsetParent(element, polyfill) {
1716
1730
  if (polyfill) {
1717
1731
  return polyfill(element);
1718
1732
  }
1719
- return element.offsetParent;
1733
+ let rawOffsetParent = element.offsetParent;
1734
+
1735
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1736
+ // while Chrome and Safari return the <body> element. The <body> element must
1737
+ // be used to perform the correct calculations even if the <html> element is
1738
+ // non-static.
1739
+ if (getDocumentElement(element) === rawOffsetParent) {
1740
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1741
+ }
1742
+ return rawOffsetParent;
1720
1743
  }
1721
1744
 
1722
1745
  // Gets the closest ancestor positioned element. Handles some edge cases,
@@ -1778,6 +1801,10 @@ const platform = {
1778
1801
  isRTL
1779
1802
  };
1780
1803
 
1804
+ function rectsAreEqual(a, b) {
1805
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1806
+ }
1807
+
1781
1808
  // https://samthor.au/2021/observing-dom/
1782
1809
  function observeMove(element, onMove) {
1783
1810
  let io = null;
@@ -1797,12 +1824,13 @@ function observeMove(element, onMove) {
1797
1824
  threshold = 1;
1798
1825
  }
1799
1826
  cleanup();
1827
+ const elementRectForRootMargin = element.getBoundingClientRect();
1800
1828
  const {
1801
1829
  left,
1802
1830
  top,
1803
1831
  width,
1804
1832
  height
1805
- } = element.getBoundingClientRect();
1833
+ } = elementRectForRootMargin;
1806
1834
  if (!skip) {
1807
1835
  onMove();
1808
1836
  }
@@ -1835,6 +1863,16 @@ function observeMove(element, onMove) {
1835
1863
  refresh(false, ratio);
1836
1864
  }
1837
1865
  }
1866
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1867
+ // It's possible that even though the ratio is reported as 1, the
1868
+ // element is not actually fully within the IntersectionObserver's root
1869
+ // area anymore. This can happen under performance constraints. This may
1870
+ // be a bug in the browser's IntersectionObserver implementation. To
1871
+ // work around this, we compare the element's bounding rect now with
1872
+ // what it was at the time we created the IntersectionObserver. If they
1873
+ // are not equal then the element moved, so we refresh.
1874
+ refresh();
1875
+ }
1838
1876
  isFirstUpdate = false;
1839
1877
  }
1840
1878
 
@@ -1912,7 +1950,7 @@ function autoUpdate(reference, floating, update, options) {
1912
1950
  }
1913
1951
  function frameLoop() {
1914
1952
  const nextRefRect = getBoundingClientRect(reference);
1915
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1953
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1916
1954
  update();
1917
1955
  }
1918
1956
  prevRefRect = nextRefRect;