Skip to content

Commit

Permalink
Merge pull request #1151 from dequelabs/release-v5.7.1
Browse files Browse the repository at this point in the history
chore(cauldron): Release 5.7.1
  • Loading branch information
scurker authored Aug 4, 2023
2 parents 507dc2a + 61df572 commit 67e551f
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 11 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

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.

### [5.7.1](https://github.com/dequelabs/cauldron/compare/v5.7.0...v5.7.1) (2023-08-04)


### Bug Fixes

* **react:** ensure that Field__label remains for Radio/Checkbox for better backwards compatibility ([#1150](https://github.com/dequelabs/cauldron/issues/1150)) ([f86d18e](https://github.com/dequelabs/cauldron/commit/f86d18ecfef162ddcadc5cf8dcbe9c18a364f560))
* update pagination statusLabel type to ContentNode ([#1099](https://github.com/dequelabs/cauldron/issues/1099)) ([ade57cc](https://github.com/dequelabs/cauldron/commit/ade57ccab94c357708af8f812af66a701ab0168e))
* **react:** Correctly expose `theme` and `toggleTheme` from context ([#1148](https://github.com/dequelabs/cauldron/issues/1148)) ([f3d7c4d](https://github.com/dequelabs/cauldron/commit/f3d7c4d6bdff59238d25978abf7a9b9cbaa0473a))

## [5.7.0](https://github.com/dequelabs/cauldron/compare/v5.6.2...v5.7.0) (2023-08-02)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cauldron",
"private": true,
"version": "5.7.0",
"version": "5.7.1",
"license": "MPL-2.0",
"scripts": {
"clean": "rimraf dist docs/dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deque/cauldron-react",
"version": "5.7.0",
"version": "5.7.1",
"description": "Fully accessible react components library for Deque Cauldron",
"homepage": "https://cauldron.dequelabs.com/",
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Checkbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
{...other}
/>
<label
className={classNames('Checkbox__label', {
className={classNames('Field__label Checkbox__label', {
'Field__label--disabled': disabled
})}
htmlFor={id}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
totalItems: number;
itemsPerPage?: number;
currentPage?: number;
statusLabel?: React.ReactNode;
statusLabel?: ContentNode;
firstPageLabel?: ContentNode;
previousPageLabel?: ContentNode;
nextPageLabel?: ContentNode;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/RadioGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const RadioGroup = forwardRef(
/>
<label
htmlFor={id}
className={classNames('Radio__label', {
className={classNames('Field__label Radio__label', {
'Field__label--disabled': disabled
})}
>
Expand Down
21 changes: 18 additions & 3 deletions packages/react/src/contexts/theme.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
import React, { useState, useEffect, useContext, createContext } from 'react';
import PropTypes from 'prop-types';

type Theme = 'light' | 'dark';

interface ProviderProps {
children: React.ReactNode;
context?: HTMLElement;
initialTheme?: string;
initialTheme?: Theme;
}

const LIGHT_THEME_CLASS = 'cauldron--theme-light';
const DARK_THEME_CLASS = 'cauldron--theme-dark';

const ThemeContext = createContext({});
interface State {
theme: Theme;
}

interface Methods {
toggleTheme: () => void;
}

const ThemeContext = createContext<State & Methods>({
theme: 'light',
toggleTheme: () => {
throw new Error('ThemeContext not initialized');
}
});

const ThemeProvider = ({
children,
context = document.body,
initialTheme = 'light'
}: ProviderProps) => {
const [theme, setTheme] = useState(initialTheme);
const [theme, setTheme] = useState<Theme>(initialTheme);
const getThemeFromContext = () =>
context.classList.contains(DARK_THEME_CLASS) ? 'dark' : 'light';
const toggleTheme = () =>
Expand Down
3 changes: 1 addition & 2 deletions packages/styles/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,9 @@ textarea.Field--has-error:focus:hover,
display: flex;
align-items: center;
text-align: left;
color: var(--field-label-text-color);
font-size: var(--text-size-small);
font-weight: var(--font-weight-normal);
cursor: default;
margin-bottom: unset;
}

.Field__required-text {
Expand Down
2 changes: 1 addition & 1 deletion packages/styles/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deque/cauldron-styles",
"version": "5.7.0",
"version": "5.7.1",
"license": "MPL-2.0",
"description": "deque cauldron pattern library styles",
"repository": "https://github.com/dequelabs/cauldron",
Expand Down

0 comments on commit 67e551f

Please sign in to comment.