Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pagination): Colors, right to left demo, and logical properties #2116

Open
wants to merge 4 commits into
base: staging/cubone
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions elements/rh-pagination/demo/right-to-left.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@

<link rel="stylesheet" href="../rh-pagination-lightdom.css">

<style>
#rtl-pagination {
gap: var(--rh-space-2xl, 32px);
padding: var(--rh-space-xl, 24px) var(--rh-space-4xl, 64px);
& rh-pagination {
justify-self: center;
}
}
</style>

<script type="module">
import '@rhds/elements/rh-button/rh-button.js';
import '@rhds/elements/rh-pagination/rh-pagination.js';
Expand Down
19 changes: 9 additions & 10 deletions elements/rh-pagination/rh-pagination-lightdom.css
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a changeset

Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ rh-pagination li > a {
display: grid;
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-xl, 1.25rem);
height: var(--_link-size);
block-size: var(--_link-size);
place-content: center;
position: relative;
text-decoration: none;
width: var(--_link-size);
inline-size: var(--_link-size);
}

rh-pagination[size='sm'] li > a {
Expand All @@ -51,7 +51,7 @@ rh-pagination li > a[aria-current]:after {
inset-inline-start: -1px;
position: absolute;
inset-block-start: -1px;
width: 104%;
inline-size: 104%;
}

rh-pagination li > a:hover:after,
Expand Down Expand Up @@ -105,8 +105,8 @@ rh-pagination:is([overflow='start'], [overflow='both']) li:first-child {
rh-pagination:is([overflow='end'], [overflow='both']) li:last-child:before,
rh-pagination:is([overflow='start'], [overflow='both']) li:first-child:after {
content: '…';
width: var(--_link-size);
height: var(--_link-size);
inline-size: var(--_link-size);
block-size: var(--_link-size);
padding-inline-end: 4px;
display: flex;
align-items: center;
Expand All @@ -121,10 +121,6 @@ rh-pagination:is([overflow='start'], [overflow='both']) li:first-child:after {
* OPEN VARIANT
*****************************************************************************/

rh-pagination[variant|='open'] {
--_list-a-bg-color: transparent;
}

rh-pagination[variant|='open'] li > a:hover:after,
rh-pagination[variant|='open'] li > a:focus:before,
rh-pagination[variant|='open'] li > a:focus:after,
Expand All @@ -134,7 +130,10 @@ rh-pagination[variant|='open'] li > a[aria-current]:after {
inset-block-end: -1px;
}

rh-pagination[variant|='open'] li > a {
--_list-a-bg-color: transparent;
}

rh-pagination[variant|='open'] li > a[aria-current] {
background-color: var(--_list-a-bg-color);
border-color: transparent; /* NOTE: Keep active/hover borders in-line */
}
59 changes: 33 additions & 26 deletions elements/rh-pagination/rh-pagination.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--_stepper-size: var(--rh-length-3xl, 48px);

display: block;
min-height: 4em;
min-block-size: 4em;
}

:host([size='sm']) {
Expand All @@ -20,17 +20,23 @@
gap: var(--rh-space-2xl, 32px) calc(var(--rh-space-xs, 4px) / 2);
flex-wrap: wrap;

--rh-pagination-accent-color: var(--rh-color-interactive-primary-default);
/* stylelint-disable-next-line */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to disable this rule? it's there for a reason. perhaps there's a bug lower down in the stack we need to fix? Try putting it in a surface.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review.

This is the same issue we're seeing in this comment on #2043.

If pagination is not wrapped in a surface, the tokens are undefined; thus, all the colors are incorrect. See the note in this PR's body under "Notes to reviewers".

--rh-pagination-accent-color: var(--rh-color-interactive-primary-default, #0066cc);
--_numeric-a-color: var(--rh-pagination-accent-color);
--_numeric-a-color-hover: var(--rh-color-interactive-primary-hover);
/* stylelint-disable-next-line */
--_numeric-a-color-hover: var(--rh-color-interactive-primary-hover, #003366);
--_numeric-a-color-focus: var(--rh-pagination-accent-color);
--_numeric-a-color-focus-outline: var(--rh-pagination-accent-color);
--_numeric-a-color-visited: var(--rh-color-interactive-primary-visited-default);
--_numeric-a-color-visited-hover: var(--rh-color-interactive-primary-visited-hover);
/* stylelint-disable-next-line */
--_numeric-a-color-visited: var(--rh-color-interactive-primary-visited-default, #5e40be);
/* stylelint-disable-next-line */
--_numeric-a-color-visited-hover: var(--rh-color-interactive-primary-visited-hover, #21134d);
--_list-a-bg-color: var(--rh-color-surface-lighter, #f2f2f2);
--_list-a-current-page-border-color: var(--rh-color-border-subtle);
/* stylelint-disable-next-line */
--_list-a-current-page-border-color: var(--rh-color-border-subtle, #c7c7c7);
--_list-a-current-page-bg-color: var(--rh-color-surface-lightest, #ffffff);
--_list-a-text-color: var(--rh-color-text-primary);
/* stylelint-disable-next-line */
--_list-a-text-color: var(--rh-color-text-primary, #151515);
--_stepper-bg-color: var(--rh-color-surface-lighter, #f2f2f2);
--_stepper-hover-focus-color: var(--rh-color-text-primary-on-dark, #ffffff);
--_border-top-hover-color: var(--rh-color-gray-60, #4d4d4d);
Expand All @@ -55,39 +61,39 @@
.visually-hidden {
border: 0;
clip: rect(0, 0, 0, 0);
height: 1px;
block-size: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
inline-size: 1px;
}

@container pagination (min-width: 344px) {
.xxs-visually-hidden {
border: 0;
clip: rect(0, 0, 0, 0);
height: 1px;
block-size: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
inline-size: 1px;
}
}

@container pagination (min-width: 768px) {
.sm-visually-visible {
clip: auto;
height: auto;
block-size: auto;
margin: 0;
overflow: visible;
padding: 0;
position: static;
white-space: normal;
width: auto;
inline-size: auto;
}
}

Expand All @@ -112,11 +118,11 @@ svg {
display: grid;
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-heading-xs, 1.25rem);
height: var(--_stepper-size);
block-size: var(--_stepper-size);
place-content: center;
position: relative;
text-decoration: none;
width: var(--_stepper-size);
inline-size: var(--_stepper-size);
}

.stepper:focus {
Expand All @@ -131,10 +137,10 @@ svg {
.stepper:focus:after {
border-block-start-style: solid;
content: '';
left: -1px;
inset-inline-start: -1px;
position: absolute;
top: -1px;
width: 104%;
inset-block-start: -1px;
inline-size: 104%;
}

.stepper:hover:after,
Expand All @@ -149,7 +155,7 @@ svg {
}

.stepper svg {
height: 14px;
block-size: 14px;
}

:is(#next, #last) svg,
Expand All @@ -173,11 +179,12 @@ svg {
}

input {
height: var(--rh-length-2xl, 32px);
width: var(--rh-length-4xl, 64px);
block-size: var(--rh-length-2xl, 32px);
inline-size: var(--rh-length-4xl, 64px);
font-size: var(--rh-font-size-body-text-md, 1rem);
background: var(--rh-color-surface-lightest, #ffffff);
border: var(--rh-border-width-sm, 1px) solid var(--rh-color-border-subtle);
/* stylelint-disable-next-line */
border: var(--rh-border-width-sm, 1px) solid var(--rh-color-border-subtle, #c7c7c7);
border-block-end-color: var(--rh-color-gray-40, #a3a3a3);
box-sizing: border-box;
padding-block: var(--rh-space-sm, 6px);
Expand Down Expand Up @@ -212,7 +219,7 @@ input:invalid:focus {

#numeric-end {
display: block;
width: 100%;
inline-size: 100%;
}

#numeric {
Expand All @@ -223,13 +230,13 @@ input:invalid:focus {
gap: 0.5em;
margin-block: 0;
margin-inline: 0 var(--rh-space-lg, 16px);
min-height: var(--_stepper-size);
width: 100%;
min-block-size: var(--_stepper-size);
inline-size: 100%;
}

#numeric input {
align-self: stretch;
height: auto;
block-size: auto;
}

#numeric a {
Expand Down
Loading