@arc-ui/components 6.0.0 → 6.3.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 CHANGED
@@ -369,6 +369,10 @@ var BrandLogo = function (_a) {
369
369
  } }, filterDataAttrs(props)), label ? React.createElement("span", { className: "arc-BrandLogo-text" }, label) : null));
370
370
  };
371
371
 
372
+ /**
373
+ * Do not edit directly
374
+ * Generated file
375
+ */
372
376
  const ArcBreakpointM = 768;
373
377
  const ArcBreakpointL = 1024;
374
378
  const iconsSelected = [
@@ -686,8 +690,8 @@ var Button = forwardRef(function (_a, ref) {
686
690
  var ButtonIcon = function (_a) {
687
691
  var icon = _a.icon, isChevron = _a.isChevron, isBeforeText = _a.isBeforeText;
688
692
  return (React.createElement("span", { className: classNames({
689
- "arc-ButtonIcon": true,
690
- "arc-ButtonIcon--chevron": isChevron
693
+ "arc-Button-icon": true,
694
+ "arc-Button-icon--chevron": isChevron
691
695
  }) }, isChevron ? (React.createElement(Icon, { icon: "btChevron".concat(isBeforeText ? "Left" : "Right", "2px") })) : (React.createElement(Icon, { icon: icon }))));
692
696
  };
693
697
 
@@ -731,7 +735,7 @@ var Heading = function (_a) {
731
735
  };
732
736
  var HeadingProposition = function (_a) {
733
737
  var children = _a.children;
734
- return React.createElement("span", { className: "arc-HeadingProposition" }, children);
738
+ return React.createElement("span", { className: "arc-Heading-proposition" }, children);
735
739
  };
736
740
  HeadingProposition.displayName = "Heading.Proposition";
737
741
  Heading.Proposition = HeadingProposition;
@@ -776,12 +780,12 @@ var useInteractionMode = function () {
776
780
  };
777
781
  if (typeof window !== "undefined") {
778
782
  document.addEventListener("keydown", onKeyDown, true);
779
- document.addEventListener("mousedown", onPointerDown, true);
783
+ document.addEventListener("click", onPointerDown, true);
780
784
  }
781
785
  return function () {
782
786
  if (typeof window !== "undefined") {
783
787
  document.removeEventListener("keydown", onKeyDown);
784
- document.removeEventListener("mousedown", onPointerDown);
788
+ document.removeEventListener("click", onPointerDown);
785
789
  }
786
790
  };
787
791
  }, []);
@@ -889,13 +893,13 @@ var Card = function (_a) {
889
893
  var CardBlock = function (_a) {
890
894
  var _b = _a.align, align = _b === void 0 ? "left" : _b, children = _a.children, _c = _a.isFullWidth, isFullWidth = _c === void 0 ? false : _c, _d = _a.grow, grow = _d === void 0 ? false : _d;
891
895
  return (React.createElement("div", { className: classNames({
892
- "arc-CardBlock": true,
893
- "arc-CardBlock--alignCenter": align === "center",
894
- "arc-CardBlock--alignRight": align === "right",
895
- "arc-CardBlock--fullWidth": isFullWidth,
896
- "arc-CardBlock--grow": grow
896
+ "arc-Card-block": true,
897
+ "arc-Card-block--alignCenter": align === "center",
898
+ "arc-Card-block--alignRight": align === "right",
899
+ "arc-Card-block--fullWidth": isFullWidth,
900
+ "arc-Card-block--grow": grow
897
901
  }) },
898
- React.createElement("div", { className: "arc-CardBlock-inner" }, children)));
902
+ React.createElement("div", { className: "arc-Card-blockInner" }, children)));
899
903
  };
900
904
  CardBlock.displayName = "Card.Block";
901
905
  Card.Block = CardBlock;
@@ -905,7 +909,7 @@ Card.Block = CardBlock;
905
909
  var CardImage = function (_a) {
906
910
  var _b = _a.alt, alt = _b === void 0 ? "" : _b, _c = _a.height, height = _c === void 0 ? 176 : _c, src = _a.src, srcSet = _a.srcSet;
907
911
  return (React.createElement("div", { className: classNames({
908
- "arc-CardImage": true
912
+ "arc-Card-image": true
909
913
  }) },
910
914
  React.createElement(Image, { alt: alt, fit: "cover", src: src, srcSet: srcSet, height: height })));
911
915
  };
