Skip to content

Commit

Permalink
MERGE: main into branch
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeriRoijenga committed Jan 9, 2025
2 parents 196f4d2 + 70fcb0e commit 4ecd51e
Show file tree
Hide file tree
Showing 123 changed files with 1,880 additions and 488 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,38 @@ jobs:
folder: packages/storybook/dist/
token: ${{ secrets.GH_TOKEN }}

test-a11y:
timeout-minutes: 60
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Install pnpm package manager
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

- name: Set up Node.js version
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: .nvmrc
cache: pnpm

- name: "Restore build artifact: Storybook"
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: storybook
path: packages/storybook/dist/

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: "Accessibility tests Storybook"
run: pnpm test-storybook:ci

publish-npm:
runs-on: ubuntu-latest
needs: [lint, test]
Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@
"./packages/*",
"./proprietary/*"
],
"dependencies": {
"@storybook/test-runner": "0.21.0",
"http-server": "14.1.1",
"rimraf": "6.0.1"
},
"devDependencies": {
"@lerna-lite/cli": "3.10.1",
"@lerna-lite/publish": "3.10.1",
"@lerna-lite/run": "3.10.1",
"@types/node": "20.17.6",
"@typescript-eslint/eslint-plugin": "8.18.0",
"@typescript-eslint/parser": "8.18.0",
"concurrently": "9.1.2",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.31.0",
Expand All @@ -47,7 +53,8 @@
"stylelint": "16.11.0",
"stylelint-config-standard-scss": "13.1.0",
"stylelint-order": "6.0.4",
"typescript": "5.7.2"
"typescript": "5.7.2",
"wait-on": "8.0.1"
},
"scripts": {
"prebuild": "pnpm run clean",
Expand Down Expand Up @@ -79,11 +86,8 @@
"update-minor": "npm-check-updates --configFileName .ncurc.minor.cjs",
"update-major": "npm-check-updates --configFileName .ncurc.major.cjs",
"watch:storybook": "npm run --workspace packages/storybook storybook",
"watch:style-dictionary": "lerna run watch:style-dictionary"
},
"dependencies": {
"http-server": "14.1.1",
"rimraf": "6.0.1"
"watch:style-dictionary": "lerna run watch:style-dictionary",
"test-storybook:ci": "npm run --workspace packages/storybook playwright:install && concurrently -k -s first -n \"STORYBOOK,A11Y-TEST\" -c \"magenta,green\" \"npm run --workspace packages/storybook prod-static -- --silent\" \"wait-on tcp:6006 && npm run --workspace packages/storybook test-storybook\""
},
"packageManager": "[email protected]+sha256.b6fd0bfda555e7e584ad7e56b30c68b01d5a04f9ee93989f4b93ca8473c49c74"
}
8 changes: 4 additions & 4 deletions packages/components-css/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@use "src/breadcrumb-nav/index" as breadcrumb;
@use "src/button/index" as button;
@use "src/card/index" as card;
@use "src/code-input/index" as codeInput;
@use "src/dot-badge/index" as dotBadge;
@use "src/checkbox/index" as checkbox;
@use "src/figure/index" as figure;
Expand All @@ -32,7 +33,9 @@
@use "src/navbar/index" as navbar;
@use "src/message-list/index" as messageList;
@use "src/navigation-list/index" as navigationList;
@use "src/number-badge/index" as numberBadge;
@use "src/ordered-list/index" as orderedList;
@use "src/pre-heading/index" as preHeading;
@use "src/radio/index" as radio;
@use "src/radio-group/index" as radioGroup;
@use "src/select/index" as select;
Expand All @@ -41,11 +44,8 @@
@use "src/skip-link/index" as skipLink;
@use "src/table/index" as table;
@use "src/textarea/index" as textarea;
@use "src/textinput/index" as textinput;
@use "src/text-input/index" as textinput;
@use "src/toggletip/index" as toggletip;
@use "src/unordered-list/index" as unorderedList;
@use "src/badgecounter/index" as badgecounter;
@use "src/pre-heading/index" as preHeading;
@use "src/code-input/index" as codeInput;
@use "src/visually-hidden/index" as visually-hidden;
@use "src/wrapper/index" as wrapper;
2 changes: 1 addition & 1 deletion packages/components-css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rijkshuisstijl-community/components-css",
"version": "1.0.0-alpha.104",
"version": "1.0.0-alpha.112",
"type": "module",
"author": "Community for NL Design System",
"description": "CSS Components for a design system based on the NL Design System architecture",
Expand Down
6 changes: 3 additions & 3 deletions packages/components-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rijkshuisstijl-community/components-react",
"version": "1.0.0-alpha.80",
"version": "1.0.0-alpha.88",
"author": "Community for NL Design System",
"description": "React component library for the Rijkshuisstijl Community repository, based on the NL Design System architecture",
"license": "EUPL-1.2",
Expand Down Expand Up @@ -80,7 +80,7 @@
"vite-plugin-runtime-config": "1.0.2"
},
"peerDependencies": {
"react": "19",
"react-dom": "19"
"react": ">=18.2.0",
"react-dom": ">=18.2.0"
}
}
78 changes: 42 additions & 36 deletions packages/components-react/src/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
import { Heading, Paragraph, Alert as UtrechtAlert } from '@utrecht/component-library-react';
import clsx from 'clsx';
import { ForwardedRef, forwardRef, PropsWithChildren, ReactNode } from 'react';
import { PropsWithChildren, ReactNode, RefObject } from 'react';
import { Icon } from './icon/Icon';

