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

feat: relative sizing #2541

Merged
merged 39 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c916df0
feat: relative sizing
eirikbacker Sep 30, 2024
76d98f4
fix: round values
eirikbacker Oct 1, 2024
0bb5b09
fix: use ds-sizing-scale-base
eirikbacker Oct 1, 2024
8de93e2
Merge branch 'next' into feat/relative-sizing
eirikbacker Oct 3, 2024
ae256f4
docs: globally set scale for testing
eirikbacker Oct 3, 2024
77515aa
chore: merge in next
eirikbacker Oct 21, 2024
f048a09
fix: adjust sizing to use relative
eirikbacker Oct 21, 2024
a0b4cb8
fix(Button): adjust min-height
eirikbacker Oct 21, 2024
06439c9
fix: start making sizing overview
eirikbacker Oct 22, 2024
1ec808d
docs: implement sizes page
eirikbacker Oct 22, 2024
97d63c1
Merge branch 'next' into feat/relative-sizing
eirikbacker Oct 22, 2024
48f63aa
fix: remove size form toggle group context
eirikbacker Oct 22, 2024
da7c3a2
fix: change scaling
eirikbacker Oct 22, 2024
47d3a26
fix(Card): adjust gap and line-height width design
eirikbacker Oct 22, 2024
cbf7734
Merge branch 'next' into feat/relative-sizing
mimarz Oct 22, 2024
fae3100
chore: remove undefined size
eirikbacker Oct 22, 2024
bf1deff
chore: cleanup
eirikbacker Oct 22, 2024
11e60e9
fix: relative font-sizes
eirikbacker Oct 22, 2024
734e719
chore: make shared type
eirikbacker Oct 22, 2024
2f777d0
docs: button stories
eirikbacker Oct 22, 2024
2a35762
fix(Dropdown): heading styling
eirikbacker Oct 22, 2024
69d32c9
fix: heading and spinner sizing
eirikbacker Oct 23, 2024
3ff0a4b
Merge branch 'next' into feat/relative-sizing
eirikbacker Oct 23, 2024
bde35ca
chore: lint
eirikbacker Oct 23, 2024
94def5f
fix: avatar
eirikbacker Oct 23, 2024
c1e790e
fix: avatar
eirikbacker Oct 23, 2024
0985a58
fix: round fallback support
eirikbacker Oct 23, 2024
8c4a8a8
fix: use @supports
eirikbacker Oct 23, 2024
52ccf80
Merge branch 'next' into feat/relative-sizing
eirikbacker Oct 23, 2024
2b4b179
Merge branch 'next' into feat/relative-sizing
eirikbacker Oct 23, 2024
1438a19
fix: update size type to only include sm, md, lg
eirikbacker Oct 23, 2024
94d54f6
fix(Theme): search input height
eirikbacker Oct 23, 2024
0e96b56
chore: add comment
eirikbacker Oct 23, 2024
4dcf746
Merge branch 'next' into feat/relative-sizing
eirikbacker Oct 23, 2024
2f4b48c
Merge branch 'next' into feat/relative-sizing
eirikbacker Oct 24, 2024
6fa73c6
Create fair-beds-destroy.md
eirikbacker Oct 24, 2024
4d79828
fix: remove unused imports
eirikbacker Oct 24, 2024
3a4d587
fix(HelpText): forward data-size
eirikbacker Oct 24, 2024
5216ce9
Merge branch 'next' into feat/relative-sizing
eirikbacker Oct 24, 2024
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
15 changes: 8 additions & 7 deletions packages/css/accordion.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
--dsc-accordion-heading-background--hover: var(--ds-color-neutral-surface-default);
--dsc-accordion-heading-background--open: var(--ds-color-neutral-background-subtle);
--dsc-accordion-heading-background: var(--ds-color-neutral-background-default);
--dsc-accordion-padding: var(--ds-spacing-4);
--dsc-accordion-padding: var(--ds-spacing-2) var(--ds-spacing-4);
--dsc-accordion-size: var(--ds-sizing-14);

