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

BorderControl: Promote to stable #65475

Merged
merged 24 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5b256ce
Export without experimental prefix
DaniGuardiola Sep 19, 2024
4332ff0
Update README
DaniGuardiola Sep 19, 2024
bf96c1c
Move Storybook stories and add redirect
DaniGuardiola Sep 19, 2024
bc7ba3a
Add changelog entries
DaniGuardiola Sep 19, 2024
a59fca9
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into s…
DaniGuardiola Sep 23, 2024
a88e769
Fix changelog.
DaniGuardiola Sep 23, 2024
256b9c4
Fix changelog (for real?)
DaniGuardiola Sep 23, 2024
a2ff408
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into s…
DaniGuardiola Sep 24, 2024
5672df5
Fix changelog
DaniGuardiola Sep 24, 2024
a2830eb
Apply feedback.
DaniGuardiola Sep 24, 2024
36e0822
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into s…
DaniGuardiola Sep 24, 2024
b5ec38f
Fix changelog
DaniGuardiola Sep 24, 2024
32a932e
Remove alpha story.
DaniGuardiola Sep 24, 2024
8eff905
README fix.
DaniGuardiola Sep 24, 2024
b043c79
Fix default in README
DaniGuardiola Sep 24, 2024
3ee9576
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into s…
DaniGuardiola Sep 27, 2024
6826228
Fix changelog
DaniGuardiola Sep 27, 2024
d357efd
Remove `showDropdownHeader` prop and the header itself.
DaniGuardiola Sep 27, 2024
c3b5386
Added `showDropdownHeader` as deprecated.
DaniGuardiola Sep 28, 2024
d13b763
Remove deprecation warning
DaniGuardiola Oct 1, 2024
9bd1c5a
Add ignores to jsdocs.
DaniGuardiola Oct 1, 2024
3956f3a
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into s…
DaniGuardiola Oct 1, 2024
c358e96
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into s…
DaniGuardiola Oct 1, 2024
8bebe21
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into s…
DaniGuardiola Oct 1, 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
2 changes: 2 additions & 0 deletions packages/components/CHANGELOG.md
Copy link
Contributor

Choose a reason for hiding this comment

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

Just flagging that this PR seems to have removed unintentionally some CHANGELOG entries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oof, bad automatic merge, let me put up a quick PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
### Deprecations

