Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/combobox-with-autocomplete-unwanted-s…
Browse files Browse the repository at this point in the history
…crolling-while-typing
  • Loading branch information
it-vegard authored Nov 22, 2024
2 parents 838d019 + e257bf4 commit 2b71215
Show file tree
Hide file tree
Showing 281 changed files with 11,022 additions and 1,970 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- [ ] JSDoc
- [ ] Examples
- [ ] Documentation
- [ ] Documentation / Decision Records
- [ ] Storybook
- [ ] Style mappings (`@navikt/core/css/config/_mappings.js`)
- [ ] Component tokens (`@navikt/core/css/tokens.json`)
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/aksel-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ jobs:
- name: Install dependencies
run: yarn

- name: Create empty .env file (Can be removed when env-file-if-exists is implemented in node v22)
run: echo "" > ./aksel.nav.no/website/.env

- name: Build application
env:
SANITY_READ: ${{ secrets.SANITY_READ }}
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/aksel-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ jobs:
yarn boot
yarn docgen
- name: Create empty .env file (Can be removed when env-file-if-exists is implemented in node v22)
run: echo "" > ./aksel.nav.no/website/.env

- name: Update sanity sync
env:
SANITY_WRITE: ${{ secrets.SANITY_WRITE }}
Expand Down Expand Up @@ -71,9 +68,6 @@ jobs:
- name: Tests
run: yarn workspace website test

- name: Create empty .env file (Can be removed when env-file-if-exists is implemented in node v22)
run: echo "" > ./aksel.nav.no/website/.env

- name: Build application
env:
SANITY_READ: ${{ secrets.SANITY_READ }}
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/backup-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
- name: Install dependencies
run: cd aksel.nav.no/website && yarn

- name: Create empty .env file (Can be removed when env-file-if-exists is implemented in node v22)
run: echo "" > ./aksel.nav.no/website/.env

- name: Export dataset
env:
SANITY_READ: ${{ secrets.SANITY_READ }}
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,11 @@ jobs:
buildScriptName: "build:storybook-chromatic"
onlyChanged: true
untraced: "**/package.json|yarn.lock|**/*.md"
externals: \@navikt/core/css/**/*.css
externals: "**/core/css/*.css|**/core/css/baseline/*.css|**/core/css/form/*.css|**/core/css/primitives/*.css"
traceChanged: true
env:
STORYBOOK_GITHUB_SHA: ${{ github.sha }}

- name: replace storybook url
if: "!contains(github.event.head_commit.message, '[ci skip]') && github.event_name != 'push'"
uses: frabert/replace-string-action@v2
id: storybook_url
with:
pattern: "(iframe.html)"
string: ${{ steps.chromatic_tests.outputs.storybookUrl }}
replace-with: ""

