Skip to content

Commit e91973d

Browse files
aduthntsekourasciampo
authored andcommitted
Components: Add missing descriptions for design system components (WordPress#79460)
* Components: Add missing descriptions for design system components * Components: Add missing descriptions for design system components * Automated Testing: Disable require-param for tsx files project-wide The already-documented rationale for this override isn't specific to these few packages and should apply for any `.tsx` file throughout the project. * Automated Testing: Restore Storybook wildcard extension for disabling reuqire-param Not all of these files are `.tsx`, so the pattern simplification inadvertently started checking some files previously overridden to ignore * Add CHANGELOG notes * Components: Fix duplicate "by" Co-Authored-By: Nik Tsekouras <16275880+ntsekouras@users.noreply.github.com> * Use code formatting for component name in description Co-Authored-By: Marco Ciampini <1083581+ciampo@users.noreply.github.com> * Components: Clarify that NumberControl is an input Co-Authored-By: Marco Ciampini <1083581+ciampo@users.noreply.github.com> --------- Co-authored-by: Nik Tsekouras <16275880+ntsekouras@users.noreply.github.com> Co-authored-by: Marco Ciampini <1083581+ciampo@users.noreply.github.com> Co-authored-by: aduth <aduth@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org>
1 parent f1b391f commit e91973d

14 files changed

Lines changed: 56 additions & 7 deletions

File tree

packages/components/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
### Documentation
5050

5151
- `Menu`: Fix `overriden` typo to `overridden` in `CheckboxItemProps` and `RadioItemProps`. ([#79331](https://github.com/WordPress/gutenberg/pull/79331))
52+
- Add component documentation for `ColorPicker`, `CustomSelectControl`, `Navigator`, `NumberControl`, `ResizableBox`, and `Slot` components ([#79460](https://github.com/WordPress/gutenberg/pull/79460)).
5253

5354
### Code Quality
5455

packages/components/src/color-picker/component.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ const UnconnectedColorPicker = (
247247
);
248248
};
249249

250+
/**
251+
* `ColorPicker` lets users select a color from a visual color surface, or by
252+
* editing its hex, RGB, or HSL values.
253+
*/
250254
export const ColorPicker = contextConnect(
251255
UnconnectedColorPicker,
252256
'ColorPicker'

packages/components/src/color-picker/stories/index.story.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import { ColorPicker } from '../component';
1212
const meta: Meta< typeof ColorPicker > = {
1313
tags: [ 'manifest' ],
1414
component: ColorPicker,
15+
// Temporary: Due to an upstream bug, render the root explicitly so the
16+
// components manifest extractor can resolve props from the JSX.
17+
//
18+
// See: https://github.com/storybookjs/storybook/issues/34877
19+
render: ( args ) => <ColorPicker { ...args } />,
1520
title: 'Components/Selection & Input/Color/ColorPicker',
1621
id: 'components-colorpicker',
1722
argTypes: {

packages/components/src/custom-select-control/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ function getDescribedBy( currentName: string, describedBy?: string ) {
5252
return sprintf( __( 'Currently selected: %s' ), currentName );
5353
}
5454

55+
/**
56+
* `CustomSelectControl` is a dropdown for selecting a single option from a
57+
* list, with support for custom styling. Use it instead of the `SelectControl`
58+
* when options need richer markup (e.g. per-option styles or hints).
59+
*/
5560
function CustomSelectControl< T extends CustomSelectOption >(
5661
props: CustomSelectProps< T >
5762
) {

packages/components/src/navigator/stories/index.story.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ const meta: Meta< typeof Navigator > = {
1919
Button: Navigator.Button,
2020
BackButton: Navigator.BackButton,
2121
},
22+
// Temporary: Due to an upstream bug, render the root explicitly so the
23+
// components manifest extractor can resolve props from the JSX.
24+
//
25+
// See: https://github.com/storybookjs/storybook/issues/34877
26+
render: ( args ) => <Navigator { ...args } />,
2227
title: 'Components/Navigation/Navigator',
2328
id: 'components-navigator',
2429
argTypes: {

packages/components/src/number-control/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ function UnforwardedNumberControl(
276276
);
277277
}
278278

279+
/**
280+
* `NumberControl` is a text input control that lets users enter and adjust a
281+
* numeric value.
282+
*/
279283
export const NumberControl = forwardRef( UnforwardedNumberControl );
280284
NumberControl.displayName = 'NumberControl';
281285

packages/components/src/resizable-box/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ function UnforwardedResizableBox(
132132
);
133133
}
134134

135+
/**
136+
* `ResizableBox` wraps content in a container with draggable handles, letting
137+
* users interactively resize it along one or more edges or corners.
138+
*/
135139
export const ResizableBox = forwardRef( UnforwardedResizableBox );
136140
ResizableBox.displayName = 'ResizableBox';
137141

packages/components/src/slot-fill/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ import type {
3030

3131
export { Fill };
3232

33+
/**
34+
* `Slot` marks a location where content rendered by matching `Fill` components
35+
* elsewhere will appear. Use it to allow a component to define UI areas that
36+
* can be extended from other parts of the application.
37+
*/
3338
export const Slot = forwardRef(
3439
(
3540
props: SlotComponentProps &

packages/dataviews/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
### Documentation
2323

24-
- Fix `overriden` typo to `overridden` in README. ([#79331](https://github.com/WordPress/gutenberg/pull/79331))
24+
- Fix `overriden` typo to `overridden` in README. ([#79331](https://github.com/WordPress/gutenberg/pull/79331))
25+
- Add component documentation for `DataViews`, `DataViewsPicker`, and `DataForm` components ([#79460](https://github.com/WordPress/gutenberg/pull/79460)).
2526

2627
### Internal
2728

packages/dataviews/src/dataform/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import { DataFormProvider } from '../components/dataform-context';
1212
import { DataFormLayout } from '../components/dataform-layouts/data-form-layout';
1313
import normalizeForm from '../components/dataform-layouts/normalize-form';
1414

15+
/**
16+
* `DataForm` renders an auto-generated form for viewing and editing the fields
17+
* of a data item, driven by a fields and form layout configuration. Use it to
18+
* edit items of a dataset, often alongside `DataViews`.
19+
*/
1520
export default function DataForm< Item >( {
1621
data,
1722
form,

0 commit comments

Comments
 (0)