Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

### Bug Fixes

- `RadioControl`: Add support for disabled radio group [#77127](https://github.com/WordPress/gutenberg/pull/77127).
- `CheckboxControl`: Fix disabled styles [#77132](https://github.com/WordPress/gutenberg/pull/77132).
- `FormTokenField`: Fix disabled styles. [#77137](https://github.com/WordPress/gutenberg/pull/77137)
- `Textarea`: Fix disabled styles [#77129](https://github.com/WordPress/gutenberg/pull/77129).
- `Autocomplete`: Fix value comparison to avoid resetting block inserter in RTC ([#76980](https://github.com/WordPress/gutenberg/pull/76980)).
- `ValidatedRangeControl`: Fix `aria-label` rendered as `[object Object]` when `required` or `markWhenOptional` is set ([#77042](https://github.com/WordPress/gutenberg/pull/77042)).
- `Autocomplete`: Fix matching logic to prefer longest overlapping trigger ([#77018](https://github.com/WordPress/gutenberg/pull/77018)).

### Enhancements

- `RadioControl`: Add support for disabled radio group [#77127](https://github.com/WordPress/gutenberg/pull/77127).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixup


### Internal

- `Autocomplete`: Refactor `useAutocomplete` to use `useReducer` ([#77020](https://github.com/WordPress/gutenberg/pull/77020)).
Expand Down
20 changes: 16 additions & 4 deletions packages/components/src/checkbox-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@
.components-checkbox-control__label {
// Ensure label is aligned with checkbox along X axis
line-height: var(--checkbox-input-size);
cursor: pointer;

.components-checkbox-control:not(:has(:disabled)) & {
cursor: pointer;
}
Comment on lines +21 to +23
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tweaking the set up here so it works better with #76786.

}

.components-checkbox-control__input[type="checkbox"] {
@include checkbox-control;
background: $white;
color: $gray-900;
clear: none;
cursor: pointer;
display: inline-block;
line-height: 0;
margin: 0 $grid-unit-05 0 0;
Expand All @@ -46,12 +48,15 @@
@include button-style-outset__focus(var(--wp-admin-theme-color));
}

&:checked,
&:indeterminate {
&:not(:disabled):is(:checked, :indeterminate) {
background: $components-color-accent;
border-color: $components-color-accent;
}

&:not(:disabled) {
cursor: pointer;
}

&:checked::before {
content: none;
}
Expand Down Expand Up @@ -88,6 +93,13 @@ svg.components-checkbox-control__indeterminate {
}
}

.components-checkbox-control:has(:disabled) {
svg.components-checkbox-control__checked,
svg.components-checkbox-control__indeterminate {
fill: $components-color-gray-400;
}
}

.components-checkbox-control__help {
display: inline-block;
margin-inline-start: calc(var(--checkbox-input-size) + var(--checkbox-input-margin));
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/checkbox-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export type CheckboxControlProps = Pick<
BaseControlProps,
'__nextHasNoMarginBottom' | 'help'
> & {
/**
* Whether the checkbox should be disabled.
*/
disabled?: boolean;
/**
* A function that receives the checked state (boolean) as input.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/radio-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
opacity: 1; // Override style from wp-admin forms.css.

&:checked::before {
border-color: $components-color-gray-300;
border-color: $components-color-gray-400;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumping this up a notch in RadioControl because it wasn't dark enough in the general case (like in Checkbox where the icon lines are very thin). It's also closer to the styles we have defined in the new design system.

opacity: 1; // Override style from wp-admin forms.css.

}
Expand Down
4 changes: 2 additions & 2 deletions packages/dataviews/src/dataform/stories/layout-regular.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const fields: Field< SamplePost >[] = [
id: 'can_comment',
label: 'Allow people to leave a comment',
type: 'boolean',
Edit: 'checkbox',
Edit: 'toggle',
},
{
id: 'filesize',
Expand Down Expand Up @@ -356,14 +356,14 @@ const LayoutRegularComponent = ( {
'title',
'order',
'sticky',
'can_comment',
'author',
'status',
'reviewer',
'email',
'password',
'date',
'birthdate',
'can_comment',
'filesize',
'dimensions',
'tags',
Expand Down
Loading