forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AlignmentMatrixControl: refactor to TypeScript (WordPress#46162)
Co-authored-by: Lena Morita <[email protected]>
- Loading branch information
Showing
12 changed files
with
173 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
export type AlignmentMatrixControlValue = | ||
| 'top left' | ||
| 'top center' | ||
| 'top right' | ||
| 'center left' | ||
| 'center' | ||
| 'center center' | ||
| 'center right' | ||
| 'bottom left' | ||
| 'bottom center' | ||
| 'bottom right'; | ||
|
||
export type AlignmentMatrixControlProps = { | ||
/** | ||
* Accessible label. If provided, sets the `aria-label` attribute of the | ||
* underlying `grid` widget. | ||
* | ||
* @default 'Alignment Matrix Control' | ||
*/ | ||
label?: string; | ||
/** | ||
* If provided, sets the default alignment value. | ||
* | ||
* @default 'center center' | ||
*/ | ||
defaultValue?: AlignmentMatrixControlValue; | ||
/** | ||
* The current alignment value. | ||
*/ | ||
value?: AlignmentMatrixControlValue; | ||
/** | ||
* A function that receives the updated alignment value. | ||
*/ | ||
onChange?: ( newValue: AlignmentMatrixControlValue ) => void; | ||
/** | ||
* If provided, sets the width of the control. | ||
* | ||
* @default 92 | ||
*/ | ||
width?: number; | ||
}; | ||
|
||
export type AlignmentMatrixControlIconProps = Pick< | ||
AlignmentMatrixControlProps, | ||
'value' | ||
> & { | ||
disablePointerEvents?: boolean; | ||
size?: number; | ||
}; | ||
|
||
export type AlignmentMatrixControlCellProps = { | ||
isActive?: boolean; | ||
value: NonNullable< AlignmentMatrixControlProps[ 'value' ] >; | ||
}; |
Oops, something went wrong.