diff --git a/platform/wab/src/wab/client/components/sidebar-tabs/SizeSection.tsx b/platform/wab/src/wab/client/components/sidebar-tabs/SizeSection.tsx index adb65dbaf07..3da90ecbbe5 100644 --- a/platform/wab/src/wab/client/components/sidebar-tabs/SizeSection.tsx +++ b/platform/wab/src/wab/client/components/sidebar-tabs/SizeSection.tsx @@ -2,13 +2,10 @@ import { WithContextMenu } from "@/wab/client/components/ContextMenu"; import S from "@/wab/client/components/sidebar-tabs/SizeSection.module.scss"; import { FullRow, - getValueSetState, - isSetOrInherited, LabeledItemRow, LabeledStyleDimItem, LabeledStyleDimItemRow, LabeledStyleSwitchItem, - SectionSeparator, shouldBeDisabled, } from "@/wab/client/components/sidebar/sidebar-helpers"; import { SidebarSection } from "@/wab/client/components/sidebar/SidebarSection"; @@ -23,16 +20,9 @@ import { useStyleComponent, } from "@/wab/client/components/style-controls/StyleComponent"; import { Icon as IconComponent } from "@/wab/client/components/widgets/Icon"; -import IconButton from "@/wab/client/components/widgets/IconButton"; import { DimManip } from "@/wab/client/DimManip"; -import { - default as PlasmicIcon__Stretch, - default as StretchIcon, -} from "@/wab/client/plasmic/plasmic_kit/PlasmicIcon__Stretch"; -import { - default as PlasmicIcon__Wrap, - default as WrapIcon, -} from "@/wab/client/plasmic/plasmic_kit/PlasmicIcon__Wrap"; +import { default as StretchIcon } from "@/wab/client/plasmic/plasmic_kit/PlasmicIcon__Stretch"; +import { default as WrapIcon } from "@/wab/client/plasmic/plasmic_kit/PlasmicIcon__Wrap"; import WidthFullBleedIcon from "@/wab/client/plasmic/plasmic_kit_icons/icons/PlasmicIcon__WidthFullBleed"; import WidthStandardStretchIcon from "@/wab/client/plasmic/plasmic_kit_icons/icons/PlasmicIcon__WidthStandardStretch"; import WidthWideIcon from "@/wab/client/plasmic/plasmic_kit_icons/icons/PlasmicIcon__WidthWide"; @@ -63,23 +53,12 @@ import { capitalizeFirst } from "@/wab/shared/strs"; import { $$$ } from "@/wab/shared/TplQuery"; import { VariantedStylesHelper } from "@/wab/shared/VariantedStylesHelper"; import { Alert, Menu } from "antd"; -import cn from "classnames"; import { observer } from "mobx-react"; import React from "react"; -interface SizePanelSectionState { - showMore: boolean; -} - -class SizeSection_ extends StyleComponent< - StyleComponentProps, - SizePanelSectionState -> { +class SizeSection_ extends StyleComponent { constructor(props: StyleComponentProps) { super(props); - this.state = { - showMore: false, - }; } render() { @@ -88,26 +67,6 @@ class SizeSection_ extends StyleComponent< this.props.vsh ?? makeVariantedStylesHelperFromCurrentCtx(this.studioCtx()); - const isMinMaxWidthSet = isSetOrInherited( - getValueSetState(...this.definedIndicators("min-width", "max-width")) - ); - - const isMinMaxHeightSet = isSetOrInherited( - getValueSetState(...this.definedIndicators("min-width", "max-width")) - ); - - const tpl = - this.props.expsProvider instanceof TplExpsProvider - ? this.props.expsProvider.tpl - : undefined; - const deepLayoutParent = tpl - ? $$$(tpl).layoutParent({ throughSlot: true }).maybeOneTpl() - : undefined; - const isDeepContentLayoutChild = - !!deepLayoutParent && isContentLayoutTpl(deepLayoutParent); - const isDeepContentLayout = - !!tpl && isContentLayoutTpl(tpl, { deep: true }); - return ( - {(renderMaybeCollapsibleRows) => ( -
- {isSvg(this.props.expsProvider) && ( - - SVGs have no default size, so setting width to hug or auto - will cause it to stretch to fill the parent container. -
- } - /> - )} - {renderMaybeCollapsibleRows([ - { - collapsible: false, - content: ( - - - - ), - }, - { - collapsible: !isSetOrInherited( - getValueSetState(...this.definedIndicators("min-width")) - ), - content: ( - - - - ), - }, - { - collapsible: !isSetOrInherited( - getValueSetState(...this.definedIndicators("max-width")) - ), - content: ( - - - - ), - }, - { - collapsible: false, - content: ( - <> - - - - - - ), - }, - { - collapsible: !isSetOrInherited( - getValueSetState(...this.definedIndicators("min-height")) - ), - content: ( - - - - ), - }, - { - collapsible: !isSetOrInherited( - getValueSetState(...this.definedIndicators("max-height")) - ), - content: ( - - - - ), - }, - { - collapsible: - !isSetOrInherited( - getValueSetState( - ...this.definedIndicators("flex-grow", "flex-shrink") - ) - ) && - !isSetOrInherited( - getValueSetState(...this.definedIndicators("flex-basis")) - ), - content: , - }, - { - collapsible: !isSetOrInherited( - getValueSetState( - ...this.definedIndicators("flex-grow", "flex-shrink") - ) - ), - content: ( - - ), - }, - { - collapsible: !isSetOrInherited( - getValueSetState(...this.definedIndicators("flex-basis")) - ), - content: ( - - ), - }, - ])} - + {isSvg(this.props.expsProvider) && ( + + SVGs have no default size, so setting width to hug or auto will + cause it to stretch to fill the parent container. + + } + /> )} + + + + + + + + + + + + + + + +
); } @@ -473,6 +357,7 @@ const SizeControl = observer(function SizeRow(props: { label={capitalizeFirst(prop)} className={S.dimField} styleName={prop} + labelSize="small" initialMenuItems={() => new DimManip( expsProvider.studioCtx, @@ -482,74 +367,6 @@ const SizeControl = observer(function SizeRow(props: { ).renderConvertMenuItems() } disabledTooltip={disabledTooltip} - rightExtras={ - !isDisabled && ( -
- {value !== "stretch" && ( - setProp("stretch")} - className={cn(S.toggleSizingIcon, { - [S.toggleSizingIcon__height]: prop === "height", - })} - > - - - )} - {value !== "wrap" && value !== "auto" && ( - setProp("wrap")} - className={cn(S.toggleSizingIcon, { - [S.toggleSizingIcon__height]: prop === "height", - })} - > - - - )} - {prop === "width" && isDeepContentLayoutChild && !isRoot && ( - <> - {value !== CONTENT_LAYOUT_WIDE && ( - setProp(CONTENT_LAYOUT_WIDE)} - className={S.toggleSizingIcon} - > - - - )} - {value !== CONTENT_LAYOUT_FULL_BLEED && ( - setProp(CONTENT_LAYOUT_FULL_BLEED)} - className={S.toggleSizingIcon} - > - - - )} - - )} -
- ) - } dimOpts={{ disabled: isDisabled || !isResizable, extraOptions, @@ -560,7 +377,6 @@ const SizeControl = observer(function SizeRow(props: { allowedUnits: isRoot ? getLengthUnits("px").filter((x) => x !== "%") : getLengthUnits("px"), - hideArrow: true, }} tokenType={TokenType.Spacing} vsh={vsh} @@ -642,10 +458,8 @@ const FlexGrowControls = observer(function FlexGrowControls(props: { return ( <> - + {renderSizing("flex-grow", "Grow", "Grow to fill available space")} - - {renderSizing("flex-shrink", "Shrink", "Shrink if not enough space")} @@ -654,7 +468,7 @@ const FlexGrowControls = observer(function FlexGrowControls(props: { function toDisplay(val: string, stretchLabel: string, isRoot: boolean) { if (val === "wrap") { - val = "Hug content"; + val = "Hug"; } else if (val === CONTENT_LAYOUT_FULL_BLEED) { val = "Full bleed"; if (isRoot) { @@ -672,7 +486,7 @@ function toDisplay(val: string, stretchLabel: string, isRoot: boolean) { } function fromDisplay(val: string, stretchLabel: string) { - if (val === "Hug content") { + if (val === "Hug") { val = "wrap"; } else if (val === "Full bleed") { val = CONTENT_LAYOUT_FULL_BLEED;