@vonage/vivid 3.0.0-next.13 → 3.0.0-next.16
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/badge/index.js +7 -7
- package/banner/index.js +6 -81
- package/button/index.js +13 -655
- package/card/index.js +3 -1
- package/elevation/index.js +4 -4
- package/fab/index.js +93 -0
- package/focus/index.js +20 -3
- package/icon/index.js +1 -1
- package/index.js +30 -19
- package/layout/index.js +3 -3
- package/lib/badge/badge.d.ts +3 -3
- package/lib/badge/index.d.ts +1 -1
- package/lib/button/button.d.ts +3 -3
- package/lib/button/index.d.ts +2 -19
- package/lib/components.d.ts +15 -10
- package/lib/elevation/index.d.ts +1 -1
- package/lib/enums.d.ts +2 -1
- package/lib/fab/fab.d.ts +10 -0
- package/lib/fab/fab.template.d.ts +4 -0
- package/lib/fab/index.d.ts +4 -0
- package/lib/focus/index.d.ts +1 -1
- package/lib/layout/index.d.ts +1 -1
- package/lib/note/index.d.ts +2 -0
- package/lib/note/note.d.ts +10 -0
- package/lib/note/note.template.d.ts +5 -0
- package/lib/popup/index.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +1 -0
- package/lib/side-drawer/index.d.ts +1 -1
- package/note/index.js +65 -0
- package/package.json +24 -4
- package/popup/index.js +114 -72
- package/progress/index.js +1 -1
- package/progress-ring/index.js +8 -3
- package/shared/enums.js +80 -0
- package/shared/focus.js +652 -0
- package/shared/focus2.js +5 -0
- package/shared/icon.js +1 -1
- package/shared/patterns/focus.d.ts +3 -0
- package/shared/patterns/index.d.ts +1 -0
- package/side-drawer/index.js +3 -3
- package/text/index.js +1 -1
- package/tooltip/index.js +3 -1
- package/shared/index2.js +0 -21
package/popup/index.js
CHANGED
|
@@ -11,8 +11,10 @@ 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 '../
|
|
14
|
+
import '../focus/index.js';
|
|
15
|
+
import '../shared/focus2.js';
|
|
15
16
|
import '../shared/affix.js';
|
|
17
|
+
import '../shared/focus.js';
|
|
16
18
|
import '../shared/apply-mixins.js';
|
|
17
19
|
|
|
18
20
|
var anObject$2 = anObject$3;
|
|
@@ -811,7 +813,8 @@ async function detectOverflow(middlewareArguments, options) {
|
|
|
811
813
|
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
812
814
|
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
815
|
boundary,
|
|
814
|
-
rootBoundary
|
|
816
|
+
rootBoundary,
|
|
817
|
+
strategy
|
|
815
818
|
}));
|
|
816
819
|
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
817
820
|
rect: elementContext === 'floating' ? { ...rects.floating,
|
|
@@ -875,6 +878,7 @@ const arrow = options => ({
|
|
|
875
878
|
y
|
|
876
879
|
};
|
|
877
880
|
const axis = getMainAxisFromPlacement(placement);
|
|
881
|
+
const alignment = getAlignment(placement);
|
|
878
882
|
const length = getLengthFromAxis(axis);
|
|
879
883
|
const arrowDimensions = await platform.getDimensions(element);
|
|
880
884
|
const minProp = axis === 'y' ? 'top' : 'left';
|
|
@@ -882,15 +886,25 @@ const arrow = options => ({
|
|
|
882
886
|
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
883
887
|
const startDiff = coords[axis] - rects.reference[axis];
|
|
884
888
|
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
885
|
-
|
|
889
|
+
let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
890
|
+
|
|
891
|
+
if (clientSize === 0) {
|
|
892
|
+
clientSize = rects.floating[length];
|
|
893
|
+
}
|
|
894
|
+
|
|
886
895
|
const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
|
|
887
|
-
// point is outside
|
|
896
|
+
// point is outside the floating element's bounds
|
|
888
897
|
|
|
889
898
|
const min = paddingObject[minProp];
|
|
890
899
|
const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
|
|
891
900
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
892
|
-
const offset = within(min, center, max);
|
|
901
|
+
const offset = within(min, center, max); // Make sure that arrow points at the reference
|
|
902
|
+
|
|
903
|
+
const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
|
|
904
|
+
const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
|
|
905
|
+
const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
|
|
893
906
|
return {
|
|
907
|
+
[axis]: coords[axis] - alignmentOffset,
|
|
894
908
|
data: {
|
|
895
909
|
[axis]: offset,
|
|
896
910
|
centerOffset: center - offset
|
|
@@ -1027,9 +1041,9 @@ const flip = function (options) {
|
|
|
1027
1041
|
switch (fallbackStrategy) {
|
|
1028
1042
|
case 'bestFit':
|
|
1029
1043
|
{
|
|
1030
|
-
var _overflowsData$
|
|
1044
|
+
var _overflowsData$map$so;
|
|
1031
1045
|
|
|
1032
|
-
const placement = (_overflowsData$
|
|
1046
|
+
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
1047
|
|
|
1034
1048
|
if (placement) {
|
|
1035
1049
|
resetPlacement = placement;
|
|
@@ -1128,26 +1142,25 @@ const hide = function (_temp) {
|
|
|
1128
1142
|
};
|
|
1129
1143
|
};
|
|
1130
1144
|
|
|
1131
|
-
function convertValueToCoords(
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1145
|
+
async function convertValueToCoords(middlewareArguments, value) {
|
|
1146
|
+
const {
|
|
1147
|
+
placement,
|
|
1148
|
+
platform,
|
|
1149
|
+
elements
|
|
1150
|
+
} = middlewareArguments;
|
|
1151
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
1136
1152
|
const side = getSide(placement);
|
|
1137
1153
|
const alignment = getAlignment(placement);
|
|
1138
1154
|
const isVertical = getMainAxisFromPlacement(placement) === 'x';
|
|
1139
1155
|
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
1140
1156
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
1141
|
-
const rawValue = typeof value === 'function' ? value(
|
|
1142
|
-
placement
|
|
1143
|
-
}) : value;
|
|
1144
|
-
const isNumber = typeof rawValue === 'number'; // eslint-disable-next-line prefer-const
|
|
1157
|
+
const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
|
|
1145
1158
|
|
|
1146
1159
|
let {
|
|
1147
1160
|
mainAxis,
|
|
1148
1161
|
crossAxis,
|
|
1149
1162
|
alignmentAxis
|
|
1150
|
-
} =
|
|
1163
|
+
} = typeof rawValue === 'number' ? {
|
|
1151
1164
|
mainAxis: rawValue,
|
|
1152
1165
|
crossAxis: 0,
|
|
1153
1166
|
alignmentAxis: null
|
|
@@ -1187,13 +1200,9 @@ const offset = function (value) {
|
|
|
1187
1200
|
async fn(middlewareArguments) {
|
|
1188
1201
|
const {
|
|
1189
1202
|
x,
|
|
1190
|
-
y
|
|
1191
|
-
placement,
|
|
1192
|
-
rects,
|
|
1193
|
-
platform,
|
|
1194
|
-
elements
|
|
1203
|
+
y
|
|
1195
1204
|
} = middlewareArguments;
|
|
1196
|
-
const diffCoords = convertValueToCoords(
|
|
1205
|
+
const diffCoords = await convertValueToCoords(middlewareArguments, value);
|
|
1197
1206
|
return {
|
|
1198
1207
|
x: x + diffCoords.x,
|
|
1199
1208
|
y: y + diffCoords.y,
|
|
@@ -1325,7 +1334,7 @@ const inline = function (options) {
|
|
|
1325
1334
|
};
|
|
1326
1335
|
|
|
1327
1336
|
function isWindow(value) {
|
|
1328
|
-
return
|
|
1337
|
+
return value && value.document && value.location && value.alert && value.setInterval;
|
|
1329
1338
|
}
|
|
1330
1339
|
function getWindow(node) {
|
|
1331
1340
|
if (node == null) {
|
|
@@ -1348,6 +1357,16 @@ function getNodeName(node) {
|
|
|
1348
1357
|
return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
|
|
1349
1358
|
}
|
|
1350
1359
|
|
|
1360
|
+
function getUAString() {
|
|
1361
|
+
const uaData = navigator.userAgentData;
|
|
1362
|
+
|
|
1363
|
+
if (uaData != null && uaData.brands) {
|
|
1364
|
+
return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
return navigator.userAgent;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1351
1370
|
function isHTMLElement(value) {
|
|
1352
1371
|
return value instanceof getWindow(value).HTMLElement;
|
|
1353
1372
|
}
|
|
@@ -1358,6 +1377,11 @@ function isNode(value) {
|
|
|
1358
1377
|
return value instanceof getWindow(value).Node;
|
|
1359
1378
|
}
|
|
1360
1379
|
function isShadowRoot(node) {
|
|
1380
|
+
// Browsers without `ShadowRoot` support
|
|
1381
|
+
if (typeof ShadowRoot === 'undefined') {
|
|
1382
|
+
return false;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1361
1385
|
const OwnElement = getWindow(node).ShadowRoot;
|
|
1362
1386
|
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
1363
1387
|
}
|
|
@@ -1375,23 +1399,38 @@ function isTableElement(element) {
|
|
|
1375
1399
|
}
|
|
1376
1400
|
function isContainingBlock(element) {
|
|
1377
1401
|
// TODO: Try and use feature detection here instead
|
|
1378
|
-
const isFirefox =
|
|
1402
|
+
const isFirefox = /firefox/i.test(getUAString());
|
|
1379
1403
|
const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
|
|
1380
1404
|
// create a containing block.
|
|
1381
1405
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1382
1406
|
|
|
1383
|
-
return css.transform !== 'none' || css.perspective !== 'none' ||
|
|
1407
|
+
return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
|
|
1408
|
+
css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
|
|
1409
|
+
}
|
|
1410
|
+
function isLayoutViewport() {
|
|
1411
|
+
// Not Safari
|
|
1412
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
|
|
1413
|
+
// • Always-visible scrollbar or not
|
|
1414
|
+
// • Width of <html>, etc.
|
|
1415
|
+
// const vV = win.visualViewport;
|
|
1416
|
+
// return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
|
|
1384
1417
|
}
|
|
1385
1418
|
|
|
1386
1419
|
const min = Math.min;
|
|
1387
1420
|
const max = Math.max;
|
|
1388
1421
|
const round = Math.round;
|
|
1389
1422
|
|
|
1390
|
-
function getBoundingClientRect(element, includeScale) {
|
|
1423
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
1424
|
+
var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
|
|
1425
|
+
|
|
1391
1426
|
if (includeScale === void 0) {
|
|
1392
1427
|
includeScale = false;
|
|
1393
1428
|
}
|
|
1394
1429
|
|
|
1430
|
+
if (isFixedStrategy === void 0) {
|
|
1431
|
+
isFixedStrategy = false;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1395
1434
|
const clientRect = element.getBoundingClientRect();
|
|
1396
1435
|
let scaleX = 1;
|
|
1397
1436
|
let scaleY = 1;
|
|
@@ -1401,15 +1440,21 @@ function getBoundingClientRect(element, includeScale) {
|
|
|
1401
1440
|
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
1402
1441
|
}
|
|
1403
1442
|
|
|
1443
|
+
const win = isElement(element) ? getWindow(element) : window;
|
|
1444
|
+
const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
1445
|
+
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;
|
|
1446
|
+
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;
|
|
1447
|
+
const width = clientRect.width / scaleX;
|
|
1448
|
+
const height = clientRect.height / scaleY;
|
|
1404
1449
|
return {
|
|
1405
|
-
width
|
|
1406
|
-
height
|
|
1407
|
-
top:
|
|
1408
|
-
right:
|
|
1409
|
-
bottom:
|
|
1410
|
-
left:
|
|
1411
|
-
x
|
|
1412
|
-
y
|
|
1450
|
+
width,
|
|
1451
|
+
height,
|
|
1452
|
+
top: y,
|
|
1453
|
+
right: x + width,
|
|
1454
|
+
bottom: y + height,
|
|
1455
|
+
left: x,
|
|
1456
|
+
x,
|
|
1457
|
+
y
|
|
1413
1458
|
};
|
|
1414
1459
|
}
|
|
1415
1460
|
|
|
@@ -1418,16 +1463,16 @@ function getDocumentElement(node) {
|
|
|
1418
1463
|
}
|
|
1419
1464
|
|
|
1420
1465
|
function getNodeScroll(element) {
|
|
1421
|
-
if (
|
|
1466
|
+
if (isElement(element)) {
|
|
1422
1467
|
return {
|
|
1423
|
-
scrollLeft: element.
|
|
1424
|
-
scrollTop: element.
|
|
1468
|
+
scrollLeft: element.scrollLeft,
|
|
1469
|
+
scrollTop: element.scrollTop
|
|
1425
1470
|
};
|
|
1426
1471
|
}
|
|
1427
1472
|
|
|
1428
1473
|
return {
|
|
1429
|
-
scrollLeft: element.
|
|
1430
|
-
scrollTop: element.
|
|
1474
|
+
scrollLeft: element.pageXOffset,
|
|
1475
|
+
scrollTop: element.pageYOffset
|
|
1431
1476
|
};
|
|
1432
1477
|
}
|
|
1433
1478
|
|
|
@@ -1445,7 +1490,8 @@ function isScaled(element) {
|
|
|
1445
1490
|
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1446
1491
|
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1447
1492
|
const documentElement = getDocumentElement(offsetParent);
|
|
1448
|
-
const rect = getBoundingClientRect(element,
|
|
1493
|
+
const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
|
|
1494
|
+
isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
|
|
1449
1495
|
let scroll = {
|
|
1450
1496
|
scrollLeft: 0,
|
|
1451
1497
|
scrollTop: 0
|
|
@@ -1594,7 +1640,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1594
1640
|
};
|
|
1595
1641
|
}
|
|
1596
1642
|
|
|
1597
|
-
function getViewportRect(element) {
|
|
1643
|
+
function getViewportRect(element, strategy) {
|
|
1598
1644
|
const win = getWindow(element);
|
|
1599
1645
|
const html = getDocumentElement(element);
|
|
1600
1646
|
const visualViewport = win.visualViewport;
|
|
@@ -1605,12 +1651,10 @@ function getViewportRect(element) {
|
|
|
1605
1651
|
|
|
1606
1652
|
if (visualViewport) {
|
|
1607
1653
|
width = visualViewport.width;
|
|
1608
|
-
height = visualViewport.height;
|
|
1609
|
-
|
|
1610
|
-
// errors due to floating point numbers, so we need to check precision.
|
|
1611
|
-
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
|
|
1654
|
+
height = visualViewport.height;
|
|
1655
|
+
const layoutViewport = isLayoutViewport();
|
|
1612
1656
|
|
|
1613
|
-
if (
|
|
1657
|
+
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
|
1614
1658
|
x = visualViewport.offsetLeft;
|
|
1615
1659
|
y = visualViewport.offsetTop;
|
|
1616
1660
|
}
|
|
@@ -1677,13 +1721,13 @@ function getOverflowAncestors(node, list) {
|
|
|
1677
1721
|
const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
|
|
1678
1722
|
const updatedList = list.concat(target);
|
|
1679
1723
|
return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
|
|
1680
|
-
updatedList.concat(getOverflowAncestors(
|
|
1724
|
+
updatedList.concat(getOverflowAncestors(target));
|
|
1681
1725
|
}
|
|
1682
1726
|
|
|
1683
1727
|
function contains(parent, child) {
|
|
1684
|
-
const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
|
|
1728
|
+
const rootNode = child == null ? void 0 : child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
|
|
1685
1729
|
|
|
1686
|
-
if (parent.contains(child)) {
|
|
1730
|
+
if (parent != null && parent.contains(child)) {
|
|
1687
1731
|
return true;
|
|
1688
1732
|
} // then fallback to custom implementation with Shadow DOM support
|
|
1689
1733
|
else if (rootNode && isShadowRoot(rootNode)) {
|
|
@@ -1703,8 +1747,8 @@ function contains(parent, child) {
|
|
|
1703
1747
|
return false;
|
|
1704
1748
|
}
|
|
1705
1749
|
|
|
1706
|
-
function getInnerBoundingClientRect(element) {
|
|
1707
|
-
const clientRect = getBoundingClientRect(element);
|
|
1750
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1751
|
+
const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
|
|
1708
1752
|
const top = clientRect.top + element.clientTop;
|
|
1709
1753
|
const left = clientRect.left + element.clientLeft;
|
|
1710
1754
|
return {
|
|
@@ -1719,13 +1763,13 @@ function getInnerBoundingClientRect(element) {
|
|
|
1719
1763
|
};
|
|
1720
1764
|
}
|
|
1721
1765
|
|
|
1722
|
-
function getClientRectFromClippingAncestor(element, clippingParent) {
|
|
1766
|
+
function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
|
|
1723
1767
|
if (clippingParent === 'viewport') {
|
|
1724
|
-
return rectToClientRect(getViewportRect(element));
|
|
1768
|
+
return rectToClientRect(getViewportRect(element, strategy));
|
|
1725
1769
|
}
|
|
1726
1770
|
|
|
1727
1771
|
if (isElement(clippingParent)) {
|
|
1728
|
-
return getInnerBoundingClientRect(clippingParent);
|
|
1772
|
+
return getInnerBoundingClientRect(clippingParent, strategy);
|
|
1729
1773
|
}
|
|
1730
1774
|
|
|
1731
1775
|
return rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
@@ -1753,19 +1797,20 @@ function getClippingRect(_ref) {
|
|
|
1753
1797
|
let {
|
|
1754
1798
|
element,
|
|
1755
1799
|
boundary,
|
|
1756
|
-
rootBoundary
|
|
1800
|
+
rootBoundary,
|
|
1801
|
+
strategy
|
|
1757
1802
|
} = _ref;
|
|
1758
1803
|
const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
|
|
1759
1804
|
const clippingAncestors = [...mainClippingAncestors, rootBoundary];
|
|
1760
1805
|
const firstClippingAncestor = clippingAncestors[0];
|
|
1761
1806
|
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
1762
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestor);
|
|
1807
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
1763
1808
|
accRect.top = max(rect.top, accRect.top);
|
|
1764
1809
|
accRect.right = min(rect.right, accRect.right);
|
|
1765
1810
|
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
1766
1811
|
accRect.left = max(rect.left, accRect.left);
|
|
1767
1812
|
return accRect;
|
|
1768
|
-
}, getClientRectFromClippingAncestor(element, firstClippingAncestor));
|
|
1813
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
1769
1814
|
return {
|
|
1770
1815
|
width: clippingRect.right - clippingRect.left,
|
|
1771
1816
|
height: clippingRect.bottom - clippingRect.top,
|
|
@@ -1811,13 +1856,11 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1811
1856
|
const {
|
|
1812
1857
|
ancestorScroll: _ancestorScroll = true,
|
|
1813
1858
|
ancestorResize: _ancestorResize = true,
|
|
1814
|
-
elementResize
|
|
1859
|
+
elementResize = true,
|
|
1815
1860
|
animationFrame = false
|
|
1816
1861
|
} = options;
|
|
1817
|
-
let cleanedUp = false;
|
|
1818
1862
|
const ancestorScroll = _ancestorScroll && !animationFrame;
|
|
1819
1863
|
const ancestorResize = _ancestorResize && !animationFrame;
|
|
1820
|
-
const elementResize = _elementResize && !animationFrame;
|
|
1821
1864
|
const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
|
|
1822
1865
|
ancestors.forEach(ancestor => {
|
|
1823
1866
|
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
@@ -1829,7 +1872,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1829
1872
|
|
|
1830
1873
|
if (elementResize) {
|
|
1831
1874
|
observer = new ResizeObserver(update);
|
|
1832
|
-
isElement(reference) && observer.observe(reference);
|
|
1875
|
+
isElement(reference) && !animationFrame && observer.observe(reference);
|
|
1833
1876
|
observer.observe(floating);
|
|
1834
1877
|
}
|
|
1835
1878
|
|
|
@@ -1841,10 +1884,6 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1841
1884
|
}
|
|
1842
1885
|
|
|
1843
1886
|
function frameLoop() {
|
|
1844
|
-
if (cleanedUp) {
|
|
1845
|
-
return;
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
1887
|
const nextRefRect = getBoundingClientRect(reference);
|
|
1849
1888
|
|
|
1850
1889
|
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
@@ -1855,10 +1894,13 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1855
1894
|
frameId = requestAnimationFrame(frameLoop);
|
|
1856
1895
|
}
|
|
1857
1896
|
|
|
1897
|
+
if (!elementResize) {
|
|
1898
|
+
update();
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1858
1901
|
return () => {
|
|
1859
1902
|
var _observer;
|
|
1860
1903
|
|
|
1861
|
-
cleanedUp = true;
|
|
1862
1904
|
ancestors.forEach(ancestor => {
|
|
1863
1905
|
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
1864
1906
|
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
@@ -2026,7 +2068,7 @@ __decorate([attr({
|
|
|
2026
2068
|
|
|
2027
2069
|
__decorate([attr, __metadata("design:type", String)], Popup.prototype, "anchor", void 0);
|
|
2028
2070
|
|
|
2029
|
-
var css_248z = ".control {\n
|
|
2071
|
+
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 {\n align-self: flex-start;\n margin-block-start: 0.25rem;\n margin-inline-end: 0.25rem;\n}";
|
|
2030
2072
|
styleInject(css_248z);
|
|
2031
2073
|
|
|
2032
2074
|
let _ = t => t,
|
|
@@ -2053,14 +2095,14 @@ const popupTemplate = () => html(_t || (_t = _`
|
|
|
2053
2095
|
${0}
|
|
2054
2096
|
</div>
|
|
2055
2097
|
</div>
|
|
2056
|
-
</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
|
|
2098
|
+
</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
2099
|
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'))));
|
|
2058
2100
|
|
|
2059
|
-
const
|
|
2101
|
+
const vividPopup = Popup.compose({
|
|
2060
2102
|
baseName: 'popup',
|
|
2061
2103
|
template: popupTemplate,
|
|
2062
2104
|
styles: css_248z
|
|
2063
2105
|
});
|
|
2064
|
-
designSystem.register(
|
|
2106
|
+
designSystem.register(vividPopup());
|
|
2065
2107
|
|
|
2066
|
-
export {
|
|
2108
|
+
export { vividPopup };
|
package/progress/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { B as BaseProgress } from '../shared/base-progress.js';
|
|
|
6
6
|
import { w as when } from '../shared/when.js';
|
|
7
7
|
import { c as classNames } from '../shared/class-names.js';
|
|
8
8
|
|
|
9
|
-
var css_248z = ".base {\n height: 6px;\n align-items: center;\n margin: 0;\n outline: none;\n}\n.base.connotation-cta {\n --connotation: var(--vvd-color-cta);\n --on-connotation: var(--vvd-color-on-cta);\n}\n
|
|
9
|
+
var css_248z = ".base {\n height: 6px;\n align-items: center;\n margin: 0;\n outline: none;\n}\n.base:not(.connotation-pacific).connotation-cta {\n --connotation: var(--vvd-color-cta);\n --on-connotation: var(--vvd-color-on-cta);\n}\n.base:not(.connotation-pacific).connotation-alert {\n --connotation: var(--vvd-color-alert);\n --on-connotation: var(--vvd-color-on-alert);\n}\n.base:not(.connotation-pacific).connotation-success {\n --connotation: var(--vvd-color-success);\n --on-connotation: var(--vvd-color-on-success);\n}\n.base:not(.connotation-pacific):not(.connotation-cta, .connotation-alert, .connotation-success) {\n --connotation: var(--vvd-color-primary);\n --on-connotation: var(--vvd-color-on-primary);\n}\n.base.connotation-pacific {\n --connotation: linear-gradient(to right, var(--vvd-color-info-30), var(--vvd-color-cta-70));\n}\n\n.indeterminate {\n display: flex;\n overflow: hidden;\n width: 100%;\n height: 100%;\n border-radius: 3px;\n}\n\n.progress {\n position: relative;\n display: flex;\n align-items: center;\n background-color: var(--vvd-color-neutral-20);\n block-size: 100%;\n inline-size: 100%;\n}\n.progress .indeterminate {\n background-color: var(--connotation);\n}\n\n.determinate {\n background-color: var(--connotation);\n block-size: 100%;\n border-radius: 3px;\n transition: all 0.2s ease-in-out;\n}\n.connotation-pacific .determinate {\n background-image: var(--connotation);\n}\n\n.indeterminate-indicator-1, .indeterminate-indicator-2 {\n position: absolute;\n animation: indeterminate-1 2s infinite;\n animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);\n background-color: var(--vvd-color-neutral-20);\n block-size: 100%;\n inline-size: 30%;\n opacity: 0;\n}\n\n.indeterminate-indicator-2 {\n animation: indeterminate-2 2s infinite;\n inline-size: 60%;\n}\n\n.connotation-pacific .indeterminate-indicator-1, .connotation-pacific .indeterminate-indicator-2 {\n background-image: var(--connotation);\n}\n\n.reverse .indeterminate-indicator-1, .reverse .indeterminate-indicator-2 {\n animation-direction: reverse;\n}\n.reverse .determinate {\n position: absolute;\n right: 0;\n}\n\n.base.shape-sharp .determinate, .base.shape-sharp .indeterminate {\n border-radius: 0;\n}\n\n.base.paused .indeterminate-indicator-1,\n.base.paused .indeterminate-indicator-2 {\n animation-play-state: paused;\n background-color: var(--connotation);\n}\n\n.base.paused .determinate {\n background-color: var(--vvd-color-neutral-40);\n}\n\n@keyframes indeterminate-1 {\n 0% {\n opacity: 1;\n transform: translateX(-100%);\n }\n 70% {\n opacity: 1;\n transform: translateX(300%);\n }\n 70.01% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n transform: translateX(300%);\n }\n}\n@keyframes indeterminate-2 {\n 0% {\n opacity: 0;\n transform: translateX(-150%);\n }\n 29.99% {\n opacity: 0;\n }\n 30% {\n opacity: 1;\n transform: translateX(-150%);\n }\n 100% {\n opacity: 1;\n transform: translateX(166.66%);\n }\n}";
|
|
10
10
|
styleInject(css_248z);
|
|
11
11
|
|
|
12
12
|
var classof = classofRaw;
|
package/progress-ring/index.js
CHANGED
|
@@ -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
|
|
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
|
|
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 =
|
|
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`
|
package/shared/enums.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var Connotation;
|
|
2
|
+
|
|
3
|
+
(function (Connotation) {
|
|
4
|
+
Connotation["Canvas"] = "canvas";
|
|
5
|
+
Connotation["Primary"] = "primary";
|
|
6
|
+
Connotation["CTA"] = "cta";
|
|
7
|
+
Connotation["Success"] = "success";
|
|
8
|
+
Connotation["Alert"] = "alert";
|
|
9
|
+
Connotation["Warning"] = "warning";
|
|
10
|
+
Connotation["Info"] = "info";
|
|
11
|
+
Connotation["Announcement"] = "announcement";
|
|
12
|
+
})(Connotation || (Connotation = {}));
|
|
13
|
+
|
|
14
|
+
var ConnotationDecorative;
|
|
15
|
+
|
|
16
|
+
(function (ConnotationDecorative) {
|
|
17
|
+
ConnotationDecorative["Pacific"] = "pacific";
|
|
18
|
+
})(ConnotationDecorative || (ConnotationDecorative = {}));
|
|
19
|
+
|
|
20
|
+
var Shape;
|
|
21
|
+
|
|
22
|
+
(function (Shape) {
|
|
23
|
+
Shape["Rounded"] = "rounded";
|
|
24
|
+
Shape["Pill"] = "pill";
|
|
25
|
+
Shape["Circled"] = "circled";
|
|
26
|
+
Shape["Sharp"] = "sharp";
|
|
27
|
+
})(Shape || (Shape = {}));
|
|
28
|
+
|
|
29
|
+
var Appearance;
|
|
30
|
+
|
|
31
|
+
(function (Appearance) {
|
|
32
|
+
Appearance["Text"] = "text";
|
|
33
|
+
Appearance["Filled"] = "filled";
|
|
34
|
+
Appearance["Outlined"] = "outlined";
|
|
35
|
+
Appearance["Duotone"] = "duotone";
|
|
36
|
+
Appearance["Subtle"] = "subtle";
|
|
37
|
+
Appearance["Ghost"] = "ghost";
|
|
38
|
+
})(Appearance || (Appearance = {}));
|
|
39
|
+
|
|
40
|
+
var Density;
|
|
41
|
+
|
|
42
|
+
(function (Density) {
|
|
43
|
+
Density["Condensed"] = "condensed";
|
|
44
|
+
Density["Normal"] = "normal";
|
|
45
|
+
Density["Extended"] = "extended";
|
|
46
|
+
})(Density || (Density = {}));
|
|
47
|
+
|
|
48
|
+
var Size;
|
|
49
|
+
|
|
50
|
+
(function (Size) {
|
|
51
|
+
Size["Small"] = "small";
|
|
52
|
+
Size["Medium"] = "medium";
|
|
53
|
+
Size["Large"] = "large";
|
|
54
|
+
})(Size || (Size = {}));
|
|
55
|
+
|
|
56
|
+
var Position;
|
|
57
|
+
|
|
58
|
+
(function (Position) {
|
|
59
|
+
Position["Top"] = "TOP";
|
|
60
|
+
Position["Bottom"] = "BOTTOM";
|
|
61
|
+
Position["Start"] = "START";
|
|
62
|
+
Position["Center"] = "CENTER";
|
|
63
|
+
Position["End"] = "END";
|
|
64
|
+
})(Position || (Position = {}));
|
|
65
|
+
|
|
66
|
+
var Role;
|
|
67
|
+
|
|
68
|
+
(function (Role) {
|
|
69
|
+
Role["Status"] = "status";
|
|
70
|
+
Role["Alert"] = "alert";
|
|
71
|
+
})(Role || (Role = {}));
|
|
72
|
+
|
|
73
|
+
var AriaLive;
|
|
74
|
+
|
|
75
|
+
(function (AriaLive) {
|
|
76
|
+
AriaLive["Polite"] = "polite";
|
|
77
|
+
AriaLive["Assertive"] = "assertive";
|
|
78
|
+
})(AriaLive || (AriaLive = {}));
|
|
79
|
+
|
|
80
|
+
export { Connotation as C };
|