-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/storefront-clean-layouts
- Loading branch information
Showing
106 changed files
with
16,438 additions
and
16,710 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,47 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
# [0.26.0](https://github.com/digdir/designsystem/compare/@digdir/[email protected]...@digdir/[email protected]) (2023-09-22) | ||
|
||
### Bug Fixes | ||
|
||
- **Textfield:** :lipstick: Style adjustments after feedback ([#852](https://github.com/digdir/designsystem/issues/852)) ([4544f1e](https://github.com/digdir/designsystem/commit/4544f1e96fb90c00360377b2a18998e9bce36f16)) | ||
|
||
### Features | ||
|
||
- **Textarea:** :sparkles: New `Textarea` component ([#851](https://github.com/digdir/designsystem/issues/851)) ([9d9c3ab](https://github.com/digdir/designsystem/commit/9d9c3ab390cea40bd3137845fd2b7fb251c84b7a)) | ||
- **TextArea:** :wastebasket: Change to Legacy ([#853](https://github.com/digdir/designsystem/issues/853)) ([9da973f](https://github.com/digdir/designsystem/commit/9da973f9db34576ad89f5d31f07ccfc933f84ee7)) | ||
|
||
## [0.25.1](https://github.com/digdir/designsystem/compare/@digdir/[email protected]...@digdir/[email protected]) (2023-09-22) | ||
|
||
### Bug Fixes | ||
|
||
- **Textfield:** Prop typo ([#848](https://github.com/digdir/designsystem/issues/848)) ([0c59b86](https://github.com/digdir/designsystem/commit/0c59b86f661222e0021311cd5eba6c7aa429ea8c)) | ||
|
||
# [0.25.0](https://github.com/digdir/designsystem/compare/@digdir/[email protected]...@digdir/[email protected]) (2023-09-21) | ||
|
||
### Features | ||
|
||
- **ErrorMessage:** :sparkles: Add new option to toggle error color ([#836](https://github.com/digdir/designsystem/issues/836)) ([8b177f3](https://github.com/digdir/designsystem/commit/8b177f3f25b3c2075d38f8f5e8a438d8727b5c98)) | ||
- **ErrorMessage:** ✨ Add `large` size ([#840](https://github.com/digdir/designsystem/issues/840)) ([9742abf](https://github.com/digdir/designsystem/commit/9742abf1d002967fdfdb6b3caa8f33bb11a85019)) | ||
- **Fieldset, Switch, Radio, Checkbox:** :sparkles: Add `large` size ([#841](https://github.com/digdir/designsystem/issues/841)) ([4e8052f](https://github.com/digdir/designsystem/commit/4e8052fc6a886b68676ca5de0a47d80eadb93656)) | ||
- **Textfield:** :sparkles: New `Textfield` component ([#816](https://github.com/digdir/designsystem/issues/816)) ([0c14cfa](https://github.com/digdir/designsystem/commit/0c14cfa3c6add379ada2f5e11dd2b6a0de05aa56)) | ||
- **TextField:** 🗑️ Change to Legacy ([#838](https://github.com/digdir/designsystem/issues/838)) ([c3d6d2d](https://github.com/digdir/designsystem/commit/c3d6d2d684ff764fe96a92e1852ddf115cf1ec62)) | ||
|
||
## [0.24.2](https://github.com/digdir/designsystem/compare/@digdir/[email protected]...@digdir/[email protected]) (2023-09-19) | ||
|
||
### Bug Fixes | ||
|
||
- **Switch:** :bug: Adher to passed `checked` & `defaultChecked` props ([#832](https://github.com/digdir/designsystem/issues/832)) ([13a4577](https://github.com/digdir/designsystem/commit/13a45774943d01c6ea3cb9e7056b1686dfa9a358)) | ||
|
||
## [0.24.1](https://github.com/digdir/designsystem/compare/@digdir/[email protected]...@digdir/[email protected]) (2023-09-18) | ||
|
||
### Bug Fixes | ||
|
||
- **Accordion:** hide content in Accordions from screen readers when Accordion is closed ([#815](https://github.com/digdir/designsystem/issues/815)) ([eea59af](https://github.com/digdir/designsystem/commit/eea59af9d09c59ba8da734a0b5cf60bd704661d1)) | ||
- **Radio, Checkbox, Button, Chip.Toggle:** Remove sticky hover on touch devices ([#803](https://github.com/digdir/designsystem/issues/803)) ([a4be791](https://github.com/digdir/designsystem/commit/a4be7918b49a607ebfa7042b3aa2d8e2f798a016)) | ||
- **Radio, Checkbox, Switch:** :bug: Remove z-index on selection control icon ([#798](https://github.com/digdir/designsystem/issues/798)) ([6c1db8b](https://github.com/digdir/designsystem/commit/6c1db8bf213e62eb9b788ac82e3114e90cd9f052)) | ||
|
||
# [0.24.0](https://github.com/digdir/designsystem/compare/@digdir/[email protected]...@digdir/[email protected]) (2023-08-31) | ||
|
||
### Features | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
|
||
import utilityClasses from '../../utils/utility.module.css'; | ||
import { ErrorMessage } from '../Typography'; | ||
|
||
export type CharacterLimitProps = Omit< | ||
CharacterCounterProps, | ||
'id' | 'value' | 'size' | ||
>; | ||
|
||
type CharacterCounterProps = { | ||
/** The message indicating the remaining character limit. */ | ||
label?: (count: number) => string; | ||
/** The description of the maximum character limit for screen readers. */ | ||
srLabel?: string; | ||
/** The maximum allowed character count. */ | ||
maxCount: number; | ||
/** The current value. */ | ||
value: string; | ||
/** The ID of the element that describes the maximum character limit for accessibility purposes. */ | ||
id: string; | ||
/** Text size */ | ||
size?: 'xsmall' | 'small' | 'medium' | 'large'; | ||
}; | ||
|
||
const defaultLabel: CharacterCounterProps['label'] = (count) => | ||
count > -1 ? `${count} tegn igjen` : `${Math.abs(count)} tegn for mye`; | ||
|
||
const defaultSrLabel = (maxCount: number) => | ||
`Tekstfelt med plass til ${maxCount} tegn`; | ||
|
||
export const CharacterCounter = ({ | ||
label = defaultLabel, | ||
srLabel: propsSrLabel, | ||
maxCount, | ||
value, | ||
id, | ||
size, | ||
}: CharacterCounterProps): JSX.Element => { | ||
const currentCount = maxCount - value.length; | ||
const hasExceededLimit = value.length > maxCount; | ||
const srLabel = propsSrLabel ? propsSrLabel : defaultSrLabel(maxCount); | ||
|
||
return ( | ||
<> | ||
<span | ||
className={utilityClasses.visuallyHidden} | ||
id={id} | ||
> | ||
{srLabel} | ||
</span> | ||
<ErrorMessage | ||
as='span' | ||
size={size} | ||
aria-live={hasExceededLimit ? 'polite' : 'off'} | ||
error={hasExceededLimit} | ||
> | ||
{label(currentCount)} | ||
</ErrorMessage> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Meta, Canvas, Story, Controls, Primary } from '@storybook/blocks'; | ||
import { Information } from '../../../../../../docs-components'; | ||
import * as TextareaStories from './Textarea.stories'; | ||
|
||
<Meta of={TextareaStories} /> | ||
|
||
# Textarea | ||
|
||
<Primary /> | ||
<Controls /> | ||
|
||
## Antall tegn | ||
|
||
<Canvas of={TextareaStories.WithCharacterCounter} /> | ||
|
||
## Kontrollert | ||
|
||
<Canvas of={TextareaStories.Controlled} /> | ||
|
||
## Full bredde | ||
|
||
<Canvas of={TextareaStories.FullWidth} /> |
Oops, something went wrong.