diff --git a/editor/src/components/inspector/common/inspector-end-to-end-tests.spec.browser2.tsx b/editor/src/components/inspector/common/inspector-end-to-end-tests.spec.browser2.tsx index 6eb3f61b1abb..cf5622166f47 100644 --- a/editor/src/components/inspector/common/inspector-end-to-end-tests.spec.browser2.tsx +++ b/editor/src/components/inspector/common/inspector-end-to-end-tests.spec.browser2.tsx @@ -675,7 +675,7 @@ describe('inspector tests with real metadata', () => { 'padding-R', )) as HTMLInputElement const opacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement matchInlineSnapshotBrowser(metadata.computedStyle?.['width'], `"203px"`) @@ -707,7 +707,7 @@ describe('inspector tests with real metadata', () => { `"simple"`, ) - matchInlineSnapshotBrowser(opacityControl.value, `"0.5"`) + matchInlineSnapshotBrowser(opacityControl.value, `"50%"`) matchInlineSnapshotBrowser( opacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"simple"`, @@ -770,7 +770,7 @@ describe('inspector tests with real metadata', () => { 'radius-one', )) as HTMLInputElement const opacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement matchInlineSnapshotBrowser(widthControl.value, `"0"`) @@ -812,7 +812,7 @@ describe('inspector tests with real metadata', () => { `"simple"`, ) - matchInlineSnapshotBrowser(opacityControl.value, `"1"`) + matchInlineSnapshotBrowser(opacityControl.value, `"100%"`) matchInlineSnapshotBrowser( opacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"simple"`, @@ -1316,7 +1316,7 @@ describe('inspector tests with real metadata', () => { 'radius-one', )) as HTMLInputElement const opacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement matchInlineSnapshotBrowser(widthControl.value, `"100"`) @@ -1366,7 +1366,7 @@ describe('inspector tests with real metadata', () => { ) matchInlineSnapshotBrowser(metadata.computedStyle?.['opacity'], `"0.5"`) - matchInlineSnapshotBrowser(opacityControl.value, `"0.5"`) + matchInlineSnapshotBrowser(opacityControl.value, `"50%"`) matchInlineSnapshotBrowser( opacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"controlled"`, @@ -1419,7 +1419,7 @@ describe('inspector tests with real metadata', () => { 'padding-R', )) as HTMLInputElement const earlyOpacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement matchInlineSnapshotBrowser(earlyMetadata.computedStyle?.['width'], `"203px"`) @@ -1451,7 +1451,7 @@ describe('inspector tests with real metadata', () => { `"detected-fromcss"`, ) - matchInlineSnapshotBrowser(earlyOpacityControl.value, `"0.5"`) + matchInlineSnapshotBrowser(earlyOpacityControl.value, `"50%"`) matchInlineSnapshotBrowser( earlyOpacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"detected-fromcss"`, @@ -1490,7 +1490,7 @@ describe('inspector tests with real metadata', () => { 'padding-R', )) as HTMLInputElement const laterOpacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement matchInlineSnapshotBrowser(laterMetadata.computedStyle?.['width'], `"203px"`) @@ -1522,7 +1522,7 @@ describe('inspector tests with real metadata', () => { `"simple"`, ) - matchInlineSnapshotBrowser(laterOpacityControl.value, `"0.5"`) + matchInlineSnapshotBrowser(laterOpacityControl.value, `"50%"`) matchInlineSnapshotBrowser( laterOpacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"simple"`, @@ -1594,7 +1594,7 @@ describe('inspector tests with real metadata', () => { 'radius-one', )) as HTMLInputElement const opacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement matchInlineSnapshotBrowser(widthControl.value, `"0"`) @@ -1624,7 +1624,7 @@ describe('inspector tests with real metadata', () => { `"simple"`, ) - matchInlineSnapshotBrowser(opacityControl.value, `"1"`) + matchInlineSnapshotBrowser(opacityControl.value, `"100%"`) matchInlineSnapshotBrowser( opacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"simple"`, @@ -1873,7 +1873,7 @@ describe('inspector tests with real metadata', () => { 'radius-one', )) as HTMLInputElement const opacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement matchInlineSnapshotBrowser(metadata.computedStyle?.['width'], `"250px"`) @@ -1908,7 +1908,7 @@ describe('inspector tests with real metadata', () => { ) matchInlineSnapshotBrowser(metadata.computedStyle?.['opacity'], `"0.3"`) - matchInlineSnapshotBrowser(opacityControl.value, `"0.3"`) + matchInlineSnapshotBrowser(opacityControl.value, `"30%"`) matchInlineSnapshotBrowser( opacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"detected-fromcss"`, @@ -1998,7 +1998,7 @@ describe('inspector tests with real metadata', () => { 'radius-one', )) as HTMLInputElement const opacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement // matchInlineSnapshotBrowser(metadata.computedStyle?.['minWidth'], `"0px"`) @@ -2030,7 +2030,7 @@ describe('inspector tests with real metadata', () => { ) matchInlineSnapshotBrowser(metadata.computedStyle?.['opacity'], `"1"`) - matchInlineSnapshotBrowser(opacityControl.value, `"1"`) + matchInlineSnapshotBrowser(opacityControl.value, `"100%"`) matchInlineSnapshotBrowser( opacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"detected-fromcss"`, @@ -2108,7 +2108,7 @@ describe('inspector tests with real metadata', () => { 'radius-one', )) as HTMLInputElement const opacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement // matchInlineSnapshotBrowser(metadata.computedStyle?.['minWidth'], `"0px"`) @@ -2140,7 +2140,7 @@ describe('inspector tests with real metadata', () => { ) matchInlineSnapshotBrowser(metadata.computedStyle?.['opacity'], `"1"`) - matchInlineSnapshotBrowser(opacityControl.value, `"1"`) + matchInlineSnapshotBrowser(opacityControl.value, `"100%"`) matchInlineSnapshotBrowser( opacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"detected"`, @@ -4312,14 +4312,14 @@ describe('Undo behavior in inspector', () => { }) const opacityControl = (await renderResult.renderedDOM.findByTestId( - 'opacity-number-input', + 'opacity', )) as HTMLInputElement - matchInlineSnapshotBrowser(opacityControl.value, `"0.5"`) + matchInlineSnapshotBrowser(opacityControl.value, `"50%"`) // change the opacity of the selected element - await setControlValue('opacity-number-input', '0.6', renderResult.renderedDOM) + await setControlValue('opacity', '60', renderResult.renderedDOM) - matchInlineSnapshotBrowser(opacityControl.value, `"0.6"`) + matchInlineSnapshotBrowser(opacityControl.value, `"60%"`) matchInlineSnapshotBrowser( opacityControl.attributes.getNamedItemNS(null, 'data-controlstatus')?.value, `"simple"`, @@ -4332,7 +4332,7 @@ describe('Undo behavior in inspector', () => { // type a new value '0.8' to opacityControl await act(async () => { - fireEvent.change(opacityControl, { target: { value: '0.8' } }) + fireEvent.change(opacityControl, { target: { value: '80' } }) }) // press Cmd + Z on the opacityControl @@ -4343,9 +4343,8 @@ describe('Undo behavior in inspector', () => { // the control's value should now be undone matchInlineSnapshotBrowser( - ((await renderResult.renderedDOM.findByTestId('opacity-number-input')) as HTMLInputElement) - .value, - `"0.5"`, + ((await renderResult.renderedDOM.findByTestId('opacity')) as HTMLInputElement).value, + `"50%"`, ) // await for the code to be updated diff --git a/editor/src/components/inspector/controls/root-element-indicator.tsx b/editor/src/components/inspector/controls/root-element-indicator.tsx index fd594840b096..0bb5b1ce871b 100644 --- a/editor/src/components/inspector/controls/root-element-indicator.tsx +++ b/editor/src/components/inspector/controls/root-element-indicator.tsx @@ -8,6 +8,7 @@ export const RootElementIndicator = () => { justifyContent: 'center', alignItems: 'center', background: colorTheme.inspectorBackground.value, + height: 34, }} >
{ alignItems: 'center', height: UtopiaTheme.layout.rowHeight.normal, background: colorTheme.inspectorBackground.value, - padding: '8px 0', + padding: '8px 0px', + flexShrink: 0, }} > ((props: InspectorProps) => { 'Inspector shouldShowGridCellSection', ) + const shouldShowContainerSection = + selectedViews.length > 0 && inspectorPreferences.includes('layout') + function renderInspectorContents() { return ( @@ -450,9 +455,18 @@ export const Inspector = React.memo((props: InspectorProps) => { paddingBottom: 50, }} > + {rootElementIsSelected ? ( + + ) : ( + when( + shouldShowAlignmentButtons, + , + ) + )} {anyComponents || multiselectedContract === 'fragment' ? ( ) : null} + {unless( shouldHideInspectorSections, ((props: InspectorProps) => { {when( shouldShowStyleSectionContents, <> - {rootElementIsSelected ? ( - - ) : ( - when( - shouldShowAlignmentButtons, - , - ) - )} {when(multiselectedContract === 'fragment', )} {when( multiselectedContract !== 'fragment' && shouldShowSimplifiedLayoutSection, // Position and Sizing sections are shown if Frame or Group is selected <> + {when(shouldShowContainerSection, )} , )} diff --git a/editor/src/components/inspector/sections/component-section/component-section.tsx b/editor/src/components/inspector/sections/component-section/component-section.tsx index e2ebe28ee57c..18c84925e48c 100644 --- a/editor/src/components/inspector/sections/component-section/component-section.tsx +++ b/editor/src/components/inspector/sections/component-section/component-section.tsx @@ -1534,7 +1534,6 @@ export const ComponentSectionInner = React.memo((props: ComponentSectionProps) = padded={false} variant='<----------1fr---------><-auto->' style={{ - borderTop: `1px solid ${colorTheme.seperator.value}`, padding: `0 ${UtopiaTheme.layout.inspectorXPadding}px`, alignItems: 'center', gap: 8, diff --git a/editor/src/components/inspector/sections/layout-section/layout-system-subsection/layout-system-controls.tsx b/editor/src/components/inspector/sections/layout-section/layout-system-subsection/layout-system-controls.tsx index 83b0f14b07f2..195ef10d7705 100644 --- a/editor/src/components/inspector/sections/layout-section/layout-system-subsection/layout-system-controls.tsx +++ b/editor/src/components/inspector/sections/layout-section/layout-system-subsection/layout-system-controls.tsx @@ -393,7 +393,6 @@ export const PaddingControl = React.memo(() => { mode={modeToUse} onCycleMode={onCycleMode} values={values} - cycleModePosition='back' /> ) }) diff --git a/editor/src/components/inspector/sections/layout-section/layout-system-subsection/split-chained-number-input.tsx b/editor/src/components/inspector/sections/layout-section/layout-system-subsection/split-chained-number-input.tsx index 1093c72e545e..1cdac1268c4c 100644 --- a/editor/src/components/inspector/sections/layout-section/layout-system-subsection/split-chained-number-input.tsx +++ b/editor/src/components/inspector/sections/layout-section/layout-system-subsection/split-chained-number-input.tsx @@ -102,8 +102,6 @@ export interface SplitChainedNumberInputValues { } } -export type CycleModePosition = 'front' | 'back' - export interface SplitChainedNumberInputProps { name: string mode: ControlMode | null @@ -131,7 +129,6 @@ export interface SplitChainedNumberInputProps { values: SplitChainedNumberInputValues numberType: CSSNumberType eventHandler: SplitChainedNumberInputEventHandler - cycleModePosition?: CycleModePosition } export type SplitChainedNumberInputEventHandler = ( @@ -460,7 +457,6 @@ const whenCSSNumber = (fn: (v: CSSNumber | null) => any) => (v: UnknownOrEmptyIn export const SplitChainedNumberInput = React.memo((props: SplitChainedNumberInputProps) => { const { name, canvasControls, numberType, eventHandler, labels, values } = props - const cycleModePosition = props.cycleModePosition ?? 'front' const setHoveredCanvasControls = useSetAtom(InspectorHoveredCanvasControls) const setFocusedCanvasControls = useSetAtom(InspectorFocusedCanvasControls) @@ -524,7 +520,7 @@ export const SplitChainedNumberInput = React.memo((props: SplitChainedNumberInpu case 'one-value': return [ { - style: { width: '25%' }, + style: { width: '50%' }, value: values.oneValue?.value, DEPRECATED_labelBelow: labels?.oneValue ?? '↔', minimum: 0, @@ -555,58 +551,58 @@ export const SplitChainedNumberInput = React.memo((props: SplitChainedNumberInpu case 'per-direction': return [ { - style: { width: '25%' }, - value: values.twoValue.horizontal?.value, - DEPRECATED_labelBelow: labels?.horizontal ?? 'H', + style: { width: '48%' }, + value: values.twoValue.vertical?.value, + DEPRECATED_labelBelow: labels?.vertical ?? 'V', minimum: 0, - onSubmitValue: onSubmitValueHorizontal(false), - onTransientSubmitValue: onSubmitValueHorizontal(true), + onSubmitValue: onSubmitValueVertical(false), + onTransientSubmitValue: onSubmitValueVertical(true), numberType: numberType, - controlStatus: values.twoValue.horizontal?.controlStatus, + controlStatus: values.twoValue.vertical?.controlStatus, defaultUnitToHide: 'px', onMouseEnter: onMouseEnterForControls([ - rightCanvasControls?.onHover, - leftCanvasControls?.onHover, + topCanvasControls?.onHover, + bottomCanvasControls?.onHover, ]), onMouseLeave: onMouseLeave, inputProps: { onFocus: onFocusForControls([ - rightCanvasControls?.onFocus, - leftCanvasControls?.onFocus, + topCanvasControls?.onFocus, + bottomCanvasControls?.onFocus, ]), onBlur: onBlur, }, - testId: `${name}-H`, + testId: `${name}-V`, }, { - style: { width: '25%' }, - value: values.twoValue.vertical?.value, - DEPRECATED_labelBelow: labels?.vertical ?? 'V', + style: { width: '48%' }, + value: values.twoValue.horizontal?.value, + DEPRECATED_labelBelow: labels?.horizontal ?? 'H', minimum: 0, - onSubmitValue: onSubmitValueVertical(false), - onTransientSubmitValue: onSubmitValueVertical(true), + onSubmitValue: onSubmitValueHorizontal(false), + onTransientSubmitValue: onSubmitValueHorizontal(true), numberType: numberType, - controlStatus: values.twoValue.vertical?.controlStatus, + controlStatus: values.twoValue.horizontal?.controlStatus, defaultUnitToHide: 'px', onMouseEnter: onMouseEnterForControls([ - topCanvasControls?.onHover, - bottomCanvasControls?.onHover, + rightCanvasControls?.onHover, + leftCanvasControls?.onHover, ]), onMouseLeave: onMouseLeave, inputProps: { onFocus: onFocusForControls([ - topCanvasControls?.onFocus, - bottomCanvasControls?.onFocus, + rightCanvasControls?.onFocus, + leftCanvasControls?.onFocus, ]), onBlur: onBlur, }, - testId: `${name}-V`, + testId: `${name}-H`, }, ] case 'per-side': return [ { - style: { width: '25%' }, + style: { width: '48%' }, value: values.fourValue.top?.value, DEPRECATED_labelBelow: labels?.top ?? 'T', minimum: 0, @@ -624,7 +620,7 @@ export const SplitChainedNumberInput = React.memo((props: SplitChainedNumberInpu testId: `${name}-T`, }, { - style: { width: '25%' }, + style: { width: '48%' }, value: values.fourValue.right?.value, DEPRECATED_labelBelow: labels?.right ?? 'R', minimum: 0, @@ -642,40 +638,40 @@ export const SplitChainedNumberInput = React.memo((props: SplitChainedNumberInpu testId: `${name}-R`, }, { - style: { width: '25%' }, - value: values.fourValue.bottom?.value, - DEPRECATED_labelBelow: labels?.bottom ?? 'B', + style: { width: '48%' }, + value: values.fourValue.left?.value, + DEPRECATED_labelBelow: labels?.left ?? 'L', minimum: 0, - onSubmitValue: onSubmitValueBottom(false), - onTransientSubmitValue: onSubmitValueBottom(true), - controlStatus: values.fourValue.bottom?.controlStatus, + onSubmitValue: onSubmitValueLeft(false), + onTransientSubmitValue: onSubmitValueLeft(true), + controlStatus: values.fourValue.left?.controlStatus, numberType: numberType, defaultUnitToHide: 'px', - onMouseEnter: onMouseEnterForControls([bottomCanvasControls?.onHover]), + onMouseEnter: onMouseEnterForControls([leftCanvasControls?.onHover]), onMouseLeave: onMouseLeave, inputProps: { - onFocus: onFocusForControls([bottomCanvasControls?.onFocus]), + onFocus: onFocusForControls([leftCanvasControls?.onFocus]), onBlur: onBlur, }, - testId: `${name}-B`, + testId: `${name}-L`, }, { - style: { width: '25%' }, - value: values.fourValue.left?.value, - DEPRECATED_labelBelow: labels?.left ?? 'L', + style: { width: '48%' }, + value: values.fourValue.bottom?.value, + DEPRECATED_labelBelow: labels?.bottom ?? 'B', minimum: 0, - onSubmitValue: onSubmitValueLeft(false), - onTransientSubmitValue: onSubmitValueLeft(true), - controlStatus: values.fourValue.left?.controlStatus, + onSubmitValue: onSubmitValueBottom(false), + onTransientSubmitValue: onSubmitValueBottom(true), + controlStatus: values.fourValue.bottom?.controlStatus, numberType: numberType, defaultUnitToHide: 'px', - onMouseEnter: onMouseEnterForControls([leftCanvasControls?.onHover]), + onMouseEnter: onMouseEnterForControls([bottomCanvasControls?.onHover]), onMouseLeave: onMouseLeave, inputProps: { - onFocus: onFocusForControls([leftCanvasControls?.onFocus]), + onFocus: onFocusForControls([bottomCanvasControls?.onFocus]), onBlur: onBlur, }, - testId: `${name}-L`, + testId: `${name}-B`, }, ] case null: @@ -731,7 +727,7 @@ export const SplitChainedNumberInput = React.memo((props: SplitChainedNumberInpu {modeIcon} @@ -745,15 +741,17 @@ export const SplitChainedNumberInput = React.memo((props: SplitChainedNumberInpu display: 'flex', flexDirection: 'row', gap: 10, + justifyContent: 'space-between', + flex: 1, }} > - {when(cycleModePosition === 'front', cycleModeControl)} - {when(cycleModePosition === 'back', cycleModeControl)} + {cycleModeControl}
) }) diff --git a/editor/src/components/inspector/sections/layout-section/self-layout-subsection/clip-content-control.tsx b/editor/src/components/inspector/sections/layout-section/self-layout-subsection/clip-content-control.tsx index 8f0576c863ff..50223da80cf2 100644 --- a/editor/src/components/inspector/sections/layout-section/self-layout-subsection/clip-content-control.tsx +++ b/editor/src/components/inspector/sections/layout-section/self-layout-subsection/clip-content-control.tsx @@ -1,6 +1,7 @@ import React from 'react' import { useInspectorStyleInfo, useIsSubSectionVisible } from '../../../common/property-path-hooks' import { BooleanControl } from '../../../controls/boolean-control' +import { FlexRow } from 'utopia-api' export const ClipContentControl = React.memo(() => { const isVisible = useIsSubSectionVisible('overflow') @@ -19,7 +20,7 @@ export const ClipContentControl = React.memo(() => { } return ( - <> + { onSubmitValue={onSubmitValue} /> Clip content - + ) }) diff --git a/editor/src/components/inspector/sections/layout-section/self-layout-subsection/simplified-layout-subsection.tsx b/editor/src/components/inspector/sections/layout-section/self-layout-subsection/simplified-layout-subsection.tsx index 9c300d94771b..62c2eb4b69db 100644 --- a/editor/src/components/inspector/sections/layout-section/self-layout-subsection/simplified-layout-subsection.tsx +++ b/editor/src/components/inspector/sections/layout-section/self-layout-subsection/simplified-layout-subsection.tsx @@ -28,8 +28,8 @@ export const SimplifiedLayoutSubsection = React.memo(() => { const showWrapperSectionWarning = selectedElementContract === 'wrapper-div' return ( - - + + { ['mixBlendMode'], blendModeMetadata.onUnsetValues, ) - return ( - - Blendmode - - + ) }) diff --git a/editor/src/components/inspector/sections/style-section/container-subsection/container-subsection.tsx b/editor/src/components/inspector/sections/style-section/container-subsection/container-subsection.tsx index b81fd0050833..8ae8b7ccfeff 100644 --- a/editor/src/components/inspector/sections/style-section/container-subsection/container-subsection.tsx +++ b/editor/src/components/inspector/sections/style-section/container-subsection/container-subsection.tsx @@ -1,37 +1,18 @@ import React from 'react' -import { FlexRow, Icons, InspectorSubsectionHeader } from '../../../../../uuiui' -import { SeeMoreHOC, useToggle } from '../../../widgets/see-more' +import { colorTheme } from '../../../../../uuiui' import { PaddingRow } from '../../layout-section/layout-system-subsection/layout-system-controls' import { BlendModeRow } from './blendmode-row' import { OpacityRow } from './opacity-row' -import { OverflowRow } from './overflow-row' +import { UIGridRow } from '../../../widgets/ui-grid-row' export const ContainerSubsection = React.memo(() => { - const [seeMoreVisible, toggleSeeMoreVisible] = useToggle(false) - return ( - <> - - - Container - - - - - - - +
+ <--1fr-->|22px|'}> + - - + + +
) }) diff --git a/editor/src/components/inspector/sections/style-section/container-subsection/opacity-row.tsx b/editor/src/components/inspector/sections/style-section/container-subsection/opacity-row.tsx index 87d0c7edf194..8a2d1f82c7a9 100644 --- a/editor/src/components/inspector/sections/style-section/container-subsection/opacity-row.tsx +++ b/editor/src/components/inspector/sections/style-section/container-subsection/opacity-row.tsx @@ -1,28 +1,11 @@ -import React from 'react' +import React, { useCallback } from 'react' import * as PP from '../../../../../core/shared/property-path' -import { PropertyLabel } from '../../../widgets/property-label' -import { UIGridRow } from '../../../widgets/ui-grid-row' import { useInspectorStyleInfo, useIsSubSectionVisible } from '../../../common/property-path-hooks' -import { useWrappedEmptyOrUnknownOnSubmitValue, NumberInput } from '../../../../../uuiui' -import { - CSSUtils, - InspectorContextMenuItems, - InspectorContextMenuWrapper, - SliderControl, -} from '../../../../../uuiui-deps' -import { SliderNumberControl } from '../../../controls/slider-number-control' -import type { CSSNumber } from '../../../common/css-utils' +import { useWrappedEmptyOrUnknownOnSubmitValue, SimplePercentInput } from '../../../../../uuiui' +import { InspectorContextMenuItems, InspectorContextMenuWrapper } from '../../../../../uuiui-deps' import { setCSSNumberValue } from '../../../common/css-utils' +import { PropertyLabel } from '../../../widgets/property-label' -const sliderControlOptions = { - minimum: 0, - maximum: 1, - stepSize: 0.01, - origin: 1, - filled: true, -} - -// TODO: path should match target const opacityProp = [PP.create('style', 'opacity')] export const OpacityRow = React.memo(() => { @@ -32,19 +15,10 @@ export const OpacityRow = React.memo(() => { const scale = opacity.unit === '%' ? 100 : 1 const isVisible = useIsSubSectionVisible('opacity') - const updateScaledValue = React.useCallback( - (newValue: number, oldValue: CSSNumber) => { - return setCSSNumberValue(oldValue, newValue * scale) - }, - [scale], - ) - const [onScaledSubmit, onScaledTransientSubmit] = - opacityMetadata.useSubmitValueFactory(updateScaledValue) - const transformNewScaledValue = React.useCallback<(newValue: number) => CSSNumber>( - (newValue) => updateScaledValue(newValue, opacity), - [updateScaledValue, opacity], - ) + const handleMouseDown = useCallback((e: React.MouseEvent) => { + e.stopPropagation() + }, []) const opacityContextMenuItems = InspectorContextMenuItems.optionalAddOnUnsetValues( opacity != null, @@ -53,11 +27,12 @@ export const OpacityRow = React.memo(() => { ) const wrappedOnSubmitValue = useWrappedEmptyOrUnknownOnSubmitValue( - opacityMetadata.onSubmitValue, + (value: number) => opacityMetadata.onSubmitValue(setCSSNumberValue(opacity, value * scale)), opacityMetadata.onUnsetValues, ) const wrappedOnTransientSubmitValue = useWrappedEmptyOrUnknownOnSubmitValue( - opacityMetadata.onTransientSubmitValue, + (value: number) => + opacityMetadata.onTransientSubmitValue(setCSSNumberValue(opacity, value * scale)), opacityMetadata.onUnsetValues, ) @@ -71,28 +46,23 @@ export const OpacityRow = React.memo(() => { items={opacityContextMenuItems} data={null} > - - Opacity - - + α} + minimum={0} + maximum={1} + stepSize={0.01} + inputProps={{ onMouseDown: handleMouseDown }} + defaultUnitToHide={null} + incrementControls={false} + /> ) }) diff --git a/editor/src/components/inspector/sections/style-section/container-subsection/radius-row.tsx b/editor/src/components/inspector/sections/style-section/container-subsection/radius-row.tsx index 832cd1a11d8d..e7a5d0b1f926 100644 --- a/editor/src/components/inspector/sections/style-section/container-subsection/radius-row.tsx +++ b/editor/src/components/inspector/sections/style-section/container-subsection/radius-row.tsx @@ -252,7 +252,6 @@ export const BorderRadiusControl = React.memo(() => { values={values} canvasControls={canvasControlsForSides} eventHandler={eventHandler} - cycleModePosition='back' /> ) }) diff --git a/editor/src/components/inspector/sections/style-section/style-section.tsx b/editor/src/components/inspector/sections/style-section/style-section.tsx index 846c57157f0d..69399b5c76ef 100644 --- a/editor/src/components/inspector/sections/style-section/style-section.tsx +++ b/editor/src/components/inspector/sections/style-section/style-section.tsx @@ -37,13 +37,11 @@ export const StyleSection = React.memo(() => { 'StyleSection inspectorPreferences', ) - const shouldShowContainerSection = inspectorPreferences.includes('layout') const shouldTextContainerSection = inspectorPreferences.includes('typography') const shouldShowVisualSections = inspectorPreferences.includes('visual') return ( - {when(shouldShowContainerSection, )} {when(shouldTextContainerSection, )} {when( shouldShowVisualSections, diff --git a/editor/src/components/inspector/widgets/ui-grid-row.tsx b/editor/src/components/inspector/widgets/ui-grid-row.tsx index e0642f8b7a32..6b520f685c5d 100644 --- a/editor/src/components/inspector/widgets/ui-grid-row.tsx +++ b/editor/src/components/inspector/widgets/ui-grid-row.tsx @@ -66,6 +66,10 @@ const gridTemplates = { gridColumnGap: 4, gridTemplateColumns: '1fr 1fr', }, + '<--1fr--><--1fr-->|22px|': { + gridColumnGap: 4, + gridTemplateColumns: '1fr 1fr 22px', + }, '<--1fr--><--1fr-->|-18px-|': { gridColumnGap: 4, // multiple columns with 1fr don't actually resize evenly as expected, diff --git a/editor/src/components/navigator/left-pane/settings-pane.tsx b/editor/src/components/navigator/left-pane/settings-pane.tsx index eabf0432fda7..0b2b1d9f6352 100644 --- a/editor/src/components/navigator/left-pane/settings-pane.tsx +++ b/editor/src/components/navigator/left-pane/settings-pane.tsx @@ -330,7 +330,12 @@ export const SettingsPane = React.memo(() => { Theme - + { [selectComponents([EP.appendNewElementPath(TestScenePath, ['parent'])], false)], false, ) - expect(renderResult.renderedDOM.getByText('Opacity')).toBeDefined() + expect(renderResult.renderedDOM.getByText('Background')).toBeDefined() await renderResult.dispatch( [selectComponents([EP.appendNewElementPath(TestScenePath, ['parent', 'bbb'])], false)], @@ -65,7 +65,7 @@ describe('React Render Count Tests -', () => { const renderCountAfter = renderResult.getNumberOfRenders() // if this breaks, GREAT NEWS but update the test please :) - expect(renderCountAfter - renderCountBefore).toMatchInlineSnapshot(`815`) + expect(renderCountAfter - renderCountBefore).toMatchInlineSnapshot(`747`) expect(renderResult.getRenderInfo()).toMatchSnapshot() }) @@ -89,7 +89,7 @@ describe('React Render Count Tests -', () => { [selectComponents([EP.appendNewElementPath(TestScenePath, ['parent'])], false)], false, ) - expect(renderResult.renderedDOM.getByText('Opacity')).toBeDefined() + expect(renderResult.renderedDOM.getByText('Background')).toBeDefined() await renderResult.dispatch( [selectComponents([EP.appendNewElementPath(TestScenePath, ['parent', 'child'])], false)], @@ -127,7 +127,7 @@ describe('React Render Count Tests -', () => { const renderCountAfter = renderResult.getNumberOfRenders() // if this breaks, GREAT NEWS but update the test please :) - expect(renderCountAfter - renderCountBefore).toMatchInlineSnapshot(`1163`) + expect(renderCountAfter - renderCountBefore).toMatchInlineSnapshot(`1095`) expect(renderResult.getRenderInfo()).toMatchSnapshot() }) @@ -151,7 +151,7 @@ describe('React Render Count Tests -', () => { [selectComponents([EP.appendNewElementPath(TestScenePath, ['parent'])], false)], false, ) - expect(renderResult.renderedDOM.getByText('Opacity')).toBeDefined() + expect(renderResult.renderedDOM.getByText('Background')).toBeDefined() await renderResult.dispatch( [selectComponents([EP.appendNewElementPath(TestScenePath, ['parent', 'bbb'])], false)], @@ -183,7 +183,7 @@ describe('React Render Count Tests -', () => { const renderCountAfter = renderResult.getNumberOfRenders() // if this breaks, GREAT NEWS but update the test please :) - expect(renderCountAfter - renderCountBefore).toMatchInlineSnapshot(`538`) + expect(renderCountAfter - renderCountBefore).toMatchInlineSnapshot(`530`) expect(renderResult.getRenderInfo()).toMatchSnapshot() }) @@ -212,7 +212,7 @@ describe('React Render Count Tests -', () => { [selectComponents([EP.appendNewElementPath(TestScenePath, ['parent'])], false)], false, ) - expect(renderResult.renderedDOM.getByText('Opacity')).toBeDefined() + expect(renderResult.renderedDOM.getByText('Background')).toBeDefined() await renderResult.dispatch( [selectComponents([EP.appendNewElementPath(TestScenePath, ['parent', 'bbb'])], false)], @@ -249,7 +249,7 @@ describe('React Render Count Tests -', () => { const renderCountAfter = renderResult.getNumberOfRenders() // if this breaks, GREAT NEWS but update the test please :) - expect(renderCountAfter - renderCountBefore).toMatchInlineSnapshot(`711`) + expect(renderCountAfter - renderCountBefore).toMatchInlineSnapshot(`703`) expect(renderResult.getRenderInfo()).toMatchSnapshot() }) }) diff --git a/editor/src/uuiui/inputs/number-input.tsx b/editor/src/uuiui/inputs/number-input.tsx index 82b7bbc0c939..53a38593fa69 100644 --- a/editor/src/uuiui/inputs/number-input.tsx +++ b/editor/src/uuiui/inputs/number-input.tsx @@ -677,6 +677,7 @@ export const NumberInput = React.memo( borderRadius: 2, display: 'flex', flexDirection: 'row', + gap: 5, alignItems: 'center', boxShadow: 'inset 0px 0px 0px 1px transparent', ...chainedStyles, @@ -807,31 +808,22 @@ export const NumberInput = React.memo( ) : null} {DEPRECATED_labelBelow == null && controlStatus != 'off' ? null : ( - - {isFauxcused ? ( -
- ) : null} -
- {DEPRECATED_labelBelow} -
-
+
+ {DEPRECATED_labelBelow} +
)} void + wrap?: boolean } export const ChainedNumberInput: React.FunctionComponent< React.PropsWithChildren -> = React.memo(({ propsArray, idPrefix, style, setGlobalCursor }) => { +> = React.memo(({ propsArray, idPrefix, style, setGlobalCursor, wrap }) => { return ( - + {propsArray.map((props, i) => { switch (i) { case 0: { diff --git a/editor/src/uuiui/widgets/popup-list/popup-list.tsx b/editor/src/uuiui/widgets/popup-list/popup-list.tsx index fbc73e695248..d9fa7d749394 100644 --- a/editor/src/uuiui/widgets/popup-list/popup-list.tsx +++ b/editor/src/uuiui/widgets/popup-list/popup-list.tsx @@ -671,6 +671,13 @@ export const PopupList = React.memo( outline: '0 !important', position: 'relative', transition: 'all 100ms', + paddingRight: 4, + '&:hover': { + justifyContent: 'space-between', + }, + '&:focus-within': { + justifyContent: 'space-between', + }, }), singleValue: () => ({ label: 'singleValue', @@ -734,12 +741,11 @@ export const PopupList = React.memo( height: OptionHeight, boxSizing: 'border-box', overflow: 'hidden', - padding: `2px 2px 2px ${ValueContainerLeftPadding}px`, + padding: `2px 8px 2px ${ValueContainerLeftPadding}px`, position: 'relative', borderRadius: UtopiaTheme.inputBorderRadius, display: 'flex', alignItems: 'center', - flexGrow: containerMode === 'noBorder' ? 0 : 1, }), indicatorSeparator: displayNone, clearIndicator: displayNone,