@vonage/vivid 3.0.0-next.14 → 3.0.0-next.17

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/popup/index.js CHANGED
@@ -11,9 +11,12 @@ import { r as ref } from '../shared/aria-global.js';
11
11
  import { c as classNames } from '../shared/class-names.js';
12
12
  import '../icon/index.js';
13
13
  import '../shared/_has.js';
14
- import '../shared/index2.js';
14
+ import '../focus/index.js';
15
+ import '../shared/focus.js';
15
16
  import '../shared/affix.js';
17
+ import '../shared/button.js';
16
18
  import '../shared/apply-mixins.js';
19
+ import '../shared/focus2.js';
17
20
 
18
21
  var anObject$2 = anObject$3;
19
22
 
@@ -811,7 +814,8 @@ async function detectOverflow(middlewareArguments, options) {
811
814
  const clippingClientRect = rectToClientRect(await platform.getClippingRect({
812
815
  element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
813
816
  boundary,
814
- rootBoundary
817
+ rootBoundary,
818
+ strategy
815
819
  }));
816
820
  const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
817
821
  rect: elementContext === 'floating' ? { ...rects.floating,
@@ -875,6 +879,7 @@ const arrow = options => ({
875
879
  y
876
880
  };
877
881
  const axis = getMainAxisFromPlacement(placement);
882
+ const alignment = getAlignment(placement);
878
883
  const length = getLengthFromAxis(axis);
879
884
  const arrowDimensions = await platform.getDimensions(element);
880
885
  const minProp = axis === 'y' ? 'top' : 'left';
@@ -882,15 +887,25 @@ const arrow = options => ({
882
887
  const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
883
888
  const startDiff = coords[axis] - rects.reference[axis];
884
889
  const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
885
- const clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
890
+ let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
891
+
892
+ if (clientSize === 0) {
893
+ clientSize = rects.floating[length];
894
+ }
895
+
886
896
  const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
887
- // point is outside of the floating element's bounds
897
+ // point is outside the floating element's bounds
888
898
 
889
899
  const min = paddingObject[minProp];
890
900
  const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
891
901
  const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
892
- const offset = within(min, center, max);
902
+ const offset = within(min, center, max); // Make sure that arrow points at the reference
903
+
904
+ const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
905
+ const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
906
+ const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
893
907
  return {
908
+ [axis]: coords[axis] - alignmentOffset,
894
909
  data: {
895
910
  [axis]: offset,
896
911
  centerOffset: center - offset
@@ -1027,9 +1042,9 @@ const flip = function (options) {
1027
1042
  switch (fallbackStrategy) {
1028
1043
  case 'bestFit':
1029
1044
  {
1030
- var _overflowsData$slice$;
1045
+ var _overflowsData$map$so;
1031
1046
 
1032
- const placement = (_overflowsData$slice$ = overflowsData.slice().sort((a, b) => a.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0) - b.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0))[0]) == null ? void 0 : _overflowsData$slice$.placement;
1047
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
1033
1048
 
1034
1049
  if (placement) {
1035
1050
  resetPlacement = placement;
@@ -1128,26 +1143,25 @@ const hide = function (_temp) {
1128
1143
  };
1129
1144
  };
1130
1145
 
1131
- function convertValueToCoords(placement, rects, value, rtl) {
1132
- if (rtl === void 0) {
1133
- rtl = false;
1134
- }
1135
-
1146
+ async function convertValueToCoords(middlewareArguments, value) {
1147
+ const {
1148
+ placement,
1149
+ platform,
1150
+ elements
1151
+ } = middlewareArguments;
1152
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1136
1153
  const side = getSide(placement);
1137
1154
  const alignment = getAlignment(placement);
1138
1155
  const isVertical = getMainAxisFromPlacement(placement) === 'x';
1139
1156
  const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1140
1157
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
1141
- const rawValue = typeof value === 'function' ? value({ ...rects,
1142
- placement
1143
- }) : value;
1144
- const isNumber = typeof rawValue === 'number'; // eslint-disable-next-line prefer-const
1158
+ const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
1145
1159
 
1146
1160
  let {
1147
1161
  mainAxis,
1148
1162
  crossAxis,
1149
1163
  alignmentAxis
1150
- } = isNumber ? {
1164
+ } = typeof rawValue === 'number' ? {
1151
1165
  mainAxis: rawValue,
1152
1166
  crossAxis: 0,
1153
1167
  alignmentAxis: null
@@ -1187,13 +1201,9 @@ const offset = function (value) {
1187
1201
  async fn(middlewareArguments) {
1188
1202
  const {
1189
1203
  x,
1190
- y,
1191
- placement,
1192
- rects,
1193
- platform,
1194
- elements
1204
+ y
1195
1205
  } = middlewareArguments;
1196
- const diffCoords = convertValueToCoords(placement, rects, value, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1206
+ const diffCoords = await convertValueToCoords(middlewareArguments, value);
1197
1207
  return {
1198
1208
  x: x + diffCoords.x,
1199
1209
  y: y + diffCoords.y,
@@ -1325,7 +1335,7 @@ const inline = function (options) {
1325
1335
  };
1326
1336
 
1327
1337
  function isWindow(value) {
1328
- return (value == null ? void 0 : value.toString()) === '[object Window]';
1338
+ return value && value.document && value.location && value.alert && value.setInterval;
1329
1339
  }
1330
1340
  function getWindow(node) {
1331
1341
  if (node == null) {
@@ -1348,6 +1358,16 @@ function getNodeName(node) {
1348
1358
  return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
1349
1359
  }
1350
1360
 
1361
+ function getUAString() {
1362
+ const uaData = navigator.userAgentData;
1363
+
1364
+ if (uaData != null && uaData.brands) {
1365
+ return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
1366
+ }
1367
+
1368
+ return navigator.userAgent;
1369
+ }
1370
+
1351
1371
  function isHTMLElement(value) {
1352
1372
  return value instanceof getWindow(value).HTMLElement;
1353
1373
  }
@@ -1358,6 +1378,11 @@ function isNode(value) {
1358
1378
  return value instanceof getWindow(value).Node;
1359
1379
  }
1360
1380
  function isShadowRoot(node) {
1381
+ // Browsers without `ShadowRoot` support
1382
+ if (typeof ShadowRoot === 'undefined') {
1383
+ return false;
1384
+ }
1385
+
1361
1386
  const OwnElement = getWindow(node).ShadowRoot;
1362
1387
  return node instanceof OwnElement || node instanceof ShadowRoot;
1363
1388
  }
@@ -1375,23 +1400,38 @@ function isTableElement(element) {
1375
1400
  }
1376
1401
  function isContainingBlock(element) {
1377
1402
  // TODO: Try and use feature detection here instead
1378
- const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
1403
+ const isFirefox = /firefox/i.test(getUAString());
1379
1404
  const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
1380
1405
  // create a containing block.
1381
1406
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1382
1407
 
1383
- return css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
1408
+ return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
1409
+ css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
1410
+ }
1411
+ function isLayoutViewport() {
1412
+ // Not Safari
1413
+ return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
1414
+ // • Always-visible scrollbar or not
1415
+ // • Width of <html>, etc.
1416
+ // const vV = win.visualViewport;
1417
+ // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
1384
1418
  }
1385
1419
 
1386
1420
  const min = Math.min;
1387
1421
  const max = Math.max;
1388
1422
  const round = Math.round;
1389
1423
 
1390
- function getBoundingClientRect(element, includeScale) {
1424
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
1425
+ var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
1426
+
1391
1427
  if (includeScale === void 0) {
1392
1428
  includeScale = false;
1393
1429
  }
1394
1430
 
1431
+ if (isFixedStrategy === void 0) {
1432
+ isFixedStrategy = false;
1433
+ }
1434
+
1395
1435
  const clientRect = element.getBoundingClientRect();
1396
1436
  let scaleX = 1;
1397
1437
  let scaleY = 1;
@@ -1401,15 +1441,21 @@ function getBoundingClientRect(element, includeScale) {
1401
1441
  scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
1402
1442
  }
1403
1443
 
1444
+ const win = isElement(element) ? getWindow(element) : window;
1445
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
1446
+ const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
1447
+ const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
1448
+ const width = clientRect.width / scaleX;
1449
+ const height = clientRect.height / scaleY;
1404
1450
  return {
1405
- width: clientRect.width / scaleX,
1406
- height: clientRect.height / scaleY,
1407
- top: clientRect.top / scaleY,
1408
- right: clientRect.right / scaleX,
1409
- bottom: clientRect.bottom / scaleY,
1410
- left: clientRect.left / scaleX,
1411
- x: clientRect.left / scaleX,
1412
- y: clientRect.top / scaleY
1451
+ width,
1452
+ height,
1453
+ top: y,
1454
+ right: x + width,
1455
+ bottom: y + height,
1456
+ left: x,
1457
+ x,
1458
+ y
1413
1459
  };
1414
1460
  }
1415
1461
 
@@ -1418,16 +1464,16 @@ function getDocumentElement(node) {
1418
1464
  }
1419
1465
 
1420
1466
  function getNodeScroll(element) {
1421
- if (isWindow(element)) {
1467
+ if (isElement(element)) {
1422
1468
  return {
1423
- scrollLeft: element.pageXOffset,
1424
- scrollTop: element.pageYOffset
1469
+ scrollLeft: element.scrollLeft,
1470
+ scrollTop: element.scrollTop
1425
1471
  };
1426
1472
  }
1427
1473
 
1428
1474
  return {
1429
- scrollLeft: element.scrollLeft,
1430
- scrollTop: element.scrollTop
1475
+ scrollLeft: element.pageXOffset,
1476
+ scrollTop: element.pageYOffset
1431
1477
  };
1432
1478
  }
1433
1479
 
@@ -1445,7 +1491,8 @@ function isScaled(element) {
1445
1491
  function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1446
1492
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
1447
1493
  const documentElement = getDocumentElement(offsetParent);
1448
- const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent));
1494
+ const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
1495
+ isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
1449
1496
  let scroll = {
1450
1497
  scrollLeft: 0,
1451
1498
  scrollTop: 0
@@ -1594,7 +1641,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1594
1641
  };
1595
1642
  }
1596
1643
 
1597
- function getViewportRect(element) {
1644
+ function getViewportRect(element, strategy) {
1598
1645
  const win = getWindow(element);
1599
1646
  const html = getDocumentElement(element);
1600
1647
  const visualViewport = win.visualViewport;
@@ -1605,12 +1652,10 @@ function getViewportRect(element) {
1605
1652
 
1606
1653
  if (visualViewport) {
1607
1654
  width = visualViewport.width;
1608
- height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
1609
- // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
1610
- // errors due to floating point numbers, so we need to check precision.
1611
- // Safari returns a number <= 0, usually < -1 when pinch-zoomed
1655
+ height = visualViewport.height;
1656
+ const layoutViewport = isLayoutViewport();
1612
1657
 
1613
- if (Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < 0.01) {
1658
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
1614
1659
  x = visualViewport.offsetLeft;
1615
1660
  y = visualViewport.offsetTop;
1616
1661
  }
@@ -1677,13 +1722,13 @@ function getOverflowAncestors(node, list) {
1677
1722
  const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
1678
1723
  const updatedList = list.concat(target);
1679
1724
  return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
1680
- updatedList.concat(getOverflowAncestors(getParentNode(target)));
1725
+ updatedList.concat(getOverflowAncestors(target));
1681
1726
  }
1682
1727
 
1683
1728
  function contains(parent, child) {
1684
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
1729
+ const rootNode = child == null ? void 0 : child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
1685
1730
 
1686
- if (parent.contains(child)) {
1731
+ if (parent != null && parent.contains(child)) {
1687
1732
  return true;
1688
1733
  } // then fallback to custom implementation with Shadow DOM support
1689
1734
  else if (rootNode && isShadowRoot(rootNode)) {
@@ -1703,8 +1748,8 @@ function contains(parent, child) {
1703
1748
  return false;
1704
1749
  }
1705
1750
 
1706
- function getInnerBoundingClientRect(element) {
1707
- const clientRect = getBoundingClientRect(element);
1751
+ function getInnerBoundingClientRect(element, strategy) {
1752
+ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
1708
1753
  const top = clientRect.top + element.clientTop;
1709
1754
  const left = clientRect.left + element.clientLeft;
1710
1755
  return {
@@ -1719,13 +1764,13 @@ function getInnerBoundingClientRect(element) {
1719
1764
  };
1720
1765
  }
1721
1766
 
1722
- function getClientRectFromClippingAncestor(element, clippingParent) {
1767
+ function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
1723
1768
  if (clippingParent === 'viewport') {
1724
- return rectToClientRect(getViewportRect(element));
1769
+ return rectToClientRect(getViewportRect(element, strategy));
1725
1770
  }
1726
1771
 
1727
1772
  if (isElement(clippingParent)) {
1728
- return getInnerBoundingClientRect(clippingParent);
1773
+ return getInnerBoundingClientRect(clippingParent, strategy);
1729
1774
  }
1730
1775
 
1731
1776
  return rectToClientRect(getDocumentRect(getDocumentElement(element)));
@@ -1753,19 +1798,20 @@ function getClippingRect(_ref) {
1753
1798
  let {
1754
1799
  element,
1755
1800
  boundary,
1756
- rootBoundary
1801
+ rootBoundary,
1802
+ strategy
1757
1803
  } = _ref;
1758
1804
  const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
1759
1805
  const clippingAncestors = [...mainClippingAncestors, rootBoundary];
1760
1806
  const firstClippingAncestor = clippingAncestors[0];
1761
1807
  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1762
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor);
1808
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1763
1809
  accRect.top = max(rect.top, accRect.top);
1764
1810
  accRect.right = min(rect.right, accRect.right);
1765
1811
  accRect.bottom = min(rect.bottom, accRect.bottom);
1766
1812
  accRect.left = max(rect.left, accRect.left);
1767
1813
  return accRect;
1768
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor));
1814
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1769
1815
  return {
1770
1816
  width: clippingRect.right - clippingRect.left,
1771
1817
  height: clippingRect.bottom - clippingRect.top,
@@ -1811,13 +1857,11 @@ function autoUpdate(reference, floating, update, options) {
1811
1857
  const {
1812
1858
  ancestorScroll: _ancestorScroll = true,
1813
1859
  ancestorResize: _ancestorResize = true,
1814
- elementResize: _elementResize = true,
1860
+ elementResize = true,
1815
1861
  animationFrame = false
1816
1862
  } = options;
1817
- let cleanedUp = false;
1818
1863
  const ancestorScroll = _ancestorScroll && !animationFrame;
1819
1864
  const ancestorResize = _ancestorResize && !animationFrame;
1820
- const elementResize = _elementResize && !animationFrame;
1821
1865
  const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
1822
1866
  ancestors.forEach(ancestor => {
1823
1867
  ancestorScroll && ancestor.addEventListener('scroll', update, {
@@ -1829,7 +1873,7 @@ function autoUpdate(reference, floating, update, options) {
1829
1873
 
1830
1874
  if (elementResize) {
1831
1875
  observer = new ResizeObserver(update);
1832
- isElement(reference) && observer.observe(reference);
1876
+ isElement(reference) && !animationFrame && observer.observe(reference);
1833
1877
  observer.observe(floating);
1834
1878
  }
1835
1879
 
@@ -1841,10 +1885,6 @@ function autoUpdate(reference, floating, update, options) {
1841
1885
  }
1842
1886
 
1843
1887
  function frameLoop() {
1844
- if (cleanedUp) {
1845
- return;
1846
- }
1847
-
1848
1888
  const nextRefRect = getBoundingClientRect(reference);
1849
1889
 
1850
1890
  if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
@@ -1855,10 +1895,13 @@ function autoUpdate(reference, floating, update, options) {
1855
1895
  frameId = requestAnimationFrame(frameLoop);
1856
1896
  }
1857
1897
 
1898
+ if (!elementResize) {
1899
+ update();
1900
+ }
1901
+
1858
1902
  return () => {
1859
1903
  var _observer;
1860
1904
 
1861
- cleanedUp = true;
1862
1905
  ancestors.forEach(ancestor => {
1863
1906
  ancestorScroll && ancestor.removeEventListener('scroll', update);
1864
1907
  ancestorResize && ancestor.removeEventListener('resize', update);
@@ -2026,7 +2069,7 @@ __decorate([attr({
2026
2069
 
2027
2070
  __decorate([attr, __metadata("design:type", String)], Popup.prototype, "anchor", void 0);
2028
2071
 
2029
- var css_248z = ".control {\n width: min-content;\n background-color: var(--vvd-color-surface-4dp);\n border-radius: inherit;\n contain: layout;\n}\n.control:not(.open) {\n display: none;\n}\n\n.popup-wrapper {\n position: fixed;\n border-radius: 6px;\n}\n\n.popup-content {\n display: grid;\n color: var(--vvd-color-on-canvas);\n}\n.dismissible .popup-content {\n align-content: start;\n grid-template-columns: 1fr auto;\n}\n\n.arrow {\n position: absolute;\n z-index: -1;\n width: 8px;\n height: 8px;\n background-color: var(--vvd-color-surface-4dp);\n transform: rotate(45deg);\n}\n\n.dismissible {\n align-self: flex-start;\n margin-block-start: 0.25rem;\n margin-inline-end: 0.25rem;\n}";
2072
+ var css_248z = ".control {\n background-color: var(--vvd-color-surface-4dp);\n border-radius: inherit;\n contain: layout;\n inline-size: -moz-fit-content;\n inline-size: fit-content;\n}\n.control:not(.open) {\n display: none;\n}\n\n.popup-wrapper {\n position: fixed;\n border-radius: 6px;\n}\n\n.popup-content {\n display: grid;\n color: var(--vvd-color-on-canvas);\n}\n.dismissible .popup-content {\n align-content: start;\n grid-template-columns: 1fr auto;\n}\n\n.arrow {\n position: absolute;\n z-index: -1;\n width: 8px;\n height: 8px;\n background-color: var(--vvd-color-surface-4dp);\n transform: rotate(45deg);\n}\n\n.dismissible-button {\n align-self: flex-start;\n margin-block-start: 0.25rem;\n margin-inline-end: 0.25rem;\n}";
2030
2073
  styleInject(css_248z);
2031
2074
 
2032
2075
  let _ = t => t,
@@ -2054,13 +2097,13 @@ const popupTemplate = () => html(_t || (_t = _`
2054
2097
  </div>
2055
2098
  </div>
2056
2099
  </vwc-elevation>`), ref('popupEl'), getClasses, x => x.open ? 'false' : 'true', x => x.alternate ? 'vvd-theme-alternate' : '', when(x => x.dismissible, html(_t2 || (_t2 = _`<vwc-button density="condensed" @click="${0}"
2057
- class="dismissible" icon="close-small-solid" shape="pill"></vwc-button>`), x => x.open = false)), when(x => x.arrow, html(_t3 || (_t3 = _`<div class="arrow" ${0}></div>`), ref('arrowEl'))));
2100
+ class="dismissible-button" icon="close-small-solid" shape="pill"></vwc-button>`), x => x.open = false)), when(x => x.arrow, html(_t3 || (_t3 = _`<div class="arrow" ${0}></div>`), ref('arrowEl'))));
2058
2101
 
2059
- const VIVIDPopup = Popup.compose({
2102
+ const vividPopup = Popup.compose({
2060
2103
  baseName: 'popup',
2061
2104
  template: popupTemplate,
2062
2105
  styles: css_248z
2063
2106
  });
2064
- designSystem.register(VIVIDPopup());
2107
+ designSystem.register(vividPopup());
2065
2108
 
2066
- export { VIVIDPopup };
2109
+ export { vividPopup };
@@ -4,19 +4,24 @@ import { B as BaseProgress } from '../shared/base-progress.js';
4
4
  import { w as when } from '../shared/when.js';
5
5
  import { c as classNames } from '../shared/class-names.js';
6
6
 
7
- var css_248z = ".base {\n width: 36px;\n height: 36px;\n align-items: center;\n outline: none;\n}\n.base.connotation-cta {\n --connotation: var(--vvd-color-cta);\n --on-connotation: var(--vvd-color-on-cta);\n}\n.base.connotation-alert {\n --connotation: var(--vvd-color-alert);\n --on-connotation: var(--vvd-color-on-alert);\n}\n.base.connotation-success {\n --connotation: var(--vvd-color-success);\n --on-connotation: var(--vvd-color-on-success);\n}\n.base:not(.connotation-cta, .connotation-alert, .connotation-success) {\n --connotation: var(--vvd-color-primary);\n --on-connotation: var(--vvd-color-on-primary);\n}\n\n.base.base-large {\n width: 48px;\n height: 48px;\n}\n\n.base.base-small {\n width: 24px;\n height: 24px;\n}\n\n.progress {\n width: 100%;\n height: 100%;\n}\n\n.background {\n fill: none;\n stroke: transparent;\n stroke-width: 2px;\n}\n\n.determinate {\n fill: none;\n stroke: var(--connotation);\n stroke-linecap: round;\n stroke-width: 2px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.indeterminate-indicator-1 {\n animation: spin-infinite 2s linear infinite;\n fill: none;\n stroke: var(--connotation);\n stroke-linecap: round;\n stroke-width: 2px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.base.paused .indeterminate-indicator-1 {\n animation-play-state: paused;\n stroke: var(--vvd-color-neutral);\n}\n\n.base.paused .determinate {\n stroke: var(--vvd-color-neutral);\n}\n\n@keyframes spin-infinite {\n 0% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(0deg);\n }\n 50% {\n stroke-dasharray: 21.99px 21.99px;\n transform: rotate(450deg);\n }\n 100% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(1080deg);\n }\n}";
7
+ var css_248z = ".base {\n align-items: center;\n block-size: var(--_density);\n inline-size: var(--_density);\n outline: none;\n}\n.base.connotation-cta {\n --connotation: var(--vvd-color-cta);\n --on-connotation: var(--vvd-color-on-cta);\n}\n.base.connotation-alert {\n --connotation: var(--vvd-color-alert);\n --on-connotation: var(--vvd-color-on-alert);\n}\n.base.connotation-success {\n --connotation: var(--vvd-color-success);\n --on-connotation: var(--vvd-color-on-success);\n}\n.base:not(.connotation-cta, .connotation-alert, .connotation-success) {\n --connotation: var(--vvd-color-primary);\n --on-connotation: var(--vvd-color-on-primary);\n}\n.base.density-4 {\n --_density: calc(4 * 4px);\n}\n.base.density-5 {\n --_density: calc(5 * 4px);\n}\n.base.density-6 {\n --_density: calc(6 * 4px);\n}\n.base.density-7 {\n --_density: calc(7 * 4px);\n}\n.base.density-8 {\n --_density: calc(8 * 4px);\n}\n.base.density-10 {\n --_density: calc(10 * 4px);\n}\n.base.density-11 {\n --_density: calc(11 * 4px);\n}\n.base.density-12 {\n --_density: calc(12 * 4px);\n}\n.base:not(.density-4, .density-5, .density-6, .density-7, .density-8, .density-10, .density-11, .density-12) {\n --_density: calc(9 * 4px);\n}\n\n.progress {\n width: 100%;\n height: 100%;\n}\n\n.background {\n fill: none;\n stroke: transparent;\n stroke-width: 2px;\n}\n\n.determinate {\n fill: none;\n stroke: var(--connotation);\n stroke-linecap: round;\n stroke-width: 2px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.indeterminate-indicator-1 {\n animation: spin-infinite 2s linear infinite;\n fill: none;\n stroke: var(--connotation);\n stroke-linecap: round;\n stroke-width: 2px;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n transition: all 0.2s ease-in-out;\n}\n\n.base.paused .indeterminate-indicator-1 {\n animation-play-state: paused;\n stroke: var(--vvd-color-neutral);\n}\n\n.base.paused .determinate {\n stroke: var(--vvd-color-neutral);\n}\n\n@keyframes spin-infinite {\n 0% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(0deg);\n }\n 50% {\n stroke-dasharray: 21.99px 21.99px;\n transform: rotate(450deg);\n }\n 100% {\n stroke-dasharray: 0.01px 43.97px;\n transform: rotate(1080deg);\n }\n}";
8
8
  styleInject(css_248z);
9
9
 
10
10
  class ProgressRing extends BaseProgress {}
11
11
 
12
- __decorate([attr(), __metadata("design:type", String)], ProgressRing.prototype, "connotation", void 0);
12
+ __decorate([attr, __metadata("design:type", String)], ProgressRing.prototype, "connotation", void 0);
13
+
14
+ __decorate([attr, __metadata("design:type", Number)], ProgressRing.prototype, "density", void 0);
13
15
 
14
16
  let _2 = t => t,
15
17
  _t,
16
18
  _t2,
17
19
  _t3;
18
20
 
19
- const getClasses = _ => classNames('base', [`connotation-${_.connotation}`, !!_.connotation]);
21
+ const getClasses = ({
22
+ connotation,
23
+ density
24
+ }) => classNames('base', [`connotation-${connotation}`, !!connotation], [`density-${(density ? Number(density) : 0) + 9}`, !!density]);
20
25
 
21
26
  const progressSegments = 44;
22
27
  const ProgressRingTemplate = _ => html(_t || (_t = _2`
@@ -0,0 +1,188 @@
1
+ import { F as FoundationElement, _ as __decorate, a as attr, o as observable } from './index.js';
2
+ import { a as applyMixins } from './apply-mixins.js';
3
+ import { F as FormAssociated } from './focus2.js';
4
+ import { A as ARIAGlobalStatesAndProperties, S as StartEnd } from './aria-global.js';
5
+
6
+ class _Button extends FoundationElement {
7
+ }
8
+ /**
9
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(Button:class)} component.
10
+ *
11
+ * @internal
12
+ */
13
+ class FormAssociatedButton extends FormAssociated(_Button) {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.proxy = document.createElement("input");
17
+ }
18
+ }
19
+
20
+ /**
21
+ * A Button Custom HTML Element.
22
+ * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button | <button> element }.
23
+ *
24
+ * @public
25
+ */
26
+ class Button extends FormAssociatedButton {
27
+ constructor() {
28
+ super(...arguments);
29
+ /**
30
+ * Prevent events to propagate if disabled and has no slotted content wrapped in HTML elements
31
+ * @internal
32
+ */
33
+ this.handleClick = (e) => {
34
+ var _a;
35
+ if (this.disabled && ((_a = this.defaultSlottedContent) === null || _a === void 0 ? void 0 : _a.length) <= 1) {
36
+ e.stopPropagation();
37
+ }
38
+ };
39
+ /**
40
+ * Submits the parent form
41
+ */
42
+ this.handleSubmission = () => {
43
+ if (!this.form) {
44
+ return;
45
+ }
46
+ const attached = this.proxy.isConnected;
47
+ if (!attached) {
48
+ this.attachProxy();
49
+ }
50
+ // Browser support for requestSubmit is not comprehensive
51
+ // so click the proxy if it isn't supported
52
+ typeof this.form.requestSubmit === "function"
53
+ ? this.form.requestSubmit(this.proxy)
54
+ : this.proxy.click();
55
+ if (!attached) {
56
+ this.detachProxy();
57
+ }
58
+ };
59
+ /**
60
+ * Resets the parent form
61
+ */
62
+ this.handleFormReset = () => {
63
+ var _a;
64
+ (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset();
65
+ };
66
+ /**
67
+ * Overrides the focus call for where delegatesFocus is unsupported.
68
+ * This check works for Chrome, Edge Chromium, FireFox, and Safari
69
+ * Relevant PR on the Firefox browser: https://phabricator.services.mozilla.com/D123858
70
+ */
71
+ this.handleUnsupportedDelegatesFocus = () => {
72
+ var _a;
73
+ // Check to see if delegatesFocus is supported
74
+ if (window.ShadowRoot &&
75
+ !window.ShadowRoot.prototype.hasOwnProperty("delegatesFocus") && ((_a = this.$fastController.definition.shadowOptions) === null || _a === void 0 ? void 0 : _a.delegatesFocus)) {
76
+ this.focus = () => {
77
+ this.control.focus();
78
+ };
79
+ }
80
+ };
81
+ }
82
+ formactionChanged() {
83
+ if (this.proxy instanceof HTMLInputElement) {
84
+ this.proxy.formAction = this.formaction;
85
+ }
86
+ }
87
+ formenctypeChanged() {
88
+ if (this.proxy instanceof HTMLInputElement) {
89
+ this.proxy.formEnctype = this.formenctype;
90
+ }
91
+ }
92
+ formmethodChanged() {
93
+ if (this.proxy instanceof HTMLInputElement) {
94
+ this.proxy.formMethod = this.formmethod;
95
+ }
96
+ }
97
+ formnovalidateChanged() {
98
+ if (this.proxy instanceof HTMLInputElement) {
99
+ this.proxy.formNoValidate = this.formnovalidate;
100
+ }
101
+ }
102
+ formtargetChanged() {
103
+ if (this.proxy instanceof HTMLInputElement) {
104
+ this.proxy.formTarget = this.formtarget;
105
+ }
106
+ }
107
+ typeChanged(previous, next) {
108
+ if (this.proxy instanceof HTMLInputElement) {
109
+ this.proxy.type = this.type;
110
+ }
111
+ next === "submit" && this.addEventListener("click", this.handleSubmission);
112
+ previous === "submit" && this.removeEventListener("click", this.handleSubmission);
113
+ next === "reset" && this.addEventListener("click", this.handleFormReset);
114
+ previous === "reset" && this.removeEventListener("click", this.handleFormReset);
115
+ }
116
+ /**
117
+ * @internal
118
+ */
119
+ connectedCallback() {
120
+ var _a;
121
+ super.connectedCallback();
122
+ this.proxy.setAttribute("type", this.type);
123
+ this.handleUnsupportedDelegatesFocus();
124
+ const elements = Array.from((_a = this.control) === null || _a === void 0 ? void 0 : _a.children);
125
+ if (elements) {
126
+ elements.forEach((span) => {
127
+ span.addEventListener("click", this.handleClick);
128
+ });
129
+ }
130
+ }
131
+ /**
132
+ * @internal
133
+ */
134
+ disconnectedCallback() {
135
+ var _a;
136
+ super.disconnectedCallback();
137
+ const elements = Array.from((_a = this.control) === null || _a === void 0 ? void 0 : _a.children);
138
+ if (elements) {
139
+ elements.forEach((span) => {
140
+ span.removeEventListener("click", this.handleClick);
141
+ });
142
+ }
143
+ }
144
+ }
145
+ __decorate([
146
+ attr({ mode: "boolean" })
147
+ ], Button.prototype, "autofocus", void 0);
148
+ __decorate([
149
+ attr({ attribute: "form" })
150
+ ], Button.prototype, "formId", void 0);
151
+ __decorate([
152
+ attr
153
+ ], Button.prototype, "formaction", void 0);
154
+ __decorate([
155
+ attr
156
+ ], Button.prototype, "formenctype", void 0);
157
+ __decorate([
158
+ attr
159
+ ], Button.prototype, "formmethod", void 0);
160
+ __decorate([
161
+ attr({ mode: "boolean" })
162
+ ], Button.prototype, "formnovalidate", void 0);
163
+ __decorate([
164
+ attr
165
+ ], Button.prototype, "formtarget", void 0);
166
+ __decorate([
167
+ attr
168
+ ], Button.prototype, "type", void 0);
169
+ __decorate([
170
+ observable
171
+ ], Button.prototype, "defaultSlottedContent", void 0);
172
+ /**
173
+ * Includes ARIA states and properties relating to the ARIA button role
174
+ *
175
+ * @public
176
+ */
177
+ class DelegatesARIAButton {
178
+ }
179
+ __decorate([
180
+ attr({ attribute: "aria-expanded" })
181
+ ], DelegatesARIAButton.prototype, "ariaExpanded", void 0);
182
+ __decorate([
183
+ attr({ attribute: "aria-pressed" })
184
+ ], DelegatesARIAButton.prototype, "ariaPressed", void 0);
185
+ applyMixins(DelegatesARIAButton, ARIAGlobalStatesAndProperties);
186
+ applyMixins(Button, StartEnd, DelegatesARIAButton);
187
+
188
+ export { Button as B };