Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cauldron): Release 6.4.0 #1482

Merged
merged 35 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
26a0753
Merge pull request #1440 from dequelabs/master
scurker Apr 3, 2024
cac9806
chore: Generate a VPAT (#1439)
github-actions[bot] Apr 3, 2024
a14cb8e
test: switch select tests to react testing library (#1386)
lsprr Apr 3, 2024
39b806d
test: switch nav item tests to react testing library (#1402)
lsprr Apr 3, 2024
fd12436
fix(react): fix BreadcrumbLink type interface to correctly allow for …
scurker Apr 5, 2024
b243bc2
test: switch tab tests to react testing library (#1377)
lsprr Apr 9, 2024
ed44118
test: switch tabs tests to react testing library (#1378)
lsprr Apr 9, 2024
dc169bb
test: switch pagination tests to react testing library (#1404)
lsprr Apr 9, 2024
362629f
docs: prevent more than one toast notification from appearing for cop…
scurker Apr 12, 2024
b25e7c3
docs: fix docs build issue (#1448)
aravind-dqi Apr 15, 2024
769262d
test: switch skip link tests to react testing library (#1416)
lsprr Apr 16, 2024
d9086ae
test: switch notice tests to react testing library (#1426)
lsprr Apr 16, 2024
cf6e034
ci: add action to update the browserslist database on a monthly basis…
scurker Apr 17, 2024
4a218a9
ci: generate screenshots via playwright for visual component testing …
scurker Apr 17, 2024
53e4b83
test: switch radio card group tests to react testing library (#1421)
lsprr Apr 17, 2024
ea1aa6d
feat(react): support use of custom classNames with Toast component (#…
tbusillo Apr 18, 2024
8ee7748
feat(styles): adjust button thin height to minimally be set to 24px (…
scurker Apr 22, 2024
3ee3378
feat(styles): allow arbitrary heading levels to be styled consistentl…
scurker Apr 22, 2024
9d93884
chore: update codeowners (#1455)
scurker Apr 22, 2024
8dfa6b4
test: switch scrim tests to react testing library (#1450)
lsprr Apr 24, 2024
b5ed8b0
feat(react): deprecate individual tooltip props for IconButton replac…
scurker Apr 24, 2024
c0eeb76
test: switch listbox tests to react testing library (#1430)
lsprr Apr 24, 2024
29fe363
docs: fix invalid JSX with IconButton (#1468)
scurker Apr 25, 2024
6aa6d6d
test: switch nav bar tests to react testing library (#1403)
lsprr Apr 30, 2024
c19d8df
test: switch top bar tests to react testing library (#1411)
lsprr Apr 30, 2024
c699993
chore: update browserlist database (#1470)
github-actions[bot] May 1, 2024
ad5e478
chore: bump actions/upload-artifact from 3 to 4 (#1471)
dependabot[bot] May 1, 2024
bf04cc9
test: switch accordion tests to react testing library (#1456)
lsprr May 7, 2024
befff6e
test: switch panel tests to react testing library (#1443)
lsprr May 7, 2024
e22033f
test: switch tag button tests to react testing library (#1458)
lsprr May 7, 2024
a4d5b52
chore: update playwright dependencies (#1475)
scurker May 10, 2024
83fae1b
chore: update pagination to use updated IconButton props (#1481)
scurker May 16, 2024
bbe8aaf
chore: fix flaky toast tests (#1480)
scurker May 16, 2024
6b5e676
fix(styles): fix issue with text overflow leading to timeline details…
scurker May 16, 2024
d7aa2d7
chore(cauldron): Release 6.4.0
May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
# Request a review from cauldron codeowners on all PRs
* @dequelabs/cauldron-codeowners

# Request a review from either design team or codeowner for screenshots
/e2e/screenshots/*.png @dequelabs/cauldron-codeowners @dequelabs/cauldron-design

# Request a review from cauldron team on docs PRs
/docs/ @dequelabs/cauldron
25 changes: 25 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ jobs:
NODE_ENV=production yarn --cwd packages/react build
- run: yarn test

screenshots:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/dependencies
with:
root: true
packages-react: true
packages-styles: true
- name: Build packages
run: |
NODE_ENV=production yarn --cwd packages/react build
NODE_ENV=production yarn --cwd packages/styles build
- name: Screenshot testing
run: |
yarn screenshots:docker
yarn screenshots
- name: Screenshot test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshot-test-results
path: ./e2e/test-results
retention-days: 14

a11y:
runs-on: ubuntu-latest
steps:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/update-browserslist-db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update Browserslist Database

on:
schedule:
# run on the 1st of every month
- cron: '15 3 1 * *'
workflow_call:

jobs:

update-browserlist-db:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Browserlist Database
run: |
git config user.name github-actions
git config user.email github-actions@github.com
npx update-browserslist-db@latest
cd packages/react && npx update-browserslist-db@latest
cd ../styles && npx update-browserslist-db@latest
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
add-paths: |
yarn.lock
packages/*/yarn.lock
commit-message: 'chore: update browserlist database'
branch: update-browserlist-database
base: develop
title: 'chore: update browserlist database'
body: |
This patch updates any outdated browserlist databases.
This PR was opened automatically by a robot :robot: :tada:
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ coverage
packages/react/lib
.DS_Store
yarn-error.log
.vscode/
.vscode/

playwright/.cache
e2e/test-results
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [6.4.0](https://github.com/dequelabs/cauldron/compare/v6.3.2...v6.4.0) (2024-05-16)


### Features

* **react:** deprecate individual tooltip props for IconButton replacing with tooltipProps ([#1465](https://github.com/dequelabs/cauldron/issues/1465)) ([b5ed8b0](https://github.com/dequelabs/cauldron/commit/b5ed8b0dbe520c34ca46dd775194ee56e3d7a960))
* **react:** support use of custom classNames with Toast component ([#1447](https://github.com/dequelabs/cauldron/issues/1447)) ([ea1aa6d](https://github.com/dequelabs/cauldron/commit/ea1aa6dc54e79d0c09817b7cff744802f52b196b))
* **styles:** adjust button thin height to minimally be set to 24px ([#1420](https://github.com/dequelabs/cauldron/issues/1420)) ([8ee7748](https://github.com/dequelabs/cauldron/commit/8ee7748b840a11b845524bca9244165c96b154b6))
* **styles:** allow arbitrary heading levels to be styled consistently for TwoColumnPanel headers ([#1454](https://github.com/dequelabs/cauldron/issues/1454)) ([3ee3378](https://github.com/dequelabs/cauldron/commit/3ee3378c33a4d027c6574b176208280b510cb312))


### Bug Fixes

* **react:** fix BreadcrumbLink type interface to correctly allow for polymorphic anchor components ([#1441](https://github.com/dequelabs/cauldron/issues/1441)) ([fd12436](https://github.com/dequelabs/cauldron/commit/fd12436069a6cfa025ce91c66892b23654262309))
* **styles:** fix issue with text overflow leading to timeline details to be misaligned ([#1479](https://github.com/dequelabs/cauldron/issues/1479)) ([6b5e676](https://github.com/dequelabs/cauldron/commit/6b5e67668c07c32346f7b2647d8ecfbc2601f410))

### [6.3.2](https://github.com/dequelabs/cauldron/compare/v6.3.1...v6.3.2) (2024-04-03)


Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ The testing methodology should account for both testing the interface of a compo

Cauldron uses [Jest](https://jestjs.io/) as its test runner to run unit tests along with [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/).

> [!IMPORTANT]
> [!IMPORTANT]
> We are currently in the process of migrating existing tests away from Enzyme to React Testing Library. New tests should **not** be written in Enzyme.

### Accessibility Testing
Expand Down
38 changes: 35 additions & 3 deletions docs/components/CopyToClipboardButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useEffect, useState } from 'react';
import React, { useRef, useEffect, useState, useMemo } from 'react';
import { IconButton, Toast } from '@deque/cauldron-react';

interface CopyToClipboardButtonProps
Expand Down Expand Up @@ -27,6 +27,38 @@ function copyTextToClipboard(text: string) {
return copied;
}

// Note: eventually we want to natively handle multiple toasts, but for now we will limit the copy toast notification
// to only display a single notification to prevent weird focus issues
const notificationsMap = new Map<Symbol, React.ComponentProps<Toast>>();
function CopyNotificationToast(
props: React.ComponentProps<Toast>
): JSX.Element {
const { show, onDismiss } = props;
const id = useMemo(() => Symbol('toast'), []);
const [deferredShow, setDeferredShow] = useState(false);

useEffect(() => {
if (show) {
Array.from(notificationsMap.values()).forEach(({ onDismiss }) => {
// force any open toasts to dismiss themselves
onDismiss();
});
notificationsMap.set(id, props);
// toast sets show via set timeout, so this matches the behavior to avoid a race condition
setTimeout(() => setDeferredShow(show));
} else {
notificationsMap.delete(id);
setDeferredShow(false);
}

return () => {
notificationsMap.delete(id);
};
}, [show]);

return <Toast {...props} show={deferredShow} />;
}

export default function CopyToClipboardButton({
value,
label = 'copy to clipboard',
Expand Down Expand Up @@ -69,14 +101,14 @@ export default function CopyToClipboardButton({
onClick={handleClick}
label={accessibleName}
/>
<Toast
<CopyNotificationToast
toastRef={toastRef}
show={showToast}
type="info"
onDismiss={handleDismiss}
>
Example copied to clipboard!
</Toast>
</CopyNotificationToast>
</>
);
}
5 changes: 4 additions & 1 deletion docs/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ function Heading({ level, children, ...props }: HeadingProps) {
);
}

function Link({ href, ...props }: React.LinkHTMLAttributes<HTMLLinkElement>) {
function Link({
href,
...props
}: React.AnchorHTMLAttributes<HTMLAnchorElement>) {
const external = href.indexOf('://') > 0 || href.indexOf('//') === 0;
return external ? (
<CauldronLink href={href} {...props} />
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/components/Breadcrumb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import {

<ComponentProps
children={true}
refType="HTMLLinkElement"
refType="HTMLAnchorElement"
/>

### BreadcrumbItem
Expand Down
48 changes: 25 additions & 23 deletions docs/pages/components/IconButton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,30 @@ Error buttons are used to indicate potentially dangerous actions.
<IconButton variant="error" icon="pencil" label="Edit" disabled />
```

### Tooltip Placement
### Tooltip Customization

Tooltip placement has a default value of `auto`, but can be fixed to a certain position if needed.
The default tooltip can be modified by setting the relevant props configuration from [Tooltip](./Tooltip). This includes all props except for `children` and `target`.

```jsx example
<IconButton icon="trash" label="Delete" tooltipPlacement="bottom" />
```

### Tooltip Variant

The tooltip style can also be customized.

```jsx example
<IconButton icon="info-circle" label="More Information" tooltipVariant="info" />
<IconButton
icon="trash"
label="Delete"
tooltipProps={{ placement: 'bottom', variant: 'info' }}
/>
```

### Offscreen Text

If there are multiple icon buttons with the same label, the visible label text can be combined with `Offscreen` to provide additional context to users using assistive technology (AT).

```jsx example
<div class="users">
<div>
User: Jason
<IconButton icon="trash" label={<>Delete User <Offscreen>Jason</Offscreen></>} />
</div>
<div>
User: Harris
<IconButton icon="trash" label={<>Delete User <Offscreen>Harris</Offscreen></>} />
</div>
<div>
User: Jason
<IconButton icon="trash" label={<>Delete User <Offscreen>Jason</Offscreen></>} />
</div>
<div>
User: Harris
<IconButton icon="trash" label={<>Delete User <Offscreen>Harris</Offscreen></>} />
</div>
```

Expand Down Expand Up @@ -112,23 +106,31 @@ If there are multiple icon buttons with the same label, the visible label text c
defaultValue: 'button',
description: 'Component to render the IconButton as.'
},
{
name: 'tooltipProps',
type: 'object',
description: 'Props to pass and configure the displayed tooltip.'
},
{
name: 'tooltipPlacement',
type: 'string',
deprecated: true,
defaultValue: 'auto',
description: 'The position of the tooltip relative to its target element.'
description: 'Deprecated, use "tooltipProps.placement" instead.'
},
{
name: 'tooltipVariant',
type: ['info', 'text', 'big'],
deprecated: true,
defaultValue: 'text',
description: 'The style of tooltip to display.'
description: 'Deprecated, use "tooltipProps.variant" instead.'
},
{
name: 'tooltipPortal',
type: ['React.Ref', 'HTMLElement'],
deprecated: true,
defaultValue: 'document.body',
description: 'The parent element to place the Tooltip in.'
description: 'Deprecated, use "tooltipProps.portal" instead.'
},
{
name: 'large',
Expand Down
1 change: 1 addition & 0 deletions docs/pages/components/Toast.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function NonDismissibleToastExample() {

<ComponentProps
children={true}
className={true}
props={[
{
name: 'type',
Expand Down
12 changes: 10 additions & 2 deletions docs/pages/components/TwoColumnPanel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import {

`TwoColumnPanel` takes in a set of columns, `ColumnLeft` and `ColumnRight` with the left column containing the list of items to choose from and the right column intended to be the currently selected item. It is expected that accessible names are provided for both of the left/right columns via `aria-label` or `aria-labelledby`.

<Note>
The heading levels provided in the below examples are the typical heading levels used for `TwoColumnPanel`. The appropriate heading levels will need to be set within context of the content of which `TwoColumnPanel` is placed.
</Note>

```jsx example
function TwoColumnPanelExample() {
const [selected, setSelected] = useState(1);
Expand Down Expand Up @@ -69,7 +73,9 @@ function TwoColumnPanelExample() {
return (
<TwoColumnPanel>
<ColumnLeft aria-labelledby="sidebar">
<ColumnHeader id="sidebar">Items</ColumnHeader>
<ColumnHeader id="sidebar">
<h2>Items</h2>
</ColumnHeader>
<nav aria-labelledby="sidebar">
<ul>
{items.map(item => (
Expand Down Expand Up @@ -152,7 +158,9 @@ function TwoColumnPanelGroupedItemsExample() {
return (
<TwoColumnPanel>
<ColumnLeft aria-labelledby="group-heading">
<ColumnHeader id="group-heading">Grouped Items</ColumnHeader>
<ColumnHeader id="group-heading">
<h2>Grouped Items</h2>
</ColumnHeader>
<ColumnList>
<ColumnGroupHeader>
<h3>Optional group heading</h3>
Expand Down
20 changes: 20 additions & 0 deletions e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG playwright_version=1.44.0
FROM mcr.microsoft.com/playwright:v$playwright_version-jammy

WORKDIR /app
COPY ./yarn.lock ./
COPY ./tsconfig.json ./
COPY ./e2e ./e2e
COPY ./packages ./packages
COPY ./playwright ./playwright
COPY ./playwright-ct.config.ts ./playwright-ct.config.ts
RUN yarn add --prefix \
playwright@$playwright_version \
@playwright/test@$playwright_version \
@playwright/experimental-ct-react17@$playwright_version \
react@^17 \
react-dom@^17 \
@fontsource/roboto@^4.5.1 \
&& rm -rf playwright/.cache

ENTRYPOINT ["/app/e2e/entrypoint.sh"]
2 changes: 2 additions & 0 deletions e2e/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
/app/node_modules/.bin/playwright test -c playwright-ct.config.ts "$@"
Loading
Loading