Compare commits

...
Author SHA1 Message Date
github-actions[bot]andgithub-actions[bot] 46af5defd9 Version Packages (#2001)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-24 15:32:35 +02:00
Ken 30eee0dac4 🐛 Fikset htmlSize-prop for <Search /> (#2000) 2023-05-24 14:36:34 +02:00
Ken 76b3a65572 Update README.md 2023-05-23 12:39:10 +02:00
github-actions[bot]andgithub-actions[bot] cb7a78e20c Version Packages (#1999)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-22 16:43:10 +02:00
Ken 475e994f49 🐛 DatepickerInput button refactor (#1993) 2023-05-22 16:36:33 +02:00
Ken 53c98181c3 🎨 Oppdatert ikoner (#1998) 2023-05-22 16:34:49 +02:00
Ken 444e905e01 🎨 xsmall variant for CopyButton (#1994) 2023-05-22 16:29:25 +02:00
Ken b7a97339f8 🚚 Flyttet Hva er aksel under 'Om nettstedet' i footer 2023-05-22 10:51:35 +02:00
Ken 1ac0f25420 ⬆️ Oppdatert sanity (#1992) 2023-05-22 09:09:11 +02:00
github-actions[bot]andgithub-actions[bot] 29ddcd59e7 Version Packages (#1990)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-19 09:47:18 +02:00
Ken 6d6267fe01 🔥 Fjernet use-client directive fra copybutton 2023-05-19 09:43:37 +02:00
Ken ee38a55837 🐛 Fikset tekst i internal-header 2023-05-16 14:22:30 +02:00
Ken b86ccc4f7f 🐛 Fikset aksel-eksempler 2023-05-16 13:24:02 +02:00
github-actions[bot]andgithub-actions[bot] 9a98f0eae4 Version Packages (#1988)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-16 13:13:56 +02:00
Ken affcab14c3 ✨ Copybutton-komponent (#1982) 2023-05-16 12:56:16 +02:00
Ken d51b0238d5 💄 Oppdatert ToggleGroup-bruk på ikonsider 2023-05-12 12:58:22 +02:00
github-actions[bot]andgithub-actions[bot] c818a92355 Version Packages (#1977)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-11 15:57:52 +02:00
Ken e8ecf309a9 💄 Oppdatert ToggleGroup (#1976) 2023-05-11 15:55:30 +02:00
Ken 060d4f3c7c 📝 Bedre props-dokumentasjon for ExpansionCard 2023-05-11 12:35:10 +02:00
github-actions[bot]andgithub-actions[bot] 1871038837 Version Packages (#1974)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-10 22:19:00 +02:00
Ken 5e79234eff 🐛 Timeline pin var ikke riktig alignet 2023-05-10 16:03:09 +02:00
github-actions[bot]andgithub-actions[bot] b8bebace11 Version Packages (#1971)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-10 14:10:55 +02:00
Ken 14379a02c3 🐛 Timeline håndterte ikke SVG-ikoner riktig 2023-05-10 13:56:20 +02:00
108 changed files with 2411 additions and 419 deletions

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@ module.exports = {
addons: [
"@storybook/addon-a11y",
"@whitespace/storybook-addon-html",
"@storybook/addon-interactions",
{
name: "@storybook/addon-storysource",
options: {
+23
View File
@@ -1,5 +1,28 @@
# @navikt/aksel-icons
## 3.2.4
## 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
+1 -1
View File
@@ -15,5 +15,5 @@ keywords:
- skråning
- helning
variant: Stroke
updated_at: 08.03.2023
updated_at: 22.05.2023
created_at: 07.03.2023
@@ -11,5 +11,5 @@ keywords:
- handel
- økonomi
variant: Stroke
updated_at: 08.03.2023
updated_at: 16.05.2023
created_at: 07.03.2023
+1 -1
View File
@@ -7,5 +7,5 @@ keywords:
- lukket
- hidden
variant: Stroke
updated_at: 08.03.2023
updated_at: 05.05.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="M6.75 4.75V19.25H17.25V8.75H14.5C13.8096 8.75 13.25 8.19036 13.25 7.5V4.75H6.75ZM14.75 5.81066L16.1893 7.25H14.75V5.81066ZM5.25 4.5C5.25 3.80964 5.80964 3.25 6.5 3.25H14C14.1989 3.25 14.3897 3.32902 14.5303 3.46967L18.5303 7.46967C18.671 7.61032 18.75 7.80109 18.75 8V19.5C18.75 20.1904 18.1904 20.75 17.5 20.75H6.5C5.80964 20.75 5.25 20.1904 5.25 19.5V4.5ZM9.96599 11.0256C9.96599 9.906 10.8749 9 11.9927 9C12.5664 9 13.0857 9.23917 13.4539 9.62112C13.7414 9.91932 13.7327 10.3941 13.4345 10.6816C13.1363 10.9691 12.6615 10.9604 12.3741 10.6622C12.2767 10.5613 12.1424 10.5 11.9927 10.5C11.7016 10.5 11.466 10.7362 11.466 11.0256C11.466 11.2386 11.5945 11.4305 11.7915 11.5116L13.7023 12.2984C14.5828 12.661 15.039 13.6373 14.7523 14.5454C14.6107 14.9939 14.3133 15.3485 13.9395 15.57C13.9933 15.7527 14.0218 15.9449 14.0218 16.1418C14.0218 17.2614 13.1128 18.1674 11.995 18.1674C11.0546 18.1674 10.264 17.5278 10.0337 16.6602C9.92739 16.2599 10.1658 15.8492 10.5661 15.7429C10.9665 15.6366 11.3772 15.875 11.4835 16.2753C11.5434 16.5012 11.7509 16.6674 11.995 16.6674C12.2862 16.6674 12.5218 16.4312 12.5218 16.1418C12.5218 15.9288 12.3932 15.7369 12.1963 15.6558L10.2855 14.869C9.40497 14.5065 8.9487 13.5301 9.23544 12.6221C9.37709 12.1735 9.67447 11.8189 10.0483 11.5974C9.99448 11.4147 9.96599 11.2225 9.96599 11.0256ZM10.8566 13.482L12.6473 14.2194C12.6562 14.2222 12.6651 14.2252 12.6739 14.2284L12.8915 14.3067C13.0695 14.3708 13.265 14.274 13.3219 14.0937C13.374 13.9287 13.2911 13.7513 13.1311 13.6854L11.3404 12.9481C11.3315 12.9452 11.3227 12.9422 11.3138 12.939L11.0962 12.8607C10.9183 12.7966 10.7228 12.8934 10.6658 13.0738C10.6137 13.2387 10.6966 13.4161 10.8566 13.482Z" fill="#262626"/>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,17 @@
name: FileParagraph
category: Files and application
sub_category: Files
keywords:
- document
- dokument
- fil
- file
- error
- feil
- feilmelding
- corrupt
- bad file
- korrupt fil
variant: Stroke
updated_at: 22.05.2023
created_at: 22.05.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="M13.25 7.5V3.5C13.25 3.36193 13.1381 3.25 13 3.25H6.5C5.80964 3.25 5.25 3.80964 5.25 4.5V19.5C5.25 20.1904 5.80964 20.75 6.5 20.75H17.5C18.1904 20.75 18.75 20.1904 18.75 19.5V9C18.75 8.86193 18.6381 8.75 18.5 8.75H14.5C13.8096 8.75 13.25 8.19036 13.25 7.5ZM15 7.25C14.8619 7.25 14.75 7.13807 14.75 7V4.29289C14.75 4.07017 15.0193 3.95863 15.1768 4.11612L17.8839 6.82322C18.0414 6.98071 17.9298 7.25 17.7071 7.25H15ZM9.96599 11.0256C9.96599 9.906 10.8749 9 11.9927 9C12.5664 9 13.0857 9.23917 13.4539 9.62112C13.7414 9.91932 13.7327 10.3941 13.4345 10.6816C13.1363 10.9691 12.6615 10.9604 12.3741 10.6622C12.2767 10.5613 12.1424 10.5 11.9927 10.5C11.7016 10.5 11.466 10.7362 11.466 11.0256C11.466 11.2386 11.5945 11.4305 11.7915 11.5116L13.7023 12.2984C14.5828 12.661 15.039 13.6373 14.7523 14.5454C14.6318 14.927 14.3985 15.2407 14.1012 15.4622C14.0095 15.5306 13.9637 15.6466 13.9853 15.7589C14.0093 15.8836 14.0218 16.0117 14.0218 16.1418C14.0218 17.2614 13.1128 18.1674 11.995 18.1674C11.0546 18.1674 10.264 17.5278 10.0337 16.6602C9.92739 16.2599 10.1658 15.8492 10.5661 15.7429C10.9665 15.6366 11.3772 15.875 11.4835 16.2753C11.5434 16.5012 11.7509 16.6674 11.995 16.6674C12.2862 16.6674 12.5218 16.4312 12.5218 16.1418C12.5218 15.9288 12.3932 15.7369 12.1963 15.6558L10.2855 14.869C9.40497 14.5065 8.9487 13.5301 9.23544 12.6221C9.35598 12.2404 9.58928 11.9267 9.8865 11.7052C9.97822 11.6368 10.024 11.5208 10.0024 11.4085C9.97844 11.2838 9.96599 11.1557 9.96599 11.0256ZM10.8566 13.482L12.6473 14.2194C12.6562 14.2222 12.6651 14.2252 12.6739 14.2284L12.8915 14.3067C13.0695 14.3708 13.265 14.274 13.3219 14.0937C13.374 13.9287 13.2911 13.7513 13.1311 13.6854L11.3404 12.9481C11.3315 12.9452 11.3227 12.9422 11.3138 12.939L11.0962 12.8607C10.9183 12.7966 10.7228 12.8934 10.6658 13.0738C10.6137 13.2387 10.6966 13.4161 10.8566 13.482Z" fill="#262626"/>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -0,0 +1,17 @@
name: FileParagraphFill
category: Files and application
sub_category: Files
keywords:
- document
- dokument
- fil
- file
- error
- feil
- feilmelding
- corrupt
- bad file
- korrupt fil
variant: Fill
updated_at: 22.05.2023
created_at: 22.05.2023
+3
View File
@@ -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="M6.75 19.25V4.75H13.25V7.5C13.25 8.19036 13.8096 8.75 14.5 8.75H17.25V19.25H6.75ZM16.1893 7.25L14.75 5.81066V7.25H16.1893ZM6.5 3.25C5.80964 3.25 5.25 3.80964 5.25 4.5V19.5C5.25 20.1904 5.80964 20.75 6.5 20.75H17.5C18.1904 20.75 18.75 20.1904 18.75 19.5V8C18.75 7.80109 18.671 7.61032 18.5303 7.46967L14.5303 3.46967C14.3897 3.32902 14.1989 3.25 14 3.25H6.5ZM9.12868 14C9.12868 13.5858 9.46447 13.25 9.87868 13.25H11.25V11.8787C11.25 11.4645 11.5858 11.1287 12 11.1287C12.4142 11.1287 12.75 11.4645 12.75 11.8787V13.25H14.1213C14.5355 13.25 14.8713 13.5858 14.8713 14C14.8713 14.4142 14.5355 14.75 14.1213 14.75H12.75V16.1213C12.75 16.5355 12.4142 16.8713 12 16.8713C11.5858 16.8713 11.25 16.5355 11.25 16.1213V14.75H9.87868C9.46447 14.75 9.12868 14.4142 9.12868 14Z" fill="#262626"/>
</svg>

After

Width:  |  Height:  |  Size: 936 B

+17
View File
@@ -0,0 +1,17 @@
name: FilePlus
category: Files and application
sub_category: Files
keywords:
- document
- dokument
- fil
- file
- error
- feil
- feilmelding
- corrupt
- bad file
- korrupt fil
variant: Stroke
updated_at: 22.05.2023
created_at: 22.05.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="M13.25 7.5V3.5C13.25 3.36193 13.1381 3.25 13 3.25H6.5C5.80964 3.25 5.25 3.80964 5.25 4.5V19.5C5.25 20.1904 5.80964 20.75 6.5 20.75H17.5C18.1904 20.75 18.75 20.1904 18.75 19.5V9C18.75 8.86193 18.6381 8.75 18.5 8.75H14.5C13.8096 8.75 13.25 8.19036 13.25 7.5ZM15 7.25C14.8619 7.25 14.75 7.13807 14.75 7V4.29289C14.75 4.07017 15.0193 3.95863 15.1768 4.11612L17.8839 6.82322C18.0414 6.98071 17.9298 7.25 17.7071 7.25H15ZM12.0001 11.1287C12.4143 11.1287 12.7501 11.4645 12.7501 11.8787V13C12.7501 13.1381 12.862 13.25 13.0001 13.25H14.1214C14.5356 13.25 14.8714 13.5858 14.8714 14C14.8714 14.4142 14.5356 14.75 14.1214 14.75H13.0001C12.862 14.75 12.7501 14.8619 12.7501 15V16.1213C12.7501 16.5355 12.4143 16.8713 12.0001 16.8713C11.5858 16.8713 11.2501 16.5355 11.2501 16.1213V15C11.2501 14.8619 11.1381 14.75 11.0001 14.75H9.87874C9.46453 14.75 9.12874 14.4142 9.12874 14C9.12874 13.5858 9.46453 13.25 9.87874 13.25H11.0001C11.1381 13.25 11.2501 13.1381 11.2501 13V11.8787C11.2501 11.4645 11.5858 11.1287 12.0001 11.1287Z" fill="#262626"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,17 @@
name: FilePlusFill
category: Files and application
sub_category: Files
keywords:
- document
- dokument
- fil
- file
- error
- feil
- feilmelding
- corrupt
- bad file
- korrupt fil
variant: Fill
updated_at: 22.05.2023
created_at: 22.05.2023
@@ -1,3 +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="M4 3.25C3.58579 3.25 3.25 3.58579 3.25 4V20C3.25 20.4142 3.58579 20.75 4 20.75H20C20.4142 20.75 20.75 20.4142 20.75 20V4C20.75 3.58579 20.4142 3.25 20 3.25H4ZM4.75 19.25V4.75H19.25V19.25H4.75ZM12 7C11.4477 7 11 7.44772 11 8C11 8.55228 11.4477 9 12 9C12.5523 9 13 8.55228 13 8C13 7.44772 12.5523 7 12 7ZM10.5 10.25C10.0858 10.25 9.75 10.5858 9.75 11C9.75 11.4142 10.0858 11.75 10.5 11.75H11.25V15.75H10.5C10.0858 15.75 9.75 16.0858 9.75 16.5C9.75 16.9142 10.0858 17.25 10.5 17.25H12H13.5C13.9142 17.25 14.25 16.9142 14.25 16.5C14.25 16.0858 13.9142 15.75 13.5 15.75H12.75V11C12.75 10.5858 12.4142 10.25 12 10.25H10.5Z" fill="#262626"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 3.25C3.58579 3.25 3.25 3.58579 3.25 4V20C3.25 20.4142 3.58579 20.75 4 20.75H20C20.4142 20.75 20.75 20.4142 20.75 20V4C20.75 3.58579 20.4142 3.25 20 3.25H4ZM4.75 19.25V4.75H19.25V19.25H4.75ZM12 6.75C11.4477 6.75 11 7.19772 11 7.75C11 8.30228 11.4477 8.75 12 8.75C12.5523 8.75 13 8.30228 13 7.75C13 7.19772 12.5523 6.75 12 6.75ZM10.5 10C10.0858 10 9.75 10.3358 9.75 10.75C9.75 11.1642 10.0858 11.5 10.5 11.5H11.25V15.5H10.5C10.0858 15.5 9.75 15.8358 9.75 16.25C9.75 16.6642 10.0858 17 10.5 17H12H13.5C13.9142 17 14.25 16.6642 14.25 16.25C14.25 15.8358 13.9142 15.5 13.5 15.5H12.75V10.75C12.75 10.3358 12.4142 10 12 10H10.5Z" fill="#262626"/>
</svg>

Before

Width:  |  Height:  |  Size: 787 B

After

Width:  |  Height:  |  Size: 795 B

@@ -1,3 +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="M3.25 4C3.25 3.58579 3.58579 3.25 4 3.25H20C20.4142 3.25 20.75 3.58579 20.75 4V20C20.75 20.4142 20.4142 20.75 20 20.75H4C3.58579 20.75 3.25 20.4142 3.25 20V4ZM11 8C11 7.44772 11.4477 7 12 7C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8ZM9.75 11C9.75 10.5858 10.0858 10.25 10.5 10.25H12C12.4142 10.25 12.75 10.5858 12.75 11V15.75H13.5C13.9142 15.75 14.25 16.0858 14.25 16.5C14.25 16.9142 13.9142 17.25 13.5 17.25H12H10.5C10.0858 17.25 9.75 16.9142 9.75 16.5C9.75 16.0858 10.0858 15.75 10.5 15.75H11.25V11.75H10.5C10.0858 11.75 9.75 11.4142 9.75 11Z" fill="#262626"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.25 4C3.25 3.58579 3.58579 3.25 4 3.25H20C20.4142 3.25 20.75 3.58579 20.75 4V20C20.75 20.4142 20.4142 20.75 20 20.75H4C3.58579 20.75 3.25 20.4142 3.25 20V4ZM11 7.75C11 7.19772 11.4477 6.75 12 6.75C12.5523 6.75 13 7.19772 13 7.75C13 8.30228 12.5523 8.75 12 8.75C11.4477 8.75 11 8.30228 11 7.75ZM9.75 10.75C9.75 10.3358 10.0858 10 10.5 10H12C12.4142 10 12.75 10.3358 12.75 10.75V15.5H13.5C13.9142 15.5 14.25 15.8358 14.25 16.25C14.25 16.6642 13.9142 17 13.5 17H12H10.5C10.0858 17 9.75 16.6642 9.75 16.25C9.75 15.8358 10.0858 15.5 10.5 15.5H11.25V11.5H10.5C10.0858 11.5 9.75 11.1642 9.75 10.75Z" fill="#262626"/>
</svg>

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 764 B

+1 -1
View File
@@ -5,5 +5,5 @@ keywords:
- "%"
- prosent
variant: Stroke
updated_at: 08.03.2023
updated_at: 05.05.2023
created_at: 07.03.2023
+1 -1
View File
@@ -15,5 +15,5 @@ keywords:
- strand
- natur
variant: Stroke
updated_at: 08.03.2023
updated_at: 08.05.2023
created_at: 07.03.2023
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-icons",
"version": "3.1.0",
"version": "3.2.4",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/ikoner",
"repository": {
+56
View File
@@ -1,5 +1,61 @@
# @navikt/aksel
## 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
+33
View File
@@ -22,6 +22,39 @@ To get started:
npx @navikt/aksel codemod --help
```
### v3
There is no general codemods for migrating from v2 -> v3.
#### CopyButton
`npx @navikt/aksel codemod v3-copybutton ...`
`<CopyToClipboard />` has been renamed to `<CopyButton />` and refactored.
- Namechange
- removed props `popoverText`, `iconPosition`, `popoverPlacement`
- changed variants
- refactored CSS and React-code. ⚠️ Overwritten CSS will not be migrated!
```diff
-import { CopyToClipboard } from "@navikt/ds-react-internal";
+import { CopyButton } from "@navikt/ds-react";
-<CopyToClipboard
+<CopyButton
- popoverText="popoverText"
- iconPosition="left"
- popoverPlacement="bottom-end"
copyText="Text to copy"
size="medium"
>
- text
+</CopyButton>
-</CopyToClipboard>
```
### v1 -> v2
[Documentation](https://aksel.nav.no/grunnleggende/kode/migrering#h76f47744d112)
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel",
"version": "3.1.0",
"version": "3.2.4",
"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": "3.1.0",
"@navikt/ds-css": "3.2.4",
"axios": "1.3.6",
"chalk": "4.1.0",
"clipboardy": "^2.3.0",
+22 -1
View File
@@ -1,7 +1,12 @@
import chalk from "chalk";
export const migrations: {
[key: string]: { description: string; value: string; path: string }[];
[key: string]: {
description: string;
value: string;
path: string;
warning?: string;
}[];
} = {
"1.0.0": [
{
@@ -48,6 +53,16 @@ export const migrations: {
path: "v2.0.0/update-less-tokens/update-less-tokens",
},
],
"v3.0.0": [
{
description:
"Replaces deprecated <CopyToClipboard /> with <CopyButton />",
value: "v3-copybutton",
path: "v3.0.0/copybutton/copybutton",
warning:
"Remember to clean css-import from '@navikt/ds-css-internal' if no longer needed\nIf non-text was used as children, or different locales were handled, you need to manually fix this",
},
],
};
export function getMigrationPath(str: string) {
@@ -56,6 +71,12 @@ export function getMigrationPath(str: string) {
.find((x) => x.value === str)?.path;
}
export function getWarning(str: string) {
return Object.values(migrations)
.reduce((acc, val) => [...val, ...acc], [])
.find((x) => x.value === str)?.warning;
}
export function getMigrationNames() {
return Object.values(migrations).reduce(
(acc, val) => [...val.map((x) => x.value), ...acc],
+5 -1
View File
@@ -2,7 +2,7 @@ import { Command } from "commander";
import fg from "fast-glob";
import * as jscodeshift from "jscodeshift/src/Runner";
import path from "path";
import { getMigrationPath } from "./migrations";
import { getMigrationPath, getWarning } from "./migrations";
import chalk from "chalk";
const ignoreNodeModules = [
@@ -32,6 +32,8 @@ export async function runCodeshift(
options?.glob && console.log(`Using glob: ${chalk.green(options.glob)}\n`);
const warning = getWarning(input);
try {
await jscodeshift.run(codemodPath, filepaths, {
babel: true,
@@ -46,6 +48,8 @@ export async function runCodeshift(
force: options?.force,
print: options?.print,
});
warning && console.log(`\n${chalk.yellow(warning)}\n`);
} catch (error) {
program.error(chalk.red("Error:", error.message));
}
@@ -0,0 +1,89 @@
import chalk from "chalk";
import moveAndRenameImport from "../../../utils/moveAndRenameImport";
import removePropsFromComponent from "../../../utils/removeProps";
/**
* @param {import('jscodeshift').FileInfo} file
* @param {import('jscodeshift').API} api
*/
export default function transformer(file, api, options, ...rest) {
const j = api.jscodeshift;
let root: any;
try {
root = j(file.source);
} catch {
return file.source;
}
const toName = "CopyButton";
const localName = moveAndRenameImport(j, root, {
fromImport: "@navikt/ds-react-internal",
toImport: "@navikt/ds-react",
fromName: "CopyToClipboard",
toName,
});
if (localName === null) {
return root.toSource(options.printOptions);
}
/* Finds and replaces import from CopyToClipboard -> CopyButton */
if (root.findJSXElements(localName)) {
removePropsFromComponent(j, root, localName, [
"popoverText",
"popoverPlacement",
"iconPosition",
"variant",
]);
const component = root.findJSXElements(localName);
component.forEach((node) => {
const children = node.node.children;
let flagged = false;
if (
children.length > 0 &&
!node.node.openingElement.attributes.some(
(attr) => attr.name.name === "text"
)
) {
if (children.length === 1 && children[0].type === "JSXText") {
node.node.openingElement.attributes.push(
j.jsxAttribute(
j.jsxIdentifier("text"),
j.literal(children[0].value.trim())
)
);
} else {
flagged = true;
console.log(
chalk.yellow(
`\n\nWarning: Detected advanced children-type!\nCodemod can't convert into "text" prop so you will need to update this manually.`
)
);
}
}
if (!flagged) {
node.node.children = [];
node.node.openingElement.selfClosing = true;
node.node.closingElement = null;
}
});
const compRoot = root.find(j.JSXElement, {
openingElement: { name: { name: localName } },
});
compRoot.forEach((x) => {
x.node.openingElement.name.name = "CopyButton";
if (x.node.children.length > 0) {
x.node.closingElement.name.name = "CopyButton";
}
});
}
return root.toSource(options.printOptions);
}
@@ -0,0 +1,6 @@
import { CopyToClipboard as DsCpyButton } from "@navikt/ds-react-internal";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return <DsCpyButton></DsCpyButton>;
};
@@ -0,0 +1,6 @@
import { CopyButton } from "@navikt/ds-react";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return <CopyButton />;
};
@@ -0,0 +1,16 @@
import { CopyToClipboard } from "@navikt/ds-react-internal";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return (
<CopyToClipboard
popoverText="popoverText"
copyText="Text to copy"
iconPosition="left"
size="medium"
popoverPlacement="bottom-end"
>
{text}
</CopyToClipboard>
);
};
@@ -0,0 +1,10 @@
import { CopyButton } from "@navikt/ds-react";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return (
<CopyButton copyText="Text to copy" size="medium" text="text">
{text}
</CopyButton>
);
};
@@ -0,0 +1,6 @@
import { CopyToClipboard } from "@navikt/ds-react-internal";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return <CopyToClipboard></CopyToClipboard>;
};
@@ -0,0 +1,6 @@
import { CopyButton } from "@navikt/ds-react";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return <CopyButton />;
};
@@ -0,0 +1,16 @@
import { CopyToClipboard } from "@navikt/ds-react-internal";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return (
<CopyToClipboard
popoverText="popoverText"
copyText="Text to copy"
iconPosition="left"
size="medium"
popoverPlacement="bottom-end"
>
text
</CopyToClipboard>
);
};
@@ -0,0 +1,6 @@
import { CopyButton } from "@navikt/ds-react";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return <CopyButton copyText="Text to copy" size="medium" text="text" />;
};
@@ -0,0 +1,12 @@
import { check } from "../../../../utils/check";
const migration = "copybutton";
const fixtures = ["complete", "idempotent", "alias", "cleanup", "import"];
for (const fixture of fixtures) {
check(__dirname, {
fixture,
migration,
extension: "js",
});
}
@@ -0,0 +1,6 @@
import { CopyButton } from "@navikt/ds-react";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return <CopyButton copyText="Text to copy" size="medium" text={props.text} />;
};
@@ -0,0 +1,6 @@
import { CopyButton } from "@navikt/ds-react";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return <CopyButton copyText="Text to copy" size="medium" text={props.text} />;
};
@@ -0,0 +1,7 @@
import { CopyToClipboard, Dropdown } from "@navikt/ds-react-internal";
import { Button } from "@navikt/ds-react";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return <CopyToClipboard></CopyToClipboard>;
};
@@ -0,0 +1,7 @@
import { Dropdown } from "@navikt/ds-react-internal";
import { Button, CopyButton } from "@navikt/ds-react";
/* eslint-disable react/jsx-no-undef */
export const Page = () => {
return <CopyButton />;
};
@@ -0,0 +1,83 @@
import core, { Collection } from "jscodeshift";
export default function moveAndRenameImport(
j: core.JSCodeshift,
root: Collection<any>,
{
fromImport,
toImport,
fromName,
toName,
}: { fromImport: string; toImport: string; fromName: string; toName: string }
) {
const existingFromImport = root.find(j.ImportDeclaration, {
source: {
value: fromImport,
},
});
if (!existingFromImport.length) {
return null;
}
let localname = fromName;
const existingFromImportSpecifier = existingFromImport?.find(
j.ImportSpecifier,
(node) => {
if (node.imported.name === fromName) {
localname = node.local.name;
}
return node.imported.name === fromName;
}
);
if (!existingFromImport.length || !existingFromImportSpecifier?.length) {
return null;
}
if (existingFromImportSpecifier?.length > 0) {
existingFromImportSpecifier.remove();
}
if (
!existingFromImport.get("specifiers").value?.length ||
existingFromImport.get("specifiers").value?.length === 0
) {
existingFromImport.remove();
}
const existingImport = root.find(j.ImportDeclaration, {
source: {
value: toImport,
},
});
const existingImportSpecifier = existingImport.find(j.ImportSpecifier, {
imported: {
name: toName,
},
});
if (existingImportSpecifier.length <= 0) {
const newImportSpecifier = j.importSpecifier(j.identifier(toName));
if (existingImport.length > 0) {
existingImport.get("specifiers").push(newImportSpecifier);
} else {
const newImport = j.importDeclaration(
[newImportSpecifier],
j.stringLiteral(toImport)
);
const lastImport = root.find(j.ImportDeclaration).at(-1);
if (lastImport.length > 0) {
lastImport.insertAfter(newImport);
} else {
root.get().node.program.body.unshift(newImport);
}
}
}
return localname;
}
@@ -0,0 +1,25 @@
import core, { Collection } from "jscodeshift";
export default function removePropsFromComponent(
j: core.JSCodeshift,
root: Collection<any>,
componentName: string,
propsToRemove: string[]
) {
const component = root.findJSXElements(componentName);
component.forEach((node) => {
const attributes = node.node.openingElement.attributes;
for (let i = attributes.length - 1; i >= 0; i--) {
const attribute = attributes[i];
if (
attribute.type === "JSXAttribute" &&
propsToRemove.includes(attribute.name.name.toString())
) {
attributes.splice(i, 1);
}
}
});
}
+16
View File
@@ -1,5 +1,21 @@
# @navikt/ds-codemod
## 3.2.4
## 3.2.3
## 3.2.2
## 3.2.1
## 3.2.0
## 3.1.3
## 3.1.2
## 3.1.1
## 3.1.0
## 3.0.1
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-codemod",
"version": "3.1.0",
"version": "3.2.4",
"description": "Aksel codemods for NAVs designsystem",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
+2 -2
View File
@@ -40,8 +40,8 @@
"build-pict": "svgr --silent --index-template index-template.js --out-dir src/pictograms pictograms"
},
"dependencies": {
"@navikt/ds-icons": "^3.1.0",
"@navikt/ds-react": "^3.1.0",
"@navikt/ds-icons": "^3.2.4",
"@navikt/ds-react": "^3.2.4",
"clsx": "^1.1.1"
},
"devDependencies": {
+44
View File
@@ -1,5 +1,49 @@
# @navikt/ds-css
## 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
## 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
- :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.
## 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
## 3.1.0
### Minor Changes
+5
View File
@@ -63,6 +63,11 @@ const StyleMappings = {
component: "ContentContainer",
main: "content-container.css",
},
{
component: "CopyButton",
main: "copybutton.css",
dependencies: [typoCss],
},
{ component: "Detail", main: typoCss },
{ component: "ErrorMessage", main: typoCss },
{ component: "ErrorSummary", main: formCss, dependencies: [typoCss] },
+4 -1
View File
@@ -146,7 +146,10 @@ async function bundleMinified() {
}
function copyToVersionFolder() {
const files = fastglob.sync("**/*.css", { cwd: `./${rootDir}` });
const files = fastglob.sync("**/*.css", {
cwd: `./${rootDir}`,
ignore: "**/version/**",
});
for (let file of files) {
const css = fs.readFileSync(`${rootDir}/${file}`, { encoding: "utf-8" });
+151
View File
@@ -0,0 +1,151 @@
[data-theme="dark"] .navds-copybutton,
[data-theme="dark"].navds-copybutton {
--a-text-action: var(--a-blue-300);
--a-surface-hover: rgb(214 231 255 /0.13);
--a-icon-success: rgb(51 170 95 /1);
--a-text-subtle: rgb(231 240 254 /0.69);
--a-text-default: rgb(251 252 254 /0.96);
}
.navds-copybutton {
--__ac-copybutton-padding: var(--a-spacing-3) var(--a-spacing-5);
cursor: pointer;
margin: 0;
text-decoration: none;
border: none;
background: none;
border-radius: var(--ac-copybutton-border-radius, var(--a-border-radius-medium));
padding: var(--__ac-copybutton-padding);
display: grid;
place-content: center;
}
.navds-copybutton--small {
--__ac-copybutton-padding: var(--a-spacing-1) var(--a-spacing-3);
min-height: 2rem;
}
.navds-copybutton--xsmall {
--__ac-copybutton-padding: var(--a-spacing-05) var(--a-spacing-2);
min-height: 1.5rem;
}
.navds-copybutton--icon-only {
--__ac-copybutton-padding: var(--a-spacing-3);
}
.navds-copybutton--small.navds-copybutton--icon-only {
--__ac-copybutton-padding: var(--a-spacing-1);
}
.navds-copybutton--xsmall.navds-copybutton--icon-only {
--__ac-copybutton-padding: var(--a-spacing-05);
}
.navds-copybutton--xsmall .navds-copybutton__icon {
font-size: 1.25rem;
}
.navds-copybutton__icon {
font-size: 1.5rem;
display: flex;
margin-left: -4px;
}
.navds-copybutton__icon:only-child {
margin: 0;
}
:where(.navds-copybutton--small, .navds-copybutton--xsmall):where(:not(:only-child)) {
margin: -2px;
}
.navds-copybutton:focus-visible {
outline: none;
box-shadow: var(--a-shadow-focus);
}
@supports not selector(:focus-visible) {
.navds-copybutton:focus {
outline: none;
box-shadow: var(--a-shadow-focus);
}
}
/* Variant/action */
.navds-copybutton--action {
color: var(--ac-copybutton-action-text, var(--a-text-action));
background-color: var(--ac-copybutton-action-bg, var(--a-surface-transparent));
}
.navds-copybutton--action:hover {
color: var(--ac-copybutton-action-hover-text, var(--a-text-action));
background-color: var(--ac-copybutton-action-hover-bg, var(--a-surface-hover));
}
.navds-copybutton--action:where(:disabled),
.navds-copybutton--action:hover:where(:disabled) {
color: var(--ac-copybutton-action-text, var(--a-text-action));
background-color: var(--ac-copybutton-action-bg, var(--a-surface-transparent));
box-shadow: none;
}
.navds-copybutton--active.navds-copybutton--action {
color: var(--ac-copybutton-action-active-text, var(--a-icon-success));
}
/* Variant/neutral */
.navds-copybutton--neutral {
color: var(--ac-copybutton-neutral-text, var(--a-text-subtle));
background-color: var(--ac-copybutton-neutral-bg, var(--a-surface-transparent));
}
.navds-copybutton--neutral:hover {
color: var(--ac-copybutton-neutral-hover-text, var(--a-text-default));
background-color: var(--ac-copybutton-neutral-hover-bg, var(--a-surface-hover));
}
.navds-copybutton--neutral:where(:disabled, .navds-copybutton--disabled),
.navds-copybutton--neutral:hover:where(:disabled, .navds-copybutton--disabled) {
color: var(--ac-copybutton-neutral-text, var(--a-text-default));
background-color: var(--ac-copybutton-neutral-bg, var(--a-surface-transparent));
box-shadow: none;
}
.navds-copybutton--active.navds-copybutton--neutral {
color: var(--ac-copybutton-neutral-active-text, var(--a-text-default));
}
.navds-copybutton__content {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--a-spacing-2);
}
.navds-copybutton--xsmall > .navds-copybutton__content {
gap: var(--a-spacing-1);
}
.navds-copybutton--active > .navds-copybutton__content {
animation: var(--ac-copybutton-animation, akselCopyButtonAnimation 0.4s linear);
}
@keyframes akselCopyButtonAnimation {
0% {
opacity: 0.4;
}
100% {
opacity: 1;
}
}
/* Disabled */
.navds-copybutton:where(:disabled) {
cursor: not-allowed;
opacity: 0.3;
}
+35 -8
View File
@@ -198,11 +198,11 @@
}
.navds-date__field-input {
padding-right: var(--a-spacing-12);
padding-right: var(--a-spacing-14);
}
.navds-form-field--small .navds-date__field-input {
padding-right: var(--a-spacing-8);
padding-right: var(--a-spacing-10);
}
/* Error-handling */
@@ -223,24 +223,51 @@
.navds-date__field-button {
position: absolute;
right: var(--a-spacing-2);
right: 1px;
top: 50%;
transform: translateY(-50%);
color: var(--ac-date-input-button-text, var(--a-text-default));
display: inline-flex;
cursor: pointer;
margin: 0;
text-decoration: none;
border: none;
background: none;
border-radius: 3px;
padding: var(--a-spacing-3);
align-items: center;
justify-content: center;
font-size: 1.5rem;
height: calc(100% - 2px);
border-start-start-radius: 0;
border-end-start-radius: 0;
}
.navds-form-field--small .navds-date__field-button {
right: var(--a-spacing-2);
height: 1.5rem;
width: 1.5rem;
padding: var(--a-spacing-1);
}
.navds-form-field--small .navds-date__field-button svg {
font-size: var(--a-font-size-medium);
.navds-date__field-button:hover:where(:not([disabled])) {
color: var(--ac-date-input-button-hover-text, var(--a-text-action-on-action-subtle));
background-color: var(--ac-date-input-button-hover-bg, var(--a-surface-action-subtle-hover));
}
.navds-form-field--disabled .navds-date__field-button {
opacity: 1;
cursor: not-allowed;
}
.navds-date__field-button:focus-visible {
outline: none;
box-shadow: var(--a-shadow-focus);
border-radius: var(--a-border-radius-medium);
}
@supports not selector(:focus-visible) {
.navds-date__field-button:focus {
outline: none;
box-shadow: var(--a-shadow-focus);
}
}
.navds-date__caption__year {
+4
View File
@@ -17,6 +17,10 @@
width: 100%;
}
.navds-search--with-size :where(.navds-search__wrapper-inner) {
width: inherit;
}
.navds-search__wrapper {
display: inline-flex;
align-items: center;
+1
View File
@@ -8,6 +8,7 @@
@import "content-container.css";
@import "chat.css";
@import "chips.css";
@import "copybutton.css";
@import "expansioncard.css";
@import "guide-panel.css";
@import "form/index.css";
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css",
"version": "3.1.0",
"version": "3.2.4",
"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": "^3.1.0",
"@navikt/ds-tokens": "^3.2.4",
"cssnano": "6.0.0",
"fast-glob": "3.2.11",
"lodash": "4.17.21",
+25 -8
View File
@@ -5,7 +5,7 @@
}
.navds-toggle-group {
border-radius: 9px;
border-radius: var(--a-border-radius-medium);
background-color: var(--ac-toggle-group-bg, var(--a-surface-transparent));
box-shadow: inset 0 0 0 1px var(--ac-toggle-group-border, var(--a-border-default));
padding: calc(var(--a-spacing-1) + 1px);
@@ -15,6 +15,10 @@
grid-auto-columns: 1fr;
}
.navds-toggle-group--small {
padding: calc(var(--a-spacing-05) + 1px);
}
.navds-toggle-group--neutral {
background-color: var(--ac-toggle-group-neutral-bg, var(--a-surface-transparent));
box-shadow: inset 0 0 0 1px var(--ac-toggle-group-neutral-border, var(--a-border-default));
@@ -24,14 +28,25 @@
display: inline-flex;
align-items: center;
justify-content: center;
padding: var(--a-spacing-3);
min-height: 48px;
padding: var(--a-spacing-1) var(--a-spacing-3);
min-height: 38px;
border: none;
cursor: pointer;
background-color: var(--ac-toggle-group-button-bg, var(--a-surface-transparent));
color: var(--ac-toggle-group-button-text, var(--a-text-default));
border-radius: var(--a-border-radius-medium);
border-radius: 2px;
min-width: fit-content;
font-weight: var(--a-font-weight-regular);
}
.navds-toggle-group--medium > :where(.navds-toggle-group__button:first-of-type:focus-visible) {
border-start-start-radius: 1px;
border-end-start-radius: 1px;
}
.navds-toggle-group--medium > :where(.navds-toggle-group__button:last-of-type:focus-visible) {
border-start-end-radius: 1px;
border-end-end-radius: 1px;
}
.navds-toggle-group--neutral > .navds-toggle-group__button {
@@ -41,7 +56,7 @@
.navds-toggle-group__button:hover {
background-color: var(--ac-toggle-group-button-hover-bg, var(--a-surface-action-subtle));
color: var(--ac-toggle-group-button-hover-text, var(--a-text-action-on-action-subtle));
color: var(--ac-toggle-group-button-hover-text, var(--a-text-default));
}
.navds-toggle-group--neutral > .navds-toggle-group__button:hover {
@@ -87,6 +102,7 @@
display: flex;
align-items: center;
gap: var(--a-spacing-2);
font-weight: inherit;
}
.navds-toggle-group__button-inner > * {
@@ -97,17 +113,18 @@
.navds-toggle-group__button[aria-checked="true"] {
background-color: var(--ac-toggle-group-selected-bg, var(--a-surface-action-selected));
color: var(--ac-toggle-group-selected-text, var(--a-text-on-action));
font-weight: var(--a-font-weight-bold);
}
.navds-toggle-group--neutral > .navds-toggle-group__button[aria-pressed="true"],
.navds-toggle-group--neutral > .navds-toggle-group__button[aria-checked="true"] {
background-color: var(--ac-toggle-group-neutral-selected-bg, var(--a-surface-neutral));
background-color: var(--ac-toggle-group-neutral-selected-bg, var(--a-surface-neutral-selected));
color: var(--ac-toggle-group-neutral-selected-text, var(--a-text-on-neutral));
}
.navds-toggle-group--small > .navds-toggle-group__button {
padding: 0.375rem;
min-height: 32px;
padding: var(--a-spacing-05) var(--a-spacing-3);
min-height: 26px;
min-width: fit-content;
}
+19 -3
View File
@@ -104,6 +104,20 @@
"--ac-chip-removable-neutral-hover-bg": "--a-surface-neutral-subtle-hover",
"--ac-chip-removable-neutral-hover-border": "--a-border-strong"
},
"copybutton": {
"--ac-copybutton-border-radius": "--a-border-radius-medium",
"--ac-copybutton-action-text": "--a-text-action",
"--ac-copybutton-action-bg": "--a-surface-transparent",
"--ac-copybutton-action-hover-text": "--a-text-action",
"--ac-copybutton-action-hover-bg": "--a-surface-hover",
"--ac-copybutton-action-active-text": "--a-icon-success",
"--ac-copybutton-neutral-text": "--a-text-subtle",
"--ac-copybutton-neutral-bg": "--a-surface-transparent",
"--ac-copybutton-neutral-hover-text": "--a-text-default",
"--ac-copybutton-neutral-hover-bg": "--a-surface-hover",
"--ac-copybutton-neutral-active-text": "--a-text-default",
"--ac-copybutton-animation": "akselCopyButtonAnimation 0.4s linear"
},
"date": {
"--ac-date-middle-text": "--a-text-on-action",
"--ac-date-middle-bg": "--a-surface-action-selected",
@@ -117,7 +131,9 @@
"--ac-date-today-border": "--a-border-action-selected",
"--ac-date-caption-text": "--a-text-default",
"--ac-date-input-error-border": "--a-border-danger",
"--ac-date-input-button-text": "--a-text-default"
"--ac-date-input-button-text": "--a-text-default",
"--ac-date-input-button-hover-text": "--a-text-action-on-action-subtle",
"--ac-date-input-button-hover-bg": "--a-surface-action-subtle-hover"
},
"expansioncard": {
"--ac-expansioncard-bg": "--a-surface-default",
@@ -277,14 +293,14 @@
"--ac-toggle-group-button-bg": "--a-surface-transparent",
"--ac-toggle-group-button-text": "--a-text-default",
"--ac-toggle-group-button-hover-bg": "--a-surface-action-subtle",
"--ac-toggle-group-button-hover-text": "--a-text-action-on-action-subtle",
"--ac-toggle-group-button-hover-text": "--a-text-default",
"--ac-toggle-group-selected-bg": "--a-surface-action-selected",
"--ac-toggle-group-selected-text": "--a-text-on-action",
"--ac-toggle-group-button-neutral-bg": "--a-surface-transparent",
"--ac-toggle-group-button-neutral-text": "--a-text-default",
"--ac-toggle-group-button-neutral-hover-bg": "--a-surface-neutral-subtle-hover",
"--ac-toggle-group-button-neutral-hover-text": "--a-text-default",
"--ac-toggle-group-neutral-selected-bg": "--a-surface-neutral",
"--ac-toggle-group-neutral-selected-bg": "--a-surface-neutral-selected",
"--ac-toggle-group-neutral-selected-text": "--a-text-on-neutral"
},
"tooltip": {
+80
View File
@@ -1,5 +1,85 @@
# @navikt/ds-react
## 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
- Updated dependencies []:
- @navikt/aksel-icons@3.2.4
## 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
- :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
- Updated dependencies [[`53c98181c`](https://github.com/navikt/aksel/commit/53c98181c327ead3406bec3487c10232af7d463a)]:
- @navikt/aksel-icons@3.2.3
## 3.2.2
### Patch Changes
- [`6d6267fe0`](https://github.com/navikt/aksel/commit/6d6267fe01f438f3bd67e1b4266ca3e82709561c) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :fire: Fjernet use-client directive fra copybutton
- Updated dependencies []:
- @navikt/aksel-icons@3.2.2
## 3.2.1
### Patch Changes
- Updated dependencies []:
- @navikt/aksel-icons@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.
### Patch Changes
- Updated dependencies []:
- @navikt/aksel-icons@3.2.0
## 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
- Updated dependencies []:
- @navikt/aksel-icons@3.1.3
## 3.1.2
### Patch Changes
- Updated dependencies []:
- @navikt/aksel-icons@3.1.2
## 3.1.1
### Patch Changes
- Updated dependencies []:
- @navikt/aksel-icons@3.1.1
## 3.1.0
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react",
"version": "3.1.0",
"version": "3.2.4",
"description": "Aksel react-components for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
@@ -38,7 +38,7 @@
},
"dependencies": {
"@floating-ui/react": "0.17.0",
"@navikt/aksel-icons": "^3.1.0",
"@navikt/aksel-icons": "^3.2.4",
"@radix-ui/react-tabs": "1.0.0",
"@radix-ui/react-toggle-group": "1.0.0",
"clsx": "^1.2.1",
@@ -0,0 +1,174 @@
import { CheckmarkIcon, FilesIcon } from "@navikt/aksel-icons";
import cl from "clsx";
import React, {
ButtonHTMLAttributes,
forwardRef,
useEffect,
useRef,
useState,
} from "react";
import copy from "../util/copy";
import Label from "../typography/Label";
export interface CopyButtonProps
extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
/**
* @default "medium"
* xsmall should only be used in tables/
*/
size?: "medium" | "small" | "xsmall";
/**
* @default "neutral"
*/
variant?: "action" | "neutral";
/**
* Text to copy to clipboard
*/
copyText: string;
/**
* Optional text in button
*/
text?: string;
/**
* Text shown when button is clicked
* Only set if used with 'text'-prop
*/
activeText?: string;
/**
* Callback when 'copied'-state is active
*/
onActiveChange?: (state: boolean) => void;
/**
* Icon shown when button is not clicked
* @default <FilesIcon />
*/
icon?: React.ReactNode;
/**
* Icon shown when active
* @default <CheckmarkIcon />
*/
activeIcon?: React.ReactNode;
/**
* Timeout duration in milliseconds
* @default 2000
*/
activeDuration?: number;
/**
* * accessible label for icon (ignored if text is set)
* @default 'Kopier'
*/
title?: string;
/**
* accessible label for icon in active-state (ignored if text is set)
* @default 'Kopiert'
*/
activeTitle?: string;
}
export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(
(
{
className,
copyText,
text,
activeText = "Kopiert!",
variant = "neutral",
size = "medium",
onActiveChange,
icon,
activeIcon,
activeDuration = 2000,
title = "Kopier",
activeTitle = "Kopiert",
...rest
},
ref
) => {
const [active, setActive] = useState(false);
const timeoutRef = useRef<number>();
useEffect(() => {
return () => {
timeoutRef.current && clearTimeout(timeoutRef.current);
};
}, []);
const handleClick = (
event: React.MouseEvent<HTMLButtonElement, MouseEvent>
) => {
timeoutRef.current && clearTimeout(timeoutRef.current);
copy(copyText);
setActive(true);
onActiveChange?.(true);
rest.onClick?.(event);
timeoutRef.current = window.setTimeout(() => {
setActive(false);
onActiveChange?.(false);
}, activeDuration);
};
return (
<button
ref={ref}
type="button"
{...rest}
aria-live="polite"
className={cl(
"navds-copybutton",
className,
`navds-copybutton--${size}`,
`navds-copybutton--${variant}`,
{
"navds-copybutton--icon-only": !text,
"navds-copybutton--active": active,
}
)}
onClick={handleClick}
>
<span className="navds-copybutton__content">
{active ? (
<span className="navds-copybutton__icon">
{activeIcon ?? (
<CheckmarkIcon
aria-hidden={!!text}
title={text ? undefined : activeTitle}
/>
)}
</span>
) : (
<span className="navds-copybutton__icon">
{icon ?? (
<FilesIcon
aria-hidden={!!text}
title={text ? undefined : title}
/>
)}
</span>
)}
{text &&
(active ? (
<Label
as="span"
size={size === "medium" ? "medium" : "small"}
aria-live="polite"
>
{activeText}
</Label>
) : (
<Label
as="span"
size={size === "medium" ? "medium" : "small"}
aria-live="polite"
>
{text}
</Label>
))}
</span>
</button>
);
}
);
export default CopyButton;
@@ -0,0 +1,200 @@
import { LinkIcon, ThumbUpIcon } from "@navikt/aksel-icons";
import { userEvent, within } from "@storybook/testing-library";
import React from "react";
import { CopyButton } from ".";
import { Tooltip } from "../tooltip";
export default {
title: "ds-react/CopyButton",
component: CopyButton,
argTypes: {
size: {
defaultValue: "medium",
control: { type: "radio" },
options: ["small", "medium", "xsmall"],
},
variant: {
defaultValue: undefined,
control: { type: "radio" },
options: ["neutral", "action"],
},
},
};
export const Default = {
render: (args) => <CopyButton {...args} />,
args: {
size: "medium",
duration: 2000,
copyText: "3.14",
text: "",
activeText: "",
},
};
export const Interaction = {
render: () => (
<CopyButton
copyText="3.14"
variant="action"
text="Kopier"
data-testid="copy-button"
/>
),
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const button = canvas.getByTestId("copy-button");
userEvent.click(button);
},
};
export const Variants = {
render: () => (
<div className="colgap">
<CopyButton copyText="3.14" variant="action" text="Kopier" />
<CopyButton copyText="3.14" variant="neutral" text="Kopier" />
</div>
),
};
export const Sizes = {
render: () => (
<div className="colgap">
<div className="rowgap">
<CopyButton copyText="3.14" variant="action" />
<CopyButton copyText="3.14" variant="neutral" />
<CopyButton copyText="3.14" variant="action" text="Kopier" />
<CopyButton copyText="3.14" variant="neutral" text="Kopier" />
</div>
<div className="rowgap">
<CopyButton size="small" copyText="3.14" variant="action" />
<CopyButton size="small" copyText="3.14" variant="neutral" />
<CopyButton
size="small"
copyText="3.14"
variant="action"
text="Kopier"
/>
<CopyButton
size="small"
copyText="3.14"
variant="neutral"
text="Kopier"
/>
</div>
<div className="rowgap">
<CopyButton size="xsmall" copyText="3.14" variant="action" />
<CopyButton size="xsmall" copyText="3.14" variant="neutral" />
<CopyButton
size="xsmall"
copyText="3.14"
variant="action"
text="Kopier"
/>
<CopyButton
size="xsmall"
copyText="3.14"
variant="neutral"
text="Kopier"
/>
</div>
</div>
),
};
export const Texts = {
render: () => (
<div className="colgap">
<div>
<CopyButton
copyText="3.14"
text="Kopier XYZ"
activeText="Kopierte XYZ"
/>
</div>
<div>
<CopyButton
copyText="3.14"
size="small"
text="Kopier XYZ"
activeText="Kopierte XYZ"
/>
</div>
<div>
<CopyButton
copyText="3.14"
size="xsmall"
text="Kopier XYZ"
activeText="Kopierte XYZ"
/>
</div>
</div>
),
};
export const Icons = {
render: () => (
<div className="rowgap">
<div>
<CopyButton
copyText="3.14"
icon={<LinkIcon title="Kopier" />}
activeIcon={<ThumbUpIcon title="Kopiert" />}
/>
</div>
<div>
<CopyButton
copyText="3.14"
size="small"
icon={<LinkIcon title="Kopier" />}
activeIcon={<ThumbUpIcon title="Kopiert" />}
/>
</div>
<div>
<CopyButton
copyText="3.14"
size="xsmall"
icon={<LinkIcon title="Kopier" />}
activeIcon={<ThumbUpIcon title="Kopiert" />}
/>
</div>
</div>
),
};
export const InlineDemo = {
render: () => (
<div style={{ display: "flex", gap: "0.5rem", alignItems: "center" }}>
<CopyButton size="small" copyText="3.14" /> Kopier dette feltet
</div>
),
};
export const WithTooltip = {
render: () => {
return (
<div>
<Tooltip content="Kopier fødselsnummer">
<CopyButton copyText="3.14" />
</Tooltip>
</div>
);
},
};
export const Duration = {
render: () => <CopyButton copyText="3.14" activeDuration={300} />,
};
export const Disabled = {
render: () => (
<div className="colgap">
<CopyButton copyText="3.14" disabled />
<CopyButton copyText="3.14" size="small" disabled />
<CopyButton copyText="3.14" disabled variant="action" />
</div>
),
};
@@ -0,0 +1 @@
export { default as CopyButton, type CopyButtonProps } from "./CopyButton";
+16 -18
View File
@@ -1,7 +1,7 @@
import { CalendarIcon } from "@navikt/aksel-icons";
import cl from "clsx";
import React, { forwardRef, InputHTMLAttributes } from "react";
import { BodyShort, Button, ErrorMessage, Label, omit } from "..";
import { BodyShort, ErrorMessage, Label, omit } from "..";
import { FormFieldProps, useFormField } from "../form/useFormField";
import { useDateInputContext } from "./context";
@@ -115,24 +115,22 @@ const DateInput: DateInputType = forwardRef<HTMLInputElement, DateInputProps>(
)}
size={14}
/>
<Button
variant="tertiary"
type="button"
size="small"
onClick={() => onOpen()}
className="navds-date__field-button"
tabIndex={open ? -1 : 0}
<button
disabled={inputProps.disabled}
icon={
<CalendarIcon
title={
open
? conditionalVariables.iconTitle.close
: conditionalVariables.iconTitle.open
}
/>
}
/>
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"
@@ -324,3 +324,22 @@ export const defaultShownMonth = () => {
</div>
);
};
export const Size = () => {
const { datepickerProps, inputProps } = UNSAFE_useDatepicker({
fromDate: new Date("Aug 23 2019"),
toDate: new Date("Feb 23 2024"),
onDateChange: console.log,
});
return (
<div style={{ display: "flex", gap: "1rem" }}>
<DatePicker {...datepickerProps} dropdownCaption>
<DatePicker.Input size="medium" {...inputProps} label="Velg dato" />
</DatePicker>
<DatePicker {...datepickerProps} dropdownCaption>
<DatePicker.Input size="small" {...inputProps} label="Velg dato" />
</DatePicker>
</div>
);
};
@@ -46,17 +46,20 @@ interface ExpansionCardCommonProps
* @default "medium"
*/
size?: "medium" | "small";
/**
* Since ExpansionCard is a section-element, accessible name is required.
*/
}
type ExpansionCardConditionalProps =
| {
["aria-label"]: string;
/**
* Should be set if not using 'aria-labelledby'
*/
"aria-label": string;
}
| {
["aria-labelledby"]: string;
/**
* Should be set if not using 'aria-label'
*/
"aria-labelledby": string;
};
export type ExpansionCardContextProps = {
@@ -67,6 +67,10 @@ export interface SearchProps
* @default "primary"
*/
variant?: "primary" | "secondary" | "simple";
/**
* Exposes the HTML size attribute
*/
htmlSize?: number | string;
}
interface SearchComponent
@@ -112,6 +116,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
defaultValue,
onChange,
onSearchClick,
htmlSize,
...rest
} = props;
@@ -164,9 +169,11 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
"navds-form-field",
`navds-form-field--${size}`,
"navds-search",
{
"navds-search--error": hasError,
"navds-search--disabled": !!inputProps.disabled,
"navds-search--with-size": !!htmlSize,
}
)}
>
@@ -215,6 +222,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
"navds-body-short",
`navds-body-${size}`
)}
{...(htmlSize ? { size: Number(htmlSize) } : {})}
/>
{(value ?? internalValue) && clearButton && (
<button
@@ -164,3 +164,28 @@ export const NoClearButton = () => (
/>
</div>
);
export const HtmlSize = () => (
<div className="colgap">
<Search
label="Lorem ipsum dolor sit amet"
description="Saepe laborum delectus officia perferendis quaerat excepturi possimus hic enim dicta assumenda."
hideLabel={false}
htmlSize="20"
/>
<Search
label="Lorem ipsum dolor sit amet"
description="Saepe laborum delectus officia perferendis quaerat excepturi possimus hic enim dicta assumenda."
hideLabel={false}
htmlSize="20"
variant="secondary"
/>
<Search
label="Lorem ipsum dolor sit amet"
description="Saepe laborum delectus officia perferendis quaerat excepturi possimus hic enim dicta assumenda."
hideLabel={false}
htmlSize="20"
variant="simple"
/>
</div>
);
+2 -1
View File
@@ -3,9 +3,10 @@ export * from "./alert";
export * from "./button";
export * from "./chat";
export * from "./chips";
export * from "./copybutton";
export * from "./date";
export * from "./form";
export * from "./expansion-card";
export * from "./form";
export * from "./grid";
export * from "./guide-panel";
export * from "./help-text";
@@ -1,6 +1,6 @@
import React, { forwardRef, useContext } from "react";
import cl from "clsx";
import { Label } from "..";
import { BodyShort } from "../typography/BodyShort";
import * as RadixToggleGroup from "@radix-ui/react-toggle-group";
import { ToggleGroupContext } from "./ToggleGroup";
@@ -30,13 +30,13 @@ const ToggleItem = forwardRef<HTMLButtonElement, ToggleItemProps>(
ref={ref}
className={cl("navds-toggle-group__button", className)}
>
<Label
<BodyShort
as="span"
className="navds-toggle-group__button-inner"
size={context?.size}
>
{children}
</Label>
</BodyShort>
</RadixToggleGroup.Item>
);
}
+81
View File
@@ -0,0 +1,81 @@
// https://github.com/sudodoki/copy-to-clipboard/blob/main/index.js
const defaultMessage = "Kopier til utklippstavle: #{key}, Enter";
function format(message) {
const copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
return message.replace(/#{\s*key\s*}/g, copyKey);
}
export default function copy(text) {
let debug,
message,
range,
selection,
mark,
success = false;
debug = process.env.NODE_ENV !== "production";
try {
range = document.createRange();
selection = document.getSelection();
mark = document.createElement("span");
mark.textContent = text;
// avoid screen readers from reading out loud the text
mark.ariaHidden = "true";
// reset user styles for span element
mark.style.all = "unset";
// prevents scrolling to the end of the page
mark.style.position = "fixed";
mark.style.top = 0;
mark.style.clip = "rect(0, 0, 0, 0)";
// used to preserve spaces and line breaks
mark.style.whiteSpace = "pre";
// do not inherit user-select (it may be `none`)
mark.style.webkitUserSelect = "text";
mark.style.MozUserSelect = "text";
mark.style.msUserSelect = "text";
mark.style.userSelect = "text";
mark.addEventListener("copy", function (e) {
e.stopPropagation();
});
document.body.appendChild(mark);
range.selectNodeContents(mark);
selection.addRange(range);
const successful = document.execCommand("copy");
if (!successful) {
throw new Error("copy command was unsuccessful");
}
success = true;
} catch (err) {
debug && console.error("unable to copy using execCommand: ", err);
debug && console.warn("trying IE specific stuff");
try {
(window as any).clipboardData.setData("text", text);
success = true;
} catch (err) {
debug && console.error("unable to copy using clipboardData: ", err);
debug && console.error("falling back to prompt");
message = format(defaultMessage);
window.prompt(message, text);
}
} finally {
if (selection) {
if (typeof selection.removeRange == "function") {
selection.removeRange(range);
} else {
selection.removeAllRanges();
}
}
if (mark) {
document.body.removeChild(mark);
}
}
return success;
}
+16
View File
@@ -1,5 +1,21 @@
# @navikt/ds-tailwind
## 3.2.4
## 3.2.3
## 3.2.2
## 3.2.1
## 3.2.0
## 3.1.3
## 3.1.2
## 3.1.1
## 3.1.0
## 3.0.1
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tailwind",
"version": "3.1.0",
"version": "3.2.4",
"description": "Tailwind config based on @navikt/ds-tokens",
"author": "Aksel | NAV designsystem team",
"keywords": [
@@ -22,7 +22,7 @@
"directory": "@navikt/core/tailwind"
},
"devDependencies": {
"@navikt/ds-tokens": "^3.1.0",
"@navikt/ds-tokens": "^3.2.4",
"@types/jest": "^29.0.0",
"color": "4.2.3",
"jest": "^29.0.0",
+16
View File
@@ -1,5 +1,21 @@
# @navikt/ds-tokens
## 3.2.4
## 3.2.3
## 3.2.2
## 3.2.1
## 3.2.0
## 3.1.3
## 3.1.2
## 3.1.1
## 3.1.0
## 3.0.1
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tokens",
"version": "3.1.0",
"version": "3.2.4",
"description": "Design-tokens for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"keywords": [
+16
View File
@@ -1,5 +1,21 @@
# @navikt/ds-icons
## 3.2.4
## 3.2.3
## 3.2.2
## 3.2.1
## 3.2.0
## 3.1.3
## 3.1.2
## 3.1.1
## 3.1.0
## 3.0.1
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-icons",
"version": "3.1.0",
"version": "3.2.4",
"description": "Aksel icons for NAV",
"author": "Aksel | NAV designsystem team",
"repository": {
+24
View File
@@ -1,5 +1,29 @@
# @navikt/ds-css-internal
## 3.2.4
## 3.2.3
## 3.2.2
## 3.2.1
## 3.2.0
## 3.1.3
## 3.1.2
### Patch Changes
- [`5e79234ef`](https://github.com/navikt/aksel/commit/5e79234effb8c8fc73c9bb0c34737e99fab1510b) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :bug: Fikset pin alignment for Timeline
## 3.1.1
### Patch Changes
- [`14379a02c`](https://github.com/navikt/aksel/commit/14379a02c3d32091a8c33061464160d7de9f3f2e) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :bug: Timeline håndterte ikke SVG ikoner riktig
## 3.1.0
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css-internal",
"version": "3.1.0",
"version": "3.2.4",
"description": "CSS for NAV internal Designsystem-components",
"author": "Aksel | NAV designsystem team",
"keywords": [
+4 -2
View File
@@ -12,7 +12,6 @@
height: 1rem;
box-sizing: content-box;
grid-column: 2;
margin-left: var(--a-spacing-8);
}
.navdsi-timeline__row-label {
@@ -40,7 +39,6 @@
display: flex;
background: var(--ac-timeline-row-bg, var(--a-surface-subtle));
margin: var(--a-spacing-4) 0;
padding-left: var(--a-spacing-8);
grid-column: 2;
}
@@ -85,6 +83,10 @@
align-items: center;
}
.navdsi-timeline__period--inner svg {
flex-shrink: 0;
}
.navdsi-timeline__period--clickable {
cursor: pointer;
}
+75
View File
@@ -1,5 +1,80 @@
# @navikt/ds-react-internal
## 3.2.4
### Patch Changes
- Updated dependencies [[`30eee0dac`](https://github.com/navikt/aksel/commit/30eee0dac4e3e5a1379033283a6885e646e80458)]:
- @navikt/ds-react@3.2.4
- @navikt/aksel-icons@3.2.4
## 3.2.3
### Patch Changes
- Updated dependencies [[`475e994f4`](https://github.com/navikt/aksel/commit/475e994f494b2080ffc05eb1684b6a244e3e2969), [`53c98181c`](https://github.com/navikt/aksel/commit/53c98181c327ead3406bec3487c10232af7d463a), [`444e905e0`](https://github.com/navikt/aksel/commit/444e905e01965fd5cac40ff20c5225b072e67221)]:
- @navikt/ds-react@3.2.3
- @navikt/aksel-icons@3.2.3
## 3.2.2
### Patch Changes
- Updated dependencies [[`6d6267fe0`](https://github.com/navikt/aksel/commit/6d6267fe01f438f3bd67e1b4266ca3e82709561c)]:
- @navikt/ds-react@3.2.2
- @navikt/aksel-icons@3.2.2
## 3.2.1
### Patch Changes
- :bug: Fikset tekst i Internal-header
- Updated dependencies []:
- @navikt/ds-react@3.2.1
- @navikt/aksel-icons@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.
### Patch Changes
- Updated dependencies [[`affcab14c`](https://github.com/navikt/aksel/commit/affcab14c3d536929dfa64a36f5b43f9d0e8c3b7)]:
- @navikt/ds-react@3.2.0
- @navikt/aksel-icons@3.2.0
## 3.1.3
### Patch Changes
- Updated dependencies [[`e8ecf309a`](https://github.com/navikt/aksel/commit/e8ecf309a910e47fd3cea6c54cd993ab1196910f)]:
- @navikt/ds-react@3.1.3
- @navikt/aksel-icons@3.1.3
## 3.1.2
### Patch Changes
- Updated dependencies []:
- @navikt/ds-react@3.1.2
- @navikt/aksel-icons@3.1.2
## 3.1.1
### Patch Changes
- [`14379a02c`](https://github.com/navikt/aksel/commit/14379a02c3d32091a8c33061464160d7de9f3f2e) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :bug: Timeline håndterte ikke SVG ikoner riktig
- Updated dependencies []:
- @navikt/ds-react@3.1.1
- @navikt/aksel-icons@3.1.1
## 3.1.0
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react-internal",
"version": "3.1.0",
"version": "3.2.4",
"description": "Aksel react components for internal UIs in NAV",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
@@ -36,8 +36,8 @@
"watch": "tsc --watch -p tsconfig.esm.json"
},
"dependencies": {
"@navikt/aksel-icons": "^3.1.0",
"@navikt/ds-react": "^3.1.0",
"@navikt/aksel-icons": "^3.2.4",
"@navikt/ds-react": "^3.2.4",
"clsx": "^1.1.1",
"copy-to-clipboard": "^3.3.1"
},
@@ -10,6 +10,9 @@ import {
mergeRefs,
} from "@navikt/ds-react";
/**
* @deprecated Use import { CopyButton } from "@navikt/ds-react" instead
*/
export interface CopyToClipboardProps
extends Omit<ButtonProps, "children" | "onClick" | "variant" | "loading"> {
/**
@@ -57,6 +60,9 @@ export interface CopyToClipboardProps
variant?: "tertiary";
}
/**
* @deprecated Use <CopyButton /> instead: import { CopyButton } from "@navikt/ds-react";
*/
export const CopyToClipboard = forwardRef<
HTMLButtonElement,
CopyToClipboardProps
@@ -33,7 +33,6 @@ export const HeaderUserButton: HeaderUserButtonType = forwardRef(
<div>
<BodyShort size="small" as="div">
{name}
ass
</BodyShort>
{description && <Detail as="div">{description}</Detail>}
</div>
@@ -72,7 +72,7 @@ const ClickablePeriod = React.memo(
initiate(index);
}}
>
<div className="navdsi-timeline__period--inner">{icon}</div>
<span className="navdsi-timeline__period--inner">{icon}</span>
</button>
{children && (
<Popover
@@ -33,10 +33,12 @@ const NonClickablePeriod = ({
[direction]: `${left}%`,
}}
>
<div className="navdsi-timeline__period--inner">
<span className="navdsi-timeline__period--inner">
{icon}
<p className="sr-only">{ariaLabel(start, end, status, statusLabel)}</p>
</div>
<span className="sr-only">
{ariaLabel(start, end, status, statusLabel)}
</span>
</span>
</div>
);
};
+4 -4
View File
@@ -15,7 +15,7 @@
<img src="https://img.shields.io/badge/PRs-welcome-green.svg?color=%23262626"" />
</a>
</div>
<div><a href="https://www.npmjs.com/package/@navikt/ds-css"><img alt="npm" src="https://img.shields.io/npm/v/@navikt/ds-css?label=%40navikt%2Fds-*"></a></div>
<div><a href="https://www.npmjs.com/package/@navikt/ds-css"><img alt="npm" src="https://img.shields.io/npm/v/@navikt/ds-css?label=version"></a></div>
<br/>
<a href="https://aksel.nav.no">Nettside</a> | <a href="https://github.com/navikt/aksel/issues">Issues</a>
<br/>
@@ -32,12 +32,12 @@
├── internal/react # @navikt/ds-react-internal, komponenter interne flater
├── internal/css # @navikt/ds-css-internal, css interne flater
├── aksel-icons # @navikt/aksel-icons, ikonpakke
├── icons # @navikt/ds-icons (ikke lengre i bruk)
└── codemod # @navikt/ds-codemod, migrerings-scripts
└── aksel # @navikt/aksel, kommandolinje-verktøy
aksel.nav.no/
├── website # NEXT.JS app (v13)
├── website # NEXT.JS app (v13)
└── website/sanity # Sanity CMS-app (v3)
```
## Commands
+9 -9
View File
@@ -15,15 +15,15 @@
"website"
],
"dependencies": {
"@navikt/aksel-icons": "^3.1.0",
"@navikt/ds-codemod": "^3.1.0",
"@navikt/ds-css": "^3.1.0",
"@navikt/ds-css-internal": "^3.1.0",
"@navikt/ds-icons": "^3.1.0",
"@navikt/ds-react": "^3.1.0",
"@navikt/ds-react-internal": "^3.1.0",
"@navikt/ds-tailwind": "^3.1.0",
"@navikt/ds-tokens": "^3.1.0"
"@navikt/aksel-icons": "^3.2.4",
"@navikt/ds-codemod": "^3.2.4",
"@navikt/ds-css": "^3.2.4",
"@navikt/ds-css-internal": "^3.2.4",
"@navikt/ds-icons": "^3.2.4",
"@navikt/ds-react": "^3.2.4",
"@navikt/ds-react-internal": "^3.2.4",
"@navikt/ds-tailwind": "^3.2.4",
"@navikt/ds-tokens": "^3.2.4"
},
"devDependencies": {
"prettier-plugin-tailwindcss": "^0.2.3"
@@ -43,9 +43,6 @@ function Snarveier() {
Snarveier
</Heading>
<BodyShort as="ul" className="mt-3 grid gap-3">
<FooterLink href="/god-praksis/artikler/om-aksel">
Hva er Aksel?
</FooterLink>
<FooterLink href="/god-praksis/artikler/skriv-for-aksel">
Skriv for Aksel
</FooterLink>
@@ -94,6 +91,9 @@ function SideLenker() {
Om nettstedet
</Heading>
<BodyShort as="ul" className="mt-3 grid gap-3">
<FooterLink href="/god-praksis/artikler/om-aksel">
Hva er Aksel?
</FooterLink>
<FooterLink href="/side/personvernerklaering">
Personvernserklæring
</FooterLink>
@@ -3,9 +3,8 @@ import { TokenTableT } from "@/types";
import { ChevronDownCircleIcon } from "@navikt/aksel-icons";
import internal from "@navikt/ds-css-internal/tokens.json";
import core from "@navikt/ds-css/tokens.json";
import { BodyLong, Label, Link } from "@navikt/ds-react";
import { BodyLong, CopyButton, Label, Link } from "@navikt/ds-react";
import cl from "classnames";
import CopyButton from "components/sanity-modules/code/CopyButton";
import NextLink from "next/link";
import { useState } from "react";
@@ -53,10 +52,9 @@ const TokenTable = ({ node }: { node: TokenTableT }) => {
</tbody>
</table>
{(open || !showMore) && (
<div className="border-border-divider bg-surface-neutral-subtle relative w-full rounded-b border border-t-0 p-2">
<div className="border-border-divider bg-surface-neutral-subtle relative w-full rounded-b border border-t-0 p-2 pr-14">
<CopyButton
variant="tokentable"
content={Object.entries(tokens).reduce(
copyText={Object.entries(tokens).reduce(
(prev, cur) =>
prev +
`${cur[0]}: ${
@@ -64,6 +62,7 @@ const TokenTable = ({ node }: { node: TokenTableT }) => {
};\n`,
""
)}
className="absolute top-2 right-2 z-10"
/>
<Label size="small" as="span" spacing>
Hva er dette?
@@ -1,78 +0,0 @@
import { useRef, useState, useEffect } from "react";
import copy from "copy-to-clipboard";
import React from "react";
import cl from "clsx";
import style from "./index.module.css";
import { CheckmarkIcon, ClipboardIcon } from "@navikt/aksel-icons";
const copyCode = (content: string) =>
copy(content, {
format: "text/plain",
});
interface CopyButtonProps {
content: string;
variant?: "tokentable" | "codeblock";
}
const CopyButton = React.forwardRef<HTMLButtonElement, CopyButtonProps>(
({ content, variant = "codeblock" }, ref) => {
const [active, setActive] = useState(false);
const timeoutRef = useRef<NodeJS.Timeout>();
useEffect(() => {
return () => timeoutRef.current && clearTimeout(timeoutRef.current);
}, []);
const handleCopy = () => {
copyCode(content);
setActive(true);
timeoutRef.current && clearTimeout(timeoutRef.current);
timeoutRef.current = setTimeout(() => setActive(false), 1000);
};
return (
<button
ref={ref}
aria-live={active ? "polite" : "off"}
role={active ? "alert" : undefined}
className={cl(
style.copybutton,
"navds-body-short group/button absolute top-2 right-2 z-10 flex h-10 w-10 items-center justify-center overflow-hidden rounded backdrop-blur transition duration-75 focus:outline-none",
{
"hover:text-text-on-inverted focus-visible:shadow-focus-inverted text-3xl text-gray-100 hover:bg-white/20 ":
variant === "codeblock",
"hover:text-deepblue-800 focus-visible:shadow-focus text-text-subtle hover:bg-surface-hover text-2xl":
variant === "tokentable",
}
)}
onClick={handleCopy}
>
<span
aria-hidden={!active}
className={cl(
"absolute inset-0 grid place-content-center transition duration-300",
{
"pointer-events-none translate-y-1.5 opacity-0": !active,
}
)}
>
<CheckmarkIcon title="Kopierte kodesnutt" />
</span>
<span
aria-hidden={active}
className={cl("flex items-center transition duration-300", {
"pointer-events-none -translate-y-1.5 opacity-0": active,
"group-hover/button:opacity-100": !active,
})}
>
<ClipboardIcon title="Kopier kodesnutt" />
</span>
</button>
);
}
);
export default CopyButton;
@@ -2,8 +2,9 @@ import { withErrorBoundary } from "@/error-boundary";
import cl from "clsx";
import Highlight, { defaultProps, Language } from "prism-react-renderer";
import React from "react";
import CopyButton from "./CopyButton";
import { CodeSnippetT } from "@/types";
import { CopyButton } from "@navikt/ds-react";
import style from "./index.module.css";
const CodeSnippet = ({
node: { code },
@@ -43,7 +44,11 @@ const CodeSnippet = ({
)}
{...props}
>
<CopyButton content={code.code} />
<CopyButton
data-theme="dark"
copyText={code.code}
className={cl(style.copybutton, "absolute top-2 right-2 z-10")}
/>
<Highlight
code={code.code}
language={language}
@@ -51,7 +56,7 @@ const CodeSnippet = ({
theme={undefined}
>
{({ tokens, getLineProps, getTokenProps }) => (
<pre className="text-text-on-inverted relative m-0 overflow-x-auto overflow-y-auto rounded-lg bg-[#0f172a] p-4 pr-16 font-mono">
<pre className="text-text-on-inverted relative m-0 mr-16 overflow-x-auto overflow-y-auto rounded-lg bg-[#0f172a] p-4 font-mono">
{tokens.map((line, i) => (
<div
key={i}
@@ -126,11 +126,11 @@ export const IconPage = ({ name }: { name: string }) => {
onSubmit={(e) => e.preventDefault()}
className="flex h-fit w-full items-center gap-4 py-2 px-4"
>
<div className="min-w-fit">
<div className="min-w-40">
<ToggleGroup
size="small"
value={toggle}
onChange={(v) => setToggle(v as any)}
variant="neutral"
>
<ToggleGroup.Item value="stroke">Stroke</ToggleGroup.Item>
<ToggleGroup.Item value="fill">Fill</ToggleGroup.Item>
+8 -9
View File
@@ -27,15 +27,15 @@
},
"dependencies": {
"@sanity/block-content-to-react": "^3.0.0",
"@sanity/client": "^5.4.2",
"@sanity/code-input": "4.1.0",
"@sanity/color-input": "^3.0.2",
"@sanity/client": "^6.1.1",
"@sanity/code-input": "4.1.1",
"@sanity/color-input": "^3.1.0",
"@sanity/icons": "2.3.1",
"@sanity/image-url": "1.0.2",
"@sanity/preview-kit": "^1.4.0",
"@sanity/preview-kit": "^1.5.3",
"@sanity/table": "1.0.1",
"@sanity/ui": "^1.3.2",
"@sanity/vision": "3.9.1",
"@sanity/ui": "^1.3.3",
"@sanity/vision": "3.11.1",
"@svgr/webpack": "^5.5.0",
"amplitude-js": "^8.21.5",
"boring-avatars": "1.7.0",
@@ -46,7 +46,7 @@
"fuse.js": "^6.6.2",
"lodash": "^4.17.21",
"next": "^13.2.1",
"next-sanity": "^4.1.7",
"next-sanity": "^4.3.2",
"prism-react-renderer": "^1.3.0",
"prismjs": "^1.27.0",
"react": "^18.0.0",
@@ -54,7 +54,7 @@
"react-modal": "3.15.1",
"react-responsive-masonry": "^2.1.7",
"recharts": "^2.2.0",
"sanity": "3.9.1",
"sanity": "3.11.1",
"sanity-plugin-asset-source-unsplash": "^1.0.6",
"sanity-plugin-iframe-pane": "^2.3.0",
"sanity-plugin-media": "^2.0.5",
@@ -71,7 +71,6 @@
"@next/bundle-analyzer": "^12.1.0",
"@next/eslint-plugin-next": "^12.2.0",
"@playwright/test": "^1.30.0",
"@sanity-codegen/types": "1.0.0-alpha.13",
"@testing-library/jest-dom": "^5.16.0",
"@testing-library/react": "^13.3.0",
"@types/jest": "^29.0.0",
@@ -0,0 +1,17 @@
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return <CopyButton copyText="3.14" variant="action" />;
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 1,
};
@@ -0,0 +1,24 @@
import { LinkBrokenIcon, LinkIcon } from "@navikt/aksel-icons";
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return (
<CopyButton
copyText="3.14"
icon={<LinkIcon title="Kopier lenke" />}
activeIcon={<LinkBrokenIcon title="Kopierte lenke" />}
/>
);
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 6,
};
@@ -0,0 +1,19 @@
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return (
<CopyButton copyText="3.14" text="Kopier XYZ" activeText="Kopierte XYZ" />
);
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 4,
};
@@ -0,0 +1,20 @@
import { LinkIcon } from "@navikt/aksel-icons";
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return (
<CopyButton copyText="3.14" icon={<LinkIcon title="Kopier lenke" />} />
);
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 5,
};
@@ -0,0 +1,23 @@
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return (
<div className="flex items-center gap-2">
<CopyButton size="small" copyText="Maguer Gorge 14b, 56430 Tatooine" />{" "}
Adresse: Maguer Gorge 14b, 56430 Tatooine
</div>
);
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 7,
desc: "CopyButton kan settes inline med tekst for å forenkle repetive oppgaver.",
};
@@ -0,0 +1,17 @@
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return <CopyButton copyText="3.14" />;
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 0,
};
@@ -0,0 +1,22 @@
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return (
<div className="flex items-center gap-2">
<CopyButton size="small" copyText="3.14" />
<CopyButton size="small" copyText="3.14" text="Kopier" />
</div>
);
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 2,
};
@@ -0,0 +1,17 @@
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return <CopyButton copyText="3.14" text="Kopier" />;
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 3,
};
@@ -0,0 +1,22 @@
import { CopyButton, Tooltip } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return (
<Tooltip content="Kopier fødselsnummer">
<CopyButton copyText="12003045000" />
</Tooltip>
);
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 8,
desc: "Tooltip kan hjelpe med å gi mer kontekst om hva man kopierer. Vi har testet dette med skjermleser og funnet ut at statisk tekst som 'kopier ...' fungerer bedre enn dynamisk tekst ved klikk i tooltip.",
};
@@ -0,0 +1,28 @@
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return (
<div className="flex items-center gap-1">
<span>Flere statsborgerskap: Norge, Danmark, Finland</span>
<span>/</span>
<span className="flex items-center gap-1">
1709230141 <CopyButton size="small" copyText="1709230141" />
</span>
<span>/</span>
<span>Gift</span>
</div>
);
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 9,
desc: "CopyButton kan eksempelvis inlines i breadcrumbs for kopi av fødselsnummer.",
};
@@ -0,0 +1,41 @@
import { CopyButton } from "@navikt/ds-react";
import { withDsExample } from "components/website-modules/examples/withDsExample";
const Example = () => {
return (
<div>
<Hr />
<Row text="Addresse 1:"> Osloveien 99, 0111 Oslo</Row>
<Row text="Addresse 2:"> Bergenveien 99, 2233 Bergen</Row>
<Row text="Telefon:">4040404040</Row>
<Row text="E-mail:">nav@naversen.no</Row>
</div>
);
};
export default withDsExample(Example);
/* Storybook story */
export const Demo = {
render: Example,
};
export const args = {
index: 10,
desc: "Ved utlisting av mye relevant innhold, kan CopyButton brukes for å enklere kopiere informasjonen.",
};
const Hr = () => (
<div className="border-t-border-divider my-1 h-[1px] w-full border-t" />
);
const Row = ({ children, text }: any) => (
<>
<div className="grid grid-cols-[1fr_4fr_auto] items-center gap-2">
<span>{text}</span>
<span>{children}</span>
<CopyButton size="small" copyText={children} />
</div>
<Hr />
</>
);
@@ -12,5 +12,5 @@ const Example = () => {
export default withDsExample(Example, "inverted");
export const args = {
index: 6,
index: 7,
};
Loaded 100 of 108 files, more files were not shown because too many files have changed in this diff. Show more