export interface AlertProps {
ref?: RefObject<HTMLDivElement>;
type: 'info' | 'ok' | 'warning' | 'error';
heading?: ReactNode;
headingLevel?: 1 | 2 | 3 | 4 | 5;
textContent?: ReactNode;
}
export const Alert = forwardRef(
(
{ type, heading, headingLevel, textContent, children, ...restProps }: PropsWithChildren<AlertProps>,
ref: ForwardedRef<HTMLDivElement>,
) => {
return (
<UtrechtAlert className="rhc-alert" ref={ref} type={type} {...restProps}>
<div
className={clsx('rhc-alert__icon-container', {
'rhc-alert__icon-container--ok': type === 'ok',
'rhc-alert__icon-container--error': type === 'error',
'rhc-alert__icon-container--warning': type === 'warning',
'rhc-alert__icon-container--info': type === 'info',
})}
>
<Icon
icon={
type === 'info'
? 'info-circle'
: type === 'ok'
? 'circle-check'
: type === 'warning'
? 'let-op'
: 'alert-circle'
}
/>
</div>
<div>
export const Alert = ({
ref,
type,
heading,
headingLevel,
textContent,
children,
...restProps
}: PropsWithChildren<AlertProps>) => {
return (
<UtrechtAlert className="rhc-alert" ref={ref} type={type} {...restProps}>
<div
className={clsx('rhc-alert__icon-container', {
'rhc-alert__icon-container--ok': type === 'ok',
'rhc-alert__icon-container--error': type === 'error',
'rhc-alert__icon-container--warning': type === 'warning',
'rhc-alert__icon-container--info': type === 'info',
})}
>
<Icon
icon={
type === 'info'
? 'info-circle'
: type === 'ok'
? 'circle-check'
: type === 'warning'
? 'let-op'
: 'alert-circle'
}
/>
</div>
<div>
{heading && (
<Heading appearance="utrecht-heading-5" level={headingLevel || 3}>
{heading}
</Heading>
<Paragraph>{textContent}</Paragraph>
{children}
</div>
</UtrechtAlert>
);
},
);
)}
<Paragraph>{textContent}</Paragraph>
{children}
</div>
</UtrechtAlert>
);
};

Alert.displayName = 'Alert';
11 changes: 1 addition & 10 deletions packages/components-react/src/Article.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import { Article as UtrechtArticle, ArticleProps as UtrechtArticleProps } from '@utrecht/component-library-react';
import { ForwardedRef, forwardRef, PropsWithChildren } from 'react';

export const Article = forwardRef(
(props: PropsWithChildren<UtrechtArticleProps>, ref: ForwardedRef<HTMLDivElement>) => {
return <UtrechtArticle ref={ref} {...props}></UtrechtArticle>;
},
);

Article.displayName = 'Article';
export { Article, type ArticleProps } from '@utrecht/component-library-react';
4 changes: 3 additions & 1 deletion packages/components-react/src/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface FullBleedCardProps extends CardPropsBase {
imageSrc: string;
description?: ReactNode;
metadata?: ReactNode;
imageAlt?: string;
}

export interface HorizontalImageCardProps extends CardPropsBase {
Expand Down Expand Up @@ -113,6 +114,7 @@ export const FullBleedCard = forwardRef(
description,
metadata,
className,
imageAlt,
...restProps
}: PropsWithChildren<FullBleedCardProps>,
ref: ForwardedRef<HTMLAnchorElement>,
Expand All @@ -124,7 +126,7 @@ export const FullBleedCard = forwardRef(
title={title}
{...restProps}
>
{<Image className="rhc-card__image" src={imageSrc} />}
{<Image alt={imageAlt} className="rhc-card__image" src={imageSrc} />}
<div className="rhc-card__content">
<div className="rhc-card__heading">{heading}</div>
<div className="rhc-card__description">{description}</div>
Expand Down
5 changes: 4 additions & 1 deletion packages/components-react/src/FileInput.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '@testing-library/jest-dom';

import { fireEvent, render, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { FileInput, FileInputProps } from './FileInput';
Expand All @@ -10,6 +9,7 @@ beforeAll(() => {

describe('File Input tests', () => {
const defaultProps: FileInputProps = {
ref: { current: document.createElement('input') },
buttonText: 'Bestanden kiezen',
maxFileSizeInBytes: 10_485_760,
allowedFileTypes: '.doc,.docx,.xlsx,.pdf,.zip,.jpg,.png,.bmp,.gif',
Expand All @@ -30,6 +30,7 @@ describe('File Input tests', () => {
const mockOnFileChange = jest.fn();

const propsTest: FileInputProps = {
ref: { current: document.createElement('input') },
buttonText: 'Bestanden kiezen',
maxFileSizeInBytes: 10_485_760,
allowedFileTypes: '.doc,.docx,.xlsx,.pdf,.zip,.jpg,.png,.bmp,.gif',
Expand Down Expand Up @@ -57,6 +58,7 @@ describe('File Input tests', () => {
const mockOnFileChange = jest.fn();

const propsTest: FileInputProps = {
ref: { current: document.createElement('input') },
buttonText: 'Bestanden kiezen',
maxFileSizeInBytes: 10_485_760,
allowedFileTypes: '.doc,.docx,.xlsx,.pdf,.zip,.jpg,.png,.bmp,.gif',
Expand Down Expand Up @@ -87,6 +89,7 @@ describe('File Input tests', () => {
const mockOnFileChange = jest.fn();

const propsTest: FileInputProps = {
ref: { current: document.createElement('input') },
buttonText: 'Bestanden kiezen',
maxFileSizeInBytes: 10_485_760,
allowedFileTypes: '.doc,.docx,.xlsx,.pdf,.zip,.jpg,.bmp,.gif', // Removed .png from allow list
Expand Down
Loading

0 comments on commit 4ecd51e

Please sign in to comment.