diff --git a/docs/data/toolpad/reference/components/chart.md b/docs/data/toolpad/reference/components/chart.md index 1b3f52b15e0..1a071050abd 100644 --- a/docs/data/toolpad/reference/components/chart.md +++ b/docs/data/toolpad/reference/components/chart.md @@ -8,8 +8,7 @@ A chart component. ## Properties -| Name | Type | Default | Description | -| :------------------------------------ | :------------------------------------ | :------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| data | array | | The data to be displayed. | -| height | number | 300 | The height of the chart. | -| sx | object | | The [`sx` prop](https://mui.com/system/getting-started/the-sx-prop/) is used for defining custom styles that have access to the theme. All MUI System properties are available via the `sx` prop. In addition, the `sx` prop allows you to specify any other CSS rules you may need. | +| Name | Type | Default | Description | +| :---------------------------------- | :------------------------------------ | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| data | array | | The data to be displayed. | +| sx | object | | The [`sx` prop](https://mui.com/system/getting-started/the-sx-prop/) is used for defining custom styles that have access to the theme. All MUI System properties are available via the `sx` prop. In addition, the `sx` prop allows you to specify any other CSS rules you may need. | diff --git a/docs/data/toolpad/reference/components/data-grid.md b/docs/data/toolpad/reference/components/data-grid.md index e0b1b9dd08d..bc16562f0da 100644 --- a/docs/data/toolpad/reference/components/data-grid.md +++ b/docs/data/toolpad/reference/components/data-grid.md @@ -19,7 +19,6 @@ The datagrid lets users display tabular data in a flexible grid. | rowIdField | string | | Defines which column contains the [id](https://mui.com/x/react-data-grid/row-definition/#row-identifier) that uniquely identifies each row. | | selection | object | null | The currently selected row. Or `null` in case no row has been selected. | | density | string | "compact" | The [density](https://mui.com/x/react-data-grid/accessibility/#density-prop) of the rows. Possible values are `compact`, `standard`, or `comfortable`. | -| height | number | 350 | The height of the data grid. | | loading | boolean | | Displays a loading animation indicating the data grid isn't ready to present data yet. | | hideToolbar | boolean | | Hide the toolbar area that contains the data grid user controls. | | sx | object | | The [`sx` prop](https://mui.com/system/getting-started/the-sx-prop/) is used for defining custom styles that have access to the theme. All MUI System properties are available via the `sx` prop. In addition, the `sx` prop allows you to specify any other CSS rules you may need. | diff --git a/docs/data/toolpad/reference/components/index.md b/docs/data/toolpad/reference/components/index.md index 43b864aea74..2ab059b41c2 100644 --- a/docs/data/toolpad/reference/components/index.md +++ b/docs/data/toolpad/reference/components/index.md @@ -20,6 +20,7 @@ - [PageRow](/toolpad/reference/components/page-row/) - [Paper](/toolpad/reference/components/paper/) - [Select](/toolpad/reference/components/select/) +- [Spacer](/toolpad/reference/components/spacer/) - [Stack](/toolpad/reference/components/stack/) - [Tabs](/toolpad/reference/components/tabs/) - [Text](/toolpad/reference/components/text/) diff --git a/docs/data/toolpad/reference/components/manifest.json b/docs/data/toolpad/reference/components/manifest.json index 4b9f04a1960..2ad5bb43e2a 100644 --- a/docs/data/toolpad/reference/components/manifest.json +++ b/docs/data/toolpad/reference/components/manifest.json @@ -73,6 +73,10 @@ "title": "Select", "pathname": "/toolpad/reference/components/select" }, + { + "title": "Spacer", + "pathname": "/toolpad/reference/components/spacer" + }, { "title": "Stack", "pathname": "/toolpad/reference/components/stack" diff --git a/docs/data/toolpad/reference/components/spacer.md b/docs/data/toolpad/reference/components/spacer.md new file mode 100644 index 00000000000..7e9572506ac --- /dev/null +++ b/docs/data/toolpad/reference/components/spacer.md @@ -0,0 +1,14 @@ + + +# Spacer + +
API docs for the Toolpad Spacer component.
+ +Spacer component. +It allows for creating space between elements. + +## Properties + +| Name | Type | Default | Description | +| :-------------------------------- | :------------------------------------ | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| sx | object | | The [`sx` prop](https://mui.com/system/getting-started/the-sx-prop/) is used for defining custom styles that have access to the theme. All MUI System properties are available via the `sx` prop. In addition, the `sx` prop allows you to specify any other CSS rules you may need. | diff --git a/docs/pages/toolpad/reference/components/spacer.js b/docs/pages/toolpad/reference/components/spacer.js new file mode 100644 index 00000000000..bfad331aa56 --- /dev/null +++ b/docs/pages/toolpad/reference/components/spacer.js @@ -0,0 +1,9 @@ +/* ATTENTION: DO NOT EDIT! This file has been auto-generated using `pnpm docs:build:api`. */ + +import * as React from 'react'; +import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs'; +import * as pageProps from '../../../../data/toolpad/reference/components/spacer.md?@mui/markdown'; + +export default function Page() { + return( propTypeDef: ArgTypeDefinition
, propName: keyof P, props: P, - componentConfig: ComponentConfig
, ) { if (propTypeDef.type === 'element' || propTypeDef.type === 'template') { return ( @@ -60,10 +59,6 @@ function shouldRenderControl
( return propTypeDef.visible(props); } - if (componentConfig.resizableHeightProp && propName === componentConfig.resizableHeightProp) { - return false; - } - return true; } @@ -141,7 +136,7 @@ function ComponentPropsEditor
({ {category}: {argTypeEntries.map(([propName, propTypeDef]) => - propTypeDef && shouldRenderControl(propTypeDef, propName, props, componentConfig) ? ( + propTypeDef && shouldRenderControl(propTypeDef, propName, props) ? (
extends AppDomNodeBase {
readonly horizontalAlign?: BoxProps['justifyContent'];
readonly verticalAlign?: BoxProps['alignItems'];
readonly columnSize?: number;
+ readonly height?: number;
};
}
@@ -822,6 +823,22 @@ export function moveNode {
+export interface ComponentConfig > {
/**
* A short explanatory text that'll be shown in the editor UI when this component is referenced.
* May contain Markdown.
@@ -426,10 +426,13 @@ export interface ComponentConfig {
*/
layoutDirection?: 'vertical' | 'horizontal' | 'both';
/**
- * Designates a property as "the resizable height property". If Toolpad detects any
- * vertical resizing of the component it will forward it to this property.
+ * Initial height of the component container box.
*/
- resizableHeightProp?: keyof P & string;
+ defaultLayoutHeight?: number;
+ /**
+ * Minimum height that the component container box can be resized to.
+ */
+ minimumLayoutHeight?: number;
/**
* Describes the individual properties for this component.
*/
diff --git a/test/models/ToolpadEditor.ts b/test/models/ToolpadEditor.ts
index c7ee8b99c92..bce9c05aad6 100644
--- a/test/models/ToolpadEditor.ts
+++ b/test/models/ToolpadEditor.ts
@@ -1,6 +1,7 @@
import { setTimeout } from 'timers/promises';
import { expect, FrameLocator, Locator, Page } from '@playwright/test';
import { gotoIfNotCurrent } from './shared';
+import { waitForBoundingBox } from '../utils/locators';
class CreateComponentDialog {
readonly page: Page;
@@ -119,7 +120,7 @@ export class ToolpadEditor {
await this.page.mouse.move(
sourceBoundingBox!.x + sourceBoundingBox!.width / 2,
sourceBoundingBox!.y + sourceBoundingBox!.height / 2,
- { steps: 10 },
+ { steps },
);
await this.page.mouse.down();
@@ -146,22 +147,20 @@ export class ToolpadEditor {
await this.componentCatalog.hover();
- let pageRootBoundingBox;
- await expect(async () => {
- pageRootBoundingBox = await this.pageRoot.boundingBox();
- expect(pageRootBoundingBox).toBeTruthy();
- }).toPass();
+ const pageRootBoundingBox = await waitForBoundingBox(this.pageRoot);
if (!moveTargetX) {
moveTargetX = pageRootBoundingBox!.x + pageRootBoundingBox!.width / 2;
}
if (!moveTargetY) {
- moveTargetY = pageRootBoundingBox!.y + pageRootBoundingBox!.height / 2;
+ moveTargetY = pageRootBoundingBox!.y + pageRootBoundingBox!.height + 12;
}
const sourceLocator = this.getComponentCatalogItem(componentName);
await expect(sourceLocator).toBeVisible();
+ await sourceLocator.hover();
+
await this.dragTo(sourceLocator, moveTargetX!, moveTargetY!, hasDrop, steps);
await style.evaluate((elm) => elm.parentNode?.removeChild(elm));
diff --git a/test/utils/locators.ts b/test/utils/locators.ts
index 56ac14c82da..a3dc2cf9fbe 100644
--- a/test/utils/locators.ts
+++ b/test/utils/locators.ts
@@ -2,15 +2,23 @@ import { Page, Locator, expect } from '../playwright/test';
type BoundingBox = NonNullable