@remotion/studio 4.0.518 → 4.0.519
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppLaunchButton.d.ts +16 -0
- package/dist/components/AppLaunchButton.js +90 -0
- package/dist/components/AssetSelector.js +7 -6
- package/dist/components/AssetSelectorItem.d.ts +12 -0
- package/dist/components/AssetSelectorItem.js +180 -62
- package/dist/components/Button.js +20 -7
- package/dist/components/Canvas.js +109 -78
- package/dist/components/CanvasOrLoading.js +7 -7
- package/dist/components/CodingAgentButton.d.ts +7 -0
- package/dist/components/CodingAgentButton.js +59 -0
- package/dist/components/CompositionContextButton.d.ts +1 -0
- package/dist/components/CompositionContextButton.js +6 -3
- package/dist/components/CompositionSelector.js +15 -10
- package/dist/components/CompositionSelectorItem.js +16 -23
- package/dist/components/ConfigureLicenseModal.js +4 -48
- package/dist/components/CurrentAsset.js +1 -1
- package/dist/components/ElementInstallConfirmation.d.ts +20 -7
- package/dist/components/ElementInstallConfirmation.js +325 -32
- package/dist/components/FixComputedValueModal.js +5 -131
- package/dist/components/InitialCompositionLoader.js +3 -2
- package/dist/components/InspectorOpenInEditor.js +48 -33
- package/dist/components/InspectorPanel/CompositionInspector.js +35 -3
- package/dist/components/InspectorPanel/CompositionInspectorHeader.js +22 -14
- package/dist/components/InspectorPanel/ConnectedCompositionsSection.js +3 -1
- package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +1 -1
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +10 -5
- package/dist/components/InspectorPanel/SequenceSelectionInspector.js +1 -1
- package/dist/components/InspectorPanel/common.js +1 -0
- package/dist/components/InspectorPanel/styles.js +1 -0
- package/dist/components/InspectorSequenceSection.js +8 -3
- package/dist/components/InspectorSourceLocation.js +5 -1
- package/dist/components/KnownBugs.d.ts +1 -1
- package/dist/components/KnownBugs.js +1 -1
- package/dist/components/LicenseExplanation.d.ts +2 -0
- package/dist/components/LicenseExplanation.js +63 -0
- package/dist/components/MenuToolbar.js +7 -1
- package/dist/components/Modals.js +1 -2
- package/dist/components/NewComposition/InputDragger.js +29 -2
- package/dist/components/NewComposition/NewCompDuration.js +1 -1
- package/dist/components/NewComposition/NewComposition.d.ts +23 -0
- package/dist/components/NewComposition/NewComposition.js +217 -80
- package/dist/components/{UpdateModal/OpenIssueButton.js → OpenIssueButton.js} +1 -1
- package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +2 -1
- package/dist/components/QuickSwitcher/QuickSwitcherContent.js +21 -13
- package/dist/components/RenderQueue/actions.d.ts +1 -0
- package/dist/components/RenderQueue/actions.js +5 -1
- package/dist/components/SelectedOutlineCanvasRotation.js +27 -1
- package/dist/components/SelectedOutlineElement.js +2 -1
- package/dist/components/SelectedOutlineKeyboardControls.d.ts +2 -2
- package/dist/components/SelectedOutlineOverlay.d.ts +3 -1
- package/dist/components/SelectedOutlineOverlay.js +21 -26
- package/dist/components/SelectedOutlinePolygon.d.ts +1 -0
- package/dist/components/SelectedOutlinePolygon.js +12 -4
- package/dist/components/SelectedOutlineRenderer.js +88 -21
- package/dist/components/SettingsContext.js +2 -1
- package/dist/components/SettingsModal.d.ts +1 -1
- package/dist/components/SettingsModal.js +19 -3
- package/dist/components/SidebarRenderButton.d.ts +1 -0
- package/dist/components/SidebarRenderButton.js +14 -5
- package/dist/components/Timeline/SequencePropsObserver.js +29 -14
- package/dist/components/Timeline/TimelineKeyframeControls.js +3 -1
- package/dist/components/Timeline/TimelineRowChrome.js +4 -2
- package/dist/components/Timeline/TimelineSequence.js +40 -8
- package/dist/components/Timeline/TimelineSequenceItem.js +34 -1
- package/dist/components/Timeline/TimelineStack/get-stack.d.ts +1 -0
- package/dist/components/Timeline/TimelineStack/get-stack.js +35 -3
- package/dist/components/Timeline/duplicate-selected-timeline-item.js +23 -25
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +6 -0
- package/dist/components/Timeline/get-sequence-context-menu-items.js +34 -1
- package/dist/components/Timeline/sequence-props-subscription-store.d.ts +2 -0
- package/dist/components/Timeline/sequence-props-subscription-store.js +22 -1
- package/dist/components/Timeline/use-sequence-props-subscription.js +7 -0
- package/dist/components/TimelineCombobox.js +1 -0
- package/dist/components/UpdateCheck.d.ts +0 -8
- package/dist/components/UpdateCheck.js +7 -54
- package/dist/components/UpdateStatusContext.d.ts +18 -0
- package/dist/components/UpdateStatusContext.js +74 -0
- package/dist/components/UpdatesSettings.d.ts +2 -0
- package/dist/components/UpdatesSettings.js +251 -0
- package/dist/components/WebMcp.js +3 -3
- package/dist/components/get-open-in-menu-items.d.ts +4 -0
- package/dist/components/get-open-in-menu-items.js +28 -24
- package/dist/components/root-composition-menu-items.d.ts +4 -1
- package/dist/components/root-composition-menu-items.js +38 -1
- package/dist/components/selected-outline-geometry.d.ts +21 -2
- package/dist/components/selected-outline-geometry.js +16 -5
- package/dist/components/selected-outline-measurement.d.ts +40 -1
- package/dist/components/selected-outline-measurement.js +239 -1
- package/dist/components/selected-outline-order.d.ts +12 -0
- package/dist/components/selected-outline-order.js +251 -0
- package/dist/components/selected-outline-types.d.ts +15 -2
- package/dist/components/selected-outline-uv.js +106 -3
- package/dist/components/use-configure-default-apps.d.ts +1 -0
- package/dist/components/use-configure-default-apps.js +24 -0
- package/dist/error-overlay/remotion-overlay/CodeFrame.js +5 -6
- package/dist/error-overlay/remotion-overlay/CopyStackTrace.js +1 -1
- package/dist/error-overlay/remotion-overlay/ErrorDisplay.js +47 -18
- package/dist/error-overlay/remotion-overlay/ErrorLoader.js +1 -1
- package/dist/error-overlay/remotion-overlay/ErrorTitle.js +5 -4
- package/dist/error-overlay/remotion-overlay/OpenInEditor.js +48 -76
- package/dist/error-overlay/remotion-overlay/SearchGitHubIssues.js +1 -1
- package/dist/error-overlay/remotion-overlay/ShortcutHint.js +2 -2
- package/dist/error-overlay/remotion-overlay/StackFrame.js +13 -8
- package/dist/error-overlay/remotion-overlay/Symbolicating.js +1 -1
- package/dist/esm/{chunk-7prjt5n5.js → chunk-1fkq5bfq.js} +15439 -11610
- package/dist/esm/chunk-6jf1natv.js +25 -0
- package/dist/esm/{chunk-4bxz1d3g.js → chunk-je0h1bgt.js} +1 -28
- package/dist/esm/chunk-m0jqdbkr.js +14571 -0
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/internals.mjs +32140 -13755
- package/dist/esm/previewEntry.mjs +35408 -17021
- package/dist/esm/renderEntry.mjs +6 -3
- package/dist/helpers/can-show-updates.d.ts +5 -0
- package/dist/helpers/can-show-updates.js +7 -0
- package/dist/helpers/colors.d.ts +0 -3
- package/dist/helpers/colors.js +2 -5
- package/dist/helpers/create-folder-tree.d.ts +5 -0
- package/dist/helpers/create-folder-tree.js +24 -1
- package/dist/helpers/get-asset-metadata.js +1 -1
- package/dist/helpers/get-box-quads-polyfill-internals.d.ts +82 -0
- package/dist/helpers/get-box-quads-polyfill-internals.js +2403 -0
- package/dist/helpers/get-box-quads-ponyfill.d.ts +10 -0
- package/dist/helpers/get-box-quads-ponyfill.js +23 -0
- package/dist/helpers/get-git-menu-item.d.ts +5 -0
- package/dist/helpers/get-git-menu-item.js +15 -1
- package/dist/helpers/hoverable.js +10 -5
- package/dist/helpers/open-in-editor.js +51 -1
- package/dist/helpers/preview-server-events.js +3 -0
- package/dist/helpers/timeline-layout.d.ts +0 -1
- package/dist/helpers/timeline-layout.js +1 -5
- package/dist/helpers/url-state.d.ts +1 -0
- package/dist/helpers/url-state.js +12 -5
- package/dist/renderEntry.js +2 -0
- package/dist/state/folders.d.ts +3 -0
- package/dist/state/folders.js +40 -1
- package/dist/state/modals.d.ts +1 -6
- package/package.json +17 -14
- package/dist/components/UpdateModal/UpdateModal.d.ts +0 -6
- package/dist/components/UpdateModal/UpdateModal.js +0 -104
- /package/dist/components/{UpdateModal/OpenIssueButton.d.ts → OpenIssueButton.d.ts} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ComboboxValue } from './NewComposition/ComboBox';
|
|
3
|
+
export declare const AppLaunchButton: React.FC<{
|
|
4
|
+
readonly actionButtonId: string | null;
|
|
5
|
+
readonly ariaLabel: string;
|
|
6
|
+
readonly children: React.ReactNode;
|
|
7
|
+
readonly disabled: boolean;
|
|
8
|
+
readonly menuAriaLabel: string;
|
|
9
|
+
readonly menuButtonId: string | null;
|
|
10
|
+
readonly menuItems: ComboboxValue[];
|
|
11
|
+
readonly onConfigureApps: (() => void) | null;
|
|
12
|
+
readonly onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
13
|
+
readonly size: 'compact' | 'default';
|
|
14
|
+
readonly style: React.CSSProperties | null;
|
|
15
|
+
readonly title: string;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppLaunchButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const colors_1 = require("../helpers/colors");
|
|
7
|
+
const caret_1 = require("../icons/caret");
|
|
8
|
+
const get_open_in_menu_items_1 = require("./get-open-in-menu-items");
|
|
9
|
+
const SegmentedButton_1 = require("./SegmentedButton");
|
|
10
|
+
const compactMainSegmentStyle = {
|
|
11
|
+
fontFamily: 'inherit',
|
|
12
|
+
gap: 6,
|
|
13
|
+
padding: '0 9px',
|
|
14
|
+
};
|
|
15
|
+
const defaultMainSegmentStyle = {
|
|
16
|
+
...compactMainSegmentStyle,
|
|
17
|
+
fontSize: 14,
|
|
18
|
+
lineHeight: '21px',
|
|
19
|
+
};
|
|
20
|
+
const dropdownSegmentStyle = {
|
|
21
|
+
fontFamily: 'inherit',
|
|
22
|
+
padding: 0,
|
|
23
|
+
width: 20,
|
|
24
|
+
};
|
|
25
|
+
const dropdownIconStyle = {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
transform: 'translateY(-1px)',
|
|
28
|
+
};
|
|
29
|
+
const AppLaunchButton = ({ actionButtonId, ariaLabel, children, disabled, menuAriaLabel, menuButtonId, menuItems, onConfigureApps, onClick, size, style, title, }) => {
|
|
30
|
+
const items = (0, react_1.useMemo)(() => {
|
|
31
|
+
return [
|
|
32
|
+
...menuItems,
|
|
33
|
+
...(0, get_open_in_menu_items_1.getConfigureDefaultAppsMenuItems)({
|
|
34
|
+
hasPreviousItems: menuItems.length > 0,
|
|
35
|
+
onConfigureApps,
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
}, [menuItems, onConfigureApps]);
|
|
39
|
+
const segments = (0, react_1.useMemo)(() => {
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
ariaLabel,
|
|
43
|
+
buttonId: actionButtonId,
|
|
44
|
+
disabled,
|
|
45
|
+
idleColor: colors_1.LIGHT_TEXT,
|
|
46
|
+
onClick,
|
|
47
|
+
onPointerDown: null,
|
|
48
|
+
renderContent: () => children,
|
|
49
|
+
segmentId: 'preferred-app',
|
|
50
|
+
style: size === 'default'
|
|
51
|
+
? defaultMainSegmentStyle
|
|
52
|
+
: compactMainSegmentStyle,
|
|
53
|
+
title,
|
|
54
|
+
type: 'action',
|
|
55
|
+
},
|
|
56
|
+
...(items.length > 0
|
|
57
|
+
? [
|
|
58
|
+
{
|
|
59
|
+
ariaLabel: menuAriaLabel,
|
|
60
|
+
buttonId: menuButtonId,
|
|
61
|
+
disabled: false,
|
|
62
|
+
idleColor: colors_1.LIGHT_TEXT,
|
|
63
|
+
leaveLeftSpace: true,
|
|
64
|
+
onOpenChange: null,
|
|
65
|
+
renderContent: (color) => (jsx_runtime_1.jsx("span", { style: dropdownIconStyle, children: jsx_runtime_1.jsx(caret_1.CaretDown, { color: color }) })),
|
|
66
|
+
segmentId: 'another-app',
|
|
67
|
+
selectedId: null,
|
|
68
|
+
style: dropdownSegmentStyle,
|
|
69
|
+
title: menuAriaLabel,
|
|
70
|
+
type: 'menu',
|
|
71
|
+
values: items,
|
|
72
|
+
},
|
|
73
|
+
]
|
|
74
|
+
: []),
|
|
75
|
+
];
|
|
76
|
+
}, [
|
|
77
|
+
actionButtonId,
|
|
78
|
+
ariaLabel,
|
|
79
|
+
children,
|
|
80
|
+
disabled,
|
|
81
|
+
items,
|
|
82
|
+
menuAriaLabel,
|
|
83
|
+
menuButtonId,
|
|
84
|
+
onClick,
|
|
85
|
+
size,
|
|
86
|
+
title,
|
|
87
|
+
]);
|
|
88
|
+
return (jsx_runtime_1.jsx(SegmentedButton_1.SegmentedButton, { segments: segments, style: { ...(size === 'default' ? { height: 41 } : null), ...style }, title: null }));
|
|
89
|
+
};
|
|
90
|
+
exports.AppLaunchButton = AppLaunchButton;
|
|
@@ -177,7 +177,7 @@ const AssetSelector = ({ readOnlyStudio }) => {
|
|
|
177
177
|
setDropLocation(null);
|
|
178
178
|
}
|
|
179
179
|
}, [dropLocation, writeFilesToPublicFolder]);
|
|
180
|
-
const uploadAssets = (0, react_1.useCallback)(async () => {
|
|
180
|
+
const uploadAssets = (0, react_1.useCallback)(async (assetPath) => {
|
|
181
181
|
try {
|
|
182
182
|
const files = await (0, import_assets_1.pickFilesToImport)();
|
|
183
183
|
if (files.length === 0) {
|
|
@@ -185,12 +185,13 @@ const AssetSelector = ({ readOnlyStudio }) => {
|
|
|
185
185
|
}
|
|
186
186
|
const wereWritten = await writeFilesToPublicFolder({
|
|
187
187
|
files,
|
|
188
|
-
assetPath
|
|
188
|
+
assetPath,
|
|
189
189
|
});
|
|
190
190
|
if (wereWritten) {
|
|
191
|
+
const destination = assetPath ? `'${assetPath}'` : 'public folder';
|
|
191
192
|
(0, NotificationCenter_1.showNotification)(files.length === 1
|
|
192
|
-
? `Uploaded ${files[0].name} to
|
|
193
|
-
: `Uploaded ${files.length} assets to
|
|
193
|
+
? `Uploaded ${files[0].name} to ${destination}`
|
|
194
|
+
: `Uploaded ${files.length} assets to ${destination}`, 3000);
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
catch (error) {
|
|
@@ -204,7 +205,7 @@ const AssetSelector = ({ readOnlyStudio }) => {
|
|
|
204
205
|
keyHint: null,
|
|
205
206
|
label: 'Upload...',
|
|
206
207
|
leftItem: null,
|
|
207
|
-
onClick: uploadAssets,
|
|
208
|
+
onClick: () => uploadAssets(null),
|
|
208
209
|
quickSwitcherLabel: 'Upload assets...',
|
|
209
210
|
subMenu: null,
|
|
210
211
|
type: 'item',
|
|
@@ -219,6 +220,6 @@ const AssetSelector = ({ readOnlyStudio }) => {
|
|
|
219
220
|
" in the root of your project and place a file in it."] }) }))) : (jsx_runtime_1.jsx("div", { className: "__remotion-vertical-scrollbar", style: {
|
|
220
221
|
...list,
|
|
221
222
|
backgroundColor: isDropDiv ? colors_1.WHITE_ALPHA_06 : colors_1.BACKGROUND,
|
|
222
|
-
}, onDragEnter: onDragEnter, onDragLeave: onDragLeave, children: jsx_runtime_1.jsx(AssetSelectorItem_1.AssetFolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }) }))] }));
|
|
223
|
+
}, onDragEnter: onDragEnter, onDragLeave: onDragLeave, children: jsx_runtime_1.jsx(AssetSelectorItem_1.AssetFolderTree, { item: assetTree, level: 0, parentFolder: null, name: null, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio, uploadAssets: uploadAssets }) }))] }));
|
|
223
224
|
};
|
|
224
225
|
exports.AssetSelector = AssetSelector;
|
|
@@ -28,6 +28,17 @@ export declare const getAssetContextMenuItems: ({ relativePath, fileManagerName,
|
|
|
28
28
|
fileExplorerDisabled: boolean;
|
|
29
29
|
mutationsDisabled: boolean;
|
|
30
30
|
}) => ComboboxValue[];
|
|
31
|
+
export declare const getAssetFolderContextMenuItems: ({ folderPath, fileManagerName, copyFolderPath, copyAbsolutePath, openFolderInExplorer, uploadAssets, fileExplorerAvailable, fileExplorerDisabled, mutationsDisabled, }: {
|
|
32
|
+
folderPath: string;
|
|
33
|
+
fileManagerName: string;
|
|
34
|
+
copyFolderPath: () => void;
|
|
35
|
+
copyAbsolutePath: (() => void) | null;
|
|
36
|
+
openFolderInExplorer: () => void;
|
|
37
|
+
uploadAssets: () => void;
|
|
38
|
+
fileExplorerAvailable: boolean;
|
|
39
|
+
fileExplorerDisabled: boolean;
|
|
40
|
+
mutationsDisabled: boolean;
|
|
41
|
+
}) => ComboboxValue[];
|
|
31
42
|
export declare const AssetFolderTree: React.FC<{
|
|
32
43
|
readonly item: AssetStructure;
|
|
33
44
|
readonly name: string | null;
|
|
@@ -38,4 +49,5 @@ export declare const AssetFolderTree: React.FC<{
|
|
|
38
49
|
readonly dropLocation: string | null;
|
|
39
50
|
readonly setDropLocation: React.Dispatch<React.SetStateAction<string | null>>;
|
|
40
51
|
readonly readOnlyStudio: boolean;
|
|
52
|
+
readonly uploadAssets: (assetPath: string | null) => void;
|
|
41
53
|
}>;
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.AssetFolderTree = exports.getAssetContextMenuItems = exports.getCanDragAsset = exports.getAssetActionAvailability = void 0;
|
|
36
|
+
exports.AssetFolderTree = exports.getAssetFolderContextMenuItems = exports.getAssetContextMenuItems = exports.getCanDragAsset = exports.getAssetActionAvailability = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
39
39
|
const react_1 = require("react");
|
|
@@ -71,7 +71,6 @@ const iconStyle = {
|
|
|
71
71
|
flexShrink: 0,
|
|
72
72
|
};
|
|
73
73
|
const itemStyle = {
|
|
74
|
-
paddingRight: 10,
|
|
75
74
|
paddingTop: 5,
|
|
76
75
|
paddingBottom: 5,
|
|
77
76
|
fontSize: 13,
|
|
@@ -86,7 +85,6 @@ const itemStyle = {
|
|
|
86
85
|
borderRadius: 4,
|
|
87
86
|
width: 'calc(100% - 4px)',
|
|
88
87
|
textAlign: 'left',
|
|
89
|
-
backgroundColor: colors_1.BACKGROUND,
|
|
90
88
|
height: layout_1.COMPACT_CONTROL_ROW_HEIGHT,
|
|
91
89
|
userSelect: 'none',
|
|
92
90
|
WebkitUserSelect: 'none',
|
|
@@ -109,11 +107,19 @@ const ellipsisIconStyle = {
|
|
|
109
107
|
height: 12,
|
|
110
108
|
},
|
|
111
109
|
};
|
|
110
|
+
const inlineActionsStyle = {
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
display: 'flex',
|
|
113
|
+
};
|
|
114
|
+
const renderContextMenuAction = (color) => {
|
|
115
|
+
return jsx_runtime_1.jsx(ellipsis_1.EllipsisIcon, { svgProps: ellipsisIconStyle, fill: color });
|
|
116
|
+
};
|
|
112
117
|
const getAssetActionAvailability = ({ browserStudioCanMutateAssets, readOnlyStudio, connectionStatus, publicFolderExists, }) => {
|
|
113
118
|
return {
|
|
114
119
|
mutationsDisabled: browserStudioCanMutateAssets !== true &&
|
|
115
120
|
(readOnlyStudio || connectionStatus !== 'connected'),
|
|
116
|
-
fileExplorerDisabled:
|
|
121
|
+
fileExplorerDisabled: browserStudioCanMutateAssets !== null ||
|
|
122
|
+
publicFolderExists === null ||
|
|
117
123
|
readOnlyStudio ||
|
|
118
124
|
connectionStatus !== 'connected',
|
|
119
125
|
};
|
|
@@ -226,67 +232,191 @@ const getAssetContextMenuItems = ({ relativePath, fileManagerName, copyFileName,
|
|
|
226
232
|
return items.filter(no_react_1.NoReactInternals.truthy);
|
|
227
233
|
};
|
|
228
234
|
exports.getAssetContextMenuItems = getAssetContextMenuItems;
|
|
229
|
-
const
|
|
230
|
-
const
|
|
235
|
+
const getAssetFolderContextMenuItems = ({ folderPath, fileManagerName, copyFolderPath, copyAbsolutePath, openFolderInExplorer, uploadAssets, fileExplorerAvailable, fileExplorerDisabled, mutationsDisabled, }) => {
|
|
236
|
+
const items = [
|
|
237
|
+
fileExplorerAvailable
|
|
238
|
+
? {
|
|
239
|
+
id: 'open-asset-folder-in-explorer',
|
|
240
|
+
keyHint: null,
|
|
241
|
+
label: `Show in ${fileManagerName}`,
|
|
242
|
+
leftItem: null,
|
|
243
|
+
onClick: openFolderInExplorer,
|
|
244
|
+
quickSwitcherLabel: `Show asset folder in ${fileManagerName}`,
|
|
245
|
+
subMenu: null,
|
|
246
|
+
type: 'item',
|
|
247
|
+
value: 'open-asset-folder-in-explorer',
|
|
248
|
+
disabled: fileExplorerDisabled,
|
|
249
|
+
}
|
|
250
|
+
: null,
|
|
251
|
+
{
|
|
252
|
+
id: 'copy-asset-folder-path',
|
|
253
|
+
keyHint: null,
|
|
254
|
+
label: 'Copy folder path',
|
|
255
|
+
leftItem: null,
|
|
256
|
+
onClick: copyFolderPath,
|
|
257
|
+
quickSwitcherLabel: 'Copy asset folder path',
|
|
258
|
+
subMenu: null,
|
|
259
|
+
type: 'item',
|
|
260
|
+
value: 'copy-asset-folder-path',
|
|
261
|
+
},
|
|
262
|
+
copyAbsolutePath
|
|
263
|
+
? {
|
|
264
|
+
id: 'copy-asset-folder-absolute-path',
|
|
265
|
+
keyHint: null,
|
|
266
|
+
label: 'Copy absolute path',
|
|
267
|
+
leftItem: null,
|
|
268
|
+
onClick: copyAbsolutePath,
|
|
269
|
+
quickSwitcherLabel: 'Copy asset folder absolute path',
|
|
270
|
+
subMenu: null,
|
|
271
|
+
type: 'item',
|
|
272
|
+
value: 'copy-asset-folder-absolute-path',
|
|
273
|
+
}
|
|
274
|
+
: null,
|
|
275
|
+
{
|
|
276
|
+
type: 'divider',
|
|
277
|
+
id: 'asset-folder-upload-divider',
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
id: 'upload-assets-to-folder',
|
|
281
|
+
keyHint: null,
|
|
282
|
+
label: 'Upload...',
|
|
283
|
+
leftItem: null,
|
|
284
|
+
onClick: uploadAssets,
|
|
285
|
+
quickSwitcherLabel: `Upload assets to ${folderPath}...`,
|
|
286
|
+
subMenu: null,
|
|
287
|
+
type: 'item',
|
|
288
|
+
value: 'upload-assets-to-folder',
|
|
289
|
+
disabled: mutationsDisabled,
|
|
290
|
+
},
|
|
291
|
+
];
|
|
292
|
+
return items.filter(no_react_1.NoReactInternals.truthy);
|
|
293
|
+
};
|
|
294
|
+
exports.getAssetFolderContextMenuItems = getAssetFolderContextMenuItems;
|
|
295
|
+
const AssetFolderItem = ({ tabIndex, item, level, parentFolder, toggleFolder, dropLocation, setDropLocation, readOnlyStudio, uploadAssets, }) => {
|
|
231
296
|
const openFolderTimerRef = (0, react_1.useRef)(null);
|
|
297
|
+
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
298
|
+
.previewServerState.type;
|
|
299
|
+
const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
|
|
300
|
+
const folderPath = (0, react_1.useMemo)(() => {
|
|
301
|
+
return parentFolder ? `${parentFolder}/${item.name}` : item.name;
|
|
302
|
+
}, [item.name, parentFolder]);
|
|
232
303
|
const { isDropDiv, onDragEnter, onDragLeave } = (0, use_asset_drag_events_1.default)({
|
|
233
304
|
name: item.name,
|
|
234
305
|
parentFolder,
|
|
235
306
|
dropLocation,
|
|
236
307
|
setDropLocation,
|
|
237
308
|
});
|
|
238
|
-
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
239
|
-
setHovered(true);
|
|
240
|
-
}, []);
|
|
241
|
-
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
242
|
-
setHovered(false);
|
|
243
|
-
}, []);
|
|
244
309
|
const folderStyle = (0, react_1.useMemo)(() => {
|
|
245
310
|
return {
|
|
246
311
|
...itemStyle,
|
|
247
312
|
paddingLeft: 4 + level * 8,
|
|
248
|
-
|
|
313
|
+
...(0, hoverable_1.hoverableStyle)({
|
|
314
|
+
idleBackground: colors_1.TRANSPARENT,
|
|
315
|
+
hoverBackground: colors_1.WHITE_ALPHA_06,
|
|
316
|
+
idleColor: colors_1.LIGHT_TEXT,
|
|
317
|
+
hoverColor: colors_1.WHITE,
|
|
318
|
+
}),
|
|
249
319
|
};
|
|
250
|
-
}, [
|
|
251
|
-
const label = (0, react_1.useMemo)(() => {
|
|
252
|
-
return {
|
|
253
|
-
...labelStyle,
|
|
254
|
-
color: hovered ? colors_1.WHITE : colors_1.LIGHT_TEXT,
|
|
255
|
-
};
|
|
256
|
-
}, [hovered]);
|
|
320
|
+
}, [level]);
|
|
257
321
|
const onClick = (0, react_1.useCallback)(() => {
|
|
258
322
|
toggleFolder(item.name, parentFolder);
|
|
259
323
|
}, [item.name, parentFolder, toggleFolder]);
|
|
324
|
+
const copyFolderPath = (0, react_1.useCallback)(() => {
|
|
325
|
+
(0, copy_text_1.copyText)(folderPath)
|
|
326
|
+
.then(() => {
|
|
327
|
+
(0, NotificationCenter_1.showNotification)(`Copied '${folderPath}' to clipboard`, 1000);
|
|
328
|
+
})
|
|
329
|
+
.catch((err) => {
|
|
330
|
+
(0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
|
|
331
|
+
});
|
|
332
|
+
}, [folderPath]);
|
|
333
|
+
const copyAbsolutePath = (0, react_1.useCallback)(() => {
|
|
334
|
+
if (window.remotion_publicFolderExists === null) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const content = `${window.remotion_publicFolderExists}/${folderPath}`;
|
|
338
|
+
(0, copy_text_1.copyText)(content)
|
|
339
|
+
.then(() => {
|
|
340
|
+
(0, NotificationCenter_1.showNotification)(`Copied '${content}' to clipboard`, 1000);
|
|
341
|
+
})
|
|
342
|
+
.catch((err) => {
|
|
343
|
+
(0, NotificationCenter_1.showNotification)(`Could not copy: ${err.message}`, 2000);
|
|
344
|
+
});
|
|
345
|
+
}, [folderPath]);
|
|
346
|
+
const openFolderInExplorer = (0, react_1.useCallback)(() => {
|
|
347
|
+
if (!window.remotion_publicFolderExists) {
|
|
348
|
+
(0, NotificationCenter_1.showNotification)('Could not find the public folder', 2000);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
(0, actions_1.openInFileExplorer)({
|
|
352
|
+
directory: `${window.remotion_publicFolderExists}/${folderPath}`,
|
|
353
|
+
}).catch((err) => {
|
|
354
|
+
(0, NotificationCenter_1.showNotification)(`Could not open folder: ${err.message}`, 2000);
|
|
355
|
+
});
|
|
356
|
+
}, [folderPath]);
|
|
357
|
+
const uploadAssetsToFolder = (0, react_1.useCallback)(() => {
|
|
358
|
+
uploadAssets(folderPath);
|
|
359
|
+
}, [folderPath, uploadAssets]);
|
|
360
|
+
const { mutationsDisabled, fileExplorerDisabled } = (0, exports.getAssetActionAvailability)({
|
|
361
|
+
browserStudioCanMutateAssets: (0, browser_studio_operations_1.getBrowserStudioOperations)() === null ? null : true,
|
|
362
|
+
readOnlyStudio,
|
|
363
|
+
connectionStatus,
|
|
364
|
+
publicFolderExists: window.remotion_publicFolderExists,
|
|
365
|
+
});
|
|
366
|
+
const getContextMenuItems = (0, react_1.useCallback)(() => {
|
|
367
|
+
return (0, exports.getAssetFolderContextMenuItems)({
|
|
368
|
+
folderPath,
|
|
369
|
+
fileManagerName,
|
|
370
|
+
copyFolderPath,
|
|
371
|
+
copyAbsolutePath: window.remotion_publicFolderExists === null ? null : copyAbsolutePath,
|
|
372
|
+
openFolderInExplorer,
|
|
373
|
+
uploadAssets: uploadAssetsToFolder,
|
|
374
|
+
fileExplorerAvailable: (0, browser_studio_operations_1.getBrowserStudioOperations)() === null,
|
|
375
|
+
fileExplorerDisabled,
|
|
376
|
+
mutationsDisabled,
|
|
377
|
+
});
|
|
378
|
+
}, [
|
|
379
|
+
copyAbsolutePath,
|
|
380
|
+
copyFolderPath,
|
|
381
|
+
fileExplorerDisabled,
|
|
382
|
+
fileManagerName,
|
|
383
|
+
folderPath,
|
|
384
|
+
mutationsDisabled,
|
|
385
|
+
openFolderInExplorer,
|
|
386
|
+
uploadAssetsToFolder,
|
|
387
|
+
]);
|
|
260
388
|
const Icon = item.expanded ? folder_1.ExpandedFolderIcon : folder_1.CollapsedFolderIcon;
|
|
261
389
|
return (jsx_runtime_1.jsxs("div", { onDragEnter: onDragEnter, onDragLeave: onDragLeave, style: {
|
|
262
390
|
backgroundColor: isDropDiv ? colors_1.WHITE_ALPHA_06 : colors_1.BACKGROUND,
|
|
263
391
|
}, children: [
|
|
264
|
-
jsx_runtime_1.jsx("div", { style: folderStyle,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
392
|
+
jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { getItems: getContextMenuItems, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { style: folderStyle, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.HOVER_GROUP_CLASS_NAME}`, tabIndex: tabIndex, title: item.name, onClick: onClick, onDragEnter: (event) => {
|
|
393
|
+
if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (!item.expanded) {
|
|
397
|
+
openFolderTimerRef.current = window.setTimeout(() => {
|
|
398
|
+
toggleFolder(item.name, parentFolder);
|
|
399
|
+
}, 1000);
|
|
400
|
+
}
|
|
401
|
+
}, onDragLeave: (event) => {
|
|
402
|
+
if (!(0, use_asset_drag_events_1.isAssetUploadDragEvent)(event)) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (openFolderTimerRef.current) {
|
|
406
|
+
clearTimeout(openFolderTimerRef.current);
|
|
407
|
+
}
|
|
408
|
+
}, children: [
|
|
409
|
+
jsx_runtime_1.jsx(Icon, { style: iconStyle, color: colors_1.CURRENT_COLOR }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelStyle, children: item.name }), jsx_runtime_1.jsxs("div", { className: hoverable_1.HOVER_GROUP_REVEAL_CLASS_NAME, style: inlineActionsStyle, children: [
|
|
410
|
+
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { variant: null, title: "More actions", renderAction: renderContextMenuAction, getItems: getContextMenuItems, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME })
|
|
411
|
+
] })
|
|
412
|
+
] }) }) }), item.expanded ? (jsx_runtime_1.jsx(exports.AssetFolderTree, { item: item.items, name: item.name, level: level, parentFolder: parentFolder, tabIndex: tabIndex, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio, uploadAssets: uploadAssets }, item.name)) : null] }));
|
|
283
413
|
};
|
|
284
|
-
const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabIndex, dropLocation, setDropLocation, readOnlyStudio, }) => {
|
|
414
|
+
const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabIndex, dropLocation, setDropLocation, readOnlyStudio, uploadAssets, }) => {
|
|
285
415
|
const combinedParents = (0, react_1.useMemo)(() => {
|
|
286
416
|
return [parentFolder, name].filter(no_react_1.NoReactInternals.truthy).join('/');
|
|
287
417
|
}, [name, parentFolder]);
|
|
288
418
|
return (jsx_runtime_1.jsxs("div", { children: [item.folders.map((folder) => {
|
|
289
|
-
return (jsx_runtime_1.jsx(AssetFolderItem, { item: folder, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio }, folder.name));
|
|
419
|
+
return (jsx_runtime_1.jsx(AssetFolderItem, { item: folder, tabIndex: tabIndex, level: level + 1, parentFolder: combinedParents, toggleFolder: toggleFolder, dropLocation: dropLocation, setDropLocation: setDropLocation, readOnlyStudio: readOnlyStudio, uploadAssets: uploadAssets }, folder.name));
|
|
290
420
|
}), item.files.map((file) => {
|
|
291
421
|
return (jsx_runtime_1.jsx(AssetSelectorItem, { item: file, tabIndex: tabIndex, level: level, parentFolder: combinedParents, readOnlyStudio: readOnlyStudio }, file.src));
|
|
292
422
|
})] }));
|
|
@@ -294,14 +424,10 @@ const AssetFolderTree = ({ item, level, name, parentFolder, toggleFolder, tabInd
|
|
|
294
424
|
exports.AssetFolderTree = AssetFolderTree;
|
|
295
425
|
const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
|
|
296
426
|
const fileManagerName = (0, get_file_manager_name_1.getFileManagerName)(window.remotion_fileSystemPlatform);
|
|
297
|
-
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
298
427
|
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
299
428
|
const { setSelectedModal } = (0, react_1.useContext)(modals_1.SetSelectedModalContext);
|
|
300
429
|
const connectionStatus = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx)
|
|
301
430
|
.previewServerState.type;
|
|
302
|
-
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
303
|
-
setHovered(true);
|
|
304
|
-
}, []);
|
|
305
431
|
const { setCanvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionSetters);
|
|
306
432
|
const { canvasContent } = (0, react_1.useContext)(remotion_1.Internals.CompositionManager);
|
|
307
433
|
const relativePath = (0, react_1.useMemo)(() => {
|
|
@@ -319,9 +445,6 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
319
445
|
const canDragAsset = (0, react_1.useMemo)(() => {
|
|
320
446
|
return (0, exports.getCanDragAsset)({ readOnlyStudio, relativePath });
|
|
321
447
|
}, [readOnlyStudio, relativePath]);
|
|
322
|
-
const onPointerLeave = (0, react_1.useCallback)(() => {
|
|
323
|
-
setHovered(false);
|
|
324
|
-
}, []);
|
|
325
448
|
const rowRef = (0, react_1.useRef)(null);
|
|
326
449
|
(0, react_1.useLayoutEffect)(() => {
|
|
327
450
|
(0, sidebar_scroll_into_view_1.maybeScrollAssetSidebarRowIntoView)({
|
|
@@ -376,23 +499,18 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
376
499
|
const style = (0, react_1.useMemo)(() => {
|
|
377
500
|
return {
|
|
378
501
|
...itemStyle,
|
|
379
|
-
|
|
380
|
-
|
|
502
|
+
...(0, hoverable_1.hoverableStyle)({
|
|
503
|
+
idleBackground: selected ? colors_1.WHITE_ALPHA_06 : colors_1.TRANSPARENT,
|
|
504
|
+
hoverBackground: colors_1.WHITE_ALPHA_06,
|
|
505
|
+
idleColor: selected ? colors_1.WHITE : colors_1.LIGHT_TEXT,
|
|
506
|
+
hoverColor: colors_1.WHITE,
|
|
507
|
+
}),
|
|
381
508
|
paddingLeft: 12 + level * 8,
|
|
382
509
|
};
|
|
383
|
-
}, [
|
|
384
|
-
const label = (0, react_1.useMemo)(() => {
|
|
385
|
-
return {
|
|
386
|
-
...labelStyle,
|
|
387
|
-
color: hovered || selected ? colors_1.WHITE : colors_1.LIGHT_TEXT,
|
|
388
|
-
};
|
|
389
|
-
}, [hovered, selected]);
|
|
510
|
+
}, [level, selected]);
|
|
390
511
|
const renderFileExplorerAction = (0, react_1.useCallback)((color) => {
|
|
391
512
|
return jsx_runtime_1.jsx(folder_1.ExpandedFolderIcon, { style: revealIconStyle, color: color });
|
|
392
513
|
}, []);
|
|
393
|
-
const renderContextMenuAction = (0, react_1.useCallback)((color) => {
|
|
394
|
-
return jsx_runtime_1.jsx(ellipsis_1.EllipsisIcon, { svgProps: ellipsisIconStyle, fill: color });
|
|
395
|
-
}, []);
|
|
396
514
|
const copyFileName = (0, react_1.useCallback)(() => {
|
|
397
515
|
(0, copy_text_1.copyText)(item.name)
|
|
398
516
|
.then(() => {
|
|
@@ -484,8 +602,8 @@ const AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio
|
|
|
484
602
|
e.stopPropagation();
|
|
485
603
|
openAssetInExplorer();
|
|
486
604
|
}, [openAssetInExplorer]);
|
|
487
|
-
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { getItems: getContextMenuItems, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { ref: rowRef, style: style,
|
|
488
|
-
jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, style: iconStyle, color:
|
|
605
|
+
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { getItems: getContextMenuItems, children: jsx_runtime_1.jsx(layout_1.Row, { align: "center", children: jsx_runtime_1.jsxs("div", { ref: rowRef, style: style, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.HOVER_GROUP_CLASS_NAME}`, onClick: onClick, draggable: canDragAsset, onDragStart: onDragStart, onDragEnd: onDragEnd, tabIndex: tabIndex, title: item.name, children: [
|
|
606
|
+
jsx_runtime_1.jsx(AssetFileIcon_1.AssetFileIcon, { fileType: previewFileType, style: iconStyle, color: colors_1.CURRENT_COLOR }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsx("div", { style: labelStyle, children: item.name }), !isDragging ? (jsx_runtime_1.jsxs("div", { className: hoverable_1.HOVER_GROUP_REVEAL_CLASS_NAME, style: inlineActionsStyle, children: [
|
|
489
607
|
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { variant: null, title: "More actions", renderAction: renderContextMenuAction, getItems: getContextMenuItems, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME }), fileExplorerDisabled ? null : (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
490
608
|
jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.5 }), jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, title: `Show in ${fileManagerName}`, renderAction: renderFileExplorerAction, onClick: revealInExplorer, style: hoverable_1.NO_HOVER_BACKGROUND_STYLE, className: hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME })
|
|
491
609
|
] }))] })) : null] }) }) }));
|
|
@@ -4,35 +4,48 @@ exports.Button = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const colors_1 = require("../helpers/colors");
|
|
7
|
+
const hoverable_1 = require("../helpers/hoverable");
|
|
7
8
|
const button = {
|
|
8
|
-
border: `1px solid ${colors_1.BLACK_ALPHA_60}`,
|
|
9
|
-
borderRadius: 4,
|
|
10
|
-
backgroundColor: colors_1.INPUT_BACKGROUND,
|
|
11
9
|
appearance: 'none',
|
|
10
|
+
border: 'none',
|
|
11
|
+
borderRadius: 6,
|
|
12
|
+
cursor: 'default',
|
|
12
13
|
fontFamily: 'inherit',
|
|
13
14
|
fontSize: 14,
|
|
14
|
-
color: colors_1.WHITE,
|
|
15
15
|
flexDirection: 'row',
|
|
16
|
+
margin: 0,
|
|
17
|
+
padding: 0,
|
|
16
18
|
};
|
|
17
19
|
const ButtonRefForwardFunction = ({ children, onClick, title, disabled, size = 'default', style, id, autoFocus, buttonContainerStyle, onPointerDown, }, ref) => {
|
|
18
20
|
const combined = (0, react_1.useMemo)(() => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const idleBackground = (_a = style === null || style === void 0 ? void 0 : style.backgroundColor) !== null && _a !== void 0 ? _a : colors_1.TRANSPARENT;
|
|
23
|
+
const idleColor = (_b = style === null || style === void 0 ? void 0 : style.color) !== null && _b !== void 0 ? _b : colors_1.LIGHT_TEXT;
|
|
19
24
|
return {
|
|
20
25
|
...button,
|
|
26
|
+
...(0, hoverable_1.hoverableStyle)({
|
|
27
|
+
idleBackground,
|
|
28
|
+
hoverBackground: disabled || (style === null || style === void 0 ? void 0 : style.backgroundColor)
|
|
29
|
+
? idleBackground
|
|
30
|
+
: (0, colors_1.getBackgroundFromHoverState)({ hovered: true, selected: false }),
|
|
31
|
+
idleColor,
|
|
32
|
+
hoverColor: disabled || (style === null || style === void 0 ? void 0 : style.color) ? idleColor : colors_1.WHITE,
|
|
33
|
+
}),
|
|
21
34
|
...(size === 'compact' ? { fontSize: 12 } : null),
|
|
22
35
|
...(size === 'condensed' ? { fontSize: 11 } : null),
|
|
23
36
|
...(style !== null && style !== void 0 ? style : {}),
|
|
24
37
|
};
|
|
25
|
-
}, [size, style]);
|
|
38
|
+
}, [disabled, size, style]);
|
|
26
39
|
const buttonContainer = (0, react_1.useMemo)(() => {
|
|
27
40
|
return {
|
|
28
41
|
padding: size === 'condensed' ? '2px 7px' : size === 'compact' ? '5px 8px' : 10,
|
|
29
|
-
cursor:
|
|
42
|
+
cursor: 'default',
|
|
30
43
|
fontSize: size === 'condensed' ? 11 : size === 'compact' ? 12 : 14,
|
|
31
44
|
lineHeight: size === 'condensed' ? '14px' : size === 'compact' ? '14px' : undefined,
|
|
32
45
|
opacity: disabled ? 0.7 : 1,
|
|
33
46
|
...(buttonContainerStyle !== null && buttonContainerStyle !== void 0 ? buttonContainerStyle : {}),
|
|
34
47
|
};
|
|
35
48
|
}, [buttonContainerStyle, disabled, size]);
|
|
36
|
-
return (jsx_runtime_1.jsx("button", { ref: ref, id: id, style: combined, type: "button", disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, autoFocus: autoFocus, title: title, children: jsx_runtime_1.jsx("div", { className: "css-reset", style: buttonContainer, children: children }) }));
|
|
49
|
+
return (jsx_runtime_1.jsx("button", { ref: ref, className: `${hoverable_1.HOVERABLE_CLASS_NAME} ${hoverable_1.FOCUS_VISIBLE_ONLY_CLASS_NAME}`, id: id, style: combined, type: "button", disabled: disabled, onClick: onClick, onPointerDown: onPointerDown, autoFocus: autoFocus, title: title, children: jsx_runtime_1.jsx("div", { className: "css-reset", style: buttonContainer, children: children }) }));
|
|
37
50
|
};
|
|
38
51
|
exports.Button = (0, react_1.forwardRef)(ButtonRefForwardFunction);
|