diff --git a/src/plugins/presentation_util/public/components/controls/control_frame/control_frame_component.tsx b/src/plugins/presentation_util/public/components/controls/control_frame/control_frame_component.tsx index f50b8309d93eed..92a9f8e3f1b655 100644 --- a/src/plugins/presentation_util/public/components/controls/control_frame/control_frame_component.tsx +++ b/src/plugins/presentation_util/public/components/controls/control_frame/control_frame_component.tsx @@ -88,7 +88,9 @@ export const ControlFrame = ({ <> {customPrepend ?? null} {usingTwoLineLayout ? undefined : ( - {title} + + {title} + )} } diff --git a/src/plugins/presentation_util/public/components/controls/control_group/component/control_group_component.tsx b/src/plugins/presentation_util/public/components/controls/control_group/component/control_group_component.tsx index 4acfed3f741210..d683c0749d98d8 100644 --- a/src/plugins/presentation_util/public/components/controls/control_group/component/control_group_component.tsx +++ b/src/plugins/presentation_util/public/components/controls/control_group/component/control_group_component.tsx @@ -123,7 +123,11 @@ export const ControlGroup = ({ controlGroupContainer }: ControlGroupProps) => { {draggingId ? ( - + ) : null} diff --git a/src/plugins/presentation_util/public/components/controls/control_group/component/control_group_sortable_item.tsx b/src/plugins/presentation_util/public/components/controls/control_group/component/control_group_sortable_item.tsx index e64320d5b367aa..c59c981e013d0e 100644 --- a/src/plugins/presentation_util/public/components/controls/control_group/component/control_group_sortable_item.tsx +++ b/src/plugins/presentation_util/public/components/controls/control_group/component/control_group_sortable_item.tsx @@ -6,7 +6,13 @@ * Side Public License, v 1. */ -import { EuiFlexItem, EuiFormControlLayout, EuiFormLabel, EuiIcon } from '@elastic/eui'; +import { + EuiFlexItem, + EuiFormControlLayout, + EuiFormLabel, + EuiIcon, + EuiFlexGroup, +} from '@elastic/eui'; import React, { forwardRef, HTMLAttributes } from 'react'; import { useSortable } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities'; @@ -118,26 +124,34 @@ const SortableControlInner = forwardRef< export const ControlClone = ({ embeddableId, container, + width, }: { embeddableId: string; container: ControlGroupContainer; + width: ControlWidth; }) => { const embeddable = useChildEmbeddable({ embeddableId, container }); - + const layout = container.getInput().controlStyle; return ( - - - - {embeddable?.getInput().title} - - } - /> + + {layout === 'twoLine' ? ( + {embeddable?.getInput().title} + ) : undefined} + + + + + {container.getInput().controlStyle === 'oneLine' ? ( + {embeddable?.getInput().title} + ) : undefined} + ); }; diff --git a/src/plugins/presentation_util/public/components/controls/control_group/control_group.scss b/src/plugins/presentation_util/public/components/controls/control_group/control_group.scss index a07ba2e2330188..b5a15637b0dc3c 100644 --- a/src/plugins/presentation_util/public/components/controls/control_group/control_group.scss +++ b/src/plugins/presentation_util/public/components/controls/control_group/control_group.scss @@ -1,17 +1,57 @@ +$smallControl: $euiSize * 14; +$mediumControl: $euiSize * 25; +$largeControl: $euiSize * 50; +$controlMinWidth: $euiSize * 14; .controlGroup { margin-left: $euiSizeXS; overflow-x: clip; // sometimes when using auto width, removing a control can cause a horizontal scrollbar to appear. + min-height: $euiSize * 4; + padding: $euiSize 0; } .controlFrame--cloneWrapper { width: max-content; .euiFormLabel { + padding-bottom: $euiSizeXS; + } + + &-small { + width: $smallControl; + } + + &-medium { + width: $mediumControl; + } + + &-large { + width: $largeControl; + } + + &-twoLine { + margin-top: -$euiSize * 1.25; + } + + .euiFormLabel, div { cursor: grabbing !important; // prevents cursor flickering while dragging the clone } - .controlFrame--formControlLayout { + .controlFrame--draggable { + cursor: grabbing; + height: $euiButtonHeight; + align-items: center; + border-radius: 6px; + @include euiFontSizeS; + font-weight: $euiFontWeightSemiBold; + box-shadow: + #{$euiFormControlBoxShadow}, + inset 0 0 0 1px $euiFormBorderColor; + background-color: $euiFormInputGroupLabelBackground; + min-width: $controlMinWidth; + } + + .controlFrame--formControlLayout, .controlFrame--draggable { &-clone { box-shadow: 0 0 0 1px $euiShadowColor, 0 1px 6px 0 $euiShadowColor; @@ -31,9 +71,14 @@ .controlFrame--formControlLayout { width: 100%; - min-width: $euiSize * 14; + min-width: $controlMinWidth; transition:background-color .1s, color .1s; + &__label { + @include euiTextTruncate; + max-width: 50%; + } + &:not(.controlFrame--formControlLayout-clone) { .controlFrame--dragHandle { cursor: grab; @@ -50,16 +95,18 @@ } } + + &-small { - width: $euiSize * 14; + width: $smallControl; } &-medium { - width: $euiSize * 25; + width: $mediumControl; } &-large { - width: $euiSize * 50; + width: $largeControl; } &-insertBefore, @@ -67,7 +114,7 @@ .controlFrame--formControlLayout:after { content: ''; position: absolute; - background-color: transparentize($euiColorSecondary, .5); + background-color: transparentize($euiColorPrimary, .5); border-radius: $euiBorderRadius; top: 0; bottom: 0; @@ -127,6 +174,7 @@ .controlFrame--formControlLayout { background-color: $euiColorEmptyShade !important; color: transparent !important; + box-shadow: none; .euiFormLabel { opacity: 0;