Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7e79847
Start refactor of ToolsPanel component to typescript
Sep 15, 2021
b1e2fc0
Add typing for dropdown menu
Aug 12, 2021
65fa4f6
Start typing the ToolsPanelHeader component
Sep 15, 2021
74ddbd8
Add types for ToolsPanelHeader
Aug 12, 2021
15c0ae3
Add remaining types
Aug 12, 2021
336efba
More conflict resolution
Sep 15, 2021
a1fe287
Update PolymorphicComponent* references to WordPressComponentProps*
Sep 2, 2021
8d9d8d7
Fix type issues following rebase
Sep 15, 2021
ee69bf8
fix remaining menu item type issues
Sep 15, 2021
1174878
Improve menu item types
Sep 16, 2021
19dec18
Move remaining eligible ToolsPanel files to TS
aaronrobertshaw Sep 17, 2021
bb89386
Revert "Improve menu item types"
aaronrobertshaw Sep 17, 2021
8369760
Revert "Add typing for dropdown menu"
aaronrobertshaw Sep 17, 2021
d853e9a
Remove menu group and item type doc block annotations
aaronrobertshaw Sep 17, 2021
19bdce7
Add ts-nocheck to ToolsPanelHeader
aaronrobertshaw Sep 17, 2021
bce9e12
Move ts-nocheck to dependencies and fix type errors
aaronrobertshaw Sep 20, 2021
87127db
Improve typing of ToolsPanel
aaronrobertshaw Sep 21, 2021
6c4180e
Add missing dependencies to tools panel item hook
aaronrobertshaw Sep 21, 2021
19cd494
Use optional chaining for onSelect and onDeselect calls
aaronrobertshaw Sep 22, 2021
f061db7
Add TypeScript types for function props in READMEs
aaronrobertshaw Sep 22, 2021
d4674f1
Enforce boolean for hasMenuItems in ToolsPanelContext
aaronrobertshaw Sep 22, 2021
1f833ab
Make all properties except panelId mandatory in ToolsPanelContext
aaronrobertshaw Sep 22, 2021
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
Prev Previous commit
Next Next commit
Add TypeScript types for function props in READMEs
  • Loading branch information
aaronrobertshaw committed Sep 23, 2021
commit f061db7e35806068d692fde289c67442750cd05b
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Text to be displayed within the panel header. It is also passed along as the

- Required: Yes

### `resetAll`: `function`
### `resetAll`: `() => void`

The `resetAll` prop provides the callback to execute when the "Reset all" menu
item is selected. Its purpose is to facilitate resetting any control values
for items contained within this header's panel.

- Required: Yes

### `toggleItem`: `function`
### `toggleItem`: `( label: string ) => void`

This is executed when an individual control's menu item is toggled. It
will update the panel's menu item state and call the panel item's `onSelect` or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ for how to use `ToolsPanelItem`.

## Props

### `hasValue`: `function`
### `hasValue`: `() => boolean`

This is called when building the `ToolsPanel` menu to determine the item's
initial checked state.
Expand All @@ -45,14 +45,14 @@ A panel item's `label` should be unique among all items within a single panel.

- Required: Yes

### `onDeselect`: `function`
### `onDeselect`: `() => void`

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`
### `onSelect`: `() => void`

A callback to take action when this item is selected in the `ToolsPanel` menu.

Expand All @@ -66,7 +66,7 @@ allows items to be injected from a shared source.

- Required: No

### `resetAllFilter`: `function`
### `resetAllFilter`: `() => void`

A `ToolsPanel` will collect each item's `resetAllFilter` and pass an array of
these functions through to the panel's `resetAll` callback. They can then be
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/tools-panel/tools-panel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ panel's dropdown menu.

- Required: Yes

### `panelId`: `function`
### `panelId`: `string`

If a `panelId` is set, it is passed through the `ToolsPanelContext` and used
to restrict panel items. Only items with a matching `panelId` will be able
to register themselves with this panel.

- Required: No

### `resetAll`: `function`
### `resetAll`: `() => void`

A function to call when the `Reset all` menu option is selected. This is passed
through to the panel's header component.
Expand Down