From 2c063cf1adad240a04f355e49af571cddabd9ebd Mon Sep 17 00:00:00 2001 From: Lo Kim Date: Wed, 19 Oct 2022 11:18:50 -0400 Subject: [PATCH 1/2] [Box] Add support for `minHeight` and `minWidth` --- polaris-react/src/components/Box/Box.scss | 4 ++++ polaris-react/src/components/Box/Box.tsx | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/polaris-react/src/components/Box/Box.scss b/polaris-react/src/components/Box/Box.scss index 1c6a1449d39..54d5510c2e0 100644 --- a/polaris-react/src/components/Box/Box.scss +++ b/polaris-react/src/components/Box/Box.scss @@ -11,6 +11,8 @@ --pc-box-border-right: initial; --pc-box-border-top: initial; --pc-box-color: initial; + --pc-box-min-height: initial; + --pc-box-min-width: initial; --pc-box-max-width: initial; --pc-box-overflow-x: initial; --pc-box-overflow-y: initial; @@ -30,6 +32,8 @@ border-right: var(--pc-box-border-right); border-top: var(--pc-box-border-top); color: var(--pc-box-color); + min-height: var(--pc-box-min-height); + min-width: var(--pc-box-min-width); max-width: var(--pc-box-max-width); overflow-x: var(--pc-box-overflow-x); overflow-y: var(--pc-box-overflow-y); diff --git a/polaris-react/src/components/Box/Box.tsx b/polaris-react/src/components/Box/Box.tsx index 2e700bbbf7f..36fe569d0ea 100644 --- a/polaris-react/src/components/Box/Box.tsx +++ b/polaris-react/src/components/Box/Box.tsx @@ -164,6 +164,10 @@ export interface BoxProps extends PropsWithChildren { color?: ColorTokenScale; /** HTML id attribute */ id?: string; + /** Set minimum height of container */ + minHeight?: string; + /** Set minimum width of container */ + minWidth?: string; /** Set maximum width of container */ maxWidth?: string; /** Clip horizontal content of children */ @@ -204,6 +208,8 @@ export const Box = forwardRef( children, color, id, + minHeight, + minWidth, maxWidth, overflowX, overflowY, @@ -269,6 +275,8 @@ export const Box = forwardRef( '--pc-box-border-radius-top-right': borderRadiuses.topRight ? `var(--p-border-radius-${borderRadiuses.topRight})` : undefined, + '--pc-box-min-height': minHeight ?? undefined, + '--pc-box-min-width': minWidth ?? undefined, '--pc-box-max-width': maxWidth ?? undefined, '--pc-box-overflow-x': overflowX ?? undefined, '--pc-box-overflow-y': overflowY ?? undefined, From 87219188e6ea3120cf1b5026b86ec40c1dc764cd Mon Sep 17 00:00:00 2001 From: Lo Kim Date: Wed, 19 Oct 2022 11:19:13 -0400 Subject: [PATCH 2/2] Add changeset --- .changeset/funny-hairs-raise.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/funny-hairs-raise.md diff --git a/.changeset/funny-hairs-raise.md b/.changeset/funny-hairs-raise.md new file mode 100644 index 00000000000..38d811a89ac --- /dev/null +++ b/.changeset/funny-hairs-raise.md @@ -0,0 +1,5 @@ +--- +'@shopify/polaris': minor +--- + +Added support for `minHeight` and `minWidth` on `Box`