diff --git a/.changeset/mighty-vans-dress.md b/.changeset/mighty-vans-dress.md new file mode 100644 index 0000000000..9a9e3861fa --- /dev/null +++ b/.changeset/mighty-vans-dress.md @@ -0,0 +1,4 @@ +--- +"@rhds/elements": major +--- +``: Removed previously-deprecated `color-palette` attribute diff --git a/.changeset/mighty-vans-skate.md b/.changeset/mighty-vans-skate.md new file mode 100644 index 0000000000..99ab6ebdec --- /dev/null +++ b/.changeset/mighty-vans-skate.md @@ -0,0 +1,5 @@ +--- +"@rhds/elements": major +--- +``: Deprecated `rhCta.cta` public property. This will be removed in the +next major version. diff --git a/.changeset/shaky-yaks-win.md b/.changeset/shaky-yaks-win.md new file mode 100644 index 0000000000..f1f2a03367 --- /dev/null +++ b/.changeset/shaky-yaks-win.md @@ -0,0 +1,17 @@ +--- +"@rhds/elements": minor +--- +``: added `href` attribute. When set, do not slot an anchor or button, +instead, slot in the link text. + +These two are equivalent: + +```html + + Elements + +``` + +```html +Elements +``` diff --git a/.changeset/wet-readers-shine.md b/.changeset/wet-readers-shine.md new file mode 100644 index 0000000000..4edfe441e5 --- /dev/null +++ b/.changeset/wet-readers-shine.md @@ -0,0 +1,8 @@ +--- +"@rhds/elements": minor +--- +``: added `icon-set` attribute to better control icon loading + +```html +... +``` diff --git a/elements/rh-cta/README.md b/elements/rh-cta/README.md index 07df6d4b4c..f426df13bf 100644 --- a/elements/rh-cta/README.md +++ b/elements/rh-cta/README.md @@ -5,9 +5,7 @@ A Call to action is a styled link that directs a user to other pages or sometime As a link ```html - - Subscribe - +Subscribe ``` As a button @@ -16,3 +14,10 @@ As a button ``` + +With a slotted anchor +```html + + Subscribe + +``` diff --git a/elements/rh-cta/demo/analytics.html b/elements/rh-cta/demo/analytics.html index 612641e33e..dbc8024c0a 100644 --- a/elements/rh-cta/demo/analytics.html +++ b/elements/rh-cta/demo/analytics.html @@ -3,54 +3,116 @@ support for analytics internally, <rh-cta> users must implement their own analytics code, taking this demo as an example.

-

-function deepClosest(event, selector) {
-  for (const node of event.composedPath().reverse()) {
-    if (node.matches?.(selector)) {
-      return node;
-    }
-  }
-  return event.target.closest(selector);
-}
-
-document.addEventListener('click', function(event) {
-  const cta = deepClosest(event, 'rh-cta');
-  if (cta) {
-    const { href, text, title } = cta.cta;
-    const color = cta.colorPalette;
-    const type = cta.variant;
-    console.log('CTA ANALYTICS EVENT', { href, text, title, color, type });
-  }
-});
-
+
+

Simple Case: Light DOM

+ + Default + + + Primary + + + Secondary + + + Brick + -
-

Simple Case: Light DOM Analytics

- Default - Primary - Secondary - Brick +
+

Using href attribute

+ Default + Primary + Secondary + Brick +
-
-

Advanced Case: Deep Shadow Analytics

+
+

Advanced Case: Deep Shadow

-