@@ -918,13 +922,13 @@ var CardLink = function (_a) {
918
922
  var actionId = _a.actionId, isButton = _a.isButton, children = _a.children, fill = _a.fill, href = _a.href, stretch = _a.stretch, target = _a.target;
919
923
  var surface = useContext(Context$3).surface;
920
924
  return (React.createElement("a", { "aria-describedby": actionId, className: classNames({
921
- "arc-CardLink": true,
922
- "arc-CardLink--button": isButton,
923
- "arc-CardLink--onDarkSurface": surface === "dark" && fill !== "neutral",
924
- "arc-CardLink--stretch": stretch
925
+ "arc-Card-link": true,
926
+ "arc-Card-link--button": isButton,
927
+ "arc-Card-link--onDarkSurface": surface === "dark" && fill !== "neutral",
928
+ "arc-Card-link--stretch": stretch
925
929
  }), href: href, rel: target === "_blank" ? "noopener noreferrer" : undefined, tabIndex: isButton ? -1 : undefined, target: target },
926
- React.createElement("span", { className: "arc-CardLink-text" }, children),
927
- isButton && (React.createElement("span", { className: "arc-CardLink-icon" },
930
+ React.createElement("span", { className: "arc-Card-linkText" }, children),
931
+ isButton && (React.createElement("span", { className: "arc-Card-linkIcon" },
928
932
  React.createElement(Icon, { icon: "btChevronRight2px", size: 8 })))));
929
933
  };
930
934
 
@@ -1064,24 +1068,24 @@ var Col = function (_a) {
1064
1068
  var _b;
1065
1069
  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"]);
1066
1070
  return (React.createElement("div", __assign({ className: classNames((_b = {},
1067
- _b["arc-Col"] = true,
1068
- _b[suffixModifier("arc-Col--align", align || "")] = align,
1069
- _b["arc-Col--".concat(span)] = typeof span !== "undefined",
1070
- _b["arc-Col--S".concat(spanS)] = typeof spanS !== "undefined",
1071
- _b["arc-Col--M".concat(spanM)] = typeof spanM !== "undefined",
1072
- _b["arc-Col--L".concat(spanL)] = typeof spanL !== "undefined",
1073
- _b["arc-Col--XL".concat(spanXL)] = typeof spanXL !== "undefined",
1074
- _b["arc-Col--offset"] = typeof offset !== "undefined" ||
1071
+ _b["arc-Columns-col"] = true,
1072
+ _b[suffixModifier("arc-Columns-col--align", align || "")] = align,
1073
+ _b["arc-Columns-col--".concat(span)] = typeof span !== "undefined",
1074
+ _b["arc-Columns-col--s".concat(spanS)] = typeof spanS !== "undefined",
1075
+ _b["arc-Columns-col--m".concat(spanM)] = typeof spanM !== "undefined",
1076
+ _b["arc-Columns-col--l".concat(spanL)] = typeof spanL !== "undefined",
1077
+ _b["arc-Columns-col--xL".concat(spanXL)] = typeof spanXL !== "undefined",
1078
+ _b["arc-Columns-col--offset"] = typeof offset !== "undefined" ||
1075
1079
  typeof offsetS !== "undefined" ||
1076
1080
  typeof offsetM !== "undefined" ||
1077
1081
  typeof offsetL !== "undefined" ||
1078
1082
  typeof offsetXL !== "undefined",
1079
- _b["arc-Col--offset".concat(offset)] = typeof offset !== "undefined",
1080
- _b["arc-Col--offsetS".concat(offsetS)] = typeof offsetS !== "undefined",
1081
- _b["arc-Col--offsetM".concat(offsetM)] = typeof offsetM !== "undefined",
1082
- _b["arc-Col--offsetL".concat(offsetL)] = typeof offsetL !== "undefined",
1083
- _b["arc-Col--offsetXL".concat(offsetXL)] = typeof offsetXL !== "undefined",
1084
- _b["arc-Col--debugVisible"] = isDebugVisible,
1083
+ _b["arc-Columns-col--offset".concat(offset)] = typeof offset !== "undefined",
1084
+ _b["arc-Columns-col--offsetS".concat(offsetS)] = typeof offsetS !== "undefined",
1085
+ _b["arc-Columns-col--offsetM".concat(offsetM)] = typeof offsetM !== "undefined",
1086
+ _b["arc-Columns-col--offsetL".concat(offsetL)] = typeof offsetL !== "undefined",
1087
+ _b["arc-Columns-col--offsetXL".concat(offsetXL)] = typeof offsetXL !== "undefined",
1088
+ _b["arc-Columns-col--debugVisible"] = isDebugVisible,
1085
1089
  _b)) }, filterDataAttrs(props)), children));
1086
1090
  };
1087
1091
  Col.displayName = "Columns.Col";
@@ -1162,9 +1166,9 @@ var GroupItem = function (_a) {
1162
1166
  var _b;
1163
1167
  var children = _a.children, _c = _a.grow, grow = _c === void 0 ? false : _c, _d = _a.isDebugVisible, isDebugVisible = _d === void 0 ? false : _d, props = __rest(_a, ["children", "grow", "isDebugVisible"]);
1164
1168
  return (React.createElement("div", __assign({ className: classNames((_b = {},
1165
- _b["arc-GroupItem"] = true,
1166
- _b["arc-GroupItem--grow"] = grow,
1167
- _b["arc-GroupItem--debugVisible"] = isDebugVisible,
1169
+ _b["arc-Group-item"] = true,
1170
+ _b["arc-Group-item--grow"] = grow,
1171
+ _b["arc-Group-item--debugVisible"] = isDebugVisible,
1168
1172
  _b)) }, filterDataAttrs(props)), children));
1169
1173
  };
1170
1174
  GroupItem.displayName = "Group.Item";
@@ -1508,7 +1512,9 @@ var Panel = function (_a) {
1508
1512
  // and the click is not on a SubNavItem-link.
1509
1513
  // This ensures that one SubNavItem Panel per NavItem always remains open.
1510
1514
  (subNavItemRef &&
1511
- !e.target.classList.contains(subNavLink)) ||
1515
+ !e.target.classList.contains(subNavLink) &&
1516
+ !e.target.classList.contains("".concat(subNavLink, "Title")) &&
1517
+ !e.target.classList.contains("".concat(subNavLink, "SubTitle"))) ||
1512
1518
  // Panel is inside a SubNavItem
1513
1519
  // and the click is not inside the Panel's NavItem parent.
1514
1520
  // This prevents SubNavItem Panels in sibling NavItems from being closed.
@@ -1636,12 +1642,31 @@ var NavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void
1636
1642
  });
