diff --git a/assets/dsd-polyfill.js b/assets/dsd-polyfill.js new file mode 100644 index 0000000000..f31505d9f9 --- /dev/null +++ b/assets/dsd-polyfill.js @@ -0,0 +1,9 @@ +(function attachShadowRoots(root) { + root.querySelectorAll('template[shadowrootmode]').forEach(template => { + const mode = template.getAttribute('shadowrootmode'); + const shadowRoot = template.parentNode.attachShadow({ mode }); + shadowRoot.appendChild(template.content); + template.remove(); + attachShadowRoots(shadowRoot); + }); +})(document); diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/analytics.html b/assets/packages/@rhds/elements/elements/rh-cta/demo/analytics.html index 4654900c69..50cb54de64 100644 --- a/assets/packages/@rhds/elements/elements/rh-cta/demo/analytics.html +++ b/assets/packages/@rhds/elements/elements/rh-cta/demo/analytics.html @@ -1,12 +1,4 @@ - - - - - - - - -

In this demo, analytics events involving <rh-cta> elements are parsed by a +

In this demo, analytics events involving <rh-cta> elements are parsed by a document-level analytics event listener. Unlike <pfe-cta>, which implemented support for analytics internally, <rh-cta> users must implement their own analytics code, taking this demo as an example.

@@ -64,3 +56,61 @@

Complex Case: Slotted Link, Deep CTA Analytics

Last CTA Analytics Event

{} + + + + + + + + diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/analytics.js b/assets/packages/@rhds/elements/elements/rh-cta/demo/analytics.js deleted file mode 100644 index 3e204fdc36..0000000000 --- a/assets/packages/@rhds/elements/elements/rh-cta/demo/analytics.js +++ /dev/null @@ -1,38 +0,0 @@ -import 'https://ga.jspm.io/npm:prismjs@1.29.0/prism.js'; -import 'https://ga.jspm.io/npm:prismjs@1.29.0/plugins/autoloader/prism-autoloader.js'; -import 'https://ga.jspm.io/npm:@power-elements/json-viewer@2.1.1/json-viewer.js'; - -customElements.define('slotted-link', class SlottedLinkElement extends HTMLElement { - constructor() { - super(); - this.attachShadow({ mode: 'open' }).innerHTML = /* html */` - - - - - `; - } -}); - -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 ?? 'default'; - const data = { href, text, title, color, type }; - // for the purposes of the demo, let's enable console logging here - // eslint-disable-next-line no-console - console.log('CTA ANALYTICS EVENT', data); - document.querySelector('json-viewer').object = data; - } -}); diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/brick.html b/assets/packages/@rhds/elements/elements/rh-cta/demo/brick.html new file mode 100644 index 0000000000..d36f37c1d4 --- /dev/null +++ b/assets/packages/@rhds/elements/elements/rh-cta/demo/brick.html @@ -0,0 +1,20 @@ +
+ Link #1 + Link #2 + Link #3 + + Supercalifragilisticexpialidocious + +
+ + + + diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/button.html b/assets/packages/@rhds/elements/elements/rh-cta/demo/button.html new file mode 100644 index 0000000000..5969067c3d --- /dev/null +++ b/assets/packages/@rhds/elements/elements/rh-cta/demo/button.html @@ -0,0 +1,46 @@ +
+

Links

+ + Link + + + + Link + + + + Link + +
+ +
+

Buttons

+ + + + + + + + + + + +
+ + + + diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/color-context.html b/assets/packages/@rhds/elements/elements/rh-cta/demo/color-context.html index 1a29c48f53..cf7f27ce73 100644 --- a/assets/packages/@rhds/elements/elements/rh-cta/demo/color-context.html +++ b/assets/packages/@rhds/elements/elements/rh-cta/demo/color-context.html @@ -1,6 +1,6 @@ + -

Dark Colour Context

Default Default Video Primary @@ -10,11 +10,22 @@

Dark Colour Context

Brick Video
- - - - + + diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/demo.css b/assets/packages/@rhds/elements/elements/rh-cta/demo/demo.css deleted file mode 100644 index afdf8e8ccb..0000000000 --- a/assets/packages/@rhds/elements/elements/rh-cta/demo/demo.css +++ /dev/null @@ -1,56 +0,0 @@ -[data-demo] { - padding: 1em 2em; -} - -section, -#dark { - display: flex; - flex-flow: row wrap; - gap: 16px; -} - -#dark { - padding: 1em 2em; - margin-inline: -2em; - margin-block: 1em; -} - -#dark h2 { - width: 100%; -} - -section :is(p, h2,h3,h4,h5,h6) { - width: 100%; -} - -section.grid { - display: grid; - gap: 10px 20px; - grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); - margin-top: 0; - margin-left: 0; -} - -section.grid :is(h2,h3,h4,h5,h6) { - grid-column: 1/-1; -} - -.resize { - resize: horizontal; - overflow: auto; - display: flex; - width: 180px; - flex-flow: row nowrap; - border: 1px solid #dddddd; - padding: 10px; -} - -json-viewer { - --json-viewer-background: white; - --json-viewer-boolean-color: #f76707; - --json-viewer-color: black; - --json-viewer-key-color: #f76707; - --json-viewer-null-color: Light #e03131; - --json-viewer-number-color: #0ca678; - --json-viewer-string-color: #0c8599; -} diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/resizing.html b/assets/packages/@rhds/elements/elements/rh-cta/demo/resizing.html new file mode 100644 index 0000000000..a1784dbf91 --- /dev/null +++ b/assets/packages/@rhds/elements/elements/rh-cta/demo/resizing.html @@ -0,0 +1,125 @@ +
+
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +

No matter the container size, the arrow trailing the CTA message should never appear on a line by itself.

+ +
+ Default link cta with longer text +
+ +
+ + קריאה לפעולה בררית מחדל עם טקסט ארוך + +
+ +

Long words should break in the middle

