diff --git a/packages/components/src/range-control/styles/range-control-styles.js b/packages/components/src/range-control/styles/range-control-styles.js index 8ec40ad9b82e02..2b7b6ec86da9f1 100644 --- a/packages/components/src/range-control/styles/range-control-styles.js +++ b/packages/components/src/range-control/styles/range-control-styles.js @@ -12,8 +12,11 @@ import NumberControl from '../../number-control'; import { COLORS, reduceMotion, rtl } from '../../utils'; import { space } from '../../ui/utils/space'; -const rangeHeight = () => css( { height: 30, minHeight: 30 } ); -const thumbSize = 12; +const rangeHeightValue = 30; +const railHeight = 4; +const rangeHeight = () => + css( { height: rangeHeightValue, minHeight: rangeHeightValue } ); +const thumbSize = 9; export const Root = styled.div` -webkit-tap-highlight-color: transparent; @@ -38,7 +41,6 @@ export const Wrapper = styled.div` color: ${ COLORS.blue.medium.focus }; display: block; flex: 1; - padding-top: 18px; position: relative; width: 100%; @@ -48,13 +50,13 @@ export const Wrapper = styled.div` `; export const BeforeIconWrapper = styled.span` - margin-top: 3px; + margin-top: ${ railHeight }px; ${ rtl( { marginRight: 6 } ) } `; export const AfterIconWrapper = styled.span` - margin-top: 3px; + margin-top: ${ railHeight }px; ${ rtl( { marginLeft: 16 } ) } `; @@ -78,11 +80,11 @@ export const Rail = styled.span` pointer-events: none; right: 0; display: block; - height: 3px; + height: ${ railHeight }px; position: absolute; - margin-top: 14px; + margin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px; top: 0; - border-radius: 9999px; + border-radius: ${ railHeight }px; ${ railBackgroundColor }; `; @@ -101,13 +103,13 @@ const trackBackgroundColor = ( { disabled, trackColor } ) => { export const Track = styled.span` background-color: currentColor; - border-radius: 9999px; + border-radius: ${ railHeight }px; box-sizing: border-box; - height: 3px; + height: ${ railHeight }px; pointer-events: none; display: block; position: absolute; - margin-top: 14px; + margin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px; top: 0; ${ trackBackgroundColor }; @@ -136,7 +138,7 @@ const markFill = ( { disabled, isFilled } ) => { export const Mark = styled.span` box-sizing: border-box; - height: 9px; + height: ${ thumbSize }px; left: 0; position: absolute; top: -4px; @@ -179,7 +181,7 @@ export const ThumbWrapper = styled.span` display: flex; height: ${ thumbSize }px; justify-content: center; - margin-top: 9px; + margin-top: ${ ( rangeHeightValue - thumbSize ) / 2 }px; outline: 0; pointer-events: none; position: absolute; @@ -261,7 +263,7 @@ const tooltipPosition = ( { position } ) => { }; export const Tooltip = styled.span` - background: ${ COLORS.ui.border }; + background: rgba( 0, 0, 0, 0.8 ); border-radius: 2px; box-sizing: border-box; color: white; diff --git a/packages/components/src/ui/color-picker/color-display.tsx b/packages/components/src/ui/color-picker/color-display.tsx index 3a3d5097a8db31..16a83aa1941d62 100644 --- a/packages/components/src/ui/color-picker/color-display.tsx +++ b/packages/components/src/ui/color-picker/color-display.tsx @@ -164,7 +164,12 @@ export const ColorDisplay = ( { } > - + diff --git a/packages/components/src/ui/color-picker/component.tsx b/packages/components/src/ui/color-picker/component.tsx index 977826c6ccf958..984ef6d30b39fb 100644 --- a/packages/components/src/ui/color-picker/component.tsx +++ b/packages/components/src/ui/color-picker/component.tsx @@ -9,7 +9,7 @@ import type { ColorFormats } from 'tinycolor2'; * WordPress dependencies */ import { useState } from '@wordpress/element'; -import { moreVertical } from '@wordpress/icons'; +import { settings } from '@wordpress/icons'; import { useDebounce } from '@wordpress/compose'; import { __ } from '@wordpress/i18n'; @@ -22,9 +22,13 @@ import { WordPressComponentProps, } from '../context'; import { HStack } from '../../h-stack'; -import Button from '../../button'; import { Spacer } from '../../spacer'; -import { ColorfulWrapper, SelectControl } from './styles'; +import { + ColorfulWrapper, + SelectControl, + AuxiliaryColorArtefactWrapper, + DetailsControlButton, +} from './styles'; import { ColorDisplay } from './color-display'; import { ColorInput } from './color-input'; import { Picker } from './picker'; @@ -95,44 +99,47 @@ const ColorPicker = ( color={ safeColor } enableAlpha={ enableAlpha } /> - - { showInputs ? ( - - setColorType( nextColorType as ColorType ) + + + { showInputs ? ( + + setColorType( nextColorType as ColorType ) + } + label={ __( 'Color format' ) } + hideLabelFromVision + /> + ) : ( + + ) } + setShowInputs( ! showInputs ) } + icon={ settings } + isPressed={ showInputs } + label={ + showInputs + ? __( 'Hide detailed inputs' ) + : __( 'Show detailed inputs' ) } - label={ __( 'Color format' ) } - hideLabelFromVision /> - ) : ( - + + { showInputs && ( + ) } -