Skip to content

Commit

Permalink
Merge branch 'next' into docs/systemvarsler
Browse files Browse the repository at this point in the history
  • Loading branch information
mrosvik authored Dec 9, 2024
2 parents a2ca719 + 0f87a12 commit b6473e8
Show file tree
Hide file tree
Showing 32 changed files with 119 additions and 168 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-rings-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-react": major
---

ValidationMessage: use `data-color="danger | success"` instead of `data-error="true | false"`
3 changes: 3 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"eleven-bags-shop",
"eleven-experts-raise",
"eleven-peaches-agree",
"eleven-rings-travel",
"empty-pears-hide",
"empty-singers-yell",
"fair-beds-destroy",
Expand Down Expand Up @@ -91,6 +92,7 @@
"nine-cameras-peel",
"nine-countries-invent",
"ninety-horses-juggle",
"ninety-jeans-punch",
"odd-hornets-sleep",
"old-melons-stare",
"old-sheep-dress",
Expand Down Expand Up @@ -123,6 +125,7 @@
"short-kiwis-turn",
"short-walls-judge",
"shy-cameras-approve",
"silver-penguins-occur",
"six-carrots-guess",
"six-trees-tie",
"slimy-bees-arrive",
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Change Log

## 1.0.0-next.40

## 1.0.0-next.39

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digdir/designsystemet",
"version": "1.0.0-next.39",
"version": "1.0.0-next.40",
"description": "CLI for Designsystemet",
"author": "Designsystemet team",
"repository": {
Expand Down
6 changes: 6 additions & 0 deletions packages/css/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 1.0.0-next.40

### Patch Changes

- Rename `Accordion` to `Details` ([#2839](https://github.com/digdir/designsystemet/pull/2839))

## 1.0.0-next.39

## 1.0.0-next.38
Expand Down
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": "1.0.0-next.39",
"version": "1.0.0-next.40",
"description": "CSS for Designsystemet",
"author": "Designsystemet team",
"repository": {
Expand Down
12 changes: 2 additions & 10 deletions packages/css/src/avatar.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
.ds-avatar {
--dsc-avatar-icon-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' fill='none' viewBox='0 0 24 24' focusable='false' role='img'%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M8.25 7.5a3.75 3.75 0 1 1 7.5 0 3.75 3.75 0 0 1-7.5 0M12 2.25a5.25 5.25 0 1 0 0 10.5 5.25 5.25 0 0 0 0-10.5M8.288 17.288A5.25 5.25 0 0 1 17.25 21a.75.75 0 0 0 1.5 0 6.75 6.75 0 0 0-13.5 0 .75.75 0 0 0 1.5 0 5.25 5.25 0 0 1 1.538-3.712' clip-rule='evenodd'%3E%3C/path%3E%3C/svg%3E");

/* default color: accent */
--dsc-avatar-background: var(--ds-color-accent-base-default);
--dsc-avatar-color: var(--ds-color-accent-contrast-default);

&[data-color] {
--dsc-avatar-background: var(--ds-color-base-default);
--dsc-avatar-color: var(--ds-color-contrast-default);
}

--dsc-avatar-background: var(--ds-color-base-default);
--dsc-avatar-color: var(--ds-color-contrast-default);
--dsc-avatar-size: var(--ds-sizing-12);
--dsc-avatar-padding: var(--ds-spacing-2);
--dsc-avatar-border-radius: var(--ds-border-radius-full);
Expand Down
2 changes: 2 additions & 0 deletions packages/css/src/badge.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
--dsc-badge-background: var(--ds-color-base-default);
--dsc-badge-color: var(--ds-color-contrast-default);

/* What do we do here? */

&[data-color='neutral'] {
--dsc-badge-background: var(--ds-color-neutral-surface-default);
--dsc-badge-color: var(--ds-color-neutral-text-default);
Expand Down
7 changes: 2 additions & 5 deletions packages/css/src/breadcrumbs.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
--dsc-breadcrumbs-spacing: var(--ds-spacing-2);
--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");
--dsc-breadcrumbs-color: var(--ds-color-text-subtle);

& > :is(ol, ul) {
display: flex;
Expand All @@ -12,18 +13,14 @@
gap: var(--dsc-breadcrumbs-spacing) 0;
}

& a:not(:focus-visible) {
color: inherit;
}

& a[aria-current='page'] {
text-decoration: none;
}

/* Draw chevron between items and before back link */
& li:where(:not(:last-child))::after,
& > :not(ol, ul)::before {
background: currentcolor;
background: var(--dsc-breadcrumbs-color);
content: '';
display: inline-block;
height: var(--dsc-breadcrumbs-chevron-size);
Expand Down
22 changes: 10 additions & 12 deletions packages/css/src/button.css
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
.ds-button {
/* default color: accent */
--dsc-button-background--active: var(--ds-color-accent-base-active);
--dsc-button-background--hover: var(--ds-color-accent-base-hover);
--dsc-button-background: var(--ds-color-accent-base-default);
--dsc-button-color: var(--ds-color-accent-contrast-default);
--dsc-button-color--hover: var(--ds-color-accent-contrast-default);
--dsc-button-background--active: var(--ds-color-base-active);
--dsc-button-background--hover: var(--ds-color-base-hover);
--dsc-button-background: var(--ds-color-base-default);
--dsc-button-color: var(--ds-color-contrast-default);
--dsc-button-color--hover: var(--ds-color-contrast-default);
--dsc-button-border-color: transparent;
--dsc-button-font-size: var(--ds-font-size-5);
--dsc-button-gap: var(--ds-spacing-2);
--dsc-button-padding: var(--ds-spacing-2) var(--ds-spacing-4);
--dsc-button-size: var(--ds-sizing-12);

&[data-variant='secondary'],
&[data-variant='tertiary'] {
--dsc-button-background: transparent;
--dsc-button-background--active: var(--ds-color-accent-surface-active);
--dsc-button-background--hover: var(--ds-color-accent-surface-hover);
--dsc-button-color: var(--ds-color-accent-text-subtle);
--dsc-button-color--hover: var(--ds-color-accent-text-default);
--dsc-button-background--active: var(--ds-color-surface-active);
--dsc-button-background--hover: var(--ds-color-surface-hover);
--dsc-button-color: var(--ds-color-text-subtle);
--dsc-button-color--hover: var(--ds-color-text-default);
}
&[data-variant='secondary'] {
--dsc-button-border-color: var(--ds-color-accent-border-strong);
--dsc-button-border-color: var(--ds-color-border-strong);
}

&[data-color] {
Expand Down
31 changes: 13 additions & 18 deletions packages/css/src/card.css
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
.ds-card {
/* default color: neutral */
--dsc-card-background--active: var(--ds-color-neutral-surface-default);
--dsc-card-background--hover: var(--ds-color-neutral-background-subtle);
--dsc-card-background: var(--ds-color-neutral-background-default);
--dsc-card-border-color: var(--ds-color-neutral-border-subtle);
--dsc-card-color: var(--ds-color-neutral-text-default);

&[data-color]:where(:not([data-color='subtle'])) {
--dsc-card-background--active: var(--ds-color-surface-active);
--dsc-card-background--hover: var(--ds-color-surface-hover);
--dsc-card-background: var(--ds-color-surface-default);
--dsc-card-border-color: var(--ds-color-border-subtle);
--dsc-card-color: var(--ds-color-text-default);
}
--dsc-card-background--active: var(--ds-color-surface-active);
--dsc-card-background--hover: var(--ds-color-surface-hover);
--dsc-card-background: var(--ds-color-surface-default);
--dsc-card-border-color: var(--ds-color-border-subtle);
--dsc-card-color: var(--ds-color-text-default);
--dsc-card-border: 1px solid var(--dsc-card-border-color);
--dsc-card-gap: var(--ds-spacing-3);
--dsc-card-padding: var(--ds-spacing-6);

&[data-color='neutral'] {
--dsc-card-background: var(--ds-color-background-default);
}
&[data-color='subtle'] {
--dsc-card-background--active: var(--ds-color-neutral-surface-default);
--dsc-card-background--hover: var(--ds-color-neutral-background-subtle);
--dsc-card-background: var(--ds-color-neutral-background-subtle);
--dsc-card-border-color: var(--ds-color-neutral-border-subtle);
--dsc-card-color: var(--ds-color-neutral-text-default);
}

--dsc-card-border: 1px solid var(--dsc-card-border-color);
--dsc-card-gap: var(--ds-spacing-3);
--dsc-card-padding: var(--ds-spacing-6);

background: var(--dsc-card-background);
border-radius: var(--ds-border-radius-lg);
border: var(--dsc-card-border);
Expand Down
1 change: 0 additions & 1 deletion packages/css/src/chip.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
--dsc-chip-color--checked: var(--ds-color-contrast-default);
--dsc-chip-input-color: var(--ds-color-border-strong);
--dsc-chip-input-color--checked: var(--ds-color-base-default);

--dsc-chip-border-radius: var(--ds-border-radius-full);
--dsc-chip-height: var(--ds-sizing-8);
--dsc-chip-icon-size: var(--ds-spacing-7);
Expand Down
10 changes: 5 additions & 5 deletions packages/css/src/details.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
--dsc-details-padding: var(--ds-spacing-2) var(--ds-spacing-4);
--dsc-details-size: var(--ds-sizing-14);

/* default color: neutral */
--dsc-details-heading-background--hover: var(--ds-color-neutral-surface-default);
--dsc-details-heading-background--open: var(--ds-color-neutral-background-subtle);
--dsc-details-heading-background: var(--ds-color-neutral-background-default);
--dsc-details-border-color: var(--ds-color-neutral-border-subtle);
--dsc-details-background: var(--ds-color-background-default);
--dsc-details-heading-background--hover: var(--ds-color-surface-default);
--dsc-details-heading-background--open: var(--ds-color-background-subtle);
--dsc-details-heading-background: var(--ds-color-background-default);
--dsc-details-border-color: var(--ds-color-border-subtle);

/* with color */
[data-color]:where(:not([data-color='neutral'])) &,
Expand Down
7 changes: 5 additions & 2 deletions packages/css/src/dropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
--dsc-dropdown-padding: var(--ds-spacing-3) var(--ds-spacing-2);
--dsc-dropdown-item-padding: var(--ds-spacing-2) var(--ds-spacing-4);
--dsc-dropdown-item-size: var(--ds-spacing-12);
--dsc-dropdown-background: var(--ds-color-neutral-background-default);
--dsc-dropdow-border-color: var(--ds-color-neutral-border-subtle);
--dsc-dropdown-border: 1px solid var(--dsc-dropdow-border-color);

background-color: var(--ds-color-neutral-background-default);
background: var(--dsc-dropdown-background);
border-radius: var(--ds-border-radius-md);
border: 1px solid var(--ds-color-neutral-border-subtle);
border: var(--dsc-dropdown-border);
box-shadow: var(--ds-shadow-md);
box-sizing: border-box;
list-style: none;
Expand Down
19 changes: 5 additions & 14 deletions packages/css/src/link.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.ds-link {
/* default color: accent */
--dsc-link-background--active: var(--ds-color-accent-surface-default);
--dsc-link-color--active: var(--ds-color-accent-text-default);
--dsc-link-color--hover: var(--ds-color-accent-text-default);
--dsc-link-color: var(--ds-color-accent-text-subtle);
--dsc-link-background--active: var(--ds-color-surface-default);
--dsc-link-color--active: var(--ds-color-text-default);
--dsc-link-color--hover: var(--ds-color-text-default);
--dsc-link-color: var(--ds-color-text-subtle);
--dsc-link-background--focus: var(--ds-color-focus-outer);
--dsc-link-color--focus: var(--ds-color-focus-inner);
--dsc-link-color--visited: var(--ds-global-purple-12);
Expand All @@ -20,15 +19,7 @@
vertical-align: middle; /* Align img or svg icon with text */
}

/**
* Colors
*/
&[data-color] {
--dsc-link-background--active: var(--ds-color-surface-default);
--dsc-link-color--active: var(--ds-color-text-default);
--dsc-link-color--hover: var(--ds-color-text-default);
--dsc-link-color: var(--ds-color-text-subtle);
}
/* What do we do here? */
&[data-color='neutral'] {
--dsc-link-color--active: var(--ds-color-neutral-text-subtle);
--dsc-link-color--hover: var(--ds-color-neutral-text-subtle);
Expand Down
13 changes: 4 additions & 9 deletions packages/css/src/popover.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.ds-popover {
--dsc-popover-background: var(--ds-color-neutral-background-default);
--dsc-popover-border-color: var(--ds-color-neutral-border-default);
--dsc-popover-color: var(--ds-color-neutral-text-default);
--dsc-popover-background: var(--ds-color-surface-default);
--dsc-popover-border-color: var(--ds-color-border-default);
--dsc-popover-color: var(--ds-color-text-default);
--dsc-popover-arrow-size: var(--ds-spacing-2);
--dsc-popover-border-radius: var(--ds-border-radius-md);
--dsc-popover-border: 1px solid var(--dsc-popover-border-color);
Expand Down Expand Up @@ -50,12 +50,7 @@
rotate: -135deg;
}

&[data-color] {
--dsc-popover-background: var(--ds-color-surface-default);
--dsc-popover-border-color: var(--ds-color-border-default);
--dsc-popover-color: var(--ds-color-text-default);
}

/* What do we do here? */
&[data-color='neutral'] {
--dsc-popover-background: var(--ds-color-neutral-background-default);
}
Expand Down
9 changes: 2 additions & 7 deletions packages/css/src/tag.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
.ds-tag {
--dsc-tag-background: var(--ds-color-neutral-background-default);
--dsc-tag-color: var(--ds-color-neutral-text-default);

&[data-color] {
--dsc-tag-background: var(--ds-color-surface-default);
--dsc-tag-color: var(--ds-color-text-default);
}
--dsc-tag-background: var(--ds-color-surface-default);
--dsc-tag-color: var(--ds-color-text-default);
--dsc-tag-min-height: var(--ds-sizing-8);
--dsc-tag-padding: 0 var(--ds-spacing-2);

Expand Down
3 changes: 2 additions & 1 deletion packages/css/src/togglegroup.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.ds-togglegroup {
--dsc-togglegroup-background: var(--ds-color-neutral-background-default);
--dsc-togglegroup-background: var(--ds-color-background-default);
/* Todo: Explore the border color here */
--dsc-togglegroup-border: var(--ds-border-width-default) solid var(--ds-color-neutral-border-default);
--dsc-togglegroup-padding: var(--ds-spacing-1);
--dsc-togglegroup-border-radius: var(--ds-border-radius-default);
Expand Down
2 changes: 1 addition & 1 deletion packages/css/src/validation-message.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
position: relative;

/* Only render error icon if the ValidationMessage actually contains an error message */
&[data-error]:not(:empty) {
&:not([data-color='success']):not(:empty) {
color: var(--ds-color-danger-text-subtle);
padding-inline-start: calc(var(--dsc-validation-message-icon-size) + var(--dsc-validation-message-gap));

Expand Down
12 changes: 12 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change Log

## 1.0.0-next.40

### Major Changes

- ValidationMessage: use `data-color="danger | success"` instead of `data-error="true | false"` ([#2860](https://github.com/digdir/designsystemet/pull/2860))

### Patch Changes

- React: Set `"type": "module"` in `package.json` ([#2842](https://github.com/digdir/designsystemet/pull/2842))

- Rename `Accordion` to `Details` ([#2839](https://github.com/digdir/designsystemet/pull/2839))

## 1.0.0-next.39

## 1.0.0-next.38
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@digdir/designsystemet-react",
"type": "module",
"version": "1.0.0-next.39",
"version": "1.0.0-next.40",
"description": "React components for Designsystemet",
"author": "Designsystemet team",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export const Composed: Story = () => (
<Textfield label='Etternavn' />
</Card.Block>
<Card.Block>
<Button variant='secondary' data-size='sm'>
<Button variant='secondary' data-color='accent' data-size='sm'>
Legg til rolle
<PlusIcon aria-hidden />
</Button>
Expand Down
6 changes: 1 addition & 5 deletions packages/react/src/components/HelpText/HelpText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@ import type { Placement } from '@floating-ui/utils';
import cl from 'clsx/lite';
import { forwardRef } from 'react';
import type { ButtonHTMLAttributes } from 'react';

import type { Color } from '../../colors';
import type { DefaultProps } from '../../types';
import type { MergeRight } from '../../utilities';
import { Popover } from '../Popover';

export type HelpTextProps = MergeRight<
DefaultProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'>,
{
/** Specify which color palette to use. If left unspecified, the color is inherited from the nearest ancestor with data-color.
*/
'data-color'?: Color;
/**
* Required descriptive label for screen readers.
**/
Expand All @@ -37,6 +32,7 @@ export const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
className={cl('ds-helptext', className)}
ref={ref}
variant='tertiary'
data-color='info'
{...rest}
/>
<Popover placement={placement} data-color='info'>
Expand Down
Loading

0 comments on commit b6473e8

Please sign in to comment.