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: hidden attribute #2962

Merged
merged 4 commits into from
Jan 8, 2025
Merged
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
5 changes: 4 additions & 1 deletion packages/css/src/avatar.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
border-radius: var(--dsc-avatar-border-radius);
box-sizing: border-box;
color: var(--dsc-avatar-color);
display: inline-flex;
flex-shrink: 0;
font-weight: var(--ds-font-weight-medium);
height: var(--dsc-avatar-size);
Expand All @@ -22,6 +21,10 @@
user-select: none;
width: var(--dsc-avatar-size);

&:not([hidden]) {
display: inline-flex;
}

&:not(:has(img)) {
padding: var(--dsc-avatar-padding);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/badge.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@

.ds-badge--position {
box-sizing: border-box;
display: inline-flex;
position: relative;
height: fit-content;
width: fit-content;

&:not([hidden]) {
display: inline-flex;
}

& .ds-badge::before {
position: absolute;
}
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/breadcrumbs.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
--dsc-breadcrumbs-color: var(--ds-color-text-subtle);

& > :is(ol, ul) {
display: flex;
flex-wrap: wrap;
list-style-type: none;
margin: 0;
padding: 0;
gap: var(--dsc-breadcrumbs-spacing) 0;

&:not([hidden]) {
display: flex;
}
}

& a[aria-current='page'] {
Expand Down
7 changes: 5 additions & 2 deletions packages/css/src/card.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
border: var(--dsc-card-border);
box-sizing: border-box;
color: var(--dsc-card-color);
display: block;
font-family: inherit;
margin: 0;
overflow: clip; /* Needed to clip media elements and and Card.Block */
padding: var(--dsc-card-padding);
text-align: inherit;

&:not([hidden]) {
display: block;
}

&:not([data-size]) {
font-size: inherit; /* Ensure inheriting font-size when <button> */
}
Expand Down Expand Up @@ -115,7 +118,7 @@
&:has(> :is(audio, figure, iframe, img, video):only-child) {
padding: 0;

& > * {
& > :not([hidden]) {
border: 0;
display: block;
height: auto;
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/chip.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
box-sizing: border-box;
color: var(--dsc-chip-color);
cursor: pointer;
display: inline-flex;
font-family: inherit;
gap: var(--gap);
line-height: var(--ds-line-height-sm);
Expand All @@ -36,6 +35,10 @@

@composes ds-focus from './base.css';

&:not([hidden]) {
display: inline-flex;
}

&:not([data-size]) {
font-size: var(--ds-font-size-minus-1);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/details.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@
background: var(--dsc-details-heading-background);
box-sizing: border-box;
cursor: pointer;
display: flex;
list-style: none;
min-height: var(--dsc-details-size);
gap: var(--dsc-details-chevron-gap);
outline: none;
padding: var(--dsc-details-padding);
position: relative;

&:not([hidden]) {
display: flex;
}

/* Render focus inside so it is easier to make full window width and place in overflow: hidden containers */
&:focus-visible {
box-shadow: inset 0 0 0 var(--dsc-focus-border-width) var(--ds-color-focus-outer);
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/dropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
align-items: center;
box-sizing: border-box;
color: var(--ds-color-neutral-text-subtle);
display: flex;
font-size: inherit;
font-weight: inherit;
margin: 0;
min-height: var(--dsc-dropdown-item-size);
padding: var(--dsc-dropdown-item-padding);

&:not([hidden]) {
display: flex;
}
}

& > ul {
Expand Down
20 changes: 16 additions & 4 deletions packages/css/src/field.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
.ds-field {
align-items: start;
display: flex;
flex-direction: column;
gap: var(--ds-size-2);

&:not([hidden]) {
display: flex;
}

& [data-field='description'] {
color: var(--ds-color-neutral-text-subtle); /* TODO: Change to opacity or color-mix(currentColor, trasparent) to ensure contrast when parent element color changes? */
}
Expand All @@ -25,12 +28,15 @@
*/
&:has(input:is([type='radio'], [type='checkbox'])) {
border-radius: var(--ds-border-radius-md);
display: grid;
grid-template-areas: 'input content';
grid-template-columns: auto 1fr;
row-gap: 0;
width: fit-content; /* Rather do display: grid + width: fit-content than display: inline-grid to encourage stacked radios */

&:not([hidden]) {
display: grid;
}

& > * {
grid-column: content; /* Only allow input in column 1 */
}
Expand Down Expand Up @@ -77,21 +83,27 @@
border-radius: var(--ds-border-radius-md);
box-sizing: border-box;
color: var(--ds-color-neutral-text-subtle);
display: inline-flex; /* Using inline-flex to match native inline-block behaviour of <input> */
max-width: 100%;
white-space: nowrap;

&:not([hidden]) {
display: inline-flex; /* Using inline-flex to match native inline-block behaviour of <input> */
}

&:has([size]) {
width: fit-content;
}

& .ds-field-affix {
align-items: center;
border: var(--dsc-field-affix-border);
display: flex;
flex-shrink: 0;
padding-inline: var(--dsc-field-affix-padding-inline);

&:not([hidden]) {
display: flex;
}

&:first-child {
border-top-left-radius: inherit;
border-bottom-left-radius: inherit;
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/pagination.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
--dsc-pagination-icon-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath d='M9.47 5.97a.75.75 0 0 1 1.06 0l5.5 5.5a.75.75 0 0 1 0 1.06l-5.5 5.5a.75.75 0 1 1-1.06-1.06L14.44 12 9.47 7.03a.75.75 0 0 1 0-1.06'/%3E%3C/svg%3E");

& > :is(ol, ul) {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: var(--dsc-pagination-gap);
list-style: none;
margin: 0;
padding: 0;

&:not([hidden]) {
display: flex;
}

& > li:first-child > ::before,
& > li:last-child > ::before {
content: '';
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/popover.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@
[data-popover='inline'] {
all: unset;
cursor: pointer;
display: inline;
text-decoration: underline dotted;
text-underline-offset: 0.27em;
font-size: inherit;

&:not([hidden]) {
display: inline;
}

@composes ds-focus from './base.css';
}
5 changes: 4 additions & 1 deletion packages/css/src/search.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
--dsc-search-icon-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M10.5 3.25a7.25 7.25 0 1 0 4.57 12.88l5.41 5.41a.75.75 0 1 0 1.06-1.06l-5.41-5.41A7.25 7.25 0 0 0 10.5 3.25M4.75 10.5a5.75 5.75 0 1 1 11.5 0 5.75 5.75 0 0 1-11.5 0'/%3E%3C/svg%3E");
--dsc-search-icon-size: var(--ds-size-7);

display: grid;
align-items: center;
grid-template-columns: 1fr auto;
width: 100%;
border-radius: var(--ds-border-radius-default);
position: relative;

&:not([hidden]) {
display: grid;
}

/* Add magnifier icon when no submit button is present */
&:not(:has(button:not([type='reset']))) {
& input {
Expand Down
10 changes: 8 additions & 2 deletions packages/css/src/skeleton.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
animation: var(--dsc-skeleton-animation);
border-radius: var(--ds-border-radius-lg);
box-sizing: border-box;
display: block;
height: 1.3em;
pointer-events: none;
user-select: none;
width: 100%;

&:not([hidden]) {
display: block;
}

&[data-variant='circle'] {
aspect-ratio: 1 / 1;
border-radius: var(--ds-border-radius-full);
Expand All @@ -22,11 +25,14 @@
border-radius: var(--ds-border-radius-full);
box-decoration-break: clone;
color: transparent;
display: inline;
font-size: 0.8em; /* Scale down font to have larger gap between lines */
letter-spacing: 0.1em; /* But scale up letter-spacing to have circa same line-length */
user-select: none; /* Prevent text selection */

&:not([hidden]) {
display: inline;
}

&:empty::before {
content: attr(data-text); /* Only fill with fallback text if empty */
word-break: break-word; /* Enable text wrapping */
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/skiplink.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
}

.ds-skiplink:focus {
display: grid;
place-items: center;
outline: 0;
position: static;
Expand All @@ -25,4 +24,8 @@
text-decoration: underline;
text-decoration-thickness: max(1px, 0.0625rem);
text-underline-offset: max(5px, 0.25rem);

&:not([hidden]) {
display: grid;
}
}
5 changes: 4 additions & 1 deletion packages/css/src/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,17 @@
box-sizing: border-box;
color: inherit;
cursor: pointer;
display: block;
font: inherit;
padding: var(--dsc-table-padding);
text-align: inherit;
width: 100%;

@composes ds-focus from './base.css';

&:not([hidden]) {
display: block;
}

&:focus-visible {
position: relative; /* Place on top when painting focus border */
}
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/tag.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
border-radius: var(--ds-border-radius-sm);
box-sizing: border-box;
color: var(--dsc-tag-color);
display: inline-flex;
line-height: var(--ds-line-height-sm);
min-height: var(--dsc-tag-min-height);
padding: var(--dsc-tag-padding);
width: max-content;
word-break: break-word;

&:not([hidden]) {
display: inline-flex;
}

@media (forced-colors: active) {
border: 1px solid CanvasText;
}
Expand Down
5 changes: 4 additions & 1 deletion packages/css/src/togglegroup.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
background: var(--dsc-togglegroup-background);
border-radius: calc(var(--dsc-togglegroup-border-radius) + var(--dsc-togglegroup-padding));
border: var(--dsc-togglegroup-border);
display: grid;
gap: var(--dsc-togglegroup-padding);
grid-auto-columns: 1fr;
grid-auto-flow: column;
height: fit-content;
padding: var(--dsc-togglegroup-padding);
width: fit-content;

&:not([hidden]) {
display: grid;
}

button {
border-radius: var(--dsc-togglegroup-border-radius);

Expand Down
Loading