@arc-ui/components 6.2.0 → 7.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 CHANGED
@@ -767,7 +767,7 @@ var useAriaDescribedby = function (_a) {
767
767
  * Detect interaction mode
768
768
  */
769
769
  var useInteractionMode = function () {
770
- var _a = useState(""), interactionMode = _a[0], setInteractionMode = _a[1];
770
+ var _a = useState("pointer"), interactionMode = _a[0], setInteractionMode = _a[1];
771
771
  useEffect(function () {
772
772
  var onKeyDown = function (event) {
773
773
  if (event.altKey || event.ctrlKey || event.metaKey) {
@@ -780,12 +780,12 @@ var useInteractionMode = function () {
780
780
  };
781
781
  if (typeof window !== "undefined") {
782
782
  document.addEventListener("keydown", onKeyDown, true);
783
- document.addEventListener("mousedown", onPointerDown, true);
783
+ document.addEventListener("click", onPointerDown, true);
784
784
  }
785
785
  return function () {
786
786
  if (typeof window !== "undefined") {
787
787
  document.removeEventListener("keydown", onKeyDown);
788
- document.removeEventListener("mousedown", onPointerDown);
788
+ document.removeEventListener("click", onPointerDown);
789
789
  }
790
790
  };
791
791
  }, []);
@@ -860,7 +860,7 @@ var useNumericInput = function (props) {
860
860
  */
861
861
  var Card = function (_a) {
862
862
  var _b;
863
- 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"]);
863
+ 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, linkData = _a.linkData, 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", "linkData", "minHeight", "target", "title", "titleSize"]);
864
864
  var surface = useContext(Context$3).surface;
865
865
  var interactionMode = useInteractionMode().interactionMode;
866
866
  var Wrapper = function (_a) {
@@ -880,7 +880,7 @@ var Card = function (_a) {
880
880
  React.createElement("div", { className: "arc-Card-header" },
881
881
  React.createElement("div", { className: "arc-Card-title" },
882
882
  React.createElement(Heading, { size: titleSize },
883
- React.createElement(CardLink, { actionId: actionId, fill: fill, href: href, stretch: true, target: target }, title))),
883
+ React.createElement(CardLink, { actionId: actionId, fill: fill, href: href, linkData: linkData, stretch: true, target: target }, title))),
884
884
  coverImage),
885
885
  React.createElement("div", { className: "arc-Card-children" },
886
886
  React.createElement(Card.Block, null, children)),
@@ -907,11 +907,11 @@ Card.Block = CardBlock;
907
907
  * Internal `Card.Image` component to show an image within a Card.
908
908
  */
909
909
  var CardImage = function (_a) {
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;
910
+ var _b = _a.alt, alt = _b === void 0 ? "" : _b, _c = _a.height, height = _c === void 0 ? 176 : _c, sizes = _a.sizes, src = _a.src, srcSet = _a.srcSet;
911
911
  return (React.createElement("div", { className: classNames({
912
912
  "arc-Card-image": true
913
913
  }) },
914
- React.createElement(Image, { alt: alt, fit: "cover", src: src, srcSet: srcSet, height: height })));
914
+ React.createElement(Image, { alt: alt, fit: "cover", sizes: sizes, src: src, srcSet: srcSet, height: height })));
915
915
  };
916
916
  CardImage.displayName = "Card.Image";
917
917
  Card.Image = CardImage;
@@ -919,14 +919,14 @@ Card.Image = CardImage;
919
919
  * Internal `CardLink` component.
920
920
  */
921
921
  var CardLink = function (_a) {
922
- var actionId = _a.actionId, isButton = _a.isButton, children = _a.children, fill = _a.fill, href = _a.href, stretch = _a.stretch, target = _a.target;
922
+ var actionId = _a.actionId, isButton = _a.isButton, children = _a.children, fill = _a.fill, href = _a.href, _b = _a.linkData, linkData = _b === void 0 ? {} : _b, stretch = _a.stretch, target = _a.target;
923
923
  var surface = useContext(Context$3).surface;
924
- return (React.createElement("a", { "aria-describedby": actionId, className: classNames({
924
+ return (React.createElement("a", __assign({ "aria-describedby": actionId, className: classNames({
925
925
  "arc-Card-link": true,
926
926
  "arc-Card-link--button": isButton,
927
927
  "arc-Card-link--onDarkSurface": surface === "dark" && fill !== "neutral",
928
928
  "arc-Card-link--stretch": stretch
929
- }), href: href, rel: target === "_blank" ? "noopener noreferrer" : undefined, tabIndex: isButton ? -1 : undefined, target: target },
929
+ }), href: href, rel: target === "_blank" ? "noopener noreferrer" : undefined, tabIndex: isButton ? -1 : undefined, target: target }, filterDataAttrs(linkData)),
930
930
  React.createElement("span", { className: "arc-Card-linkText" }, children),
931
931
  isButton && (React.createElement("span", { className: "arc-Card-linkIcon" },
932
932
  React.createElement(Icon, { icon: "btChevronRight2px", size: 8 })))));
@@ -1427,12 +1427,16 @@ var ItemGroup = function (_a) {
1427
1427
  // useEffect does not run in ReactDomServer renders
1428
1428
  setHasClientSideJavaScript(true);
1429
1429
  }, [setHasClientSideJavaScript]);
1430
+ var ElementType = "div";
1431
+ if (title) {
1432
+ ElementType = "details";
1433
+ }
1430
1434
  return (React.createElement("li", { className: "arc-SiteHeaderItemGroup" },
1431
- React.createElement("details", __assign({ className: "arc-SiteHeaderItemGroup-details", open: isMinWidthArcBreakpointL }, filterDataAttrs(props)),
1432
- 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))),
1435
+ React.createElement(ElementType, __assign({ className: "arc-SiteHeaderItemGroup-details", open: Boolean(title && isMinWidthArcBreakpointL) }, filterDataAttrs(props)),
1436
+ title ? (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)))) : null,
1433
1437
  React.createElement("ul", { className: "arc-SiteHeaderItemGroup-items" },
1434
1438
  children,
1435
- href ? (React.createElement("li", { className: "arc-SiteHeaderItem arc-SiteHeaderItem--viewAll" },
1439
+ href && title ? (React.createElement("li", { className: "arc-SiteHeaderItem arc-SiteHeaderItem--viewAll" },
1436
1440
  React.createElement("a", { className: "arc-SiteHeaderItem-link", href: href }, viewAllTitle || "View all ".concat(title.toLowerCase())))) : null))));
1437
1441
  };
1438
1442