&[data-border] > * {
border: var(--dsc-accordion-border);
Expand Down Expand Up @@ -65,16 +66,18 @@
box-sizing: border-box;

& > :is(summary, u-summary) {
align-items: center;
background: var(--dsc-accordion-heading-background);
box-sizing: border-box;
cursor: pointer;
display: flex;
list-style: none;
min-height: var(--dsc-accordion-size);
gap: var(--dsc-accordion-chevron-gap);
outline: none;
padding-block: var(--dsc-accordion-padding);
padding-inline: calc(var(--dsc-accordion-padding) + var(--dsc-accordion-chevron-size) + var(--dsc-accordion-chevron-gap)) var(--dsc-accordion-padding);
padding: var(--dsc-accordion-padding);

@composes ds-focus from './base/base.css';
@composes ds-body-text--sm from './base/base.css';
eirikbacker marked this conversation as resolved.
Show resolved Hide resolved

&:focus-visible {
position: relative; /* Ensure foucs outline renders on top */
Expand All @@ -84,11 +87,9 @@
background: currentcolor;
border-radius: var(--ds-border-radius-md);
content: '';
flex-shrink: 0;
height: var(--dsc-accordion-chevron-size);
mask: 50% / contain no-repeat var(--dsc-accordion-chevron-url);
position: absolute;
margin-inline: calc((var(--dsc-accordion-chevron-size) + var(--dsc-accordion-chevron-gap)) * -1); /* Using margin instead of top/left to avoid position: relative and to support dir="rtl" */

width: var(--dsc-accordion-chevron-size);
}
}
Expand Down
19 changes: 0 additions & 19 deletions packages/css/alert.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
padding-inline: calc(var(--dsc-alert-padding) + var(--dsc-alert-icon-size) + var(--dsc-alert-gap)) var(--dsc-alert-padding);
position: relative;

@composes ds-body-text--md from './base/base.css';

& > :is(h1, h2, h3, h4, h5, h6):first-child::before /* If Alert starts with Heading, align icon to this */,
&:not(:has(> :is(h1, h2, h3, h4, h5, h6):first-child))::before /* If there is no Heading, align icon to Alert itself */ {
background: var(--dsc-alert-icon-color);
Expand Down Expand Up @@ -55,21 +53,4 @@
--dsc-alert-icon-color: var(--ds-color-danger-text-subtle);
--dsc-alert-icon-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M7.74 2.47a.75.75 0 0 1 .53-.22h7.46a.75.75 0 0 1 .53.22l5.27 5.27c.14.14.22.33.22.53v7.46a.75.75 0 0 1-.22.53l-5.27 5.27a.75.75 0 0 1-.53.22H8.27a.75.75 0 0 1-.53-.22l-5.27-5.27a.75.75 0 0 1-.22-.53V8.27a.75.75 0 0 1 .22-.53zm1.29 5.5a.75.75 0 0 0-1.06 1.06L10.94 12l-2.97 2.97a.75.75 0 1 0 1.06 1.06L12 13.06l2.97 2.97a.75.75 0 1 0 1.06-1.06L13.06 12l2.97-2.97a.75.75 0 0 0-1.06-1.06L12 10.94z'/%3E%3C/svg%3E");
}

/**
* Sizes
*/
&[data-size='sm'] {
--dsc-alert-icon-size: var(--ds-sizing-6);
--dsc-alert-padding: var(--ds-spacing-5);

@composes ds-body-text--sm from './base/base.css';
}

&[data-size='lg'] {
--dsc-alert-icon-size: var(--ds-sizing-8);
--dsc-alert-padding: var(--ds-spacing-7);

@composes ds-body-text--lg from './base/base.css';
}
}
18 changes: 3 additions & 15 deletions packages/css/avatar.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
box-sizing: border-box;
color: var(--dsc-avatar-color);
display: inline-flex;
font-weight: var(--ds-font-weight-medium);
height: var(--dsc-avatar-size);
justify-content: center;
overflow: hidden;
text-decoration: none;
text-transform: uppercase;
user-select: none;

@composes ds-body-text--xs from './base/base.css';

&:not(:has(> img)) {
padding: var(--dsc-avatar-padding);
}
Expand Down Expand Up @@ -79,31 +78,20 @@
--dsc-avatar-color: var(--ds-color-brand3-contrast-default);
}

/* TODO: Sizes */
&[data-size='xs'] {
--dsc-avatar-size: var(--ds-sizing-7);
--dsc-avatar-padding: var(--ds-spacing-1);

@composes ds-body-text--xs from './base/base.css';
font-size: var(--ds-body-xs-font-size);
}

&[data-size='sm'] {
--dsc-avatar-size: var(--ds-sizing-9);
--dsc-avatar-padding: var(--ds-spacing-1);

@composes ds-heading-text--2xs from './base/base.css';
}