+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+
+ + + + diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/rh-cta.html b/assets/packages/@rhds/elements/elements/rh-cta/demo/rh-cta.html index 546f8be200..1aac713fd4 100644 --- a/assets/packages/@rhds/elements/elements/rh-cta/demo/rh-cta.html +++ b/assets/packages/@rhds/elements/elements/rh-cta/demo/rh-cta.html @@ -1,160 +1,7 @@ - - - - + + Call to Action + -
-

Variants

- Default - Default Video - Primary - Video - Secondary - Brick - Brick Icon -
- - -

Dark Colour Context

- Default - Default Video - Primary - Video - Secondary - Brick - Brick Icon -
- -
-

Right-to-Left Languages

- ברירת מחדל - ברירת מחדל - וידאו - ראשי - ראשי - וידאו - משני - לבנה - לבנה עם אייקון -
- -
-

Deep Shadow RTL

-

When the CTA is found within the shadow root of an element which is itself within a RTL context.

- - - -
- -
-

Resizing

-
- Get product details -
-
-
- Get product details -
-
-
- Get product details -
-
-
- Get product details -
-
-
- Get product details -
-
-
- Get product details -
-
-
- Get product details -
-
- -
-

Extra-long words

-
- - Supercalifragilisticexpialidocious - -
-
-
- - Supercalifragilisticexpialidocious - -
-
-
- - Supercalifragilisticexpialidocious - -
-
-
- - Supercalifragilisticexpialidocious - -
-
-
- - Supercalifragilisticexpialidocious - -
-
-
- - Supercalifragilisticexpialidocious - -
-
-
- - Supercalifragilisticexpialidocious - -
-
- -
-

Force wrap to test arrow line-wrap

-

No matter the container size, the arrow trailing the CTA message should never appear on a line by itself.

-
- Default link cta with longer text -
-
- קריאה לפעולה בררית מחדל עם טקסט ארוך -
-
- - + diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/rh-cta.js b/assets/packages/@rhds/elements/elements/rh-cta/demo/rh-cta.js deleted file mode 100644 index 89f70bbb9c..0000000000 --- a/assets/packages/@rhds/elements/elements/rh-cta/demo/rh-cta.js +++ /dev/null @@ -1,23 +0,0 @@ -import '@patternfly/elements/pf-panel/pf-panel.js'; -import '@patternfly/elements/pf-card/pf-card.js'; -import '@rhds/elements/rh-cta/rh-cta.js'; - -import '@rhds/elements/lib/elements/rh-context-provider/rh-context-provider.js'; - -const root = document.querySelector('[data-demo="rh-cta"]')?.shadowRoot ?? document; - -root.querySelector('rh-cta'); - -/** - * Polyfill declarative shadow dom. - * @see https://web.dev/declarative-shadow-dom/ - */ -(function attachShadowRoots(root) { - root.querySelectorAll('template[shadowroot]').forEach(template => { - const mode = template.getAttribute('shadowroot'); - const shadowRoot = template.parentNode.attachShadow({ mode }); - shadowRoot.appendChild(template.content); - template.remove(); - attachShadowRoots(shadowRoot); - }); -})(document); diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/right-to-left.html b/assets/packages/@rhds/elements/elements/rh-cta/demo/right-to-left.html new file mode 100644 index 0000000000..2ef1b5d523 --- /dev/null +++ b/assets/packages/@rhds/elements/elements/rh-cta/demo/right-to-left.html @@ -0,0 +1,118 @@ +
+
+

Right-to-Left Languages

+
+ +
+ + ברירת מחדל + + + + ברירת מחדל - וידאו + + + + ראשי + + + + ראשי - וידאו + + + + משני + + + + לבנה + + + + לבנה עם אייקון + +
+
+ +
+
+

Deep Shadow RTL

+

+ When the CTA is found within the shadow root of an element which is itself within a RTL context, + it's own contents should also be displayed right-to-left, including the various box models, the placement + of the icon, and the direction of the arrow. Authors should not need to specify the direction with the + dir="rtl" attribute if it is added to a containing element. + In this demo, the shadow root's host element has a light blue background colour, in order distinguish it from the document content. +

