Compare commits

...
Author SHA1 Message Date
github-actions[bot]andgithub-actions[bot] 84506691af Version Packages (#2206)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-24 14:12:50 +02:00
Halvor Haugan be647e2ada ✨ Modal: mulighet for å rendre i portal (#2209) 2023-08-24 14:07:03 +02:00
Ken 1698137b96 🐛 Input setter nå ikke aria-controls før popover åpnes (#2213) 2023-08-24 14:06:43 +02:00
Halvor Haugan 02d7f91eff ✅ Modal: use polyfill in JSDOM (#2208) 2023-08-23 16:24:40 +02:00
Halvor Haugan 5b78f71884 💄 Modal: fjern kantlinje (#2210) 2023-08-23 16:15:20 +02:00
Ken 54a43cf924 🐛 Fikset token-naming for table-token (#2204) 2023-08-23 12:26:02 +02:00
Lars Eirik Korsgaard Hansen 6fcbb72a6f 📄 Move font-license to /fonts & change 'licence' to 'license' (#2201) 2023-08-23 08:57:10 +02:00
Ken b69f30f69b 🎨 Fikset mindre sanity-bugs (#2200) 2023-08-22 19:12:39 +02:00
github-actions[bot]andgithub-actions[bot] 265e105fd0 Version Packages (#2202)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-22 15:10:46 +02:00
Ken 8d934e0931 🐛 Checkmark, Confirmationpanel og Tokens patch (#2199) 2023-08-22 15:05:15 +02:00
Ken 6981fbccff 🐛 Fikset kalkulering av ikon-navn på ikonside 2023-08-18 18:27:11 +02:00
github-actions[bot]andgithub-actions[bot] bfee5a822e Version Packages (#2192)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-18 13:09:28 +02:00
Halvor Haugan 58ed3b5367 🏷️ Modal: Bedre type for width (#2191) 2023-08-18 12:51:56 +02:00
github-actions[bot]andgithub-actions[bot] 00b3dd7d59 Version Packages (#2190)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-18 12:20:30 +02:00
Ken 90db7dd0c1 📝 changeset 2023-08-18 12:16:01 +02:00
Ken b6d0304d5a Merge branch 'main' of https://github.com/navikt/aksel 2023-08-18 12:00:15 +02:00
Ken de0a797e09 ⚰️ Fjernet duplikat OG-bilde 2023-08-18 11:59:54 +02:00
github-actions[bot]andgithub-actions[bot] c4eaf0f350 Version Packages (#2186)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-18 11:41:26 +02:00
Ken fb9897e6a0 🐛 Fikset fokusrekkefølge på søk 2023-08-18 09:25:49 +02:00
Halvor HauganandKen 3438b5d7e7 ✨ Modal: støtte for header og footer (#2135)
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
2023-08-17 16:40:52 +02:00
Ken 3583062824 🎨 Oppdatert Action og Gray (#2092) 2023-08-17 16:14:42 +02:00
Ken 2993f809ad La til large-size for Table, oppdatert expand-knapp (#2178) 2023-08-17 16:14:24 +02:00
github-actions[bot]andgithub-actions[bot] fe25e1fdf2 Version Packages (#2185)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-17 16:03:48 +02:00
Vegard HaugstvedtandKen 5cda39ce19 Bugfix/missing red border on combobox with error (#2184)
Co-authored-by: Ken <ken.aleksander@gmail.com>
2023-08-17 16:00:25 +02:00
github-actions[bot]andgithub-actions[bot] 6cb25e44de Version Packages (#2172)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-17 14:24:27 +02:00
Ken 5812d6ee87 📝 Oppdatert changesets 2023-08-17 14:14:01 +02:00
Ken a402777c70 🐛 Alignet alert-ikon med tekst (#2179) 2023-08-17 14:02:56 +02:00
Vegard Haugstvedt d4064bd461 Call Combobox.onClear when clearin input field programatically (#2183) 2023-08-17 14:00:05 +02:00
KenandHalvor Haugan 1c482e03b8 Oppdatert list: Small-variant, bugfixes (#2168)
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
2023-08-17 13:56:59 +02:00
Vegard HaugstvedtandKen 608e1f3944 Feature/combobox error message (#2182)
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
2023-08-17 13:26:10 +02:00
Ken 107d6f3d93 CopyButton prop for iconPosition (#2173) 2023-08-17 13:21:54 +02:00
Ken 09d41e9b6d 🎨 Checkbox checkmark er nå SVG, ikke base64 (#2171) 2023-08-17 12:49:33 +02:00
Ken ebacbddd44 🐛 Reverserte major-update av stylelint 2023-08-17 12:47:34 +02:00
Ken e58b072c84 🎨 Oppdatert storybook, fikset chromatic-PR kommentar 2023-08-17 12:02:03 +02:00
Lars Eirik Korsgaard HansenandKen e7cb3753a0 🐛 fix: Combobox , SingleSelect: allow custom options (#2180)
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
2023-08-17 11:38:31 +02:00
Lars Eirik Korsgaard Hansen 7486ba11f9 🐛 Combobox, SingleSelect: close dropdown menu upon selecting option (#2177)
* isAddedByUser changed to isCustomOption to match language used elsewhere

* list closes when choosing option on SingleSelect

* changeset
2023-08-16 15:43:59 +02:00
Vegard Haugstvedt cf01a6e162 Bugfix/combobox.on clear is fired more times than expected (#2170) 2023-08-16 10:45:02 +02:00
Ken a67f95433f 🐛 Fikset dodont tekst og ikon for god-praksis 2023-08-16 10:44:41 +02:00
github-actions[bot]andgithub-actions[bot] dd03078e33 Version Packages (#2169)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-15 14:12:40 +02:00
Halvor Haugan 72321e3846 💄 ToggleGroup: fjern semibold fra selected button (#2167) 2023-08-15 13:42:20 +02:00
Ken 1cd8ac93ed 🎨 Oppdatert ikonside med forslag fra Slack (#2164) 2023-08-15 10:50:54 +02:00
Ken 48d6f14103 🐛 Fikset for restriktiv validering av sidetittel i sanity 2023-08-15 10:15:11 +02:00
github-actions[bot]andgithub-actions[bot] 44da7fcdc6 Version Packages (#2160)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-14 14:43:22 +02:00
Ken e68ab5cb2c 🎨 Fikset hardkodet border-radius i diverse komponenter (#2159) 2023-08-14 14:40:47 +02:00
Ken c721b392f9 ♻️ Chores Sanity, Storybook
- Oppdatert Storybook, Sanity
- Fikset validering for InputWithCounter i Sanity
- Fikset Accordion-stories rekkefølge
- La til egne knapper for Desktop/mobil-view for eksempler
- Bruker DS-knapper i kode-eksempler på Aksel
2023-08-14 13:40:10 +02:00
Ken 1d0d0ce665 Merge branch 'main' of https://github.com/navikt/aksel 2023-08-13 20:56:42 +02:00
Ken 9d02940543 🔥 Fjernet console.log 2023-08-13 20:50:54 +02:00
Ken 7ff63a2c63 🐛 Fikset validering for sidetittel i sanity 2023-08-13 20:50:13 +02:00
github-actions[bot]andgithub-actions[bot] 49f33a78d8 Version Packages (#2151)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-11 15:59:23 +02:00
Ken 06aaec70f0 📝 Oppdatert changeset for HGrid 2023-08-11 15:43:40 +02:00
Ken 5fbf230e47 🎨 Justert antall viste artikkler i masonary 2023-08-11 13:24:26 +02:00
Vegard Haugstvedt 53265c247e It is not possible to close combobox dropdown after clicking a chip (#2155)
* Fixes bug where it is not possible to close dropdown by pressing escape or clicking outside the combobox after clicking the chips to de-select an option

In short, the focus were lost/reset when the chip disappears, but now is reset to the input instead.
Also fixed issue where clicking the chip while virtual focus is in the dropdown caused a click on both the option and the chip, causing it to be de-selected and instantly re-selected.

* Updated "remove selected"-test to also check that closing the dropdown after clicking a chip is possible.

* Added changeset
2023-08-11 12:38:22 +02:00
Ken d78f33df79 🚚 Markert gammelt grid som deprecated (#2153) 2023-08-11 12:37:02 +02:00
Ken 4375c55ab6 📝 Oppdatert storybook template i workflow 2023-08-11 09:45:02 +02:00
Christian SkrøvsethandKen 0de8238ecf Add semibold (600) fonts (#2150)
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
2023-08-11 09:01:59 +02:00
KenandHalvor Haugan 647b14a238 [Primitives] HGrid (#1838)
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
2023-08-10 15:38:58 +02:00
Ken 64901adccb 🎨 Oppdatert List-dokumentasjon, fikset bruk av ikoner med text (#2149) 2023-08-10 13:06:48 +02:00
Ken 49ddb2094c Hotfix: Fikset visited state for Link og vertical-align for SVG i tailwind 2023-08-09 17:06:15 +02:00
github-actions[bot]andgithub-actions[bot] 8a5f209735 Version Packages (#2148)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-09 16:30:12 +02:00
Ken d3bd1202ed Hotfix: Fikset visited state for Link og SVG-reset ved bruk av tailwind 2023-08-09 16:19:49 +02:00
github-actions[bot]andgithub-actions[bot] 4bf6027518 Version Packages (#2147)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-09 15:34:18 +02:00
Halvor Haugan c8e203c523 ✏️ Fiks skrivefeil i suggestionblock (#2146) 2023-08-09 15:15:41 +02:00
267799ca0e update links (#2093)
* style links with inline

* tweak css spacing for inline links with SVG

* add break-all prop to link

* wrap link in span to allow for spacing

* more obvious spacing example

* remove spacing prop from link

* implement pr review comments

* add random icon visual fuzz testing in stories

* remove console.log

* changeset

* add examples to aksel.nav.no

* 🎨 make inline-flex version opt-in, improve prop naming

* 🐛 Fixed comments

* 🎨 Oppdatert props

* 🎨 refactor links, add examples (remove underline & inline)

* change is no longer major (pr review comment)

Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>

* cleaner changeset (pr review comment)

Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>

* norwegian changeset (pr review comment)

Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>

* update changeset (pr review comment)

Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>

* use neutral token for neutral link variant

Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>

* use neutral token for neutral link variant

Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>

* Update .changeset/proud-tigers-share.md

---------

Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
Co-authored-by: Ken <ken.aleksander@gmail.com>
2023-08-09 15:00:44 +02:00
github-actions[bot]andgithub-actions[bot] 42934af3a1 Version Packages (#2145)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-09 14:38:31 +02:00
Vegard Haugstvedt eff8a902c5 Bugfix/combobox bugfixes and tweaks (#2144)
* Clear input field when clicking option in multiselect combobox

Makes the behaviour consistent when clicking with a mouse and when selecting an option with keyboard.

* MultiSelect with "add new" example should actually have the addnewValues prop set...

* Expose through onToggleSelected whether selected values in combobox are added by the user or not.

* Add the additional affordance of bold font-weight for selected options in combobox.

Done to account for screen magnifiers on screens that don't show the background color, where the checkmark is out-of-sight.

* Avoid "jumping" when selecting option in multiselect, stemming from the chips being slightly larger than the padding allowed for (equal to the width of the border)

* Added changeset and updated yarn.lock

* Do not use focus-visible inside fallback for when focus-visible is not supported

* Add fallback focus-styling using JS and a helper class for browsers not supporting :has (Firefox)

* Fix for onBlur in ComboboxWrapper. Without tabindex="-1" event.relatedTarget in onBlur will be null, and we can't check that focus has entirely moved outside the Combobox.
2023-08-09 14:15:26 +02:00
Ken d34a8f45ef 🐛 aria-live fix for button (#2143) 2023-08-09 11:01:45 +02:00
github-actions[bot]andgithub-actions[bot] d1ceb40439 Version Packages (#2141)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-07 13:58:17 +02:00
e033b34c3b Table component: adding click event on expandable table rows (#2127)
Co-authored-by: Vegard Haugstvedt <it.vegard@gmail.com>
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
2023-08-07 13:42:07 +02:00
Halvor Haugan de3991d0f0 📝 Fiks skrivefeil i Select-eksempler (#2140) 2023-08-04 18:30:41 +02:00
github-actions[bot]andgithub-actions[bot] 9641215506 Version Packages (#2139)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-04 13:43:34 +02:00
Ken 8a82e1c1f6 [Ny komponent] Stack, Spacer (#2040) 2023-08-04 13:13:46 +02:00
github-actions[bot]andgithub-actions[bot] a2dfc8699b Version Packages (#2138)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-04 12:33:33 +02:00
Ken 492cfc1801 💄 Oppdatert bruk av REM for font-scaling fix (#2126) 2023-08-04 11:33:05 +02:00
Ken 9ca5932fed ⬆️ Oppdatert dependencies for dependabot warnings (#2134) 2023-08-04 11:18:24 +02:00
Vebjørn NordbyandKen 5950673fbf Legger til htmlInputType time på TextField-type (#2137)
Co-authored-by: Ken <ken.aleksander@gmail.com>
2023-08-04 09:15:17 +02:00
Ken 5b42ff07ee 🐛 Fikset oppdateringer av prop-docs på Aksel.nav.no 2023-08-03 13:41:20 +02:00
github-actions[bot]andgithub-actions[bot] 09ba52ea76 Version Packages (#2132)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-03 13:30:24 +02:00
a82bccf707 Removable chips type now defaults to button (#2124)
* Removable chips type now defaults to button

* 📝 Changeset

* 📝 Changeset update

* Remove OverridableComponent from Chips.Removable. This component should always be a button, and it is not currently used in any other way.

The reason for making this change now, is that we put type="button" on the Chip.Removable to prevent a submit event when the chip is clicked inside a form.

---------

Co-authored-by: Ken <ken.aleksander@gmail.com>
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
Co-authored-by: Vegard Haugstvedt <it.vegard@gmail.com>
2023-08-03 11:41:31 +02:00
Ken 89ae778c24 🐛 Fikset lasting av aksel-eksempler i storybook 2023-08-03 10:53:25 +02:00
Ken 5b2669d35d ⬆️ Oppdatert storybook til 7.2 (#2128) 2023-08-02 15:35:28 +02:00
Ken 8a82bb4a96 🐛 Fikset layout-bug på komponentsider for enkelte nettlesere 2023-08-02 12:43:19 +02:00
Ken 7871e0f95c 📝 Oppdatert datepicker-eksempler med formatering (#2125) 2023-08-02 12:37:14 +02:00
dependabot[bot] 3182888a07 ⬆️ Bump word-wrap from 1.2.3 to 1.2.4 (#2115)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-02 10:39:55 +02:00
Mathias S. Müller f2742da085 Legg til manglende størrelsesbeskrivelse (#2121) 2023-07-27 14:59:08 +02:00
github-actions[bot]andgithub-actions[bot] 92721aefa0 Version Packages (#2119)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-21 11:47:05 +02:00
Ken e6fdfdc9b4 🐛 Fikset stepper-bug (#2116) 2023-07-20 19:50:56 +02:00
github-actions[bot]andgithub-actions[bot] 93975bc935 Version Packages (#2118)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-19 20:14:53 +02:00
Ken 3a0dac3997 🐛 Fikset datepicker-bug for dynamsik oppdatering av 'month' (#2117) 2023-07-19 20:12:14 +02:00
Andreas Nordahl 1d43710af0 Remove preconnect link to fonts.googleapis.com(#2114) 2023-07-19 17:45:55 +02:00
github-actions[bot]andgithub-actions[bot] 6df7c78e3c Version Packages (#2111)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-17 22:35:24 +02:00
Andreas NordahlandKen 476d79e487 Expose timeline axis label templates as a prop (#2109)
Co-authored-by: Ken <ken.aleksander@gmail.com>
2023-07-17 22:32:16 +02:00
dependabot[bot]andLars Eirik Korsgaard Hansen 238a715c92 ⬆️ Bump semver from 5.7.1 to 5.7.2 (#2107)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lars Eirik Korsgaard Hansen <71271458+larseirikhansen@users.noreply.github.com>
2023-07-14 15:06:55 +02:00
Lars Eirik Korsgaard Hansen 0fadd33e3e Combobox fixes (#2112)
Combobox post-release tweaks

* Add dynamic height to examples because of the dropdown

* Examples were not working: remove controlled prop for uncontrolled Comboboxes

* Add an example with controlled Combobox
2023-07-14 11:08:47 +02:00
Ken eadc0bce13 📝 Oppdatert changeset for bedre endringslogg 2023-07-13 15:50:29 +02:00
Lars Eirik Korsgaard Hansen 678db9b11b Update spotty-onions-cough.md 2023-07-13 15:39:40 +02:00
Lars Eirik Korsgaard Hansen e3027cc196 ✨ Ny komponent: Combobox (#1868)
✨Ny komponent: Combobox 🎉 

Combobox er en ny komponent som kombinerer tekstfelt og nedtrekksliste. 
- Velg mellom predefinerte alternativer i nedtrekkslisten
- Bruk input-feltet som filter for alternativene i nedtrekkslisten.
- Legg inn nye svar, hvis svaret du ikke finnes i listen
- Velg mellom SingleSelect eller MultiSelect-versjon for henholdsvis ett og flere valg. 
- Autocomplete svar i inputfeltet når man velger SingleSelect

Dokumentasjonen finner du på https://aksel.nav.no/komponenter/core/combobox
2023-07-13 15:17:05 +02:00
Ken ac0fd790e3 ⚰️ Fjernet ubrukt metrics-løsning (#2098) 2023-07-06 17:42:38 +02:00
SjurandKen c344c9beb4 Update removable.tsx (#2101)
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
2023-07-06 17:22:24 +02:00
SjurandKen 5cb5dea4ff Update toggle-neutral.tsx (#2100)
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
2023-07-06 14:42:51 +02:00
Sjur 054c63b161 Update toggle.tsx (#2099) 2023-07-06 14:42:12 +02:00
Julian Nymark f60ba32f97 split default example into separate examples (#2097)
* split default example into separate examples

* also keep the default

* remove unnecessary div wrapper for single elements
2023-07-06 13:28:26 +02:00
Ken 54811b394d ✨ Eksterne sider åpnes nå i ny fane 2023-07-06 13:14:33 +02:00
Ken c6b0570c4c 🔇 Fjernet API-access for tilbakemeldinger 2023-07-06 11:21:05 +02:00
Ken 8baa1ab0b4 🔒 Fjernet kommentarfelt på aksel 2023-07-05 09:24:10 +02:00
Ken 06ceeb3e6f 🐛 Fikset rouge ';' i preview 2023-07-04 21:55:21 +02:00
Ken 02f19858c7 🐛 Fikset sanity-auth for preview og edit-knapp 2023-07-04 21:51:21 +02:00
Ken 799e26a628 🐛 Fikset lenker på komponentside 2023-07-04 17:11:53 +02:00
Ken f5e5843916 Oppdatert sanity, Lister opp alle utdaterte artikler for forfatter (#2091) 2023-07-04 13:59:33 +02:00
github-actions[bot]andgithub-actions[bot] 4b8ed30554 Version Packages (#2090)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-03 14:38:52 +02:00
Ken 28430f1345 🐛 Fikset layout-bug i skjemakomponenter (#2089) 2023-07-03 14:34:50 +02:00
github-actions[bot]andgithub-actions[bot] d242325863 Version Packages (#2087)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-03 13:22:31 +02:00
Ken ae70bfa719 ReadOnly for skjemakomponenter (#2080) 2023-07-03 12:37:48 +02:00
Ken 0aef861622 📝 Readme-oppdatering 2023-06-30 14:33:58 +02:00
Ken 525b021e0f 📝 Oppdatert Switch-eksempler 2023-06-30 11:23:22 +02:00
Ken 761344c34e 🎨 Oppdatert sidebar-config for sanity 2023-06-30 10:34:39 +02:00
github-actions[bot]andgithub-actions[bot] a67f61c33f Version Packages (#2084)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-29 15:23:12 +02:00
Julian NymarkandKen b05958863b add close button to alert (#2079)
Co-authored-by: Ken <ken.aleksander@gmail.com>
2023-06-29 13:43:10 +02:00
Ken 883ae00dfa 💄 Fikset sidebar :before-element 2023-06-29 13:25:17 +02:00
github-actions[bot]andgithub-actions[bot] 6eb8a79092 Version Packages (#2082)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-28 11:35:27 +02:00
Ken 718b3204d8 🐛 Fikset i18n for textarea 2023-06-28 11:25:32 +02:00
Ken 45970ac0fb 🐛 UU dukket ikke opp i søk 2023-06-28 10:39:54 +02:00
Ken fe5e8ada74 🐛 Fikset capitalize på god-praksis tagger 2023-06-28 10:39:07 +02:00
Ken 3e625a5cb5 🐛 Underline brakk på windows for forside-kort 2023-06-28 10:06:23 +02:00
Ken edc3495ce6 🐛 Fikset text-decoration for windows på aksel.nav.no 2023-06-27 20:26:59 +02:00
Ken 2520bc7ff5 🎨 Fikset lenker brukt på Aksel.nav.no
🎨 Intro-cards shadows

💄 Komponentoversikt-cards

💄 Oppdatert lenkevisning for cards på aksel.nav.no
2023-06-27 15:25:06 +02:00
github-actions[bot]andgithub-actions[bot] 44446e753a Version Packages (#2078)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-26 13:38:24 +02:00
Halvor Haugan 4156326752 Chat: fjern border, gjør svg mindre, bytt om "subtle" og "neutral" (#2077) 2023-06-26 13:27:25 +02:00
Ken 23970486ed 🐛 fikset date-handling for preview av god-praksis 2023-06-26 12:31:36 +02:00
Ken a8f1069650 🎉 Automatisk changelog på aksel.nav.no
🔥 Fjernet unified fra dependencies

🐛 Fikset changelog-format, la inn støtte for emojies
2023-06-23 18:30:03 +02:00
Julian Nymark f9c8320b74 sort + reverse the semver entries (#2074) 2023-06-23 11:01:33 +02:00
Ken c4839a12ed 📝 Oppdatert PR-template, Changelog-cleanup (#2073) 2023-06-23 10:43:53 +02:00
Halvor Haugan 60f64d7f70 📝 Dropdown: Better Item examples (#2072) 2023-06-22 17:21:12 +02:00
github-actions[bot]andgithub-actions[bot] e32dbe5c5d Version Packages (#2071)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-22 15:23:42 +02:00
Ken de36269582 ✨ Oppdaterte shadow-tokens (#2041) 2023-06-22 15:12:42 +02:00
Julian Nymark 6cb6c52770 Changelog generator script (#2046) 2023-06-22 15:10:03 +02:00
Ken a877d24ed0 🐛 Fikset corder-bleed på komponentside-header 2023-06-21 17:10:43 +02:00
github-actions[bot]andgithub-actions[bot] a1b6332fa1 Version Packages (#2070)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-21 13:48:45 +02:00
Ken 99c08b8e4a Fikset bug i Popover/Helptext der popover gikk helt ut i kantene (#2069) 2023-06-21 13:44:59 +02:00
Ken d39ed906c6 🐛 Fikset ExpansionCard bug ved nesting (#2067) 2023-06-21 13:40:48 +02:00
github-actions[bot]andgithub-actions[bot] 3b31bd3d75 Version Packages (#2066)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-21 11:59:33 +02:00
Halvor HauganandKen b1625ba388 ✨ Chat: ny small-variant, justert design, forbedret UU (#2048)
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
2023-06-21 09:40:50 +02:00
Ken 269d06c277 📝 ErrorSummary prop-dokumentasjon 2023-06-20 15:47:52 +02:00
Ken 0c56273f3b 🐛 Fikset rekkefølge på button-stories 2023-06-20 15:41:13 +02:00
Ken ab6a96aed7 ♻️ Oppdatert komponent demoer (#2063) 2023-06-20 11:46:45 +02:00
Ken 9ee8a72082 🔥 Fjernet død kode, lazy-loader sanity-moduler bare brukt for preview 2023-06-19 19:53:50 +02:00
Ken c2e5a92d8e 🎉 Oppdatert søk (#2062) 2023-06-19 18:28:24 +02:00
Ken 6059aa59aa 🐛 Oppdatert playwright-config for mindre flaky tester 2023-06-19 16:21:13 +02:00
Ken b877ada408 🐛 Fikset playwright-tester 2023-06-19 15:11:59 +02:00
Ken 4e339f183e 🔊 Oppdatert amplitude (#2061) 2023-06-19 14:09:08 +02:00
Ken 1d62bf26ff 🛠️ Diverse småjustering for Aksel (#2060) 2023-06-19 13:19:57 +02:00
github-actions[bot]andgithub-actions[bot] da0fbc3299 Version Packages (#2057)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-19 13:02:23 +02:00
Ken 9f59e67e2a ⚡ Lazy-loading date-fns: sparer ~10kB first-load (#2058) 2023-06-19 12:53:28 +02:00
Ken ed7aafcac8 🎨 Oppdatert deploy image (#2059) 2023-06-19 12:53:08 +02:00
Ken dfbbe92a63 🎨 Helptext har nå en prop for wrapperClassName (#2056) 2023-06-19 11:48:53 +02:00
Ken 42b5af64ab 🐛 Timeline Period brakk ved bruk av JSODOM 2023-06-17 10:25:45 +02:00
Ken 329119fa04 💄 DoDont-ikon er nå høyrestilt 2023-06-16 16:21:19 +02:00
Ken 0fc80f45cb ♿ Fikset regression der sanity ikke lengre støttet skjermlesere 2023-06-16 16:07:37 +02:00
Ken 337b9fda13 🐛 Fikset inlinecode bruk i heading 2023-06-16 12:58:26 +02:00
github-actions[bot]andgithub-actions[bot] 659e835da9 Version Packages (#2055)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-15 16:38:08 +02:00
Ken e10f4375b1 Merge branch 'main' of https://github.com/navikt/aksel 2023-06-15 16:34:25 +02:00
Ken 9a8bb26c36 🐛 Timeline brakk ved bruk av JSDOM-tester 2023-06-15 16:33:40 +02:00
github-actions[bot]andgithub-actions[bot] 69aea38784 Version Packages (#2053)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-15 15:55:48 +02:00
Ken 8f16d1571e 🎨 Oppdatert ikoner (#2054) 2023-06-15 15:51:47 +02:00
Marianne Røsvik e2265c9a78 Added two new icons (#2047) 2023-06-15 15:06:48 +02:00
Ken 925aa7a140 🐛 OverridableComponent omitter nå 'as' (#2051) 2023-06-15 14:46:34 +02:00
Ken 7c17e40cac 🐛 Datepicker og Monthpicker lukker nå popover ved escape (#2052) 2023-06-15 14:46:07 +02:00
github-actions[bot]andgithub-actions[bot] 3c8889ea88 Version Packages (#2050)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-13 16:49:54 +02:00
Ken e060961050 🐛 Fikset bruk av text-subtle på skjemaelementer (#2049) 2023-06-13 16:45:35 +02:00
Ken 18aa4ee7fb Merge branch 'main' of https://github.com/navikt/aksel 2023-06-09 14:36:38 +02:00
Ken f44edd76a2 Merge branch 'next' 2023-06-09 14:31:11 +02:00
github-actions[bot]andgithub-actions[bot] 1fa636bdd5 Version Packages (#2044)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-09 14:16:43 +02:00
Ken 44a75acb6b 🐛 className ble ikke riktig forwardet til period 2023-06-09 14:14:15 +02:00
Ken 550faee900 💄 Checkboard-pattern for transparent visning av tokens 2023-06-09 13:53:29 +02:00
Karl O 88b6174b0b 📝 La til next-logger så backend logging får rett log-level (#2042) 2023-06-09 13:34:31 +02:00
Ken fbf016b3bd ✨ Forbedringer for Aksel.nav.no UI (#2043) 2023-06-09 13:05:59 +02:00
09fa503b98 initial template for PR (#2019)
* initial template for PR

* update template

* update template

* 📝 Oppdatert template

---------

Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
Co-authored-by: Ken <ken.aleksander@gmail.com>
2023-06-09 09:55:28 +02:00
Ken f5688485f5 ⬆️ Oppdatert Sanity 2023-06-08 18:43:14 +02:00
github-actions[bot]andgithub-actions[bot] 6385c4686e Version Packages (#2039)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-08 16:07:32 +02:00
Ken 30068dca3f 📝 La til jsdoc for skeleton-komponent 2023-06-08 16:03:27 +02:00
github-actions[bot]andgithub-actions[bot] 3aa04d2375 Version Packages (#2038)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-08 15:25:09 +02:00
Ken 91343563c9 🐛 Fikset markering av tekst internt i Skeleton-komponent 2023-06-08 15:21:52 +02:00
Ken d5c8112339 📝 Fikset typo i skeleton-docs 2023-06-08 15:02:24 +02:00
github-actions[bot]andgithub-actions[bot] e6cc9d1b4f Version Packages (#2031)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-08 14:49:16 +02:00
Ken db8c38a094 [Ny komponent] Skeleton (#1821) 2023-06-08 14:44:08 +02:00
Ken 35041e64eb Update README.md 2023-06-08 08:17:20 +02:00
Ken 690422d824 🐛 Fikset darkmode for skjemakomponenter 2023-06-07 20:10:28 +02:00
Ken b54bebd308 ⚡ Forbedret søk 2023-06-07 16:11:40 +02:00
Ken 8db194170c 🐛 Fikset chips.css bug etter merge 2023-06-07 15:45:00 +02:00
Ken 7b42f536aa 🎨 Oppdatert Chips-komponent (#2035) 2023-06-07 15:39:11 +02:00
Ken b2f796d681 💄 Text-subtle, icon-subtle til 700 nivå, form-description farger(#2036) 2023-06-07 15:22:02 +02:00
17d92c9ed5 add jsdoc (it's mostly copilot + some tweaks) (#2034)
* 📝 add jsdoc (it's mostly copilot + some tweaks)

* 😂 emojis

* 🏷️ add jsdoc for overridableComponents

* 🏷️ Oppdatert docgen for nestede komponenter

* 🎨 Oppdatert chat

* 🏷️ Dokumentert date-hooks

* 🏷️ Expansioncard-props

* 🏷️ Stepper.step jsdoc

* 🏷️ Tabs jsdoc

* 🏷️ Linkpaneltypes

* 🏷️ List jsdoc

* 🏷️ list jsdoc

* 🏷️ InternalHeader-docs

* 🏷️ jsdoc for dropdown

* 🏷️ Timeline jsdoc

---------

Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
Co-authored-by: Ken <ken.aleksander@gmail.com>
2023-06-07 14:19:34 +02:00
Ken 7bae5dce88 🎨 Fikset søketreff for CSS + overflow av ikonsøk-form 2023-06-06 15:43:38 +02:00
Ken 6aca0a4b6a 🎨 Data-tokens (#2032) 2023-06-06 13:49:31 +02:00
Ken 4f7fde22a3 🐛 Regex-fix for sanity-url er 2023-06-06 13:45:34 +02:00
Ken 0dad69a8df 💄 Fadein frontpage-cards 2023-06-05 22:34:37 +02:00
Julian Nymark c028f36e2b Indent prop added to accordion (#2027) 2023-06-05 19:38:44 +02:00
Ken 988fb36619 📝 Nettside-readme 2023-06-05 17:25:09 +02:00
Ken f61cd88627 📝 Oppdatert readme 2023-06-05 17:10:26 +02:00
github-actions[bot]andgithub-actions[bot] 7d62019a13 Version Packages (#2028)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-05 16:05:27 +02:00
Ken 83e3a1131a ⚰️ Fjernet kode for gamle pakker (#2029) 2023-06-05 15:58:53 +02:00
Ken 895bdc08e5 v4: Internal til Core, Datepicker ut av beta (#2026) 2023-06-05 15:05:31 +02:00
Ken 3c991e13d1 🐛 Fikset duplisert-id for komponent-eksempler 2023-06-05 14:50:42 +02:00
MaxandMaximilian Lloyd 0c24d57c6c 📝 Noen JSDoc eksempler (#2025)
Co-authored-by: Maximilian Lloyd <maximilian.oysta.lloyd@nav.no>
2023-06-05 09:14:48 +02:00
Ken 0f0041b71e 🎨 Forbedret ikonside og eksempel-navigering
🎨 Fungerende anchor-tag navigering for eksempler

🚚 Flyttet sections-kode i sidebar ut i egen hook

💄 Oppdatert tag
2023-06-05 08:52:21 +02:00
Ken da40cc405c ⬆️ Oppdatert sanity (#2021) 2023-06-02 20:31:14 +02:00
Ken c135cbe642 ⬆️ Oppdatert playwright-image til 1.33.0 versjon 2023-06-01 08:25:22 +02:00
Ken 2a2e9edbd7 ⬇️ Negradert playwright for å matche docker img-tag 2023-05-31 23:39:39 +02:00
Ken d22d6049e8 ⬆️ Oppdatert playwright-image til nyeste versjon 2023-05-31 23:26:17 +02:00
Ken f9bea26a29 🔥 Fjernet lenke til identitet da siden ikke lengre finnes 2023-05-31 23:17:17 +02:00
github-actions[bot]andgithub-actions[bot] 239017b07a Version Packages (#2018)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-31 15:39:05 +02:00
Julian Nymark 7615dbbb54 add dependency on postcss-value-parser (#2017) 2023-05-31 15:34:25 +02:00
Ken 4034eea298 🐛 Fikset release av stylelint 2023-05-31 15:03:16 +02:00
github-actions[bot]andgithub-actions[bot] 68501b4c8a Version Packages (#2015)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-31 14:29:19 +02:00
61c4114214 [WIP] aksel stylelint (#1973)
* working stylelint config + test rule

this commit is a good "base" for developing future stylelint rules

* merge ideas (sortof)

* delete test-rule + add URL to readme section

* flatten json object

* bundle token files at build time

* update lock file deps

* package distribution & version in error message

* rule for internal tokens

* rule for class name override

* remove config props

* fix: emit multiple errors for nodes in postcss-value-parser

* adjust error messages

* some tests

* final tests

* refactor

* no more regex

* update README.md

* update README.md (again)

* readme

* readme and usage example for aksel-design-token-exists

* move README of rule into top-level README

* update README

* update README

* move sources into /src, bookkeeping

* add aksel-stylelint to changeset.fixed

* set exports correctly (exposes ./recommended)

* bookkeeping, cleanup, refactor, remove test files

* Update README.md

* changeset

* fix urls

* update test for aksel-design-token-exists to cover all token files

* add more granular error catching

* cleanup, improve error message

* update tests + fix code that broke tests

* add rule: deprecate classes

* adjust aksel-design-token-exists

* adjust test for no-deprecated-classes

* refactor design-token-exists

* update README

* 📝 update README

* update readme

* refactor: split rules into smaller rules

* fix tests (deduplicate from refactor), fix plugin too

* fix meta name / ruleName -> ruleNamePackage refactor

* set internal dependencies (build time)

* set internal dependencies (build time)

* when building stylelint, always pull latest css & token files

* new lock

* test cache-busting

* ignore some lint rules

* deduplicate rulename

* bring back caching in ci.yml

* 📝 Oppdatert Package.json docs

* more helpful error messages

* 📝 Updated readme

* 📝 Updated prefixes for rules in readme

* 📝 Formateringsfeil i readme

* refactor ruleNames (shorter and better!)

* update one more rule name (I forgor)

* refactor names again (must have namespace)

* 🐛 Fikset intern bruk av lint-regler

* ⬆️ yarn lock sync

---------

Co-authored-by: Halvor Haugan <halvor.haugan@nav.no>
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
Co-authored-by: Ken <ken.aleksander@gmail.com>
2023-05-31 14:22:41 +02:00
Halvor HauganandKen b958d41a20 ✨ Tag: ny variant "moderate" (#2010)
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
2023-05-31 13:53:30 +02:00
Ken c3905aa2f8 🎨 linetermination fix for windows (#2014) 2023-05-31 13:53:00 +02:00
Ken 812a2347a0 ♿ Mindre uu-fiks for ikonside 2023-05-31 10:18:15 +02:00
Ken deb1c151bb Update README.md 2023-05-30 15:18:26 +02:00
Ken 784d17165d ♻️ Ikonside bruker nå CopyButton 2023-05-30 15:07:18 +02:00
Ken 1a894829f0 🎨 Search: Custom-button eksempel for aksel 2023-05-26 14:04:59 +02:00
Halvor Haugan e06a76b5c5 🐛 aksel-icons copyfiles-kommandoen fungerer nå på Win/Unix (#2007) 2023-05-25 22:35:49 +02:00
github-actions[bot]andgithub-actions[bot] 18d6f63e3e Version Packages (#2006)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-25 15:12:17 +02:00
Ken 4953e6725e 🐛 Ignore figma-plugin 2023-05-25 14:53:43 +02:00
Christian Skrøvseth 5533fbd5a3 Migrate CopyButton from deprecated to modern clipboard (#2005) 2023-05-25 14:40:22 +02:00
Ken 2c54cd077b 🎨 Icon-plugin (#1997) 2023-05-25 13:38:37 +02:00
Ken c84efa5ee9 🐛 Disable chromatic-snapshot av flaky button-story 2023-05-25 13:08:13 +02:00
Ken 9f3bcb8974 🐛 Endret rekkefølge på timeline-eksempler 2023-05-25 13:03:55 +02:00
github-actions[bot]andgithub-actions[bot] c8375ba46f Version Packages (#2002)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-25 12:36:22 +02:00
Ken 288cef591a Timeline viser popover på hover (#1995) 2023-05-25 12:25:26 +02:00
Ken aa3b4c22d6 🎨 Mulighet for manuell sortering av elementer i grunnleggende-sidebar 2023-05-24 18:26:38 +02:00
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
1352 changed files with 29118 additions and 25443 deletions

No files matched your search

-3
View File
@@ -31,10 +31,7 @@ Alle base-pakkene våre har `fixed versjonering`. Dette tilsier at en bump på e
"@navikt/ds-react",
"@navikt/ds-css",
"@navikt/aksel-icons",
"@navikt/ds-icons",
"@navikt/ds-tokens",
"@navikt/ds-tailwind",
"@navikt/ds-css-internal",
"@navikt/ds-react-internal",
"@navikt/ds-codemod"
```
+6 -6
View File
@@ -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": [
[
@@ -8,19 +11,16 @@
"@navikt/ds-css",
"@navikt/ds-tokens",
"@navikt/ds-tailwind",
"@navikt/ds-css-internal",
"@navikt/ds-react-internal",
"@navikt/ds-codemod",
"@navikt/aksel-icons",
"@navikt/aksel",
"@navikt/ds-icons"
"@navikt/aksel-stylelint"
]
],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["shadow-dom", "aksel.nav.no", "@navikt/ds-navno"],
"ignore": ["shadow-dom", "aksel.nav.no", "aksel-icons-figma-plugin"],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"updateInternalDependents": "always"
+44
View File
@@ -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
+3 -3
View File
@@ -75,7 +75,7 @@ jobs:
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: github-comment-finder
body-includes: Storybook demo
- name: Create or update comment
if: steps.chromatic_tests.outcome == 'success' && !contains(github.event.head_commit.message, '[ci skip]') && github.event_name != 'push'
@@ -84,7 +84,7 @@ jobs:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
### [<img id="github-comment-finder" src="https://raw.githubusercontent.com/storybookjs/brand/main/logo/logo-storybook-inverse.svg" height="32"/>](${{steps.storybook_url.outputs.replaced}})
## [Storybook demo](${{steps.storybook_url.outputs.replaced}})
[${{ steps.vars.outputs.sha_short }}](https://github.com/navikt/aksel/commit/${{ steps.vars.outputs.sha_short }}) | ${{steps.chromatic_tests.outputs.componentCount}} komponenter | ${{steps.chromatic_tests.outputs.specCount}} stories
edit-mode: replace
@@ -96,7 +96,7 @@ jobs:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
### [<img id="github-comment-finder" src="https://raw.githubusercontent.com/storybookjs/brand/main/logo/logo-storybook-inverse.svg" height="32"/>](${{steps.storybook_url.outputs.replaced}})
## [Storybook demo](${{steps.storybook_url.outputs.replaced}})
### [Endringer til review](${{steps.chromatic_tests.outputs.url}}): ${{steps.chromatic_tests.outputs.changeCount}}
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
playwright:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.30.0-focal
image: mcr.microsoft.com/playwright:v1.35.1-jammy
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
+4
View File
@@ -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:
+1 -1
View File
@@ -14,7 +14,7 @@ jobs:
name: Smoketest Aksel
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.30.0-focal
image: mcr.microsoft.com/playwright:v1.35.1-jammy
steps:
- uses: actions/setup-node@v3
with:
-42
View File
@@ -1,42 +0,0 @@
name: Update Icons
on:
# schedule:
# - cron: 0 0 * * *
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Node-modules cache
uses: actions/cache@v3
id: node-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: install
if: steps.node-cache.outputs.cache-hit != 'true'
run: yarn install
- name: postinstall
if: steps.node-cache.outputs.cache-hit == 'true'
run: yarn postinstall
- name: Update Icons
run: yarn workspace @navikt/ds-icons update
env:
FIGMA_TOKEN: ${{ secrets.FIGMA_IKONER_API }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GIT_REPO }}
commit-message: "Ikoner synket fra figma"
branch: figma-icons-sync
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
delete-branch: true
title: "Ikonsynk Figma"
-39
View File
@@ -1,39 +0,0 @@
name: Update tokens
on:
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Node-modules cache
uses: actions/cache@v3
id: node-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: install
if: steps.node-cache.outputs.cache-hit != 'true'
run: yarn install
- name: postinstall
if: steps.node-cache.outputs.cache-hit == 'true'
run: yarn postinstall
- name: Update tokens
run: yarn workspace @navikt/ds-tokens update
env:
FIGMA_TOKEN: ${{ secrets.FIGMA_IKONER_API }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: figma-tokens-sync
delete-branch: true
title: "Tokens sync Figma"
commit-message: "Tokens synket fra figma"
committer: GitHub <noreply@github.com>
signoff: false
+2 -1
View File
@@ -150,4 +150,5 @@ playwright-report/
/test-results/
backup-*.tar.gz
sitemap-urls.json
*.tar.gz
*.tar.gz
searchindex.json
+5
View File
@@ -10,6 +10,11 @@ module.exports = (indexers) => {
const exampleIndexer = async (fileName: string, opts) => {
let code = readFileSync(fileName, "utf-8").toString();
code = code
.split("\n")
.filter((line) => !line.includes("withDsExample"))
.join("\n");
code = code.replace("export const args =", "const args =");
code += `\nexport default { title: "Eksempler/${fileName
+2 -10
View File
@@ -6,19 +6,11 @@ import { Meta, Canvas } from "@storybook/addon-docs";
[Dokumentasjon](https://aksel.nav.no/komponenter)
### Core
```bash
yarn add @navikt/ds-react @navikt/ds-css
```
### Interne-flater
```bash
yarn add @navikt/ds-react-internal @navikt/ds-css-internal
```
### Ikoner
## Ikoner
[Dokumentasjon](https://aksel.nav.no/ikoner)
@@ -26,7 +18,7 @@ yarn add @navikt/ds-react-internal @navikt/ds-css-internal
yarn add @navikt/aksel-icons
```
### Bruk
## Bruk
```jsx
import { Heading } from "@navikt/ds-react";
+3 -8
View File
@@ -1,5 +1,4 @@
const storyIndexers = require("./indexer");
const path = require("path");
const { mergeConfig } = require("vite");
@@ -59,15 +58,11 @@ module.exports = {
},
async viteFinal(config) {
return mergeConfig(config, {
define: { "process.env": {} },
define: {
"process.env": {},
},
resolve: {
alias: [
/*
// Example
{
find: "@components",
replacement: path.resolve(__dirname, "./src/components"),
}, */
{
find: "components",
replacement: path.resolve(
+1 -3
View File
@@ -1,12 +1,10 @@
import { RouterContext } from "next/dist/shared/lib/router-context";
import "@navikt/ds-css/index.css";
import "@navikt/ds-css-internal/index.css";
import "./layout.css";
export const parameters = {
options: {
storySort: {
method: "",
method: "alphabetical",
order: ["Intro", "ds-react", ["form"], ["Default"], "ds-icons"],
locales: "",
},
+68 -114
View File
@@ -1,183 +1,137 @@
# @navikt/aksel-icons
## 3.2.1
## 5.1.0
## 3.2.0
## 5.0.3
## 3.1.3
## 5.0.2
## 3.1.2
## 5.0.1
## 3.1.1
## 5.0.0
## 3.1.0
## 4.12.1
## 3.0.1
## 4.12.0
## 3.0.0
## 4.11.2
## 4.11.1
## 4.11.0
## 4.10.2
## 4.10.1
## 4.10.0
## 4.9.1
## 4.9.0
## 4.8.0
## 4.7.4
## 4.7.3
## 4.7.2
## 4.7.1
## 4.7.0
## 4.6.1
## 4.6.0
## 4.5.0
## 4.4.2
## 4.4.1
## 4.1.5
### Patch Changes
- Nye ikoner `ChevronRightLast` og `ChevronLeftLast` ([PR](https://github.com/navikt/aksel/pull/2054))
## 3.2.3
### Patch Changes
- 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))
+1 -1
View File
@@ -63,4 +63,4 @@ declare module "*.svg" {
## License
[MIT](https://github.com/navikt/aksel/blob/main/LICENCE)
[MIT](https://github.com/navikt/aksel/blob/main/LICENSE)
+5
View File
@@ -24,6 +24,11 @@ fs.writeFileSync(
`const metadata = ${JSON.stringify(metadata)};\n\n module.exports = metadata;`
);
fs.writeFileSync(
path.resolve(__dirname, "../dist/metadata.mjs"),
`const metadata = ${JSON.stringify(metadata)};\n\n export default metadata;`
);
fs.writeFileSync(
path.resolve(__dirname, "../dist/metadata.d.ts"),
`export type AkselIcon = {
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
!src
!*.d.ts
@@ -0,0 +1,22 @@
![](/src/assets/gh-cover.png)
# Aksel Icons plugin
Pluginen gir deg mulighet til å se gjennom og hente ut alle ikonene i fra ikonpakken `@navikt/aksel-icons`. Du slipper da å hente nye oppdateringer fra Figma Community.
Referer til [ikon-dokumentasjonen](https://aksel.nav.no/ikoner) for å se alle ikonene.
Har du ønsker om nye ikoner, eller ønsker å bidra med å lage nye, lag et issue på [GitHub-repoet for designsystemet](https://github.com/navikt/aksel).
## Quickstart
- `yarn dev` for development
- `yarn build` for production-build
### Test with Figma
- Open `Figma` -> `Plugins` -> `Development` -> `Import plugin from manifest...` and choose `manifest.json` file from this repo.
### Publish to Figma
- Open `Figma` -> `Plugins` -> `Find more plugins` -> `Publish new versions`
(requires publish-access)
@@ -0,0 +1,10 @@
{
"name": "Aksel Icons",
"id": "1221057403873975172",
"api": "1.0.0",
"main": "dist/plugin.js",
"ui": "dist/index.html",
"capabilities": [],
"enableProposedApi": false,
"editorType": ["figma", "figjam"]
}
@@ -0,0 +1,35 @@
{
"name": "aksel-icons-figma-plugin",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite -c ./vite.config.ui.ts",
"build:icon-plugin": "tsc && npm run build:ui && npm run build:plugin",
"build:ui": "vite build -c ./vite.config.ui.ts --emptyOutDir",
"build:plugin": "vite build -c ./vite.config.plugin.ts",
"preview": "vite preview"
},
"dependencies": {
"@navikt/ds-css": "*",
"@navikt/ds-react": "*",
"fuse.js": "^6.6.2",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@figma/plugin-typings": "^1.62.0",
"@svgr/core": "^6.5.1",
"@types/node": "^18.15.11",
"@types/postcss-url": "^10.0.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@vitejs/plugin-react": "^3.1.0",
"postcss": "^8.4.0",
"postcss-url": "^10.1.3",
"typescript": "^4.8.0",
"vite": "^4.2.0",
"vite-plugin-singlefile": "^0.13.3",
"vite-plugin-svgr": "^2.4.0"
}
}
@@ -0,0 +1,31 @@
/* eslint-disable import/no-anonymous-default-export */
import fs from "fs";
import { Plugin } from "vite";
function svgToDataURL(svgStr: string) {
const encoded = encodeURIComponent(svgStr)
.replace(/'/g, "%27")
.replace(/"/g, "%22");
const header = "data:image/svg+xml,";
const dataUrl = header + encoded;
return dataUrl;
}
export default function (): Plugin {
return {
name: "vite-inline-svg",
enforce: "pre",
async load(id) {
const [path, query] = id.split("?", 2);
if (!path.endsWith(".svg")) return;
if (query !== "inline") return;
const svg = await fs.promises.readFile(path, "utf-8");
return `export default "${svgToDataURL(svg)}"`;
},
};
}
@@ -0,0 +1,50 @@
import { createFilter, FilterPattern } from "@rollup/pluginutils";
import type { Config } from "@svgr/core";
import fs from "fs";
import type { Plugin } from "vite";
import { transformWithEsbuild } from "vite";
export interface ViteSvgrOptions {
svgrOptions?: Config;
esbuildOptions?: Parameters<typeof transformWithEsbuild>[2];
exclude?: FilterPattern;
include?: FilterPattern;
}
export default function viteSvgr({
svgrOptions,
esbuildOptions,
include = "**/*.svg?component",
exclude,
}: ViteSvgrOptions = {}): Plugin {
const filter = createFilter(include, exclude);
return {
name: "vite-svgr-component",
async transform(code, id) {
if (filter(id)) {
const { transform } = await import("@svgr/core");
const svgCode = await fs.promises.readFile(
id.replace(/\?.*$/, ""),
"utf8"
);
const componentCode = await transform(svgCode, svgrOptions, {
filePath: id,
caller: { previousExport: null },
});
const res = await transformWithEsbuild(componentCode, id, {
loader: "jsx",
...esbuildOptions,
});
return {
code: res.code,
map: null,
};
}
},
};
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,4 @@
<svg width="32" height="32" viewBox="0 0 170 170" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.07318 54.5734C-0.692218 51.806 -0.690888 47.3204 2.07614 44.5546L38.6019 8.04512C38.7787 7.8684 38.9576 7.69433 39.1387 7.52295L39.1205 7.50476C42.7235 3.90124 47.1588 1.63753 51.8075 0.71364C53.8316 0.243049 55.9182 1.07479e-05 58.0297 1.01387e-05L142.517 0C157.695 5.55246e-06 170 12.3065 170 27.4874V111.958C170 113.916 169.791 115.852 169.386 117.737C168.522 122.523 166.241 127.103 162.542 130.803L162.533 130.794C162.342 130.997 162.148 131.197 161.95 131.395L125.425 167.925C122.659 170.692 118.174 170.692 115.408 167.925C112.642 165.158 112.642 160.673 115.408 157.906L151.933 121.376C153.698 119.61 154.917 117.4 155.48 115.008C155.999 111.779 155.014 108.355 152.525 105.866L64.1955 17.5236C61.632 14.9597 58.0865 13.9765 54.7698 14.574C52.4605 15.1572 50.3292 16.3547 48.6162 18.0669L12.0905 54.5764C9.32349 57.3422 4.83857 57.3409 2.07318 54.5734ZM80.8759 14.1688L155.833 89.1374V27.4874C155.833 20.1317 149.871 14.1688 142.517 14.1688L80.8759 14.1688Z" fill="#004367"/>
<path d="M2.07466 167.925C-0.691554 165.158 -0.691554 160.673 2.07466 157.906L65.8247 94.1468C68.5909 91.3801 73.0758 91.3801 75.842 94.1468C78.6082 96.9134 78.6082 101.399 75.842 104.166L12.092 167.925C9.32579 170.692 4.84087 170.692 2.07466 167.925Z" fill="#004367"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,21 @@
/* eslint-disable no-restricted-globals */
/* eslint-disable no-undef */
import * as Networker from "monorepo-networker";
import { NetworkMessages } from "@common/network/messages";
import { NetworkSide } from "@common/network/sides";
export const initializeNetwork = Networker.createInitializer({
messagesRegistry: NetworkMessages.registry,
initTransports: function (register) {
register(NetworkSide.PLUGIN, NetworkSide.UI, (message) => {
// @ts-ignore
figma.ui.postMessage(message);
});
register(NetworkSide.UI, NetworkSide.PLUGIN, (message) => {
// @ts-ignore
parent.postMessage({ pluginMessage: message }, "*");
});
},
});
@@ -0,0 +1,21 @@
import { CreateRectMessage } from "@common/network/messages/CreateRectMessage";
import { HelloMessage } from "@common/network/messages/HelloMessage";
import { PingMessage } from "@common/network/messages/PingMessage";
import { NetworkSide } from "@common/network/sides";
import * as Networker from "monorepo-networker";
export namespace NetworkMessages {
export const registry = new Networker.MessageTypeRegistry();
export const PING = registry.register(new PingMessage("ping"));
export const HELLO_PLUGIN = registry.register(
new HelloMessage(NetworkSide.PLUGIN)
);
export const HELLO_UI = registry.register(new HelloMessage(NetworkSide.UI));
export const CREATE_RECT = registry.register(
new CreateRectMessage("create-rect")
);
}
@@ -0,0 +1,42 @@
/* eslint-disable no-undef */
import { NetworkSide } from "@common/network/sides";
import * as Networker from "monorepo-networker";
interface Payload {
width: number;
height: number;
}
export class CreateRectMessage extends Networker.MessageType<Payload> {
public receivingSide(): Networker.Side {
return NetworkSide.PLUGIN;
}
public handle(payload: Payload, from: Networker.Side): void {
// @ts-ignore
if (figma.editorType === "figma") {
// @ts-ignore
const rect = figma.createRectangle();
rect.x = 0;
rect.y = 0;
rect.name = "Plugin Rectangle # " + Math.floor(Math.random() * 9999);
rect.fills = [
{
type: "SOLID",
color: {
r: Math.random(),
g: Math.random(),
b: Math.random(),
},
},
];
rect.resize(payload.width, payload.height);
// @ts-ignore
figma.currentPage.appendChild(rect);
// @ts-ignore
figma.viewport.scrollAndZoomIntoView([rect]);
// @ts-ignore
figma.closePlugin();
}
}
}
@@ -0,0 +1,19 @@
import * as Networker from "monorepo-networker";
interface Payload {
text: string;
}
export class HelloMessage extends Networker.MessageType<Payload> {
constructor(private side: Networker.Side) {
super("hello-" + side.getName());
}
receivingSide(): Networker.Side {
return this.side;
}
handle(payload: Payload, from: Networker.Side) {
console.log(`${from.getName()} said "${payload.text}"`);
}
}
@@ -0,0 +1,17 @@
import * as Networker from "monorepo-networker";
import { NetworkSide } from "@common/network/sides";
interface Payload {}
type Response = string;
export class PingMessage extends Networker.MessageType<Payload, Response> {
receivingSide(): Networker.Side {
return NetworkSide.PLUGIN;
}
handle(payload: Payload, from: Networker.Side): string {
console.log(from.getName(), "has pinged us!");
return `Pong, ${from.getName()}!`;
}
}
@@ -0,0 +1,24 @@
/* eslint-disable no-undef */
import * as Networker from "monorepo-networker";
export namespace NetworkSide {
export const PLUGIN = Networker.Side.register(
new Networker.Side<MessageEvent<any>>("Plugin", {
// @ts-ignore
attachListener: (callback) => figma.ui.on("message", callback),
// @ts-ignore
detachListener: (callback) => figma.ui.off("message", callback),
})
);
export const UI = Networker.Side.register(
new Networker.Side("UI", {
shouldHandle: (event) => event.data?.pluginId != null,
messageGetter: (event) => event.data.pluginMessage,
attachListener: (callback) =>
window.addEventListener("message", callback),
detachListener: (callback) =>
window.removeEventListener("message", callback),
})
);
}
@@ -0,0 +1,48 @@
/* eslint-disable no-undef */
figma.showUI(__html__, { width: 480, height: 600 });
figma.ui.onmessage = (msg) => {
if (msg.type === "create-icon") {
const nodes = [];
const icon = figma.createNodeFromSvg(msg.svg);
icon.name = msg.name;
icon.resize(msg.size, msg.size);
nodes.push(icon);
figma.currentPage.appendChild(icon);
figma.viewport.scrollAndZoomIntoView(nodes);
figma.ui.postMessage({
type: "create-icon",
message: `Created ${msg.name} icon}`,
});
}
};
// https://github.com/figma/plugin-samples#icon-drag-and-drop
figma.on("drop", (event) => {
const { files, node } = event;
if (files.length > 0 && files[0].type === "image/svg+xml") {
files[0].getTextAsync().then((text) => {
const newNode = figma.createNodeFromSvg(text);
newNode.name = `${files[0].name.replace(".svg", "")}Icon`;
newNode.resize(24, 24);
// We can only append page nodes to documents
if ("appendChild" in node && node.type !== "DOCUMENT") {
node.appendChild(newNode);
}
newNode.x = event.x;
newNode.y = event.y;
figma.currentPage.selection = [newNode];
});
return false;
}
});
@@ -0,0 +1,193 @@
import { Heading, Search, ToggleGroup } from "@navikt/ds-react";
import Fuse from "fuse.js";
import { useEffect, useMemo, useState } from "react";
import * as Icons from "../../../";
import meta from "../../../dist/metadata";
import "./app.css";
import { categorizeIcons, getFillIcon } from "./utils";
const fuseStroke = new Fuse(
Object.values(meta).filter((x) => x.variant.toLowerCase() === "stroke"),
{
threshold: 0.2,
keys: [
{ name: "name", weight: 3 },
{ name: "category", weight: 2 },
{ name: "sub_category", weight: 2 },
{ name: "keywords", weight: 3 },
{ name: "variant", weight: 1 },
],
shouldSort: false,
}
);
const fuseFill = new Fuse(getFillIcon(Object.values(meta)), {
threshold: 0.2,
keys: [
{ name: "name", weight: 3 },
{ name: "category", weight: 2 },
{ name: "sub_category", weight: 2 },
{ name: "keywords", weight: 3 },
{ name: "variant", weight: 1 },
],
shouldSort: false,
});
const App = () => {
const [query, setQuery] = useState("");
const [toggle, setToggle] = useState<"stroke" | "fill">("stroke");
const [strokeIcons] = useState(
Object.values(meta).filter((x) => x.variant.toLowerCase() === "stroke")
);
const [fillIcons] = useState(getFillIcon(Object.values(meta)));
const categories = useMemo(() => {
if (toggle === "fill") {
return categorizeIcons(
query
? fuseFill.search(query).map((result) => result.item as any)
: fillIcons
);
}
return categorizeIcons(
query
? fuseStroke.search(query).map((result) => result.item as any)
: strokeIcons
);
}, [toggle, query, strokeIcons, fillIcons]);
const onCreate = (id: string, name: string) => {
let svg = document.getElementById(id)?.outerHTML;
let size = 24;
// eslint-disable-next-line no-restricted-globals
parent.postMessage(
{
pluginMessage: {
type: "create-icon",
svg,
size,
name,
},
},
"*"
);
};
useEffect(() => {
const dragEvent = (e) => {
// Don't proceed if the item was dropped inside the plugin window.
if (e.view.length === 0) {
return;
}
const file = new File([e.target.innerHTML], `${e.target.id}.svg`, {
type: "image/svg+xml",
});
window.parent.postMessage(
{
pluginDrop: {
clientX: e.clientX,
clientY: e.clientY,
files: [file],
name: e.target.id,
},
},
"*"
);
};
const icons = document.getElementsByClassName("icon-classname");
for (const icon of icons) {
icon.addEventListener("dragend", dragEvent);
}
return () => {
for (const icon of icons) {
icon.removeEventListener("dragend", dragEvent);
}
};
}, [categories]);
return (
<main tabIndex={-1} className="wrapper">
<form onSubmit={(e) => e.preventDefault()} className="form">
<div className="form-togglegroup">
<ToggleGroup
value={toggle}
onChange={(v) => setToggle(v as any)}
variant="neutral"
>
<ToggleGroup.Item value="stroke">Stroke</ToggleGroup.Item>
<ToggleGroup.Item value="fill">Fill</ToggleGroup.Item>
</ToggleGroup>
</div>
<div className="form-search">
<Search
variant="simple"
label="Ikonsøk"
style={{ border: "none" }}
placeholder="Søk"
autoComplete="off"
onChange={setQuery}
value={query}
clearButton={false}
/>
</div>
</form>
<div className="categories">
{categories.map((cat) => {
return (
<div key={cat.category}>
<Heading level="2" size="small" spacing>
{cat.category}
</Heading>
<div className="sub-categories">
{cat.sub_categories.map((sub) => {
return (
<div key={sub.sub_category}>
<Heading level="3" size="xsmall" className="sub-heading">
{sub.sub_category}
</Heading>
<div className="icons-wrapper">
{sub.icons.map((i) => {
const T = Icons[`${i.id}Icon`];
if (T === undefined) {
console.log(i);
return null;
}
return (
<button
key={i.id}
id={i.id}
onClick={() => {
onCreate(`icon-id-${i.id}`, `${i.id}Icon`);
}}
draggable="true"
className="icon-classname icon-button"
>
<T
font-size="2rem"
title={i.id}
id={`icon-id-${i.id}`}
/>
</button>
);
})}
</div>
</div>
);
})}
</div>
</div>
);
})}
</div>
</main>
);
};
export default App;
@@ -0,0 +1,79 @@
@import "@navikt/ds-css";
.wrapper {
background-color: var(--a-bg-default);
}
.form {
border-bottom: 1px solid var(--a-border-subtle);
position: sticky;
top: 0;
z-index: 20;
display: flex;
align-items: center;
height: fit-content;
width: 100%;
gap: 1rem;
padding-block: 0.5rem;
padding-inline: 1rem;
background-color: var(--a-bg-default);
}
.form-togglegroup {
min-width: 10rem;
}
.form-search {
display: flex;
gap: 0.5rem;
align-items: center;
width: 100%;
}
.categories {
display: grid;
width: 100%;
place-content: start;
gap: 2rem;
padding: 1.5rem;
}
.sub-categories {
display: grid;
width: 100%;
gap: 0.5rem;
}
.sub-heading {
color: var(--a-text-subtle);
margin-bottom: 0.25rem;
}
.icons-wrapper {
gap: 0.125rem;
display: flex;
flex-wrap: wrap;
}
.icon-button {
min-height: 3rem;
min-width: 3rem;
border-radius: var(--a-border-radius-small);
display: grid;
place-content: center;
background-color: var(--a-surface-default);
cursor: pointer;
border: none;
}
.icon-button:hover {
background-color: var(--a-surface-hover);
}
.icon-button:active {
background-color: var(--a-surface-neutral-subtle-hover);
}
.icon-button:focus-visible {
outline: 2px solid var(--a-border-focus);
}
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Aksel icons</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="./main.tsx"></script>
</body>
</html>
@@ -0,0 +1,9 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
@@ -0,0 +1,56 @@
import meta from "@navikt/aksel-icons/metadata";
const subCategorizeIcons = (
icons: (typeof meta)[1][]
): { sub_category: string; icons: (typeof meta)[1][] }[] => {
const categories: { sub_category: string; icons: (typeof meta)[1][] }[] = [];
for (const icon of icons) {
const i = categories.findIndex(
({ sub_category }) => icon.sub_category === sub_category
);
i !== -1
? categories[i].icons.push(icon)
: categories.push({ sub_category: icon.sub_category, icons: [icon] });
}
return categories.sort((a, b) =>
a.sub_category.localeCompare(b.sub_category)
);
};
export const categorizeIcons = (
icons: (typeof meta)[1][]
): {
category: string;
sub_categories: { sub_category: string; icons: (typeof meta)[1][] }[];
}[] => {
const categories: {
category: string;
icons: (typeof meta)[1][];
}[] = [];
for (const icon of icons) {
const i = categories.findIndex(
({ category }) => icon.category === category
);
i !== -1
? categories[i].icons.push(icon)
: categories.push({ category: icon.category, icons: [icon] });
}
return categories
.sort((a, b) => a.category.localeCompare(b.category))
.map((x) => ({ ...x, sub_categories: subCategorizeIcons(x.icons) }));
};
const noFill = (icon: (typeof meta)[1], icons: (typeof meta)[1][]) => {
const foundFill = icons.find(
(x) => x.name.endsWith("Fill") && x.name.replace("Fill", "") === icon.name
);
return !foundFill;
};
export const getFillIcon = (icons: (typeof meta)[1][]) => {
return icons.filter(
(x, _, z) => x.variant.toLowerCase() === "fill" || noFill(x, z)
);
};
+30
View File
@@ -0,0 +1,30 @@
/// <reference types="vite/client" />
declare module "*.svg?component" {
import * as React from "react";
const ReactComponent: React.FunctionComponent<
React.ComponentProps<"svg"> & { title?: string }
>;
export default ReactComponent;
}
declare module "**/metadata.mjs" {
export type AkselIcon = {
id: string;
name: string;
category: string;
sub_category: "Time";
keywords: string[];
variant: "stroke" | "fill";
updated_at: Date;
created_at: Date;
};
declare const metadata: {
[iconId: string]: AkselIcon;
};
export default metadata;
}
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "CommonJS",
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": false,
"noEmit": true,
"jsx": "react-jsx",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"rootDir": ".",
"baseUrl": ".",
"outDir": "dist/",
"sourceMap": false,
"noImplicitAny": false,
"types": ["@figma/plugin-typings"]
},
"include": [
"src/**/*.d.ts",
"src/**/*.d.ts",
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.js",
"src/**/*.jsx"
],
"exclude": ["src/common/**/*"]
}
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": [
"vite.config.plugin.ts",
"vite.config.ui.ts",
"./scripts/vite/*.ts"
]
}
@@ -0,0 +1,17 @@
import path from "path";
import { defineConfig } from "vite";
import { viteSingleFile } from "vite-plugin-singlefile";
export default defineConfig({
plugins: [viteSingleFile()],
build: {
lib: {
name: "Aksel Icons",
entry: path.resolve(__dirname, "./src/plugin/plugin.ts"),
fileName: "plugin",
formats: ["es"],
},
emptyOutDir: false,
outDir: path.resolve(__dirname, "./dist"),
},
});
@@ -0,0 +1,25 @@
import { defineConfig } from "vite";
import path from "path";
import { viteSingleFile } from "vite-plugin-singlefile";
import react from "@vitejs/plugin-react";
import inlineSvg from "./scripts/vite/vite-inline-svg";
import svgComponent from "./scripts/vite/vite-svgr-component";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), svgComponent(), inlineSvg(), viteSingleFile()],
root: path.resolve(__dirname, "./src/ui/"),
build: {
outDir: path.resolve(__dirname, "./dist"),
rollupOptions: {
input: {
ui: path.relative(__dirname, "./src/ui/index.html"),
},
output: {
entryFileNames: "[name].js",
},
},
},
});
+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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
@@ -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
@@ -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
+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
@@ -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
+1 -1
View File
@@ -7,5 +7,5 @@ keywords:
- delete
- slett
variant: Stroke
updated_at: 08.03.2023
updated_at: 24.05.2023
created_at: 07.03.2023
+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
@@ -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 -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
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-icons",
"version": "3.2.1",
"version": "5.1.0",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/ikoner",
"repository": {
@@ -53,7 +53,7 @@
"scripts": {
"create-icons": "svgr --silent --index-template config/index-template.js --out-dir src icons",
"copy-util": "copyfiles util/* src",
"copy-svg": "copyfiles -f icons/*.svg dist/svg/",
"copy-svg": "copyfiles -f 'icons/*.svg' dist/svg/",
"copy": "yarn copy-util && yarn copy-svg",
"update-metadata": "node config/metadata.js",
"build": "yarn copy && yarn create-icons && concurrently \"tsc\" \"tsc -p tsconfig.esm.json\" && node config/cleanTypes.js && yarn update-metadata",
+1
View File
@@ -0,0 +1 @@
/dist
+77
View File
@@ -0,0 +1,77 @@
# @navikt/aksel-stylelint
## 5.1.0
## 5.0.3
## 5.0.2
## 5.0.1
## 5.0.0
## 4.12.1
## 4.12.0
## 4.11.2
## 4.11.1
## 4.11.0
## 4.10.2
## 4.10.1
## 4.10.0
## 4.9.1
## 4.9.0
## 4.8.0
## 4.7.4
## 4.7.3
## 4.7.2
## 4.7.1
## 4.7.0
## 4.6.1
## 4.6.0
## 4.5.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
- La til riktige dependencies ([PR](https://github.com/navikt/aksel/pull/2017))
## 3.4.1
### Patch Changes
- Inkluderer nå dist-mappe i release
## 3.4.0
### Minor Changes
- Stylelint-pakke for Aksel ([PR](https://github.com/navikt/aksel/pull/1973))
+173
View File
@@ -0,0 +1,173 @@
# Aksel stylelint rules & plugins
This stylelint plugin is useful when working with the [Aksel design system](https://aksel.nav.no/).
It is designed to be useful for both _internal_ and _external_ developers, so _everyone_ should install this 🙌.
> **Warning**
> The version of this plugin **_MUST MATCH_** the version of the other design system packages used in your project for the linting to make sense!
> Otherwise you are very likely to get _incorrect_ errors that tell you to use the wrong token names.
# Install
```bash
yarn add -D @navikt/aksel-stylelint
npm install -D @navikt/aksel-stylelint
```
### How to configure
It should be sufficient for most cases to extend the recommended defaults.
```js
"stylelint": {
"extends": [
...
"@navikt/aksel-stylelint/recommended"
],
...
}
```
## aksel/design-token-exists
Makes sure all referenced CSS-variables with prefix `--a-` or `--ac-` exists in Aksels token-collection. As a side-effect Aksel reserves these prefixes for its design-tokens.
❌ Incorrect:
```css
html {
--a-my-own-color-bg-hover: #f2f2f2;
^^^^^^^^^^^^^^^^^^^^^^^^^
background-color: var(--a-my-own-color-bg-hover);
^^^^^^^^^^^^^^^^^^^^^^^^^
}
```
✅ Correct:
```css
html {
background-color: var(--custom-tag-surface-default);
}
```
## aksel/design-token-no-global-override
Makes sure you don't override global level tokens with `--a-`-prefix. Global/Semantic tokens are supposed to be used as is, and not overridden. That is unless you are theming your solution to match a different sub-brands or brands. In those cases we encourage to make all the changes in a single 'config'-file, then disable the rule for that file only.
❌ Incorrect:
```css
div {
--a-surface-default: #f2f2f2;
^^^^^^^^^^^^^^^^^^^
}
```
✅ Correct:
```css
div {
background-color: var(--a-surface-default);
}
```
## aksel/design-token-no-component-reference
Makes sure you don't reference component level tokens with `--ac-`-prefix. Component level tokens are only supposed to be overridden, not referenced.
This is since they are by default not defined, leading to unknown side-effects when referenced incorrectly.
❌ Incorrect:
```css
html {
stroke: var(--ac-button-loader-stroke);
^^^^^^^^^^^^^^^^^^^^^^^^^
}
```
✅ Correct:
```css
html {
--ac-button-loader-stroke: lawngreen;
}
```
## aksel/no-internal-tokens
Disallows use or override of internal Aksel design tokens. Internal tokens are not supposed to be used outside the design system, and may be changed or removed without warning. Be aware that the rule simply checks the prefix of the token, and not if it actually exists in the design system. Even if it doesn't exist, using design system prefixes should be avoided.
❌ Incorrect:
```css
a {
--__ac-some-property: pink;
} ^^^^^^^^^^^^^^^^^^^^
```
```css
a {
color: var(--__ac-some-property);
} ^^^^^^^^^^^^^^^^^^^^
```
✅ Correct:
```css
a {
--some-property: pink;
}
```
```css
a {
color: var(--some-property);
}
```
## aksel/no-class-override
Warns when trying to override design system styling by using class selectors that starts with "navds-" or "navdsi-". Overriding styles in the design system is discouraged. We want to have consistent look and feel across applications. Even if it seems to work fine now, it might break on subsequent updates in the design system.
❌ Incorrect:
```css
.navds-button {
^^^^^^^^^^^^^
}
```
```css
.some-class .navdsi-header {
} ^^^^^^^^^^^^^^
```
✅ Correct:
```css
.some-class {
}
```
## aksel/no-deprecated-classes
Warns when you try to use deprecated class names.
❌ Incorrect:
```css
.navdsi-deprecated-example {
^^^^^^^^^^^^^^^^^^^^^^^^^^
}
```
✅ Correct:
```css
.guaranteed-not-deprecated {
}
```
🐛 Found a bug? https://github.com/navikt/aksel/issues
+59
View File
@@ -0,0 +1,59 @@
{
"name": "@navikt/aksel-stylelint",
"version": "5.1.0",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/grunnleggende/kode/stylelint",
"repository": {
"type": "git",
"url": "git+https://github.com/navikt/aksel.git",
"directory": "@navikt/aksel-stylelint"
},
"keywords": [
"aksel",
"stylelint",
"config",
"linting"
],
"publishConfig": {
"access": "public"
},
"license": "MIT",
"main": "./dist/index.js",
"exports": {
"./recommended": "./dist/recommended.js"
},
"files": [
"/dist"
],
"scripts": {
"test": "jest",
"copy-css": "node -e \"require('fs').copyFileSync('../core/css/dist/index.css','dist/index.css')\"",
"copy-tokens": "node -e \"require('fs').copyFileSync('../core/css/tokens.json','dist/tokens.json')\"",
"copy": "yarn copy-css && yarn copy-tokens",
"build": "tsc -p . && concurrently \"yarn:copy-*\"",
"watch:lint": "tsc --watch -p .",
"dev": "yarn watch:lint"
},
"devDependencies": {
"@navikt/ds-css": "^5.1.0",
"@navikt/ds-tokens": "^5.1.0",
"@types/jest": "^29.0.0",
"concurrently": "7.2.1",
"copyfiles": "2.4.1",
"jest": "^29.0.0",
"jest-preset-stylelint": "^6.1.0",
"postcss-selector-parser": "^6.0.13",
"postcss-value-parser": "^4.2.0",
"stylelint": "^14.8.5",
"typescript": "^4.8.0"
},
"jest": {
"preset": "jest-preset-stylelint",
"testMatch": [
"**/*.test.ts"
],
"transform": {
"^.+\\.ts?$": "ts-jest"
}
}
}
@@ -0,0 +1,41 @@
type DeprecatedList = {
classes: string[];
message: string;
deprecatePrefix?: boolean;
}[];
export const deprecations: DeprecatedList = [
{
classes: ["navdsi-deprecated-example", "navdsi-other-deprecated-example"],
message: "Removed in vX.X.X, see documentation [link] for more information",
},
{
classes: [
"navdsi-dropdown",
"navdsi-copy-to-clipboard",
"navdsi-header",
"navdsi-timeline",
],
message:
"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",
},
{
classes: ["navds-modal__overlay"],
message:
"Removed in v5.0.0, use `.navds-modal::backdrop` and `.navds-modal--polyfilled + .backdrop` instead",
},
{
classes: ["navds-modal__button--shake"],
message: "Removed in v5.0.0",
},
{
classes: ["navds-modal__content"],
message: "Renamed to `.navds-modal__body` in v5.0.0",
},
];
+8
View File
@@ -0,0 +1,8 @@
import { createPlugin } from "stylelint";
import { rules } from "./rules";
const rulesPlugins = Object.keys(rules).map((ruleName) => {
return createPlugin(`${ruleName}`, rules[ruleName]);
});
export default rulesPlugins;
@@ -0,0 +1,11 @@
module.exports = {
plugins: ["."],
rules: {
"aksel/design-token-exists": true,
"aksel/no-internal-tokens": true,
"aksel/no-class-override": [true, { severity: "warning" }],
"aksel/no-deprecated-classes": true,
"aksel/design-token-no-global-override": true,
"aksel/design-token-no-component-reference": true,
},
};
@@ -0,0 +1,94 @@
import { getTestRule } from "jest-preset-stylelint";
import rule, { messages } from ".";
getTestRule()({
plugins: ["./dist/index.js"],
ruleName: rule.ruleName,
config: true,
accept: [
{
code: ".foo { --ac-accordion-header-bg-hover: 1px; --ac-internalheader-bg: red; }",
description: "existing '--ac-' tokens overridden",
},
{
code: ".foo { --my-custom-color: var(--a-orange-800); }",
description: "existing '--a-' token referenced",
},
],
reject: [
{
code: ".foo { --a-does-not-exist: 1px }",
description: "attempt to override nonexistent '--a-' token",
warnings: [
{
message: messages.propNotExist({ prop: "--a-does-not-exist" }),
line: 1,
endLine: 1,
column: 8,
endColumn: 26,
},
],
},
{
code: ".foo \n { \n --ac-does-not-exist: 1px; \n }",
description: "attempt to override nonexistent '--ac-' token",
message: messages.propNotExist({ prop: "--ac-does-not-exist" }),
line: 3,
endLine: 3,
column: 2,
endColumn: 21,
},
{
code: ".foo { color: var(--a-bar) }",
description: "attempt to use nonexistent token",
message: messages.valueNotExist({ prop: "color" }, "--a-bar"),
line: 1,
endLine: 1,
column: 19,
endColumn: 26,
},
{
code: ".foo { width: var(--ac-bar, --a-baz) }",
description: "attempt to use two nonexistent tokens in one var()",
warnings: [
{
message: messages.valueNotExist({ prop: "width" }, "--ac-bar"),
line: 1,
endLine: 1,
column: 19,
endColumn: 27,
},
{
message: messages.valueNotExist({ prop: "width" }, "--a-baz"),
line: 1,
endLine: 1,
column: 29,
endColumn: 36,
},
],
},
{
code: ".foo { padding: var(--a-bar) var(--a-baz); }",
description: "attempt to use two nonexistent tokens as separate vars",
warnings: [
{
message: messages.valueNotExist({ prop: "padding" }, "--a-bar"),
line: 1,
endLine: 1,
column: 21,
endColumn: 28,
},
{
message: messages.valueNotExist({ prop: "padding" }, "--a-baz"),
line: 1,
endLine: 1,
column: 34,
endColumn: 41,
},
],
},
],
});
@@ -0,0 +1,96 @@
import stylelint from "stylelint";
import valueParser from "postcss-value-parser";
import { readFileSync } from "node:fs";
import { Node as PostCSSNode } from "postcss";
import { isCustomProperty, tokenExists } from "../../utils";
const packageJson = JSON.parse(
readFileSync(`${__dirname}/../../../package.json`).toString()
);
const ruleName = "aksel/design-token-exists";
const prefix_a = "--a-";
const prefix_ac = "--ac-";
export const controlledPrefixes = [prefix_a, prefix_ac];
const packageVersion = packageJson.version;
export const messages = stylelint.utils.ruleMessages(ruleName, {
propNotExist: (node: any) =>
`("${node.prop}") does not exist in the design system.\n\n` +
`Property "${node.prop}" has a name that seems like it intends to override a design token by ` +
`using one of the following prefixes [${controlledPrefixes}]. ` +
`However, that token doesn"t seem to exist in the design system. ` +
`\n\nVersion: ${packageVersion}`,
valueNotExist: (node: any, invalidValues: string) =>
`("${invalidValues}") does not exist in the design system.\n\n` +
`Property "${node.prop}" has offending value "${invalidValues}", ` +
`and the value seems like it intends to reference a design token by ` +
`using one of the following prefixes [${controlledPrefixes}]. ` +
`However, that token doesn't seem to exist in the design system. ` +
`\n\nVersion: ${packageVersion}`,
});
const checkDeclValue = (
controlledPrefixes: string[],
value: string,
postcssResult: stylelint.PostcssResult,
rootNode: PostCSSNode
) => {
valueParser(value).walk((node) => {
if (
node.type === "word" &&
isCustomProperty(node.value) &&
controlledPrefixes.some((prefix) => node.value.startsWith(prefix)) &&
!tokenExists(controlledPrefixes, node.value)
) {
stylelint.utils.report({
message: messages.valueNotExist(rootNode, node.value),
node: rootNode,
result: postcssResult,
ruleName,
word: node.value,
});
}
});
};
const checkDeclProp = (
controlledPrefixes: string[],
prop: string,
postcssResult: stylelint.PostcssResult,
rootNode: PostCSSNode
) => {
if (
isCustomProperty(prop) &&
controlledPrefixes.some((prefix) => prop.startsWith(prefix)) &&
!tokenExists(controlledPrefixes, prop)
) {
stylelint.utils.report({
message: messages.propNotExist(rootNode),
node: rootNode,
result: postcssResult,
ruleName,
word: prop,
});
}
};
const ruleFunction: stylelint.Rule = () => {
return (postcssRoot, postcssResult) => {
postcssRoot.walkDecls((node) => {
checkDeclValue(controlledPrefixes, node.value, postcssResult, node);
checkDeclProp(controlledPrefixes, node.prop, postcssResult, node);
});
};
};
ruleFunction.ruleName = ruleName;
ruleFunction.messages = {};
ruleFunction.meta = {
url: `https://github.com/navikt/aksel/blob/main/%40navikt/aksel-stylelint/README.md#${ruleName}`,
};
export default ruleFunction;
@@ -0,0 +1,34 @@
import { getTestRule } from "jest-preset-stylelint";
import rule, { messages } from ".";
getTestRule()({
plugins: ["./dist/index.js"],
ruleName: rule.ruleName,
config: true,
accept: [
{
code: ".foo { --ac-accordion-header-bg-hover: 1px; --ac-header-bg: red; }",
description: "existing '--ac-' tokens overridden",
},
{
code: ".foo { --my-custom-color: var(--a-orange-800); }",
description: "existing '--a-' token referenced",
},
],
reject: [
{
code: ".foo { width: var(--ac-button-padding) }",
description: "attempt to use '--ac-' token",
message: messages.valueRefComponent(
{ prop: "width" },
"--ac-button-padding"
),
line: 1,
endLine: 1,
column: 19,
endColumn: 38,
},
],
});
@@ -0,0 +1,60 @@
import stylelint from "stylelint";
import { Node as PostCSSNode } from "postcss";
import valueParser from "postcss-value-parser";
import { getPackageVersion, isCustomProperty, tokenExists } from "../../utils";
const ruleName = "aksel/design-token-no-component-reference";
const packageVersion = getPackageVersion();
const prefix_ac = "--ac-";
export const messages = stylelint.utils.ruleMessages(ruleName, {
valueRefComponent: (node: any, invalidValue: string) =>
`Referencing ("${prefix_ac}*") not allowed.\n\n` +
`Property "${node.prop}" has offending value "${invalidValue}". ` +
`The value references a component level token ("${prefix_ac}"). ` +
`It is better to either reference a global level token ("--a-") or ` +
`create a custom token instead. ` +
`\n\nVersion: ${packageVersion}`,
});
const checkDeclValue = (
controlledPrefixes: string[],
value: string,
postcssResult: stylelint.PostcssResult,
rootNode: PostCSSNode
) => {
valueParser(value).walk((node) => {
if (
node.type === "word" &&
isCustomProperty(node.value) &&
node.value.startsWith(prefix_ac) &&
tokenExists(controlledPrefixes, node.value)
) {
stylelint.utils.report({
message: messages.valueRefComponent(rootNode, node.value),
node: rootNode,
result: postcssResult,
ruleName,
word: node.value,
});
}
});
};
const ruleFunction: stylelint.Rule = () => {
return (postcssRoot, postcssResult) => {
postcssRoot.walkDecls((node) => {
checkDeclValue([prefix_ac], node.value, postcssResult, node);
});
};
};
ruleFunction.ruleName = ruleName;
ruleFunction.messages = {};
ruleFunction.meta = {
url: `https://github.com/navikt/aksel/blob/main/%40navikt/aksel-stylelint/README.md#${ruleName}`,
};
export default ruleFunction;
@@ -0,0 +1,44 @@
import { getTestRule } from "jest-preset-stylelint";
import rule, { messages } from ".";
getTestRule()({
plugins: ["./dist/index.js"],
ruleName: rule.ruleName,
config: true,
accept: [
{
code: ".foo { --ac-accordion-header-bg-hover: 1px; --ac-header-bg: red; }",
description: "existing '--ac-' tokens overridden",
},
{
code: ".foo { --my-custom-color: var(--a-orange-800); }",
description: "existing '--a-' token referenced",
},
],
reject: [
{
code: ".foo { --a-surface-action: 1px }",
description: "existing '--a-' token overridden",
message: messages.propOverrideGlobal({ prop: "--a-surface-action" }),
line: 1,
endLine: 1,
column: 8,
endColumn: 26,
},
{
code: ".foo { --a-does-not-exist: 1px }",
description: "attempt to override nonexistent '--a-' token",
warnings: [
{
message: messages.propOverrideGlobal({ prop: "--a-does-not-exist" }),
line: 1,
endLine: 1,
column: 8,
endColumn: 26,
},
],
},
],
});
@@ -0,0 +1,62 @@
import stylelint from "stylelint";
import { readFileSync } from "node:fs";
import { Node as PostCSSNode } from "postcss";
import { isCustomProperty } from "../../utils";
const packageJson = JSON.parse(
readFileSync(`${__dirname}/../../../package.json`).toString()
);
const ruleName = "aksel/design-token-no-global-override";
const prefix_a = "--a-";
const packageVersion = packageJson.version;
export const messages = stylelint.utils.ruleMessages(ruleName, {
propOverrideGlobal: (node: any) =>
`Overriding ("${node.prop}*") not allowed.\n\n` +
`Property "${node.prop}" tries to override a global level token ("${prefix_a}"), this is highly discouraged. ` +
`It is better to override a component level token ("--ac-") or create a custom token instead. ` +
`Overriding global tokens should only be done when creating custom global themes.` +
`\n\nVersion: ${packageVersion}`,
});
const checkDeclProp = (
controlledPrefixes: string[],
prop: string,
postcssResult: stylelint.PostcssResult,
rootNode: PostCSSNode
) => {
if (
isCustomProperty(prop) &&
controlledPrefixes.some((prefix) => prop.startsWith(prefix))
) {
if (prop.startsWith(prefix_a)) {
stylelint.utils.report({
message: messages.propOverrideGlobal(rootNode),
node: rootNode,
result: postcssResult,
ruleName,
word: prop,
});
}
}
};
const ruleFunction: stylelint.Rule = () => {
return (postcssRoot, postcssResult) => {
postcssRoot.walkDecls((node) => {
checkDeclProp([prefix_a], node.prop, postcssResult, node);
});
};
};
ruleFunction.ruleName = ruleName;
ruleFunction.messages = {};
ruleFunction.meta = {
url: `https://github.com/navikt/aksel/blob/main/%40navikt/aksel-stylelint/README.md#${ruleName}`,
};
export default ruleFunction;
@@ -0,0 +1,31 @@
import { getTestRule } from "jest-preset-stylelint";
import rule, { messages } from ".";
getTestRule()({
plugins: ["./dist/index.js"],
ruleName: rule.ruleName,
config: true,
accept: [{ code: ".foo-navds-bar {}", description: "allowed class name" }],
reject: [
{
code: ".foo, \n .navds-button \n .bar {}",
description: "selector with disallowed class name .navds-*",
message: messages.unexpected("navds-button"),
line: 2,
endLine: 2,
column: 3,
endColumn: 15,
},
{
code: ".foo .navdsi-button \n .bar {}",
description: "selector with disallowed class name .navdsi-*",
message: messages.unexpected("navdsi-button"),
line: 1,
endLine: 1,
column: 7,
endColumn: 20,
},
],
});
@@ -0,0 +1,42 @@
import stylelint from "stylelint";
import selectorParser from "postcss-selector-parser";
const ruleName = "aksel/no-class-override";
const url =
"https://github.com/navikt/aksel/blob/main/%40navikt/aksel-stylelint/README.md#aksel/no-class-override";
const prefixes = ["navds-", "navdsi-"];
export const messages = stylelint.utils.ruleMessages(ruleName, {
unexpected: (value) =>
`("${value}") not allowed.\n\n` +
`"${value}" looks like a class name used in the design system, ` +
`because it starts with "${prefixes.join('" or "')}". ` +
"It is not recommended to override the styling in the design system.",
});
const ruleFunction: stylelint.Rule = () => {
return (postcssRoot, postcssResult) => {
postcssRoot.walkRules((node) => {
selectorParser((selectors) => {
selectors.walkClasses((className) => {
if (!prefixes.some((prefix) => className.value.startsWith(prefix))) {
return;
}
stylelint.utils.report({
message: messages.unexpected(className.value),
node,
result: postcssResult,
ruleName,
word: className.value,
});
});
}).processSync(node.selector);
});
};
};
ruleFunction.ruleName = ruleName;
ruleFunction.messages = messages;
ruleFunction.meta = { url };
export default ruleFunction;
@@ -0,0 +1,56 @@
import { getTestRule } from "jest-preset-stylelint";
import rule, { messages } from ".";
import { deprecations } from "../../deprecations";
getTestRule()({
plugins: ["./dist/index.js"],
ruleName: rule.ruleName,
config: true,
accept: [
{
code: ".navds-foo, navdsi-bar, .baz {}",
description: "allowed class names",
// Allowed because this rule only checks deprecated class names. See also aksel/no-class-override.
},
],
reject: [
{
code: ".foo, \n .navdsi-deprecated-example \n .bar {}",
description: "selector with deprecated class name 1",
message: messages.unexpected(
"navdsi-deprecated-example",
deprecations[0].message
),
line: 2,
endLine: 2,
column: 3,
endColumn: 28,
},
{
code: ".foo .navdsi-other-deprecated-example \n .bar {}",
description: "selector with deprecated class name 2",
message: messages.unexpected(
"navdsi-other-deprecated-example",
deprecations[0].message
),
line: 1,
endLine: 1,
column: 7,
endColumn: 38,
},
{
code: ".foo, \n .navdsi-dropdown-example \n .bar {}",
description: "selector with deprecated class name 1",
message: messages.unexpected(
"navdsi-dropdown-example",
deprecations[1].message
),
line: 2,
endLine: 2,
column: 3,
endColumn: 26,
},
],
});
@@ -0,0 +1,52 @@
import stylelint from "stylelint";
import selectorParser from "postcss-selector-parser";
import { deprecations } from "../../deprecations";
const ruleName = "aksel/no-deprecated-classes";
const url =
"https://github.com/navikt/aksel/blob/main/%40navikt/aksel-stylelint/README.md#aksel/no-deprecated-classes";
export const messages = stylelint.utils.ruleMessages(ruleName, {
unexpected: (value, secondaryOption) =>
`Class "${value}" is deprecated. ` + secondaryOption,
});
const ruleFunction: stylelint.Rule = () => {
return (postcssRoot, postcssResult) => {
postcssRoot.walkRules((node) => {
selectorParser((selectors) => {
selectors.walkClasses((className) => {
for (const deprecation of deprecations) {
if (
!deprecation.deprecatePrefix &&
!deprecation.classes.includes(className.value)
) {
continue;
} else if (
deprecation.deprecatePrefix &&
!deprecation.classes.some((x) => className.value.startsWith(x))
) {
return;
}
stylelint.utils.report({
message: messages.unexpected(
className.value,
deprecation.message
),
node,
result: postcssResult,
ruleName,
word: className.value,
});
}
});
}).processSync(node.selector);
});
};
};
ruleFunction.ruleName = ruleName;
ruleFunction.messages = messages;
ruleFunction.meta = { url };
export default ruleFunction;
@@ -0,0 +1,80 @@
import { getTestRule } from "jest-preset-stylelint";
import rule, { messages } from ".";
getTestRule()({
plugins: ["./dist/index.js"],
ruleName: rule.ruleName,
config: true,
accept: [
{
code: ".foo { --bar--__ac-baz: 1px }",
description: "non-internal token defined",
},
{
code: ".foo { font-size: var(--bar--__ac-baz) }",
description: "non-internal token used",
},
],
reject: [
{
code: ".foo { --__ac-bar: 1px; }",
description: "internal token overridden",
message: messages.tokenOverridden("--__ac-bar"),
line: 1,
endLine: 1,
column: 8,
endColumn: 24,
},
{
code: ".foo { color: var(--__ac-bar) }",
description: "one internal token used",
message: messages.tokenUsed("--__ac-bar", "color"),
line: 1,
endLine: 1,
column: 19,
endColumn: 29,
},
{
code: ".foo { width: var(--__ac-bar, --__ac-baz) }",
description: "two internal tokens used in one var()",
warnings: [
{
message: messages.tokenUsed("--__ac-bar", "width"),
line: 1,
endLine: 1,
column: 19,
endColumn: 29,
},
{
message: messages.tokenUsed("--__ac-baz", "width"),
line: 1,
endLine: 1,
column: 31,
endColumn: 41,
},
],
},
{
code: ".foo { padding: var(--__ac-bar) var(--__ac-baz); }",
description: "two internal tokens used as separate vars",
warnings: [
{
message: messages.tokenUsed("--__ac-bar", "padding"),
line: 1,
endLine: 1,
column: 21,
endColumn: 31,
},
{
message: messages.tokenUsed("--__ac-baz", "padding"),
line: 1,
endLine: 1,
column: 37,
endColumn: 47,
},
],
},
],
});
@@ -0,0 +1,62 @@
import stylelint from "stylelint";
import valueParser from "postcss-value-parser";
const ruleName = "aksel/no-internal-tokens";
const url =
"https://github.com/navikt/aksel/blob/main/%40navikt/aksel-stylelint/README.md#aksel/no-internal-tokens";
const prefix = "--__ac-";
export const messages = stylelint.utils.ruleMessages(ruleName, {
tokenUsed: (token, prop) =>
`("${token}") not allowed.\n\n` +
`"${token}" (inside decleration "${prop}") looks like an internal design token, ` +
`because it starts with "${prefix}". Internal tokens should not be used outside the design system.`,
tokenOverridden: (token) =>
`("${token}") not allowed.\n\n` +
`"${token}" looks like an internal design token, because it starts with "${prefix}". ` +
`Internal tokens should not be overridden.`,
});
const getInternalTokensUsed = (value: string) => {
const invalidValues: string[] = [];
valueParser(value).walk((node) => {
if (node.type === "word" && node.value.startsWith(prefix)) {
invalidValues.push(node.value);
}
});
return invalidValues;
};
const ruleFunction: stylelint.Rule = () => {
return (postcssRoot, postcssResult) => {
postcssRoot.walkDecls((node) => {
getInternalTokensUsed(node.value).forEach((token) => {
stylelint.utils.report({
message: messages.tokenUsed(token, node.prop),
node,
result: postcssResult,
ruleName,
word: token,
});
});
const isTokenOverride = node.prop.startsWith(prefix);
if (isTokenOverride) {
stylelint.utils.report({
message: messages.tokenOverridden(node.prop),
node,
result: postcssResult,
ruleName,
});
}
});
};
};
ruleFunction.ruleName = ruleName;
ruleFunction.messages = {};
ruleFunction.meta = { url };
export default ruleFunction;
@@ -0,0 +1,16 @@
import { Rule } from "stylelint";
import designTokenExists from "./aksel-design-token-exists";
import internalTokens from "./aksel-no-internal-tokens";
import classOverride from "./aksel-no-class-override";
import deprecatedClasses from "./aksel-no-deprecated-classes";
import noGlobalOverride from "./aksel-design-token-no-global-override";
import noComponentReference from "./aksel-design-token-no-component-reference";
export const rules: Record<string, Rule> = {
"aksel/design-token-exists": designTokenExists,
"aksel/design-token-no-global-override": noGlobalOverride,
"aksel/design-token-no-component-reference": noComponentReference,
"aksel/no-internal-tokens": internalTokens,
"aksel/no-class-override": classOverride,
"aksel/no-deprecated-classes": deprecatedClasses,
};
+136
View File
@@ -0,0 +1,136 @@
import { readFileSync } from "node:fs";
import valueParser from "postcss-value-parser";
export const isCustomProperty = (property) => {
return property.startsWith("--");
};
export const matchesStringOrRegExp = (input, comparison) => {
if (!Array.isArray(input)) {
return testAgainstStringOrRegExpOrArray(input, comparison);
}
for (const inputItem of input) {
const testResult = testAgainstStringOrRegExpOrArray(inputItem, comparison);
if (testResult) {
return testResult;
}
}
return false;
};
export const testAgainstStringOrRegExpOrArray = (value, comparison) => {
if (!Array.isArray(comparison)) {
return testAgainstStringOrRegExp(value, comparison);
}
for (const comparisonItem of comparison) {
const testResult = testAgainstStringOrRegExp(value, comparisonItem);
if (testResult) {
return testResult;
}
}
return false;
};
export const testAgainstStringOrRegExp = (value, comparison) => {
// If it's a RegExp, test directly
if (comparison instanceof RegExp) {
return comparison.test(value)
? { match: value, pattern: comparison }
: false;
}
// Check if it's RegExp in a string
const firstComparisonChar = comparison[0];
const lastComparisonChar = comparison[comparison.length - 1];
const secondToLastComparisonChar = comparison[comparison.length - 2];
const comparisonIsRegex =
firstComparisonChar === "/" &&
(lastComparisonChar === "/" ||
(secondToLastComparisonChar === "/" && lastComparisonChar === "i"));
const hasCaseInsensitiveFlag =
comparisonIsRegex && lastComparisonChar === "i";
// If so, create a new RegExp from it
if (comparisonIsRegex) {
const valueMatches = hasCaseInsensitiveFlag
? new RegExp(comparison.slice(1, -2), "i").test(value)
: new RegExp(comparison.slice(1, -1)).test(value);
return valueMatches ? { match: value, pattern: comparison } : false;
}
// Otherwise, it's a string. Do a strict comparison
return value === comparison ? { match: value, pattern: comparison } : false;
};
export const vendorUnprefixed = (prop) => {
return prop.replace(/^-\w+-/, "");
};
export const flattenObject = (obj) => {
const flattened = Object.keys(obj).reduce((acc, key) => {
if (typeof obj[key] === "string") {
acc.push(key);
} else {
acc.push(flattenObject(obj[key]));
}
return acc;
}, []);
return flattened.flat();
};
const tokenCSSFile = "./index.css";
const tokenJsonFile = "./tokens.json";
let allowedTokenNames = [];
export const addTokens = (
tokenJSONFile: string,
allowedTokenNames: string[]
) => {
const jsonFileBuffer = readFileSync(`${__dirname}/${tokenJSONFile}`);
const fileString = jsonFileBuffer.toString();
const flattened = flattenObject(JSON.parse(fileString));
flattened.forEach((token) => allowedTokenNames.push(token));
};
export const tokenExists = (
controlledPrefixes: string[],
inputToken: string
) => {
// "singleton" if statement (attempt at caching file parsing)
if (!allowedTokenNames.length) {
const cssFileBuffer = readFileSync(`${__dirname}/${tokenCSSFile}`);
const cssFileString = cssFileBuffer.toString();
valueParser(cssFileString).walk((node) => {
if (
node.type === "word" &&
isCustomProperty(node.value) &&
controlledPrefixes.some((prefix) => node.value.startsWith(prefix))
) {
allowedTokenNames.push(node.value);
}
});
addTokens(tokenJsonFile, allowedTokenNames);
}
return allowedTokenNames.includes(inputToken);
};
const packageJson = JSON.parse(
readFileSync(`${__dirname}/../package.json`).toString()
);
export const getPackageVersion = () => {
return packageJson.version;
};
+18
View File
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "CommonJS",
"sourceMap": false,
"esModuleInterop": true,
"target": "es2020",
"preserveWatchOutput": true,
"declaration": false,
"types": ["node", "jest", "@types/jest"],
"outDir": "dist",
"rootDir": "./src",
"resolveJsonModule": true,
"allowJs": true,
"skipLibCheck": true
},
"include": ["**/*.ts"],
"exclude": ["node_modules", "dist", "**/tests/**"]
}
+142 -69
View File
@@ -1,124 +1,197 @@
# @navikt/aksel
## 3.2.1
## 5.1.0
### Patch Changes
- Updated dependencies [[`5b78f7188`](https://github.com/navikt/aksel/commit/5b78f71884b65987a175bfdbdd332cc8406cba2d), [`54a43cf92`](https://github.com/navikt/aksel/commit/54a43cf924c63954da8c5abd901a0b8fb4498948)]:
- @navikt/ds-css@5.1.0
## 5.0.3
### Patch Changes
- Updated dependencies [[`8d934e093`](https://github.com/navikt/aksel/commit/8d934e0931caaa6f774a8f1b20fa34a19ece7218), [`8d934e093`](https://github.com/navikt/aksel/commit/8d934e0931caaa6f774a8f1b20fa34a19ece7218)]:
- @navikt/ds-css@5.0.3
## 5.0.2
### Patch Changes
- Updated dependencies []:
- @navikt/ds-css@3.2.1
- @navikt/ds-css@5.0.2
## 3.2.0
## 5.0.1
### Patch Changes
- Updated dependencies [[`affcab14c`](https://github.com/navikt/aksel/commit/affcab14c3d536929dfa64a36f5b43f9d0e8c3b7)]:
- @navikt/ds-css@3.2.0
- Updated dependencies [[`90db7dd0c`](https://github.com/navikt/aksel/commit/90db7dd0c120c16a387d3169c05c1f33dc694323)]:
- @navikt/ds-css@5.0.1
## 3.1.3
## 5.0.0
### Patch Changes
- Updated dependencies [[`e8ecf309a`](https://github.com/navikt/aksel/commit/e8ecf309a910e47fd3cea6c54cd993ab1196910f)]:
- @navikt/ds-css@3.1.3
- Updated dependencies [[`2993f809a`](https://github.com/navikt/aksel/commit/2993f809adbf26fe88237066fea7f3e1a21b6690), [`2993f809a`](https://github.com/navikt/aksel/commit/2993f809adbf26fe88237066fea7f3e1a21b6690), [`3438b5d7e`](https://github.com/navikt/aksel/commit/3438b5d7e75037889946d4f89e95cd1f91bbb2d0)]:
- @navikt/ds-css@5.0.0
## 3.1.2
## 4.12.1
### Patch Changes
- Updated dependencies [[`5cda39ce1`](https://github.com/navikt/aksel/commit/5cda39ce19fa3f25ae18a0b07dd85e97378edd26)]:
- @navikt/ds-css@4.12.1
## 4.12.0
### Patch Changes
- Updated dependencies [[`1c482e03b`](https://github.com/navikt/aksel/commit/1c482e03b845c4e6f6f1e174a58992fbeeabb52e), [`107d6f3d9`](https://github.com/navikt/aksel/commit/107d6f3d935cbc9bb94bc15cea63431cd15bbd61), [`09d41e9b6`](https://github.com/navikt/aksel/commit/09d41e9b6da5486a55faaf8088191b4a8374e420), [`a402777c7`](https://github.com/navikt/aksel/commit/a402777c70a18899ef4239b10a6335a671e26167)]:
- @navikt/ds-css@4.12.0
## 4.11.2
### Patch Changes
- Updated dependencies [[`72321e384`](https://github.com/navikt/aksel/commit/72321e3846f785318ebdba9f8e06cf13b09cd524)]:
- @navikt/ds-css@4.11.2
## 4.11.1
### Patch Changes
- Updated dependencies [[`e68ab5cb2`](https://github.com/navikt/aksel/commit/e68ab5cb2cd91c2f0234c864ee71821ed07a8203)]:
- @navikt/ds-css@4.11.1
## 4.11.0
### Patch Changes
- Updated dependencies [[`64901adcc`](https://github.com/navikt/aksel/commit/64901adccb8f19fbe06cdab4a70d47978e90e343), [`0de8238ec`](https://github.com/navikt/aksel/commit/0de8238ecf22e9f1fbc0e1b0cfe7a5cd7254901e), [`647b14a23`](https://github.com/navikt/aksel/commit/647b14a23888f82bacc4806d3afaacb5e39178fa)]:
- @navikt/ds-css@4.11.0
## 4.10.2
### Patch Changes
- Updated dependencies []:
- @navikt/ds-css@3.1.2
- @navikt/ds-css@4.10.2
## 3.1.1
## 4.10.1
### Patch Changes
- Updated dependencies [[`d3bd1202e`](https://github.com/navikt/aksel/commit/d3bd1202eddb23dd3f1f09c3e4086ff3b19737d6)]:
- @navikt/ds-css@4.10.1
## 4.10.0
### Patch Changes
- Updated dependencies [[`267799ca0`](https://github.com/navikt/aksel/commit/267799ca0ecc0c549e159f94124befb654e29331)]:
- @navikt/ds-css@4.10.0
## 4.9.1
### Patch Changes
- Updated dependencies [[`eff8a902c`](https://github.com/navikt/aksel/commit/eff8a902c50fd5ebc56616e866aa0a61b9eb5efc)]:
- @navikt/ds-css@4.9.1
## 4.9.0
### Patch Changes
- Updated dependencies [[`e033b34c3`](https://github.com/navikt/aksel/commit/e033b34c3b85fb98dd11dd0300bb20075e1b06e8)]:
- @navikt/ds-css@4.9.0
## 4.8.0
### Patch Changes
- Updated dependencies [[`8a82e1c1f`](https://github.com/navikt/aksel/commit/8a82e1c1f66ea38fca77b25d74b14926bd817dd9)]:
- @navikt/ds-css@4.8.0
## 4.7.4
### Patch Changes
- Updated dependencies [[`492cfc180`](https://github.com/navikt/aksel/commit/492cfc1801df4ab16306185345d5089e24a0d659)]:
- @navikt/ds-css@4.7.4
## 4.7.3
### Patch Changes
- Updated dependencies []:
- @navikt/ds-css@3.1.1
- @navikt/ds-css@4.7.3
## 3.1.0
## 4.7.2
### 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
- Updated dependencies [[`e6fdfdc9b`](https://github.com/navikt/aksel/commit/e6fdfdc9b44156b6eb8ebc0eda3a9259dce800ff)]:
- @navikt/ds-css@4.7.2
## 3.0.1
## 4.7.1
### Patch Changes
- Updated dependencies []:
- @navikt/ds-css@3.0.1
- @navikt/ds-css@4.7.1
## 3.0.0
## 4.7.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
- Updated dependencies [[`e3027cc19`](https://github.com/navikt/aksel/commit/e3027cc1966623433cfc2d28915273486c7bf611)]:
- @navikt/ds-css@4.7.0
## 2.9.8
## 4.6.1
### Patch Changes
- Updated dependencies [[`28430f134`](https://github.com/navikt/aksel/commit/28430f13455a8ecc10447e5e1ad75625d29c4bcb)]:
- @navikt/ds-css@4.6.1
## 4.6.0
### Patch Changes
- Updated dependencies [[`ae70bfa71`](https://github.com/navikt/aksel/commit/ae70bfa7192db46d8dea0dfb0222a857efc46be5)]:
- @navikt/ds-css@4.6.0
## 4.5.0
### Patch Changes
- Updated dependencies [[`b05958863`](https://github.com/navikt/aksel/commit/b05958863b1adadb1b6a3fcceb4477e7411b66b5), [`b05958863`](https://github.com/navikt/aksel/commit/b05958863b1adadb1b6a3fcceb4477e7411b66b5)]:
- @navikt/ds-css@4.5.0
## 4.4.2
### Patch Changes
- Updated dependencies []:
- @navikt/ds-css@2.9.8
- @navikt/ds-css@4.4.2
## 2.9.7
## 4.4.1
### Patch Changes
- Updated dependencies []:
- @navikt/ds-css@2.9.7
- Updated dependencies [[`415632675`](https://github.com/navikt/aksel/commit/4156326752eaf7a97855b33653850362dada8788)]:
- @navikt/ds-css@4.4.1
## 2.9.6
## 4.0.0
### Patch Changes
### Major Changes
- Updated dependencies []:
- @navikt/ds-css@2.9.6
- Codemod for migrering av Datepicker/Monthpicker ut av Beta. `npx @navikt/aksel codemod v4-date` ([PR](https://github.com/navikt/aksel/pull/2026))
## 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))
+40 -1
View File
@@ -22,6 +22,45 @@ To get started:
npx @navikt/aksel codemod --help
```
### v4
In v4, we moved all the components from `@navikt/ds-react-internal` to `@navikt/ds-react`. This means that you will need to update all your imports to the new package. As a part of this, Header was renamed to `InternalHeader` and all the CSS-classes was renamed to use `navds` as a prefix instead of `navdsi`.
#### react
`npx @navikt/aksel codemod v4-internal-react ...`
Rewrites all imports from `@navikt/ds-react-internal` to `@navikt/ds-react`. Remember to remove `@navikt/ds-react-internal` as a dependency after migration.
```diff
- import { Dropdown, Timeline, Header } from "@navikt/ds-react-internal";
- import { Button, CopyButton } from "@navikt/ds-react";
+ import { Button, CopyButton, Dropdown, Timeline, InternalHeader as Header } from "@navikt/ds-react";
```
#### css
`npx @navikt/aksel codemod v4-internal-css ...`
Rewrites all css with `navdsi`-prefix to `navds`-prefix. Rewrites all `.navdsi-header` classes to `.navds-internalheader`.
Remember to remove `@navikt/ds-css-internal` as a dependency after migration + remove it from you lists of imports in the CSS-bundle.
```diff
- .navdsi-dropdown
+ .navds-dropdown
- .navdsi-header
+ .navds-internalheader
- .navdsi-timeline
+ .navds-timeline
```
Note: This is a "dumb" codemod that uses a simple regex to find and replace. This can lead to unknown sideeffects, so its reccomended to scope the codemod to spesific files.
```bash
`npx @navikt/aksel codemod v4-internal-css **/*.css`
```
### v3
There is no general codemods for migrating from v2 -> v3.
@@ -203,4 +242,4 @@ This codemod can only be ran once, since the size-scale will keep decreasing for
## License
[MIT](https://github.com/navikt/aksel/blob/main/LICENCE)
[MIT](https://github.com/navikt/aksel/blob/main/LICENSE)
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel",
"version": "3.2.1",
"version": "5.1.0",
"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.2.1",
"@navikt/ds-css": "5.1.0",
"axios": "1.3.6",
"chalk": "4.1.0",
"clipboardy": "^2.3.0",
+24
View File
@@ -63,6 +63,30 @@ export const migrations: {
"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",
},
],
"v4.0.0": [
{
description:
"Replaced deprecated 'internal'-component import to 'core'-imports",
value: "v4-internal-react",
path: "v4.0.0/internal-react/internal-react",
warning:
"Remember to also run 'v4-internal-css' if you have overwritten any css-classes!",
},
{
description:
"Replaced 'navdsi'-prefixes used to overwrite internal-css to 'navds'-prefixes",
value: "v4-internal-css",
path: "v4.0.0/internal-css/internal-css",
warning:
"Remember to remove '@navikt/ds-css-internal' imports if no longer needed! Also run 'v4-internal-react' to convert internal-react imports to core-imports",
},
{
description:
"Removes all instances of UNSAFE_ for datepicker/monthpicker.",
value: "v4-date",
path: "v4.0.0/date/date",
},
],
};
export function getMigrationPath(str: string) {
@@ -1,3 +1,4 @@
import { getLineTerminator } from "../../../utils/lineterminator";
import renameProps from "../../../utils/rename-props";
/**
@@ -64,5 +65,5 @@ export default function transformer(file, api, options) {
});
}
return root.toSource(options.printOptions);
return root.toSource(getLineTerminator(file.source));
}
@@ -1,3 +1,5 @@
import { getLineTerminator } from "../../../utils/lineterminator";
/**
* @param {import('jscodeshift').FileInfo} file
* @param {import('jscodeshift').API} api
@@ -79,5 +81,5 @@ export default function transformer(file, api, options) {
});
}
return root.toSource(options.printOptions);
return root.toSource(getLineTerminator(file.source));
}
Loaded 100 of 1352 files, more files were not shown because too many files have changed in this diff. Show more