From 730c02c17dbd100dd5a7d75363a2b28dafedeb1a Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Wed, 25 Aug 2021 21:07:24 +1000 Subject: [PATCH] Update ToolsPanel docs to reflect latest state --- .../tools-panel/tools-panel-item/README.md | 37 +++++++++++++++++++ .../src/tools-panel/tools-panel/README.md | 20 +++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/packages/components/src/tools-panel/tools-panel-item/README.md b/packages/components/src/tools-panel/tools-panel-item/README.md index 2384b32f7be41..a573e4bd3bf48 100644 --- a/packages/components/src/tools-panel/tools-panel-item/README.md +++ b/packages/components/src/tools-panel/tools-panel-item/README.md @@ -18,6 +18,13 @@ for how to use `ToolsPanelItem`. ## Props +### `hasValue`: `function` + +This is called when building the `ToolsPanel` menu to determine the item's +initial checked state. + +- Required: Yes + ### `isShownByDefault`: `boolean` This prop identifies the current item as being displayed by default. This means @@ -37,3 +44,33 @@ determine if the panel item should be displayed. A panel item's `label` should be unique among all items within a single panel. - Required: Yes + +### `onDeselect`: `function` + +Called when this item is deselected in the `ToolsPanel` menu. This is normally +used to reset the panel item control's value. + +- Required: No + +### `onSelect`: `function` + +A callback to take action when this item is selected in the `ToolsPanel` menu. + +- Required: No + +### `panelId`: `string` + +This prop can be set to a ID representing a unique `ToolsPanel`. Before +attempting to register with a panel, each item will ensure that it belongs to +the current panel. This avoids issues when sharing SlotFills to inject items +into a panel. + +- Required: No + +### `resetAllFilter`: `function` + +A `ToolsPanel` will collect each item's `resetAllFilter` and pass an array of +these function through to the panel's `resetAll` callback. They can then be +iterated over to perform additional tasks for items injected via SlotFills. + +- Required: No diff --git a/packages/components/src/tools-panel/tools-panel/README.md b/packages/components/src/tools-panel/tools-panel/README.md index 4424ef880af9b..1269fa250d27b 100644 --- a/packages/components/src/tools-panel/tools-panel/README.md +++ b/packages/components/src/tools-panel/tools-panel/README.md @@ -71,21 +71,29 @@ export function DimensionPanel( props ) { ## Props +### `header`: `string` + +Text to be displayed within the panel's header. + +- Required: Yes + ### `label`: `string` The label for the panel's dropdown menu. - Required: Yes -### `resetAll`: `function` +### `panelId`: `function` -A function to call when the `Reset all` menu option is selected. This is passed -through to the panel's header component. +The `panelId` is passed through the `ToolsPanelContext` to panel items. This is +be used to ensure items injected via SlotFills are only registered for their +intended panels. -- Required: Yes +- Required: No -### `header`: `string` +### `resetAll`: `function` -Text to be displayed within the panel's header. +A function to call when the `Reset all` menu option is selected. This is passed +through to the panel's header component. - Required: Yes