+
+ + + +
+ + + + + diff --git a/assets/packages/@rhds/elements/elements/rh-cta/demo/variants.html b/assets/packages/@rhds/elements/elements/rh-cta/demo/variants.html new file mode 100644 index 0000000000..f12445354a --- /dev/null +++ b/assets/packages/@rhds/elements/elements/rh-cta/demo/variants.html @@ -0,0 +1,51 @@ +
+ + Default + + + + Default Video + + + + Primary + + + + Video + + + + Secondary + + +
+ + Brick + + + Brick Icon + +
+
+ + + + + diff --git a/assets/packages/@rhds/elements/elements/rh-cta/rh-cta.css b/assets/packages/@rhds/elements/elements/rh-cta/rh-cta.css index cbeb71ffbb..df8e5bca94 100644 --- a/assets/packages/@rhds/elements/elements/rh-cta/rh-cta.css +++ b/assets/packages/@rhds/elements/elements/rh-cta/rh-cta.css @@ -314,6 +314,12 @@ svg { * BRICK *****************************************************************************/ +:host([variant="brick"]) { + display: inline-block !important; + max-width: 100%; + width: 100%; +} + :host([variant="brick"]) #container { border-style: solid; font-family: var(--rh-font-family-body-text, RedHatText, "Red Hat Text", "Noto Sans Arabic", "Noto Sans Hebrew", "Noto Sans JP", "Noto Sans KR", "Noto Sans Malayalam", "Noto Sans SC", "Noto Sans TC", "Noto Sans Thai", Helvetica, Arial, sans-serif); diff --git a/assets/playgrounds/rh-cta-playground.js b/assets/playgrounds/rh-cta-playground.js index 6f2e7d9397..f0be1b9524 100644 --- a/assets/playgrounds/rh-cta-playground.js +++ b/assets/playgrounds/rh-cta-playground.js @@ -8,52 +8,54 @@ export const configure = project => project.config = { "demo/index.html": { "contentType": "text/html", "selected": true, - "content": "\n\n\n\n\n
\n

Variants

\n Default\n Default Video\n Primary\n Video\n Secondary\n Brick\n Brick Icon\n
\n\n\n

Dark Colour Context

\n Default\n Default Video\n Primary\n Video\n Secondary\n Brick\n Brick Icon\n
\n\n
\n

Right-to-Left Languages

\n ברירת מחדל\n ברירת מחדל - וידאו\n ראשי\n ראשי - וידאו\n משני\n לבנה\n לבנה עם אייקון\n
\n\n
\n

Deep Shadow RTL

\n

When the CTA is found within the shadow root of an element which is itself within a RTL context.

\n \n \n \n
\n\n
\n

Resizing

\n
\n Get product details\n
\n
\n
\n Get product details\n
\n
\n
\n Get product details\n
\n
\n
\n Get product details\n
\n
\n
\n Get product details\n
\n
\n
\n Get product details\n
\n
\n
\n Get product details\n
\n
\n\n
\n

Extra-long words

\n
\n \n Supercalifragilisticexpialidocious\n \n
\n
\n
\n \n Supercalifragilisticexpialidocious\n \n
\n
\n
\n \n Supercalifragilisticexpialidocious\n \n
\n
\n
\n \n Supercalifragilisticexpialidocious\n \n
\n
\n
\n \n Supercalifragilisticexpialidocious\n \n
\n
\n
\n \n Supercalifragilisticexpialidocious\n \n
\n
\n
\n \n Supercalifragilisticexpialidocious\n \n
\n
\n\n
\n

Force wrap to test arrow line-wrap

\n

No matter the container size, the arrow trailing the CTA message should never appear on a line by itself.

\n
\n Default link cta with longer text\n
\n
\n קריאה לפעולה בררית מחדל עם טקסט ארוך\n
\n
\n\n\n", + "content": "\n Call to Action\n\n\n\n", "label": "Call to action" }, - "demo/demo.css": { - "content": "[data-demo] {\n padding: 1em 2em;\n}\n\nsection,\n#dark {\n display: flex;\n flex-flow: row wrap;\n gap: 16px;\n}\n\n#dark {\n padding: 1em 2em;\n margin-inline: -2em;\n margin-block: 1em;\n}\n\n#dark h2 {\n width: 100%;\n}\n\nsection :is(p, h2,h3,h4,h5,h6) {\n width: 100%;\n}\n\nsection.grid {\n display: grid;\n gap: 10px 20px;\n grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));\n margin-top: 0;\n margin-left: 0;\n}\n\nsection.grid :is(h2,h3,h4,h5,h6) {\n grid-column: 1/-1;\n}\n\n.resize {\n resize: horizontal;\n overflow: auto;\n display: flex;\n width: 180px;\n flex-flow: row nowrap;\n border: 1px solid #dddddd;\n padding: 10px;\n}\n\njson-viewer {\n --json-viewer-background: white;\n --json-viewer-boolean-color: #f76707;\n --json-viewer-color: black;\n --json-viewer-key-color: #f76707;\n --json-viewer-null-color: Light #e03131;\n --json-viewer-number-color: #0ca678;\n --json-viewer-string-color: #0c8599;\n}\n", - "hidden": true - }, - "demo/rh-cta.js": { - "content": "import '@patternfly/elements/pf-panel/pf-panel.js';\nimport '@patternfly/elements/pf-card/pf-card.js';\nimport '@rhds/elements/rh-cta/rh-cta.js';\n\nimport '@rhds/elements/lib/elements/rh-context-provider/rh-context-provider.js';\n\nconst root = document.querySelector('[data-demo=\"rh-cta\"]')?.shadowRoot ?? document;\n\nroot.querySelector('rh-cta');\n\n/**\n * Polyfill declarative shadow dom.\n * @see https://web.dev/declarative-shadow-dom/\n */\n(function attachShadowRoots(root) {\n root.querySelectorAll('template[shadowroot]').forEach(template => {\n const mode = template.getAttribute('shadowroot');\n const shadowRoot = template.parentNode.attachShadow({ mode });\n shadowRoot.appendChild(template.content);\n template.remove();\n attachShadowRoots(shadowRoot);\n });\n})(document);\n", - "hidden": true - }, "demo/analytics/index.html": { "contentType": "text/html", "selected": false, - "content": "\n\n\n\n\n\n\n\n

In this demo, analytics events involving <rh-cta> elements are parsed by a \n document-level analytics event listener. Unlike <pfe-cta>, which implemented\n support for analytics internally, <rh-cta> users must implement their own\n analytics code, taking this demo as an example.

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

Simple Case: Light DOM Analytics

\n Default\n Primary\n Secondary\n Brick\n
\n\n
\n

Advanced Case: Deep Shadow Analytics

\n \n \n \n
\n\n
\n

Complex Case: Slotted Link, Deep CTA Analytics

\n \n Default\n Primary\n Secondary\n Brick\n \n
\n\n

Last CTA Analytics Event

\n{}\n", + "content": "

In this demo, analytics events involving <rh-cta> elements are parsed by a\n document-level analytics event listener. Unlike <pfe-cta>, which implemented\n support for analytics internally, <rh-cta> users must implement their own\n analytics code, taking this demo as an example.

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

Simple Case: Light DOM Analytics

\n Default\n Primary\n Secondary\n Brick\n
\n\n
\n

Advanced Case: Deep Shadow Analytics

\n \n \n \n
\n\n
\n

Complex Case: Slotted Link, Deep CTA Analytics

\n \n Default\n Primary\n Secondary\n Brick\n \n
\n\n

Last CTA Analytics Event

\n{}\n\n\n\n\n\n\n\n\n", "label": "Analytics" }, - "demo/analytics/demo.css": { - "content": "[data-demo] {\n padding: 1em 2em;\n}\n\nsection,\n#dark {\n display: flex;\n flex-flow: row wrap;\n gap: 16px;\n}\n\n#dark {\n padding: 1em 2em;\n margin-inline: -2em;\n margin-block: 1em;\n}\n\n#dark h2 {\n width: 100%;\n}\n\nsection :is(p, h2,h3,h4,h5,h6) {\n width: 100%;\n}\n\nsection.grid {\n display: grid;\n gap: 10px 20px;\n grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));\n margin-top: 0;\n margin-left: 0;\n}\n\nsection.grid :is(h2,h3,h4,h5,h6) {\n grid-column: 1/-1;\n}\n\n.resize {\n resize: horizontal;\n overflow: auto;\n display: flex;\n width: 180px;\n flex-flow: row nowrap;\n border: 1px solid #dddddd;\n padding: 10px;\n}\n\njson-viewer {\n --json-viewer-background: white;\n --json-viewer-boolean-color: #f76707;\n --json-viewer-color: black;\n --json-viewer-key-color: #f76707;\n --json-viewer-null-color: Light #e03131;\n --json-viewer-number-color: #0ca678;\n --json-viewer-string-color: #0c8599;\n}\n", - "hidden": true - }, "demo/analytics/assets/prism.css": { "content": "/* PrismJS 1.21.0\n * prism.js default theme for JavaScript, CSS and HTML\n * Based on dabblet (http://dabblet.com)\n * @author Lea Verou\n * @see https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+jsx&plugins=toolbar+copy-to-clipboard\n */\n\n:is(code, pre)[class*=\"language-\"] {\n color: black;\n background: none;\n text-shadow: 0 1px white;\n font-family: var(--rh-font-family-code);\n font-size: 1em;\n text-align: left;\n white-space: pre;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n line-height: 1.5;\n tab-size: 4;\n hyphens: none;\n}\n \npre[class*=\"language-\"]::selection,\npre[class*=\"language-\"] ::selection,\ncode[class*=\"language-\"]::selection,\ncode[class*=\"language-\"] ::selection {\n text-shadow: none;\n background: #b3d4fc;\n}\n \n@media print {\n code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n text-shadow: none;\n }\n}\n \n/* Code blocks */\npre[class*=\"language-\"] {\n padding: 1em;\n margin: 0.5em 0;\n overflow: auto;\n}\n \n:not(pre) > code[class*=\"language-\"],\npre[class*=\"language-\"] {\n background: #f5f5f5;\n}\n \n/* Inline code */\n:not(pre) > code[class*=\"language-\"] {\n padding: 0.1em;\n border-radius: 0.3em;\n white-space: normal;\n}\n \n.token.comment,\n.token.prolog,\n.token.doctype,\n.token.cdata {\n color: slategray;\n}\n \n.token.punctuation {\n color: #999999;\n}\n \n.token.namespace {\n opacity: 0.7;\n}\n \n.token.property,\n.token.tag,\n.token.boolean,\n.token.number,\n.token.constant,\n.token.symbol,\n.token.deleted {\n color: #990055;\n}\n \n.token.selector,\n.token.attr-name,\n.token.string,\n.token.char,\n.token.builtin,\n.token.inserted {\n color: #669900;\n}\n \n.token.operator,\n.token.entity,\n.token.url,\n.language-css .token.string,\n.style .token.string {\n color: #9a6e3a;\n\n /* This background color was intended by the author of this theme. */\n background: hsla(0deg, 0%, 100%, 0.5);\n}\n \n.token.atrule,\n.token.attr-value,\n.token.keyword {\n color: #0077aa;\n}\n \n.token.function,\n.token.class-name {\n color: #dd4a68;\n}\n \n.token.regex,\n.token.important,\n.token.variable {\n color: #ee9900;\n}\n \n.token.important,\n.token.bold {\n font-weight: bold;\n}\n\n.token.italic {\n font-style: italic;\n}\n \n.token.entity {\n cursor: help;\n}\n \ndiv.code-toolbar {\n position: relative;\n overflow: auto;\n}\n \ndiv.code-toolbar > .toolbar {\n position: absolute;\n top: 0.6em;\n right: 0.3em;\n transition: opacity 0.3s ease-in-out;\n opacity: 0;\n}\n \ndiv.code-toolbar:hover > .toolbar {\n opacity: 1;\n}\n \n/* Separate line b/c rules are thrown out if selector is invalid.\n\t\tIE11 and old Edge versions don't support :focus-within. */\ndiv.code-toolbar:focus-within > .toolbar {\n opacity: 1;\n}\n \ndiv.code-toolbar > .toolbar .toolbar-item {\n display: inline-block;\n}\n \ndiv.code-toolbar > .toolbar a {\n cursor: pointer;\n}\n \ndiv.code-toolbar > .toolbar button {\n background: none;\n border: 0;\n color: inherit;\n font: inherit;\n line-height: normal;\n overflow: visible;\n padding: 0; /* for button */\n user-select: none;\n}\n \ndiv.code-toolbar > .toolbar a,\ndiv.code-toolbar > .toolbar button,\ndiv.code-toolbar > .toolbar span {\n color: #bbbbbb;\n font-size: 0.8em;\n padding: 0 0.5em;\n background: #f5f2f0;\n background: rgba(224, 224, 224, 0.2);\n\n /* box-shadow: 0 2px 0 0 rgba(0,0,0,0.2); */\n\n /* border-radius: .5em; */\n border: 1px solid #cccccc;\n}\n \ndiv.code-toolbar > .toolbar a:hover,\ndiv.code-toolbar > .toolbar a:focus,\ndiv.code-toolbar > .toolbar button:hover,\ndiv.code-toolbar > .toolbar button:focus,\ndiv.code-toolbar > .toolbar span:hover,\ndiv.code-toolbar > .toolbar span:focus {\n color: inherit;\n text-decoration: none;\n}\n \n \n", "hidden": true }, - "demo/analytics/rh-cta.js": { - "content": "import '@patternfly/elements/pf-panel/pf-panel.js';\nimport '@patternfly/elements/pf-card/pf-card.js';\nimport '@rhds/elements/rh-cta/rh-cta.js';\n\nimport '@rhds/elements/lib/elements/rh-context-provider/rh-context-provider.js';\n\nconst root = document.querySelector('[data-demo=\"rh-cta\"]')?.shadowRoot ?? document;\n\nroot.querySelector('rh-cta');\n\n/**\n * Polyfill declarative shadow dom.\n * @see https://web.dev/declarative-shadow-dom/\n */\n(function attachShadowRoots(root) {\n root.querySelectorAll('template[shadowroot]').forEach(template => {\n const mode = template.getAttribute('shadowroot');\n const shadowRoot = template.parentNode.attachShadow({ mode });\n shadowRoot.appendChild(template.content);\n template.remove();\n attachShadowRoots(shadowRoot);\n });\n})(document);\n", - "hidden": true + "demo/brick/index.html": { + "contentType": "text/html", + "selected": false, + "content": "
\n Link #1\n Link #2\n Link #3\n \n Supercalifragilisticexpialidocious\n \n
\n\n\n\n\n", + "label": "Brick" }, - "demo/analytics/analytics.js": { - "content": "import 'https://ga.jspm.io/npm:prismjs@1.29.0/prism.js';\nimport 'https://ga.jspm.io/npm:prismjs@1.29.0/plugins/autoloader/prism-autoloader.js';\nimport 'https://ga.jspm.io/npm:@power-elements/json-viewer@2.1.1/json-viewer.js';\n\ncustomElements.define('slotted-link', class SlottedLinkElement extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' }).innerHTML = /* html */`\n \n \n \n \n `;\n }\n});\n\nfunction deepClosest(event, selector) {\n for (const node of event.composedPath().reverse()) {\n if (node.matches?.(selector)) {\n return node;\n }\n }\n return event.target.closest(selector);\n}\n\ndocument.addEventListener('click', function(event) {\n const cta = deepClosest(event, 'rh-cta');\n if (cta) {\n const { href, text, title } = cta.cta;\n const color = cta.colorPalette;\n const type = cta.variant ?? 'default';\n const data = { href, text, title, color, type };\n // for the purposes of the demo, let's enable console logging here\n // eslint-disable-next-line no-console\n console.log('CTA ANALYTICS EVENT', data);\n document.querySelector('json-viewer').object = data;\n }\n});\n", - "hidden": true + "demo/button/index.html": { + "contentType": "text/html", + "selected": false, + "content": "
\n

Links

\n \n Link\n \n\n \n Link\n \n\n \n Link\n \n
\n\n
\n

Buttons

\n \n \n \n\n \n \n \n\n \n \n \n
\n\n\n\n\n", + "label": "Button" }, "demo/color-context/index.html": { "contentType": "text/html", "selected": false, - "content": "\n\n

Dark Colour Context

\n Default\n Default Video\n Primary\n Video\n Secondary\n Brick\n Brick Video\n
\n\n\n\n\n\n\n\n", + "content": "\n\n\n Default\n Default Video\n Primary\n Video\n Secondary\n Brick\n Brick Video\n\n\n\n\n\n\n", "label": "Color Context" }, - "demo/color-context/demo.css": { - "content": "[data-demo] {\n padding: 1em 2em;\n}\n\nsection,\n#dark {\n display: flex;\n flex-flow: row wrap;\n gap: 16px;\n}\n\n#dark {\n padding: 1em 2em;\n margin-inline: -2em;\n margin-block: 1em;\n}\n\n#dark h2 {\n width: 100%;\n}\n\nsection :is(p, h2,h3,h4,h5,h6) {\n width: 100%;\n}\n\nsection.grid {\n display: grid;\n gap: 10px 20px;\n grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));\n margin-top: 0;\n margin-left: 0;\n}\n\nsection.grid :is(h2,h3,h4,h5,h6) {\n grid-column: 1/-1;\n}\n\n.resize {\n resize: horizontal;\n overflow: auto;\n display: flex;\n width: 180px;\n flex-flow: row nowrap;\n border: 1px solid #dddddd;\n padding: 10px;\n}\n\njson-viewer {\n --json-viewer-background: white;\n --json-viewer-boolean-color: #f76707;\n --json-viewer-color: black;\n --json-viewer-key-color: #f76707;\n --json-viewer-null-color: Light #e03131;\n --json-viewer-number-color: #0ca678;\n --json-viewer-string-color: #0c8599;\n}\n", - "hidden": true + "demo/resizing/index.html": { + "contentType": "text/html", + "selected": false, + "content": "
\n
\n \n Get product details\n \n
\n\n
\n \n Get product details\n \n
\n\n
\n \n Get product details\n \n
\n\n
\n \n Get product details\n \n
\n\n
\n \n Get product details\n \n
\n\n
\n \n Get product details\n \n
\n\n
\n \n Get product details\n \n
\n\n

No matter the container size, the arrow trailing the CTA message should never appear on a line by itself.

\n\n
\n Default link cta with longer text\n
\n\n
\n \n קריאה לפעולה בררית מחדל עם טקסט ארוך\n \n
\n\n

Long words should break in the middle

\n\n
\n \n Supercalifragilisticexpialidocious\n \n
\n\n
\n \n Supercalifragilisticexpialidocious\n \n
\n\n
\n \n Supercalifragilisticexpialidocious\n \n
\n\n
\n \n Supercalifragilisticexpialidocious\n \n
\n\n
\n \n Supercalifragilisticexpialidocious\n \n
\n\n
\n \n Supercalifragilisticexpialidocious\n \n
\n\n
\n \n Supercalifragilisticexpialidocious\n \n
\n
\n\n\n\n\n", + "label": "Resizing" }, - "demo/color-context/rh-cta.js": { - "content": "import '@patternfly/elements/pf-panel/pf-panel.js';\nimport '@patternfly/elements/pf-card/pf-card.js';\nimport '@rhds/elements/rh-cta/rh-cta.js';\n\nimport '@rhds/elements/lib/elements/rh-context-provider/rh-context-provider.js';\n\nconst root = document.querySelector('[data-demo=\"rh-cta\"]')?.shadowRoot ?? document;\n\nroot.querySelector('rh-cta');\n\n/**\n * Polyfill declarative shadow dom.\n * @see https://web.dev/declarative-shadow-dom/\n */\n(function attachShadowRoots(root) {\n root.querySelectorAll('template[shadowroot]').forEach(template => {\n const mode = template.getAttribute('shadowroot');\n const shadowRoot = template.parentNode.attachShadow({ mode });\n shadowRoot.appendChild(template.content);\n template.remove();\n attachShadowRoots(shadowRoot);\n });\n})(document);\n", - "hidden": true + "demo/right-to-left/index.html": { + "contentType": "text/html", + "selected": false, + "content": "
\n
\n

Right-to-Left Languages

\n
\n\n
\n \n ברירת מחדל\n \n\n \n ברירת מחדל - וידאו\n \n\n \n ראשי\n \n\n \n ראשי - וידאו\n \n\n \n משני\n \n\n \n לבנה\n \n\n \n לבנה עם אייקון\n \n
\n
\n\n
\n
\n

Deep Shadow RTL

\n

\n When the CTA is found within the shadow root of an element which is itself within a RTL context,\n it's own contents should also be displayed right-to-left, including the various box models, the placement\n of the icon, and the direction of the arrow. Authors should not need to specify the direction with the\n dir=\"rtl\" attribute if it is added to a containing element.\n In this demo, the shadow root's host element has a light blue background colour, in order distinguish it from the document content.\n

\n
\n \n \n \n
\n\n\n\n\n\n", + "label": "Right To Left" + }, + "demo/variants/index.html": { + "contentType": "text/html", + "selected": false, + "content": "
\n \n Default\n \n\n \n Default Video\n \n\n \n Primary\n \n\n \n Video\n \n\n \n Secondary\n \n\n
\n \n Brick\n \n \n Brick Icon\n \n
\n
\n\n\n\n\n\n", + "label": "Variants" } } }; \ No newline at end of file diff --git a/elements/call-to-action/demo/analytics.js b/elements/call-to-action/demo/analytics.js deleted file mode 100644 index 3e204fdc36..0000000000 --- a/elements/call-to-action/demo/analytics.js +++ /dev/null @@ -1,38 +0,0 @@ -import 'https://ga.jspm.io/npm:prismjs@1.29.0/prism.js'; -import 'https://ga.jspm.io/npm:prismjs@1.29.0/plugins/autoloader/prism-autoloader.js'; -import 'https://ga.jspm.io/npm:@power-elements/json-viewer@2.1.1/json-viewer.js'; - -customElements.define('slotted-link', class SlottedLinkElement extends HTMLElement { - constructor() { - super(); - this.attachShadow({ mode: 'open' }).innerHTML = /* html */` - - - - - `; - } -}); - -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 ?? 'default'; - const data = { href, text, title, color, type }; - // for the purposes of the demo, let's enable console logging here - // eslint-disable-next-line no-console - console.log('CTA ANALYTICS EVENT', data); - document.querySelector('json-viewer').object = data; - } -}); diff --git a/elements/call-to-action/demo/analytics/index.html b/elements/call-to-action/demo/analytics/index.html index 57f48436bf..b058dcd3f4 100644 --- a/elements/call-to-action/demo/analytics/index.html +++ b/elements/call-to-action/demo/analytics/index.html @@ -19,15 +19,7 @@
-
- - - - - - - -

In this demo, analytics events involving <rh-cta> elements are parsed by a +

In this demo, analytics events involving <rh-cta> elements are parsed by a document-level analytics event listener. Unlike <pfe-cta>, which implemented support for analytics internally, <rh-cta> users must implement their own analytics code, taking this demo as an example.

@@ -85,6 +77,64 @@

Complex Case: Slotted Link, Deep CTA Analytics

Last CTA Analytics Event

{} + + + + + + + +
diff --git a/elements/call-to-action/demo/brick/index.html b/elements/call-to-action/demo/brick/index.html new file mode 100644 index 0000000000..ed0010758e --- /dev/null +++ b/elements/call-to-action/demo/brick/index.html @@ -0,0 +1,46 @@ + + + + + Brick | Red Hat Design System + + + + + + + + + + + + +
+
+ + + + +
+
+ + + \ No newline at end of file diff --git a/elements/call-to-action/demo/button/index.html b/elements/call-to-action/demo/button/index.html new file mode 100644 index 0000000000..22401da144 --- /dev/null +++ b/elements/call-to-action/demo/button/index.html @@ -0,0 +1,72 @@ + + + + + Button | Red Hat Design System + + + + + + + + + + + + +
+
+

Links

+ + Link + + + + Link + + + + Link + +
+ +
+

Buttons

+ + + + + + + + + + + +
+ + + + +
+
+ + + \ No newline at end of file diff --git a/elements/call-to-action/demo/color-context/index.html b/elements/call-to-action/demo/color-context/index.html index 65f37ad5fc..0bba469f3a 100644 --- a/elements/call-to-action/demo/color-context/index.html +++ b/elements/call-to-action/demo/color-context/index.html @@ -20,8 +20,8 @@
+ -

Dark Colour Context

Default Default Video Primary @@ -31,14 +31,25 @@

Dark Colour Context

Brick Video
- - - - + +
diff --git a/elements/call-to-action/demo/demo.css b/elements/call-to-action/demo/demo.css deleted file mode 100644 index afdf8e8ccb..0000000000 --- a/elements/call-to-action/demo/demo.css +++ /dev/null @@ -1,56 +0,0 @@ -[data-demo] { - padding: 1em 2em; -} - -section, -#dark { - display: flex; - flex-flow: row wrap; - gap: 16px; -} - -#dark { - padding: 1em 2em; - margin-inline: -2em; - margin-block: 1em; -} - -#dark h2 { - width: 100%; -} - -section :is(p, h2,h3,h4,h5,h6) { - width: 100%; -} - -section.grid { - display: grid; - gap: 10px 20px; - grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); - margin-top: 0; - margin-left: 0; -} - -section.grid :is(h2,h3,h4,h5,h6) { - grid-column: 1/-1; -} - -.resize { - resize: horizontal; - overflow: auto; - display: flex; - width: 180px; - flex-flow: row nowrap; - border: 1px solid #dddddd; - padding: 10px; -} - -json-viewer { - --json-viewer-background: white; - --json-viewer-boolean-color: #f76707; - --json-viewer-color: black; - --json-viewer-key-color: #f76707; - --json-viewer-null-color: Light #e03131; - --json-viewer-number-color: #0ca678; - --json-viewer-string-color: #0c8599; -} diff --git a/elements/call-to-action/demo/index.html b/elements/call-to-action/demo/index.html index e44821baca..0a28c79a7d 100644 --- a/elements/call-to-action/demo/index.html +++ b/elements/call-to-action/demo/index.html @@ -19,166 +19,13 @@
-
- - - +
+ Call to Action + -
-

Variants

- Default - Default Video - Primary - Video - Secondary - Brick - Brick Icon -
- - -

Dark Colour Context

- Default - Default Video - Primary - Video - Secondary - Brick - Brick Icon -
- -
-

Right-to-Left Languages

- ברירת מחדל - ברירת מחדל - וידאו - ראשי - ראשי - וידאו - משני - לבנה - לבנה עם אייקון -
- -
-

Deep Shadow RTL

-

When the CTA is found within the shadow root of an element which is itself within a RTL context.

- - - -
- -
-

Resizing

- -
- -
- -
- -
- -
- -
- -
- -
-

Extra-long words

- -
- -
- -
- -
- -
- -
- -
- -
-

Force wrap to test arrow line-wrap

-

No matter the container size, the arrow trailing the CTA message should never appear on a line by itself.

- - -
- - +
diff --git a/elements/call-to-action/demo/resizing/index.html b/elements/call-to-action/demo/resizing/index.html new file mode 100644 index 0000000000..ca351b09ec --- /dev/null +++ b/elements/call-to-action/demo/resizing/index.html @@ -0,0 +1,151 @@ + + + + + Resizing | Red Hat Design System + + + + + + + + + + + + +
+
+
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +
+ + Get product details + +
+ +

No matter the container size, the arrow trailing the CTA message should never appear on a line by itself.

+ +
+ Default link cta with longer text +
+ +
+ + קריאה לפעולה בררית מחדל עם טקסט ארוך + +
+ +

Long words should break in the middle

+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+ +
+ + Supercalifragilisticexpialidocious + +
+
+ + + + +
+
+ + + \ No newline at end of file diff --git a/elements/call-to-action/demo/rh-cta.js b/elements/call-to-action/demo/rh-cta.js deleted file mode 100644 index 89f70bbb9c..0000000000 --- a/elements/call-to-action/demo/rh-cta.js +++ /dev/null @@ -1,23 +0,0 @@ -import '@patternfly/elements/pf-panel/pf-panel.js'; -import '@patternfly/elements/pf-card/pf-card.js'; -import '@rhds/elements/rh-cta/rh-cta.js'; - -import '@rhds/elements/lib/elements/rh-context-provider/rh-context-provider.js'; - -const root = document.querySelector('[data-demo="rh-cta"]')?.shadowRoot ?? document; - -root.querySelector('rh-cta'); - -/** - * Polyfill declarative shadow dom. - * @see https://web.dev/declarative-shadow-dom/ - */ -(function attachShadowRoots(root) { - root.querySelectorAll('template[shadowroot]').forEach(template => { - const mode = template.getAttribute('shadowroot'); - const shadowRoot = template.parentNode.attachShadow({ mode }); - shadowRoot.appendChild(template.content); - template.remove(); - attachShadowRoots(shadowRoot); - }); -})(document); diff --git a/elements/call-to-action/demo/right-to-left/index.html b/elements/call-to-action/demo/right-to-left/index.html new file mode 100644 index 0000000000..5fadf87618 --- /dev/null +++ b/elements/call-to-action/demo/right-to-left/index.html @@ -0,0 +1,144 @@ + + + + + Right To Left | Red Hat Design System + + + + + + + + + + + + +
+
+
+

Right-to-Left Languages

+
+ +
+ + ברירת מחדל + + + + ברירת מחדל - וידאו + + + + ראשי + + + + ראשי - וידאו + + + + משני + + + + לבנה + + + + לבנה עם אייקון + +
+
+ +
+
+

Deep Shadow RTL

+

+ When the CTA is found within the shadow root of an element which is itself within a RTL context, + it's own contents should also be displayed right-to-left, including the various box models, the placement + of the icon, and the direction of the arrow. Authors should not need to specify the direction with the + dir="rtl" attribute if it is added to a containing element. + In this demo, the shadow root's host element has a light blue background colour, in order distinguish it from the document content. +

+
+ + + +
+ + + + + +
+
+ + + \ No newline at end of file diff --git a/elements/call-to-action/demo/variants/index.html b/elements/call-to-action/demo/variants/index.html new file mode 100644 index 0000000000..7d78b49385 --- /dev/null +++ b/elements/call-to-action/demo/variants/index.html @@ -0,0 +1,77 @@ + + + + + Variants | Red Hat Design System + + + + + + + + + + + + +
+
+ + Default + + + + Default Video + + + + Primary + + + + Video + + + + Secondary + + +
+ + Brick + + + Brick Icon + +
+
+ + + + + +
+
+ + + \ No newline at end of file diff --git a/elements/call-to-action/index.html b/elements/call-to-action/index.html index f87b8aa314..40de38f230 100644 --- a/elements/call-to-action/index.html +++ b/elements/call-to-action/index.html @@ -891,7 +891,7 @@

View a live version of this element to see how it can be customized.

-
<link rel="stylesheet" href="https://static.redhat.com/libs/redhat/redhat-font/4/webfonts/red-hat-font.min.css">
<link rel="stylesheet" href="https://static.redhat.com/libs/redhat/redhat-theme/6/advanced-theme.css">
<link rel="stylesheet" href="demo.css">
<script type="module" src="rh-cta.js"></script>

<section id="variants">
<h2>Variants</h2>
<rh-cta><a href="#default">Default</a></rh-cta>
<rh-cta icon="circle-play"><a href="#default-video">Default Video</a></rh-cta>
<rh-cta variant="primary"><a href="#primary">Primary</a></rh-cta>
<rh-cta variant="primary" icon="circle-play"><a href="#primary-video">Video</a></rh-cta>
<rh-cta variant="secondary"><a href="#secondary">Secondary</a></rh-cta>
<rh-cta variant="brick"><a href="#brick">Brick</a></rh-cta>
<rh-cta variant="brick" icon="user"><a href="#brick-icon">Brick Icon</a></rh-cta>
</section>

<rh-context-provider id="dark" color-palette="darkest">
<h2>Dark Colour Context</h2>
<rh-cta><a href="#default">Default</a></rh-cta>
<rh-cta icon="circle-play"><a href="#default-video">Default Video</a></rh-cta>
<rh-cta variant="primary"><a href="#primary">Primary</a></rh-cta>
<rh-cta variant="primary" icon="circle-play"><a href="#primary-video">Video</a></rh-cta>
<rh-cta variant="secondary"><a href="#secondary">Secondary</a></rh-cta>
<rh-cta variant="brick"><a href="#brick">Brick</a></rh-cta>
<rh-cta variant="brick" icon="user"><a href="#brick-icon">Brick Icon</a></rh-cta>
</rh-context-provider>

<section dir="rtl">
<h2>Right-to-Left Languages</h2>
<rh-cta><a href="#default">ברירת מחדל</a></rh-cta>
<rh-cta icon="circle-play"><a href="#default-video">ברירת מחדל - וידאו</a></rh-cta>
<rh-cta variant="primary"><a href="#primary">ראשי</a></rh-cta>
<rh-cta variant="primary" icon="circle-play"><a href="#primary-video">ראשי - וידאו</a></rh-cta>
<rh-cta variant="secondary"><a href="#secondary">משני</a></rh-cta>
<rh-cta variant="brick"><a href="#brick">לבנה</a></rh-cta>
<rh-cta variant="brick" icon="user"><a href="#brick-icon">לבנה עם אייקון</a></rh-cta>
</section>

<section dir="rtl">
<h2>Deep Shadow RTL</h2>
<p dir="ltr">When the CTA is found within the shadow root of an element which is itself within a RTL context.</p>
<shadow-root>
<template shadowroot="open">
<style>
:host {
display: flex;
flex-flow: row wrap;
gap: 16px;
}
</style>
<rh-cta id="deep"><a href="#default">ברירת מחדל</a></rh-cta>
<rh-cta icon="circle-play"><a href="#default-video">ברירת מחדל - וידאו</a></rh-cta>
<rh-cta variant="primary"><a href="#primary">ראשי</a></rh-cta>
<rh-cta variant="primary" icon="circle-play"><a href="#primary-video">ראשי - וידאו</a></rh-cta>
<rh-cta variant="secondary"><a href="#secondary">משני</a></rh-cta>
<rh-cta variant="brick"><a href="#brick">לבנה</a></rh-cta>
<rh-cta variant="brick" icon="user"><a href="#brick-icon">לבנה עם אייקון</a></rh-cta>
</template>
</shadow-root>
</section>

<section id="resizing">
<h2>Resizing</h2>
<div class="resize">
<rh-cta><a href="#default">Get product details</a></rh-cta>
</div>
<br>
<div class="resize">
<rh-cta icon="circle-play"><a href="#default-video">Get product details</a></rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="primary"><a href="#primary">Get product details</a></rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="primary" icon="circle-play"><a href="#primary-video">Get product details</a></rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="secondary"><a href="#secondary">Get product details</a></rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="brick"><a href="#brick">Get product details</a></rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="brick" icon="user"><a href="#brick-icon">Get product details</a></rh-cta>
</div>
</section>

<section id="resizing">
<h2>Extra-long words</h2>
<div class="resize">
<rh-cta>
<a href="#default">Supercalifragilisticexpialidocious</a>
</rh-cta>
</div>
<br>
<div class="resize">
<rh-cta icon="circle-play">
<a href="#default-video">Supercalifragilisticexpialidocious</a>
</rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="primary">
<a href="#primary">Supercalifragilisticexpialidocious</a>
</rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="primary" icon="circle-play">
<a href="#primary-video">Supercalifragilisticexpialidocious</a>
</rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="secondary">
<a href="#secondary">Supercalifragilisticexpialidocious</a>
</rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="brick">
<a href="#brick">Supercalifragilisticexpialidocious</a>
</rh-cta>
</div>
<br>
<div class="resize">
<rh-cta variant="brick" icon="user">
<a href="#brick-icon">Supercalifragilisticexpialidocious</a>
</rh-cta>
</div>
</section>

<section id="wrap">
<h2>Force wrap to test arrow line-wrap</h2>
<p>No matter the container size, the arrow trailing the CTA message should never appear on a line by itself.</p>
<div class="resize">
<rh-cta><a href="#default">Default link cta with longer text</a></rh-cta>
</div>
<div class="resize" dir="rtl">
<rh-cta><a href="#default">קריאה לפעולה בררית מחדל עם טקסט ארוך</a></rh-cta>
</div>
</section>

<section id="link-button" class="grid">
<h2>Link and button styles (displayed inline)</h2>
<rh-cta><a href="">Link</a></rh-cta>
<rh-cta><button>Button</button></rh-cta>

<rh-cta variant="primary"><a href="">Link</a></rh-cta>
<rh-cta variant="primary"><button>Button</button></rh-cta>

<rh-cta variant="secondary"><a href="">Link</a></rh-cta>
<rh-cta variant="secondary"><button>Button</button></rh-cta>

</section>
+
<rh-cta>
<a href="#">Call to Action</a>
</rh-cta>

<script type="module">
import '@rhds/elements/rh-cta/rh-cta.js';
</script>

View the demo