- name: Get commit sha
if: "!contains(github.event.head_commit.message, '[ci skip]') && github.event_name != 'push'"
id: vars
Expand All @@ -93,7 +84,7 @@ jobs:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## [Storybook demo](${{steps.storybook_url.outputs.replaced}})
## [Storybook demo](${{steps.chromatic_tests.outputs.storybookUrl}})
[${{ 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
Expand All @@ -105,9 +96,12 @@ jobs:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## [Storybook demo](${{steps.storybook_url.outputs.replaced}})
## [Storybook demo](${{steps.chromatic_tests.outputs.storybookUrl}}) / [Chromatic](${{steps.chromatic_tests.outputs.url}})
### 📝 Endringer til review: ${{steps.chromatic_tests.outputs.changeCount}}
### [Endringer til review](${{steps.chromatic_tests.outputs.url}}): ${{steps.chromatic_tests.outputs.changeCount}}
${{ steps.chromatic_tests.outputs.errorCount > 0 && format('### ❌ Stories med feil: {0}', steps.chromatic_tests.outputs.errorCount) || '' }}
${{ steps.chromatic_tests.outputs.interactionTestFailuresCount > 0 && format('### ❌ Feilede interaksjonstester: {0}', steps.chromatic_tests.outputs.interactionTestFailuresCount) || '' }}
[${{ 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
3 changes: 0 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ jobs:
run: |
yarn boot
- name: Create empty .env file (Can be removed when env-file-if-exists is implemented in node v22)
run: echo "" > ./aksel.nav.no/website/.env

- name: Build application
env:
SANITY_READ: ${{ secrets.SANITY_READ }}
Expand Down
9 changes: 9 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

CHANGED=`git diff $1 $2 --stat -- yarn.lock | wc -l`
if [ $CHANGED -gt 0 ];
then
echo
echo "*** 🟡 yarn.lock has changed 🟡 ***"
fi
9 changes: 9 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

CHANGED=`git diff HEAD@{1} --stat -- yarn.lock | wc -l`
if [ $CHANGED -gt 0 ];
then
echo
echo "*** 🟡 yarn.lock has changed 🟡 ***"
fi
6 changes: 5 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ export default {
},
},
},
"storybook-addon-pseudo-states",
/**
* https://github.com/chromaui/storybook-addon-pseudo-states/issues/101
* Currently disabled to avoid interference with darkmode update
*/
/* "storybook-addon-pseudo-states", */
],
framework: {
name: "@storybook/react-vite",
Expand Down
78 changes: 0 additions & 78 deletions .storybook/preview.jsx

This file was deleted.

128 changes: 128 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import { withThemeByClassName } from "@storybook/addon-themes";
import { Preview } from "@storybook/react";
import React, { useLayoutEffect } from "react";
// @ts-expect-error - Temporary
import darksideCss from "@navikt/ds-css/darkside/index.css?inline";
// @ts-expect-error - Temporary
import defaultCss from "@navikt/ds-css/index.css?inline";
import { UNSAFE_AkselTheme } from "../@navikt/core/react/src/provider";
import UNSAFE_AkselLanguageProvider from "../@navikt/core/react/src/provider/i18n/LanguageProvider";
import en from "../@navikt/core/react/src/util/i18n/locales/en";
import nb from "../@navikt/core/react/src/util/i18n/locales/nb";
import nn from "../@navikt/core/react/src/util/i18n/locales/nn";
import "./layout.css";

const ModeDecorator = ({ children, mode, theme }) => {
useLayoutEffect(() => {
const style = document.createElement("style");
style.innerHTML = mode === "darkside" ? darksideCss : defaultCss;
document.head.appendChild(style);

if (mode === "darkside") {
document.body.style.setProperty("background", "var(--ax-bg-default)");
}

return () => {
document.head.removeChild(style);
document.body.style.removeProperty("background");
};
}, [mode]);

return mode === "darkside" ? (
<UNSAFE_AkselTheme theme={theme || undefined} hasBackground={false}>
{children}
</UNSAFE_AkselTheme>
) : (
children
);
};

const translations = {
nb,
nn,
en,
};

const LanguageDecorator = ({ children, language }) => {
if (language) {
return (
<UNSAFE_AkselLanguageProvider translations={translations[language]}>
{children}
</UNSAFE_AkselLanguageProvider>
);
}
return children;
};

export default {
parameters: {
options: {
storySort: {
method: "alphabetical",
order: [
"Getting started",
"ds-react",
["Primitives"],
["Default", "Controls"],
"Aksel-icons",
],
},
},
layout: "centered",
backgrounds: { disable: true },
},

globalTypes: {
mode: {
name: "Darkside",
toolbar: {
items: [
{
value: "default",
icon: "hourglass",
title: "Default (old)",
},
{ value: "darkside", icon: "beaker", title: "Darkside (new)" },
],
showName: true,
dynamicTitle: true,
},
},
language: {
toolbar: {
icon: "globe",
items: [
{ value: undefined, title: "Unset" },
{ value: "nb", right: "🇳🇴", title: "Norsk bokmål" },
{ value: "nn", right: "🇳🇴", title: "Norsk nynorsk" },
{ value: "en", right: "🇬🇧", title: "English" },
],
dynamicTitle: true,
},
},
},

initialGlobals: {
mode: "default",
},

decorators: [
(StoryFn, context) => (
<ModeDecorator mode={context.globals.mode} theme={context.globals.theme}>
<StoryFn />
</ModeDecorator>
),
(StoryFn, context) => (
<LanguageDecorator language={context.globals.language}>
<StoryFn />
</LanguageDecorator>
),
withThemeByClassName({
themes: {
light: "light",
dark: "dark",
},
defaultTheme: "light",
}),
],
} satisfies Preview;
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"cssVariables.lookupFiles": ["@navikt/core/css/dist/index.css"],
"cssVariables.lookupFiles": [
"@navikt/core/tokens/dist/tokens.css",
"@navikt/core/tokens/dist/darkside/tokens.css"
],
"eslint.problems.shortenToSingleLine": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.watcherExclude": {
Expand Down
18 changes: 18 additions & 0 deletions @navikt/aksel-icons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @navikt/aksel-icons

## 7.5.3

## 7.5.2

## 7.5.1

## 7.5.0

### Minor Changes

- Icons: 🎉 Added FileJpeg, FilePng and MedicalThermometer. ([#3332](https://github.com/navikt/aksel/pull/3332))

## 7.4.3

## 7.4.2

## 7.4.1

## 7.4.0

## 7.3.1
Expand Down
4 changes: 4 additions & 0 deletions @navikt/aksel-icons/icons/FileJpeg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2b71215

Please sign in to comment.