Compare commits

..
Author SHA1 Message Date
github-actions[bot]andgithub-actions[bot] 6abc1c0f3b Version Packages (#2644)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-17 11:14:41 +01:00
Ken 1177b36f48 🐛 HelpText-state ble ikke riktig oppdatert ved klikk (#2643) 2024-01-17 11:13:00 +01:00
Ken 1580290da0 🐛 Artikler uten riktig tema ble vist på forside 2024-01-16 16:19:21 +01:00
Ken b0b3b5e477 ⚡ Er nå mulig å opt-out fra chromatic (#2630) 2024-01-16 14:16:07 +01:00
Ken ef07a8ec0f 🐛 Fikset deploy av Aksel.nav.no (#2636) 2024-01-16 14:14:53 +01:00
Ken 52147b377c ✨ createContext-utility (#2619)
* ✨ createContext-utility

* ♻️ Oppdatert createcontext med bedre API

* 📝 Oppdatert kommentarer
2024-01-16 14:05:46 +01:00
23 changed files with 177 additions and 54 deletions

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ on:
jobs:
visual_regression_test:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ignore-chromatic') }}
name: "visual regression test (chromatic)"
runs-on: ubuntu-latest
permissions:
+2
View File
@@ -1,5 +1,7 @@
# @navikt/aksel-icons
## 5.15.1
## 5.15.0
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-icons",
"version": "5.15.0",
"version": "5.15.1",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/ikoner",
"repository": {
+2
View File
@@ -1,5 +1,7 @@
# @navikt/aksel-stylelint
## 5.15.1
## 5.15.0
## 5.14.0
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-stylelint",
"version": "5.15.0",
"version": "5.15.1",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/grunnleggende/kode/stylelint",
"repository": {
@@ -35,8 +35,8 @@
"dev": "yarn watch:lint"
},
"devDependencies": {
"@navikt/ds-css": "^5.15.0",
"@navikt/ds-tokens": "^5.15.0",
"@navikt/ds-css": "^5.15.1",
"@navikt/ds-tokens": "^5.15.1",
"@types/jest": "^29.0.0",
"concurrently": "7.2.1",
"copyfiles": "2.4.1",
+7
View File
@@ -1,5 +1,12 @@
# @navikt/aksel
## 5.15.1
### Patch Changes
- Updated dependencies []:
- @navikt/ds-css@5.15.1
## 5.15.0
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel",
"version": "5.15.0",
"version": "5.15.1",
"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": "5.15.0",
"@navikt/ds-css": "5.15.1",
"axios": "1.6.0",
"chalk": "4.1.0",
"clipboardy": "^2.3.0",
+2
View File
@@ -1,5 +1,7 @@
# @navikt/ds-css
## 5.15.1
## 5.15.0
## 5.14.0
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css",
"version": "5.15.0",
"version": "5.15.1",
"description": "CSS for NAV Designsystem",
"author": "Aksel | NAV designsystem team",
"keywords": [
@@ -27,7 +27,7 @@
"css:get-version": "node config/get-version.js"
},
"devDependencies": {
"@navikt/ds-tokens": "^5.15.0",
"@navikt/ds-tokens": "^5.15.1",
"cssnano": "6.0.0",
"fast-glob": "3.2.11",
"lodash": "4.17.21",
+10
View File
@@ -1,5 +1,15 @@
# @navikt/ds-react
## 5.15.1
### Patch Changes
- HelpText: HelpText-state ble ikke riktig oppdatert ved klikk ([#2643](https://github.com/navikt/aksel/pull/2643))
- Updated dependencies []:
- @navikt/ds-tokens@5.15.1
- @navikt/aksel-icons@5.15.1
## 5.15.0
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react",
"version": "5.15.0",
"version": "5.15.1",
"description": "Aksel react-components for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
@@ -38,8 +38,8 @@
},
"dependencies": {
"@floating-ui/react": "0.25.4",
"@navikt/aksel-icons": "^5.15.0",
"@navikt/ds-tokens": "^5.15.0",
"@navikt/aksel-icons": "^5.15.1",
"@navikt/ds-tokens": "^5.15.1",
"@radix-ui/react-tabs": "1.0.0",
"@radix-ui/react-toggle-group": "1.0.0",
"clsx": "^1.2.1",
@@ -57,7 +57,7 @@ export const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
<button
{...rest}
ref={mergedRef}
onClick={composeEventHandlers(onClick, () => setOpen((x) => x))}
onClick={composeEventHandlers(onClick, () => setOpen((x) => !x))}
className={cl(className, "navds-help-text__button")}
type="button"
aria-expanded={open}
@@ -0,0 +1,67 @@
/**
* Custom createContext to consolidate context-implementation across the system
* Inspired by:
* - https://github.com/radix-ui/primitives/blob/main/packages/react/context/src/createContext.tsx
* - https://github.com/chakra-ui/chakra-ui/blob/5ec0be610b5a69afba01a9c22365155c1b519136/packages/hooks/context/src/index.ts
*/
import React, {
createContext as createReactContext,
useContext as useReactContext,
} from "react";
export interface CreateContextOptions<T> {
hookName?: string;
providerName?: string;
errorMessage?: string;
name?: string;
defaultValue?: T;
}
type ProviderProps<T> = T & { children: React.ReactNode };
export type CreateContextReturn<T> = [
(contextValues: ProviderProps<T>) => React.JSX.Element,
() => T,
];
function getErrorMessage(hook: string, provider: string) {
return `${hook} returned \`undefined\`. Seems you forgot to wrap component within ${provider}`;
}
export function createContext<T>(options: CreateContextOptions<T> = {}) {
const {
name,
hookName = "useContext",
providerName = "Provider",
errorMessage,
defaultValue,
} = options;
const Context = createReactContext<T | undefined>(defaultValue);
function Provider({ children, ...context }: ProviderProps<T>) {
// Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = React.useMemo(() => context, Object.values(context)) as T;
return <Context.Provider value={value}>{children}</Context.Provider>;
}
function useContext() {
const context = useReactContext(Context);
if (!context) {
const error = new Error(
errorMessage ?? getErrorMessage(hookName, providerName),
);
error.name = "ContextError";
Error.captureStackTrace?.(error, useContext);
throw error;
}
return context;
}
Context.displayName = name;
return [Provider, useContext] as CreateContextReturn<T>;
}
+2
View File
@@ -1,5 +1,7 @@
# @navikt/ds-tailwind
## 5.15.1
## 5.15.0
## 5.14.0
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tailwind",
"version": "5.15.0",
"version": "5.15.1",
"description": "Tailwind config based on @navikt/ds-tokens",
"author": "Aksel | NAV designsystem team",
"keywords": [
@@ -24,7 +24,7 @@
"directory": "@navikt/core/tailwind"
},
"devDependencies": {
"@navikt/ds-tokens": "^5.15.0",
"@navikt/ds-tokens": "^5.15.1",
"@types/jest": "^29.0.0",
"color": "4.2.3",
"jest": "^29.0.0",
+2
View File
@@ -1,5 +1,7 @@
# @navikt/ds-tokens
## 5.15.1
## 5.15.0
## 5.14.0
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tokens",
"version": "5.15.0",
"version": "5.15.1",
"description": "Design-tokens for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"keywords": [
+4
View File
@@ -6,6 +6,10 @@
- Ikoner: Synket ikoner med Figma. Lagt til nytt ikon `FigureChild` ([#2629](https://github.com/navikt/aksel/pull/2629))
### @navikt/ds-react
- HelpText: HelpText-state ble ikke riktig oppdatert ved klikk ([#2643](https://github.com/navikt/aksel/pull/2643))
## 5.14
### @navikt/ds-react
-1
View File
@@ -26,7 +26,6 @@ spec:
- host: hnbe3yhs.apicdn.sanity.io
- host: cdn.sanity.io
rules: []
env:
filesFrom:
- emptyDir:
medium: Memory
-1
View File
@@ -30,7 +30,6 @@ spec:
- host: hnbe3yhs.apicdn.sanity.io
- host: cdn.sanity.io
rules: []
env:
gcp:
buckets:
- name: aksel-website-prod
+5 -5
View File
@@ -16,10 +16,10 @@
"playroom"
],
"dependencies": {
"@navikt/aksel-icons": "^5.15.0",
"@navikt/ds-css": "^5.15.0",
"@navikt/ds-react": "^5.15.0",
"@navikt/ds-tailwind": "^5.15.0",
"@navikt/ds-tokens": "^5.15.0"
"@navikt/aksel-icons": "^5.15.1",
"@navikt/ds-css": "^5.15.1",
"@navikt/ds-react": "^5.15.1",
"@navikt/ds-tailwind": "^5.15.1",
"@navikt/ds-tokens": "^5.15.1"
}
}
+41 -15
View File
@@ -68,19 +68,34 @@ const query = `*[_type == "aksel_forside"][0]{
seo,
${contributorsAll}
},
"artikler": *[_type == "aksel_artikkel" && defined(publishedAt) && !(_id in ^.highlights[]._ref)] | order(publishedAt desc)[0...4]{
_type,
_id,
heading,
_createdAt,
_updatedAt,
publishedAt,
"slug": slug.current,
"tema": tema[]->title,
ingress,
seo,
${contributorsAll}
},
"artikler": select(
$preview == "true" => *[_type == "aksel_artikkel" && defined(publishedAt) && !(_id in ^.highlights[]._ref)] | order(publishedAt desc)[0...4]{
_type,
_id,
heading,
_createdAt,
_updatedAt,
publishedAt,
"slug": slug.current,
"tema": tema[]->title,
ingress,
seo,
${contributorsAll}
},
$preview != "true" => *[_type == "aksel_artikkel" && defined(publishedAt) && !(_id in ^.highlights[]._ref) && count(*[references(^._id)]) > 0] | order(publishedAt desc)[0...4]{
_type,
_id,
heading,
_createdAt,
_updatedAt,
publishedAt,
"slug": slug.current,
"tema": tema[]->title,
ingress,
seo,
${contributorsAll}
}
),
"komponenter": *[_type in ["komponent_artikkel", "ds_artikkel", "templates_artikkel"] && defined(publishedAt) && !(_id in ^.highlights[]._ref)] | order(publishedAt desc)[0...3]{
_type,
_id,
@@ -106,7 +121,13 @@ export const getStaticProps: GetStaticProps = async ({
}): Promise<PageProps> => {
const client = getClient();
const { page = null, tema = null, blocks = null } = await client.fetch(query);
const {
page = null,
tema = null,
blocks = null,
} = await client.fetch(query, {
preview: "false",
});
const validateTema = tema
.filter(
@@ -284,7 +305,12 @@ const PagePreview = (props: PageProps["props"]) => {
if (props?.preview) {
return (
<Suspense fallback={<Forside {...props} />}>
<WithPreview comp={Forside} query={query} props={props} />
<WithPreview
comp={Forside}
query={query}
props={props}
params={{ preview: "true" }}
/>
</Suspense>
);
}
+17 -17
View File
@@ -3462,7 +3462,7 @@ __metadata:
languageName: node
linkType: hard
"@navikt/aksel-icons@^5.14.0, @navikt/aksel-icons@workspace:@navikt/aksel-icons":
"@navikt/aksel-icons@^5.15.0, @navikt/aksel-icons@workspace:@navikt/aksel-icons":
version: 0.0.0-use.local
resolution: "@navikt/aksel-icons@workspace:@navikt/aksel-icons"
dependencies:
@@ -3489,8 +3489,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@navikt/aksel-stylelint@workspace:@navikt/aksel-stylelint"
dependencies:
"@navikt/ds-css": ^5.14.0
"@navikt/ds-tokens": ^5.14.0
"@navikt/ds-css": ^5.15.0
"@navikt/ds-tokens": ^5.15.0
"@types/jest": ^29.0.0
concurrently: 7.2.1
copyfiles: 2.4.1
@@ -3508,7 +3508,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@navikt/aksel@workspace:@navikt/aksel"
dependencies:
"@navikt/ds-css": 5.14.0
"@navikt/ds-css": 5.15.0
"@types/inquirer": ^9.0.3
"@types/jest": ^29.0.0
axios: 1.6.0
@@ -3532,11 +3532,11 @@ __metadata:
languageName: unknown
linkType: soft
"@navikt/ds-css@*, @navikt/ds-css@5.14.0, @navikt/ds-css@^5.14.0, @navikt/ds-css@^5.9.2, @navikt/ds-css@workspace:@navikt/core/css":
"@navikt/ds-css@*, @navikt/ds-css@5.15.0, @navikt/ds-css@^5.15.0, @navikt/ds-css@^5.9.2, @navikt/ds-css@workspace:@navikt/core/css":
version: 0.0.0-use.local
resolution: "@navikt/ds-css@workspace:@navikt/core/css"
dependencies:
"@navikt/ds-tokens": ^5.14.0
"@navikt/ds-tokens": ^5.15.0
cssnano: 6.0.0
fast-glob: 3.2.11
lodash: 4.17.21
@@ -3549,13 +3549,13 @@ __metadata:
languageName: unknown
linkType: soft
"@navikt/ds-react@*, @navikt/ds-react@^5.14.0, @navikt/ds-react@^5.9.2, @navikt/ds-react@workspace:@navikt/core/react":
"@navikt/ds-react@*, @navikt/ds-react@^5.15.0, @navikt/ds-react@^5.9.2, @navikt/ds-react@workspace:@navikt/core/react":
version: 0.0.0-use.local
resolution: "@navikt/ds-react@workspace:@navikt/core/react"
dependencies:
"@floating-ui/react": 0.25.4
"@navikt/aksel-icons": ^5.14.0
"@navikt/ds-tokens": ^5.14.0
"@navikt/aksel-icons": ^5.15.0
"@navikt/ds-tokens": ^5.15.0
"@radix-ui/react-tabs": 1.0.0
"@radix-ui/react-toggle-group": 1.0.0
"@testing-library/dom": 8.13.0
@@ -3589,11 +3589,11 @@ __metadata:
languageName: unknown
linkType: soft
"@navikt/ds-tailwind@^5.14.0, @navikt/ds-tailwind@workspace:@navikt/core/tailwind":
"@navikt/ds-tailwind@^5.15.0, @navikt/ds-tailwind@workspace:@navikt/core/tailwind":
version: 0.0.0-use.local
resolution: "@navikt/ds-tailwind@workspace:@navikt/core/tailwind"
dependencies:
"@navikt/ds-tokens": ^5.14.0
"@navikt/ds-tokens": ^5.15.0
"@types/jest": ^29.0.0
color: 4.2.3
jest: ^29.0.0
@@ -3605,7 +3605,7 @@ __metadata:
languageName: unknown
linkType: soft
"@navikt/ds-tokens@^5.14.0, @navikt/ds-tokens@workspace:@navikt/core/tokens":
"@navikt/ds-tokens@^5.15.0, @navikt/ds-tokens@workspace:@navikt/core/tokens":
version: 0.0.0-use.local
resolution: "@navikt/ds-tokens@workspace:@navikt/core/tokens"
dependencies:
@@ -8718,11 +8718,11 @@ __metadata:
version: 0.0.0-use.local
resolution: "aksel.nav.no@workspace:aksel.nav.no"
dependencies:
"@navikt/aksel-icons": ^5.14.0
"@navikt/ds-css": ^5.14.0
"@navikt/ds-react": ^5.14.0
"@navikt/ds-tailwind": ^5.14.0
"@navikt/ds-tokens": ^5.14.0
"@navikt/aksel-icons": ^5.15.0
"@navikt/ds-css": ^5.15.0
"@navikt/ds-react": ^5.15.0
"@navikt/ds-tailwind": ^5.15.0
"@navikt/ds-tokens": ^5.15.0
languageName: unknown
linkType: soft