-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DuotonePicker, DuotoneSwatch: Convert to TypeScript (#49060)
* Rename index.tsx * Add types for DuotoneSwatch * Add more types * Add main JSDoc * Move ColorListPicker into duotone-picker folder * Convert stories * Add changelog * Fix style imports * ColorListPicker: Tweak types * Add code comment * Improve TODO comment * Fix typo * Move changelog
- Loading branch information
Showing
14 changed files
with
177 additions
and
40 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
File renamed without changes.
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
File renamed without changes.
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
12 changes: 9 additions & 3 deletions
12
.../duotone-picker/stories/duotone-swatch.js → ...duotone-picker/stories/duotone-swatch.tsx
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,61 @@ | ||
export type DuotonePickerProps = { | ||
/** | ||
* Whether there should be a button to clear the duotone value. | ||
* | ||
* @default true | ||
*/ | ||
clearable?: boolean; | ||
/** | ||
* Whether there should be an `unset` option. | ||
* | ||
* @default true | ||
*/ | ||
unsetable?: boolean; | ||
/** | ||
* Array of color presets of the form `{ color: '#000000', name: 'Black', slug: 'black' }`. | ||
*/ | ||
colorPalette: Color[]; | ||
/** | ||
* Array of duotone presets of the form `{ colors: [ '#000000', '#ffffff' ], name: 'Grayscale', slug: 'grayscale' }`. | ||
*/ | ||
duotonePalette: DuotoneColor[]; | ||
/** | ||
* Whether custom colors should be disabled. | ||
* | ||
* @default false | ||
*/ | ||
disableCustomColors?: boolean; | ||
/** | ||
* Whether custom duotone values should be disabled. | ||
* | ||
* @default false | ||
*/ | ||
disableCustomDuotone?: boolean; | ||
/** | ||
* An array of colors for the duotone effect. | ||
*/ | ||
value?: string[] | 'unset'; | ||
/** | ||
* Callback which is called when the duotone colors change. | ||
*/ | ||
onChange: ( value: DuotonePickerProps[ 'value' ] | undefined ) => void; | ||
}; | ||
|
||
type Color = { | ||
color: string; | ||
name: string; | ||
slug: string; | ||
}; | ||
|
||
type DuotoneColor = { | ||
colors: string[]; | ||
name: string; | ||
slug: string; | ||
}; | ||
|
||
export type DuotoneSwatchProps = { | ||
/** | ||
* An array of colors to show or `null` to show the placeholder swatch icon. | ||
*/ | ||
values?: string[] | null; | ||
}; |
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
Oops, something went wrong.
04c579c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 04c579c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4478707343
📝 Reported issues:
/test/e2e/specs/site-editor/template-part.spec.js