diff --git a/.changeset/giant-crabs-hug.md b/.changeset/giant-crabs-hug.md new file mode 100644 index 0000000000..8b60b508b6 --- /dev/null +++ b/.changeset/giant-crabs-hug.md @@ -0,0 +1,5 @@ +--- +"@rhds/elements": patch +--- + +``: corrected cta tokens public api diff --git a/elements/rh-cta/rh-cta.css b/elements/rh-cta/rh-cta.css index 86b776a94c..ee1dc30a69 100644 --- a/elements/rh-cta/rh-cta.css +++ b/elements/rh-cta/rh-cta.css @@ -17,7 +17,7 @@ a, font-size: inherit !important; font-weight: inherit !important; line-height: inherit !important; - text-decoration: var(--rh-cta-text-decoration) !important; + text-decoration: var(--_text-decoration) !important; z-index: 2 !important; } @@ -42,17 +42,17 @@ a:after, #container { position: relative; white-space: nowrap; - color: var(--rh-cta-color); + color: var(--_color); font-family: var(--rh-font-family-heading, RedHatDisplay, "Red Hat Display", "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); font-size: var(--rh-font-size-body-text-lg, 1.125rem); font-weight: 600; /* WARNING: not a token value */ line-height: var(--rh-line-height-body-text, 1.5); - background-color: var(--rh-cta-background-color); - border-color: var(--rh-cta-border-color, transparent); + background-color: var(--_background-color); + border-color: var(--_border-color, transparent); border-radius: var(--rh-border-radius-default, 3px); border-width: var(--rh-border-width-sm, 1px); - --_context-background-color: var(--rh-cta-background-color) !important; + --_context-background-color: var(--_background-color) !important; --_arrow-size: 13px; --_arrow-plus-padding: calc(var(--rh-space-md, 8px) + var(--_arrow-size)); --_pf-icon-plus-padding: calc(5px + var(--pf-icon--size)); @@ -119,15 +119,15 @@ a:focus-within, } :host(:is(:focus, :focus-within)) { - --rh-cta-background-color: var(--rh-cta-focus-background-color); + --_background-color: var(--rh-cta-focus-background-color); } :host(:is(:focus, :focus-within)) #container { - border-color: var(--rh-cta-focus-border-color); + border-color: var(--_focus-border-color); background-color: var( - --rh-cta-focus-container-background-color, - var(--rh-cta-focus-background-color) + --_focus-container-background-color, + var(--_focus-background-color) ); color: var(--rh-cta-focus-color); outline: @@ -136,12 +136,13 @@ a:focus-within, var(--rh-cta-focus-container-outline-color, var(--rh-cta-focus-outline-color)); outline-offset: 2px; - --rh-cta-text-decoration: var(--rh-cta-focus-text-decoration); + --_color: var(--_focus-color); + --_text-decoration: var(--_focus-text-decoration); } :host(:is(:focus, :focus-within)) #container:after { border-style: solid; - border-color: var(--rh-cta-focus-inner-border-color); + border-color: var(--_focus-inner-border-color); } /***************************************************************************** @@ -149,11 +150,11 @@ a:focus-within, *****************************************************************************/ :host(:hover) #container { - color: var(--rh-cta-hover-color); - border-color: var(--rh-cta-hover-border-color); - background-color: var(--rh-cta-hover-background-color); + color: var(--_hover-color); + border-color: var(--_hover-border-color); + background-color: var(--_hover-background-color); - --rh-cta-text-decoration: var(--rh-cta-hover-text-decoration); + --_text-decoration: var(--rh-cta-hover-text-decoration, var(--_hover-text-decoration)); } :host(:hover) #container svg { @@ -169,20 +170,23 @@ a:focus-within, *****************************************************************************/ :host(:active) { - background-color: var(--rh-cta-active-background-color); + background-color: var(--_background-color); } :host(:active) #container { - --rh-cta-background-color: + --_background-color: var( - --rh-cta-active-container-background-color, - var(--rh-cta-active-background-color) + --rh-cta-background-color, + var( + --rh-cta-active-container-background-color, + var(--rh-cta-active-background-color) + ) ); } :host(:active) #container:after { border-style: solid; - border-color: var(--rh-cta-active-inner-border-color) !important; + border-color: var(--_active-inner-border-color) !important; } /***************************************************************************** @@ -227,45 +231,42 @@ a:focus-within, *****************************************************************************/ :host(:not([variant])) { - --rh-cta-background-color: transparent; - --rh-cta-border-color: transparent; - --rh-cta-color: var(--rh-color-interactive-blue-darker, #0066cc); - --rh-cta-hover-background-color: transparent; - --rh-cta-hover-border-color: transparent; - --rh-cta-hover-inner-border-color: transparent; - --rh-cta-hover-color: var(--rh-color-interactive-blue-darkest, #003366); - --rh-cta-hover-text-decoration: none; - --rh-cta-focus-background-color: transparent; + --_background-color: var(--rh-cta-background-color, transparent); + --_border-color: var(--rh-cta-border-color, transparent); + --_color: var(--rh-cta-color, var(--rh-color-interactive-blue-darker, #0066cc)); + --_hover-background-color: var(--rh-cta-hover-background-color, transparent); + --_hover-border-color: var(--rh-cta-hover-border-color, transparent); + --_hover-color: var(--rh-cta-hover-color, var(--rh-color-interactive-blue-darkest, #003366)); + --_hover-text-decoration: var(--rh-cta-hover-text-decoration, none); + --_focus-background-color: var(--rh-cta-focus-background-color, transparent); /* --rh-color-border-interactive-on-light with 10% opacity */ - --rh-cta-focus-container-background-color: transparent; - --rh-cta-focus-container-outline-color: var(--rh-color-border-interactive-on-light, #0066cc); - --rh-cta-focus-border-color: transparent; - --rh-cta-focus-inner-border-color: transparent; - --rh-cta-focus-color: var(--rh-color-interactive-blue-darkest, #003366); - --rh-cta-focus-text-decoration: none; + --_focus-container-background-color: var(--rh-cta-focus-container-background-color, #0066cc1a); + --_focus-border-color: var(--rh-cta-focus-border-color, transparent); + --_focus-color: var(--rh-cta-focus-color, var(--rh-color-interactive-blue-darker, #0066cc)); + --_focus-inner-border-color: var(--rh-cta-focus-inner-border-color, transparent); + --_focus-text-decoration: var(--rh-cta-focus-text-decoration, none); /* --rh-color-border-interactive-on-light with 10% opacity */ - --rh-cta-active-container-background-color: #0066cc1a; - --rh-cta-active-inner-border-color: transparent; - --rh-cta-active-text-decoration: none; + --_active-container-background-color: var(--rh-cta-active-container-background-color, #0066cc1a); + --_active-inner-border-color: var(--rh-cta-active-inner-border-color, transparent); + --_active-text-decoration: var(--rh-cta-active-text-decoration, none); } :host(:not([variant])) .dark { - --rh-cta-color: var(--rh-color-interactive-blue-lighter, #92c5f9); - --rh-cta-hover-color: var(--rh-color-interactive-blue-lightest, #b9dafc); + --_color: var(--rh-cta-color, var(--rh-color-interactive-blue-lighter, #92c5f9)); + --_hover-color: var(--rh-cta-hover-color, var(--rh-color-interactive-blue-lightest, #b9dafc)); /* --rh-color-interactive-blue-lighter with 25% opacity */ - --rh-cta-focus-container-background-color: transparent; - --rh-cta-focus-container-outline-color: var(--rh-color-border-interactive-on-dark, #92c5f9); - --rh-cta-focus-border-color: transparent; - --rh-cta-focus-color: var(--rh-color-interactive-blue-lightest, #b9dafc); - --rh-cta-focus-inner-border-color: transparent; - --rh-cta-focus-text-decoration: none; + --_focus-container-background-color: var(--rh-cta-focus-container-background-color, #73bcf740); + --_focus-border-color: var(--rh-cta-focus-border-color, transparent); + --_focus-color: var(--rh-cta-focus-color, var(--rh-color-interactive-blue-lighter, #92c5f9)); + --_focus-inner-border-color: var(--rh-cta-focus-inner-border-color, transparent); + --_focus-text-decoration: var(--rh-cta-focus-text-decoration, none); /* --rh-color-interactive-blue-lighter with 25% opacity */ - --rh-cta-active-container-background-color: #73bcf740; - --rh-cta-active-text-decoration: none; + --_active-container-background-color: var(--rh-cta-active-container-background-color, #73bcf740); + --_active-text-decoration: var(--rh-cta-active-text-decoration, none); } /***************************************************************************** @@ -275,24 +276,85 @@ a:focus-within, :host([variant="primary"]) #container { border-style: solid; - --rh-cta-background-color: var(--rh-color-brand-red-on-light, #ee0000); - --rh-cta-border-color: var(--rh-color-brand-red-on-light, #ee0000); - --rh-cta-color: var(--rh-color-text-primary-on-dark, #ffffff); - --rh-cta-hover-background-color: var(--rh-color-brand-red-dark, #a60000); - --rh-cta-hover-border-color: var(--rh-color-brand-red-dark, #a60000); - --rh-cta-hover-color: var(--rh-color-text-primary-on-dark, #ffffff); - --rh-cta-focus-background-color: var(--rh-color-brand-red-dark, #a60000); - --rh-cta-focus-border-color: transparent; - --rh-cta-focus-outline-color: var(--rh-color-border-interactive-on-light, #0066cc); - --rh-cta-focus-color: var(--rh-color-text-primary-on-dark, #ffffff); - --rh-cta-focus-inner-border-color: transparent; - --rh-cta-active-background-color: var(--rh-color-brand-red-dark, #a60000); - --rh-cta-active-inner-border-color: transparent; + --_background-color: var(--rh-cta-background-color, var(--rh-color-brand-red-on-light, #ee0000)); + --_border-color: var(--rh-cta-border-color, var(--rh-color-brand-red-on-light, #ee0000)); + --_color: var(--rh-cta-color, var(--rh-color-text-primary-on-dark, #ffffff)); + --_hover-background-color: + var( + --rh-cta-hover-background-color, + var( + --rh-color-brand-red-dark, + #a60000 + ) + ); + --_hover-border-color: + var( + --rh-cta-hover-border-color, + var( + --rh-color-brand-red-dark, + #a60000 + ) + ); + --_hover-color: + var( + --rh-cta-hover-color, + var( + --rh-color-text-primary-on-dark, + #ffffff + ) + ); + --_focus-background-color: + var( + --rh-cta-focus-background-color, + var( + --rh-color-brand-red-on-light, + #ee0000 + ) + ); + --_focus-border-color: + var( + --rh-cta-focus-border-color, + var( + --rh-color-brand-red-on-light, + #ee0000 + ) + ); + --_focus-color: + var( + --rh-cta-focus-color, + var( + --rh-color-text-primary-on-dark, + #ffffff + ) + ); + --_focus-inner-border-color: + var( + --rh-cta-focus-inner-border-color, + var( + --rh-color-text-primary-on-dark, + #ffffff + ) + ); + --_active-background-color: + var( + --rh-cta-active-background-color, + var( + --rh-color-brand-red-dark, + #a60000 + ) + ); + --_active-inner-border-color: + var( + --rh-cta-active-inner-border-color, + var( + --rh-color-text-primary-on-dark, + #ffffff + ) + ); } :host([variant="primary"]) #container.dark { - --rh-cta-hover-border-color: transparent; - --rh-cta-focus-outline-color: var(--rh-color-border-interactive-on-dark, #92c5f9); + --_hover-border-color: var(--rh-cta-hover-border-color, var(--rh-color-brand-red-dark, #a60000)); } /***************************************************************************** @@ -302,36 +364,153 @@ a:focus-within, :host([variant="secondary"]) #container { border-style: solid; - --rh-cta-background-color: transparent; - --rh-cta-border-color: var(--rh-color-border-strong-on-light, #151515); - --rh-cta-color: var(--rh-color-text-primary-on-light, #151515); - --rh-cta-hover-background-color: var(--rh-color-surface-darkest, #151515); - --rh-cta-hover-border-color: var(--rh-color-border-strong-on-light, #151515); - --rh-cta-hover-color: var(--rh-color-text-primary-on-dark, #ffffff); - --rh-cta-focus-background-color: var(--rh-color-surface-darkest, #151515); - --rh-cta-focus-border-color: transparent; - --rh-cta-focus-outline-color: var(--rh-color-border-interactive-on-light, #0066cc); - --rh-cta-focus-color: var(--rh-color-text-primary-on-dark, #ffffff); - --rh-cta-focus-inner-border-color: transparent; - --rh-cta-active-color: var(--rh-color-text-primary-on-dark, #ffffff); - --rh-cta-active-background-color: var(--rh-color-border-strong-on-light, #151515); - --rh-cta-active-inner-border-color: transparent; + --_background-color: var(--rh-cta-background-color, transparent); + --_border-color: var(--rh-cta-border-color, var(--rh-color-text-primary-on-light, #151515)); + --_color: var(--rh-cta-color, var(--rh-color-text-primary-on-light, #151515)); + --_hover-background-color: + var( + --rh-cta-hover-background-color, + var( + --rh-color-surface-darkest, + #151515 + ) + ); + --_hover-border-color: + var( + --rh-cta-hover-border-color, + var( + --rh-color-border-strong-on-light, + #151515 + ) + ); + --_hover-color: + var( + --rh-cta-hover-color, + var( + --rh-color-text-primary-on-dark, + #ffffff + ) + ); + --_focus-background-color: + var( + --rh-cta-focus-background-color, + var( + --rh-color-surface-lighter, + #f2f2f2 + ) + ); + --_focus-border-color: + var( + --rh-cta-focus-border-color, + var( + --rh-color-border-strong-on-light, + #151515 + ) + ); + --_focus-color: + var( + --rh-cta-focus-color, + var( + --rh-color-surface-darkest, + #151515 + ) + ); + --_focus-inner-border-color: + var( + --rh-cta-focus-inner-border-color, + var( + --rh-color-border-strong-on-light, + #151515 + ) + ); + --_active-color: + var( + --rh-cta-active-color, + var( + --rh-color-text-primary-on-dark, + #ffffff + ) + ); + --_active-background-color: + var( + --rh-cta-active-background-color, + var( + --rh-color-border-strong-on-light, + #151515 + ) + ); + --_active-inner-border-color: + var( + --rh-cta-active-inner-border-color, + var( + --rh-color-surface-light, + #e0e0e0 + ) + ); } :host([variant="secondary"]) #container.dark { - --rh-cta-border-color: var(--rh-color-border-strong-on-dark, #ffffff); - --rh-cta-color: var(--rh-color-text-primary-on-dark, #ffffff); - --rh-cta-hover-background-color: var(--rh-color-surface-lightest, #ffffff); - --rh-cta-hover-border-color: var(--rh-color-border-strong-on-dark, #ffffff); - --rh-cta-hover-color: var(--rh-color-text-primary-on-light, #151515); - --rh-cta-focus-background-color: var(--rh-color-surface-lightest, #ffffff); - --rh-cta-focus-border-color: transparent; - --rh-cta-focus-outline-color: var(--rh-color-border-interactive-on-dark, #92c5f9); - --rh-cta-focus-inner-border-color: transparent; - --rh-cta-focus-color: var(--rh-color-text-primary-on-light, #151515); - --rh-cta-active-color: var(--rh-color-text-primary-on-light, #151515); - --rh-cta-active-background-color: var(--rh-color-surface-lightest, #ffffff); - --rh-cta-active-inner-border-color: transparent; + --_border-color: var(--rh-cta-border-color, var(--rh-color-border-strong-on-dark, #ffffff)); + --_color: var(--rh-cta-color, var(--rh-color-text-primary-on-dark, #ffffff)); + --_hover-background-color: + var( + --rh-cta-hover-background-color, + var( + --rh-color-surface-lightest, + #ffffff + ) + ); + --_hover-border-color: + var( + --rh-cta-hover-border-color, + var( + --rh-color-border-strong-on-dark, + #ffffff + ) + ); + --_hover-color: var(--rh-cta-hover-color, var(--rh-color-text-primary-on-light, #151515)); + --_focus-background-color: + var( + --rh-cta-focus-background-color, + var( + --rh-color-surface-dark, + #383838 + ) + ); + --_focus-border-color: + var( + --rh-cta-focus-border-color, + var( + --rh-color-border-strong-on-dark, + #ffffff + ) + ); + --_focus-inner-border-color: + var( + --rh-cta-focus-inner-border-color, + var( + --rh-color-border-strong-on-dark, + #ffffff + ) + ); + --_focus-color: var(--rh-cta-focus-color, var(--rh-color-text-primary-on-dark, #ffffff)); + --_active-color: var(--rh-cta-active-color, var(--rh-color-text-primary-on-light, #151515)); + --_active-background-color: + var( + --rh-cta-active-background-color, + var( + --rh-color-surface-lightest, + #ffffff + ) + ); + --_active-inner-border-color: + var( + --rh-cta-active-inner-border-color, + var( + --rh-color-border-strong-on-light, + #151515 + ) + ); } /***************************************************************************** @@ -354,40 +533,120 @@ a:focus-within, justify-content: center; align-items: center; - --rh-cta-background-color: transparent; - --rh-cta-border-color: var(--rh-color-border-subtle-on-light, #c7c7c7); - --rh-cta-color: var(--rh-color-interactive-blue-darker, #0066cc); - --rh-cta-hover-background-color: var(--rh-color-surface-lighter, #f2f2f2); - --rh-cta-hover-border-color: var(--rh-color-border-subtle-on-light, #c7c7c7); - --rh-cta-hover-color: var(--rh-color-interactive-blue-darkest, #003366); - --rh-cta-hover-text-decoration: underline; - --rh-cta-focus-background-color: var(--rh-color-surface-lighter, #f2f2f2); - --rh-cta-focus-color: var(--rh-color-interactive-blue-darkest, #003366); - --rh-cta-focus-border-color: var(--rh-color-border-subtle-on-light, #c7c7c7); - --rh-cta-focus-outline-color: var(--rh-color-border-interactive-on-light, #0066cc); - --rh-cta-focus-inner-border-color: transparent; - --rh-cta-focus-text-decoration: underline; - --rh-cta-active-background-color: var(--rh-color-surface-lighter, #f2f2f2); - --rh-cta-active-inner-border-color: transparent; - --rh-cta-active-text-decoration: underline; + --_background-color: var(--rh-cta-background-color, transparent); + --_border-color: var(--rh-cta-border-color, var(--rh-color-border-subtle-on-light, #c7c7c7)); + --_color: var(--rh-cta-color, var(--rh-color-interactive-blue-darker, #0066cc)); + --_hover-background-color: + var( + --rh-cta-hover-background-color, + var( + --rh-color-surface-lighter, + #f2f2f2 + ) + ); + --_hover-border-color: + var( + --rh-cta-hover-border-color, + var( + --rh-color-border-subtle-on-light, + #c7c7c7 + ) + ); + --_hover-color: var(--rh-cta-hover-color, var(--rh-color-interactive-blue-darkest, #003366)); + --_hover-text-decoration: var(--rh-cta-hover-text-decoration, none); + --_focus-color: var(--rh-cta-focus-color, var(--rh-color-interactive-blue-darker, #0066cc)); + --_focus-border-color: + var( + --rh-cta-focus-border-color, + var( + --rh-color-border-subtle-on-light, + #c7c7c7 + ) + ); + --_focus-inner-border-color: + var( + --rh-cta-focus-inner-border-color, + var( + --rh-color-border-subtle-on-light, + #c7c7c7 + ) + ); + --_focus-text-decoration: var(--rh-cta-focus-text-decoration, none); + --_active-background-color: + var( + --rh-cta-active-background-color, + var( + --rh-color-surface-lighter, + #f2f2f2 + ) + ); + --_active-inner-border-color: + var( + --rh-cta-active-inner-border-color, + var( + --rh-color-border-subtle-on-light, + #c7c7c7 + ) + ); + --_active-text-decoration: var(--rh-cta-active-text-decoration, none); } :host([variant="brick"]) #container.dark { - --rh-cta-border-color: var(--rh-color-border-subtle-on-dark, #707070); - --rh-cta-color: var(--rh-color-interactive-blue-lighter, #92c5f9); - --rh-cta-hover-background-color: var(--rh-color-surface-darker, #1f1f1f); - --rh-cta-hover-border-color: var(--rh-color-border-subtle-on-dark, #707070); - --rh-cta-hover-color: var(--rh-color-interactive-blue-lightest, #b9dafc); - --rh-cta-hover-text-decoration: underline; - --rh-cta-focus-background-color: var(--rh-color-surface-dark-alt, #292929); - --rh-cta-focus-color: var(--rh-color-interactive-blue-lightest, #b9dafc); - --rh-cta-focus-border-color: var(--rh-color-border-subtle-on-dark, #707070); - --rh-cta-focus-outline-color: var(--rh-color-border-interactive-on-dark, #92c5f9); - --rh-cta-focus-inner-border-color: transparent; - --rh-cta-focus-text-decoration: underline; - --rh-cta-active-background-color: var(--rh-color-surface-darker, #1f1f1f); - --rh-cta-active-inner-border-color: transparent; - --rh-cta-active-text-decoration: underline; + --_border-color: var(--rh-cta-border-color, var(--rh-color-border-subtle-on-dark, #707070)); + --_color: var(--rh-cta-color, var(--rh-color-interactive-blue-lighter, #92c5f9)); + --_hover-background-color: + var( + --rh-cta-hover-background-color, + var( + --rh-color-surface-darker, + #1f1f1f + ) + ); + --_hover-border-color: + var( + --rh-cta-hover-border-color, + var( + --rh-color-border-subtle-on-dark, + #707070 + ) + ); + --_hover-color: var(--rh-cta-hover-color, var(--rh-color-interactive-blue-lightest, #b9dafc)); + --_hover-text-decoration: var(--rh-cta-hover-text-decoration, underline); + --_focus-color: var(--rh-cta-focus-color, var(--rh-color-interactive-blue-lighter, #92c5f9)); + --_focus-border-color: + var( + --rh-cta-focus-border-color, + var( + --rh-color-border-subtle-on-dark, + #707070 + ) + ); + --_focus-inner-border-color: + var( + --rh-cta-focus-inner-border-color, + var( + --rh-color-border-subtle-on-dark, + #707070 + ) + ); + --_focus-text-decoration: var(--rh-cta-focus-text-decoration, none); + --_active-background-color: + var( + --rh-cta-active-background-color, + var( + --rh-color-surface-darker, + #1f1f1f + ) + ); + --_active-inner-border-color: + var( + --rh-cta-active-inner-border-color, + var( + --rh-color-border-subtle-on-dark, + #707070 + ) + ); + --_active-text-decoration: var(--rh-cta-active-text-decoration, underline); } :host([variant="brick"]) #container.icon pf-icon {