1637
1643
  }); });
1638
1644
 
1645
+ /**
1646
+ * Use `Text` to display text.
1647
+ */
1648
+ var Text = function (_a) {
1649
+ var _b;
1650
+ 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"]);
1651
+ var surface = useContext(Context$3).surface;
1652
+ return (React.createElement("span", __assign({ className: classNames((_b = {
1653
+ "arc-Text": true
1654
+ },
1655
+ _b[suffixModifier("arc-Text--align", align)] = align !== "left",
1656
+ _b["arc-Text--inline"] = isInline,
1657
+ _b["arc-Text--measured"] = isMeasured,
1658
+ _b["arc-Text--size".concat(size && size.toUpperCase())] = size && size !== "m",
1659
+ _b["arc-Text--".concat(tone)] = tone !== "default",
1660
+ _b["arc-Text--onDarkSurface"] = surface === "dark",
1661
+ _b)) }, filterDataAttrs(props)), children));
1662
+ };
1663
+
1639
1664
  var SubNavItem = function (_a) {
1640
1665
  var _b, _c;
1641
- var children = _a.children, _d = _a.isDefaultItem, isDefaultItem = _d === void 0 ? false : _d, href = _a.href, promo = _a.promo, title = _a.title, props = __rest(_a, ["children", "isDefaultItem", "href", "promo", "title"]);
1642
- var _e = useContext(Context$1), navItem = _e.navItem, subTitle = _e.subTitle;
1666
+ var children = _a.children, _d = _a.isDefaultItem, isDefaultItem = _d === void 0 ? false : _d, href = _a.href, offsetXL = _a.offsetXL, promo = _a.promo, subTitle = _a.subTitle, title = _a.title, viewAllTitle = _a.viewAllTitle, props = __rest(_a, ["children", "isDefaultItem", "href", "offsetXL", "promo", "subTitle", "title", "viewAllTitle"]);
1667
+ var navItem = useContext(Context$1).navItem;
1643
1668
  var subNavItem = useRef();
1644
- var _f = useState(false), panelOpen = _f[0], setPanelOpen = _f[1];
1669
+ var _e = useState(false), panelOpen = _e[0], setPanelOpen = _e[1];
1645
1670
  var isMinWidthArcBreakpointL = useMediaQuery("(min-width: ".concat(ArcBreakpointL, "px)"));
1646
1671
  useEffect(function () {
1647
1672
  React.Children.map(children, function (item) {
@@ -1661,52 +1686,75 @@ var SubNavItem = function (_a) {
1661
1686
  setPanelOpen(false);
1662
1687
  }
1663
1688
  }, [isDefaultItem, isMinWidthArcBreakpointL]);
1689
+ var linkTitle = (React.createElement(React.Fragment, null,
1690
+ React.createElement("span", { className: "arc-SiteHeaderSubNavItem-linkTitle" }, title),
1691
+ subTitle ? (React.createElement("span", { className: "arc-SiteHeaderSubNavItem-linkSubTitle" }, subTitle)) : null));
1664
1692
  return (React.createElement("li", __assign({ className: classNames((_b = {},
1665
1693
  _b["arc-SiteHeaderSubNavItem"] = true,
1666
1694
  _b["arc-SiteHeaderSubNavItem--linkSelected"] = children && panelOpen,
1667
- _b)), ref: subNavItem }, filterDataAttrs(props), { "data-default-item": isDefaultItem || null }), !children ? (href ? (React.createElement("a", { className: "arc-SiteHeaderSubNavItem-link", href: href }, title)) : null) : (React.createElement(React.Fragment, null,
1695
+ _b[suffixModifier("arc-SiteHeaderSubNavItem--offsetXL", offsetXL || "")] = offsetXL,
1696
+ _b)), ref: subNavItem }, filterDataAttrs(props), { "data-default-item": isDefaultItem || null }), !children ? (href ? (React.createElement("a", { className: "arc-SiteHeaderSubNavItem-link", href: href }, linkTitle)) : null) : (React.createElement(React.Fragment, null,
1668
1697
  React.createElement("button", { "aria-expanded": panelOpen, className: classNames((_c = {},
1669
1698
  _c["arc-SiteHeaderSubNavItem-link"] = true,
1670
1699
  _c["arc-SiteHeaderSubNavItem-link--itemHasChildren"] = children,
1671
1700
  _c)), onClick: function () {
1672
1701
  setPanelOpen(true);
1673
- } }, title),
1674
- React.createElement(Panel, { navItemRef: navItem, open: panelOpen, setOpen: setPanelOpen, subNavItemRef: subNavItem, subNavLink: "arc-SiteHeaderSubNavItem-link", promo: promo, title: React.createElement(React.Fragment, null,
1675
- subTitle && "".concat(subTitle, " "),
1676
- React.createElement("b", null, title)) }, children)))));
1702
+ } }, linkTitle),
1703
+ React.createElement(Panel, { navItemRef: navItem, open: panelOpen, setOpen: setPanelOpen, subNavItemRef: subNavItem, subNavLink: "arc-SiteHeaderSubNavItem-link", promo: promo, title: React.createElement("span", null,
1704
+ title,
1705
+ subTitle && (React.createElement(Text, { size: "xs", tone: "supporting" }, subTitle))), viewAll: href ? (React.createElement(Panel.ViewAll, { href: href, title: viewAllTitle || "View all ".concat(title.toLowerCase()) })) : (undefined) }, children)))));
1677
1706
  };
