From 3d17c61018b2e5d37755f690e35e7a0e6eadf5ff Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 13 Dec 2024 23:05:33 +0900 Subject: [PATCH] TreeSelect: Deprecate 36px default size (#67855) * TreeSelect: Deprecate 36px default size * Fix types * Auto-generate readme * Add changelog * Fixup readme Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla --- packages/components/CHANGELOG.md | 1 + .../components/src/input-control/types.ts | 6 +- packages/components/src/tree-select/README.md | 171 +++++++++++++++--- .../src/tree-select/docs-manifest.json | 5 + packages/components/src/tree-select/index.tsx | 12 +- .../src/tree-select/stories/index.story.tsx | 1 + packages/components/src/tree-select/types.ts | 9 +- 7 files changed, 172 insertions(+), 33 deletions(-) create mode 100644 packages/components/src/tree-select/docs-manifest.json diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 49cc196b1f7e69..af71c4104b4d97 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -8,6 +8,7 @@ ### Deprecations +- `TreeSelect`: Deprecate 36px default size ([#67855](https://github.com/WordPress/gutenberg/pull/67855)). - `SelectControl`: Deprecate 36px default size ([#66898](https://github.com/WordPress/gutenberg/pull/66898)). - `InputControl`: Deprecate 36px default size ([#66897](https://github.com/WordPress/gutenberg/pull/66897)). diff --git a/packages/components/src/input-control/types.ts b/packages/components/src/input-control/types.ts index 99c5b1aea92c37..edb69def619057 100644 --- a/packages/components/src/input-control/types.ts +++ b/packages/components/src/input-control/types.ts @@ -136,7 +136,7 @@ export interface InputBaseProps extends BaseProps, FlexProps { * If you want to apply standard padding in accordance with the size variant, wrap the element in * the provided `` component. * - * @example + * ```jsx * import { * __experimentalInputControl as InputControl, * __experimentalInputControlPrefixWrapper as InputControlPrefixWrapper, @@ -145,6 +145,7 @@ export interface InputBaseProps extends BaseProps, FlexProps { * @} * /> + * ``` */ prefix?: ReactNode; /** @@ -154,7 +155,7 @@ export interface InputBaseProps extends BaseProps, FlexProps { * If you want to apply standard padding in accordance with the size variant, wrap the element in * the provided `` component. * - * @example + * ```jsx * import { * __experimentalInputControl as InputControl, * __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper, @@ -163,6 +164,7 @@ export interface InputBaseProps extends BaseProps, FlexProps { * %} * /> + * ``` */ suffix?: ReactNode; /** diff --git a/packages/components/src/tree-select/README.md b/packages/components/src/tree-select/README.md index 3d26488478bd0c..493c83bf993b0c 100644 --- a/packages/components/src/tree-select/README.md +++ b/packages/components/src/tree-select/README.md @@ -1,10 +1,10 @@ # TreeSelect -TreeSelect component is used to generate select input fields. + -## Usage +

See the WordPress Storybook for more detailed, interactive documentation.

-Render a user interface to select the parent page in a hierarchy of pages: +Generates a hierarchical select input. ```jsx import { useState } from 'react'; @@ -15,7 +15,8 @@ const MyTreeSelect = () => { return ( setPage( newPage ) } @@ -50,51 +51,165 @@ const MyTreeSelect = () => { ); } ``` - ## Props -The set of props accepted by the component will be specified below. -Props not included in this set will be applied to the SelectControl component being used. +### `__next40pxDefaultSize` + +Start opting into the larger default height that will become the default size in a future version. + + - Type: `boolean` + - Required: No + - Default: `false` + +### `__nextHasNoMarginBottom` + +Start opting into the new margin-free styles that will become the default in a future version. + + - Type: `boolean` + - Required: No + - Default: `false` + +### `children` + +As an alternative to the `options` prop, `optgroup`s and `options` can be +passed in as `children` for more customizability. + + - Type: `ReactNode` + - Required: No + +### `disabled` -### label +If true, the `input` will be disabled. + + - Type: `boolean` + - Required: No + - Default: `false` + +### `hideLabelFromVision` + +If true, the label will only be visible to screen readers. + + - Type: `boolean` + - Required: No + - Default: `false` + +### `help` + +Additional description for the control. + +Only use for meaningful description or instructions for the control. An element containing the description will be programmatically associated to the BaseControl by the means of an `aria-describedby` attribute. + + - Type: `ReactNode` + - Required: No + +### `label` If this property is added, a label will be generated using label property as the content. -- Type: `String` -- Required: No + - Type: `ReactNode` + - Required: No + +### `labelPosition` + +The position of the label. -### noOptionLabel + - Type: `"top" | "bottom" | "side" | "edge"` + - Required: No + - Default: `'top'` + +### `noOptionLabel` If this property is added, an option will be added with this label to represent empty selection. -- Type: `String` -- Required: No + - Type: `string` + - Required: No + +### `onChange` + +A function that receives the value of the new option that is being selected as input. + + - Type: `(value: string, extra?: { event?: ChangeEvent; }) => void` + - Required: No + +### `options` + +An array of option property objects to be rendered, +each with a `label` and `value` property, as well as any other +`