🎥 Make videos programmatically with React
`@remotion/studio`: Add tooltips to compact controls
JonnyBurger0103129e86e5
diff --git a/packages/studio/src/components/AssetSelectorItem.tsx b/packages/studio/src/components/AssetSelectorItem.tsxindex 9f31fd30dd..6bf8546c86 100644--- a/packages/studio/src/components/AssetSelectorItem.tsx+++ b/packages/studio/src/components/AssetSelectorItem.tsx@@ -43,6 +43,7 @@ import {getCachedImageMetadata} from '../helpers/use-image-metadata';import {getCachedMediaMetadata} from '../helpers/use-media-metadata';import {EllipsisIcon} from '../icons/ellipsis';import {CollapsedFolderIcon, ExpandedFolderIcon} from '../icons/folder';+import {ActionTooltip} from './ActionTooltip';import {getAssetActionAvailability,useAssetContextMenuItems,@@ -390,14 +391,21 @@ const AssetFolderItem: React.FC<{style={inlineActionsStyle}><Spacing x={0.5} />- <InlineDropdown- variant={null}- aria-label="More actions"- renderAction={renderContextMenuAction}- getItems={getContextMenuItems}- style={NO_HOVER_BACKGROUND_STYLE}- className={FOCUS_VISIBLE_ONLY_CLASS_NAME}- />+ <ActionTooltip+ label="More actions"+ shortcut={null}+ delay={800}+ dismissOnClick+ >+ <InlineDropdown+ variant={null}+ aria-label="More actions"+ renderAction={renderContextMenuAction}+ getItems={getContextMenuItems}+ style={NO_HOVER_BACKGROUND_STYLE}+ className={FOCUS_VISIBLE_ONLY_CLASS_NAME}+ />+ </ActionTooltip></div></div></Row>@@ -650,25 +658,39 @@ const AssetSelectorItem: React.FC<{style={inlineActionsStyle}><Spacing x={0.5} />- <InlineDropdown- variant={null}- aria-label="More actions"- renderAction={renderContextMenuAction}- getItems={getContextMenuItems}- style={NO_HOVER_BACKGROUND_STYLE}- className={FOCUS_VISIBLE_ONLY_CLASS_NAME}- />+ <ActionTooltip+ label="More actions"+ shortcut={null}+ delay={800}+ dismissOnClick+ >+ <InlineDropdown+ variant={null}+ aria-label="More actions"+ renderAction={renderContextMenuAction}+ getItems={getContextMenuItems}+ style={NO_HOVER_BACKGROUND_STYLE}+ className={FOCUS_VISIBLE_ONLY_CLASS_NAME}+ />+ </ActionTooltip>{fileExplorerDisabled ? null : (<><Spacing x={0.5} />- <InlineAction- variant={null}- aria-label={`Show in ${fileManagerName}`}- renderAction={renderFileExplorerAction}- onClick={revealInExplorer}- style={NO_HOVER_BACKGROUND_STYLE}- className={FOCUS_VISIBLE_ONLY_CLASS_NAME}- />+ <ActionTooltip+ label={`Show in ${fileManagerName}`}+ shortcut={null}+ delay={800}+ dismissOnClick+ >+ <InlineAction+ variant={null}+ aria-label={`Show in ${fileManagerName}`}+ renderAction={renderFileExplorerAction}+ onClick={revealInExplorer}+ style={NO_HOVER_BACKGROUND_STYLE}+ className={FOCUS_VISIBLE_ONLY_CLASS_NAME}+ />+ </ActionTooltip></>)}</div>diff --git a/packages/studio/src/components/CompositionContextButton.tsx b/packages/studio/src/components/CompositionContextButton.tsxindex c14bb8f273..d2ceb44deb 100644--- a/packages/studio/src/components/CompositionContextButton.tsx+++ b/packages/studio/src/components/CompositionContextButton.tsx@@ -7,6 +7,7 @@ import {NO_HOVER_BACKGROUND_STYLE,} from '../helpers/hoverable';import {EllipsisIcon} from '../icons/ellipsis';+import {ActionTooltip} from './ActionTooltip';import type {RenderInlineAction} from './InlineAction';import {InlineDropdown} from './InlineDropdown';import {Spacing} from './layout';@@ -46,13 +47,21 @@ export const CompositionContextButton: React.FC<{return (<div className={HOVER_GROUP_REVEAL_CLASS_NAME} style={revealStyle}><Spacing x={0.5} />- <InlineDropdown- renderAction={renderAction}- getItems={getItems}- variant={null}- style={NO_HOVER_BACKGROUND_STYLE}- className={FOCUS_VISIBLE_ONLY_CLASS_NAME}- />+ <ActionTooltip+ label="More actions"+ shortcut={null}+ delay={800}+ dismissOnClick+ >+ <InlineDropdown+ renderAction={renderAction}+ getItems={getItems}+ variant={null}+ style={NO_HOVER_BACKGROUND_STYLE}+ className={FOCUS_VISIBLE_ONLY_CLASS_NAME}+ aria-label="More actions"+ />+ </ActionTooltip></div>);};diff --git a/packages/studio/src/components/InspectorLocationCopy.tsx b/packages/studio/src/components/InspectorLocationCopy.tsxindex c64f6092fb..fdbbf92f9a 100644--- a/packages/studio/src/components/InspectorLocationCopy.tsx+++ b/packages/studio/src/components/InspectorLocationCopy.tsx@@ -3,6 +3,7 @@ import type {OriginalPosition} from '../error-overlay/react-overlay/utils/get-soimport {formatContextForAgents} from '../helpers/format-file-location';import {useCopyFeedback} from '../helpers/use-copy-feedback';import {CopyIcon} from '../icons/copy';+import {ActionTooltip} from './ActionTooltip';import type {RenderInlineAction} from './InlineAction';import {InlineAction} from './InlineAction';import {InspectorOpenInEditor} from './InspectorOpenInEditor';@@ -111,12 +112,19 @@ export const InspectorLocationCopy: React.FC<{showTooltips/>{contextForAgents ? (- <InlineAction- variant={null}- onClick={onCopy}- renderAction={renderCopyAction}- aria-label="Copy context for agents"- />+ <ActionTooltip+ label="Copy context for agents"+ shortcut={null}+ delay={800}+ dismissOnClick+ >+ <InlineAction+ variant={null}+ onClick={onCopy}+ renderAction={renderCopyAction}+ aria-label="Copy context for agents"+ />+ </ActionTooltip>) : null}</div>) : null}diff --git a/packages/studio/src/components/InspectorPanel/AlignmentControls.tsx b/packages/studio/src/components/InspectorPanel/AlignmentControls.tsxindex 78accd5add..b486bd6841 100644--- a/packages/studio/src/components/InspectorPanel/AlignmentControls.tsx+++ b/packages/studio/src/components/InspectorPanel/AlignmentControls.tsx@@ -10,6 +10,7 @@ import {AlignCenterVerticalIcon} from '../../icons/align-center-vertical';import {AlignLeftIcon} from '../../icons/align-left';import {AlignRightIcon} from '../../icons/align-right';import {AlignTopIcon} from '../../icons/align-top';+import {ActionTooltip} from '../ActionTooltip';import {InlineAction} from '../InlineAction';import {INSPECTOR_PANEL_HORIZONTAL_PADDING} from '../InspectorPanelLayout';import {getSelectedOutlineActiveSchema} from '../selected-outline-drag';@@ -63,13 +64,15 @@ const AlignmentButton: React.FC<{readonly disabled: boolean;}> = ({onClick, 'aria-label': ariaLabel, Icon, disabled}) => {return (- <InlineAction- variant={null}- aria-label={ariaLabel}- onClick={onClick}- renderAction={(color) => <Icon style={iconStyle} color={color} />}- disabled={disabled}- />+ <ActionTooltip label={ariaLabel} shortcut={null} delay={800} dismissOnClick>+ <InlineAction+ variant={null}+ aria-label={ariaLabel}+ onClick={onClick}+ renderAction={(color) => <Icon style={iconStyle} color={color} />}+ disabled={disabled}+ />+ </ActionTooltip>);};diff --git a/packages/studio/src/components/InspectorSequenceSection.tsx b/packages/studio/src/components/InspectorSequenceSection.tsxindex d37abbb2ba..4d34a29bc5 100644--- a/packages/studio/src/components/InspectorSequenceSection.tsx+++ b/packages/studio/src/components/InspectorSequenceSection.tsx@@ -27,6 +27,7 @@ import {FullscreenIcon} from '../icons/fullscreen';import {Plus} from '../icons/plus';import {SetSelectedModalContext} from '../state/modals';import {Transform3DModeStateContext} from '../state/transform-3d-mode';+import {ActionTooltip} from './ActionTooltip';import {AssetFileIcon} from './AssetFileIcon';import {InlineAction} from './InlineAction';import {InlineCaptionInspector} from './InlineCaptionInspector';@@ -807,63 +808,83 @@ export const InspectorSequenceSection: React.FC<{validatedLocation.source,]);+ const borderRadiusActionLabel =+ borderRadiusConversion === null+ ? borderRadiusUsesShorthand+ ? 'A static border radius is required to use individual corners'+ : 'All four corners must have the same static value'+ : borderRadiusUsesShorthand+ ? 'Use individual corner radii'+ : 'Use one border radius value';const borderRadiusAction = borderRadiusGroup ? (- <InlineAction- variant={null}- disabled={- borderRadiusConversion === null ||- previewServerState.type !== 'connected'- }- onClick={onConvertBorderRadius}- aria-label={- borderRadiusConversion === null- ? borderRadiusUsesShorthand- ? 'A static border radius is required to use individual corners'- : 'All four corners must have the same static value'- : borderRadiusUsesShorthand- ? 'Use individual corner radii'- : 'Use one border radius value'- }- renderAction={(color) =>- borderRadiusUsesShorthand ? (- <FullscreenIcon color={color} style={borderRadiusToggleIcon} />- ) : (- <BorderRadiusIcon color={color} style={borderRadiusToggleIcon} />- )- }- />+ <ActionTooltip+ label={borderRadiusActionLabel}+ shortcut={null}+ delay={800}+ dismissOnClick+ >+ <InlineAction+ variant={null}+ disabled={+ borderRadiusConversion === null ||+ previewServerState.type !== 'connected'+ }+ onClick={onConvertBorderRadius}+ aria-label={borderRadiusActionLabel}+ renderAction={(color) =>+ borderRadiusUsesShorthand ? (+ <FullscreenIcon color={color} style={borderRadiusToggleIcon} />+ ) : (+ <BorderRadiusIcon color={color} style={borderRadiusToggleIcon} />+ )+ }+ />+ </ActionTooltip>) : null;+ const transform3DActionLabel = automaticallyEnabled3DTransform+ ? '3D controls are required by the current transform values'+ : show3DTransformControls+ ? 'Hide 3D transform controls'+ : 'Show 3D transform controls';const transform3DAction = (- <InlineAction- variant={null}- disabled={automaticallyEnabled3DTransform}- onClick={onToggle3DTransform}- aria-label={- automaticallyEnabled3DTransform- ? '3D controls are required by the current transform values'- : show3DTransformControls- ? 'Hide 3D transform controls'- : 'Show 3D transform controls'- }- hoveredColor={show3DTransformControls ? BLUE : undefined}- unhoveredColor={show3DTransformControls ? BLUE : LIGHT_TEXT}- renderAction={(color) => (- <CubeIcon color={color} style={transform3DToggleIcon} />- )}- />+ <ActionTooltip+ label={transform3DActionLabel}+ shortcut={null}+ delay={800}+ dismissOnClick+ >+ <InlineAction+ variant={null}+ disabled={automaticallyEnabled3DTransform}+ onClick={onToggle3DTransform}+ aria-label={transform3DActionLabel}+ hoveredColor={show3DTransformControls ? BLUE : undefined}+ unhoveredColor={show3DTransformControls ? BLUE : LIGHT_TEXT}+ renderAction={(color) => (+ <CubeIcon color={color} style={transform3DToggleIcon} />+ )}+ />+ </ActionTooltip>);const effectsHeader = (<CollapsibleInspectorSectionHeaderaction={- <InlineAction- variant={null}- disabled={!canAddEffect}- onClick={onAddEffect}- aria-label={canAddEffect ? 'Add effect' : undefined}- renderAction={(color) => <Plus color={color} style={plusIcon} />}- />+ <ActionTooltip+ label="Add effect"+ shortcut={null}+ delay={800}+ dismissOnClick+ >+ <InlineAction+ variant={null}+ disabled={!canAddEffect}+ onClick={onAddEffect}+ aria-label="Add effect"+ renderAction={(color) => <Plus color={color} style={plusIcon} />}+ />+ </ActionTooltip>}expanded={effectsExpanded}label="Effects"diff --git a/packages/studio/src/components/RenderModal/InlineEyeIcon.tsx b/packages/studio/src/components/RenderModal/InlineEyeIcon.tsxindex 1a7aebabb9..de6522af6f 100644--- a/packages/studio/src/components/RenderModal/InlineEyeIcon.tsx+++ b/packages/studio/src/components/RenderModal/InlineEyeIcon.tsx@@ -1,5 +1,6 @@import {useCallback} from 'react';import {CURRENT_COLOR} from '../../helpers/colors';+import {ActionTooltip} from '../ActionTooltip';import type {RenderInlineAction} from '../InlineAction';import {InlineAction} from '../InlineAction';@@ -32,12 +33,16 @@ export const InlineEyeButton: React.FC<{},[enabled],);+ const label = enabled ? 'Show value' : 'Hide value';return (- <InlineAction- renderAction={renderAction}- onClick={onClick}- variant={null}- />+ <ActionTooltip label={label} shortcut={null} delay={800} dismissOnClick>+ <InlineAction+ renderAction={renderAction}+ onClick={onClick}+ variant={null}+ aria-label={label}+ />+ </ActionTooltip>);};diff --git a/packages/studio/src/components/RenderModal/InlineRemoveButton.tsx b/packages/studio/src/components/RenderModal/InlineRemoveButton.tsxindex d7aab2602a..92b29496da 100644--- a/packages/studio/src/components/RenderModal/InlineRemoveButton.tsx+++ b/packages/studio/src/components/RenderModal/InlineRemoveButton.tsx@@ -1,5 +1,6 @@import {useCallback} from 'react';import {CURRENT_COLOR} from '../../helpers/colors';+import {ActionTooltip} from '../ActionTooltip';import type {RenderInlineAction} from '../InlineAction';import {InlineAction} from '../InlineAction';@@ -27,10 +28,13 @@ export const InlineRemoveButton: React.FC<{}, []);return (- <InlineAction- renderAction={renderAction}- onClick={onClick}- variant={null}- />+ <ActionTooltip label="Remove" shortcut={null} delay={800} dismissOnClick>+ <InlineAction+ renderAction={renderAction}+ onClick={onClick}+ variant={null}+ aria-label="Remove"+ />+ </ActionTooltip>);};diff --git a/packages/studio/src/components/RenderModal/SchemaEditor/SchemaResetButton.tsx b/packages/studio/src/components/RenderModal/SchemaEditor/SchemaResetButton.tsxindex 794fb3ddeb..f097323f1a 100644--- a/packages/studio/src/components/RenderModal/SchemaEditor/SchemaResetButton.tsx+++ b/packages/studio/src/components/RenderModal/SchemaEditor/SchemaResetButton.tsx@@ -1,5 +1,6 @@import React, {useCallback} from 'react';import {CURRENT_COLOR} from '../../../helpers/colors';+import {ActionTooltip} from '../../ActionTooltip';import type {RenderInlineAction} from '../../InlineAction';import {InlineAction} from '../../InlineAction';@@ -23,10 +24,13 @@ export const SchemaResetButton: React.FC<{}, []);return (- <InlineAction- renderAction={renderAction}- onClick={onClick}- variant={null}- />+ <ActionTooltip label="Reset" shortcut={null} delay={800} dismissOnClick>+ <InlineAction+ renderAction={renderAction}+ onClick={onClick}+ variant={null}+ aria-label="Reset"+ />+ </ActionTooltip>);};diff --git a/packages/studio/src/components/SidebarRenderButton.tsx b/packages/studio/src/components/SidebarRenderButton.tsxindex 103717ddce..a71997205c 100644--- a/packages/studio/src/components/SidebarRenderButton.tsx+++ b/packages/studio/src/components/SidebarRenderButton.tsx@@ -18,6 +18,7 @@ import {} from '../helpers/hoverable';import {ThinRenderIcon} from '../icons/render';import {SetSelectedModalContext} from '../state/modals';+import {ActionTooltip} from './ActionTooltip';import type {RenderInlineAction} from './InlineAction';import {InlineAction} from './InlineAction';@@ -131,13 +132,16 @@ export const SidebarRenderButton: React.FC<{return (<div className={HOVER_GROUP_REVEAL_CLASS_NAME} style={revealStyle}>- <InlineAction- renderAction={renderAction}- onClick={onClick}- variant={null}- style={NO_HOVER_BACKGROUND_STYLE}- className={FOCUS_VISIBLE_ONLY_CLASS_NAME}- />+ <ActionTooltip label="Render" shortcut={null} delay={800} dismissOnClick>+ <InlineAction+ renderAction={renderAction}+ onClick={onClick}+ variant={null}+ style={NO_HOVER_BACKGROUND_STYLE}+ className={FOCUS_VISIBLE_ONLY_CLASS_NAME}+ aria-label="Render"+ />+ </ActionTooltip></div>);};diff --git a/packages/studio/src/components/Timeline/TimelineKeyframeControls.tsx b/packages/studio/src/components/Timeline/TimelineKeyframeControls.tsxindex 990970a9d0..52026b72c1 100644--- a/packages/studio/src/components/Timeline/TimelineKeyframeControls.tsx+++ b/packages/studio/src/components/Timeline/TimelineKeyframeControls.tsx@@ -23,6 +23,7 @@ import {type TimelineTreeNode,} from '../../helpers/timeline-layout';import {timelineNodePathInfoToKey} from '../../helpers/timeline-node-path-key';+import {ActionTooltip} from '../ActionTooltip';import {ExpandedTracksSetterContext} from '../ExpandedTracksProvider';import {callAddKeyframes,@@ -887,6 +888,9 @@ export const TimelineKeyframeControls: React.FC<{);const diamondColor = hasKeyframeAtCurrentFrame ? BLUE : LIGHT_TEXT;+ const toggleKeyframeLabel = hasKeyframeAtCurrentFrame+ ? 'Remove keyframe'+ : 'Add keyframe';return (<div@@ -896,41 +900,66 @@ export const TimelineKeyframeControls: React.FC<{: controlsContainerStyle}>- <button- type="button"- style={previousStyle}- disabled={previousDisabled}- onPointerDown={previousDisabled ? undefined : onPrevious}- aria-label="Go to previous keyframe"+ <ActionTooltip+ label="Go to previous keyframe"+ shortcut={null}+ delay={800}+ dismissOnClick+ triggerStyle={{+ visibility: showNavigationButtons ? 'visible' : 'hidden',+ }}>- <svg width="14" height="14" viewBox="0 0 10 10" style={svgStyle}>- <path d="M7 1.5L3 5L7 8.5Z" fill={LIGHT_GRAY} />- </svg>- </button>- <button- type="button"- style={diamondStyle}- disabled={!canToggleKeyframe || !clientId}- onPointerDown={- canToggleKeyframe && clientId ? onToggleKeyframe : undefined- }- aria-label={- hasKeyframeAtCurrentFrame ? 'Remove keyframe' : 'Add keyframe'- }+ <button+ type="button"+ style={previousStyle}+ disabled={previousDisabled}+ onPointerDown={previousDisabled ? undefined : onPrevious}+ aria-label="Go to previous keyframe"+ >+ <svg width="14" height="14" viewBox="0 0 10 10" style={svgStyle}>+ <path d="M7 1.5L3 5L7 8.5Z" fill={LIGHT_GRAY} />+ </svg>+ </button>+ </ActionTooltip>+ <ActionTooltip+ label={toggleKeyframeLabel}+ shortcut={null}+ delay={800}+ dismissOnClick>- <TimelineKeyframeDiamondIcon color={diamondColor} size={12} />- </button>- <button- type="button"- style={nextStyle}- disabled={nextDisabled}- onPointerDown={nextDisabled ? undefined : onNext}- aria-label="Go to next keyframe"+ <button+ type="button"+ style={diamondStyle}+ disabled={!canToggleKeyframe || !clientId}+ onPointerDown={+ canToggleKeyframe && clientId ? onToggleKeyframe : undefined+ }+ aria-label={toggleKeyframeLabel}+ >+ <TimelineKeyframeDiamondIcon color={diamondColor} size={12} />+ </button>+ </ActionTooltip>+ <ActionTooltip+ label="Go to next keyframe"+ shortcut={null}+ delay={800}+ dismissOnClick+ triggerStyle={{+ visibility: showNavigationButtons ? 'visible' : 'hidden',+ }}>- <svg width="14" height="14" viewBox="0 0 10 10" style={svgStyle}>- <path d="M3 1.5L7 5L3 8.5Z" fill={LIGHT_GRAY} />- </svg>- </button>+ <button+ type="button"+ style={nextStyle}+ disabled={nextDisabled}+ onPointerDown={nextDisabled ? undefined : onNext}+ aria-label="Go to next keyframe"+ >+ <svg width="14" height="14" viewBox="0 0 10 10" style={svgStyle}>+ <path d="M3 1.5L7 5L3 8.5Z" fill={LIGHT_GRAY} />+ </svg>+ </button>+ </ActionTooltip></div>);};diff --git a/packages/studio/src/components/Timeline/TimelineScaleField.tsx b/packages/studio/src/components/Timeline/TimelineScaleField.tsxindex 6c66a1d348..a0bfa6d05c 100644--- a/packages/studio/src/components/Timeline/TimelineScaleField.tsx+++ b/packages/studio/src/components/Timeline/TimelineScaleField.tsx@@ -11,6 +11,7 @@ import type {TimelineFieldOnSave,} from '../../helpers/timeline-layout';import {ScaleLockContext} from '../../state/scale-lock';+import {ActionTooltip} from '../ActionTooltip';import {InputDragger} from '../NewComposition/InputDragger';import {formatTimelineFieldValueForDisplay} from './timeline-field-display-utils';import {normalizeTimelineNumber} from './timeline-field-utils';@@ -110,6 +111,7 @@ const LinkToggle: React.FC<{readonly linked: boolean;readonly onToggle: () => void;}> = ({linked, onToggle}) => {+ const label = linked ? 'Unlink scale axes' : 'Link scale axes';const onPointerDown = useCallback((e: React.PointerEvent<HTMLButtonElement>) => {if (e.button !== 0) {@@ -123,25 +125,27 @@ const LinkToggle: React.FC<{);return (- <button- type="button"- style={toggleStyle}- onPointerDown={onPointerDown}- aria-label={linked ? 'Unlink scale axes' : 'Link scale axes'}- >- {linked ? (- <svg- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 640 640"- style={linkIconStyle}- >- <path- fill={CURRENT_COLOR_LOWERCASE}- d="M32 320C32 214 118 128 224 128L288 128L288 192L224 192C153.3 192 96 249.3 96 320C96 390.7 153.3 448 224 448L288 448L288 512L224 512C118 512 32 426 32 320zM608 320C608 426 522 512 416 512L352 512L352 448L416 448C486.7 448 544 390.7 544 320C544 249.3 486.7 192 416 192L352 192L352 128L416 128C522 128 608 214 608 320zM224 288L448 288L448 352L192 352L192 288L224 288z"- />- </svg>- ) : null}- </button>+ <ActionTooltip label={label} shortcut={null} delay={800} dismissOnClick>+ <button+ type="button"+ style={toggleStyle}+ onPointerDown={onPointerDown}+ aria-label={label}+ >+ {linked ? (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 640 640"+ style={linkIconStyle}+ >+ <path+ fill={CURRENT_COLOR_LOWERCASE}+ d="M32 320C32 214 118 128 224 128L288 128L288 192L224 192C153.3 192 96 249.3 96 320C96 390.7 153.3 448 224 448L288 448L288 512L224 512C118 512 32 426 32 320zM608 320C608 426 522 512 416 512L352 512L352 448L416 448C486.7 448 544 390.7 544 320C544 249.3 486.7 192 416 192L352 192L352 128L416 128C522 128 608 214 608 320zM224 288L448 288L448 352L192 352L192 288L224 288z"+ />+ </svg>+ ) : null}+ </button>+ </ActionTooltip>);};