1678
1707
 
1679
1708
  var SubNavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
1680
- var children, promo, link, href, title, props;
1681
- return __generator(this, function (_a) {
1682
- switch (_a.label) {
1709
+ var children, promo, link, linkTitle, viewAll, href, title, offsetXL, props;
1710
+ var _a;
1711
+ return __generator(this, function (_b) {
1712
+ switch (_b.label) {
1683
1713
  case 0:
1684
1714
  children = el.querySelector(".arc-SiteHeaderPanel-items");
1685
1715
  promo = el.querySelector(".arc-SiteHeaderPanel-promo");
1686
1716
  if (!children) return [3 /*break*/, 2];
1687
1717
  return [4 /*yield*/, hydrate(children)];
1688
1718
  case 1:
1689
- children = _a.sent();
1690
- _a.label = 2;
1719
+ children = _b.sent();
1720
+ _b.label = 2;
1691
1721
  case 2:
1692
1722
  if (!promo) return [3 /*break*/, 4];
1693
1723
  return [4 /*yield*/, hydrate(promo)];
1694
1724
  case 3:
1695
- promo = _a.sent();
1696
- _a.label = 4;
1725
+ promo = _b.sent();
1726
+ _b.label = 4;
1697
1727
  case 4:
1698
1728
  link = el.querySelector(".arc-SiteHeaderSubNavItem-link");
1729
+ linkTitle = el.querySelector(".arc-SiteHeaderSubNavItem-linkTitle");
1730
+ viewAll = el.querySelector(".arc-SiteHeaderPanel-viewAll");
1699
1731
  href = "";
1700
1732
  title = "";
1701
1733
  if (link) {
1702
1734
  href = link.getAttribute("href") || /* istanbul ignore next */ "";
1703
- title = link.textContent || /* istanbul ignore next */ "";
1735
+ }
1736
+ if (linkTitle) {
1737
+ title = linkTitle.textContent || /* istanbul ignore next */ "";
1738
+ }
1739
+ if (viewAll) {
1740
+ href = viewAll.getAttribute("href") || /* istanbul ignore next */ "";
1741
+ }
1742
+ offsetXL = undefined;
1743
+ if (el.classList.contains("arc-SiteHeaderSubNavItem--offsetXL24")) {
1744
+ offsetXL = "24";
1745
+ }
1746
+ if (el.classList.contains("arc-SiteHeaderSubNavItem--offsetXL48")) {
1747
+ offsetXL = "48";
1704
1748
  }
1705
1749
  props = {
1706
1750
  href: href,
1707
1751
  isDefaultItem: Boolean(el.dataset.defaultItem),
1752
+ offsetXL: offsetXL,
1708
1753
  promo: promo || undefined,
1709
- title: title
1754
+ subTitle: ((_a = el.querySelector(".arc-SiteHeaderSubNavItem-linkSubTitle")) === null || _a === void 0 ? void 0 : _a.textContent) ||
1755
+ undefined,
1756
+ title: title,
1757
+ viewAllTitle: (viewAll === null || viewAll === void 0 ? void 0 : viewAll.textContent) || undefined
1710
1758
  };
1711
1759
  return [2 /*return*/, React.createElement(SubNavItem, __assign({}, props), children)];
1712
1760
  }
@@ -1773,7 +1821,7 @@ function wrap(el, wrapper) {
1773
1821
  wrapper.appendChild(el);
1774
1822
  }
1775
1823
  var NavItemWithSubNavRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
1776
- var subNavItem1, subNavItem2, subNavItem3, div1, div2, slot1, slot2, slot3, div3, link, subTitle, viewAll, title, props;
1824
+ var subNavItem1, subNavItem2, subNavItem3, div1, div2, slot1, slot2, slot3, div3, link, subTitle, viewAllNodes, viewAll, title, props;
1777
1825
  return __generator(this, function (_a) {
1778
1826
  switch (_a.label) {
1779
1827
  case 0:
@@ -1803,7 +1851,8 @@ var NavItemWithSubNavRehydrator = (function (el, hydrate) { return __awaiter(voi
1803
1851
  case 4:
1804
1852
  link = el.querySelector(".arc-SiteHeaderNavItem-link");
1805
1853
  subTitle = el.querySelector(".arc-SiteHeaderPanel-title");
1806
- viewAll = el.querySelector(".arc-SiteHeaderPanel-viewAll");
1854
+ viewAllNodes = el.querySelectorAll(".arc-SiteHeaderPanel-viewAll");
1855
+ viewAll = viewAllNodes[viewAllNodes.length - 1];
1807
1856
  title = "";
1808
1857
  if (link) {
1809
1858
  title = link.textContent || /* istanbul ignore next */ "";
@@ -1970,25 +2019,6 @@ SiteHeaderRehydrator.NavItemRehydrator = NavItemRehydrator;
1970
2019
  SiteHeaderRehydrator.NavItemWithSubNavRehydrator = NavItemWithSubNavRehydrator;
1971
2020
  SiteHeaderRehydrator.SubNavItemRehydrator = SubNavItemRehydrator;
1972
2021
 
1973
- /**
1974
- * Use `Text` to display text.
1975
- */
1976
- var Text = function (_a) {
1977
- var _b;
1978
- 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"]);
1979
- var surface = useContext(Context$3).surface;
1980
- return (React.createElement("span", __assign({ className: classNames((_b = {
1981
- "arc-Text": true
1982
- },
1983
- _b[suffixModifier("arc-Text--align", align)] = align !== "left",
1984
- _b["arc-Text--inline"] = isInline,
1985
- _b["arc-Text--measured"] = isMeasured,
1986
- _b["arc-Text--size".concat(size && size.toUpperCase())] = size && size !== "m",
1987
- _b["arc-Text--".concat(tone)] = tone !== "default",
1988
- _b["arc-Text--onDarkSurface"] = surface === "dark",
1989
- _b)) }, filterDataAttrs(props)), children));
1990
- };
1991
-
1992
2022
  /**
1993
2023
  * Use `TextInput` to allow custom user text entry with a keyboard.
1994
2024
  */