@arc-ui/components 3.1.0 → 4.0.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.
- package/dist/index.es.js +126 -83
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +126 -83
- package/dist/index.js.map +1 -1
- package/dist/styles.bt.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.ee.css +1 -1
- package/dist/types/components/Base/Base.d.ts +1 -1
- package/dist/types/components/BrandLogo/BrandLogo.d.ts +5 -0
- package/dist/types/components/Card/Card.d.ts +2 -2
- package/dist/types/components/Icon/Icon.d.ts +0 -1
- package/dist/types/components/SiteHeader/SiteHeader.d.ts +5 -0
- package/dist/types/components/SiteHeader/components/ItemGroup/ItemGroup.d.ts +10 -0
- package/package.json +5 -4
package/dist/index.es.js
CHANGED
|
@@ -355,15 +355,17 @@ __spreadArray([], backgroundsShared, true);
|
|
|
355
355
|
* Use `BrandLogo` to display the brand logo.
|
|
356
356
|
*/
|
|
357
357
|
var BrandLogo = function (_a) {
|
|
358
|
-
var _b
|
|
358
|
+
var _b;
|
|
359
|
+
var _c = _a.color, color = _c === void 0 ? "auto" : _c, label = _a.label, _d = _a.size, size = _d === void 0 ? 34 : _d, subBrand = _a.subBrand, props = __rest(_a, ["color", "label", "size", "subBrand"]);
|
|
359
360
|
var surface = useContext(Context$2).surface;
|
|
360
|
-
return (React.createElement("div", __assign({ className: classNames({
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
361
|
+
return (React.createElement("div", __assign({ className: classNames((_b = {
|
|
362
|
+
"arc-BrandLogo": true,
|
|
363
|
+
"arc-BrandLogo--colorBrand": color === "brand",
|
|
364
|
+
"arc-BrandLogo--onDarkSurface": surface === "dark"
|
|
365
|
+
},
|
|
366
|
+
_b[suffixModifier("arc-BrandLogo--subBrand", subBrand || "")] = subBrand,
|
|
367
|
+
_b)), style: {
|
|
368
|
+
width: size !== 34 ? size : undefined
|
|
367
369
|
} }, filterDataAttrs(props)), label ? React.createElement("span", { className: "arc-BrandLogo-text" }, label) : null));
|
|
368
370
|
};
|
|
369
371
|
|
|
@@ -636,10 +638,10 @@ var Icon = function (_a) {
|
|
|
636
638
|
var surface = useContext(Context$2).surface;
|
|
637
639
|
return (React.createElement("span", __assign({ "aria-label": label, className: classNames((_b = {},
|
|
638
640
|
_b["arc-Icon"] = true,
|
|
639
|
-
_b[suffixModifier("arc-Icon--color", color
|
|
641
|
+
_b[suffixModifier("arc-Icon--color", color)] = color !== "auto",
|
|
640
642
|
_b["arc-Icon--".concat(icon).concat(isSelected && iconsSelected.includes("".concat(icon, "Fill")) ? "Fill" : "")] = icon,
|
|
641
643
|
_b["arc-Icon--inline"] = isInline,
|
|
642
|
-
_b["arc-Icon--
|
|
644
|
+
_b["arc-Icon--onDarkSurface"] = surface === "dark",
|
|
643
645
|
_b)), role: label ? "img" : undefined, style: {
|
|
644
646
|
height: size,
|
|
645
647
|
width: size
|
|
@@ -655,11 +657,10 @@ var Button = forwardRef(function (_a, ref) {
|
|
|
655
657
|
var surface = useContext(Context$2).surface;
|
|
656
658
|
var buttonClasses = classNames((_b = {
|
|
657
659
|
"arc-Button": true,
|
|
658
|
-
"arc-Button--displayBlock": isDisplayBlock
|
|
659
|
-
"arc-Button--fillFlat": fill === "flat",
|
|
660
|
-
"arc-Button--fillOutlined": fill === "outlined",
|
|
661
|
-
"arc-Button--fullWidth": isFullWidth
|
|
660
|
+
"arc-Button--displayBlock": isDisplayBlock
|
|
662
661
|
},
|
|
662
|
+
_b[suffixModifier("arc-Button--fill", fill)] = fill !== "solid",
|
|
663
|
+
_b["arc-Button--fullWidth"] = isFullWidth,
|
|
663
664
|
_b[suffixModifier("arc-Button--icon", iconPosition.replace("icon", ""))] = (icon || fill === "flat") &&
|
|
664
665
|
iconPosition &&
|
|
665
666
|
iconPosition !== "afterText",
|
|
@@ -716,7 +717,7 @@ var Heading = function (_a) {
|
|
|
716
717
|
return (React.createElement(Element, __assign({ className: classNames((_b = {
|
|
717
718
|
"arc-Heading": true
|
|
718
719
|
},
|
|
719
|
-
_b[suffixModifier("arc-Heading--align", align
|
|
720
|
+
_b[suffixModifier("arc-Heading--align", align)] = align && align !== "left",
|
|
720
721
|
_b["arc-Heading--size".concat(size && size.toUpperCase())] = size,
|
|
721
722
|
_b["arc-Heading--casingNone"] = casing === "none",
|
|
722
723
|
_b["arc-Heading--colorBrand"] = color === "brand",
|
|
@@ -846,25 +847,24 @@ var useNumericInput = function (props) {
|
|
|
846
847
|
return { inputMode: inputMode, pattern: pattern, type: type };
|
|
847
848
|
};
|
|
848
849
|
|
|
849
|
-
var defaultActionLabel = "Read more";
|
|
850
850
|
/**
|
|
851
851
|
* Use `Card` to contain content and actions about a single subject.
|
|
852
852
|
*/
|
|
853
853
|
var Card = function (_a) {
|
|
854
854
|
var _b;
|
|
855
|
-
var actionId = _a.actionId, _c = _a.actionLabel, actionLabel = _c === void 0 ?
|
|
855
|
+
var actionId = _a.actionId, _c = _a.actionLabel, actionLabel = _c === void 0 ? "Read more" : _c, children = _a.children, _d = _a.fill, fill = _d === void 0 ? "solid" : _d, href = _a.href, imageAlt = _a.imageAlt, imageSrc = _a.imageSrc, imageSrcSet = _a.imageSrcSet, imageHeight = _a.imageHeight, minHeight = _a.minHeight, target = _a.target, title = _a.title, _e = _a.titleSize, titleSize = _e === void 0 ? "s" : _e, props = __rest(_a, ["actionId", "actionLabel", "children", "fill", "href", "imageAlt", "imageSrc", "imageSrcSet", "imageHeight", "minHeight", "target", "title", "titleSize"]);
|
|
856
856
|
var surface = useContext(Context$2).surface;
|
|
857
857
|
var interactionMode = useInteractionMode().interactionMode;
|
|
858
858
|
var Wrapper = function (_a) {
|
|
859
859
|
var children = _a.children;
|
|
860
|
-
return fill === "outlined" ? (React.createElement("div", null, children)) : (React.createElement(Surface, { background: surface === "dark" ? "white" : "darker" }, children));
|
|
860
|
+
return fill === "outlined" || fill === "neutral" ? (React.createElement("div", null, children)) : (React.createElement(Surface, { background: surface === "dark" ? "white" : "darker" }, children));
|
|
861
861
|
};
|
|
862
862
|
var coverImage = imageSrc && (React.createElement(CardImage, { alt: imageAlt, src: imageSrc, srcSet: imageSrcSet, height: imageHeight }));
|
|
863
863
|
return (React.createElement("div", __assign({ className: classNames((_b = {
|
|
864
864
|
"arc-Card": true,
|
|
865
|
-
"arc-Card--onDarkSurface": surface === "dark"
|
|
866
|
-
"arc-Card--fillOutlined": fill === "outlined"
|
|
865
|
+
"arc-Card--onDarkSurface": surface === "dark"
|
|
867
866
|
},
|
|
867
|
+
_b[suffixModifier("arc-Card--fill", fill)] = fill !== "solid",
|
|
868
868
|
_b["arc-is-".concat(interactionMode, "InteractionMode")] = interactionMode,
|
|
869
869
|
_b)) }, filterDataAttrs(props)),
|
|
870
870
|
React.createElement(Wrapper, null,
|
|
@@ -872,12 +872,12 @@ var Card = function (_a) {
|
|
|
872
872
|
React.createElement("div", { className: "arc-Card-header" },
|
|
873
873
|
React.createElement("div", { className: "arc-Card-title" },
|
|
874
874
|
React.createElement(Heading, { size: titleSize },
|
|
875
|
-
React.createElement(CardLink, { actionId: actionId, href: href, stretch: true, target: target }, title))),
|
|
875
|
+
React.createElement(CardLink, { actionId: actionId, fill: fill, href: href, stretch: true, target: target }, title))),
|
|
876
876
|
coverImage),
|
|
877
877
|
React.createElement("div", { className: "arc-Card-children" },
|
|
878
878
|
React.createElement(Card.Block, null, children)),
|
|
879
879
|
href && (React.createElement(CardBlock, null,
|
|
880
|
-
React.createElement(CardLink, { href: href, actionId: actionId, isButton: true }, actionLabel
|
|
880
|
+
React.createElement(CardLink, { href: href, fill: fill, actionId: actionId, isButton: true }, actionLabel)))))));
|
|
881
881
|
};
|
|
882
882
|
/**
|
|
883
883
|
* Internal `Card.Block` component to section blocks of content within a Card.
|
|
@@ -911,12 +911,12 @@ Card.Image = CardImage;
|
|
|
911
911
|
* Internal `CardLink` component.
|
|
912
912
|
*/
|
|
913
913
|
var CardLink = function (_a) {
|
|
914
|
-
var actionId = _a.actionId, isButton = _a.isButton, children = _a.children, href = _a.href, stretch = _a.stretch, target = _a.target;
|
|
914
|
+
var actionId = _a.actionId, isButton = _a.isButton, children = _a.children, fill = _a.fill, href = _a.href, stretch = _a.stretch, target = _a.target;
|
|
915
915
|
var surface = useContext(Context$2).surface;
|
|
916
916
|
return (React.createElement("a", { "aria-describedby": actionId, className: classNames({
|
|
917
917
|
"arc-CardLink": true,
|
|
918
918
|
"arc-CardLink--button": isButton,
|
|
919
|
-
"arc-CardLink--onDarkSurface": surface === "dark",
|
|
919
|
+
"arc-CardLink--onDarkSurface": surface === "dark" && fill !== "neutral",
|
|
920
920
|
"arc-CardLink--stretch": stretch
|
|
921
921
|
}), href: href, rel: target === "_blank" ? "noopener noreferrer" : undefined, tabIndex: isButton ? -1 : undefined, target: target },
|
|
922
922
|
React.createElement("span", { className: "arc-CardLink-text" }, children),
|
|
@@ -1012,9 +1012,7 @@ var Col = function (_a) {
|
|
|
1012
1012
|
var align = _a.align, children = _a.children, _c = _a.isDebugVisible, isDebugVisible = _c === void 0 ? false : _c, offset = _a.offset, offsetS = _a.offsetS, offsetM = _a.offsetM, offsetL = _a.offsetL, offsetXL = _a.offsetXL, span = _a.span, spanS = _a.spanS, spanM = _a.spanM, spanL = _a.spanL, spanXL = _a.spanXL, props = __rest(_a, ["align", "children", "isDebugVisible", "offset", "offsetS", "offsetM", "offsetL", "offsetXL", "span", "spanS", "spanM", "spanL", "spanXL"]);
|
|
1013
1013
|
return (React.createElement("div", __assign({ className: classNames((_b = {},
|
|
1014
1014
|
_b["arc-Col"] = true,
|
|
1015
|
-
_b["arc-Col--
|
|
1016
|
-
_b["arc-Col--alignCenter"] = align === "center",
|
|
1017
|
-
_b["arc-Col--alignTop"] = align === "top",
|
|
1015
|
+
_b[suffixModifier("arc-Col--align", align || "")] = align,
|
|
1018
1016
|
_b["arc-Col--".concat(span)] = typeof span !== "undefined",
|
|
1019
1017
|
_b["arc-Col--S".concat(spanS)] = typeof spanS !== "undefined",
|
|
1020
1018
|
_b["arc-Col--M".concat(spanM)] = typeof spanM !== "undefined",
|
|
@@ -1046,7 +1044,7 @@ var Curve = function (_a) {
|
|
|
1046
1044
|
return (React.createElement("div", __assign({ className: classNames((_b = {
|
|
1047
1045
|
"arc-Curve": true
|
|
1048
1046
|
},
|
|
1049
|
-
_b[suffixModifier("arc-Curve--from", from
|
|
1047
|
+
_b[suffixModifier("arc-Curve--from", from)] = from && from !== "top",
|
|
1050
1048
|
_b["arc-Curve--size".concat(size && size.toUpperCase())] = size && size !== "m",
|
|
1051
1049
|
_b[suffixModifier("arc-Curve--bottomColor", bottomColor || "")] = bottomColor,
|
|
1052
1050
|
_b[suffixModifier("arc-Curve--topColor", topColor || "")] = topColor,
|
|
@@ -1344,10 +1342,8 @@ var SiteFooter = function (_a) {
|
|
|
1344
1342
|
children && (React.createElement("ul", { className: "arc-SiteFooter-secondaryItems" }, children)),
|
|
1345
1343
|
React.createElement("div", { className: "arc-SiteFooter-brand" },
|
|
1346
1344
|
React.createElement("div", { className: "arc-SiteFooter-copyright" },
|
|
1347
|
-
React.createElement("span", { className: "arc-SiteFooter-copyrightSymbol" }, "\u00A9"),
|
|
1348
|
-
|
|
1349
|
-
currentYear || new Date().getFullYear()),
|
|
1350
|
-
React.createElement(BrandLogo, { label: logoLabel, size: 32 }))))))));
|
|
1345
|
+
React.createElement("span", { className: "arc-SiteFooter-copyrightSymbol" }, "\u00A9"), " ".concat(currentYear || new Date().getFullYear())),
|
|
1346
|
+
React.createElement(BrandLogo, { label: logoLabel }))))))));
|
|
1351
1347
|
};
|
|
1352
1348
|
var SiteFooterItemGroup = function (_a) {
|
|
1353
1349
|
var children = _a.children, title = _a.title;
|
|
@@ -1375,16 +1371,20 @@ SiteFooterItemGroup.displayName = "SiteFooter.ItemGroup";
|
|
|
1375
1371
|
SiteFooter.ItemGroup = SiteFooterItemGroup;
|
|
1376
1372
|
|
|
1377
1373
|
var SiteFooter_rehydrator = (function (el, rehydrateChildren) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1378
|
-
var children, props;
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
switch (_b.label) {
|
|
1374
|
+
var children, titleElement, title, props;
|
|
1375
|
+
return __generator(this, function (_a) {
|
|
1376
|
+
switch (_a.label) {
|
|
1382
1377
|
case 0: return [4 /*yield*/, rehydrateChildren(el.querySelector(".arc-SiteFooter-mainItems"))];
|
|
1383
1378
|
case 1:
|
|
1384
|
-
children =
|
|
1379
|
+
children = _a.sent();
|
|
1380
|
+
titleElement = el.querySelector(".arc-SiteFooter-title");
|
|
1381
|
+
title = "";
|
|
1382
|
+
if (titleElement) {
|
|
1383
|
+
title = titleElement.textContent || /* istanbul ignore next */ "";
|
|
1384
|
+
}
|
|
1385
1385
|
props = {
|
|
1386
1386
|
children: children,
|
|
1387
|
-
title:
|
|
1387
|
+
title: title
|
|
1388
1388
|
};
|
|
1389
1389
|
return [2 /*return*/, React.createElement(SiteFooter.ItemGroup, __assign({}, props), children)];
|
|
1390
1390
|
}
|
|
@@ -1402,7 +1402,8 @@ var Item = function (_a) {
|
|
|
1402
1402
|
};
|
|
1403
1403
|
|
|
1404
1404
|
var ItemGroup = function (_a) {
|
|
1405
|
-
var children = _a.children, title = _a.title, props = __rest(_a, ["children", "title"]);
|
|
1405
|
+
var children = _a.children, href = _a.href, title = _a.title, viewAllTitle = _a.viewAllTitle, props = __rest(_a, ["children", "href", "title", "viewAllTitle"]);
|
|
1406
|
+
var _b = useState(false), hasClientSideJavaScript = _b[0], setHasClientSideJavaScript = _b[1];
|
|
1406
1407
|
var isMinWidthArcBreakpointL = useMediaQuery("(min-width: ".concat(ArcBreakpointL, "px)"));
|
|
1407
1408
|
useEffect(function () {
|
|
1408
1409
|
React.Children.map(children, function (item) {
|
|
@@ -1411,24 +1412,43 @@ var ItemGroup = function (_a) {
|
|
|
1411
1412
|
}
|
|
1412
1413
|
});
|
|
1413
1414
|
}, [children]);
|
|
1415
|
+
useEffect(function () {
|
|
1416
|
+
// useEffect does not run in ReactDomServer renders
|
|
1417
|
+
setHasClientSideJavaScript(true);
|
|
1418
|
+
}, [setHasClientSideJavaScript]);
|
|
1414
1419
|
return (React.createElement("li", { className: "arc-SiteHeaderItemGroup" },
|
|
1415
1420
|
React.createElement("details", __assign({ className: "arc-SiteHeaderItemGroup-details", open: isMinWidthArcBreakpointL }, filterDataAttrs(props)),
|
|
1416
|
-
React.createElement("summary", { className: "arc-SiteHeaderItemGroup-summary", tabIndex: isMinWidthArcBreakpointL ? -1 : 0 },
|
|
1417
|
-
|
|
1418
|
-
|
|
1421
|
+
React.createElement("summary", { className: "arc-SiteHeaderItemGroup-summary", tabIndex: isMinWidthArcBreakpointL ? -1 : 0 }, href ? (React.createElement("a", { className: "arc-SiteHeaderItemGroup-title", href: href, tabIndex: !hasClientSideJavaScript || isMinWidthArcBreakpointL ? 0 : -1 }, title)) : (React.createElement("div", { className: "arc-SiteHeaderItemGroup-title" }, title))),
|
|
1422
|
+
React.createElement("ul", { className: "arc-SiteHeaderItemGroup-items" },
|
|
1423
|
+
children,
|
|
1424
|
+
href ? (React.createElement("li", { className: "arc-SiteHeaderItem arc-SiteHeaderItem--viewAll" },
|
|
1425
|
+
React.createElement("a", { className: "arc-SiteHeaderItem-link", href: href }, viewAllTitle || "View all ".concat(title.toLowerCase())))) : null))));
|
|
1419
1426
|
};
|
|
1420
1427
|
|
|
1421
1428
|
var ItemGroupRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1422
|
-
var children, props;
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
switch (_b.label) {
|
|
1429
|
+
var children, titleElement, viewAllElement, title, href, viewAllTitle, props;
|
|
1430
|
+
return __generator(this, function (_a) {
|
|
1431
|
+
switch (_a.label) {
|
|
1426
1432
|
case 0: return [4 /*yield*/, hydrate(el.querySelector(".arc-SiteHeaderItemGroup-items"))];
|
|
1427
1433
|
case 1:
|
|
1428
|
-
children =
|
|
1434
|
+
children = _a.sent();
|
|
1435
|
+
titleElement = el.querySelector(".arc-SiteHeaderItemGroup-title");
|
|
1436
|
+
viewAllElement = el.querySelector(".arc-SiteHeaderItem--viewAll");
|
|
1437
|
+
title = "";
|
|
1438
|
+
href = "";
|
|
1439
|
+
viewAllTitle = "";
|
|
1440
|
+
if (titleElement) {
|
|
1441
|
+
title = titleElement.textContent || /* istanbul ignore next */ "";
|
|
1442
|
+
href = titleElement.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1443
|
+
}
|
|
1444
|
+
if (viewAllElement) {
|
|
1445
|
+
viewAllTitle = viewAllElement.textContent || /* istanbul ignore next */ "";
|
|
1446
|
+
}
|
|
1429
1447
|
props = {
|
|
1430
1448
|
children: children,
|
|
1431
|
-
|
|
1449
|
+
href: href,
|
|
1450
|
+
title: title,
|
|
1451
|
+
viewAllTitle: viewAllTitle
|
|
1432
1452
|
};
|
|
1433
1453
|
return [2 /*return*/, React.createElement(ItemGroup, __assign({}, props), children)];
|
|
1434
1454
|
}
|
|
@@ -1458,7 +1478,7 @@ var BackButton = function (_a) {
|
|
|
1458
1478
|
|
|
1459
1479
|
var Panel = function (_a) {
|
|
1460
1480
|
var _b;
|
|
1461
|
-
var children = _a.children, navItemRef = _a.navItemRef,
|
|
1481
|
+
var children = _a.children, navItemRef = _a.navItemRef, open = _a.open, promo = _a.promo, setOpen = _a.setOpen, subNavItemRef = _a.subNavItemRef, _c = _a.subNavLink, subNavLink = _c === void 0 ? "" : _c, title = _a.title, viewAll = _a.viewAll, withSubNav = _a.withSubNav, props = __rest(_a, ["children", "navItemRef", "open", "promo", "setOpen", "subNavItemRef", "subNavLink", "title", "viewAll", "withSubNav"]);
|
|
1462
1482
|
var transparent = useContext(Context).transparent;
|
|
1463
1483
|
useEffect(function () {
|
|
1464
1484
|
// Where appropriate, close the Panel when clicking outside of it,
|
|
@@ -1568,7 +1588,7 @@ var NavItem = function (_a) {
|
|
|
1568
1588
|
};
|
|
1569
1589
|
|
|
1570
1590
|
var NavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1571
|
-
var children, promo, link, viewAll, props;
|
|
1591
|
+
var children, promo, link, viewAll, href, title, props;
|
|
1572
1592
|
return __generator(this, function (_a) {
|
|
1573
1593
|
switch (_a.label) {
|
|
1574
1594
|
case 0:
|
|
@@ -1588,11 +1608,20 @@ var NavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void
|
|
|
1588
1608
|
case 4:
|
|
1589
1609
|
link = el.querySelector(".arc-SiteHeaderNavItem-link");
|
|
1590
1610
|
viewAll = el.querySelector(".arc-SiteHeaderPanel-viewAll");
|
|
1611
|
+
href = "";
|
|
1612
|
+
title = "";
|
|
1613
|
+
if (link) {
|
|
1614
|
+
title = link.textContent || /* istanbul ignore next */ "";
|
|
1615
|
+
href = link.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1616
|
+
}
|
|
1617
|
+
if (viewAll) {
|
|
1618
|
+
href = viewAll.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1619
|
+
}
|
|
1591
1620
|
props = {
|
|
1592
|
-
href:
|
|
1621
|
+
href: href,
|
|
1593
1622
|
isCurrent: el.classList.contains("arc-SiteHeaderNavItem--linkSelected") || undefined,
|
|
1594
1623
|
promo: promo || undefined,
|
|
1595
|
-
title:
|
|
1624
|
+
title: title,
|
|
1596
1625
|
viewAllTitle: (viewAll === null || viewAll === void 0 ? void 0 : viewAll.textContent) || undefined
|
|
1597
1626
|
};
|
|
1598
1627
|
return [2 /*return*/, React.createElement(NavItem, __assign({}, props), children)];
|
|
@@ -1641,7 +1670,7 @@ var SubNavItem = function (_a) {
|
|
|
1641
1670
|
};
|
|
1642
1671
|
|
|
1643
1672
|
var SubNavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1644
|
-
var children, promo, link, props;
|
|
1673
|
+
var children, promo, link, href, title, props;
|
|
1645
1674
|
return __generator(this, function (_a) {
|
|
1646
1675
|
switch (_a.label) {
|
|
1647
1676
|
case 0:
|
|
@@ -1660,11 +1689,17 @@ var SubNavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, vo
|
|
|
1660
1689
|
_a.label = 4;
|
|
1661
1690
|
case 4:
|
|
1662
1691
|
link = el.querySelector(".arc-SiteHeaderSubNavItem-link");
|
|
1692
|
+
href = "";
|
|
1693
|
+
title = "";
|
|
1694
|
+
if (link) {
|
|
1695
|
+
href = link.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1696
|
+
title = link.textContent || /* istanbul ignore next */ "";
|
|
1697
|
+
}
|
|
1663
1698
|
props = {
|
|
1664
|
-
href:
|
|
1699
|
+
href: href,
|
|
1665
1700
|
isDefaultItem: Boolean(el.dataset.defaultItem),
|
|
1666
1701
|
promo: promo || undefined,
|
|
1667
|
-
title:
|
|
1702
|
+
title: title
|
|
1668
1703
|
};
|
|
1669
1704
|
return [2 /*return*/, React.createElement(SubNavItem, __assign({}, props), children)];
|
|
1670
1705
|
}
|
|
@@ -1685,7 +1720,7 @@ var NavItemWithSubNav = function (_a) {
|
|
|
1685
1720
|
if (item && item.type !== SubNavItem && item.type !== Fragment) {
|
|
1686
1721
|
throw new Error("Illegal child passed to <SiteHeader.NavItemWithSubNav /> `slot1` prop. Ensure to only use <SiteHeader.SubNavItem />.");
|
|
1687
1722
|
}
|
|
1688
|
-
if (item
|
|
1723
|
+
if (item.props.isDefaultItem) {
|
|
1689
1724
|
setDefaultItem(false);
|
|
1690
1725
|
}
|
|
1691
1726
|
});
|
|
@@ -1693,7 +1728,7 @@ var NavItemWithSubNav = function (_a) {
|
|
|
1693
1728
|
if (item && item.type !== SubNavItem && item.type !== Fragment) {
|
|
1694
1729
|
throw new Error("Illegal child passed to <SiteHeader.NavItemWithSubNav /> `slot2` prop. Ensure to only use <SiteHeader.SubNavItem />.");
|
|
1695
1730
|
}
|
|
1696
|
-
if (item
|
|
1731
|
+
if (item.props.isDefaultItem) {
|
|
1697
1732
|
setDefaultItem(false);
|
|
1698
1733
|
}
|
|
1699
1734
|
});
|
|
@@ -1701,7 +1736,7 @@ var NavItemWithSubNav = function (_a) {
|
|
|
1701
1736
|
if (item && item.type !== SubNavItem && item.type !== Fragment) {
|
|
1702
1737
|
throw new Error("Illegal child passed to <SiteHeader.NavItemWithSubNav /> `slot3` prop. Ensure to only use <SiteHeader.SubNavItem />.");
|
|
1703
1738
|
}
|
|
1704
|
-
if (item
|
|
1739
|
+
if (item.props.isDefaultItem) {
|
|
1705
1740
|
setDefaultItem(false);
|
|
1706
1741
|
}
|
|
1707
1742
|
});
|
|
@@ -1731,7 +1766,7 @@ function wrap(el, wrapper) {
|
|
|
1731
1766
|
wrapper.appendChild(el);
|
|
1732
1767
|
}
|
|
1733
1768
|
var NavItemWithSubNavRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1734
|
-
var subNavItem1, subNavItem2, subNavItem3, div1, div2, slot1, slot2, slot3, div3, link, subTitle, viewAll, props;
|
|
1769
|
+
var subNavItem1, subNavItem2, subNavItem3, div1, div2, slot1, slot2, slot3, div3, link, subTitle, viewAll, title, props;
|
|
1735
1770
|
return __generator(this, function (_a) {
|
|
1736
1771
|
switch (_a.label) {
|
|
1737
1772
|
case 0:
|
|
@@ -1762,13 +1797,17 @@ var NavItemWithSubNavRehydrator = (function (el, hydrate) { return __awaiter(voi
|
|
|
1762
1797
|
link = el.querySelector(".arc-SiteHeaderNavItem-link");
|
|
1763
1798
|
subTitle = el.querySelector(".arc-SiteHeaderPanel-title");
|
|
1764
1799
|
viewAll = el.querySelector(".arc-SiteHeaderPanel-viewAll");
|
|
1800
|
+
title = "";
|
|
1801
|
+
if (link) {
|
|
1802
|
+
title = link.textContent || /* istanbul ignore next */ "";
|
|
1803
|
+
}
|
|
1765
1804
|
props = {
|
|
1766
1805
|
href: (viewAll === null || viewAll === void 0 ? void 0 : viewAll.getAttribute("href")) || undefined,
|
|
1767
|
-
slot1: slot1 || undefined,
|
|
1768
|
-
slot2: slot2 || undefined,
|
|
1806
|
+
slot1: slot1 || /* istanbul ignore next */ undefined,
|
|
1807
|
+
slot2: slot2 || /* istanbul ignore next */ undefined,
|
|
1769
1808
|
slot3: slot3 || undefined,
|
|
1770
1809
|
subTitle: (subTitle === null || subTitle === void 0 ? void 0 : subTitle.textContent) || undefined,
|
|
1771
|
-
title:
|
|
1810
|
+
title: title,
|
|
1772
1811
|
viewAllTitle: (viewAll === null || viewAll === void 0 ? void 0 : viewAll.textContent) || undefined
|
|
1773
1812
|
};
|
|
1774
1813
|
return [2 /*return*/, React.createElement(NavItemWithSubNav, __assign({}, props))];
|
|
@@ -1798,7 +1837,7 @@ var Provider = Context.Provider;
|
|
|
1798
1837
|
*/
|
|
1799
1838
|
var SiteHeader = function (_a) {
|
|
1800
1839
|
var _b;
|
|
1801
|
-
var children = _a.children, _c = _a.basketHref, basketHref = _c === void 0 ? "/basket" : _c, _d = _a.hasBasket, hasBasket = _d === void 0 ? false : _d, _e = _a.hasLogin, hasLogin = _e === void 0 ? true : _e, _f = _a.isTransparent, isTransparent = _f === void 0 ? false : _f, _g = _a.loginHref, loginHref = _g === void 0 ? "/login" : _g, _h = _a.loginTitle, loginTitle = _h === void 0 ? "Login / Register" : _h, _j = _a.logoHref, logoHref = _j === void 0 ? "/" : _j, _k = _a.logoLabel, logoLabel = _k === void 0 ? "Home" : _k, search = _a.search, props = __rest(_a, ["children", "basketHref", "hasBasket", "hasLogin", "isTransparent", "loginHref", "loginTitle", "logoHref", "logoLabel", "search"]);
|
|
1840
|
+
var children = _a.children, _c = _a.basketHref, basketHref = _c === void 0 ? "/basket" : _c, _d = _a.hasBasket, hasBasket = _d === void 0 ? false : _d, _e = _a.hasLogin, hasLogin = _e === void 0 ? true : _e, _f = _a.isTransparent, isTransparent = _f === void 0 ? false : _f, _g = _a.loginHref, loginHref = _g === void 0 ? "/login" : _g, _h = _a.loginTitle, loginTitle = _h === void 0 ? "Login / Register" : _h, _j = _a.logoHref, logoHref = _j === void 0 ? "/" : _j, _k = _a.logoLabel, logoLabel = _k === void 0 ? "Home" : _k, search = _a.search, subBrand = _a.subBrand, props = __rest(_a, ["children", "basketHref", "hasBasket", "hasLogin", "isTransparent", "loginHref", "loginTitle", "logoHref", "logoLabel", "search", "subBrand"]);
|
|
1802
1841
|
var _l = useState(false), hasClientSideJavaScript = _l[0], setHasClientSideJavaScript = _l[1];
|
|
1803
1842
|
var _m = useState(false), menuOpen = _m[0], setMenuOpen = _m[1];
|
|
1804
1843
|
var isMinWidthArcBreakpointL = useMediaQuery("(min-width: ".concat(ArcBreakpointL, "px)"));
|
|
@@ -1849,15 +1888,15 @@ var SiteHeader = function (_a) {
|
|
|
1849
1888
|
: undefined },
|
|
1850
1889
|
React.createElement("div", { className: "arc-SiteHeader-inner" },
|
|
1851
1890
|
React.createElement("a", { className: "arc-SiteHeader-brand", href: logoHref },
|
|
1852
|
-
React.createElement(BrandLogo, { label: logoLabel,
|
|
1853
|
-
React.createElement("nav", { className: "arc-SiteHeader-nav" },
|
|
1891
|
+
React.createElement(BrandLogo, { label: logoLabel, subBrand: subBrand })),
|
|
1892
|
+
children && (React.createElement("nav", { className: "arc-SiteHeader-nav" },
|
|
1854
1893
|
React.createElement("div", { className: "arc-SiteHeader-menuButton" },
|
|
1855
1894
|
React.createElement(MenuButton, { menuOpen: menuOpen, setMenuOpen: setMenuOpen })),
|
|
1856
1895
|
React.createElement("div", { className: "arc-SiteHeader-main" },
|
|
1857
1896
|
React.createElement("ul", { className: "arc-SiteHeader-navItems" }, children),
|
|
1858
1897
|
hasLogin && (React.createElement("div", { className: "arc-SiteHeader-loginButton" },
|
|
1859
|
-
React.createElement(Button, { href: loginHref, isFullWidth: true, label: loginTitle }))))))
|
|
1860
|
-
(
|
|
1898
|
+
React.createElement(Button, { href: loginHref, isFullWidth: true, label: loginTitle })))))),
|
|
1899
|
+
(hasBasket || hasLogin || search) && (React.createElement("div", { className: "arc-SiteHeader-secondary" },
|
|
1861
1900
|
search ? (React.createElement("div", { className: "arc-SiteHeader-search" }, search)) : null,
|
|
1862
1901
|
hasBasket ? (React.createElement("a", { className: "arc-SiteHeader-basket", href: basketHref },
|
|
1863
1902
|
React.createElement(Icon, { icon: "btBasket", label: "Basket", size: 24 }))) : null,
|
|
@@ -1877,27 +1916,33 @@ SiteHeader.NavItemWithSubNav = NavItemWithSubNav;
|
|
|
1877
1916
|
SiteHeader.SubNavItem = SubNavItem;
|
|
1878
1917
|
|
|
1879
1918
|
var SiteHeaderRehydrator = function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1880
|
-
var children, search, basket, login, props;
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
switch (_c.label) {
|
|
1919
|
+
var children, search, basket, brand, login, logoHref, logoLabel, props;
|
|
1920
|
+
return __generator(this, function (_a) {
|
|
1921
|
+
switch (_a.label) {
|
|
1884
1922
|
case 0:
|
|
1885
1923
|
children = el.querySelector(".arc-SiteHeader-navItems");
|
|
1886
1924
|
search = el.querySelector(".arc-SiteHeader-search");
|
|
1887
1925
|
if (!children) return [3 /*break*/, 2];
|
|
1888
1926
|
return [4 /*yield*/, hydrate(children)];
|
|
1889
1927
|
case 1:
|
|
1890
|
-
children =
|
|
1891
|
-
|
|
1928
|
+
children = _a.sent();
|
|
1929
|
+
_a.label = 2;
|
|
1892
1930
|
case 2:
|
|
1893
1931
|
if (!search) return [3 /*break*/, 4];
|
|
1894
1932
|
return [4 /*yield*/, hydrate(search)];
|
|
1895
1933
|
case 3:
|
|
1896
|
-
search =
|
|
1897
|
-
|
|
1934
|
+
search = _a.sent();
|
|
1935
|
+
_a.label = 4;
|
|
1898
1936
|
case 4:
|
|
1899
1937
|
basket = el.querySelector(".arc-SiteHeader-basket");
|
|
1938
|
+
brand = el.querySelector(".arc-SiteHeader-brand");
|
|
1900
1939
|
login = el.querySelector(".arc-SiteHeader-loginLink");
|
|
1940
|
+
logoHref = "";
|
|
1941
|
+
logoLabel = "";
|
|
1942
|
+
if (brand) {
|
|
1943
|
+
logoHref = brand.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1944
|
+
logoLabel = brand.textContent || /* istanbul ignore next */ "";
|
|
1945
|
+
}
|
|
1901
1946
|
props = {
|
|
1902
1947
|
basketHref: (basket === null || basket === void 0 ? void 0 : basket.getAttribute("href")) || undefined,
|
|
1903
1948
|
hasBasket: Boolean(basket),
|
|
@@ -1905,9 +1950,8 @@ var SiteHeaderRehydrator = function (el, hydrate) { return __awaiter(void 0, voi
|
|
|
1905
1950
|
isTransparent: Boolean(el.dataset.transparent),
|
|
1906
1951
|
loginHref: (login === null || login === void 0 ? void 0 : login.getAttribute("href")) || undefined,
|
|
1907
1952
|
loginTitle: (login === null || login === void 0 ? void 0 : login.textContent) || undefined,
|
|
1908
|
-
logoHref:
|
|
1909
|
-
|
|
1910
|
-
logoLabel: ((_b = el.querySelector("arc-BrandLogo-text")) === null || _b === void 0 ? void 0 : _b.textContent) || undefined,
|
|
1953
|
+
logoHref: logoHref,
|
|
1954
|
+
logoLabel: logoLabel,
|
|
1911
1955
|
search: search
|
|
1912
1956
|
};
|
|
1913
1957
|
return [2 /*return*/, React.createElement(SiteHeader, __assign({}, props), children)];
|
|
@@ -1927,12 +1971,11 @@ var Text = function (_a) {
|
|
|
1927
1971
|
var _c = _a.align, align = _c === void 0 ? "left" : _c, children = _a.children, _d = _a.isInline, isInline = _d === void 0 ? false : _d, _e = _a.isMeasured, isMeasured = _e === void 0 ? false : _e, _f = _a.size, size = _f === void 0 ? "m" : _f, _g = _a.tone, tone = _g === void 0 ? "default" : _g, props = __rest(_a, ["align", "children", "isInline", "isMeasured", "size", "tone"]);
|
|
1928
1972
|
var surface = useContext(Context$2).surface;
|
|
1929
1973
|
return (React.createElement("span", __assign({ className: classNames((_b = {
|
|
1930
|
-
"arc-Text": true
|
|
1931
|
-
"arc-Text--alignCenter": align === "center",
|
|
1932
|
-
"arc-Text--alignRight": align === "right",
|
|
1933
|
-
"arc-Text--inline": isInline,
|
|
1934
|
-
"arc-Text--measured": isMeasured
|
|
1974
|
+
"arc-Text": true
|
|
1935
1975
|
},
|
|
1976
|
+
_b[suffixModifier("arc-Text--align", align)] = align !== "left",
|
|
1977
|
+
_b["arc-Text--inline"] = isInline,
|
|
1978
|
+
_b["arc-Text--measured"] = isMeasured,
|
|
1936
1979
|
_b["arc-Text--size".concat(size && size.toUpperCase())] = size && size !== "m",
|
|
1937
1980
|
_b["arc-Text--".concat(tone)] = tone !== "default",
|
|
1938
1981
|
_b["arc-Text--onDarkSurface"] = surface === "dark",
|