- Deprecate `__unstableComposite`, `__unstableCompositeGroup`, `__unstableCompositeItem` and `__unstableUseCompositeState`. Consumers of the package should use the stable `Composite` component instead ([#63572](https://github.com/WordPress/gutenberg/pull/63572)).
- `__experimentalBorderControl` can now be imported as a stable `BorderControl` ([#65475](https://github.com/WordPress/gutenberg/pull/65475)).

### New Features

- `Composite`: add stable version of the component ([#63569](https://github.com/WordPress/gutenberg/pull/63569)).
- `ComboboxControl`: add support for `placeholder` attribute ([#65254](https://github.com/WordPress/gutenberg/pull/65254)).
- `BoxControl`: promote to stable ([#65475](https://github.com/WordPress/gutenberg/pull/65475)).

### Enhancements

Expand Down
57 changes: 27 additions & 30 deletions packages/components/src/border-control/border-control/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# BorderControl
# BorderControl

<div class="callout callout-alert">
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
</div>
<br />
This component provides control over a border's color, style, and width.
An input control for a border's color, style, and width.

## Development guidelines

Expand All @@ -21,7 +17,7 @@ a "shape" abstraction.

```jsx
import { useState } from 'react';
import { __experimentalBorderControl as BorderControl } from '@wordpress/components';
import { BorderControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

const colors = [
Expand Down Expand Up @@ -58,49 +54,49 @@ colors are organized by multiple origins.

Each color may be an object containing a `name` and `color` value.

- Required: No
- Default: `[]`
- Required: No
- Default: `[]`

### `disableCustomColors`: `boolean`

This toggles the ability to choose custom colors.

- Required: No
- Required: No

### `disableUnits`: `boolean`

This controls whether unit selection should be disabled.

- Required: No
- Required: No

### `enableAlpha`: `boolean`

This controls whether the alpha channel will be offered when selecting
custom colors.

- Required: No
- Default: `false`
- Required: No
- Default: `false`

DaniGuardiola marked this conversation as resolved.
Show resolved Hide resolved
DaniGuardiola marked this conversation as resolved.
Show resolved Hide resolved
### `enableStyle`: `boolean`

This controls whether to support border style selection.

- Required: No
- Default: `true`
- Required: No
- Default: `true`

### `hideLabelFromVision`: `boolean`

Provides control over whether the label will only be visible to screen readers.

- Required: No
- Required: No

### `isCompact`: `boolean`

This flags the `BorderControl` to render with a more compact appearance. It
restricts the width of the control and prevents it from expanding to take up
additional space.

- Required: No
- Required: No

### `label`: `string`

Expand All @@ -109,7 +105,7 @@ If provided, a label will be generated using this as the content.
_Whether it is visible only to screen readers is controlled via
`hideLabelFromVision`._

- Required: No
- Required: No

### `onChange`: `( value?: Object ) => void`

Expand All @@ -118,38 +114,39 @@ that selects or clears, border color, style, or width.

_Note: the value may be `undefined` if a user clears all border properties._

- Required: Yes
- Required: Yes

### `shouldSanitizeBorder`: `boolean`

If opted into, sanitizing the border means that if no width or color have been
selected, the border style is also cleared and `undefined` is returned as the
new border value.

- Required: No
- Default: true
- Required: No
- Default: true

### `showDropdownHeader`: `boolean`

DaniGuardiola marked this conversation as resolved.
Show resolved Hide resolved
Whether or not to render a header for the border color and style picker
dropdown. The header includes a label for the color picker and a close button.

- Required: No
- Required: No

### `size`: `string`

Size of the control.

- Required: No
- Default: `default`
- Allowed values: `default`, `__unstable-large`
- Required: No
- Default: `default`
- Allowed values: `default`, `__unstable-large`

### `value`: `Object`

An object representing a border or `undefined`. Used to set the current border
configuration for this component.

Example:

```js
{
color: '#72aee6',
Expand All @@ -158,25 +155,25 @@ Example:
}
```

- Required: No
- Required: No

### `width`: `CSSProperties[ 'width' ]`

Controls the visual width of the `BorderControl`. It has no effect if the
`isCompact` prop is set to `true`.

- Required: No
- Required: No

### `withSlider`: `boolean`

Flags whether this `BorderControl` should also render a `RangeControl` for
additional control over a border's width.

- Required: No
- Required: No

### `__next40pxDefaultSize`: `boolean`

Start opting into the larger default height that will become the default size in a future version.

- Required: No
- Default: `false`
- Required: No
- Default: `false`
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const UnconnectedBorderControl = (
* a "shape" abstraction.
*
* ```jsx
* import { __experimentalBorderControl as BorderControl } from '@wordpress/components';
* import { BorderControl } from '@wordpress/components';
* import { __ } from '@wordpress/i18n';
*
* const colors = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { BorderControl } from '..';
import type { Border } from '../types';

const meta: Meta< typeof BorderControl > = {
title: 'Components (Experimental)/BorderControl',
title: 'Components/BorderControl',
DaniGuardiola marked this conversation as resolved.
Show resolved Hide resolved
component: BorderControl,
argTypes: {
onChange: {
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export {
isDefinedBorder as __experimentalIsDefinedBorder,
isEmptyBorder as __experimentalIsEmptyBorder,
} from './border-box-control';
export { BorderControl as __experimentalBorderControl } from './border-control';
export {
/** @deprecated Import `BorderControl` instead. */
BorderControl as __experimentalBorderControl,
DaniGuardiola marked this conversation as resolved.
Show resolved Hide resolved
BorderControl,
} from './border-control';
export {
default as __experimentalBoxControl,
applyValueToSides as __experimentalApplyValueToSides,
Expand Down
1 change: 1 addition & 0 deletions storybook/manager-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
( function redirectIfStoryMoved() {
const PREVIOUSLY_EXPERIMENTAL_COMPONENTS = [
'alignmentmatrixcontrol',
'bordercontrol',
'customselectcontrol-v2',
'dimensioncontrol',
'navigation',
Expand Down
Loading