&[data-size='md'] {
--dsc-avatar-size: var(--ds-sizing-12);
--dsc-avatar-padding: var(--ds-spacing-2);

@composes ds-heading-text--sm from './base/base.css';
}

&[data-size='lg'] {
--dsc-avatar-size: var(--ds-sizing-15);
--dsc-avatar-padding: var(--ds-spacing-2);

@composes ds-heading-text--md from './base/base.css';
}
}
25 changes: 3 additions & 22 deletions packages/css/badge.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

box-sizing: border-box;
display: inline-flex;
line-height: var(--ds-line-height-sm);
eirikbacker marked this conversation as resolved.
Show resolved Hide resolved
position: relative;

@composes ds-body-text--short-sm from './base/base.css';

&::before {
content: attr(data-count);
background: var(--dsc-badge-background);
Expand All @@ -23,26 +22,8 @@
place-items: center;
}

&[data-size='sm'] {
--dsc-badge-size: var(--ds-sizing-3);
--dsc-badge-padding: 0 var(--ds-spacing-1);

@composes ds-body-text--short-xs from './base/base.css';

&[data-count] {
--dsc-badge-size: var(--ds-sizing-5);
}
}

&[data-size='lg'] {
--dsc-badge-size: var(--ds-sizing-4);
--dsc-badge-padding: 0 var(--ds-spacing-2);

@composes ds-body-text--short-md from './base/base.css';

&[data-count] {
--dsc-badge-size: var(--ds-sizing-7);
}
&:not([data-size]) {
font-size: var(--ds-font-size-minus-1); /* Default to small when size is not defined */
}

&[data-color='info'] {
Expand Down
93 changes: 16 additions & 77 deletions packages/css/base/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
--dsc-focus-border-width: 3px; /* Default focus border width */
--dsc-focus-boxShadow: 0 0 0 var(--dsc-focus-border-width) var(--ds-color-focus-inner);
--dsc-focus-outline: var(--ds-color-focus-outer) solid var(--dsc-focus-border-width);
--ds-font-size-minus-1: max(.9em, .875rem); /* Default to 90% of font-size, but minimum 14px */
--ds-font-size-plus-1: 1.1em; /* Default to 110% */

/* font-size adjustments if supporting round() */
@supports (width: round(down, .1em, 1px)) {
--ds-font-size-minus-1: round(down, max(.9em, .875rem), 0.0625rem); /* Default to 90% of font-size, but minimum 14px */
--ds-font-size-plus-1: round(down, 1.1em, 0.0625rem); /* Default to 110% */
}

color: var(--ds-color-neutral-text-default);
background-color: var(--ds-color-neutral-background-default);
Expand All @@ -42,114 +50,43 @@
outline-offset: var(--dsc-focus-border-width);
}

/** Body typography */
.ds-body-text--xs {
[data-size='xs'] {
font-weight: var(--ds-body-xs-font-weight);
line-height: var(--ds-body-xs-line-height);
font-size: var(--ds-body-xs-font-size);
letter-spacing: var(--ds-body-xs-letter-spacing);
}

.ds-body-text--sm {
[data-size='sm'] {
font-weight: var(--ds-body-sm-font-weight);
line-height: var(--ds-body-sm-line-height);
font-size: var(--ds-body-sm-font-size);
letter-spacing: var(--ds-body-sm-letter-spacing);
}

.ds-body-text--md {
body,
eirikbacker marked this conversation as resolved.
Show resolved Hide resolved
[data-size='md'] {
font-weight: var(--ds-body-md-font-weight);
line-height: var(--ds-body-md-line-height);
font-size: var(--ds-body-md-font-size);
letter-spacing: var(--ds-body-md-letter-spacing);
}

.ds-body-text--lg {
[data-size='lg'] {
font-weight: var(--ds-body-lg-font-weight);
line-height: var(--ds-body-lg-line-height);
font-size: var(--ds-body-lg-font-size);
letter-spacing: var(--ds-body-lg-letter-spacing);
}

.ds-body-text--xl {
[data-size='xl'] {
font-weight: var(--ds-body-xl-font-weight);
line-height: var(--ds-body-xl-line-height);
font-size: var(--ds-body-xl-font-size);
letter-spacing: var(--ds-body-xl-letter-spacing);
}

.ds-body-text--long-xs {
font-weight: var(--ds-body-long-xs-font-weight);
line-height: var(--ds-body-long-xs-line-height);
font-size: var(--ds-body-long-xs-font-size);
letter-spacing: var(--ds-body-long-xs-letter-spacing);
}

.ds-body-text--long-sm {
font-weight: var(--ds-body-long-sm-font-weight);
line-height: var(--ds-body-long-sm-line-height);
font-size: var(--ds-body-long-sm-font-size);
letter-spacing: var(--ds-body-long-sm-letter-spacing);
}

.ds-body-text--long-md {
font-weight: var(--ds-body-long-md-font-weight);
line-height: var(--ds-body-long-md-line-height);
font-size: var(--ds-body-long-md-font-size);
letter-spacing: var(--ds-body-long-md-letter-spacing);
}

.ds-body-text--long-lg {
font-weight: var(--ds-body-long-lg-font-weight);
line-height: var(--ds-body-long-lg-line-height);
font-size: var(--ds-body-long-lg-font-size);
letter-spacing: var(--ds-body-long-lg-letter-spacing);
}

.ds-body-text--long-xl {
font-weight: var(--ds-body-long-xl-font-weight);
line-height: var(--ds-body-long-xl-line-height);
font-size: var(--ds-body-long-xl-font-size);
letter-spacing: var(--ds-body-long-xl-letter-spacing);
}

.ds-body-text--short-xs {
font-weight: var(--ds-body-short-xs-font-weight);
line-height: var(--ds-body-short-xs-line-height);
font-size: var(--ds-body-short-xs-font-size);
letter-spacing: var(--ds-body-short-xs-letter-spacing);
}

.ds-body-text--short-sm {
font-weight: var(--ds-body-short-sm-font-weight);
line-height: var(--ds-body-short-sm-line-height);
font-size: var(--ds-body-short-sm-font-size);
letter-spacing: var(--ds-body-short-sm-letter-spacing);
}

.ds-body-text--short-md {
font-weight: var(--ds-body-short-md-font-weight);
line-height: var(--ds-body-short-md-line-height);
font-size: var(--ds-body-short-md-font-size);
letter-spacing: var(--ds-body-short-md-letter-spacing);
}

.ds-body-text--short-lg {
font-weight: var(--ds-body-short-lg-font-weight);
line-height: var(--ds-body-short-lg-line-height);
font-size: var(--ds-body-short-lg-font-size);
letter-spacing: var(--ds-body-short-lg-letter-spacing);
}

.ds-body-text--short-xl {
font-weight: var(--ds-body-short-xl-font-weight);
line-height: var(--ds-body-short-xl-line-height);
font-size: var(--ds-body-short-xl-font-size);
letter-spacing: var(--ds-body-short-xl-letter-spacing);
}

/** Heading */

.ds-heading-text--2xs {
font-weight: var(--ds-heading-2xs-font-weight);
line-height: var(--ds-heading-2xs-line-height);
Expand Down Expand Up @@ -199,6 +136,7 @@
letter-spacing: var(--ds-heading-2xl-letter-spacing);
}

/* TODO: Maybe remove label sizes after sync with design */
.ds-label--md {
font-size: var(--ds-label-md-font-size);
font-weight: var(--ds-label-md-font-weight);
Expand Down Expand Up @@ -227,6 +165,7 @@
letter-spacing: var(--ds-label-lg-letter-spacing);
}

/* TODO: Maybe remove validation sizes after sync with design */
.ds-validation-message--xs {
font-weight: var(--ds-error_message-xs-font-weight);
line-height: var(--ds-error_message-xs-line-height);
Expand Down
16 changes: 0 additions & 16 deletions packages/css/breadcrumbs.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,6 @@
--dsc-breadcrumbs-chevron-size: var(--ds-sizing-6);
--dsc-breadcrumbs-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");

@composes ds-body-text--md from './base/base.css';

&[data-size='sm'] {
--dsc-breadcrumbs-spacing: var(--ds-spacing-1);
--dsc-breadcrumbs-chevron-size: var(--ds-sizing-5);

@composes ds-body-text--sm from './base/base.css';
}

&[data-size='lg'] {
--dsc-breadcrumbs-spacing: var(--ds-spacing-3);
--dsc-breadcrumbs-chevron-size: var(--ds-sizing-7);

@composes ds-body-text--lg from './base/base.css';
}

& > :is(ol, ul) {
display: flex;
flex-wrap: wrap;
Expand Down
Loading
Loading