Skip to content

Commit

Permalink
Add Grid component to @wordpress/components
Browse files Browse the repository at this point in the history
  • Loading branch information
lipemat committed Feb 15, 2021
1 parent 02db8a3 commit 441d012
Showing 1 changed file with 69 additions and 1 deletion.
70 changes: 69 additions & 1 deletion wordpress__components/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
declare module '@wordpress/components' {
import {ComponentType, InputHTMLAttributes, ReactNode, SelectHTMLAttributes, SVGAttributes} from 'react';
import {
ComponentType,
CSSProperties,
InputHTMLAttributes,
ReactNode,
SelectHTMLAttributes,
SVGAttributes,
} from 'react';
import {ClassNamesFn} from 'classnames/types';
import {SVG} from '@wordpress/primitives';

Expand Down Expand Up @@ -366,6 +373,65 @@ declare module '@wordpress/components' {
className: string;
}

interface Grid {
align?: CSSProperties['alignItems'];
/**
* Adjusts the horizontal and vertical alignment of children.
*/
alignment?:
'bottom'
| 'bottomLeft'
| 'bottomRight'
| 'center'
| 'edge'
| 'left'
| 'right'
| 'stretch'
| 'top'
| 'topLeft'
| 'topRight';
/**
* Adjusts the number of columns of the `Grid`.
*
* @default 2
*/
columns?: Array<number | undefined> | number;
/**
* Adjusts the `grid-column-gap`.
*/
columnGap?: CSSProperties['gridColumnGap'];
/**
* Changes the CSS display from `grid` to `inline-grid`.
*/
isInline?: boolean;
/**
* Gap between each child.
*
* @default 3
*/
gap?: number;
/**
* Adjusts the inline alignment of children.
*/
justify?: CSSProperties['justifyContent'];
/**
* Adjusts the `grid-row-gap`.
*/
rowGap?: CSSProperties['gridRowGap'];
/**
* Adjusts the number of rows of the `Grid`.
*/
rows?: Array<number | undefined> | number;
/**
* Adjusts the CSS grid `template-columns`.
*/
templateColumns?: CSSProperties['gridTemplateColumns'];
/**
* Adjusts the CSS grid `template-rows`.
*/
templateRows?: CSSProperties['gridTemplateRows'];
}

interface Guide {
onFinish: () => void;
children: ComponentType<GuidePage>[];
Expand Down Expand Up @@ -434,6 +500,7 @@ declare module '@wordpress/components' {
export const ColorPalette: ComponentType<ColorPalette>;
export const ColorPicker: ComponentType<ColorPicker>;
export const Dashicon: ComponentType<Dashicon>;
export const Grid: ComponentType<Grid>;
export const Guide: ComponentType<Guide>;
export const GuidePage: ComponentType<GuidePage>;
export const PanelBody: ComponentType<PanelBody>;
Expand All @@ -450,6 +517,7 @@ declare module '@wordpress/components' {
ColorPalette: ComponentType<ColorPalette>;
ColorPicker: ComponentType<ColorPicker>;
Dashicon: ComponentType<Dashicon>;
Grid: ComponentType<Grid>;
Guide: ComponentType<Guide>;
GuidePage: ComponentType<GuidePage>;
PanelBody: ComponentType<PanelBody>;
Expand Down

0 comments on commit 441d012

Please sign in to comment.