decentraland-ui2 0.39.2 → 0.40.0
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/WearablePreview/AnimationControls/AnimationControls.d.ts +3 -0
- package/dist/components/WearablePreview/AnimationControls/AnimationControls.js +59 -0
- package/dist/components/WearablePreview/AnimationControls/AnimationControls.js.map +1 -0
- package/dist/components/WearablePreview/AnimationControls/AnimationControls.styled.d.ts +16 -0
- package/dist/components/WearablePreview/AnimationControls/AnimationControls.styled.js +15 -0
- package/dist/components/WearablePreview/AnimationControls/AnimationControls.styled.js.map +1 -0
- package/dist/components/WearablePreview/AnimationControls/AnimationControls.types.d.ts +13 -0
- package/dist/components/WearablePreview/AnimationControls/AnimationControls.types.js +2 -0
- package/dist/components/WearablePreview/AnimationControls/AnimationControls.types.js.map +1 -0
- package/dist/components/WearablePreview/AnimationControls/index.d.ts +2 -0
- package/dist/components/WearablePreview/AnimationControls/index.js +2 -0
- package/dist/components/WearablePreview/AnimationControls/index.js.map +1 -0
- package/dist/components/WearablePreview/EmoteControls/EmoteControls.d.ts +3 -0
- package/dist/components/WearablePreview/EmoteControls/EmoteControls.js +174 -0
- package/dist/components/WearablePreview/EmoteControls/EmoteControls.js.map +1 -0
- package/dist/components/WearablePreview/EmoteControls/EmoteControls.styled.d.ts +26 -0
- package/dist/components/WearablePreview/EmoteControls/EmoteControls.styled.js +98 -0
- package/dist/components/WearablePreview/EmoteControls/EmoteControls.styled.js.map +1 -0
- package/dist/components/WearablePreview/EmoteControls/EmoteControls.types.d.ts +32 -0
- package/dist/components/WearablePreview/EmoteControls/EmoteControls.types.js +2 -0
- package/dist/components/WearablePreview/EmoteControls/EmoteControls.types.js.map +1 -0
- package/dist/components/WearablePreview/EmoteControls/index.d.ts +2 -0
- package/dist/components/WearablePreview/EmoteControls/index.js +2 -0
- package/dist/components/WearablePreview/EmoteControls/index.js.map +1 -0
- package/dist/components/WearablePreview/TranslationControls/TranslationControls.d.ts +3 -0
- package/dist/components/WearablePreview/TranslationControls/TranslationControls.js +15 -0
- package/dist/components/WearablePreview/TranslationControls/TranslationControls.js.map +1 -0
- package/dist/components/WearablePreview/TranslationControls/TranslationControls.styled.d.ts +25 -0
- package/dist/components/WearablePreview/TranslationControls/TranslationControls.styled.js +65 -0
- package/dist/components/WearablePreview/TranslationControls/TranslationControls.styled.js.map +1 -0
- package/dist/components/WearablePreview/TranslationControls/TranslationControls.types.d.ts +19 -0
- package/dist/components/WearablePreview/TranslationControls/TranslationControls.types.js +13 -0
- package/dist/components/WearablePreview/TranslationControls/TranslationControls.types.js.map +1 -0
- package/dist/components/WearablePreview/TranslationControls/index.d.ts +3 -0
- package/dist/components/WearablePreview/TranslationControls/index.js +3 -0
- package/dist/components/WearablePreview/TranslationControls/index.js.map +1 -0
- package/dist/components/WearablePreview/WearablePreview.controller.d.ts +3 -1
- package/dist/components/WearablePreview/WearablePreview.controller.js +49 -12
- package/dist/components/WearablePreview/WearablePreview.controller.js.map +1 -1
- package/dist/components/WearablePreview/WearablePreview.js +5 -3
- package/dist/components/WearablePreview/WearablePreview.js.map +1 -1
- package/dist/components/WearablePreview/WearablePreview.stories.d.ts +5 -0
- package/dist/components/WearablePreview/WearablePreview.stories.js +42 -5
- package/dist/components/WearablePreview/WearablePreview.stories.js.map +1 -1
- package/dist/components/WearablePreview/WearablePreview.stories.styled.js +5 -5
- package/dist/components/WearablePreview/WearablePreview.stories.styled.js.map +1 -1
- package/dist/components/WearablePreview/WearablePreview.types.d.ts +3 -9
- package/dist/components/WearablePreview/WearablePreview.types.js +1 -9
- package/dist/components/WearablePreview/WearablePreview.types.js.map +1 -1
- package/dist/components/WearablePreview/ZoomControls/ZoomControls.d.ts +3 -0
- package/dist/components/WearablePreview/ZoomControls/ZoomControls.js +19 -0
- package/dist/components/WearablePreview/ZoomControls/ZoomControls.js.map +1 -0
- package/dist/components/WearablePreview/ZoomControls/ZoomControls.styled.d.ts +11 -0
- package/dist/components/WearablePreview/ZoomControls/ZoomControls.styled.js +29 -0
- package/dist/components/WearablePreview/ZoomControls/ZoomControls.styled.js.map +1 -0
- package/dist/components/WearablePreview/ZoomControls/ZoomControls.types.d.ts +12 -0
- package/dist/components/WearablePreview/ZoomControls/ZoomControls.types.js +6 -0
- package/dist/components/WearablePreview/ZoomControls/ZoomControls.types.js.map +1 -0
- package/dist/components/WearablePreview/ZoomControls/index.d.ts +3 -0
- package/dist/components/WearablePreview/ZoomControls/index.js +3 -0
- package/dist/components/WearablePreview/ZoomControls/index.js.map +1 -0
- package/dist/components/WearablePreview/index.d.ts +9 -1
- package/dist/components/WearablePreview/index.js +5 -1
- package/dist/components/WearablePreview/index.js.map +1 -1
- package/dist/components/WearablePreview/useWearablePreviewController.d.ts +5 -0
- package/dist/components/WearablePreview/useWearablePreviewController.js +45 -0
- package/dist/components/WearablePreview/useWearablePreviewController.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
4
|
+
import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp";
|
|
5
|
+
import ButtonGroup from "@mui/material/ButtonGroup";
|
|
6
|
+
import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
7
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
8
|
+
import MenuList from "@mui/material/MenuList";
|
|
9
|
+
import Paper from "@mui/material/Paper";
|
|
10
|
+
import Popper from "@mui/material/Popper";
|
|
11
|
+
import { useWearablePreviewController } from "../useWearablePreviewController";
|
|
12
|
+
import { StyledAnimationButton, StyledAnimationDivider, StyledAnimationGrow, } from "./AnimationControls.styled";
|
|
13
|
+
export const AnimationControls = ({ wearablePreviewId, className, wearablePreviewController, selectedAnimation, onSelectAnimation, }) => {
|
|
14
|
+
const { controllerRef, isReady } = useWearablePreviewController(wearablePreviewId, wearablePreviewController);
|
|
15
|
+
const [open, setOpen] = React.useState(false);
|
|
16
|
+
const anchorRef = React.useRef(null);
|
|
17
|
+
const [socialEmoteAnimations, setSocialEmoteAnimations] = useState(undefined);
|
|
18
|
+
const selectedIndex = useMemo(() => {
|
|
19
|
+
if (!socialEmoteAnimations || !selectedAnimation) {
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
const index = socialEmoteAnimations.findIndex((anim) => anim.title === selectedAnimation.title);
|
|
23
|
+
return index >= 0 ? index : 0;
|
|
24
|
+
}, [socialEmoteAnimations, selectedAnimation]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (isReady && controllerRef.current) {
|
|
27
|
+
if (socialEmoteAnimations === undefined) {
|
|
28
|
+
controllerRef.current.emote
|
|
29
|
+
.getSocialEmoteAnimations()
|
|
30
|
+
.then((socialEmoteAnimations) => {
|
|
31
|
+
setSocialEmoteAnimations(socialEmoteAnimations);
|
|
32
|
+
})
|
|
33
|
+
.catch((error) => {
|
|
34
|
+
console.error("Error checking social emote:", error);
|
|
35
|
+
setSocialEmoteAnimations(null);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, [socialEmoteAnimations, isReady, controllerRef]);
|
|
40
|
+
const handleMenuItemClick = useCallback((_event, index) => {
|
|
41
|
+
setOpen(false);
|
|
42
|
+
onSelectAnimation?.(socialEmoteAnimations[index]);
|
|
43
|
+
}, [socialEmoteAnimations, onSelectAnimation]);
|
|
44
|
+
const handleToggle = useCallback(() => {
|
|
45
|
+
setOpen((prevOpen) => !prevOpen);
|
|
46
|
+
}, []);
|
|
47
|
+
const handleClose = useCallback((event) => {
|
|
48
|
+
if (anchorRef.current &&
|
|
49
|
+
anchorRef.current.contains(event.target)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
setOpen(false);
|
|
53
|
+
}, [anchorRef]);
|
|
54
|
+
if (!socialEmoteAnimations) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return (_jsxs(React.Fragment, { children: [_jsx(ButtonGroup, { className: className, variant: "contained", ref: anchorRef, "aria-label": "Button group with a nested menu", children: _jsxs(StyledAnimationButton, { size: "small", "aria-controls": open ? "split-button-menu" : undefined, "aria-expanded": open ? "true" : undefined, "aria-label": "select merge strategy", "aria-haspopup": "menu", onClick: handleToggle, children: [socialEmoteAnimations[selectedIndex].title, _jsx(StyledAnimationDivider, { orientation: "vertical", flexItem: true }), open ? _jsx(ArrowDropUpIcon, {}) : _jsx(ArrowDropDownIcon, {})] }) }), _jsx(Popper, { open: open, anchorEl: anchorRef.current, role: undefined, transition: true, disablePortal: true, className: `${className}__popper`, children: ({ TransitionProps, placement }) => (_jsx(StyledAnimationGrow, { ...TransitionProps, placement: placement, children: _jsx(Paper, { children: _jsx(ClickAwayListener, { onClickAway: handleClose, children: _jsx(MenuList, { id: "split-button-menu", autoFocusItem: true, children: socialEmoteAnimations.map((option, index) => (_jsx(MenuItem, { selected: index === selectedIndex, onClick: (event) => handleMenuItemClick(event, index), children: option.title }, option.title))) }) }) }) })) })] }));
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=AnimationControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationControls.js","sourceRoot":"","sources":["../../../../src/components/WearablePreview/AnimationControls/AnimationControls.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAExE,OAAO,iBAAiB,MAAM,mCAAmC,CAAA;AACjE,OAAO,eAAe,MAAM,iCAAiC,CAAA;AAC7D,OAAO,WAAW,MAAM,2BAA2B,CAAA;AACnD,OAAO,iBAAiB,MAAM,iCAAiC,CAAA;AAC/D,OAAO,QAAQ,MAAM,wBAAwB,CAAA;AAC7C,OAAO,QAAQ,MAAM,wBAAwB,CAAA;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ACO,GACd,GACY,CACvB,GACM,IACM,CAClB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const StyledAnimationButton: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
3
|
+
}, "disabled" | "color" | "className" | "style" | "classes" | "children" | "sx" | "variant" | "tabIndex" | "disableElevation" | "fullWidth" | "startIcon" | "endIcon" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "href" | "size"> & {
|
|
4
|
+
theme?: import("@emotion/react").Theme;
|
|
5
|
+
}, {}, {}>;
|
|
6
|
+
declare const StyledAnimationDivider: import("@emotion/styled").StyledComponent<import("@mui/material").DividerOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHRElement>, HTMLHRElement>, "ref"> & {
|
|
7
|
+
ref?: ((instance: HTMLHRElement | null) => void) | import("react").RefObject<HTMLHRElement> | null | undefined;
|
|
8
|
+
}, "light" | "textAlign" | "className" | "style" | "classes" | "children" | "sx" | "variant" | "orientation" | "absolute" | "flexItem"> & {
|
|
9
|
+
theme?: import("@emotion/react").Theme;
|
|
10
|
+
}, {}, {}>;
|
|
11
|
+
declare const StyledAnimationGrow: import("@emotion/styled").StyledComponent<import("@mui/material").GrowProps & {
|
|
12
|
+
theme?: import("@emotion/react").Theme;
|
|
13
|
+
} & {
|
|
14
|
+
placement?: string;
|
|
15
|
+
}, {}, {}>;
|
|
16
|
+
export { StyledAnimationButton, StyledAnimationDivider, StyledAnimationGrow };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Button, Divider, Grow } from "@mui/material";
|
|
3
|
+
const StyledAnimationButton = styled(Button)(({ theme }) => ({
|
|
4
|
+
gap: theme.spacing(1),
|
|
5
|
+
}));
|
|
6
|
+
const StyledAnimationDivider = styled(Divider)(({ theme }) => ({
|
|
7
|
+
height: "calc(100% + 8px)",
|
|
8
|
+
marginTop: theme.spacing(-0.5),
|
|
9
|
+
borderColor: theme.palette.common.white,
|
|
10
|
+
}));
|
|
11
|
+
const StyledAnimationGrow = styled(Grow)(({ placement }) => ({
|
|
12
|
+
transformOrigin: placement === "bottom" ? "center top" : "center bottom",
|
|
13
|
+
}));
|
|
14
|
+
export { StyledAnimationButton, StyledAnimationDivider, StyledAnimationGrow };
|
|
15
|
+
//# sourceMappingURL=AnimationControls.styled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationControls.styled.js","sourceRoot":"","sources":["../../../../src/components/WearablePreview/AnimationControls/AnimationControls.styled.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3D,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;CACtB,CAAC,CAAC,CAAA;AAEH,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,EAAE,kBAAkB;IAC1B,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC;IAC9B,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;CACxC,CAAC,CAAC,CAAA;AAEH,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,CACtC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;IAClB,eAAe,EAAE,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe;CACzE,CAAC,CACH,CAAA;AAED,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IPreviewController } from "@dcl/schemas";
|
|
2
|
+
import { SocialEmoteAnimation } from "@dcl/schemas/dist/dapps/preview/social-emote-animation";
|
|
3
|
+
export type AnimationControlsProps = {
|
|
4
|
+
wearablePreviewId: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
wearablePreviewController?: IPreviewController;
|
|
7
|
+
selectedAnimation?: SocialEmoteAnimation;
|
|
8
|
+
onSelectAnimation?: (animation: SocialEmoteAnimation) => void;
|
|
9
|
+
renderAnimationSelector?: (props: {
|
|
10
|
+
socialEmoteAnimations: SocialEmoteAnimation[] | null;
|
|
11
|
+
onSelectAnimation?: (animation: SocialEmoteAnimation) => void;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationControls.types.js","sourceRoot":"","sources":["../../../../src/components/WearablePreview/AnimationControls/AnimationControls.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/WearablePreview/AnimationControls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
3
|
+
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { PreviewEmoteEventType } from "@dcl/schemas/dist/dapps/preview/preview-emote-event-type";
|
|
5
|
+
import PauseIcon from "@mui/icons-material/Pause";
|
|
6
|
+
import PlayArrowIcon from "@mui/icons-material/PlayArrow";
|
|
7
|
+
import VolumeOffIcon from "@mui/icons-material/VolumeOff";
|
|
8
|
+
import VolumeUpIcon from "@mui/icons-material/VolumeUp";
|
|
9
|
+
import { useWearablePreviewController } from "../useWearablePreviewController";
|
|
10
|
+
import { StyledEmoteControlsContainer, StyledFrameControl, StyledFrameInput, StyledPlayButton, StyledRangeInput, StyledSoundButton, } from "./EmoteControls.styled";
|
|
11
|
+
export const EmoteControls = ({ wearablePreviewId, className, hideFrameInput, hideProgressInput, hidePlayButton, hideSoundButton, wearablePreviewController, renderPlayButton, renderSoundButton, renderProgressBar, renderFrameInput, }) => {
|
|
12
|
+
const { controllerRef, isReady } = useWearablePreviewController(wearablePreviewId, wearablePreviewController);
|
|
13
|
+
const [frame, setFrame] = useState(0);
|
|
14
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
15
|
+
const [length, setLength] = useState(undefined);
|
|
16
|
+
const [isSoundEnabled, setIsSoundEnabled] = useState(false);
|
|
17
|
+
const [hasSound, setHasSound] = useState(undefined);
|
|
18
|
+
const [shouldResumePlaying, setShouldResumePlaying] = useState(false);
|
|
19
|
+
const [isChangingFrame, setIsChangingFrame] = useState(false);
|
|
20
|
+
const handleAnimationLoop = useCallback(() => {
|
|
21
|
+
setFrame(0);
|
|
22
|
+
}, []);
|
|
23
|
+
const handleAnimationEnd = useCallback(() => {
|
|
24
|
+
setIsPlaying(false);
|
|
25
|
+
setFrame((currentFrame) => {
|
|
26
|
+
const currentLength = length ?? 0;
|
|
27
|
+
return currentFrame >= Math.floor(currentLength * 100) ? 0 : currentFrame;
|
|
28
|
+
});
|
|
29
|
+
}, [length]);
|
|
30
|
+
const handleAnimationPause = useCallback(() => {
|
|
31
|
+
setIsPlaying(false);
|
|
32
|
+
}, []);
|
|
33
|
+
const handleAnimationPlay = useCallback(async () => {
|
|
34
|
+
if (!isChangingFrame) {
|
|
35
|
+
let emoteLength = length;
|
|
36
|
+
if (!length && controllerRef.current) {
|
|
37
|
+
emoteLength = await controllerRef.current.emote.getLength();
|
|
38
|
+
}
|
|
39
|
+
setIsPlaying(true);
|
|
40
|
+
setLength(emoteLength);
|
|
41
|
+
}
|
|
42
|
+
}, [length, isChangingFrame, controllerRef]);
|
|
43
|
+
const handleAnimationPlaying = useCallback(({ length: playingLength }) => {
|
|
44
|
+
setFrame(Math.ceil((playingLength ?? 0) * 100));
|
|
45
|
+
}, []);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const controller = controllerRef.current;
|
|
48
|
+
if (!controller) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
controller.emote.events.on(PreviewEmoteEventType.ANIMATION_PLAY, handleAnimationPlay);
|
|
52
|
+
controller.emote.events.on(PreviewEmoteEventType.ANIMATION_PLAYING, handleAnimationPlaying);
|
|
53
|
+
controller.emote.events.on(PreviewEmoteEventType.ANIMATION_END, handleAnimationEnd);
|
|
54
|
+
controller.emote.events.on(PreviewEmoteEventType.ANIMATION_PAUSE, handleAnimationPause);
|
|
55
|
+
controller.emote.events.on(PreviewEmoteEventType.ANIMATION_LOOP, handleAnimationLoop);
|
|
56
|
+
return () => {
|
|
57
|
+
controller.emote.events.off(PreviewEmoteEventType.ANIMATION_PLAY, handleAnimationPlay);
|
|
58
|
+
controller.emote.events.off(PreviewEmoteEventType.ANIMATION_PLAYING, handleAnimationPlaying);
|
|
59
|
+
controller.emote.events.off(PreviewEmoteEventType.ANIMATION_END, handleAnimationEnd);
|
|
60
|
+
controller.emote.events.off(PreviewEmoteEventType.ANIMATION_PAUSE, handleAnimationPause);
|
|
61
|
+
controller.emote.events.off(PreviewEmoteEventType.ANIMATION_LOOP, handleAnimationLoop);
|
|
62
|
+
};
|
|
63
|
+
}, [
|
|
64
|
+
controllerRef,
|
|
65
|
+
handleAnimationPlay,
|
|
66
|
+
handleAnimationPlaying,
|
|
67
|
+
handleAnimationEnd,
|
|
68
|
+
handleAnimationPause,
|
|
69
|
+
handleAnimationLoop,
|
|
70
|
+
]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (hasSound === undefined && isReady && controllerRef.current) {
|
|
73
|
+
controllerRef.current.emote
|
|
74
|
+
.hasSound()
|
|
75
|
+
.then((soundExists) => setHasSound(soundExists))
|
|
76
|
+
.catch((error) => {
|
|
77
|
+
console.error("Error checking sound:", error);
|
|
78
|
+
setHasSound(false);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, [hasSound, isReady, controllerRef]);
|
|
82
|
+
const handlePlay = useCallback(async () => {
|
|
83
|
+
if (!controllerRef.current) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
await controllerRef.current.emote.play();
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error("Error playing emote:", error);
|
|
91
|
+
}
|
|
92
|
+
}, [controllerRef]);
|
|
93
|
+
const handlePause = useCallback(async () => {
|
|
94
|
+
if (!controllerRef.current) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
await controllerRef.current.emote.pause();
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
console.error("Error pausing emote:", error);
|
|
102
|
+
}
|
|
103
|
+
}, [controllerRef]);
|
|
104
|
+
const handlePlayPause = useCallback(async () => {
|
|
105
|
+
if (isPlaying) {
|
|
106
|
+
await handlePause();
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
await handlePlay();
|
|
110
|
+
}
|
|
111
|
+
}, [isPlaying, handlePlay, handlePause]);
|
|
112
|
+
const handleSoundToggle = useCallback(() => {
|
|
113
|
+
if (isSoundEnabled) {
|
|
114
|
+
controllerRef.current?.emote.disableSound();
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
controllerRef.current?.emote.enableSound();
|
|
118
|
+
}
|
|
119
|
+
setIsSoundEnabled(!isSoundEnabled);
|
|
120
|
+
}, [isSoundEnabled, controllerRef]);
|
|
121
|
+
const handleFrameChange = useCallback(async (value) => {
|
|
122
|
+
if (isNaN(value) || !controllerRef.current) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
let targetValue = value;
|
|
126
|
+
const currentLength = length ?? 0;
|
|
127
|
+
if (currentLength * 100 < value) {
|
|
128
|
+
targetValue = currentLength * 100;
|
|
129
|
+
}
|
|
130
|
+
setFrame(targetValue);
|
|
131
|
+
setIsChangingFrame(true);
|
|
132
|
+
try {
|
|
133
|
+
if (isPlaying) {
|
|
134
|
+
await controllerRef.current.emote.pause();
|
|
135
|
+
setShouldResumePlaying(true);
|
|
136
|
+
}
|
|
137
|
+
await controllerRef.current.emote.goTo(targetValue / 100);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
console.error("Error changing frame:", error);
|
|
141
|
+
}
|
|
142
|
+
}, [length, isPlaying, controllerRef]);
|
|
143
|
+
const handleMouseUp = useCallback(async () => {
|
|
144
|
+
setIsChangingFrame(false);
|
|
145
|
+
if (shouldResumePlaying && controllerRef.current) {
|
|
146
|
+
try {
|
|
147
|
+
await controllerRef.current.emote.play();
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
console.error("Error resuming play:", error);
|
|
151
|
+
}
|
|
152
|
+
setShouldResumePlaying(false);
|
|
153
|
+
}
|
|
154
|
+
}, [shouldResumePlaying, controllerRef]);
|
|
155
|
+
return (_jsxs(StyledEmoteControlsContainer, { className: className, children: [hidePlayButton ? null : renderPlayButton ? (renderPlayButton({
|
|
156
|
+
isPlaying,
|
|
157
|
+
onPlay: handlePlay,
|
|
158
|
+
onPause: handlePause,
|
|
159
|
+
onToggle: handlePlayPause,
|
|
160
|
+
})) : (_jsx(StyledPlayButton, { onClick: handlePlayPause, children: isPlaying ? _jsx(PauseIcon, {}) : _jsx(PlayArrowIcon, {}) })), !hideProgressInput ? (renderProgressBar ? (renderProgressBar({
|
|
161
|
+
frame,
|
|
162
|
+
length: length ?? 0,
|
|
163
|
+
onChange: handleFrameChange,
|
|
164
|
+
onMouseUp: handleMouseUp,
|
|
165
|
+
})) : (_jsx(StyledRangeInput, { type: "range", value: frame, max: Math.ceil((length ?? 0) * 100), min: 0, step: 1, onChange: (e) => handleFrameChange(Number(e.target.value)), onMouseUp: handleMouseUp }))) : null, hideFrameInput ? null : (_jsx(StyledFrameControl, { children: renderFrameInput ? (renderFrameInput({
|
|
166
|
+
frame: Math.round(frame / 100),
|
|
167
|
+
onChange: (value) => handleFrameChange(value * 100),
|
|
168
|
+
})) : (_jsx(StyledFrameInput, { type: "number", value: Math.round(frame / 100), onChange: (e) => handleFrameChange(Number(e.target.value) * 100) })) })), hideSoundButton || !hasSound ? null : renderSoundButton ? (renderSoundButton({
|
|
169
|
+
isSoundEnabled,
|
|
170
|
+
hasSound,
|
|
171
|
+
onToggle: handleSoundToggle,
|
|
172
|
+
})) : (_jsx(StyledSoundButton, { muted: !isSoundEnabled, onClick: handleSoundToggle, children: isSoundEnabled ? _jsx(VolumeUpIcon, {}) : _jsx(VolumeOffIcon, {}) }))] }));
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=EmoteControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmoteControls.js","sourceRoot":"","sources":["../../../../src/components/WearablePreview/EmoteControls/EmoteControls.tsx"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAA;AAChG,OAAO,SAAS,MAAM,2BAA2B,CAAA;AACjD,OAAO,aAAa,MAAM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AC,CAAC,CAAC,CACzD,iBAAiB,CAAC;gBAChB,cAAc;gBACd,QAAQ;gBACR,QAAQ,EAAE,iBAAiB;aAC5B,CAAC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,iBAAiB,IAAC,KAAK,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,iBAAiB,YAClE,cAAc,CAAC,CAAC,CAAC,KAAC,YAAY,KAAG,CAAC,CAAC,CAAC,KAAC,aAAa,KAAG,GACpC,CACrB,IAC4B,CAChC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const StyledEmoteControlsContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & {
|
|
4
|
+
theme?: import("@emotion/react").Theme;
|
|
5
|
+
}, {}, {}>;
|
|
6
|
+
declare const StyledPlayButton: import("@emotion/styled").StyledComponent<import("../../Button").ButtonProps & {
|
|
7
|
+
theme?: import("@emotion/react").Theme;
|
|
8
|
+
}, {}, {}>;
|
|
9
|
+
declare const StyledSoundButton: import("@emotion/styled").StyledComponent<import("../../Button").ButtonProps & {
|
|
10
|
+
theme?: import("@emotion/react").Theme;
|
|
11
|
+
} & {
|
|
12
|
+
muted?: boolean;
|
|
13
|
+
}, {}, {}>;
|
|
14
|
+
declare const StyledRangeInput: import("@emotion/styled").StyledComponent<{
|
|
15
|
+
theme?: import("@emotion/react").Theme;
|
|
16
|
+
as?: import("react").ElementType;
|
|
17
|
+
}, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
|
|
18
|
+
declare const StyledFrameControl: import("@emotion/styled").StyledComponent<{
|
|
19
|
+
theme?: import("@emotion/react").Theme;
|
|
20
|
+
as?: import("react").ElementType;
|
|
21
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
22
|
+
declare const StyledFrameInput: import("@emotion/styled").StyledComponent<{
|
|
23
|
+
theme?: import("@emotion/react").Theme;
|
|
24
|
+
as?: import("react").ElementType;
|
|
25
|
+
}, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
|
|
26
|
+
export { StyledEmoteControlsContainer, StyledPlayButton, StyledSoundButton, StyledRangeInput, StyledFrameControl, StyledFrameInput, };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import { Button } from "../../Button";
|
|
4
|
+
const StyledEmoteControlsContainer = styled(Box)(({ theme }) => ({
|
|
5
|
+
display: "flex",
|
|
6
|
+
position: "absolute",
|
|
7
|
+
width: "100%",
|
|
8
|
+
bottom: 0,
|
|
9
|
+
margin: `${theme.spacing(2)} 0`,
|
|
10
|
+
padding: `0 ${theme.spacing(3)}`,
|
|
11
|
+
gap: theme.spacing(2),
|
|
12
|
+
}));
|
|
13
|
+
const StyledPlayButton = styled(Button)(({ theme }) => ({
|
|
14
|
+
width: 56,
|
|
15
|
+
height: 44,
|
|
16
|
+
padding: 0,
|
|
17
|
+
minWidth: "unset",
|
|
18
|
+
background: "rgba(0, 0, 0, 0.64) !important",
|
|
19
|
+
"& svg": {
|
|
20
|
+
marginLeft: theme.spacing(0.5),
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
const StyledSoundButton = styled(Button)(({ theme, muted }) => ({
|
|
24
|
+
marginLeft: theme.spacing(2.5),
|
|
25
|
+
minWidth: 25,
|
|
26
|
+
background: "none",
|
|
27
|
+
padding: 0,
|
|
28
|
+
opacity: muted ? 0.5 : 1,
|
|
29
|
+
}));
|
|
30
|
+
const StyledRangeInput = styled("input")(({ theme }) => ({
|
|
31
|
+
flex: 1,
|
|
32
|
+
width: "100%",
|
|
33
|
+
background: "none",
|
|
34
|
+
WebkitAppearance: "none",
|
|
35
|
+
"&:focus": {
|
|
36
|
+
outline: "none",
|
|
37
|
+
},
|
|
38
|
+
"&::-webkit-slider-thumb": {
|
|
39
|
+
WebkitAppearance: "none",
|
|
40
|
+
width: 24,
|
|
41
|
+
height: 24,
|
|
42
|
+
borderRadius: 10,
|
|
43
|
+
backgroundColor: "#736e7d",
|
|
44
|
+
overflow: "visible",
|
|
45
|
+
cursor: "pointer",
|
|
46
|
+
paddingBottom: theme.spacing(0.625),
|
|
47
|
+
marginTop: theme.spacing(-0.5),
|
|
48
|
+
},
|
|
49
|
+
"&::-moz-range-thumb": {
|
|
50
|
+
width: 24,
|
|
51
|
+
height: 24,
|
|
52
|
+
borderRadius: 20,
|
|
53
|
+
backgroundColor: "#736e7d",
|
|
54
|
+
overflow: "visible",
|
|
55
|
+
cursor: "pointer",
|
|
56
|
+
border: "none",
|
|
57
|
+
},
|
|
58
|
+
"&::-ms-thumb": {
|
|
59
|
+
width: 24,
|
|
60
|
+
height: 24,
|
|
61
|
+
borderRadius: 20,
|
|
62
|
+
backgroundColor: "#736e7d",
|
|
63
|
+
overflow: "visible",
|
|
64
|
+
cursor: "pointer",
|
|
65
|
+
},
|
|
66
|
+
"&::-webkit-slider-runnable-track": {
|
|
67
|
+
width: 300,
|
|
68
|
+
height: 15,
|
|
69
|
+
background: "rgba(115, 110, 125, 0.32)",
|
|
70
|
+
border: "none",
|
|
71
|
+
borderRadius: 10,
|
|
72
|
+
},
|
|
73
|
+
"&::-moz-range-track": {
|
|
74
|
+
width: "100%",
|
|
75
|
+
height: 15,
|
|
76
|
+
borderRadius: 10,
|
|
77
|
+
cursor: "pointer",
|
|
78
|
+
background: "rgba(115, 110, 125, 0.32)",
|
|
79
|
+
},
|
|
80
|
+
}));
|
|
81
|
+
const StyledFrameControl = styled("div")({
|
|
82
|
+
display: "flex",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
});
|
|
85
|
+
const StyledFrameInput = styled("input")({
|
|
86
|
+
width: 56,
|
|
87
|
+
height: 44,
|
|
88
|
+
borderRadius: 5,
|
|
89
|
+
background: "transparent",
|
|
90
|
+
border: "1px solid rgba(115, 110, 125, 0.4)",
|
|
91
|
+
color: "white",
|
|
92
|
+
textAlign: "center",
|
|
93
|
+
"&:focus-visible": {
|
|
94
|
+
outline: "1px solid",
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
export { StyledEmoteControlsContainer, StyledPlayButton, StyledSoundButton, StyledRangeInput, StyledFrameControl, StyledFrameInput, };
|
|
98
|
+
//# sourceMappingURL=EmoteControls.styled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmoteControls.styled.js","sourceRoot":"","sources":["../../../../src/components/WearablePreview/EmoteControls/EmoteControls.styled.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,MAAM,4BAA4B,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/D,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;IAC/B,OAAO,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;IAChC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;CACtB,CAAC,CAAC,CAAA;AAEH,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,E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YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,SAAS;QAC1B,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,MAAM;KACf;IACD,cAAc,EAAE;QACd,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,SAAS;QAC1B,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,SAAS;KAClB;IACD,kCAAkC,EAAE;QAClC,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,2BAA2B;QACvC,MAAM,EAAE,MAAM;QACd,YAAY,EAAE,EAAE;KACjB;IACD,qBAAqB,EAAE;QACrB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,2BAA2B;KACxC;CACF,CAAC,CAAC,CAAA;AAEH,MAAM,kBAAkB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;CACrB,CAAC,CAAA;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,YAAY,EAAE,CAAC;IACf,UAAU,EAAE,aAAa;IACzB,MAAM,EAAE,oCAAoC;IAC5C,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,QAAQ;IACnB,iBAAiB,EAAE;QACjB,OAAO,EAAE,WAAW;KACrB;CACF,CAAC,CAAA;AAEF,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GACjB,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IPreviewController } from "@dcl/schemas";
|
|
3
|
+
export type EmoteControlsProps = {
|
|
4
|
+
wearablePreviewId: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
hideFrameInput?: boolean;
|
|
7
|
+
hideProgressInput?: boolean;
|
|
8
|
+
hidePlayButton?: boolean;
|
|
9
|
+
hideSoundButton?: boolean;
|
|
10
|
+
wearablePreviewController?: IPreviewController;
|
|
11
|
+
renderPlayButton?: (props: {
|
|
12
|
+
isPlaying: boolean;
|
|
13
|
+
onPlay: () => Promise<void>;
|
|
14
|
+
onPause: () => Promise<void>;
|
|
15
|
+
onToggle: () => Promise<void>;
|
|
16
|
+
}) => React.ReactNode;
|
|
17
|
+
renderSoundButton?: (props: {
|
|
18
|
+
isSoundEnabled: boolean;
|
|
19
|
+
hasSound: boolean;
|
|
20
|
+
onToggle: () => void;
|
|
21
|
+
}) => React.ReactNode;
|
|
22
|
+
renderProgressBar?: (props: {
|
|
23
|
+
frame: number;
|
|
24
|
+
length: number;
|
|
25
|
+
onChange: (value: number) => Promise<void>;
|
|
26
|
+
onMouseUp: () => Promise<void>;
|
|
27
|
+
}) => React.ReactNode;
|
|
28
|
+
renderFrameInput?: (props: {
|
|
29
|
+
frame: number;
|
|
30
|
+
onChange: (value: number) => Promise<void>;
|
|
31
|
+
}) => React.ReactNode;
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmoteControls.types.js","sourceRoot":"","sources":["../../../../src/components/WearablePreview/EmoteControls/EmoteControls.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/WearablePreview/EmoteControls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import SwapVertIcon from "@mui/icons-material/SwapVert";
|
|
4
|
+
import { useWearablePreviewController } from "../useWearablePreviewController";
|
|
5
|
+
import { VerticalPosition, } from "./TranslationControls.types";
|
|
6
|
+
import { StyledIconWrapper, StyledSlider, StyledTranslationControlsContainer, StyledVerticalSliderContainer, } from "./TranslationControls.styled";
|
|
7
|
+
export const TranslationControls = ({ wearablePreviewId, vertical, className, verticalPosition = VerticalPosition.RIGHT, wearablePreviewController, }) => {
|
|
8
|
+
const { controllerRef } = useWearablePreviewController(wearablePreviewId, wearablePreviewController);
|
|
9
|
+
const handleControlTranslation = useCallback((_event, value) => {
|
|
10
|
+
const _value = Array.isArray(value) ? value[0] : value;
|
|
11
|
+
controllerRef.current?.scene.panCamera({ y: _value * -1 });
|
|
12
|
+
}, [controllerRef]);
|
|
13
|
+
return (_jsx(StyledTranslationControlsContainer, { className: className, verticalPosition: verticalPosition, children: vertical ? (_jsxs(StyledVerticalSliderContainer, { children: [_jsx(StyledIconWrapper, { children: _jsx(SwapVertIcon, {}) }), _jsx(StyledSlider, { orientation: "vertical", defaultValue: 0, step: 0.1, min: -2, max: 2, onChange: handleControlTranslation })] })) : null }));
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=TranslationControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationControls.js","sourceRoot":"","sources":["../../../../src/components/WearablePreview/TranslationControls/TranslationControls.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,YAAY,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAEL,gBAAgB,GACjB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,kCAAkC,EAClC,6BAA6B,GAC9B,MAAM,8BAA8B,CAAA;AAErC,MAAM,CAAC,MAAM,mBAAmB,GAAuC,CAAC,EACtE,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,gBAAgB,GAAG,gBAAgB,CAAC,KAAK,EACzC,yBAAyB,GAC1B,EAAE,EAAE;IACH,MAAM,EAAE,aAAa,EAAE,GAAG,4BAA4B,CACpD,iBAAiB,EACjB,yBAAyB,CAC1B,CAAA;IACD,MAAM,wBAAwB,GAAG,WAAW,CAC1C,CAAC,MAAa,EAAE,KAAwB,EAAE,EAAE;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QACtD,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAA;IAC5D,CAAC,EACD,CAAC,aAAa,CAAC,CAChB,CAAA;IAED,OAAO,CACL,KAAC,kCAAkC,IACjC,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,YAEjC,QAAQ,CAAC,CAAC,CAAC,CACV,MAAC,6BAA6B,eAC5B,KAAC,iBAAiB,cAChB,KAAC,YAAY,KAAG,GACE,EACpB,KAAC,YAAY,IACX,WAAW,EAAC,UAAU,EACtB,YAAY,EAAE,CAAC,EACf,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,CAAC,CAAC,EACP,GAAG,EAAE,CAAC,EACN,QAAQ,EAAE,wBAAwB,GAClC,IAC4B,CACjC,CAAC,CAAC,CAAC,IAAI,GAC2B,CACtC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HorizontalPosition, VerticalPosition } from "./TranslationControls.types";
|
|
2
|
+
declare const StyledTranslationControlsContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & {
|
|
5
|
+
theme?: import("@emotion/react").Theme;
|
|
6
|
+
} & {
|
|
7
|
+
horizontalPosition?: HorizontalPosition;
|
|
8
|
+
verticalPosition?: VerticalPosition;
|
|
9
|
+
}, {}, {}>;
|
|
10
|
+
declare const StyledVerticalSliderContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
11
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
12
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & {
|
|
13
|
+
theme?: import("@emotion/react").Theme;
|
|
14
|
+
}, {}, {}>;
|
|
15
|
+
declare const StyledIconWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
16
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
17
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & {
|
|
18
|
+
theme?: import("@emotion/react").Theme;
|
|
19
|
+
}, {}, {}>;
|
|
20
|
+
declare const StyledSlider: import("@emotion/styled").StyledComponent<import("@mui/material").SliderOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
21
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
22
|
+
}, "disabled" | "components" | "color" | "scale" | "className" | "style" | "classes" | "sx" | "track" | "defaultValue" | "tabIndex" | "aria-label" | "aria-labelledby" | "aria-valuetext" | "onChange" | "size" | "name" | "value" | "slots" | "slotProps" | "orientation" | "componentsProps" | "max" | "disableSwap" | "getAriaLabel" | "getAriaValueText" | "marks" | "min" | "onChangeCommitted" | "shiftStep" | "step" | "valueLabelDisplay" | "valueLabelFormat"> & {
|
|
23
|
+
theme?: import("@emotion/react").Theme;
|
|
24
|
+
}, {}, {}>;
|
|
25
|
+
export { StyledIconWrapper, StyledSlider, StyledTranslationControlsContainer, StyledVerticalSliderContainer, };
|