@ayseaistudio/ui-components 3.5.13 → 3.5.15
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/Player/Player.d.ts
CHANGED
|
@@ -11,9 +11,10 @@ interface Props {
|
|
|
11
11
|
className: any;
|
|
12
12
|
audioUrl?: string;
|
|
13
13
|
audioReference: React.Ref<HTMLAudioElement | null>;
|
|
14
|
+
disabled?: boolean;
|
|
14
15
|
}
|
|
15
16
|
export declare const Player: {
|
|
16
|
-
({ withButton, size, status, direction, className, isPlaying, isLoading, togglePlayPause, audioUrl, audioReference }: Props): React.JSX.Element;
|
|
17
|
+
({ withButton, size, status, direction, className, isPlaying, isLoading, togglePlayPause, audioUrl, audioReference, disabled }: Props): React.JSX.Element;
|
|
17
18
|
propTypes: {
|
|
18
19
|
withButton: PropTypes.Requireable<boolean>;
|
|
19
20
|
size: PropTypes.Requireable<string>;
|
package/dist/Player/Player.js
CHANGED
|
@@ -6,7 +6,7 @@ import { IconPlayerPlayFilled, IconPlayerPauseFilled } from "@tabler/icons-react
|
|
|
6
6
|
import { PrimaryButton } from "../PrimaryButton/PrimaryButton";
|
|
7
7
|
import { Loader } from "../Loader/Loader";
|
|
8
8
|
import { useState, useEffect, useRef } from "react";
|
|
9
|
-
export const Player = ({ withButton = true, size, status, direction, className, isPlaying, isLoading = false, togglePlayPause, audioUrl, audioReference }) => {
|
|
9
|
+
export const Player = ({ withButton = true, size, status, direction, className, isPlaying, isLoading = false, togglePlayPause, audioUrl, audioReference, disabled = false }) => {
|
|
10
10
|
const [volume, setVolume] = useState(100);
|
|
11
11
|
const [currentTime, setCurrentTime] = useState(0);
|
|
12
12
|
const [duration, setDuration] = useState(0);
|
|
@@ -60,7 +60,7 @@ export const Player = ({ withButton = true, size, status, direction, className,
|
|
|
60
60
|
setAudioInstance(null);
|
|
61
61
|
};
|
|
62
62
|
}, [audioUrl]);
|
|
63
|
-
return (_jsxs("div", { className: `player ${className}`, children: [withButton && (_jsx(PrimaryButton, { className: "primary-button", leftIcon: isLoading ? (_jsx(Loader, { size: 20 })) : isPlaying ? (_jsx(IconPlayerPauseFilled, { size: 20, color: "#F1F1F1" })) : (_jsx(IconPlayerPlayFilled, { size: 20, color: "#F1F1F1" })), color: "black", onClick: togglePlayPause })), _jsx("div", { className: "player-controls", children: _jsx(SingleSlider, { className: "seek-slider", size: "large", status: "zero", value: currentTime, min: 0, max: duration, onChange: handleSeekChange, rightLabel: _jsxs("span", { className: "slider-time", children: [_jsx("span", { className: "current-time", children: formatTime(currentTime) }), _jsx("span", { children: " / " }), _jsx("span", { className: "total-time", children: formatTime(duration || 0) })] }) }) })] }));
|
|
63
|
+
return (_jsxs("div", { className: `player ${className}`, children: [withButton && (_jsx(PrimaryButton, { className: "primary-button", leftIcon: isLoading ? (_jsx(Loader, { size: 20 })) : isPlaying ? (_jsx(IconPlayerPauseFilled, { size: 20, color: "#F1F1F1" })) : (_jsx(IconPlayerPlayFilled, { size: 20, color: "#F1F1F1" })), color: "black", onClick: togglePlayPause, status: disabled ? "disabled" : "default" })), _jsx("div", { className: "player-controls", children: _jsx(SingleSlider, { className: "seek-slider", size: "large", status: "zero", value: currentTime, min: 0, max: duration, onChange: handleSeekChange, rightLabel: _jsxs("span", { className: "slider-time", children: [_jsx("span", { className: "current-time", children: formatTime(currentTime) }), _jsx("span", { children: " / " }), _jsx("span", { className: "total-time", children: formatTime(duration || 0) })] }) }) })] }));
|
|
64
64
|
};
|
|
65
65
|
Player.propTypes = {
|
|
66
66
|
withButton: PropTypes.bool,
|
|
@@ -8,11 +8,15 @@ export const TertiaryButton = ({ text, leftIcon, rightIcon, size, color, status,
|
|
|
8
8
|
color: color || "black",
|
|
9
9
|
status: status || "default",
|
|
10
10
|
});
|
|
11
|
-
return (_jsxs("div", { className: `tertiary-button ${state.size} ${state.color} ${state.status} ${className}`, onClick: onClick, onMouseLeave:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
return (_jsxs("div", { className: `tertiary-button ${state.size} ${state.color} ${state.status} ${className}`, onClick: state.status === "disabled" ? undefined : onClick, onMouseLeave: state.status === "disabled"
|
|
12
|
+
? undefined
|
|
13
|
+
: () => {
|
|
14
|
+
dispatch("mouse_leave");
|
|
15
|
+
}, onMouseEnter: state.status === "disabled"
|
|
16
|
+
? undefined
|
|
17
|
+
: () => {
|
|
18
|
+
dispatch("mouse_enter");
|
|
19
|
+
}, children: [leftIcon && _jsx("span", { className: "icon left-icon", children: leftIcon }), text && _jsx("div", { className: "button", children: text }), rightIcon && _jsx("span", { className: "icon right-icon", children: rightIcon })] }));
|
|
16
20
|
};
|
|
17
21
|
function reducer(state, action) {
|
|
18
22
|
switch (action) {
|
|
@@ -127,6 +127,14 @@
|
|
|
127
127
|
color: #b0b0b0;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
.tertiary-button.disabled {
|
|
131
|
+
cursor: default;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.tertiary-button.disabled .icon {
|
|
135
|
+
color: #b0b0b0;
|
|
136
|
+
}
|
|
137
|
+
|
|
130
138
|
.tertiary-button.black .button {
|
|
131
139
|
-webkit-box-orient: vertical;
|
|
132
140
|
-webkit-line-clamp: 1;
|