Skip to content

Commit

Permalink
Merge branch 'main' into docs/why-both-spacing-and-sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
mrosvik authored Apr 24, 2024
2 parents cc0133e + aeed607 commit 5232c9e
Show file tree
Hide file tree
Showing 24 changed files with 424 additions and 760 deletions.
10 changes: 10 additions & 0 deletions packages/css/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.6.0](https://github.com/digdir/designsystemet/compare/@digdir/[email protected]...@digdir/[email protected]) (2024-04-23)

### Bug Fixes

- **Skiplink:** :bug: Should now show correctly ([#1866](https://github.com/digdir/designsystemet/issues/1866)) ([4afbe91](https://github.com/digdir/designsystemet/commit/4afbe91f7b42da0a3fb1ed26ecb919269db3a746))

### Features

- **Alert:** ✨ New design and sizes ([#1804](https://github.com/digdir/designsystemet/issues/1804)) ([14e707d](https://github.com/digdir/designsystemet/commit/14e707d254571084b1f03aa4b90acfa096b8609f))

# [0.5.0](https://github.com/digdir/designsystemet/compare/@digdir/[email protected]...@digdir/[email protected]) (2024-04-22)

### Bug Fixes
Expand Down
38 changes: 28 additions & 10 deletions packages/css/alert.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
@layer fds.alert {
.fds-alert {
--fds-alert-border: var(--fds-semantic-border-info-default);
--fds-alert-border-left: 8px 0 0 0 var(--fds-alert-border) inset;
--fds-alert-border-color: var(--fds-semantic-border-info-default);
--fds-alert-border-radius: var(--fds-border_radius-medium);
--fds-alert-color: var(--fds-semantic-text-neutral-default);
--fds-alert-icon-color: var(--fds-alert-border);
--fds-alert-icon-color: var(--fds-alert-border-color);
--fds-alert-icon-size: var(--fds-sizing-7);
--fds-alert-background: var(--fds-semantic-surface-info-subtle);
--fds-alert-padding: var(--fds-spacing-6);

box-shadow: var(--fds-alert-border-left);
border: 1px solid var(--fds-alert-border-color);
border-radius: var(--fds-alert-border-radius);
background: var(--fds-alert-background);
color: var(--fds-alert-color);
padding: var(--fds-spacing-4);
padding: var(--fds-alert-padding);
display: grid;
grid-auto-flow: column;
grid-auto-columns: min-content auto;
gap: var(--fds-spacing-2);
font: var(--fds-typography-paragraph-medium);
}

.fds-alert__icon {
Expand All @@ -29,26 +32,41 @@
}

.fds-alert--info {
--fds-alert-border: var(--fds-semantic-border-info-default);
--fds-alert-border-color: var(--fds-semantic-border-info-default);
--fds-alert-background: var(--fds-semantic-surface-info-subtle);
}

.fds-alert--warning {
--fds-alert-border: var(--fds-semantic-border-warning-default);
--fds-alert-border-color: var(--fds-semantic-border-warning-default);
--fds-alert-background: var(--fds-semantic-surface-warning-subtle);
}

.fds-alert--success {
--fds-alert-border: var(--fds-semantic-border-success-default);
--fds-alert-border-color: var(--fds-semantic-border-success-default);
--fds-alert-background: var(--fds-semantic-surface-success-subtle);
}

.fds-alert--danger {
--fds-alert-border: var(--fds-semantic-border-danger-default);
--fds-alert-border-color: var(--fds-semantic-border-danger-default);
--fds-alert-background: var(--fds-semantic-surface-danger-subtle);
}

.fds-alert--small {
--fds-alert-padding: var(--fds-spacing-5);
--fds-alert-icon-size: var(--fds-sizing-6);
}

.fds-alert--medium {
--fds-alert-padding: var(--fds-spacing-6);
--fds-alert-icon-size: var(--fds-sizing-7);
}

.fds-alert--large {
--fds-alert-padding: var(--fds-spacing-7);
--fds-alert-icon-size: var(--fds-sizing-8);
}

.fds-alert--elevated {
box-shadow: var(--fds-alert-border-left), var(--fds-shadow-small);
box-shadow: var(--fds-shadow-small);
}
}
272 changes: 272 additions & 0 deletions packages/css/button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
@layer fds.btn {
.fds-btn {
--fds-btn-padding: 0 var(--fds-spacing-4);

display: flex;
align-items: center;
border: var(--fds-border_width-default) solid transparent;
background-color: var(--fds-semantic-surface-action-first-default);
color: var(--fds-semantic-text-action-first-on_action);
min-width: 2.5em;
padding: var(--fds-btn-padding);
box-sizing: border-box;
cursor: pointer;
font-family: inherit;
justify-content: center;
text-align: center;
text-decoration: none;
position: relative;
border-radius: var(--fds-border_radius-interactive);
min-height: var(--fds-sizing-10);
}

.fds-btn svg {
overflow: visible;
}

.fds-btn:disabled,
.fds-btn[aria-disabled='true'] {
cursor: not-allowed;
opacity: var(--fds-opacity-disabled);
}

.fds-btn--small {
--fds-btn-padding: 0 var(--fds-spacing-3);

gap: var(--fds-sizing-1);
font: var(--fds-typography-paragraph-short-small);
font-family: inherit;
min-height: var(--fds-sizing-10);
}

.fds-btn--small::before {
position: absolute;
top: 0;
left: 0;
width: auto;
min-height: auto;
content: '';
}

.fds-btn--small::after {
position: absolute;
top: -5px;
left: 0;
width: 100%;
height: 44px;
content: '';
}

.fds-btn--medium {
--fds-btn-padding: 0 var(--fds-spacing-4);

gap: var(--fds-sizing-2);
font: var(--fds-typography-paragraph-short-medium);
font-family: inherit;
min-height: var(--fds-sizing-12);
}

.fds-btn--large {
--fds-btn-padding: 0 var(--fds-spacing-5);

gap: var(--fds-sizing-2);
font: var(--fds-typography-paragraph-short-large);
font-family: inherit;
min-height: var(--fds-sizing-14);
}

.fds-btn--full-width {
width: 100%;
}

.fds-btn--secondary,
.fds-btn--tertiary {
background-color: transparent;
}

.fds-btn--icon-only {
--fds-btn-padding: 0;
}

/* Primary button colors */
.fds-btn--primary:where(.fds-btn--first) {
background-color: var(--fds-semantic-surface-action-first-default);
}

.fds-btn--primary:where(.fds-btn--second) {
background-color: var(--fds-semantic-surface-action-second-default);
}

.fds-btn--primary:where(.fds-btn--success) {
background-color: var(--fds-semantic-surface-success-default);
}

.fds-btn--primary:where(.fds-btn--danger) {
background-color: var(--fds-semantic-surface-danger-default);
}

/* Only use hover for non-touch devices to prevent sticky-hovering */
@media (hover: hover) and (pointer: fine) {
.fds-btn--primary:where(.fds-btn--first):not([aria-disabled='true'], :disabled):hover {
background-color: var(--fds-semantic-surface-action-first-hover);
}

.fds-btn--primary:where(.fds-btn--second):not([aria-disabled='true'], :disabled):hover {
background-color: var(--fds-semantic-surface-action-second-hover);
}

.fds-btn--primary:where(.fds-btn--success):not([aria-disabled='true'], :disabled):hover {
background-color: var(--fds-semantic-surface-success-hover);
}

.fds-btn--primary:where(.fds-btn--danger):not([aria-disabled='true'], :disabled):hover {
background-color: var(--fds-semantic-surface-danger-hover);
}

.fds-btn--secondary:where(.fds-btn--first):not([aria-disabled='true'], :disabled):hover {
color: var(--fds-semantic-text-action-first-hover);
border-color: var(--fds-semantic-border-action-first-hover);
background-color: var(--fds-semantic-surface-action-first-no_fill-hover);
}

.fds-btn--secondary:where(.fds-btn--second):not([aria-disabled='true'], :disabled):hover {
color: var(--fds-semantic-text-action-second-hover);
border-color: var(--fds-semantic-border-action-second-hover);
background-color: var(--fds-semantic-surface-action-second-no_fill-hover);
}

.fds-btn--secondary:where(.fds-btn--success):not([aria-disabled='true'], :disabled):hover {
color: var(--fds-semantic-text-success-hover);
border-color: var(--fds-semantic-border-success-hover);
background-color: var(--fds-semantic-surface-success-no_fill-hover);
}

.fds-btn--secondary:where(.fds-btn--danger):not([aria-disabled='true'], :disabled):hover {
color: var(--fds-semantic-text-danger-hover);
border-color: var(--fds-semantic-border-danger-hover);
background-color: var(--fds-semantic-surface-danger-no_fill-hover);
}

.fds-btn--tertiary:where(.fds-btn--first):not([aria-disabled='true'], :disabled):hover {
color: var(--fds-semantic-text-action-first-hover);
background-color: var(--fds-semantic-surface-action-first-no_fill-hover);
}

.fds-btn--tertiary:where(.fds-btn--second):not([aria-disabled='true'], :disabled):hover {
color: var(--fds-semantic-text-action-second-hover);
background-color: var(--fds-semantic-surface-action-second-no_fill-hover);
}

.fds-btn--tertiary:where(.fds-btn--success):not([aria-disabled='true'], :disabled):hover {
color: var(--fds-semantic-text-success-hover);
background-color: var(--fds-semantic-surface-success-no_fill-hover);
}

.fds-btn--tertiary:where(.fds-btn--danger):not([aria-disabled='true'], :disabled):hover {
color: var(--fds-semantic-text-danger-hover);
background-color: var(--fds-semantic-surface-danger-no_fill-hover);
}
}

.fds-btn--primary:where(.fds-btn--first):not([aria-disabled='true'], :disabled):active {
background-color: var(--fds-semantic-surface-action-first-active);
}

.fds-btn--primary:where(.fds-btn--second):not([aria-disabled='true'], :disabled):active {
background-color: var(--fds-semantic-surface-action-second-active);
}

.fds-btn--primary:where(.fds-btn--success):not([aria-disabled='true'], :disabled):active {
background-color: var(--fds-semantic-surface-success-active);
}

.fds-btn--primary:where(.fds-btn--danger):not([aria-disabled='true'], :disabled):active {
background-color: var(--fds-semantic-surface-danger-active);
}

/* Secondary button colors */
.fds-btn--secondary:where(.fds-btn--first) {
color: var(--fds-semantic-text-action-first-default);
border-color: var(--fds-semantic-border-action-first-default);
background-color: var(--fds-semantic-surface-action-first-no_fill);
}

.fds-btn--secondary:where(.fds-btn--second) {
color: var(--fds-semantic-text-action-second-default);
border-color: var(--fds-semantic-border-action-second-default);
background-color: var(--fds-semantic-surface-action-second-no_fill);
}

.fds-btn--secondary:where(.fds-btn--success) {
color: var(--fds-semantic-text-success-default);
border-color: var(--fds-semantic-border-success-default);
background-color: var(--fds-semantic-surface-success-no_fill);
}

.fds-btn--secondary:where(.fds-btn--danger) {
color: var(--fds-semantic-text-danger-default);
border-color: var(--fds-semantic-border-danger-default);
background-color: var(--fds-semantic-surface-danger-no_fill);
}

.fds-btn--secondary:where(.fds-btn--first):not([aria-disabled='true'], :disabled):active {
color: var(--fds-semantic-text-action-first-active);
border-color: var(--fds-semantic-border-action-first-active);
background-color: var(--fds-semantic-surface-action-first-no_fill-active);
}

.fds-btn--secondary:where(.fds-btn--second):not([aria-disabled='true'], :disabled):active {
color: var(--fds-semantic-text-action-second-active);
border-color: var(--fds-semantic-border-action-second-active);
background-color: var(--fds-semantic-surface-action-second-no_fill-active);
}

.fds-btn--secondary:where(.fds-btn--success):not([aria-disabled='true'], :disabled):active {
color: var(--fds-semantic-text-success-active);
border-color: var(--fds-semantic-border-success-active);
background-color: var(--fds-semantic-surface-success-no_fill-active);
}

.fds-btn--secondary:where(.fds-btn--danger):not([aria-disabled='true'], :disabled):active {
color: var(--fds-semantic-text-danger-active);
border-color: var(--fds-semantic-border-danger-active);
background-color: var(--fds-semantic-surface-danger-no_fill-active);
}

/* Tertiary button colors */
.fds-btn--tertiary:where(.fds-btn--first) {
color: var(--fds-semantic-text-action-first-default);
}

.fds-btn--tertiary:where(.fds-btn--second) {
color: var(--fds-semantic-text-action-second-default);
}

.fds-btn--tertiary:where(.fds-btn--success) {
color: var(--fds-semantic-text-success-default);
}

.fds-btn--tertiary:where(.fds-btn--danger) {
color: var(--fds-semantic-text-danger-default);
}

.fds-btn--tertiary:where(.fds-btn--first):not([aria-disabled='true'], :disabled):active {
color: var(--fds-semantic-text-action-first-active);
background-color: var(--fds-semantic-surface-action-first-no_fill-active);
}

.fds-btn--tertiary:where(.fds-btn--second):not([aria-disabled='true'], :disabled):active {
color: var(--fds-semantic-text-action-second-active);
background-color: var(--fds-semantic-surface-action-second-no_fill-active);
}

.fds-btn--tertiary:where(.fds-btn--success):not([aria-disabled='true'], :disabled):active {
color: var(--fds-semantic-text-success-active);
background-color: var(--fds-semantic-surface-success-no_fill-active);
}

.fds-btn--tertiary:where(.fds-btn--danger):not([aria-disabled='true'], :disabled):active {
color: var(--fds-semantic-text-danger-active);
background-color: var(--fds-semantic-surface-danger-no_fill-active);
}
}
3 changes: 3 additions & 0 deletions packages/css/index.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@charset "UTF-8";

/** Import order defines ordinal specificity for layers */
@import url('./react-css-modules.css');
@import url('./button.css');
@import url('./utils.css');
@import url('./alert.css');
@import url('./ingress.css');
@import url('./skiplink.css');
2 changes: 1 addition & 1 deletion packages/css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digdir/designsystemet-css",
"version": "0.5.0",
"version": "0.6.0",
"description": "CSS for Designsystemet",
"author": "Designsystemet team",
"repository": "https://github.com/digdir/designsystemet",
Expand Down
Loading

0 comments on commit 5232c9e

Please sign in to comment.