mirror of
https://github.com/navikt/aksel.git
synced 2026-10-13 01:02:02 +00:00
Compare commits
80
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6eb8a79092 | ||
|
|
718b3204d8 | ||
|
|
45970ac0fb | ||
|
|
fe5e8ada74 | ||
|
|
3e625a5cb5 | ||
|
|
edc3495ce6 | ||
|
|
2520bc7ff5 | ||
|
|
44446e753a | ||
|
|
4156326752 | ||
|
|
23970486ed | ||
|
|
a8f1069650 | ||
|
|
f9c8320b74 | ||
|
|
c4839a12ed | ||
|
|
60f64d7f70 | ||
|
|
e32dbe5c5d | ||
|
|
de36269582 | ||
|
|
6cb6c52770 | ||
|
|
a877d24ed0 | ||
|
|
a1b6332fa1 | ||
|
|
99c08b8e4a | ||
|
|
d39ed906c6 | ||
|
|
3b31bd3d75 | ||
|
|
b1625ba388 | ||
|
|
269d06c277 | ||
|
|
0c56273f3b | ||
|
|
ab6a96aed7 | ||
|
|
9ee8a72082 | ||
|
|
c2e5a92d8e | ||
|
|
6059aa59aa | ||
|
|
b877ada408 | ||
|
|
4e339f183e | ||
|
|
1d62bf26ff | ||
|
|
da0fbc3299 | ||
|
|
9f59e67e2a | ||
|
|
ed7aafcac8 | ||
|
|
dfbbe92a63 | ||
|
|
42b5af64ab | ||
|
|
329119fa04 | ||
|
|
0fc80f45cb | ||
|
|
337b9fda13 | ||
|
|
659e835da9 | ||
|
|
e10f4375b1 | ||
|
|
9a8bb26c36 | ||
|
|
69aea38784 | ||
|
|
8f16d1571e | ||
|
|
e2265c9a78 | ||
|
|
925aa7a140 | ||
|
|
7c17e40cac | ||
|
|
3c8889ea88 | ||
|
|
e060961050 | ||
|
|
18aa4ee7fb | ||
|
|
f44edd76a2 | ||
|
|
1fa636bdd5 | ||
|
|
44a75acb6b | ||
|
|
550faee900 | ||
|
|
88b6174b0b | ||
|
|
fbf016b3bd | ||
|
|
09fa503b98 | ||
|
|
f5688485f5 | ||
|
|
6385c4686e | ||
|
|
30068dca3f | ||
|
|
3aa04d2375 | ||
|
|
91343563c9 | ||
|
|
d5c8112339 | ||
|
|
e6cc9d1b4f | ||
|
|
db8c38a094 | ||
|
|
35041e64eb | ||
|
|
690422d824 | ||
|
|
b54bebd308 | ||
|
|
8db194170c | ||
|
|
7b42f536aa | ||
|
|
b2f796d681 | ||
|
|
17d92c9ed5 | ||
|
|
7bae5dce88 | ||
|
|
6aca0a4b6a | ||
|
|
4f7fde22a3 | ||
|
|
0dad69a8df | ||
|
|
c028f36e2b | ||
|
|
988fb36619 | ||
|
|
f61cd88627 |
No files matched your search
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json",
|
||||
"changelog": ["@changesets/changelog-github", { "repo": "navikt/aksel" }],
|
||||
"changelog": [
|
||||
"@svitejs/changesets-changelog-github-compact",
|
||||
{ "repo": "navikt/aksel" }
|
||||
],
|
||||
"commit": false,
|
||||
"fixed": [
|
||||
[
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
### Description
|
||||
|
||||
<!-- PR description/motivation
|
||||
add links to project-tasks, slack discussions etc here
|
||||
-->
|
||||
|
||||
### Change summary
|
||||
|
||||
<!-- Short summary of changes in PR
|
||||
- added variant x
|
||||
- fixed bug in y
|
||||
-->
|
||||
|
||||
### PR Checklist 📝 (Remove fields after check!)
|
||||
|
||||
#### New component? ✨
|
||||
|
||||
- Check that component-styling is correctly configured in `@navikt/core/css/config/_mappings.js`. This is needed for correct build and CDN upload.
|
||||
- Check that styling is correctly exported from `@navikt/core/css/index.css`
|
||||
- Check that correct tokens for component is documented in `@navikt/core/css/tokens.json`
|
||||
- Check that only needed components and types are exported from `@navikt/core/react/src/index.ts`
|
||||
- Add JSDoc to component (see other components for reference)
|
||||
- Create storybook-stories for relevant component variations and compositions. Stories are used for [visual regression testing](https://www.chromatic.com/docs/), so make sure they are complete.
|
||||
- Is the component sufficiently complex to warrant tests? Add some unit-tests for jest.
|
||||
|
||||
#### Component-updates 🎉
|
||||
|
||||
- Revalidate if everything under `New component` is still accounted for
|
||||
- Deprecating/removing a CSS class? Add it to `@navikt/aksel-stylelint/src/deprecations.ts` with a suitable description. This helps stylelint-users keep their code clean and bug-free.
|
||||
|
||||
#### Documentation 📝
|
||||
|
||||
- Add/update component-demos for component `aksel.nav.no/website/pages/eksempler`
|
||||
- Create/Update documentation in sanity if needed
|
||||
Note: Props, tokens and examples only updates to sanity on merge to main
|
||||
|
||||
#### Versioning 🏷️
|
||||
|
||||
- Run `yarn changeset` to generate a version-entry for change.
|
||||
- - Bug/hotfix: Patch
|
||||
- - New feature: Minor
|
||||
- - Breaking change: Major
|
||||
- Adding breaking changes? Consider adding a codemod for easier migration.
|
||||
- Breaking changes also needs documentation under "Migration"-page on website
|
||||
@@ -13,7 +13,7 @@ jobs:
|
||||
playwright:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.33.0-focal
|
||||
image: mcr.microsoft.com/playwright:v1.35.1-jammy
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
|
||||
@@ -28,6 +28,10 @@ jobs:
|
||||
node-version: 16.13.0
|
||||
cache: yarn
|
||||
|
||||
- uses: denoland/setup-deno@v1
|
||||
with:
|
||||
deno-version: v1.x
|
||||
|
||||
- name: Restore cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
name: Smoketest Aksel
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.33.0-focal
|
||||
image: mcr.microsoft.com/playwright:v1.35.1-jammy
|
||||
steps:
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
|
||||
+2
-1
@@ -150,4 +150,5 @@ playwright-report/
|
||||
/test-results/
|
||||
backup-*.tar.gz
|
||||
sitemap-urls.json
|
||||
*.tar.gz
|
||||
*.tar.gz
|
||||
searchindex.json
|
||||
@@ -1,208 +1,89 @@
|
||||
# @navikt/aksel-icons
|
||||
|
||||
## 4.0.0
|
||||
## 4.4.2
|
||||
|
||||
## 3.4.2
|
||||
## 4.4.1
|
||||
|
||||
## 3.4.1
|
||||
## 4.1.5
|
||||
|
||||
## 3.4.0
|
||||
### Patch Changes
|
||||
|
||||
## 3.3.1
|
||||
|
||||
## 3.3.0
|
||||
|
||||
## 3.2.4
|
||||
- Nye ikoner `ChevronRightLast` og `ChevronLeftLast` ([PR](https://github.com/navikt/aksel/pull/2054))
|
||||
|
||||
## 3.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1998](https://github.com/navikt/aksel/pull/1998) [`53c98181c`](https://github.com/navikt/aksel/commit/53c98181c327ead3406bec3487c10232af7d463a) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :tada: Nye ikoner!
|
||||
|
||||
- :sparkles: FileParagraph
|
||||
- :sparkles: FilePlus
|
||||
|
||||
## 3.2.2
|
||||
|
||||
## 3.2.1
|
||||
|
||||
## 3.2.0
|
||||
|
||||
## 3.1.3
|
||||
|
||||
## 3.1.2
|
||||
|
||||
## 3.1.1
|
||||
|
||||
## 3.1.0
|
||||
|
||||
## 3.0.1
|
||||
|
||||
## 3.0.0
|
||||
- Nye ikoner `FileParagraph` og `FilePlus` ([PR](https://github.com/navikt/aksel/pull/1998))
|
||||
|
||||
## 2.9.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1959](https://github.com/navikt/aksel/pull/1959) [`8790c5997`](https://github.com/navikt/aksel/commit/8790c5997e0d647419bdb5080c86781d08c196b8) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :lipstick: Statusikoner er nå tydeligere og mer konsistente.
|
||||
- Oppdatert Statusikoner til å være tydeligere og mer konsistente. ([PR](https://github.com/navikt/aksel/pull/1959))
|
||||
|
||||
## 2.9.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- :bug: CheckmarkIcon
|
||||
- Fikset `CheckmarkIcon`-bug
|
||||
|
||||
## 2.9.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1956](https://github.com/navikt/aksel/pull/1956) [`8c8559009`](https://github.com/navikt/aksel/commit/8c8559009982911bc4402913656ba4cc6a223dd1) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :bug: Fikset CheckmarkCircleIcon
|
||||
|
||||
## 2.9.5
|
||||
|
||||
## 2.9.4
|
||||
- Fikset `CheckmarkCircleIcon`-bug ([PR](https://github.com/navikt/aksel/pull/1956))
|
||||
|
||||
## 2.9.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1950](https://github.com/navikt/aksel/pull/1950) [`c03d53d5a`](https://github.com/navikt/aksel/commit/c03d53d5aa2dc7f06a223d48069fa21ee39bb396) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :sparkles: Nye ikoner
|
||||
|
||||
- :tada: BulletList
|
||||
- :tada: NumberList
|
||||
|
||||
## 2.9.2
|
||||
|
||||
## 2.9.1
|
||||
|
||||
## 2.9.0
|
||||
|
||||
## 2.8.16
|
||||
- Nye ikoner `BulletList` og `NumberList` ([PR](https://github.com/navikt/aksel/pull/1950))
|
||||
|
||||
## 2.8.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1928](https://github.com/navikt/aksel/pull/1928) [`dfe923582`](https://github.com/navikt/aksel/commit/dfe923582a57b41c77cfb4fbfa7c56be047ef2b0) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :tada: Lagt til nye ikoner :tada:
|
||||
|
||||
- HandKnot.svg
|
||||
- HandKnotFilled.svg
|
||||
|
||||
- [#1930](https://github.com/navikt/aksel/pull/1930) [`6682be1c8`](https://github.com/navikt/aksel/commit/6682be1c8e6562213c64e5be4bed70fef54ab865) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Alle pakker implementerer nå npm provenance (beta)
|
||||
|
||||
## 2.8.14
|
||||
- :tada: Nye ikoner `HandKnot` og `HandKnotFilled` ([PR](https://github.com/navikt/aksel/pull/1928))
|
||||
|
||||
## 2.8.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1921](https://github.com/navikt/aksel/pull/1921) [`ecd6241e5`](https://github.com/navikt/aksel/commit/ecd6241e5751519fbda800a5f41a613957dbf77c) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Oppdatert ikoner :tada:
|
||||
|
||||
## 2.8.12
|
||||
- Oppdatert `InformationSquare`-ikon ([PR](https://github.com/navikt/aksel/pull/1921))
|
||||
|
||||
## 2.8.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1909](https://github.com/navikt/aksel/pull/1909) [`270427910`](https://github.com/navikt/aksel/commit/2704279107a5fbf93048de37d014e78f6721438f) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Oppdatert ikoner
|
||||
|
||||
## 2.8.10
|
||||
|
||||
## 2.8.9
|
||||
- Oppdatert `VideoSlack`, `Questionmark` og `Information`-ikoner ([PR](https://github.com/navikt/aksel/pull/1909))
|
||||
|
||||
## 2.8.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`ed8e28454`](https://github.com/navikt/aksel/commit/ed8e284540a9e3a5be7d1d5e393f31db86962613) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :sparkles: Nye ikoner
|
||||
|
||||
- :tada: VideoSlash
|
||||
- :tada: VideoSlashFill
|
||||
|
||||
## 2.8.7
|
||||
|
||||
## 2.8.6
|
||||
|
||||
## 2.8.5
|
||||
- Nye ikoner `VideoSlash` og `VideoSlashFill`
|
||||
|
||||
## 2.8.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fikset Sourcemap-bug i Aksel-icons
|
||||
|
||||
## 2.8.3
|
||||
|
||||
## 2.8.2
|
||||
|
||||
## 2.8.1
|
||||
|
||||
## 2.8.0
|
||||
|
||||
## 2.7.8
|
||||
- Fikset Sourcemap-bug
|
||||
|
||||
## 2.7.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`a22ac3eb7`](https://github.com/navikt/aksel/commit/a22ac3eb78135bf93d4771802475396849809c03) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :Sparkles: Nye ikoner
|
||||
|
||||
- :tada: CaretUpDownFilledDown
|
||||
- :tada: CaretUpDownFilledUp
|
||||
- :tada: CloudDown
|
||||
- :tada: CloudDownFill
|
||||
- :tada: CloudUp
|
||||
- :tada: CloudUpFill
|
||||
- :tada: HddDown
|
||||
- :tada: HddDownFill
|
||||
- :tada: HddUp
|
||||
- :tada: HddUpFill
|
||||
- :tada: Inbox
|
||||
- :tada: InboxDown
|
||||
- :tada: InboxDownFill
|
||||
- :tada: InboxFill
|
||||
- :tada: InboxUp
|
||||
- :tada: InboxUpFill
|
||||
- :tada: ShoppingBasket
|
||||
- :tada: ShoppingBasketFill
|
||||
|
||||
## 2.7.6
|
||||
|
||||
## 2.7.5
|
||||
- Nye ikoner `CaretUpDownFilledDown`, `CaretUpDownFilledUp`, `CloudDown`, `CloudDownFill`, `CloudUp`, `CloudUpFill`, `HddDown`, `HddDownFill`, `HddUp`, `HddUpFill`, `Inbox`, `InboxDown`, `InboxDownFill`, `InboxFill`, `InboxUp`, `InboxUpFill`, `ShoppingBasket`, `ShoppingBasketFill`
|
||||
|
||||
## 2.7.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1852](https://github.com/navikt/aksel/pull/1852) [`a4fd1dd22`](https://github.com/navikt/aksel/commit/a4fd1dd227b9b56b747f962aa0c2b2dc9b4e30a4) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Oppdatert ikonpakke med nye ikoner :rocket:
|
||||
|
||||
- :tada: CaretDownFill
|
||||
- :tada: CaretLeft
|
||||
- :tada: CaretLeftFill
|
||||
- :tada: CaretLeftRight
|
||||
- :tada: CaretLeftRightFill
|
||||
- :tada: CaretRight
|
||||
- :tada: CaretRightFill
|
||||
- :tada: CaretUpDownFill
|
||||
- :tada: CaretUpFill
|
||||
- :tada: Escalator
|
||||
- :tada: Moon
|
||||
- :tada: MoonFill
|
||||
- :fire: EscalatorStroke
|
||||
|
||||
## 2.7.3
|
||||
|
||||
## 2.7.2
|
||||
|
||||
## 2.7.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`7d9517cf9`](https://github.com/navikt/aksel/commit/7d9517cf90331b57441a0787a04eef66efd1b9b0) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Public-access for ny ikonpakke i GPR
|
||||
- Nye ikoner, `CaretDownFill`, `CaretLeft`, `CaretLeftFill`, `CaretLeftRight`, `CaretLeftRightFill`, `CaretRight`, `CaretRightFill`, `CaretUpDownFill`, `CaretUpFill`, `Escalator`, `Moon`, `MoonFill`. Fjernet `EscalatorStroke` ([PR](https://github.com/navikt/aksel/pull/1852))
|
||||
|
||||
## 2.7.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1847](https://github.com/navikt/aksel/pull/1847) [`de291a972`](https://github.com/navikt/aksel/commit/de291a9722c262d40fecaec7be55b71f86e60160) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Ny ikonpakke med for core icons 3! `@navikt/aksel-icons`
|
||||
- Ny ikonpakke med for core icons 3! `@navikt/aksel-icons` ([PR](https://github.com/navikt/aksel/pull/1847))
|
||||
@@ -15,5 +15,5 @@ keywords:
|
||||
- Sammenføye
|
||||
- Kildekontroll
|
||||
variant: Stroke
|
||||
updated_at: 08.03.2023
|
||||
updated_at: 24.05.2023
|
||||
created_at: 07.03.2023
|
||||
@@ -5,5 +5,5 @@ keywords:
|
||||
- left
|
||||
- venstre
|
||||
variant: Stroke
|
||||
updated_at: 08.03.2023
|
||||
updated_at: 14.06.2023
|
||||
created_at: 07.03.2023
|
||||
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 6.25C7.5 5.83579 7.16421 5.5 6.75 5.5C6.33579 5.5 6 5.83579 6 6.25V17.75C6 18.1642 6.33579 18.5 6.75 18.5C7.16421 18.5 7.5 18.1642 7.5 17.75V6.25ZM17.7803 7.03033C18.0732 6.73744 18.0732 6.26256 17.7803 5.96967C17.4874 5.67678 17.0126 5.67678 16.7197 5.96967L11.2197 11.4697C11.079 11.6103 11 11.8011 11 12C11 12.1989 11.079 12.3897 11.2197 12.5303L16.7197 18.0303C17.0126 18.3232 17.4874 18.3232 17.7803 18.0303C18.0732 17.7374 18.0732 17.2626 17.7803 16.9697L12.8107 12L17.7803 7.03033Z" fill="#262626"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 664 B |
@@ -0,0 +1,12 @@
|
||||
name: ChevronLeftFirst
|
||||
category: Arrows
|
||||
sub_category: Chevron
|
||||
keywords:
|
||||
- left
|
||||
- venstre
|
||||
- side
|
||||
- first
|
||||
- først
|
||||
variant: Stroke
|
||||
updated_at: 15.06.2023
|
||||
created_at: 15.06.2023
|
||||
@@ -6,5 +6,5 @@ keywords:
|
||||
- høyre
|
||||
- side
|
||||
variant: Stroke
|
||||
updated_at: 08.03.2023
|
||||
updated_at: 09.06.2023
|
||||
created_at: 07.03.2023
|
||||
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18 6.25C18 5.83579 17.6642 5.5 17.25 5.5C16.8358 5.5 16.5 5.83579 16.5 6.25V17.75C16.5 18.1642 16.8358 18.5 17.25 18.5C17.6642 18.5 18 18.1642 18 17.75V6.25ZM7.28033 6.21967C6.98744 5.92678 6.51256 5.92678 6.21967 6.21967C5.92678 6.51256 5.92678 6.98744 6.21967 7.28033L11.1893 12.25L6.21967 17.2197C5.92678 17.5126 5.92678 17.9874 6.21967 18.2803C6.51256 18.5732 6.98744 18.5732 7.28033 18.2803L12.7803 12.7803C13.0732 12.4874 13.0732 12.0126 12.7803 11.7197L7.28033 6.21967Z" fill="#262626"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 648 B |
@@ -0,0 +1,10 @@
|
||||
name: ChevronRightLast
|
||||
category: Arrows
|
||||
sub_category: Chevron
|
||||
keywords:
|
||||
- right
|
||||
- høyre
|
||||
- side
|
||||
variant: Stroke
|
||||
updated_at: 15.06.2023
|
||||
created_at: 15.06.2023
|
||||
@@ -15,5 +15,5 @@ keywords:
|
||||
- markup-språk
|
||||
- kildekode
|
||||
variant: Stroke
|
||||
updated_at: 08.03.2023
|
||||
updated_at: 24.05.2023
|
||||
created_at: 07.03.2023
|
||||
@@ -13,5 +13,5 @@ keywords:
|
||||
- dra og slippe
|
||||
- skifte
|
||||
variant: Stroke
|
||||
updated_at: 08.03.2023
|
||||
updated_at: 26.05.2023
|
||||
created_at: 07.03.2023
|
||||
@@ -23,5 +23,5 @@ keywords:
|
||||
- milepæler
|
||||
- hendelser
|
||||
variant: Stroke
|
||||
updated_at: 08.03.2023
|
||||
updated_at: 31.05.2023
|
||||
created_at: 07.03.2023
|
||||
@@ -7,5 +7,5 @@ keywords:
|
||||
- delete
|
||||
- slett
|
||||
variant: Stroke
|
||||
updated_at: 08.03.2023
|
||||
updated_at: 24.05.2023
|
||||
created_at: 07.03.2023
|
||||
@@ -6,5 +6,5 @@ keywords:
|
||||
- uploading
|
||||
- send
|
||||
variant: Stroke
|
||||
updated_at: 08.03.2023
|
||||
updated_at: 08.06.2023
|
||||
created_at: 07.03.2023
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@navikt/aksel-icons",
|
||||
"version": "4.0.0",
|
||||
"version": "4.4.2",
|
||||
"author": "Aksel | NAV",
|
||||
"homepage": "https://aksel.nav.no/ikoner",
|
||||
"repository": {
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
# @navikt/aksel-stylelint
|
||||
|
||||
## 4.0.0
|
||||
## 4.4.2
|
||||
|
||||
## 4.4.1
|
||||
|
||||
## 4.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Deprecated klassenavn `navds-chips--icon-left` ([PR](https://github.com/navikt/aksel/pull/2035))
|
||||
|
||||
## 3.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2017](https://github.com/navikt/aksel/pull/2017) [`7615dbbb5`](https://github.com/navikt/aksel/commit/7615dbbb54c7c96e2252366188547b27b2ac1142) Thanks [@JulianNymark](https://github.com/JulianNymark)! - add missing dependency
|
||||
- La til riktige dependencies ([PR](https://github.com/navikt/aksel/pull/2017))
|
||||
|
||||
## 3.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- :bug: Stylelint hotfix, inkluderer nå dist-mappe (kanskje..)
|
||||
- Inkluderer nå dist-mappe i release
|
||||
|
||||
## 3.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1973](https://github.com/navikt/aksel/pull/1973) [`61c411421`](https://github.com/navikt/aksel/commit/61c4114214841ec42f48e1abd0d72d2a42d265ab) Thanks [@JulianNymark](https://github.com/JulianNymark)! - add stylelint plugin
|
||||
- Stylelint-pakke for Aksel ([PR](https://github.com/navikt/aksel/pull/1973))
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@navikt/aksel-stylelint",
|
||||
"version": "4.0.0",
|
||||
"version": "4.4.2",
|
||||
"author": "Aksel | NAV",
|
||||
"homepage": "https://aksel.nav.no/grunnleggende/kode/stylelint",
|
||||
"repository": {
|
||||
@@ -35,8 +35,8 @@
|
||||
"dev": "yarn watch:lint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@navikt/ds-css": "^4.0.0",
|
||||
"@navikt/ds-tokens": "^4.0.0",
|
||||
"@navikt/ds-css": "^4.4.2",
|
||||
"@navikt/ds-tokens": "^4.4.2",
|
||||
"@types/jest": "^29.0.0",
|
||||
"concurrently": "7.2.1",
|
||||
"copyfiles": "2.4.1",
|
||||
|
||||
@@ -20,4 +20,9 @@ export const deprecations: DeprecatedList = [
|
||||
"Class were moved to '@navikt/ds-css' and renamed with 'navds'-prefix in v4.0.0. Docs: https://aksel.nav.no/grunnleggende/kode/endringslogg#h728704adeb59.",
|
||||
deprecatePrefix: true,
|
||||
},
|
||||
{
|
||||
classes: ["navds-chips--icon-left"],
|
||||
message:
|
||||
"In v4.1.0 Chips. Toggle no longer handles special alignment for checkmark-icon, thus removing this class",
|
||||
},
|
||||
];
|
||||
+17
-203
@@ -1,215 +1,29 @@
|
||||
# @navikt/aksel
|
||||
|
||||
## 4.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@4.4.2
|
||||
|
||||
## 4.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`415632675`](https://github.com/navikt/aksel/commit/4156326752eaf7a97855b33653850362dada8788)]:
|
||||
- @navikt/ds-css@4.4.1
|
||||
|
||||
## 4.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- [#2026](https://github.com/navikt/aksel/pull/2026) [`895bdc08e`](https://github.com/navikt/aksel/commit/895bdc08e50647d9b9186cbf0e9ab069323de56c) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :test-tube: Datepicker og Monthpicker er nå ute av beta. Kjør codemod for migrering, eller `cmd/ctrl + shift + f` og erstatt `UNSAFE_` med ``
|
||||
- Codemod for migrering av Datepicker/Monthpicker ut av Beta. `npx @navikt/aksel codemod v4-date` ([PR](https://github.com/navikt/aksel/pull/2026))
|
||||
|
||||
- UNSAFE-prefix er fjernet fra Datepicker og Monthpicker
|
||||
|
||||
```bash
|
||||
npx @navikt/aksel codemod v4-date
|
||||
```
|
||||
|
||||
- [#2026](https://github.com/navikt/aksel/pull/2026) [`895bdc08e`](https://github.com/navikt/aksel/commit/895bdc08e50647d9b9186cbf0e9ab069323de56c) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :truck: Komponenter i `@navikt/ds-react-internal` er flyttet over til `@navikt/ds-react`
|
||||
|
||||
- `<Header />` er renamet til `<InternalHeader />`
|
||||
- Dropdown, Timeline og InternalHeader(Header) er flyttet over til `@navikt/ds-react`
|
||||
- All styling fra `@navikt/ds-css-internal` er flyttet til `@navikt/ds-css` og classname-prefix er endret fra `navdsi` -> `navds` for flyttede komponenter. Sett opp [stylelint med configen vår](https://aksel.nav.no/grunnleggende/kode/stylelint), så vil du få feilmelding om du bruker gamle klassenavn.
|
||||
- Fikset cascading-problem mellom dropdown og popover. Dropdown blir ikke lengre påvirket av import-rekkefølge av popover.
|
||||
- Styling for flyttede komponenter finnes nå på CDN (https://aksel.nav.no/grunnleggende/kode/css-import)
|
||||
|
||||
Kjør codemod for migrering:
|
||||
|
||||
```bash
|
||||
// React
|
||||
npx @navikt/aksel codemod v4-internal-react
|
||||
|
||||
// CSS
|
||||
npx @navikt/aksel codemod v4-internal-css
|
||||
```
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`895bdc08e`](https://github.com/navikt/aksel/commit/895bdc08e50647d9b9186cbf0e9ab069323de56c), [`895bdc08e`](https://github.com/navikt/aksel/commit/895bdc08e50647d9b9186cbf0e9ab069323de56c)]:
|
||||
- @navikt/ds-css@4.0.0
|
||||
|
||||
## 3.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@3.4.2
|
||||
|
||||
## 3.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@3.4.1
|
||||
|
||||
## 3.4.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`b958d41a2`](https://github.com/navikt/aksel/commit/b958d41a20c66327658514fcf24ae20893c9531a)]:
|
||||
- @navikt/ds-css@3.4.0
|
||||
|
||||
## 3.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@3.3.1
|
||||
|
||||
## 3.3.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@3.3.0
|
||||
|
||||
## 3.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`30eee0dac`](https://github.com/navikt/aksel/commit/30eee0dac4e3e5a1379033283a6885e646e80458)]:
|
||||
- @navikt/ds-css@3.2.4
|
||||
|
||||
## 3.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`475e994f4`](https://github.com/navikt/aksel/commit/475e994f494b2080ffc05eb1684b6a244e3e2969), [`444e905e0`](https://github.com/navikt/aksel/commit/444e905e01965fd5cac40ff20c5225b072e67221)]:
|
||||
- @navikt/ds-css@3.2.3
|
||||
|
||||
## 3.2.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@3.2.2
|
||||
|
||||
## 3.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@3.2.1
|
||||
|
||||
## 3.2.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`affcab14c`](https://github.com/navikt/aksel/commit/affcab14c3d536929dfa64a36f5b43f9d0e8c3b7)]:
|
||||
- @navikt/ds-css@3.2.0
|
||||
|
||||
## 3.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`e8ecf309a`](https://github.com/navikt/aksel/commit/e8ecf309a910e47fd3cea6c54cd993ab1196910f)]:
|
||||
- @navikt/ds-css@3.1.3
|
||||
|
||||
## 3.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@3.1.2
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@3.1.1
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`9d2cd9e7f`](https://github.com/navikt/aksel/commit/9d2cd9e7fffb3cf6310c88229ee39ea85db19bca), [`f1c4c46eb`](https://github.com/navikt/aksel/commit/f1c4c46ebb0522561483f18e3b86b190cf9cc372)]:
|
||||
- @navikt/ds-css@3.1.0
|
||||
|
||||
## 3.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@3.0.1
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`166ee5feb`](https://github.com/navikt/aksel/commit/166ee5feb3c987c4e633eb449812116bfd865d3f), [`166ee5feb`](https://github.com/navikt/aksel/commit/166ee5feb3c987c4e633eb449812116bfd865d3f)]:
|
||||
- @navikt/ds-css@3.0.0
|
||||
|
||||
## 2.9.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@2.9.8
|
||||
|
||||
## 2.9.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@2.9.7
|
||||
|
||||
## 2.9.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@2.9.6
|
||||
|
||||
## 2.9.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@2.9.5
|
||||
- Codemods for migrering fra `@navikt/ds-react-internal` til `@navikt/ds-react` [Guide](https://aksel.nav.no/grunnleggende/kode/migrering#h3b8538e1981d) ([PR](https://github.com/navikt/aksel/pull/2026))
|
||||
|
||||
## 2.9.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1952](https://github.com/navikt/aksel/pull/1952) [`27b2b4a11`](https://github.com/navikt/aksel/commit/27b2b4a11caf5ca05c96c686c453653d8a900e5f) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :truck: Flyttet Codemods from `@navikt/ds-codemods` -> `@navikt/aksel`.
|
||||
|
||||
- `@navikt/ds-codemods` vil bli deprecated ettehvert.
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@2.9.4
|
||||
|
||||
## 2.9.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@2.9.3
|
||||
|
||||
## 2.9.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@2.9.2
|
||||
|
||||
## 2.9.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @navikt/ds-css@2.9.1
|
||||
|
||||
## 2.9.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`657b7f3f3`](https://github.com/navikt/aksel/commit/657b7f3f3e62c5ce3173e6c95a29fcd237ce7343)]:
|
||||
- @navikt/ds-css@2.9.0
|
||||
- :truck: Flyttet Codemods fra `@navikt/ds-codemods` -> `@navikt/aksel`. `@navikt/ds-codemods` regnes nå som deprecated ([PR](https://github.com/navikt/aksel/pull/1952))
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@navikt/aksel",
|
||||
"version": "4.0.0",
|
||||
"version": "4.4.2",
|
||||
"description": "Aksel command line interface. Handles css-imports, codemods and more",
|
||||
"author": "Aksel | NAV designsystem team",
|
||||
"license": "MIT",
|
||||
@@ -29,7 +29,7 @@
|
||||
},
|
||||
"homepage": "https://aksel.nav.no/grunnleggende/kode/kommandolinje",
|
||||
"dependencies": {
|
||||
"@navikt/ds-css": "4.0.0",
|
||||
"@navikt/ds-css": "4.4.2",
|
||||
"axios": "1.3.6",
|
||||
"chalk": "4.1.0",
|
||||
"clipboardy": "^2.3.0",
|
||||
|
||||
+93
-292
@@ -1,452 +1,253 @@
|
||||
# @navikt/ds-css
|
||||
|
||||
## 4.4.2
|
||||
|
||||
## 4.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- :lipstick: Chat: fjernet border, satt avatar svg til 24x24px, byttet om "subtle" og "neutral" ([#2077](https://github.com/navikt/aksel/pull/2077))
|
||||
|
||||
## 4.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Shadow-tokens er oppdatert: Datepicker har nå ikke border, Modal bruker shadow-xlarge, LinkCard bruker shadow-xsmall ([PR](https://github.com/navikt/aksel/pull/2041))
|
||||
|
||||
## 4.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Popover/Helptext: Maksbredde på 100vw - 1.5rem. Treffer ikke lengre kanten på skjermen. ([PR](https://github.com/navikt/aksel/pull/2069))
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- ExpansionCard: Ved nesting av komponetene fikk man styling fra parent ([PR](https://github.com/navikt/aksel/pull/2067))
|
||||
|
||||
## 4.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Chat: `small`-size, innebygde varianter for farge og oppdatert utseende. ([PR](https://github.com/navikt/aksel/pull/2048))
|
||||
|
||||
## 4.1.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Readmore: setter nå eksplisitt color for å ikke arve text-subtle fra parent. ([PR](https://github.com/navikt/aksel/pull/2049))
|
||||
|
||||
## 4.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- :bug: Fikset cursor-markering av tekst i skeleton.
|
||||
|
||||
## 4.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Chips: `neutral` og `action`-varianter av Chips.Toggle. Opt-out mulighet for Checkmark. Oppdatert checkmark-ikon ([PR](https://github.com/navikt/aksel/pull/2035))
|
||||
|
||||
- Alle description-felter på fieldsets har nå `text-subtle` som farge. ([PR](https://github.com/navikt/aksel/pull/2036))
|
||||
|
||||
## 4.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- [#2026](https://github.com/navikt/aksel/pull/2026) [`895bdc08e`](https://github.com/navikt/aksel/commit/895bdc08e50647d9b9186cbf0e9ab069323de56c) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :test-tube: Datepicker og Monthpicker er nå ute av beta. Kjør codemod for migrering, eller `cmd/ctrl + shift + f` og erstatt `UNSAFE_` med ``
|
||||
- All styling fra `@navikt/ds-css-internal` er flyttet til `@navikt/ds-css`. ([PR](https://github.com/navikt/aksel/pull/2026))
|
||||
|
||||
- UNSAFE-prefix er fjernet fra Datepicker og Monthpicker
|
||||
- classname-prefix er endret fra `navdsi` -> `navds` for flyttede komponenter.
|
||||
|
||||
```bash
|
||||
npx @navikt/aksel codemod v4-date
|
||||
```
|
||||
- Fikset cascading-problem mellom dropdown og popover. Dropdown blir ikke lengre påvirket av import-rekkefølge av popover.
|
||||
|
||||
- [#2026](https://github.com/navikt/aksel/pull/2026) [`895bdc08e`](https://github.com/navikt/aksel/commit/895bdc08e50647d9b9186cbf0e9ab069323de56c) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :truck: Komponenter i `@navikt/ds-react-internal` er flyttet over til `@navikt/ds-react`
|
||||
|
||||
- `<Header />` er renamet til `<InternalHeader />`
|
||||
- Dropdown, Timeline og InternalHeader(Header) er flyttet over til `@navikt/ds-react`
|
||||
- All styling fra `@navikt/ds-css-internal` er flyttet til `@navikt/ds-css` og classname-prefix er endret fra `navdsi` -> `navds` for flyttede komponenter. Sett opp [stylelint med configen vår](https://aksel.nav.no/grunnleggende/kode/stylelint), så vil du få feilmelding om du bruker gamle klassenavn.
|
||||
- Fikset cascading-problem mellom dropdown og popover. Dropdown blir ikke lengre påvirket av import-rekkefølge av popover.
|
||||
- Styling for flyttede komponenter finnes nå på CDN (https://aksel.nav.no/grunnleggende/kode/css-import)
|
||||
|
||||
Kjør codemod for migrering:
|
||||
|
||||
```bash
|
||||
// React
|
||||
npx @navikt/aksel codemod v4-internal-react
|
||||
|
||||
// CSS
|
||||
npx @navikt/aksel codemod v4-internal-css
|
||||
```
|
||||
|
||||
## 3.4.2
|
||||
|
||||
## 3.4.1
|
||||
- Styling for flyttede komponenter finnes nå på CDN [Guide](https://aksel.nav.no/grunnleggende/kode/css-import)
|
||||
|
||||
## 3.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#2010](https://github.com/navikt/aksel/pull/2010) [`b958d41a2`](https://github.com/navikt/aksel/commit/b958d41a20c66327658514fcf24ae20893c9531a) Thanks [@HalvorHaugan](https://github.com/HalvorHaugan)! - Ny variant "moderate" i Tag
|
||||
|
||||
## 3.3.1
|
||||
|
||||
## 3.3.0
|
||||
|
||||
## 3.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2000](https://github.com/navikt/aksel/pull/2000) [`30eee0dac`](https://github.com/navikt/aksel/commit/30eee0dac4e3e5a1379033283a6885e646e80458) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :bug: Search støtter nå htmlSize-prop
|
||||
- Tag: `moderate`-variant ([PR](https://github.com/navikt/aksel/pull/2010))
|
||||
|
||||
## 3.2.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1993](https://github.com/navikt/aksel/pull/1993) [`475e994f4`](https://github.com/navikt/aksel/commit/475e994f494b2080ffc05eb1684b6a244e3e2969) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :bug: Fikset small-variant av datepicker-input
|
||||
- Datepicker: Fikset small-variant av datepicker-input. ([PR](https://github.com/navikt/aksel/pull/1993))
|
||||
|
||||
- :recycle: Refactored Datepicker.Input-button for bugfix
|
||||
|
||||
- [#1994](https://github.com/navikt/aksel/pull/1994) [`444e905e0`](https://github.com/navikt/aksel/commit/444e905e01965fd5cac40ff20c5225b072e67221) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :tada: CopyButton har nå en `xsmall`-variant
|
||||
|
||||
- Kan nå lettere brukes i tabeller
|
||||
|
||||
## 3.2.2
|
||||
|
||||
## 3.2.1
|
||||
|
||||
## 3.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1982](https://github.com/navikt/aksel/pull/1982) [`affcab14c`](https://github.com/navikt/aksel/commit/affcab14c3d536929dfa64a36f5b43f9d0e8c3b7) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :sparkles: Ny komponent `<CopyButton />`!
|
||||
|
||||
- Erstatter `<CopyToClipboard />` fra `@navikt/ds-react-internal`
|
||||
- CopyToClipboard er markert som deprecated. Den vil fortsatt fungere, men noen lintere vil kunne ende opp med å klage på den.
|
||||
- CopyButton: `xsmall`-size for bruk i tabeller ([PR](https://github.com/navikt/aksel/pull/1994))
|
||||
|
||||
## 3.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1976](https://github.com/navikt/aksel/pull/1976) [`e8ecf309a`](https://github.com/navikt/aksel/commit/e8ecf309a910e47fd3cea6c54cd993ab1196910f) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :lipstick: Oppdatert utseende for ToggleGroup
|
||||
|
||||
- Medium og Small er begge 10px lavere
|
||||
- Mindre border-radius
|
||||
|
||||
## 3.1.2
|
||||
|
||||
## 3.1.1
|
||||
- :lipstick: Oppdatert utseende for ToggleGroup. `Medium` og `Small`-size er begge 10px lavere, mindre border-radius ([PR](https://github.com/navikt/aksel/pull/1976))
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1966](https://github.com/navikt/aksel/pull/1966) [`f1c4c46eb`](https://github.com/navikt/aksel/commit/f1c4c46ebb0522561483f18e3b86b190cf9cc372) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :lipstick: Alle komponenter bruker nå default `:focus-visible` for fokusmarkering.
|
||||
(Alle komponenter som bruker `:focus-visible` har også en fallback for `:focus`)
|
||||
- Alle komponenter bruker nå default `:focus-visible` for fokusmarkering. Medfølger også fallback for `:focus` ([PR](https://github.com/navikt/aksel/pull/1966))
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1967](https://github.com/navikt/aksel/pull/1967) [`9d2cd9e7f`](https://github.com/navikt/aksel/commit/9d2cd9e7fffb3cf6310c88229ee39ea85db19bca) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :lipstick: Oppdatert Label og Description spacing for skjemakomponenter
|
||||
|
||||
## 3.0.1
|
||||
- Oppdatert Label og Description spacing for skjemakomponenter ([PR](https://github.com/navikt/aksel/pull/1967))
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- [#1964](https://github.com/navikt/aksel/pull/1964) [`166ee5feb`](https://github.com/navikt/aksel/commit/166ee5feb3c987c4e633eb449812116bfd865d3f) Thanks [@KenAJoh](https://github.com/KenAJoh)! - **Accordion**
|
||||
|
||||
- Accordion oppdatet til å ha chevron left-aligned.
|
||||
- Neutral-variant lagt til
|
||||
- Diverse nye size-options for heading og paddinger.
|
||||
- Deler av Accordion-CSS er refaktorert. Dette vil kunne brekke overskrevne stiler.
|
||||
|
||||
- [#1964](https://github.com/navikt/aksel/pull/1964) [`166ee5feb`](https://github.com/navikt/aksel/commit/166ee5feb3c987c4e633eb449812116bfd865d3f) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Aksels løsninger bruker nå `@navikt/aksel-icons`
|
||||
|
||||
**Sideeffects av ikonendringer**
|
||||
|
||||
- Komponenter som tidligere brukte Expand-ikon har fått oppdatert animasjon (table, readmore og accordion)
|
||||
- Alert bruker samme ikonstørrelse for alle størrelser
|
||||
- Chips har justert padding/ikonstørrelser
|
||||
- Datepicker hover-bug på knapper er fikset
|
||||
- Helptekst bruker nå et custom-ikon.
|
||||
- Select har fått justert padding rundt ikon
|
||||
- Switch bruker samme checkmark som checkbox, er nå avrundet
|
||||
- ReadMore har justert margin for alignment med ikon, fjernet content-animasjon
|
||||
- Tabs bruker default text-default nå
|
||||
- Stepper har endret hvordan den styler checkmark-ikon.
|
||||
|
||||
## 2.9.8
|
||||
|
||||
## 2.9.7
|
||||
|
||||
## 2.9.6
|
||||
|
||||
## 2.9.5
|
||||
|
||||
## 2.9.4
|
||||
|
||||
## 2.9.3
|
||||
|
||||
## 2.9.2
|
||||
|
||||
## 2.9.1
|
||||
- Accordion: Chevron er left-aligned, deler av styling er refaktorert, `size`-props og `neutral`-variant ([PR](https://github.com/navikt/aksel/pull/1964))
|
||||
|
||||
## 2.9.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1941](https://github.com/navikt/aksel/pull/1941) [`657b7f3f3`](https://github.com/navikt/aksel/commit/657b7f3f3e62c5ce3173e6c95a29fcd237ce7343) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :tada: CSS nå tilgjengelig som separate filer
|
||||
|
||||
- Kan lastest fra CDN
|
||||
- Tilbys nå i minified-versjoner
|
||||
- Kommandoline: `npx @navikt/aksel css-imports` for å raskt komme i gang med CSS-optimalisering
|
||||
|
||||
## 2.8.16
|
||||
|
||||
## 2.8.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1930](https://github.com/navikt/aksel/pull/1930) [`6682be1c8`](https://github.com/navikt/aksel/commit/6682be1c8e6562213c64e5be4bed70fef54ab865) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Alle pakker implementerer nå npm provenance (beta)
|
||||
|
||||
## 2.8.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`f0d9a8853`](https://github.com/navikt/aksel/commit/f0d9a8853f56854a4049bd3f6cc34968e9d6c380) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Fixes shown month on open in Datepicker/MonthPicker, better handling of out-of-range 'today'
|
||||
|
||||
## 2.8.13
|
||||
|
||||
## 2.8.12
|
||||
|
||||
## 2.8.11
|
||||
|
||||
## 2.8.10
|
||||
- CSS nå tilgjengelig som separate filer: Kan lastest fra CDN, minified-versjoner tilgjengelig ([PR](https://github.com/navikt/aksel/pull/1941))
|
||||
|
||||
## 2.8.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1905](https://github.com/navikt/aksel/pull/1905) [`212194964`](https://github.com/navikt/aksel/commit/212194964c4dd576e1ffc031316dff8cbe5016a2) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :sparkles: Padding/border-radius tokens for button.css
|
||||
|
||||
## 2.8.8
|
||||
- Button: Padding/border-radius tokens ([PR](https://github.com/navikt/aksel/pull/1905))
|
||||
|
||||
## 2.8.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`7f3f025db`](https://github.com/navikt/aksel/commit/7f3f025db2ad605df4240605a733d10d08db753a) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Fikset typografi for radio, checkbox. Button token for tertiary
|
||||
- Button: token for tertiary
|
||||
|
||||
## 2.8.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`2eb358ad8`](https://github.com/navikt/aksel/commit/2eb358ad888979d21c385b3900973946f3f466be) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Alert, Chips og ErrorSummary har nå bedre utvalg av tokens
|
||||
- Alert, Chips og ErrorSummary har nå bedre utvalg av tokens
|
||||
|
||||
## 2.8.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`f66437082`](https://github.com/navikt/aksel/commit/f664370826ed51bda7ad681e1f1799c26d2c1f0a) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :art: Accordion-tokens for header bakgrunn
|
||||
- Accordion: tokens for header-bakgrunn
|
||||
|
||||
- [#1879](https://github.com/navikt/aksel/pull/1879) [`55b585618`](https://github.com/navikt/aksel/commit/55b585618341a4d8bf26ed9b9e129d897b1600dc) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :bug: Fikset tekstfarge i select på iphone
|
||||
|
||||
## 2.8.4
|
||||
|
||||
## 2.8.3
|
||||
- Select: Fikset tekstfarge på iphone ([PR](https://github.com/navikt/aksel/pull/1879))
|
||||
|
||||
## 2.8.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1870](https://github.com/navikt/aksel/pull/1870) [`9c495cf50`](https://github.com/navikt/aksel/commit/9c495cf5037a7453e51e273ab93e4232576f4958) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Oppdatert typografi for ExpansioCard
|
||||
|
||||
## 2.8.1
|
||||
|
||||
## 2.8.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1820](https://github.com/navikt/aksel/pull/1820) [`c6d51a019`](https://github.com/navikt/aksel/commit/c6d51a01902e4fd7916a422e17ed175f39acd458) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :tada: Ny komponent! ExpansionCard. Oppfølger fra gammel Ekspanderbartpanel.
|
||||
- ExpansioCard: Oppdatert typografi ([PR](https://github.com/navikt/aksel/pull/1870))
|
||||
|
||||
## 2.7.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1863](https://github.com/navikt/aksel/pull/1863) [`7ace69f21`](https://github.com/navikt/aksel/commit/7ace69f215760bbb5bf997670c897403d8ee558d) Thanks [@it-vegard](https://github.com/it-vegard)! - Added focus indicator for tabpanel
|
||||
|
||||
## 2.7.7
|
||||
|
||||
## 2.7.6
|
||||
- Tabs: La til focus-markering for Tabs.Panel ([PR](https://github.com/navikt/aksel/pull/1863))
|
||||
|
||||
## 2.7.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- :bug: Fikset token-bug i togglegroup
|
||||
|
||||
## 2.7.4
|
||||
|
||||
## 2.7.3
|
||||
|
||||
## 2.7.2
|
||||
|
||||
## 2.7.1
|
||||
|
||||
## 2.7.0
|
||||
|
||||
## 2.6.2
|
||||
|
||||
## 2.6.1
|
||||
|
||||
## 2.6.0
|
||||
|
||||
## 2.5.1
|
||||
|
||||
## 2.5.0
|
||||
- ToggleGroup: Fikset token-bug
|
||||
|
||||
## 2.4.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`f962bc781`](https://github.com/navikt/aksel/commit/f962bc7816027c24e334d9754c3e07cda951cf56) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Fikset disabled-opacity bug i select for Chrome
|
||||
- Select: Fikset disabled + opacity bug for Chrome
|
||||
|
||||
## 2.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1823](https://github.com/navikt/aksel/pull/1823) [`a7ce61f84`](https://github.com/navikt/aksel/commit/a7ce61f840e5bfaafc4f70e550167fe0095555b8) Thanks [@kschieren](https://github.com/kschieren)! - added support for nested lists
|
||||
|
||||
## 2.4.1
|
||||
|
||||
## 2.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1807](https://github.com/navikt/aksel/pull/1807) [`70eeb24b3`](https://github.com/navikt/aksel/commit/70eeb24b38ac871c7f2e31e1621b949669c401b6) Thanks [@kschieren](https://github.com/kschieren)! - Added List component
|
||||
- List: La til støtte for nesting ([PR](https://github.com/navikt/aksel/pull/1823))
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`241b2e678`](https://github.com/navikt/aksel/commit/241b2e678f1f40909e2d36fe095dcbce8673f174) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Fikset feil bruk av fallback-tokens i textarea, timeline
|
||||
- Fikset feil bruk av fallback-tokens i Textarea og Timeline
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1813](https://github.com/navikt/aksel/pull/1813) [`7702c6527`](https://github.com/navikt/aksel/commit/7702c65275a4d86a8260852d091e6dd4cfe9217c) Thanks [@ingfo](https://github.com/ingfo)! - Fiksa sentrering av tekst i Select i Firefox
|
||||
- Select: Fikset sentrering av tekst i Firefox ([PR](https://github.com/navikt/aksel/pull/1813))
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`51b62cca7`](https://github.com/navikt/aksel/commit/51b62cca7b857e92669cd0b09e620b131faf80e5) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Select small 34px høyde -> 32px
|
||||
- Select: `small`-variant er nå 32px (var 34px)
|
||||
|
||||
## 2.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1789](https://github.com/navikt/aksel/pull/1789) [`c0929a534`](https://github.com/navikt/aksel/commit/c0929a534dc8effece5435f8be550cb7931a52b1) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Button og ToggleGroup har nå en neutral-variant, oppdatert neutral-tokens
|
||||
- ToggleGroup: `Neutral`-variant. ([PR](https://github.com/navikt/aksel/pull/1789))
|
||||
|
||||
## 2.1.7
|
||||
|
||||
## 2.1.6
|
||||
|
||||
## 2.1.5
|
||||
|
||||
## 2.1.4
|
||||
|
||||
## 2.1.3
|
||||
- Button: `Neutral`-variant.
|
||||
|
||||
## 2.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`62f36da5e`](https://github.com/navikt/aksel/commit/62f36da5e74fc7f53414d42b310c3b57597795bc) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Small textfield har nå 8px horisontal padding (4px før)
|
||||
|
||||
## 2.1.1
|
||||
|
||||
## 2.1.0
|
||||
|
||||
## 2.0.18
|
||||
|
||||
## 2.0.17
|
||||
|
||||
## 2.0.16
|
||||
|
||||
## 2.0.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1748](https://github.com/navikt/aksel/pull/1748) [`22dfd8e60`](https://github.com/navikt/aksel/commit/22dfd8e60315c421749394d35e41f412a00a7593) Thanks [@KenAJoh](https://github.com/KenAJoh)! - toptextPosition prop i Chat for horisontal plassering av navn og dato.
|
||||
|
||||
## 2.0.14
|
||||
|
||||
## 2.0.13
|
||||
- TextField: `small`-variant har nå 8px horisontal padding (før 4px)
|
||||
|
||||
## 2.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1737](https://github.com/navikt/aksel/pull/1737) [`8a1ef5e7e`](https://github.com/navikt/aksel/commit/8a1ef5e7e2c066cb80c13e14329e1585e2c427f8) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :bug: Fikset default visuell error-state for radio
|
||||
|
||||
## 2.0.11
|
||||
|
||||
## 2.0.10
|
||||
|
||||
## 2.0.9
|
||||
|
||||
## 2.0.8
|
||||
|
||||
## 2.0.7
|
||||
|
||||
## 2.0.6
|
||||
- Radio: Fikset default visuell error-state ([PR](https://github.com/navikt/aksel/pull/1737))
|
||||
|
||||
## 2.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Reverserte border-width endrind i button
|
||||
|
||||
## 2.0.4
|
||||
|
||||
## 2.0.3
|
||||
|
||||
## 2.0.2
|
||||
- Button: Reverserte border-width endrinder (var 1.5px, nå 2px)
|
||||
|
||||
## 2.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`e8007328d`](https://github.com/navikt/aksel/commit/e8007328db3f6d5be696cf24f03304c79be0f3f7) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Bugfixer ved bruk av tokens
|
||||
- Bugfixer ved bruk av tokens oppdatert i v2.0.0
|
||||
|
||||
## 2.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- [`6b96e4833`](https://github.com/navikt/aksel/commit/6b96e48330c2e013a1acee85cefccd9ccc1aece4) Thanks [@KenAJoh](https://github.com/KenAJoh)! - v2: Tokens update and font-loading
|
||||
- Fontlasting: Fonter lastes nå fra NAV-CDN
|
||||
|
||||
## 1.5.10
|
||||
- Tokens: Alle komponenter bruker nå semantiske tokens for som standard, med innebygd støtte for komponent-spesifikke tokens.
|
||||
|
||||
## 1.5.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4px -> 2px gap chips-toggle active
|
||||
|
||||
## 1.5.8
|
||||
|
||||
## 1.5.7
|
||||
|
||||
## 1.5.6
|
||||
|
||||
## 1.5.5
|
||||
|
||||
## 1.5.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1709](https://github.com/navikt/aksel/pull/1709) [`77302a30b`](https://github.com/navikt/aksel/commit/77302a30b8eef8dc00b2d2e9c904a3f57da81a11) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Oppdatert ikoner
|
||||
- Chips: 4px -> 2px gap mellom checkmark i Chips.Toggle
|
||||
|
||||
## 1.5.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Byttet om på alt-farge rekkefølge
|
||||
|
||||
## 1.5.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- :memo: Rename FilterChips to ToggleChips
|
||||
- Tokens: Byttet om på rekkefølge av alt-farger
|
||||
|
||||
## 1.5.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Flex-wrap chips.css
|
||||
- Chips. Bruker nå standard flex-wrap
|
||||
|
||||
## 1.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1684](https://github.com/navikt/aksel/pull/1684) [`e19bf67b3`](https://github.com/navikt/aksel/commit/e19bf67b337dea39989c68b5e9c2591cf0d5b40f) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :sparkles: Oppdaterte tag-varianter
|
||||
|
||||
- [#1668](https://github.com/navikt/aksel/pull/1668) [`97c5f60e9`](https://github.com/navikt/aksel/commit/97c5f60e9111da7e08f55c8d0aa29581f0a9b1ca) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Chips komponent :sparkles:
|
||||
|
||||
## 1.4.4
|
||||
|
||||
## 1.4.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- :sparkles: Validering og inputFormat i Date-komponenter
|
||||
|
||||
## 1.4.2
|
||||
|
||||
## 1.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`3c08651df`](https://github.com/navikt/aksel/commit/3c08651df28c3e19dd8c8a7a1d0032200bec473d) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Date-komponenter følger språkrådets dato-formatering for måneder.
|
||||
|
||||
## 1.4.0
|
||||
- Tag: `filled`-varianter ([PR](https://github.com/navikt/aksel/pull/1684))
|
||||
|
||||
## 1.3.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`40f0b3340`](https://github.com/navikt/aksel/commit/40f0b3340d01bf85fecc04f2f3a8e8b2acf996f1) Thanks [@KenAJoh](https://github.com/KenAJoh)! - Bump for latest-tag
|
||||
- Fikset bruk av `:watch` for diverse parsere (less, parcel)
|
||||
|
||||
## 1.3.38
|
||||
## 1.3.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Tokens tilgjengeligjøres nå også på `:host`. Dette lar shadow-dom brukere konsumere tokens direkte.
|
||||
@@ -141,11 +141,16 @@
|
||||
/*************************
|
||||
* Content *
|
||||
*************************/
|
||||
|
||||
.navds-accordion__content {
|
||||
padding: 0 var(--a-spacing-3) var(--a-spacing-5) var(--a-spacing-11);
|
||||
padding: 0 var(--a-spacing-3) var(--a-spacing-5);
|
||||
animation: fadeAccordionContent 250ms ease;
|
||||
}
|
||||
|
||||
.navds-accordion--indent > :where(.navds-accordion__item) > :where(.navds-accordion__content) {
|
||||
padding: 0 var(--a-spacing-3) var(--a-spacing-5) var(--a-spacing-11);
|
||||
}
|
||||
|
||||
.navds-accordion__content--closed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
+31
-17
@@ -1,14 +1,12 @@
|
||||
.navds-chat {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: var(--a-spacing-4);
|
||||
padding-right: var(--a-spacing-16);
|
||||
gap: var(--a-spacing-3);
|
||||
max-width: 40.75rem;
|
||||
}
|
||||
|
||||
.navds-chat--right {
|
||||
flex-direction: row-reverse;
|
||||
padding-right: 0;
|
||||
padding-left: var(--a-spacing-16);
|
||||
}
|
||||
|
||||
.navds-chat__bubble-wrapper {
|
||||
@@ -26,29 +24,33 @@
|
||||
|
||||
.navds-chat__avatar {
|
||||
align-items: center;
|
||||
background: var(--ac-chat-avatar-bg, var(--a-bg-subtle));
|
||||
color: var(--ac-chat-avatar-color, var(--a-text-default));
|
||||
box-shadow: var(--a-shadow-xsmall);
|
||||
background-color: var(--ac-chat-avatar-bg, var(--a-surface-neutral-subtle));
|
||||
border-radius: var(--a-border-radius-full);
|
||||
color: var(--ac-chat-avatar-color, var(--a-text-default));
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
height: 3rem;
|
||||
width: 3rem;
|
||||
height: 2.5rem;
|
||||
width: 2.5rem;
|
||||
line-height: 2.5rem; /* Makes text properly vertically centered in Chrome */
|
||||
font-size: 1.06rem;
|
||||
letter-spacing: 0.024rem;
|
||||
}
|
||||
|
||||
.navds-chat__avatar svg {
|
||||
align-self: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
max-width: 1.5rem;
|
||||
max-height: 1.5rem;
|
||||
}
|
||||
|
||||
.navds-chat__bubble {
|
||||
padding: 1rem;
|
||||
box-shadow: var(--a-shadow-small);
|
||||
padding: var(--a-spacing-4);
|
||||
box-shadow: var(--a-shadow-xsmall);
|
||||
width: fit-content;
|
||||
max-width: 37.5rem;
|
||||
background-color: var(--ac-chat-bubble-bg, var(--a-bg-subtle));
|
||||
background-color: var(--ac-chat-bubble-bg, var(--a-surface-neutral-subtle));
|
||||
border-radius: var(--a-border-radius-xlarge);
|
||||
border-bottom-left-radius: 2px;
|
||||
display: flex;
|
||||
@@ -61,11 +63,27 @@
|
||||
border-bottom-right-radius: 2px;
|
||||
}
|
||||
|
||||
.navds-chat--small .navds-chat__bubble {
|
||||
padding: var(--a-spacing-3);
|
||||
}
|
||||
|
||||
.navds-chat--info .navds-chat__bubble,
|
||||
.navds-chat--info .navds-chat__avatar {
|
||||
background-color: var(--a-surface-info-subtle);
|
||||
}
|
||||
|
||||
.navds-chat--subtle .navds-chat__bubble,
|
||||
.navds-chat--subtle .navds-chat__avatar {
|
||||
background-color: var(--a-surface-default);
|
||||
}
|
||||
|
||||
.navds-chat__top-text {
|
||||
color: var(--ac-chat-top-text, var(--a-text-default));
|
||||
display: flex;
|
||||
gap: var(--a-spacing-2);
|
||||
align-items: baseline;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navds-chat--right .navds-chat__top-text {
|
||||
@@ -87,7 +105,3 @@
|
||||
.navds-chat--right .navds-chat__top-text--left {
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.navds-chat__name {
|
||||
font-weight: var(--a-font-weight-bold);
|
||||
}
|
||||
+27
-22
@@ -20,7 +20,7 @@
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--a-spacing-05);
|
||||
gap: var(--a-spacing-1);
|
||||
margin: 0;
|
||||
padding: 0 var(--a-spacing-3);
|
||||
text-decoration: none;
|
||||
@@ -34,14 +34,14 @@
|
||||
}
|
||||
|
||||
.navds-chips__toggle {
|
||||
box-shadow: inset 0 0 0 1px var(--ac-chip-toggle-border, var(--a-border-default));
|
||||
background-color: var(--ac-chip-toggle-bg, var(--a-surface-neutral-subtle));
|
||||
box-shadow: inset 0 0 0 1px var(--ac-chip-toggle-border, var(--a-border-subtle));
|
||||
background-color: var(--ac-chip-toggle-bg, var(--a-surface-action-subtle));
|
||||
color: var(--ac-chip-toggle-text, var(--a-text-default));
|
||||
}
|
||||
|
||||
.navds-chips__toggle:hover {
|
||||
box-shadow: inset 0 0 0 1px var(--ac-chip-toggle-hover-border, var(--a-border-strong));
|
||||
background-color: var(--ac-chip-toggle-hover-bg, var(--a-surface-neutral-subtle-hover));
|
||||
box-shadow: inset 0 0 0 1px var(--ac-chip-toggle-hover-border, var(--a-border-subtle-hover));
|
||||
background-color: var(--ac-chip-toggle-hover-bg, var(--a-surface-action-subtle-hover));
|
||||
}
|
||||
|
||||
.navds-chips__toggle[aria-pressed="true"] {
|
||||
@@ -54,6 +54,28 @@
|
||||
background-color: var(--ac-chip-toggle-pressed-hover-bg, var(--a-surface-action-selected-hover));
|
||||
}
|
||||
|
||||
/* Toggle variant neutral */
|
||||
.navds-chips__toggle--neutral {
|
||||
box-shadow: inset 0 0 0 1px var(--ac-chip-toggle-neutral-border, var(--a-border-subtle));
|
||||
background-color: var(--ac-chip-toggle-neutral-bg, var(--a-surface-neutral-subtle));
|
||||
color: var(--ac-chip-toggle-neutral-text, var(--a-text-default));
|
||||
}
|
||||
|
||||
.navds-chips__toggle--neutral:hover {
|
||||
box-shadow: inset 0 0 0 1px var(--ac-chip-toggle-neutral-hover-border, var(--a-border-subtle-hover));
|
||||
background-color: var(--ac-chip-toggle-neutral-hover-bg, var(--a-surface-neutral-subtle-hover));
|
||||
}
|
||||
|
||||
.navds-chips__toggle--neutral[aria-pressed="true"] {
|
||||
box-shadow: none;
|
||||
background-color: var(--ac-chip-toggle-neutral-pressed-bg, var(--a-surface-neutral-selected));
|
||||
color: var(--ac-chip-toggle-neutral-pressed-text, var(--a-text-on-neutral));
|
||||
}
|
||||
|
||||
.navds-chips__toggle--neutral[aria-pressed="true"]:hover {
|
||||
background-color: var(--ac-chip-toggle-neutral-pressed-hover-bg, var(--a-surface-neutral-selected));
|
||||
}
|
||||
|
||||
.navds-chips__toggle:focus-visible {
|
||||
box-shadow: 0 0 0 2px var(--ac-chip-toggle-focus, var(--a-border-focus));
|
||||
}
|
||||
@@ -99,19 +121,6 @@
|
||||
border-radius: var(--a-border-radius-full);
|
||||
}
|
||||
|
||||
.navds-chips__toggle-icon {
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border-radius: var(--a-border-radius-full);
|
||||
}
|
||||
|
||||
.navds-chips--small .navds-chips__toggle-icon {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
}
|
||||
|
||||
.navds-chips--small .navds-chips__removable-icon {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
@@ -161,7 +170,3 @@
|
||||
.navds-chips--small .navds-chips--icon-right {
|
||||
padding-right: var(--a-spacing-05);
|
||||
}
|
||||
|
||||
.navds-chips--small .navds-chips--icon-left {
|
||||
padding-left: 0.375rem;
|
||||
}
|
||||
@@ -127,6 +127,7 @@ const StyleMappings = {
|
||||
{ component: "ReadMore", main: "read-more.css", dependencies: [typoCss] },
|
||||
{ component: "Search", main: formCss, dependencies: [typoCss] },
|
||||
{ component: "Select", main: formCss, dependencies: [typoCss] },
|
||||
{ component: "Skeleton", main: "skeleton.css", dependencies: [] },
|
||||
{ component: "Stepper", main: "stepper.css", dependencies: [typoCss] },
|
||||
{ component: "Switch", main: formCss, dependencies: [typoCss] },
|
||||
{ component: "Table", main: "table.css", dependencies: [typoCss] },
|
||||
|
||||
@@ -278,3 +278,7 @@
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.navds-date__popover:where(.navds-popover) {
|
||||
border: none;
|
||||
}
|
||||
@@ -77,7 +77,7 @@
|
||||
margin-top: var(--a-spacing-1);
|
||||
}
|
||||
|
||||
.navds-expansioncard--small :where(.navds-expansioncard__title--small) {
|
||||
.navds-expansioncard--small > :where(.navds-expansioncard__header) :where(.navds-expansioncard__title--small) {
|
||||
margin-top: var(--a-spacing-05);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
transition: transform 150ms ease-in-out;
|
||||
}
|
||||
|
||||
.navds-expansioncard--open :where(.navds-expansioncard__header-chevron) {
|
||||
.navds-expansioncard--open > :where(.navds-expansioncard__header) :where(.navds-expansioncard__header-chevron) {
|
||||
transform: translateY(0) rotate(180deg);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.navds-expansioncard--open :where(.navds-expansioncard__header-button):hover :where(.navds-expansioncard__header-chevron) {
|
||||
.navds-expansioncard--open
|
||||
> :where(.navds-expansioncard__header)
|
||||
> :where(.navds-expansioncard__header-button):hover
|
||||
:where(.navds-expansioncard__header-chevron) {
|
||||
transform: translateY(-1px) rotate(180deg);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
[data-theme="dark"] {
|
||||
--ac-form-description: var(--a-text-on-inverted);
|
||||
}
|
||||
|
||||
.navds-fieldset {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
@@ -9,6 +13,10 @@
|
||||
margin-top: var(--a-spacing-2);
|
||||
}
|
||||
|
||||
.navds-fieldset__description {
|
||||
color: var(--ac-form-description, var(--a-text-subtle));
|
||||
}
|
||||
|
||||
.navds-fieldset > .navds-fieldset__description:not(:empty) {
|
||||
margin-top: 0.125rem;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
[data-theme="dark"] {
|
||||
--ac-form-description: var(--a-text-on-inverted);
|
||||
}
|
||||
|
||||
.navds-form-field {
|
||||
display: grid;
|
||||
justify-items: start;
|
||||
@@ -6,6 +10,7 @@
|
||||
|
||||
.navds-form-field__description {
|
||||
margin-top: -6px;
|
||||
color: var(--ac-form-description, var(--a-text-subtle));
|
||||
}
|
||||
|
||||
.navds-form-field .navds-error-message,
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
.navds-help-text__popover.navds-popover {
|
||||
background-color: var(--ac-help-text-popover-bg, var(--a-surface-info-subtle));
|
||||
max-width: 65ch;
|
||||
max-width: min(65ch, calc(100vw - 1.5rem));
|
||||
|
||||
--ac-popover-border: var(--a-border-info);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
@import "panel.css";
|
||||
@import "link-panel.css";
|
||||
@import "read-more.css";
|
||||
@import "skeleton.css";
|
||||
@import "stepper.css";
|
||||
@import "table.css";
|
||||
@import "tabs.css";
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
}
|
||||
|
||||
.navds-link-panel:hover {
|
||||
box-shadow: var(--a-shadow-medium);
|
||||
box-shadow: var(--a-shadow-small);
|
||||
border-color: var(--ac-link-panel-hover-border, var(--a-border-action));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
position: relative;
|
||||
overflow: auto;
|
||||
max-height: 100%;
|
||||
box-shadow: var(--a-shadow-xlarge);
|
||||
}
|
||||
|
||||
.navds-modal__content {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@navikt/ds-css",
|
||||
"version": "4.0.0",
|
||||
"version": "4.4.2",
|
||||
"description": "CSS for NAV Designsystem",
|
||||
"author": "Aksel | NAV designsystem team",
|
||||
"keywords": [
|
||||
@@ -27,7 +27,7 @@
|
||||
"css:get-version": "node config/get-version.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@navikt/ds-tokens": "^4.0.0",
|
||||
"@navikt/ds-tokens": "^4.4.2",
|
||||
"cssnano": "6.0.0",
|
||||
"fast-glob": "3.2.11",
|
||||
"lodash": "4.17.21",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
border: 1px solid;
|
||||
border-color: var(--ac-popover-border, var(--a-border-default));
|
||||
border-radius: var(--a-border-radius-medium);
|
||||
max-width: calc(100vw - var(--a-spacing-6));
|
||||
}
|
||||
|
||||
.navds-popover__content {
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
border-left: 2px solid var(--ac-read-more-line, var(--a-border-divider));
|
||||
margin-left: 13px;
|
||||
padding-left: 13px;
|
||||
color: var(--a-text-default);
|
||||
}
|
||||
|
||||
.navds-read-more--small .navds-read-more__content {
|
||||
|
||||
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
.navds-skeleton {
|
||||
display: block;
|
||||
background-color: var(--ac-skeleton-bg, var(--a-surface-neutral-moderate));
|
||||
height: 1.3em;
|
||||
animation: akselSkeletonAnimation 0.8s linear infinite alternate;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.navds-skeleton--has-children {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.navds-skeleton--has-children > * {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.navds-skeleton--has-children.navds-skeleton--no-height {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.navds-skeleton--has-children.navds-skeleton--no-width {
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.navds-skeleton--text {
|
||||
height: auto;
|
||||
transform-origin: 0 55%;
|
||||
transform: scale(1, 0.6);
|
||||
border-radius: var(--a-border-radius-medium);
|
||||
}
|
||||
|
||||
.navds-skeleton--text:empty::before {
|
||||
content: "\00a0";
|
||||
}
|
||||
|
||||
.navds-skeleton--circle {
|
||||
border-radius: var(--a-border-radius-full);
|
||||
}
|
||||
|
||||
.navds-skeleton--rectangle {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.navds-skeleton--rounded {
|
||||
border-radius: var(--a-border-radius-xlarge);
|
||||
}
|
||||
|
||||
@keyframes akselSkeletonAnimation {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,10 @@
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.navds-timeline__row-periods:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.navds-timeline__period {
|
||||
height: 100%;
|
||||
border-radius: var(--a-border-radius-full);
|
||||
|
||||
@@ -80,20 +80,28 @@
|
||||
"--ac-button-tertiary-neutral-active-hover-bg": "--a-surface-neutral-active"
|
||||
},
|
||||
"chat": {
|
||||
"--ac-chat-avatar-bg": "--a-bg-subtle",
|
||||
"--ac-chat-avatar-bg": "--a-surface-neutral-subtle",
|
||||
"--ac-chat-avatar-color": "--a-text-default",
|
||||
"--ac-chat-bubble-bg": "--a-bg-subtle",
|
||||
"--ac-chat-bubble-bg": "--a-surface-neutral-subtle",
|
||||
"--ac-chat-top-text": "--a-text-default"
|
||||
},
|
||||
"chips": {
|
||||
"--ac-chip-toggle-border": "--a-border-default",
|
||||
"--ac-chip-toggle-bg": "--a-surface-neutral-subtle",
|
||||
"--ac-chip-toggle-border": "--a-border-subtle",
|
||||
"--ac-chip-toggle-bg": "--a-surface-action-subtle",
|
||||
"--ac-chip-toggle-text": "--a-text-default",
|
||||
"--ac-chip-toggle-hover-border": "--a-border-strong",
|
||||
"--ac-chip-toggle-hover-bg": "--a-surface-neutral-subtle-hover",
|
||||
"--ac-chip-toggle-hover-border": "--a-border-subtle-hover",
|
||||
"--ac-chip-toggle-hover-bg": "--a-surface-action-subtle-hover",
|
||||
"--ac-chip-toggle-pressed-bg": "--a-surface-action-selected",
|
||||
"--ac-chip-toggle-pressed-text": "--a-text-on-action",
|
||||
"--ac-chip-toggle-pressed-hover-bg": "--a-surface-action-selected-hover",
|
||||
"--ac-chip-toggle-neutral-border": "--a-border-subtle",
|
||||
"--ac-chip-toggle-neutral-bg": "--a-surface-neutral-subtle",
|
||||
"--ac-chip-toggle-neutral-text": "--a-text-default",
|
||||
"--ac-chip-toggle-neutral-hover-border": "--a-border-subtle-hover",
|
||||
"--ac-chip-toggle-neutral-hover-bg": "--a-surface-neutral-subtle-hover",
|
||||
"--ac-chip-toggle-neutral-pressed-bg": "--a-surface-neutral-selected",
|
||||
"--ac-chip-toggle-neutral-pressed-text": "--a-text-on-neutral",
|
||||
"--ac-chip-toggle-neutral-pressed-hover-bg": "--a-surface-neutral-selected",
|
||||
"--ac-chip-toggle-focus": "--a-border-focus",
|
||||
"--ac-chip-removable-action-bg": "--a-surface-action-selected",
|
||||
"--ac-chip-removable-action-text": "--a-text-on-action",
|
||||
@@ -206,6 +214,9 @@
|
||||
"--ac-read-more-active-bg": "--a-surface-active",
|
||||
"--ac-read-more-line": "--a-border-divider"
|
||||
},
|
||||
"skeleton": {
|
||||
"--ac-skeleton-bg": "--a-surface-neutral-moderate"
|
||||
},
|
||||
"stepper": {
|
||||
"--ac-stepper-text": "--a-surface-action",
|
||||
"--ac-stepper-line": "--a-border-default",
|
||||
@@ -349,6 +360,10 @@
|
||||
"--ac-radio-checkbox-error-border": "--a-border-danger",
|
||||
"--ac-radio-checkbox-error-hover-bg": "--a-surface-danger-subtle"
|
||||
},
|
||||
"forms": {
|
||||
"--ac-form-description": "--a-text-subtle",
|
||||
"--ac-form-subdescription": "--a-text-subtle"
|
||||
},
|
||||
"search": {
|
||||
"--ac-search-button-border": "--a-border-default",
|
||||
"--ac-search-button-border-hover": "--a-border-action",
|
||||
|
||||
+213
-726
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@navikt/ds-react",
|
||||
"version": "4.0.0",
|
||||
"version": "4.4.2",
|
||||
"description": "Aksel react-components for NAV designsystem",
|
||||
"author": "Aksel | NAV designsystem team",
|
||||
"license": "MIT",
|
||||
@@ -38,7 +38,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@floating-ui/react": "0.24.1",
|
||||
"@navikt/aksel-icons": "^4.0.0",
|
||||
"@navikt/aksel-icons": "^4.4.2",
|
||||
"@radix-ui/react-tabs": "1.0.0",
|
||||
"@radix-ui/react-toggle-group": "1.0.0",
|
||||
"clsx": "^1.2.1",
|
||||
|
||||
@@ -1,17 +1,32 @@
|
||||
import cl from "clsx";
|
||||
import React, { forwardRef } from "react";
|
||||
import AccordionItem, { AccordionItemType } from "./AccordionItem";
|
||||
import AccordionContent, { AccordionContentType } from "./AccordionContent";
|
||||
import AccordionHeader, { AccordionHeaderType } from "./AccordionHeader";
|
||||
import AccordionItem, { AccordionItemProps } from "./AccordionItem";
|
||||
import AccordionContent, { AccordionContentProps } from "./AccordionContent";
|
||||
import AccordionHeader, { AccordionHeaderProps } from "./AccordionHeader";
|
||||
import { AccordionContext } from "./AccordionContext";
|
||||
|
||||
interface AccordionComponent
|
||||
extends React.ForwardRefExoticComponent<
|
||||
AccordionProps & React.RefAttributes<HTMLDivElement>
|
||||
> {
|
||||
Item: AccordionItemType;
|
||||
Header: AccordionHeaderType;
|
||||
Content: AccordionContentType;
|
||||
/**
|
||||
* @see 🏷️ {@link AccordionItemProps}
|
||||
*/
|
||||
Item: React.ForwardRefExoticComponent<
|
||||
AccordionItemProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
/**
|
||||
* @see 🏷️ {@link AccordionHeaderProps}
|
||||
*/
|
||||
Header: React.ForwardRefExoticComponent<
|
||||
AccordionHeaderProps & React.RefAttributes<HTMLButtonElement>
|
||||
>;
|
||||
/**
|
||||
* @see 🏷️ {@link AccordionContentProps}
|
||||
*/
|
||||
Content: React.ForwardRefExoticComponent<
|
||||
AccordionContentProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
}
|
||||
|
||||
export interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
@@ -27,12 +42,37 @@ export interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
* @default "medium"
|
||||
*/
|
||||
size?: "large" | "medium" | "small";
|
||||
/**
|
||||
* Whether to indent content or not
|
||||
* @default true
|
||||
*/
|
||||
indent?: boolean;
|
||||
/**
|
||||
* Instances of Accordion.Item
|
||||
*/
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays collapsible content sections.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/accordion)
|
||||
* @see 🏷️ {@link AccordionProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <Accordion>
|
||||
* <Accordion.Item>
|
||||
* <Accordion.Header>Section 1</Accordion.Header>
|
||||
* <Accordion.Content>Content 1</Accordion.Content>
|
||||
* </Accordion.Item>
|
||||
* <Accordion.Item>
|
||||
* <Accordion.Header>Section 2</Accordion.Header>
|
||||
* <Accordion.Content>Content 2</Accordion.Content>
|
||||
* </Accordion.Item>
|
||||
* </Accordion>
|
||||
* ```
|
||||
*/
|
||||
export const Accordion = forwardRef<HTMLDivElement, AccordionProps>(
|
||||
(
|
||||
{
|
||||
@@ -40,6 +80,7 @@ export const Accordion = forwardRef<HTMLDivElement, AccordionProps>(
|
||||
variant = "default",
|
||||
headingSize = "small",
|
||||
size = "medium",
|
||||
indent = true,
|
||||
...rest
|
||||
},
|
||||
ref
|
||||
@@ -57,7 +98,8 @@ export const Accordion = forwardRef<HTMLDivElement, AccordionProps>(
|
||||
className={cl(
|
||||
"navds-accordion",
|
||||
className,
|
||||
`navds-accordion--${size}`
|
||||
`navds-accordion--${size}`,
|
||||
{ "navds-accordion--indent": indent }
|
||||
)}
|
||||
ref={ref}
|
||||
/>
|
||||
|
||||
@@ -11,11 +11,7 @@ export interface AccordionContentProps
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type AccordionContentType = React.ForwardRefExoticComponent<
|
||||
AccordionContentProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
|
||||
const AccordionContent: AccordionContentType = forwardRef(
|
||||
const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(
|
||||
({ children, className, ...rest }, ref) => {
|
||||
const context = useContext(AccordionItemContext);
|
||||
|
||||
|
||||
@@ -13,11 +13,7 @@ export interface AccordionHeaderProps
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type AccordionHeaderType = React.ForwardRefExoticComponent<
|
||||
AccordionHeaderProps & React.RefAttributes<HTMLButtonElement>
|
||||
>;
|
||||
|
||||
const AccordionHeader: AccordionHeaderType = forwardRef(
|
||||
const AccordionHeader = forwardRef<HTMLButtonElement, AccordionHeaderProps>(
|
||||
({ children, className, onClick, ...rest }, ref) => {
|
||||
const itemContext = useContext(AccordionItemContext);
|
||||
const accordionContext = useContext(AccordionContext);
|
||||
|
||||
@@ -27,10 +27,6 @@ export interface AccordionItemProps
|
||||
defaultOpen?: boolean;
|
||||
}
|
||||
|
||||
export type AccordionItemType = React.ForwardRefExoticComponent<
|
||||
AccordionItemProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
|
||||
export interface AccordionItemContextProps {
|
||||
open: boolean;
|
||||
toggleOpen: () => void;
|
||||
@@ -39,7 +35,7 @@ export interface AccordionItemContextProps {
|
||||
export const AccordionItemContext =
|
||||
createContext<AccordionItemContextProps | null>(null);
|
||||
|
||||
const AccordionItem: AccordionItemType = forwardRef(
|
||||
const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(
|
||||
(
|
||||
{ children, className, open, defaultOpen = false, onClick, id, ...rest },
|
||||
ref
|
||||
|
||||
@@ -114,11 +114,12 @@ export const Default = {
|
||||
},
|
||||
|
||||
args: {
|
||||
controlled: "false",
|
||||
controlled: false,
|
||||
nItems: 2,
|
||||
variant: "default",
|
||||
headingSize: "medium",
|
||||
size: "medium",
|
||||
indent: true,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -137,7 +138,7 @@ export const DefaultOpen = {
|
||||
|
||||
args: {
|
||||
openItems: [1, 2],
|
||||
controlled: "false",
|
||||
controlled: false,
|
||||
nItems: 5,
|
||||
variant: "neutral",
|
||||
headingSize: "large",
|
||||
@@ -251,6 +252,7 @@ export const WithTable = {
|
||||
args: {
|
||||
variant: "default",
|
||||
headingSize: "large",
|
||||
indent: false,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -53,6 +53,15 @@ export interface AlertContextProps {
|
||||
size: "medium" | "small";
|
||||
}
|
||||
|
||||
/**
|
||||
* A component for displaying alerts
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/alert)
|
||||
* @see 🏷️ {@link AlertProps}
|
||||
* @example
|
||||
* ```jsx
|
||||
* <Alert variant="error">Dette er en feilmelding</Alert>
|
||||
* ```
|
||||
*/
|
||||
export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
||||
(
|
||||
{
|
||||
|
||||
@@ -47,6 +47,16 @@ export interface ButtonProps
|
||||
iconPosition?: "left" | "right";
|
||||
}
|
||||
|
||||
/**
|
||||
* A button component
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/button)
|
||||
* @see 🏷️ {@link ButtonProps}
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
* @example
|
||||
* ```jsx
|
||||
* <Button>Klikk meg</Button>
|
||||
* ```
|
||||
*/
|
||||
export const Button: OverridableComponent<ButtonProps, HTMLButtonElement> =
|
||||
forwardRef(
|
||||
(
|
||||
|
||||
@@ -17,6 +17,7 @@ export interface BubbleProps extends HTMLAttributes<HTMLDivElement> {
|
||||
timestamp?: string;
|
||||
/**
|
||||
* Background color on bubble
|
||||
* @deprecated Use `variant` on Chat instead
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
/**
|
||||
@@ -25,11 +26,7 @@ export interface BubbleProps extends HTMLAttributes<HTMLDivElement> {
|
||||
toptextPosition?: "left" | "right";
|
||||
}
|
||||
|
||||
export type BubbleType = React.ForwardRefExoticComponent<
|
||||
BubbleProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
|
||||
const Bubble: BubbleType = forwardRef(
|
||||
const Bubble = forwardRef<HTMLDivElement, BubbleProps>(
|
||||
(
|
||||
{
|
||||
children,
|
||||
@@ -50,17 +47,20 @@ const Bubble: BubbleType = forwardRef(
|
||||
{...rest}
|
||||
>
|
||||
{(timestamp || name) && (
|
||||
<div
|
||||
<h3
|
||||
className={cl(
|
||||
`navds-chat__top-text`,
|
||||
toptextPosition && `navds-chat__top-text--${toptextPosition}`
|
||||
)}
|
||||
>
|
||||
{name && <Detail className="navds-chat__name">{name}</Detail>}
|
||||
{timestamp && (
|
||||
<Detail className="navds-chat__timestamp">{timestamp}</Detail>
|
||||
{name && <Detail as="span">{name}</Detail>}
|
||||
{name && timestamp && (
|
||||
<Detail as="span" aria-hidden>
|
||||
•
|
||||
</Detail>
|
||||
)}
|
||||
</div>
|
||||
{timestamp && <Detail as="span">{timestamp}</Detail>}
|
||||
</h3>
|
||||
)}
|
||||
{children}
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import React, { forwardRef, HTMLAttributes } from "react";
|
||||
import cl from "clsx";
|
||||
import Bubble, { BubbleType } from "./Bubble";
|
||||
import { BodyLong, BodyShort } from "../typography";
|
||||
import Bubble from "./Bubble";
|
||||
import { BodyLong } from "../typography";
|
||||
|
||||
export const POSITIONS = ["left", "right"] as const;
|
||||
export const SIZES = ["medium", "small"] as const;
|
||||
|
||||
export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
|
||||
/**
|
||||
@@ -17,36 +20,69 @@ export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
|
||||
*/
|
||||
timestamp?: string;
|
||||
/**
|
||||
* Avatar for messenger. Regular text for initials works to
|
||||
* Avatar for messenger. Regular text for initials works too, but it will be hidden for screen readers.
|
||||
*/
|
||||
avatar: React.ReactNode;
|
||||
avatar?: React.ReactNode;
|
||||
/**
|
||||
* Changes background color on avatar and bubbles.
|
||||
* Avoid using the same background as the surface behind Chat.
|
||||
* @default "neutral"
|
||||
*/
|
||||
variant?: "subtle" | "info" | "neutral";
|
||||
/**
|
||||
* Background color on bubbles
|
||||
* @deprecated Use `variant` instead
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
/**
|
||||
* Background color for avatar
|
||||
* @deprecated Use `variant` instead
|
||||
*/
|
||||
avatarBgColor?: string;
|
||||
/**
|
||||
* Positions avatar and Bubbles
|
||||
* Positions avatar and bubbles
|
||||
* @default "left"
|
||||
*/
|
||||
position?: "left" | "right";
|
||||
position?: (typeof POSITIONS)[number];
|
||||
/**
|
||||
* Hoizontal position of toptext
|
||||
* @default Same as chat
|
||||
* @default Same as position
|
||||
*/
|
||||
toptextPosition?: "left" | "right";
|
||||
toptextPosition?: (typeof POSITIONS)[number];
|
||||
/**
|
||||
* Affects padding and font size in bubbles
|
||||
* @default "medium"
|
||||
*/
|
||||
size?: (typeof SIZES)[number];
|
||||
}
|
||||
|
||||
interface ChatComponent
|
||||
extends React.ForwardRefExoticComponent<
|
||||
ChatProps & React.RefAttributes<HTMLDivElement>
|
||||
> {
|
||||
Bubble: BubbleType;
|
||||
/**
|
||||
* @see 🏷️ {@link BubbleProps}
|
||||
*/
|
||||
Bubble: typeof Bubble;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component for communicating dialogs between two parties.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/chat)
|
||||
* @see 🏷️ {@link ChatProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <Chat avatar="A" name="Alice" timestamp="01.01.21 14:00">
|
||||
* <Chat.Bubble>Hello!</Chat.Bubble>
|
||||
* <Chat.Bubble>How can I help you?</Chat.Bubble>
|
||||
* </Chat>
|
||||
* <Chat avatar="B" name="Bob" timestamp="01.01.21 14:01" position="right">
|
||||
* <Chat.Bubble>Hi there!</Chat.Bubble>
|
||||
* </Chat>
|
||||
* ```
|
||||
*/
|
||||
export const Chat = forwardRef<HTMLDivElement, ChatProps>(
|
||||
(
|
||||
{
|
||||
@@ -56,51 +92,54 @@ export const Chat = forwardRef<HTMLDivElement, ChatProps>(
|
||||
timestamp,
|
||||
avatar,
|
||||
position = "left",
|
||||
variant = "neutral",
|
||||
avatarBgColor,
|
||||
backgroundColor,
|
||||
toptextPosition,
|
||||
size = "medium",
|
||||
...rest
|
||||
},
|
||||
}: ChatProps,
|
||||
ref
|
||||
) => {
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cl(
|
||||
"navds-chat",
|
||||
className,
|
||||
`navds-chat--${position} navds-chat--top-text-${
|
||||
toptextPosition ?? position
|
||||
}`
|
||||
)}
|
||||
{...rest}
|
||||
>
|
||||
<BodyShort
|
||||
as="div"
|
||||
) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cl(
|
||||
"navds-chat",
|
||||
className,
|
||||
`navds-chat--${position}`,
|
||||
`navds-chat--top-text-${toptextPosition ?? position}`,
|
||||
`navds-chat--${size}`,
|
||||
`navds-chat--${variant}`
|
||||
)}
|
||||
{...rest}
|
||||
>
|
||||
{avatar && (
|
||||
<div
|
||||
className="navds-chat__avatar"
|
||||
aria-hidden
|
||||
style={{ backgroundColor: avatarBgColor }}
|
||||
>
|
||||
{avatar}
|
||||
</BodyShort>
|
||||
<ol className="navds-chat__bubble-wrapper">
|
||||
{React.Children.map(children, (child, i) => {
|
||||
if (React.isValidElement(child)) {
|
||||
return (
|
||||
<BodyLong as="li">
|
||||
{React.cloneElement(child, {
|
||||
name: name && i === 0 ? name : undefined,
|
||||
timestamp: timestamp && i === 0 ? timestamp : undefined,
|
||||
backgroundColor,
|
||||
...child.props,
|
||||
})}
|
||||
</BodyLong>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</ol>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
<ol className="navds-chat__bubble-wrapper">
|
||||
{React.Children.map(children, (child, i) => {
|
||||
if (React.isValidElement(child)) {
|
||||
return (
|
||||
<BodyLong as="li" size={size}>
|
||||
{React.cloneElement(child, {
|
||||
name: name && i === 0 ? name : undefined,
|
||||
timestamp: timestamp && i === 0 ? timestamp : undefined,
|
||||
backgroundColor,
|
||||
...child.props,
|
||||
})}
|
||||
</BodyLong>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</ol>
|
||||
</div>
|
||||
)
|
||||
) as ChatComponent;
|
||||
|
||||
Chat.Bubble = Bubble;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { Chat } from "../index";
|
||||
import { Meta } from "@storybook/react";
|
||||
import { POSITIONS, SIZES } from "./Chat";
|
||||
|
||||
export default {
|
||||
title: "ds-react/Chat",
|
||||
@@ -16,19 +17,25 @@ export default {
|
||||
type: "text",
|
||||
},
|
||||
},
|
||||
position: {
|
||||
control: { type: "radio" },
|
||||
options: POSITIONS,
|
||||
},
|
||||
toptextPosition: {
|
||||
control: { type: "radio" },
|
||||
options: POSITIONS,
|
||||
},
|
||||
size: {
|
||||
control: { type: "radio" },
|
||||
options: SIZES,
|
||||
},
|
||||
},
|
||||
} as Meta;
|
||||
} satisfies Meta<typeof Chat>;
|
||||
|
||||
export const Default = {
|
||||
render: (props) => {
|
||||
return (
|
||||
<Chat
|
||||
avatar={props?.avatar ?? "ON"}
|
||||
name={props?.name ?? "Ola Normann"}
|
||||
timestamp={props?.timestamp ?? "01.01.21 14:00"}
|
||||
avatarBgColor={props?.avatarBgColor}
|
||||
backgroundColor={props?.backgroundColor}
|
||||
>
|
||||
<Chat {...props}>
|
||||
<Chat.Bubble>
|
||||
Aute minim nisi sunt mollit duis sunt nulla minim non proident.
|
||||
</Chat.Bubble>
|
||||
@@ -48,141 +55,156 @@ export const Default = {
|
||||
},
|
||||
};
|
||||
|
||||
export const Farger = () => {
|
||||
return (
|
||||
export const Small = () => (
|
||||
<Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 14:00" size="small">
|
||||
<Chat.Bubble>
|
||||
Aute minim nisi sunt mollit duis sunt nulla minim non proident.
|
||||
</Chat.Bubble>
|
||||
<Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
|
||||
<Chat.Bubble>
|
||||
Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
|
||||
labore nisi ut.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
);
|
||||
|
||||
export const Colors = () => (
|
||||
<Chat
|
||||
avatar="NAV"
|
||||
name="NAV"
|
||||
timestamp="01.01.21 14:00"
|
||||
avatarBgColor="var(--a-surface-alt-1-subtle)"
|
||||
backgroundColor="var(--a-surface-warning-subtle)"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Aute minim nisi sunt mollit duis sunt nulla minim non proident.
|
||||
</Chat.Bubble>
|
||||
<Chat.Bubble backgroundColor="lightYellow">
|
||||
Tempor fugiat amet eu sint in in ullamco.
|
||||
</Chat.Bubble>
|
||||
<Chat.Bubble>
|
||||
Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
|
||||
labore nisi ut.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
);
|
||||
|
||||
export const Variants = () => (
|
||||
<div className="colgap">
|
||||
<Chat avatar="NAV" name="NAV" timestamp="01.01.21 14:00" variant="info">
|
||||
<Chat.Bubble>
|
||||
Aute minim nisi sunt mollit duis sunt nulla minim non proident.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
<Chat
|
||||
avatar="KN"
|
||||
name="Kari Nordmann"
|
||||
timestamp="01.01.21 14:03"
|
||||
variant="neutral"
|
||||
position="right"
|
||||
>
|
||||
<Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
|
||||
</Chat>
|
||||
<Chat
|
||||
avatar="ON"
|
||||
name="Ola Nordmann"
|
||||
timestamp="01.01.21 14:07"
|
||||
variant="subtle"
|
||||
position="right"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
|
||||
labore nisi ut.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
</div>
|
||||
);
|
||||
|
||||
export const Position = () => (
|
||||
<div className="colgap">
|
||||
<Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 14:00">
|
||||
<Chat.Bubble>
|
||||
Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
|
||||
labore nisi ut.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
<Chat
|
||||
avatar="KH"
|
||||
name="Kari Høyli"
|
||||
timestamp="01.01.21 14:32"
|
||||
position="right"
|
||||
variant="info"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Reprehenderit pariatur officia exercitation laboris.
|
||||
</Chat.Bubble>
|
||||
<Chat.Bubble>
|
||||
Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit est
|
||||
dolore incididunt. Occaecat cupidatat magna.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
<Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 15:00">
|
||||
<Chat.Bubble>
|
||||
Exercitation irure Lorem cupidatat culpa anim cillum esse ullamco qui
|
||||
dolore laborum et Lorem. Labore sunt duis id Lorem voluptate commodo ea
|
||||
esse. Dolore esse aliqua proident ea ad commodo ut dolore voluptate
|
||||
labore sunt aute.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
</div>
|
||||
);
|
||||
|
||||
export const ToptextPosition = () => (
|
||||
<div className="colgap">
|
||||
<Chat
|
||||
avatar="ON"
|
||||
name="Ola Normann"
|
||||
timestamp="01.01.21 14:00"
|
||||
avatarBgColor="var(--a-lightblue-200)"
|
||||
backgroundColor="var(--a-lightblue-100)"
|
||||
toptextPosition="right"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Aute minim nisi sunt mollit duis sunt nulla minim non proident.
|
||||
</Chat.Bubble>
|
||||
<Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
|
||||
<Chat.Bubble>
|
||||
Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
|
||||
labore nisi ut.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
);
|
||||
};
|
||||
|
||||
export const Position = () => {
|
||||
return (
|
||||
<div className="colgap">
|
||||
<Chat
|
||||
avatar="ON"
|
||||
name="Ola Normann"
|
||||
timestamp="01.01.21 14:00"
|
||||
backgroundColor="rgba(255, 249, 240, 1)"
|
||||
avatarBgColor="rgba(255, 236, 204, 1)"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Adipisicing laborum est eu laborum est sit in commodo enim sint
|
||||
laboris labore nisi ut.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
<Chat
|
||||
avatar="KH"
|
||||
name="Kari Høyli"
|
||||
timestamp="01.01.21 14:32"
|
||||
position="right"
|
||||
backgroundColor="rgba(230, 240, 255, 1)"
|
||||
avatarBgColor="rgba(204, 225, 255, 1)"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Reprehenderit pariatur officia exercitation laboris.
|
||||
</Chat.Bubble>
|
||||
<Chat.Bubble>
|
||||
Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit
|
||||
est dolore incididunt. Occaecat cupidatat magna.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
<Chat
|
||||
avatar="ON"
|
||||
name="Ola Normann"
|
||||
timestamp="01.01.21 15:00"
|
||||
backgroundColor="rgba(255, 249, 240, 1)"
|
||||
avatarBgColor="rgba(255, 236, 204, 1)"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Exercitation irure Lorem cupidatat culpa anim cillum esse ullamco qui
|
||||
dolore laborum et Lorem. Labore sunt duis id Lorem voluptate commodo
|
||||
ea esse. Dolore esse aliqua proident ea ad commodo ut dolore voluptate
|
||||
labore sunt aute.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const ToptextPosition = () => {
|
||||
return (
|
||||
<div className="colgap">
|
||||
<Chat
|
||||
avatar="ON"
|
||||
name="Ola Normann"
|
||||
timestamp="01.01.21 14:00"
|
||||
backgroundColor="rgba(255, 249, 240, 1)"
|
||||
avatarBgColor="rgba(255, 236, 204, 1)"
|
||||
toptextPosition="right"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Adipisicing laborum est eu laborum est sit in commodo enim sint
|
||||
laboris labore nisi ut.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
<Chat
|
||||
avatar="KH"
|
||||
name="Kari Høyli"
|
||||
timestamp="01.01.21 14:32"
|
||||
position="right"
|
||||
backgroundColor="rgba(230, 240, 255, 1)"
|
||||
avatarBgColor="rgba(204, 225, 255, 1)"
|
||||
toptextPosition="left"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Reprehenderit pariatur officia exercitation laboris.
|
||||
</Chat.Bubble>
|
||||
<Chat.Bubble>
|
||||
Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit
|
||||
est dolore incididunt. Occaecat cupidatat magna.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
<Chat
|
||||
avatar="ON"
|
||||
name="Ola Normann"
|
||||
timestamp="01.01.21 15:00"
|
||||
backgroundColor="rgba(255, 249, 240, 1)"
|
||||
avatarBgColor="rgba(255, 236, 204, 1)"
|
||||
>
|
||||
<Chat.Bubble toptextPosition="right">
|
||||
Exercitation irure Lorem cupidatat culpa anim cillum esse ullamco qui
|
||||
dolore laborum et Lorem. Labore sunt duis id Lorem voluptate commodo
|
||||
ea esse. Dolore esse aliqua proident ea ad commodo ut dolore voluptate
|
||||
labore sunt aute.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const Avatar = () => {
|
||||
return (
|
||||
<Chat avatar={<Illustration />} timestamp="01.01.21 14:00">
|
||||
<Chat
|
||||
name="Kari Høyli"
|
||||
timestamp="01.01.21 14:32"
|
||||
position="right"
|
||||
variant="info"
|
||||
toptextPosition="left"
|
||||
>
|
||||
<Chat.Bubble>
|
||||
Aute minim nisi sunt mollit duis sunt nulla minim non proident.
|
||||
Reprehenderit pariatur officia exercitation laboris.
|
||||
</Chat.Bubble>
|
||||
<Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
|
||||
<Chat.Bubble>
|
||||
Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
|
||||
labore nisi ut.
|
||||
Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit est
|
||||
dolore incididunt. Occaecat cupidatat magna.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
);
|
||||
};
|
||||
<Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 15:00">
|
||||
<Chat.Bubble toptextPosition="right">
|
||||
Exercitation irure Lorem cupidatat culpa anim cillum esse ullamco qui
|
||||
dolore laborum et Lorem. Labore sunt duis id Lorem voluptate commodo ea
|
||||
esse. Dolore esse aliqua proident ea ad commodo ut dolore voluptate
|
||||
labore sunt aute.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
</div>
|
||||
);
|
||||
|
||||
export const Avatar = () => (
|
||||
<Chat avatar={<Illustration />} timestamp="01.01.21 14:00">
|
||||
<Chat.Bubble>
|
||||
Aute minim nisi sunt mollit duis sunt nulla minim non proident.
|
||||
</Chat.Bubble>
|
||||
<Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
|
||||
<Chat.Bubble>
|
||||
Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
|
||||
labore nisi ut.
|
||||
</Chat.Bubble>
|
||||
</Chat>
|
||||
);
|
||||
|
||||
const Illustration = () => (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 93">
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import cl from "clsx";
|
||||
import React, { forwardRef, HTMLAttributes } from "react";
|
||||
import ToggleChips, { ToggleChipsType } from "./Toggle";
|
||||
import RemovableChips, { RemovableChipsType } from "./Removable";
|
||||
import ToggleChips, { ToggleChipsProps } from "./Toggle";
|
||||
import RemovableChips, { RemovableChipsProps } from "./Removable";
|
||||
import { OverridableComponent } from "../util/OverridableComponent";
|
||||
|
||||
export interface ChipsProps extends HTMLAttributes<HTMLUListElement> {
|
||||
children: React.ReactNode;
|
||||
@@ -16,10 +17,47 @@ interface ChipsComponent
|
||||
extends React.ForwardRefExoticComponent<
|
||||
ChipsProps & React.RefAttributes<HTMLUListElement>
|
||||
> {
|
||||
Toggle: ToggleChipsType;
|
||||
Removable: RemovableChipsType;
|
||||
/**
|
||||
* Toggle between selected-states.
|
||||
* @see 🏷️ {@link ToggleChipsProps}
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
*/
|
||||
Toggle: OverridableComponent<ToggleChipsProps, HTMLButtonElement>;
|
||||
/**
|
||||
* Remove filter or the likes on click
|
||||
* @see 🏷️ {@link RemovableChipsProps}
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
*/
|
||||
Removable: OverridableComponent<RemovableChipsProps, HTMLButtonElement>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a list of items as chips.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/chips)
|
||||
* @see 🏷️ {@link ChipsProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
<Chips size="small">
|
||||
{options.map((c) => (
|
||||
<Chips.Toggle
|
||||
selected={selected.includes(c)}
|
||||
key={c}
|
||||
onClick={() =>
|
||||
setSelected(
|
||||
selected.includes(c)
|
||||
? selected.filter((x) => x !== c)
|
||||
: [...selected, c]
|
||||
)
|
||||
}
|
||||
>
|
||||
{c}
|
||||
</Chips.Toggle>
|
||||
))}
|
||||
</Chips>
|
||||
* ```
|
||||
*/
|
||||
export const Chips: ChipsComponent = forwardRef<HTMLUListElement, ChipsProps>(
|
||||
({ className, size = "medium", children, ...rest }, ref) => {
|
||||
return (
|
||||
|
||||
@@ -22,9 +22,6 @@ export interface RemovableChipsProps
|
||||
onDelete?: () => void;
|
||||
}
|
||||
|
||||
export interface RemovableChipsType
|
||||
extends OverridableComponent<RemovableChipsProps, HTMLButtonElement> {}
|
||||
|
||||
export const RemovableChips: OverridableComponent<
|
||||
RemovableChipsProps,
|
||||
HTMLButtonElement
|
||||
@@ -63,6 +60,6 @@ export const RemovableChips: OverridableComponent<
|
||||
</Component>
|
||||
);
|
||||
}
|
||||
) as RemovableChipsType;
|
||||
);
|
||||
|
||||
export default RemovableChips;
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CheckmarkIcon } from "@navikt/aksel-icons";
|
||||
import cl from "clsx";
|
||||
import React, { forwardRef } from "react";
|
||||
import { OverridableComponent } from "../util/OverridableComponent";
|
||||
@@ -10,27 +9,64 @@ export interface ToggleChipsProps
|
||||
* Toggles aria-pressed and visual-changes
|
||||
*/
|
||||
selected?: boolean;
|
||||
/**
|
||||
* Chip-variants
|
||||
* @default "action"
|
||||
*/
|
||||
variant?: "action" | "neutral";
|
||||
/**
|
||||
* Toggles display of checkmark on selected
|
||||
* @default true
|
||||
*/
|
||||
checkmark?: boolean;
|
||||
}
|
||||
|
||||
export interface ToggleChipsType
|
||||
extends OverridableComponent<ToggleChipsProps, HTMLButtonElement> {}
|
||||
|
||||
export const ToggleChips: ToggleChipsType = forwardRef(
|
||||
export const ToggleChips: OverridableComponent<
|
||||
ToggleChipsProps,
|
||||
HTMLButtonElement
|
||||
> = forwardRef(
|
||||
(
|
||||
{ className, children, selected, as: Component = "button", ...rest },
|
||||
{
|
||||
className,
|
||||
children,
|
||||
selected,
|
||||
variant = "action",
|
||||
checkmark = true,
|
||||
as: Component = "button",
|
||||
...rest
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
return (
|
||||
<Component
|
||||
{...rest}
|
||||
ref={ref}
|
||||
className={cl("navds-chips__chip navds-chips__toggle", className, {
|
||||
"navds-chips--icon-left": selected,
|
||||
})}
|
||||
className={cl(
|
||||
"navds-chips__chip navds-chips__toggle",
|
||||
className,
|
||||
`navds-chips__toggle--${variant}`
|
||||
)}
|
||||
aria-pressed={selected}
|
||||
>
|
||||
{selected && (
|
||||
<CheckmarkIcon aria-hidden className="navds-chips__toggle-icon" />
|
||||
{selected && checkmark && (
|
||||
<svg
|
||||
aria-hidden
|
||||
className="navds-chips__toggle-icon"
|
||||
width="10"
|
||||
height="8"
|
||||
viewBox="0 0 10 8"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
focusable={false}
|
||||
role="img"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M9.51894 0.45851C9.81799 0.745107 9.8281 1.21987 9.5415 1.51893L3.7915 7.51893C3.51247 7.81009 3.05315 7.82848 2.75174 7.56056L0.501735 5.56056C0.192148 5.28537 0.164263 4.81132 0.439451 4.50173C0.71464 4.19214 1.18869 4.16426 1.49828 4.43944L3.20835 5.95951L8.45852 0.481072C8.74511 0.182015 9.21988 0.171913 9.51894 0.45851Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
)}
|
||||
<span className="navds-chips__chip-text">{children}</span>
|
||||
</Component>
|
||||
|
||||
@@ -66,25 +66,78 @@ export const Default = {
|
||||
};
|
||||
|
||||
export const Toggle = () => {
|
||||
const [selected, setSelected] = useState<number[]>([]);
|
||||
const [selected, setSelected] = useState<number[]>([2, 4]);
|
||||
return (
|
||||
<Chips>
|
||||
{options.map((c, y) => (
|
||||
<Chips.Toggle
|
||||
selected={selected.includes(y)}
|
||||
onClick={() =>
|
||||
setSelected(
|
||||
selected.includes(y)
|
||||
? selected.filter((x) => x !== y)
|
||||
: [...selected, y]
|
||||
)
|
||||
}
|
||||
key={y}
|
||||
>
|
||||
{c}
|
||||
</Chips.Toggle>
|
||||
))}
|
||||
</Chips>
|
||||
<div className="colgap">
|
||||
<Chips>
|
||||
{options.map((c, y) => (
|
||||
<Chips.Toggle
|
||||
selected={selected.includes(y)}
|
||||
onClick={() =>
|
||||
setSelected(
|
||||
selected.includes(y)
|
||||
? selected.filter((x) => x !== y)
|
||||
: [...selected, y]
|
||||
)
|
||||
}
|
||||
key={y}
|
||||
>
|
||||
{c}
|
||||
</Chips.Toggle>
|
||||
))}
|
||||
</Chips>
|
||||
<Chips>
|
||||
{options.map((c, y) => (
|
||||
<Chips.Toggle
|
||||
variant="neutral"
|
||||
selected={selected.includes(y)}
|
||||
onClick={() =>
|
||||
setSelected(
|
||||
selected.includes(y)
|
||||
? selected.filter((x) => x !== y)
|
||||
: [...selected, y]
|
||||
)
|
||||
}
|
||||
key={y}
|
||||
>
|
||||
{c}
|
||||
</Chips.Toggle>
|
||||
))}
|
||||
</Chips>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const ToggleNoCheckmark = () => {
|
||||
const [selected, setSelected] = useState<number>(2);
|
||||
return (
|
||||
<div className="colgap">
|
||||
<Chips>
|
||||
{options.map((c, y) => (
|
||||
<Chips.Toggle
|
||||
selected={selected === y}
|
||||
checkmark={false}
|
||||
onClick={() => setSelected(y)}
|
||||
key={y}
|
||||
>
|
||||
{c}
|
||||
</Chips.Toggle>
|
||||
))}
|
||||
</Chips>
|
||||
<Chips>
|
||||
{options.map((c, y) => (
|
||||
<Chips.Toggle
|
||||
variant="neutral"
|
||||
selected={selected === y}
|
||||
checkmark={false}
|
||||
onClick={() => setSelected(y)}
|
||||
key={y}
|
||||
>
|
||||
{c}
|
||||
</Chips.Toggle>
|
||||
))}
|
||||
</Chips>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -108,7 +161,7 @@ export const Removable = () => {
|
||||
};
|
||||
|
||||
export const Regular = () => {
|
||||
const [selected, setSelected] = useState<number[]>([]);
|
||||
const [selected, setSelected] = useState<number[]>([2]);
|
||||
return (
|
||||
<div className="colgap">
|
||||
<Chips>
|
||||
@@ -138,7 +191,7 @@ export const Regular = () => {
|
||||
};
|
||||
|
||||
export const Small = () => {
|
||||
const [selected, setSelected] = useState<number[]>([]);
|
||||
const [selected, setSelected] = useState<number[]>([2, 4]);
|
||||
return (
|
||||
<div className="colgap">
|
||||
<Chips size="small">
|
||||
|
||||
@@ -65,6 +65,17 @@ export interface CopyButtonProps
|
||||
activeTitle?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A button component that copies text to the clipboard when clicked.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/copybutton)
|
||||
* @see 🏷️ {@link CopyButtonProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
<CopyButton copyText="3.14" />
|
||||
* ```
|
||||
*/
|
||||
export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(
|
||||
(
|
||||
{
|
||||
|
||||
@@ -28,131 +28,121 @@ export interface DateInputProps
|
||||
variant?: "datepicker" | "monthpicker";
|
||||
}
|
||||
|
||||
export type DateInputType = React.ForwardRefExoticComponent<
|
||||
DateInputProps & React.RefAttributes<HTMLInputElement>
|
||||
>;
|
||||
const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
||||
const {
|
||||
className,
|
||||
hideLabel = false,
|
||||
label,
|
||||
description,
|
||||
variant = "datepicker",
|
||||
...rest
|
||||
} = props;
|
||||
|
||||
const DateInput: DateInputType = forwardRef<HTMLInputElement, DateInputProps>(
|
||||
(props, ref) => {
|
||||
const {
|
||||
className,
|
||||
hideLabel = false,
|
||||
label,
|
||||
description,
|
||||
variant = "datepicker",
|
||||
...rest
|
||||
} = props;
|
||||
const isDatepickerVariant = variant === "datepicker";
|
||||
|
||||
const isDatepickerVariant = variant === "datepicker";
|
||||
const conditionalVariables = {
|
||||
prefix: isDatepickerVariant ? "datepicker-input" : "monthpicker-input",
|
||||
iconTitle: {
|
||||
open: isDatepickerVariant ? "Åpne datovelger" : "Åpne månedsvelger",
|
||||
close: isDatepickerVariant ? "Lukk datovelger" : "Lukk månedsvelger",
|
||||
},
|
||||
};
|
||||
|
||||
const conditionalVariables = {
|
||||
prefix: isDatepickerVariant ? "datepicker-input" : "monthpicker-input",
|
||||
iconTitle: {
|
||||
open: isDatepickerVariant ? "Åpne datovelger" : "Åpne månedsvelger",
|
||||
close: isDatepickerVariant ? "Lukk datovelger" : "Lukk månedsvelger",
|
||||
},
|
||||
};
|
||||
const { onOpen, ariaId, open } = useDateInputContext();
|
||||
|
||||
const { onOpen, ariaId, open } = useDateInputContext();
|
||||
const {
|
||||
inputProps,
|
||||
size = "medium",
|
||||
inputDescriptionId,
|
||||
errorId,
|
||||
showErrorMsg,
|
||||
hasError,
|
||||
} = useFormField(props, conditionalVariables.prefix);
|
||||
|
||||
const {
|
||||
inputProps,
|
||||
size = "medium",
|
||||
inputDescriptionId,
|
||||
errorId,
|
||||
showErrorMsg,
|
||||
hasError,
|
||||
} = useFormField(props, conditionalVariables.prefix);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cl(
|
||||
className,
|
||||
"navds-form-field",
|
||||
`navds-form-field--${size}`,
|
||||
"navds-date__field",
|
||||
{
|
||||
"navds-text-field--error": hasError,
|
||||
"navds-date__field--error": hasError,
|
||||
"navds-form-field--disabled": !!inputProps.disabled,
|
||||
"navds-text-field--disabled": !!inputProps.disabled,
|
||||
}
|
||||
)}
|
||||
return (
|
||||
<div
|
||||
className={cl(
|
||||
className,
|
||||
"navds-form-field",
|
||||
`navds-form-field--${size}`,
|
||||
"navds-date__field",
|
||||
{
|
||||
"navds-text-field--error": hasError,
|
||||
"navds-date__field--error": hasError,
|
||||
"navds-form-field--disabled": !!inputProps.disabled,
|
||||
"navds-text-field--disabled": !!inputProps.disabled,
|
||||
}
|
||||
)}
|
||||
>
|
||||
<Label
|
||||
htmlFor={inputProps.id}
|
||||
size={size}
|
||||
className={cl("navds-form-field__label", {
|
||||
"navds-sr-only": hideLabel,
|
||||
})}
|
||||
>
|
||||
<Label
|
||||
htmlFor={inputProps.id}
|
||||
size={size}
|
||||
className={cl("navds-form-field__label", {
|
||||
{label}
|
||||
</Label>
|
||||
{!!description && (
|
||||
<BodyShort
|
||||
as="div"
|
||||
className={cl("navds-form-field__description", {
|
||||
"navds-sr-only": hideLabel,
|
||||
})}
|
||||
id={inputDescriptionId}
|
||||
size={size}
|
||||
>
|
||||
{label}
|
||||
</Label>
|
||||
{!!description && (
|
||||
<BodyShort
|
||||
as="div"
|
||||
className={cl("navds-form-field__description", {
|
||||
"navds-sr-only": hideLabel,
|
||||
})}
|
||||
id={inputDescriptionId}
|
||||
size={size}
|
||||
>
|
||||
{description}
|
||||
</BodyShort>
|
||||
)}
|
||||
<div className="navds-date__field-wrapper">
|
||||
<input
|
||||
ref={ref}
|
||||
{...omit(rest, ["error", "errorId", "size"])}
|
||||
{...inputProps}
|
||||
autoComplete="off"
|
||||
aria-controls={ariaId}
|
||||
className={cl(
|
||||
"navds-date__field-input",
|
||||
"navds-text-field__input",
|
||||
"navds-body-short",
|
||||
`navds-body-${size}`
|
||||
)}
|
||||
size={14}
|
||||
/>
|
||||
<button
|
||||
disabled={inputProps.disabled}
|
||||
tabIndex={open ? -1 : 0}
|
||||
onClick={() => onOpen()}
|
||||
type="button"
|
||||
className="navds-date__field-button"
|
||||
>
|
||||
<CalendarIcon
|
||||
pointerEvents="none"
|
||||
title={
|
||||
open
|
||||
? conditionalVariables.iconTitle.close
|
||||
: conditionalVariables.iconTitle.open
|
||||
}
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
className="navds-form-field__error"
|
||||
id={errorId}
|
||||
aria-relevant="additions removals"
|
||||
aria-live="polite"
|
||||
>
|
||||
{showErrorMsg && (
|
||||
<ErrorMessage size={size}>{props.error}</ErrorMessage>
|
||||
{description}
|
||||
</BodyShort>
|
||||
)}
|
||||
<div className="navds-date__field-wrapper">
|
||||
<input
|
||||
ref={ref}
|
||||
{...omit(rest, ["error", "errorId", "size"])}
|
||||
{...inputProps}
|
||||
autoComplete="off"
|
||||
aria-controls={ariaId}
|
||||
className={cl(
|
||||
"navds-date__field-input",
|
||||
"navds-text-field__input",
|
||||
"navds-body-short",
|
||||
`navds-body-${size}`
|
||||
)}
|
||||
</div>
|
||||
size={14}
|
||||
/>
|
||||
<button
|
||||
disabled={inputProps.disabled}
|
||||
tabIndex={open ? -1 : 0}
|
||||
onClick={() => onOpen()}
|
||||
type="button"
|
||||
className="navds-date__field-button"
|
||||
>
|
||||
<CalendarIcon
|
||||
pointerEvents="none"
|
||||
title={
|
||||
open
|
||||
? conditionalVariables.iconTitle.close
|
||||
: conditionalVariables.iconTitle.open
|
||||
}
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
<div
|
||||
className="navds-form-field__error"
|
||||
id={errorId}
|
||||
aria-relevant="additions removals"
|
||||
aria-live="polite"
|
||||
>
|
||||
{showErrorMsg && <ErrorMessage size={size}>{props.error}</ErrorMessage>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export const DatePickerInput = forwardRef<HTMLInputElement, DateInputProps>(
|
||||
(props, ref) => <DateInput {...props} ref={ref} />
|
||||
);
|
||||
|
||||
export const DatePickerInput: DateInputType = forwardRef<
|
||||
HTMLInputElement,
|
||||
DateInputProps
|
||||
>((props, ref) => <DateInput {...props} ref={ref} />);
|
||||
|
||||
export const MonthPickerInput: DateInputType = forwardRef<
|
||||
HTMLInputElement,
|
||||
DateInputProps
|
||||
>((props, ref) => <DateInput {...props} variant="monthpicker" ref={ref} />);
|
||||
export const MonthPickerInput = forwardRef<HTMLInputElement, DateInputProps>(
|
||||
(props, ref) => <DateInput {...props} variant="monthpicker" ref={ref} />
|
||||
);
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
SelectSingleEventHandler,
|
||||
} from "react-day-picker";
|
||||
import { omit, Popover, useId } from "../..";
|
||||
import { DateInputType, DatePickerInput } from "../DateInput";
|
||||
import { DateInputProps, DatePickerInput } from "../DateInput";
|
||||
import { DateContext } from "../context";
|
||||
import { getLocaleFromString, labels } from "../utils";
|
||||
import { Caption, DropdownCaption } from "./caption";
|
||||
@@ -114,16 +114,59 @@ export interface DatePickerDefaultProps
|
||||
* @default "absolute"
|
||||
*/
|
||||
strategy?: "absolute" | "fixed";
|
||||
/**
|
||||
* Bubbles Escape keydown-event up trough DOM-tree. This is set to false by default to prevent closing components like Modal on Escape
|
||||
* @default false
|
||||
*/
|
||||
bubbleEscape?: boolean;
|
||||
}
|
||||
|
||||
export type DatePickerProps = DatePickerDefaultProps & ConditionalModeProps;
|
||||
|
||||
interface DatePickerComponent
|
||||
extends React.ForwardRefExoticComponent<DatePickerProps> {
|
||||
/**
|
||||
* @example
|
||||
* ```jsx
|
||||
* <DatePicker.Standalone
|
||||
* dropdownCaption
|
||||
* fromDate={new Date("2020-10-01")}
|
||||
* toDate={new Date("2024-10-01")}
|
||||
* />
|
||||
* ```
|
||||
*/
|
||||
Standalone: DatePickerStandaloneType;
|
||||
Input: DateInputType;
|
||||
/**
|
||||
* Custom TextField for DatePicker
|
||||
* @see 🏷️ {@link DateInputProps}
|
||||
*/
|
||||
Input: React.ForwardRefExoticComponent<
|
||||
DateInputProps & React.RefAttributes<HTMLInputElement>
|
||||
>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that allows users to select a date from a calendar.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/datepicker)
|
||||
* @see 🏷️ {@link DatePickerProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* const { inputProps, datepickerProps } = useMonthpicker({
|
||||
* onMonthChange: console.log,
|
||||
* });
|
||||
*
|
||||
* return (
|
||||
* <DatePicker {...datepickerProps} dropdownCaption>
|
||||
* <DatePicker.Input
|
||||
* {...inputProps}
|
||||
* label="Velg dato"
|
||||
* />
|
||||
* </DatePicker>
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
||||
(
|
||||
{
|
||||
@@ -142,6 +185,7 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
||||
onClose,
|
||||
onOpenToggle,
|
||||
strategy = "absolute",
|
||||
bubbleEscape = false,
|
||||
...rest
|
||||
},
|
||||
ref
|
||||
@@ -213,6 +257,8 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
||||
role="dialog"
|
||||
ref={ref}
|
||||
strategy={strategy}
|
||||
className="navds-date__popover"
|
||||
bubbleEscape={bubbleEscape}
|
||||
>
|
||||
<DayPicker
|
||||
locale={getLocaleFromString(locale)}
|
||||
|
||||
@@ -113,6 +113,19 @@ const getValidationMessage = (val = {}): DateValidationT => ({
|
||||
...val,
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* @see 🏷️ {@link UseDatepickerOptions}
|
||||
* @see 🏷️ {@link UseDatepickerValue}
|
||||
* @see 🏷️ {@link DateValidationT}
|
||||
* @example
|
||||
* const { datepickerProps, inputProps } = useDatepicker({
|
||||
* fromDate: new Date("Aug 23 2019"),
|
||||
* toDate: new Date("Feb 23 2024"),
|
||||
* onDateChange: console.log,
|
||||
* onValidate: console.log,
|
||||
* });
|
||||
*/
|
||||
export const useDatepicker = (
|
||||
opt: UseDatepickerOptions = {}
|
||||
): UseDatepickerValue => {
|
||||
@@ -306,6 +319,7 @@ export const useDatepicker = (
|
||||
onOpenToggle: () => handleOpen(!open),
|
||||
disabled,
|
||||
disableWeekends,
|
||||
bubbleEscape: true,
|
||||
ref: setDaypickerRef,
|
||||
};
|
||||
|
||||
|
||||
@@ -110,6 +110,19 @@ const getIsAfter = (opt: { toDate?: Date; date?: Date }) =>
|
||||
(opt.toDate.getFullYear() === opt.date.getFullYear() &&
|
||||
opt.toDate.getMonth() < opt.date.getMonth()));
|
||||
|
||||
/**
|
||||
*
|
||||
* @see 🏷️ {@link UseMonthPickerOptions}
|
||||
* @see 🏷️ {@link UseMonthPickerValue}
|
||||
* @see 🏷️ {@link MonthValidationT}
|
||||
* @example
|
||||
* const { monthpickerProps, inputProps } = useMonthpicker({
|
||||
* fromDate: new Date("Aug 23 2019"),
|
||||
* toDate: new Date("Feb 23 2024"),
|
||||
* onMonthChange: console.log,
|
||||
* onValidate: console.log,
|
||||
* });
|
||||
*/
|
||||
export const useMonthpicker = (
|
||||
opt: UseMonthPickerOptions = {}
|
||||
): UseMonthPickerValue => {
|
||||
@@ -299,6 +312,7 @@ export const useMonthpicker = (
|
||||
open,
|
||||
onOpenToggle: () => handleOpen(!open),
|
||||
disabled,
|
||||
bubbleEscape: true,
|
||||
ref: setMonthpickerRef,
|
||||
};
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ const RANGE = {
|
||||
TO: "TO",
|
||||
} as const;
|
||||
|
||||
type RangeT = typeof RANGE[keyof typeof RANGE];
|
||||
type RangeT = (typeof RANGE)[keyof typeof RANGE];
|
||||
|
||||
const fromValidation = (day: Date, opt?: UseRangeDatepickerOptions) => {
|
||||
const isBefore =
|
||||
@@ -190,6 +190,18 @@ const initialValidation = (
|
||||
return getValidationMessage({ ...fromVal }, { ...toVal });
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see 🏷️ {@link UseRangeDatepickerOptions}
|
||||
* @see 🏷️ {@link UseRangeDatepickerValue}
|
||||
* @see 🏷️ {@link RangeValidationT}
|
||||
* @example
|
||||
* const { datepickerProps, fromInputProps, toInputProps } = useRangeDatepicker({
|
||||
* fromDate: new Date("Aug 23 2019"),
|
||||
* onRangeChange: console.log,
|
||||
* onValidate: console.log,
|
||||
* });
|
||||
*/
|
||||
export const useRangeDatepicker = (
|
||||
opt: UseRangeDatepickerOptions = {}
|
||||
): UseRangeDatepickerValue => {
|
||||
@@ -532,6 +544,7 @@ export const useRangeDatepicker = (
|
||||
onOpenToggle: () => setOpen((x) => !x),
|
||||
disabled,
|
||||
disableWeekends,
|
||||
bubbleEscape: true,
|
||||
ref: setDaypickerRef,
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import cl from "clsx";
|
||||
import React, { forwardRef, useRef, useState } from "react";
|
||||
import { RootProvider } from "react-day-picker";
|
||||
import { Popover, useId } from "../..";
|
||||
import { DateInputType, MonthPickerInput } from "../DateInput";
|
||||
import { DateInputProps, MonthPickerInput } from "../DateInput";
|
||||
import { DateContext, SharedMonthProvider } from "../context";
|
||||
import { getLocaleFromString, Matcher } from "../utils";
|
||||
import MonthCaption from "./MonthCaption";
|
||||
@@ -86,20 +86,57 @@ export interface MonthPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
* @default "absolute"
|
||||
*/
|
||||
strategy?: "absolute" | "fixed";
|
||||
/**
|
||||
* Bubbles Escape keydown-event up trough DOM-tree. This is set to false by default to prevent closing components like Modal on Escape
|
||||
* @default false
|
||||
*/
|
||||
bubbleEscape?: boolean;
|
||||
}
|
||||
|
||||
interface MonthPickerComponent
|
||||
extends React.ForwardRefExoticComponent<MonthPickerProps> {
|
||||
/**
|
||||
* Variant without popover
|
||||
* @example
|
||||
* ```jsx
|
||||
* <MonthPicker.Standalone
|
||||
* dropdownCaption
|
||||
* fromDate={new Date("1 Oct 2020")}
|
||||
* toDate={new Date("1 Oct 2024")}
|
||||
* />
|
||||
* ```
|
||||
*/
|
||||
Standalone: MonthPickerStandaloneType;
|
||||
/**
|
||||
* Built-in Inputfield
|
||||
* Custom TextField for MonthPicker
|
||||
* @see 🏷️ {@link DateInputProps}
|
||||
*/
|
||||
Input: DateInputType;
|
||||
Input: React.ForwardRefExoticComponent<
|
||||
DateInputProps & React.RefAttributes<HTMLInputElement>
|
||||
>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a month picker.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/monthpicker)
|
||||
* @see 🏷️ {@link MonthPickerProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* const { inputProps, monthpickerProps } = useMonthpicker({
|
||||
* onMonthChange: console.log,
|
||||
* });
|
||||
*
|
||||
* return (
|
||||
* <MonthPicker {...monthpickerProps} dropdownCaption>
|
||||
* <MonthPicker.Input
|
||||
* {...inputProps}
|
||||
* label="Velg måned"
|
||||
* />
|
||||
* </MonthPicker>
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
export const MonthPicker = forwardRef<HTMLDivElement, MonthPickerProps>(
|
||||
(
|
||||
{
|
||||
@@ -121,6 +158,7 @@ export const MonthPicker = forwardRef<HTMLDivElement, MonthPickerProps>(
|
||||
year,
|
||||
onYearChange,
|
||||
strategy = "absolute",
|
||||
bubbleEscape = false,
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
@@ -170,8 +208,9 @@ export const MonthPicker = forwardRef<HTMLDivElement, MonthPickerProps>(
|
||||
role="dialog"
|
||||
ref={ref}
|
||||
id={ariaId}
|
||||
className="navds-date"
|
||||
className="navds-date navds-date__popover"
|
||||
strategy={strategy}
|
||||
bubbleEscape={bubbleEscape}
|
||||
>
|
||||
<RootProvider
|
||||
locale={getLocaleFromString(locale)}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { createContext, useState } from "react";
|
||||
import Toggle, { ToggleType } from "./Toggle";
|
||||
import Toggle, { ToggleProps } from "./Toggle";
|
||||
import Menu, { MenuType } from "./Menu";
|
||||
|
||||
export interface DropdownProps {
|
||||
@@ -24,7 +24,15 @@ export interface DropdownProps {
|
||||
}
|
||||
|
||||
export interface DropdownType extends React.FC<DropdownProps> {
|
||||
Toggle: ToggleType;
|
||||
/**
|
||||
* @see 🏷️ {@link ToggleProps}
|
||||
*/
|
||||
Toggle: React.ForwardRefExoticComponent<
|
||||
ToggleProps & React.RefAttributes<HTMLButtonElement>
|
||||
>;
|
||||
/**
|
||||
* @see 🏷️ {@link MenuType}
|
||||
*/
|
||||
Menu: MenuType;
|
||||
}
|
||||
|
||||
@@ -38,6 +46,37 @@ export interface DropdownContextType {
|
||||
|
||||
export const DropdownContext = createContext<DropdownContextType | null>(null);
|
||||
|
||||
/**
|
||||
* A component that displays a dropdown menu when the user clicks on its toggle button.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/dropdown)
|
||||
* @see 🏷️ {@link DropdownProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <Dropdown>
|
||||
* <Button as={Dropdown.Toggle}>Toggle</Button>
|
||||
* <Dropdown.Menu>
|
||||
* <Dropdown.Menu.GroupedList>
|
||||
* <Dropdown.Menu.GroupedList.Heading>
|
||||
* Systemer og oppslagsverk
|
||||
* </Dropdown.Menu.GroupedList.Heading>
|
||||
* <Dropdown.Menu.GroupedList.Item>
|
||||
* Gosys
|
||||
* </Dropdown.Menu.GroupedList.Item>
|
||||
* <Dropdown.Menu.GroupedList.Item>
|
||||
* Infotrygd
|
||||
* </Dropdown.Menu.GroupedList.Item>
|
||||
* </Dropdown.Menu.GroupedList>
|
||||
* <Dropdown.Menu.Divider />
|
||||
* <Dropdown.Menu.List>
|
||||
* <Dropdown.Menu.List.Item>Gosys</Dropdown.Menu.List.Item>
|
||||
* <Dropdown.Menu.List.Item>Infotrygd</Dropdown.Menu.List.Item>
|
||||
* </Dropdown.Menu.List>
|
||||
* </Dropdown.Menu>
|
||||
* </Dropdown>
|
||||
* ```
|
||||
*/
|
||||
export const Dropdown = (({
|
||||
children,
|
||||
onSelect,
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
import React, { forwardRef } from "react";
|
||||
import cl from "clsx";
|
||||
|
||||
export type DividerType = React.ForwardRefExoticComponent<
|
||||
React.HTMLAttributes<HTMLHRElement> & React.RefAttributes<HTMLHRElement>
|
||||
>;
|
||||
|
||||
export const Divider: DividerType = forwardRef(
|
||||
({ className, ...rest }, ref) => (
|
||||
<hr
|
||||
{...rest}
|
||||
ref={ref}
|
||||
className={cl("navds-dropdown__divider", className)}
|
||||
/>
|
||||
)
|
||||
);
|
||||
export const Divider = forwardRef<
|
||||
HTMLHRElement,
|
||||
React.HTMLAttributes<HTMLHRElement>
|
||||
>(({ className, ...rest }, ref) => (
|
||||
<hr
|
||||
{...rest}
|
||||
ref={ref}
|
||||
className={cl("navds-dropdown__divider", className)}
|
||||
/>
|
||||
));
|
||||
|
||||
export default Divider;
|
||||
@@ -9,23 +9,20 @@ export interface GroupedHeadingProps
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type GroupedHeadingType = React.ForwardRefExoticComponent<
|
||||
GroupedHeadingProps & React.RefAttributes<HTMLElement>
|
||||
>;
|
||||
|
||||
export const GroupedHeading: GroupedHeadingType = forwardRef(
|
||||
({ className, ...rest }, ref) => (
|
||||
<dt
|
||||
{...rest}
|
||||
ref={ref}
|
||||
className={cl(
|
||||
"navds-dropdown__list-heading",
|
||||
"navds-heading",
|
||||
"navds-heading--xsmall",
|
||||
className
|
||||
)}
|
||||
/>
|
||||
)
|
||||
);
|
||||
export const GroupedHeading = forwardRef<
|
||||
HTMLDetailsElement,
|
||||
GroupedHeadingProps
|
||||
>(({ className, ...rest }, ref) => (
|
||||
<dt
|
||||
{...rest}
|
||||
ref={ref}
|
||||
className={cl(
|
||||
"navds-dropdown__list-heading",
|
||||
"navds-heading",
|
||||
"navds-heading--xsmall",
|
||||
className
|
||||
)}
|
||||
/>
|
||||
));
|
||||
|
||||
export default GroupedHeading;
|
||||
@@ -11,35 +11,31 @@ export interface GroupedItemProps
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type GroupedItemType = OverridableComponent<
|
||||
export const GroupedItem: OverridableComponent<
|
||||
GroupedItemProps,
|
||||
HTMLButtonElement
|
||||
>;
|
||||
> = forwardRef(({ as: Component = "button", className, ...rest }, ref) => {
|
||||
const context = useContext(DropdownContext);
|
||||
|
||||
export const GroupedItem: GroupedItemType = forwardRef(
|
||||
({ as: Component = "button", className, ...rest }, ref) => {
|
||||
const context = useContext(DropdownContext);
|
||||
|
||||
return (
|
||||
<dd className="navds-dropdown__list-item">
|
||||
<Component
|
||||
{...rest}
|
||||
value={rest.children}
|
||||
onClick={(event: React.MouseEvent<HTMLElement, MouseEvent>) => {
|
||||
context?.onSelect?.(event);
|
||||
rest?.onClick?.(event);
|
||||
}}
|
||||
ref={ref}
|
||||
className={cl(
|
||||
"navds-dropdown__item",
|
||||
"navds-body-short",
|
||||
"navds-body-short--small",
|
||||
className
|
||||
)}
|
||||
/>
|
||||
</dd>
|
||||
);
|
||||
}
|
||||
);
|
||||
return (
|
||||
<dd className="navds-dropdown__list-item">
|
||||
<Component
|
||||
{...rest}
|
||||
value={rest.children}
|
||||
onClick={(event: React.MouseEvent<HTMLElement, MouseEvent>) => {
|
||||
context?.onSelect?.(event);
|
||||
rest?.onClick?.(event);
|
||||
}}
|
||||
ref={ref}
|
||||
className={cl(
|
||||
"navds-dropdown__item",
|
||||
"navds-body-short",
|
||||
"navds-body-short--small",
|
||||
className
|
||||
)}
|
||||
/>
|
||||
</dd>
|
||||
);
|
||||
});
|
||||
|
||||
export default GroupedItem;
|
||||
@@ -1,7 +1,8 @@
|
||||
import React, { forwardRef } from "react";
|
||||
import cl from "clsx";
|
||||
import GroupedHeading, { GroupedHeadingType } from "./Heading";
|
||||
import GroupedItem, { GroupedItemType } from "./Item";
|
||||
import React, { forwardRef } from "react";
|
||||
import { OverridableComponent } from "../../../util/OverridableComponent";
|
||||
import GroupedHeading, { GroupedHeadingProps } from "./Heading";
|
||||
import GroupedItem, { GroupedItemProps } from "./Item";
|
||||
|
||||
export interface GroupedListProps
|
||||
extends React.HTMLAttributes<HTMLDListElement> {
|
||||
@@ -15,8 +16,17 @@ export interface GroupedListType
|
||||
extends React.ForwardRefExoticComponent<
|
||||
GroupedListProps & React.RefAttributes<HTMLDListElement>
|
||||
> {
|
||||
Heading: GroupedHeadingType;
|
||||
Item: GroupedItemType;
|
||||
/**
|
||||
* @see 🏷️ {@link GroupedHeadingProps}
|
||||
*/
|
||||
Heading: React.ForwardRefExoticComponent<
|
||||
GroupedHeadingProps & React.RefAttributes<HTMLDetailsElement>
|
||||
>;
|
||||
/**
|
||||
* @see 🏷️ {@link GroupedItemProps}
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
*/
|
||||
Item: OverridableComponent<GroupedItemProps, HTMLButtonElement>;
|
||||
}
|
||||
|
||||
export const DescriptionList = forwardRef(
|
||||
|
||||
@@ -10,13 +10,8 @@ export interface ListItemProps extends React.ButtonHTMLAttributes<HTMLElement> {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type ListItemType = OverridableComponent<
|
||||
ListItemProps,
|
||||
HTMLButtonElement
|
||||
>;
|
||||
|
||||
export const ListItem: ListItemType = forwardRef(
|
||||
({ as: Component = "button", className, ...rest }, ref) => {
|
||||
export const ListItem: OverridableComponent<ListItemProps, HTMLButtonElement> =
|
||||
forwardRef(({ as: Component = "button", className, ...rest }, ref) => {
|
||||
const context = useContext(DropdownContext);
|
||||
|
||||
return (
|
||||
@@ -38,7 +33,6 @@ export const ListItem: ListItemType = forwardRef(
|
||||
/>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
export default ListItem;
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { forwardRef } from "react";
|
||||
import cl from "clsx";
|
||||
import ListItem, { ListItemType } from "./Item";
|
||||
import React, { forwardRef } from "react";
|
||||
import { OverridableComponent } from "../../../util/OverridableComponent";
|
||||
import ListItem, { ListItemProps } from "./Item";
|
||||
|
||||
export interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
|
||||
/**
|
||||
@@ -13,7 +14,11 @@ export interface ListType
|
||||
extends React.ForwardRefExoticComponent<
|
||||
ListProps & React.RefAttributes<HTMLUListElement>
|
||||
> {
|
||||
Item: ListItemType;
|
||||
/**
|
||||
* @see 🏷️ {@link ListItemProps}
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
*/
|
||||
Item: OverridableComponent<ListItemProps, HTMLButtonElement>;
|
||||
}
|
||||
|
||||
export const List = forwardRef(({ className, children, ...rest }, ref) => (
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Popover } from "../../popover";
|
||||
import cl from "clsx";
|
||||
import React, { forwardRef, useContext } from "react";
|
||||
import { Popover } from "../../popover";
|
||||
import { DropdownContext } from "../Dropdown";
|
||||
import Divider, { DividerType } from "./Divider";
|
||||
import Divider from "./Divider";
|
||||
import GroupedList, { GroupedListType } from "./GroupedList";
|
||||
import List, { ListType } from "./List";
|
||||
|
||||
@@ -43,9 +43,20 @@ export interface MenuType<Props = MenuProps>
|
||||
extends React.ForwardRefExoticComponent<
|
||||
Props & React.RefAttributes<HTMLDivElement>
|
||||
> {
|
||||
/**
|
||||
* @see 🏷️ {@link ListType}
|
||||
*/
|
||||
List: ListType;
|
||||
/**
|
||||
* @see 🏷️ {@link GroupedListType}
|
||||
*/
|
||||
GroupedList: GroupedListType;
|
||||
Divider: DividerType;
|
||||
/**
|
||||
* @see 🏷️ {@link React.HTMLAttributes<HTMLHRElement>}
|
||||
*/
|
||||
Divider: React.ForwardRefExoticComponent<
|
||||
React.HTMLAttributes<HTMLHRElement> & React.RefAttributes<HTMLHRElement>
|
||||
>;
|
||||
}
|
||||
|
||||
export const Menu = forwardRef<HTMLDivElement, MenuProps>(
|
||||
|
||||
@@ -10,11 +10,7 @@ export interface ToggleProps
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type ToggleType = React.ForwardRefExoticComponent<
|
||||
ToggleProps & React.RefAttributes<HTMLButtonElement>
|
||||
>;
|
||||
|
||||
export const Toggle: ToggleType = forwardRef(
|
||||
export const Toggle = forwardRef<HTMLButtonElement, ToggleProps>(
|
||||
({ className, onClick, ...rest }, ref) => {
|
||||
const context = useContext(DropdownContext);
|
||||
|
||||
|
||||
@@ -1,28 +1,48 @@
|
||||
import cl from "clsx";
|
||||
import React, { createContext, forwardRef, useRef, useState } from "react";
|
||||
import { OverridableComponent } from "../util/OverridableComponent";
|
||||
import ExpansionCardContent, {
|
||||
ExpansionCardContentType,
|
||||
ExpansionCardContentProps,
|
||||
} from "./ExpansionCardContent";
|
||||
import {
|
||||
ExpansionCardDescription,
|
||||
ExpansionCardDescriptionType,
|
||||
ExpansionCardDescriptionProps,
|
||||
} from "./ExpansionCardDescription";
|
||||
import ExpansionCardHeader, {
|
||||
ExpansionCardHeaderType,
|
||||
ExpansionCardHeaderProps,
|
||||
} from "./ExpansionCardHeader";
|
||||
import {
|
||||
ExpansionCardTitle,
|
||||
ExpansionCardTitleType,
|
||||
ExpansionCardTitleProps,
|
||||
} from "./ExpansionCardTitle";
|
||||
|
||||
interface ExpansionCardComponent
|
||||
extends React.ForwardRefExoticComponent<
|
||||
ExpansionCardProps & React.RefAttributes<HTMLDivElement>
|
||||
> {
|
||||
Header: ExpansionCardHeaderType;
|
||||
Title: ExpansionCardTitleType;
|
||||
Description: ExpansionCardDescriptionType;
|
||||
Content: ExpansionCardContentType;
|
||||
/**
|
||||
* @see 🏷️ {@link ExpansionCardHeaderProps}
|
||||
*/
|
||||
Header: React.ForwardRefExoticComponent<
|
||||
ExpansionCardHeaderProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
/**
|
||||
* @see 🏷️ {@link ExpansionCardTitleProps}
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
*/
|
||||
Title: OverridableComponent<ExpansionCardTitleProps, HTMLHeadingElement>;
|
||||
/**
|
||||
* @see 🏷️ {@link ExpansionCardDescriptionProps}
|
||||
*/
|
||||
Description: React.ForwardRefExoticComponent<
|
||||
ExpansionCardDescriptionProps & React.RefAttributes<HTMLParagraphElement>
|
||||
>;
|
||||
/**
|
||||
* @see 🏷️ {@link ExpansionCardContentProps}
|
||||
*/
|
||||
Content: React.ForwardRefExoticComponent<
|
||||
ExpansionCardContentProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
}
|
||||
|
||||
interface ExpansionCardCommonProps
|
||||
@@ -77,6 +97,24 @@ export const ExpansionCardContext = createContext<ExpansionCardContextProps>({
|
||||
export type ExpansionCardProps = ExpansionCardCommonProps &
|
||||
ExpansionCardConditionalProps;
|
||||
|
||||
/**
|
||||
* A component that displays an expandable card.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/expansioncard)
|
||||
* @see 🏷️ {@link ExpansionCardProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <ExpansionCard aria-label="default-demo">
|
||||
* <ExpansionCard.Header>
|
||||
* <ExpansionCard.Title>Utbetaling av sykepenger</ExpansionCard.Title>
|
||||
* </ExpansionCard.Header>
|
||||
* <ExpansionCard.Content>
|
||||
* <Innhold />
|
||||
* </ExpansionCard.Content>
|
||||
* </ExpansionCard>
|
||||
* ```
|
||||
*/
|
||||
export const ExpansionCard = forwardRef<HTMLDivElement, ExpansionCardProps>(
|
||||
(
|
||||
{
|
||||
|
||||
@@ -8,36 +8,33 @@ export interface ExpansionCardContentProps
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type ExpansionCardContentType = React.ForwardRefExoticComponent<
|
||||
ExpansionCardContentProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
const ExpansionCardContent = forwardRef<
|
||||
HTMLDivElement,
|
||||
ExpansionCardContentProps
|
||||
>(({ children, className, ...rest }, ref) => {
|
||||
const panelContext = useContext(ExpansionCardContext);
|
||||
|
||||
const ExpansionCardContent: ExpansionCardContentType = forwardRef(
|
||||
({ children, className, ...rest }, ref) => {
|
||||
const panelContext = useContext(ExpansionCardContext);
|
||||
|
||||
if (panelContext === null) {
|
||||
console.error(
|
||||
"<ExpansionCard.Content> has to be used within an <ExpansionCard>"
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<BodyLong
|
||||
{...rest}
|
||||
ref={ref}
|
||||
as="div"
|
||||
className={cl("navds-expansioncard__content", className, {
|
||||
"navds-expansioncard__content--closed": !panelContext.open,
|
||||
})}
|
||||
aria-hidden={!panelContext.open}
|
||||
size={panelContext.size}
|
||||
>
|
||||
<div className="navds-expansioncard__content-inner">{children}</div>
|
||||
</BodyLong>
|
||||
if (panelContext === null) {
|
||||
console.error(
|
||||
"<ExpansionCard.Content> has to be used within an <ExpansionCard>"
|
||||
);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<BodyLong
|
||||
{...rest}
|
||||
ref={ref}
|
||||
as="div"
|
||||
className={cl("navds-expansioncard__content", className, {
|
||||
"navds-expansioncard__content--closed": !panelContext.open,
|
||||
})}
|
||||
aria-hidden={!panelContext.open}
|
||||
size={panelContext.size}
|
||||
>
|
||||
<div className="navds-expansioncard__content-inner">{children}</div>
|
||||
</BodyLong>
|
||||
);
|
||||
});
|
||||
|
||||
export default ExpansionCardContent;
|
||||
@@ -3,33 +3,31 @@ import cl from "clsx";
|
||||
import { BodyLong } from "../typography/BodyLong";
|
||||
import { ExpansionCardContext } from "./ExpansionCard";
|
||||
|
||||
interface ExpansionCardDescriptionProps
|
||||
export interface ExpansionCardDescriptionProps
|
||||
extends React.HTMLAttributes<HTMLParagraphElement> {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type ExpansionCardDescriptionType = React.ForwardRefExoticComponent<
|
||||
ExpansionCardDescriptionProps & React.RefAttributes<HTMLParagraphElement>
|
||||
>;
|
||||
export const ExpansionCardDescription = forwardRef<
|
||||
HTMLParagraphElement,
|
||||
ExpansionCardDescriptionProps
|
||||
>(({ className, ...rest }, ref) => {
|
||||
const panelContext = useContext(ExpansionCardContext);
|
||||
|
||||
export const ExpansionCardDescription: ExpansionCardDescriptionType =
|
||||
forwardRef(({ className, ...rest }, ref) => {
|
||||
const panelContext = useContext(ExpansionCardContext);
|
||||
|
||||
if (panelContext === null) {
|
||||
console.error(
|
||||
"<ExpansionCard.Description> has to be used within an <ExpansionCard>"
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<BodyLong
|
||||
{...rest}
|
||||
as="p"
|
||||
ref={ref}
|
||||
className={cl("navds-link-panel__description", className)}
|
||||
size={panelContext.size}
|
||||
/>
|
||||
if (panelContext === null) {
|
||||
console.error(
|
||||
"<ExpansionCard.Description> has to be used within an <ExpansionCard>"
|
||||
);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<BodyLong
|
||||
{...rest}
|
||||
as="p"
|
||||
ref={ref}
|
||||
className={cl("navds-link-panel__description", className)}
|
||||
size={panelContext.size}
|
||||
/>
|
||||
);
|
||||
});
|
||||
@@ -8,43 +8,40 @@ export interface ExpansionCardHeaderProps
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type ExpansionCardHeaderType = React.ForwardRefExoticComponent<
|
||||
ExpansionCardHeaderProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
const ExpansionCardHeader = forwardRef<
|
||||
HTMLDivElement,
|
||||
ExpansionCardHeaderProps
|
||||
>(({ children, className, ...rest }, ref) => {
|
||||
const panelContext = useContext(ExpansionCardContext);
|
||||
|
||||
const ExpansionCardHeader: ExpansionCardHeaderType = forwardRef(
|
||||
({ children, className, ...rest }, ref) => {
|
||||
const panelContext = useContext(ExpansionCardContext);
|
||||
|
||||
if (panelContext === null) {
|
||||
console.error(
|
||||
"<ExpansionCard.Header> has to be used within an <ExpansionCard>"
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
{...rest}
|
||||
className={cl("navds-expansioncard__header", className)}
|
||||
>
|
||||
<div className="navds-expansioncard__header-content">{children}</div>
|
||||
|
||||
<button
|
||||
className="navds-expansioncard__header-button"
|
||||
onClick={() => panelContext.toggleOpen()}
|
||||
type="button"
|
||||
aria-expanded={panelContext.open}
|
||||
>
|
||||
<ChevronDownIcon
|
||||
className="navds-expansioncard__header-chevron"
|
||||
title="Vis mer"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
if (panelContext === null) {
|
||||
console.error(
|
||||
"<ExpansionCard.Header> has to be used within an <ExpansionCard>"
|
||||
);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
{...rest}
|
||||
className={cl("navds-expansioncard__header", className)}
|
||||
>
|
||||
<div className="navds-expansioncard__header-content">{children}</div>
|
||||
|
||||
<button
|
||||
className="navds-expansioncard__header-button"
|
||||
onClick={() => panelContext.toggleOpen()}
|
||||
type="button"
|
||||
aria-expanded={panelContext.open}
|
||||
>
|
||||
<ChevronDownIcon
|
||||
className="navds-expansioncard__header-chevron"
|
||||
title="Vis mer"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default ExpansionCardHeader;
|
||||
@@ -2,7 +2,7 @@ import React, { forwardRef } from "react";
|
||||
import cl from "clsx";
|
||||
import { OverridableComponent } from "../util/OverridableComponent";
|
||||
|
||||
interface ExpansionCardTitleProps
|
||||
export interface ExpansionCardTitleProps
|
||||
extends React.HTMLAttributes<HTMLHeadingElement> {
|
||||
children: React.ReactNode;
|
||||
/**
|
||||
@@ -12,12 +12,10 @@ interface ExpansionCardTitleProps
|
||||
size?: "large" | "medium" | "small";
|
||||
}
|
||||
|
||||
export type ExpansionCardTitleType = OverridableComponent<
|
||||
export const ExpansionCardTitle: OverridableComponent<
|
||||
ExpansionCardTitleProps,
|
||||
HTMLHeadingElement
|
||||
>;
|
||||
|
||||
export const ExpansionCardTitle: ExpansionCardTitleType = forwardRef(
|
||||
> = forwardRef(
|
||||
({ className, as: Component = "h3", size = "medium", ...rest }, ref) => (
|
||||
<Component
|
||||
{...rest}
|
||||
|
||||
@@ -26,6 +26,24 @@ export interface ConfirmationPanelProps
|
||||
errorId?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a confirmation checkbox with a label.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/confirmationpanel)
|
||||
* @see 🏷️ {@link ConfirmationPanelProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
<ConfirmationPanel
|
||||
checked={state}
|
||||
label="Ja, jeg samtykker."
|
||||
onChange={() => setState((x) => !x)}
|
||||
>
|
||||
For å komme videre må du gi oss lov til å hente inn og bruke opplysninger
|
||||
om deg.
|
||||
</ConfirmationPanel>
|
||||
* ```
|
||||
*/
|
||||
export const ConfirmationPanel = forwardRef<
|
||||
HTMLInputElement,
|
||||
ConfirmationPanelProps
|
||||
|
||||
@@ -30,6 +30,22 @@ export interface SelectProps
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a select input field.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/select)
|
||||
* @see 🏷️ {@link SelectProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <Select label="Hvilket land har du bosted i.">
|
||||
* <option value="">Velg land</option>
|
||||
* <option value="norge">Norge</option>
|
||||
* <option value="sverige">Sverige</option>
|
||||
* <option value="danmark">Danmark</option>
|
||||
* </Select>
|
||||
* ```
|
||||
*/
|
||||
export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
||||
(props, ref) => {
|
||||
const {
|
||||
|
||||
@@ -55,6 +55,17 @@ export interface SwitchProps
|
||||
description?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a switch input field.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/switch)
|
||||
* @see 🏷️ {@link SwitchProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <Switch>Slå på notifikasjoner</Switch>
|
||||
* ```
|
||||
*/
|
||||
export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
||||
(props, ref) => {
|
||||
const { inputProps, size } = useFormField(props, "switch");
|
||||
|
||||
@@ -33,6 +33,17 @@ export interface TextFieldProps
|
||||
type?: "email" | "number" | "password" | "tel" | "text" | "url";
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a text input field with a label.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/textfield)
|
||||
* @see 🏷️ {@link TextFieldProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <TextField label="Har du noen tilbakemeldinger?" />
|
||||
* ```
|
||||
*/
|
||||
export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
||||
(props, ref) => {
|
||||
const {
|
||||
|
||||
@@ -55,6 +55,17 @@ export interface TextareaProps
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a textarea input field with a label.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/textarea)
|
||||
* @see 🏷️ {@link TextareaProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <Textarea label="Har du noen tilbakemeldinger?" />
|
||||
* ```
|
||||
*/
|
||||
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
(props, ref) => {
|
||||
const {
|
||||
@@ -192,8 +203,8 @@ export const Counter = ({ maxLength, currentLength, size, i18n }) => {
|
||||
size={size}
|
||||
>
|
||||
{difference < 0
|
||||
? `${Math.abs(difference)} ${i18n?.counterLeft ?? "tegn for mye"}`
|
||||
: `${difference} ${i18n?.counterTooMuch ?? "tegn igjen"}`}
|
||||
? `${Math.abs(difference)} ${i18n?.counterTooMuch ?? "tegn for mye"}`
|
||||
: `${difference} ${i18n?.counterLeft ?? "tegn igjen"}`}
|
||||
</BodyShort>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -35,6 +35,21 @@ export interface CheckboxGroupProps
|
||||
onChange?: (value: any[]) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that allows users to select one or more options from a list.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/checkbox)
|
||||
* @see 🏷️ {@link CheckboxProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <CheckboxGroup legend="Hvor vil du sitte?">
|
||||
* <Checkbox value="Bakerst">Bakerst</Checkbox>
|
||||
* <Checkbox value="Midterst">Midterst</Checkbox>
|
||||
* <Checkbox value="Fremst">Fremst</Checkbox>
|
||||
* </CheckboxGroup>
|
||||
* ```
|
||||
*/
|
||||
export const CheckboxGroup = forwardRef<
|
||||
HTMLFieldSetElement,
|
||||
CheckboxGroupProps
|
||||
|
||||
@@ -29,9 +29,39 @@ interface ErrorSummaryComponent
|
||||
extends React.ForwardRefExoticComponent<
|
||||
ErrorSummaryProps & React.RefAttributes<HTMLDivElement>
|
||||
> {
|
||||
/**
|
||||
* Link to error
|
||||
*
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <ErrorSummary.Item href="#1">
|
||||
* Felt må fylles ut med alder
|
||||
* </ErrorSummary.Item>
|
||||
* ```
|
||||
*/
|
||||
Item: ErrorSummaryItemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a summary of errors.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/errorsummary)
|
||||
* @see 🏷️ {@link ErrorSummaryProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <ErrorSummary heading="Du må fikse disse feilene før du kan sende inn søknad.">
|
||||
* <ErrorSummary.Item href="#1">
|
||||
* Felt må fylles ut med alder
|
||||
* </ErrorSummary.Item>
|
||||
* <ErrorSummary.Item href="#2">
|
||||
* Tekstfeltet må ha en godkjent e-mail
|
||||
* </ErrorSummary.Item>
|
||||
* </ErrorSummary>
|
||||
* ```
|
||||
*/
|
||||
export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
|
||||
(
|
||||
{
|
||||
|
||||
@@ -8,6 +8,10 @@ export interface ErrorSummaryItemProps
|
||||
* Link text
|
||||
*/
|
||||
children: React.ReactNode;
|
||||
/**
|
||||
* Link to errormessage
|
||||
*/
|
||||
href?: string;
|
||||
}
|
||||
|
||||
export type ErrorSummaryItemType = OverridableComponent<
|
||||
|
||||
@@ -47,8 +47,8 @@ export interface RadioGroupProps
|
||||
|
||||
/**
|
||||
* Form radio group
|
||||
* @see https://aksel.nav.no/komponenter/core/radio
|
||||
* @see {@link RadioGroupProps}
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/radio)
|
||||
* @see 🏷️ {@link RadioGroupProps}
|
||||
* @example
|
||||
* <RadioGroup legend="Får du AAP nå?">
|
||||
* <Radio value="ja">Ja</Radio>
|
||||
|
||||
@@ -91,6 +91,19 @@ export const SearchContext = React.createContext<SearchContextProps | null>(
|
||||
null
|
||||
);
|
||||
|
||||
/**
|
||||
* A component that displays a search input field.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/search)
|
||||
* @see 🏷️ {@link SearchProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <form>
|
||||
* <Search label="Søk alle NAV sine sider" variant="primary" />
|
||||
* </form>
|
||||
* ```
|
||||
*/
|
||||
export const Search = forwardRef<HTMLInputElement, SearchProps>(
|
||||
(props, ref) => {
|
||||
const {
|
||||
|
||||
@@ -18,6 +18,21 @@ export interface GuidePanelProps extends HTMLAttributes<HTMLDivElement> {
|
||||
poster?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a guide panel.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/guidepanel)
|
||||
* @see 🏷️ {@link GuidePanelProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <GuidePanel>
|
||||
* Saksbehandlingstiden varierer fra kommune til kommune. Hvis det går mer
|
||||
* enn X måneder siden du søkte, skal du få brev om at saksbehandlingstiden
|
||||
* er forlenget.
|
||||
* </GuidePanel>
|
||||
* ```
|
||||
*/
|
||||
export const GuidePanel = forwardRef<HTMLDivElement, GuidePanelProps>(
|
||||
(
|
||||
{ children, className, illustration, poster = false, color, ...rest },
|
||||
|
||||
@@ -29,8 +29,25 @@ export interface HelpTextProps
|
||||
| "right-end"
|
||||
| "left-start"
|
||||
| "left-end";
|
||||
/**
|
||||
* Classname for wrapper
|
||||
*/
|
||||
wrapperClassName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a help text button with a popover.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/helptext)
|
||||
* @see 🏷️ {@link HelpTextProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <HelpText title="Hvor kommer dette fra?">
|
||||
* Informasjonen er hentet fra X sin statistikk fra 2021
|
||||
* </HelpText>
|
||||
* ```
|
||||
*/
|
||||
export const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
|
||||
(
|
||||
{
|
||||
@@ -40,6 +57,7 @@ export const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
|
||||
strategy = "absolute",
|
||||
title = "hjelp",
|
||||
onClick,
|
||||
wrapperClassName,
|
||||
...rest
|
||||
},
|
||||
ref
|
||||
@@ -49,7 +67,7 @@ export const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="navds-help-text">
|
||||
<div className={cl("navds-help-text", wrapperClassName)}>
|
||||
<button
|
||||
{...rest}
|
||||
ref={mergedRef}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { HelpText } from "..";
|
||||
import { BodyLong, Heading, HelpText } from "..";
|
||||
|
||||
export default {
|
||||
title: "ds-react/HelpText",
|
||||
@@ -65,3 +65,36 @@ export const Open = () => {
|
||||
</HelpText>
|
||||
);
|
||||
};
|
||||
|
||||
export const WrapperClassName = {
|
||||
render: () => {
|
||||
return (
|
||||
<div>
|
||||
<BodyLong spacing>
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta
|
||||
perspiciatis vero voluptatum, asperiores cumque, deserunt accusantium
|
||||
ullam ipsa accusamus officia cupiditate quae unde esse culpa, ratione
|
||||
ab quam ea quas?
|
||||
</BodyLong>
|
||||
|
||||
<Heading level="2" size="medium">
|
||||
67 år og 1 måneder øklasdjkl askdak døkasøk daøkdkølasøkld asølkdøka
|
||||
<HelpText wrapperClassName="testClass">
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta
|
||||
perspiciatis vero voluptatum, asperiores cumque, deserunt
|
||||
accusantium ullam ipsa accusamus officia cupiditate quae unde esse
|
||||
culpa, ratione ab quam ea quas?
|
||||
</HelpText>
|
||||
<style>{`.testClass {display: inline-block; margin-left: 0.5rem; vertical-align: middle;}`}</style>
|
||||
</Heading>
|
||||
|
||||
<BodyLong spacing>
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta
|
||||
perspiciatis vero voluptatum, asperiores cumque, deserunt accusantium
|
||||
ullam ipsa accusamus officia cupiditate quae unde esse culpa, ratione
|
||||
ab quam ea quas?
|
||||
</BodyLong>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -22,6 +22,7 @@ export * from "./panel";
|
||||
export * from "./popover";
|
||||
export * from "./provider";
|
||||
export * from "./read-more";
|
||||
export * from "./skeleton";
|
||||
export * from "./stepper";
|
||||
export * from "./table";
|
||||
export * from "./tabs";
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import cl from "clsx";
|
||||
import React, { forwardRef, HTMLAttributes } from "react";
|
||||
import { OverridableComponent } from "../util/OverridableComponent";
|
||||
import InternalHeaderButton, {
|
||||
InternalHeaderButtonProps,
|
||||
} from "./InternalHeaderButton";
|
||||
import InternalHeaderTitle, {
|
||||
InternalHeaderTitleType,
|
||||
InternalHeaderTitleProps,
|
||||
} from "./InternalHeaderTitle";
|
||||
import InternalHeaderUser, {
|
||||
InternalHeaderUserType,
|
||||
InternalHeaderUserProps,
|
||||
} from "./InternalHeaderUser";
|
||||
import InternalHeaderButton, {
|
||||
InternalHeaderButtonType,
|
||||
} from "./InternalHeaderButton";
|
||||
import InternalHeaderUserButton, {
|
||||
InternalHeaderUserButtonType,
|
||||
InternalHeaderUserButtonProps,
|
||||
} from "./InternalHeaderUserButton";
|
||||
import cl from "clsx";
|
||||
|
||||
export interface InternalHeaderProps extends HTMLAttributes<HTMLElement> {
|
||||
children: React.ReactNode;
|
||||
@@ -21,12 +22,60 @@ interface InternalHeaderComponent
|
||||
extends React.ForwardRefExoticComponent<
|
||||
InternalHeaderProps & React.RefAttributes<HTMLElement>
|
||||
> {
|
||||
Title: InternalHeaderTitleType;
|
||||
User: InternalHeaderUserType;
|
||||
Button: InternalHeaderButtonType;
|
||||
UserButton: InternalHeaderUserButtonType;
|
||||
/**
|
||||
* @see 🏷️ {@link InternalHeaderTitleProps}
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
*/
|
||||
Title: OverridableComponent<InternalHeaderTitleProps, HTMLAnchorElement>;
|
||||
/**
|
||||
* @see 🏷️ {@link InternalHeaderUserProps}
|
||||
*/
|
||||
User: React.ForwardRefExoticComponent<
|
||||
InternalHeaderUserProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
/**
|
||||
* @see 🏷️ {@link InternalHeaderButtonProps}
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
*/
|
||||
Button: OverridableComponent<InternalHeaderButtonProps, HTMLButtonElement>;
|
||||
/**
|
||||
* @see 🏷️ {@link InternalHeaderUserButtonProps}
|
||||
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
||||
*/
|
||||
UserButton: OverridableComponent<
|
||||
InternalHeaderUserButtonProps,
|
||||
HTMLButtonElement
|
||||
>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple Header for internal pages and systems.
|
||||
*
|
||||
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/i-header)
|
||||
* @see 🏷️ {@link InternalHeaderProps}
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* <InternalHeader>
|
||||
* <InternalHeader.Title as="h1">Sykepenger</InternalHeader.Title>
|
||||
* <InternalHeader.User name="Ola Normann" className="ml-auto" />
|
||||
* </InternalHeader>
|
||||
* ```
|
||||
* @example
|
||||
* ```jsx
|
||||
* <InternalHeader >
|
||||
* <InternalHeader.Title href="/#home">Tittel med lenke</InternalHeader.Title>
|
||||
* <Dropdown>
|
||||
* <InternalHeader.Button
|
||||
* as={Dropdown.Toggle}
|
||||
* >
|
||||
* <MenuGridIcon title="MenuGridIconer og oppslagsverk" />
|
||||
* </InternalHeader.Button>
|
||||
* <Dropdown.Menu />
|
||||
* </Dropdown>
|
||||
* </InternalHeader>
|
||||
* ```
|
||||
*/
|
||||
export const InternalHeader = forwardRef(({ className, ...rest }, ref) => (
|
||||
<header
|
||||
data-theme="dark"
|
||||
|
||||
@@ -9,20 +9,15 @@ export interface InternalHeaderButtonProps
|
||||
*/
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type InternalHeaderButtonType = OverridableComponent<
|
||||
export const InternalHeaderButton: OverridableComponent<
|
||||
InternalHeaderButtonProps,
|
||||
HTMLButtonElement
|
||||
>;
|
||||
|
||||
export const InternalHeaderButton: InternalHeaderButtonType = forwardRef(
|
||||
({ as: Component = "button", className, ...rest }, ref) => (
|
||||
<Component
|
||||
{...rest}
|
||||
ref={ref}
|
||||
className={cl("navds-internalheader__button", className)}
|
||||
/>
|
||||
)
|
||||
);
|
||||
> = forwardRef(({ as: Component = "button", className, ...rest }, ref) => (
|
||||
<Component
|
||||
{...rest}
|
||||
ref={ref}
|
||||
className={cl("navds-internalheader__button", className)}
|
||||
/>
|
||||
));
|
||||
|
||||
export default InternalHeaderButton;
|
||||
@@ -10,26 +10,18 @@ export interface InternalHeaderTitleProps
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export type InternalHeaderTitleType = OverridableComponent<
|
||||
export const InternalHeaderTitle: OverridableComponent<
|
||||
InternalHeaderTitleProps,
|
||||
HTMLAnchorElement
|
||||
>;
|
||||
|
||||
export const InternalHeaderTitle: InternalHeaderTitleType = forwardRef(
|
||||
({ as: Component = "a", children, className, ...rest }, ref) => (
|
||||
<Component
|
||||
{...rest}
|
||||
ref={ref}
|
||||
size="xsmall"
|
||||
className={cl(
|
||||
"navds-internalheader__title",
|
||||
"navds-body-short",
|
||||
className
|
||||
)}
|
||||
>
|
||||
<span>{children}</span>
|
||||
</Component>
|
||||
)
|
||||
);
|
||||
> = forwardRef(({ as: Component = "a", children, className, ...rest }, ref) => (
|
||||
<Component
|
||||
{...rest}
|
||||
ref={ref}
|
||||
size="xsmall"
|
||||
className={cl("navds-internalheader__title", "navds-body-short", className)}
|
||||
>
|
||||
<span>{children}</span>
|
||||
</Component>
|
||||
));
|
||||
|
||||
export default InternalHeaderTitle;
|
||||
@@ -14,10 +14,6 @@ export interface InternalHeaderUserProps
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export type InternalHeaderUserType = React.ForwardRefExoticComponent<
|
||||
InternalHeaderUserProps & React.RefAttributes<HTMLDivElement>
|
||||
>;
|
||||
|
||||
export const InternalHeaderUser = forwardRef<
|
||||
HTMLDivElement,
|
||||
InternalHeaderUserProps
|
||||
|
||||
@@ -17,27 +17,24 @@ export interface InternalHeaderUserButtonProps
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export type InternalHeaderUserButtonType = OverridableComponent<
|
||||
export const InternalHeaderUserButton: OverridableComponent<
|
||||
InternalHeaderUserButtonProps,
|
||||
HTMLButtonElement
|
||||
>;
|
||||
|
||||
export const InternalHeaderUserButton: InternalHeaderUserButtonType =
|
||||
forwardRef(({ as, name, description, className, ...rest }, ref) => (
|
||||
<InternalHeaderButton
|
||||
{...rest}
|
||||
as={as}
|
||||
ref={ref}
|
||||
className={cl("navds-internalheader__user-button", className)}
|
||||
>
|
||||
<div>
|
||||
<BodyShort size="small" as="div">
|
||||
{name}
|
||||
</BodyShort>
|
||||
{description && <Detail as="div">{description}</Detail>}
|
||||
</div>
|
||||
<ChevronDownIcon title="vis meny" />
|
||||
</InternalHeaderButton>
|
||||
));
|
||||
> = forwardRef(({ as, name, description, className, ...rest }, ref) => (
|
||||
<InternalHeaderButton
|
||||
{...rest}
|
||||
as={as}
|
||||
ref={ref}
|
||||
className={cl("navds-internalheader__user-button", className)}
|
||||
>
|
||||
<div>
|
||||
<BodyShort size="small" as="div">
|
||||
{name}
|
||||
</BodyShort>
|
||||
{description && <Detail as="div">{description}</Detail>}
|
||||
</div>
|
||||
<ChevronDownIcon title="vis meny" />
|
||||
</InternalHeaderButton>
|
||||
));
|
||||
|
||||
export default InternalHeaderUserButton;
|
||||
Loaded 100 of 334 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user