@ayseaistudio/ui-components 3.5.2 → 3.5.4

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/README.md CHANGED
@@ -10,7 +10,7 @@ Includes ready-to-use components like buttons and other UI elements.
10
10
  Install the package in your React project:
11
11
 
12
12
  ```bash
13
- npm install @ayseaistudio/ui-components
13
+ npm install @ayseaistudio/ui-components@latest
14
14
  ```
15
15
 
16
16
  If you encounter a React version conflict, use:
@@ -2,6 +2,7 @@ import PropTypes from "prop-types";
2
2
  import "./style.css";
3
3
  interface Props {
4
4
  letter?: string;
5
+ image?: string;
5
6
  size?: "large" | "xx-small" | "x-small" | "medium" | "small";
6
7
  color?: "mauve" | "lime" | "zest" | "grey" | "blue" | "green" | "galliano" | "orange" | "red";
7
8
  status?: "active" | "default";
@@ -9,9 +10,10 @@ interface Props {
9
10
  className?: any;
10
11
  }
11
12
  export declare const Avatar: {
12
- ({ letter, size, color, status, version, className, }: Props): React.JSX.Element;
13
+ ({ letter, image, size, color, status, version, className, }: Props): React.JSX.Element;
13
14
  propTypes: {
14
15
  letter: PropTypes.Requireable<string>;
16
+ image: PropTypes.Requireable<string>;
15
17
  size: PropTypes.Requireable<string>;
16
18
  color: PropTypes.Requireable<string>;
17
19
  status: PropTypes.Requireable<string>;
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import PropTypes from "prop-types";
3
3
  import "./style.css";
4
- export const Avatar = ({ letter = "AB", size, color, status, version, className, }) => {
5
- return (_jsxs("div", { className: `avatar ${size} ${status} ${version} ${color} ${className}`, children: [version === "half" && _jsx("div", { className: "rectangle" }), _jsx("div", { className: "AB", children: letter })] }));
4
+ export const Avatar = ({ letter = "AB", image, size, color, status, version, className, }) => {
5
+ return (_jsxs("div", { className: `avatar ${size} ${status} ${version} ${color} ${className}`, style: image ? { backgroundImage: `url(${image})`, backgroundSize: 'cover', backgroundPosition: 'center' } : {}, children: [version === "half" && _jsx("div", { className: "rectangle" }), image ? null : _jsx("div", { className: "AB", children: letter })] }));
6
6
  };
7
7
  Avatar.propTypes = {
8
8
  letter: PropTypes.string,
9
+ image: PropTypes.string,
9
10
  size: PropTypes.oneOf(["large", "xx-small", "x-small", "medium", "small"]),
10
11
  color: PropTypes.oneOf([
11
12
  "mauve",
@@ -8,16 +8,18 @@ interface Props {
8
8
  avatarColor?: "grey" | "lime" | "mauve" | "zest" | "blue" | "green" | "galliano" | "orange" | "red";
9
9
  timestamp?: string;
10
10
  avatarLetter?: string;
11
+ avatarImage?: string;
11
12
  highlighted?: boolean;
12
13
  avatarPosition?: "left" | "right";
13
14
  showAvatar?: boolean;
14
15
  }
15
16
  export declare const ChatMessage: {
16
- ({ className, divClassName, text, frameClassName, avatarColor, timestamp, avatarLetter, highlighted, avatarPosition, showAvatar, }: Props): React.JSX.Element;
17
+ ({ className, divClassName, text, frameClassName, avatarColor, timestamp, avatarLetter, avatarImage, highlighted, avatarPosition, showAvatar, }: Props): React.JSX.Element;
17
18
  propTypes: {
18
19
  hasDiv: PropTypes.Requireable<boolean>;
19
20
  text: PropTypes.Requireable<string>;
20
21
  avatarColor: PropTypes.Requireable<string>;
22
+ avatarImage: PropTypes.Requireable<string>;
21
23
  showAvatar: PropTypes.Requireable<boolean>;
22
24
  avatarPosition: PropTypes.Requireable<string>;
23
25
  };
@@ -3,14 +3,16 @@ import PropTypes from "prop-types";
3
3
  import "./style.css";
4
4
  import { Avatar } from "../Avatar/Avatar";
5
5
  import { Label } from "../Label/Label";
6
- export const ChatMessage = ({ className, divClassName, text, frameClassName, avatarColor = "lime", timestamp, avatarLetter, highlighted, avatarPosition = "right", showAvatar = true, }) => {
7
- const frameElement = (_jsxs("div", { className: `frame-22 ${frameClassName}`, children: [showAvatar && (_jsx(Avatar, { color: avatarColor, letter: avatarLetter, size: "medium", status: "default", version: "default" })), _jsx(Label, { bold: "off", className: "label-9", color: "black", size: "small", spacing: "off", stroke: "off", text: timestamp, version: "secondary" })] }));
8
- return (_jsxs("div", { className: `chat-message-right ${highlighted ? "highlighted" : ""} ${className}`, children: [avatarPosition === "left" && frameElement, _jsx("div", { className: "message-baloon", children: _jsx("p", { className: `p ${divClassName}`, children: text }) }), avatarPosition === "right" && frameElement] }));
6
+ export const ChatMessage = ({ className, divClassName, text, frameClassName, avatarColor = "lime", timestamp, avatarLetter, avatarImage, highlighted, avatarPosition = "right", showAvatar = true, }) => {
7
+ const avatarElement = showAvatar && (_jsx("div", { className: `frame-22 ${frameClassName}`, children: _jsx(Avatar, { color: avatarColor, letter: avatarLetter, image: avatarImage, size: "medium", status: "default", version: "default" }) }));
8
+ const timestampElement = (_jsx("div", { className: `frame-22 ${frameClassName}`, children: _jsx(Label, { bold: "off", className: "label-9", color: "black", size: "small", spacing: "off", stroke: "off", text: timestamp, version: "secondary" }) }));
9
+ return (_jsxs("div", { className: `chat-message-right ${highlighted ? "highlighted" : ""} ${className}`, children: [avatarPosition === "left" && avatarElement, _jsx("div", { className: "message-baloon", children: _jsx("p", { className: `p ${divClassName}`, children: text }) }), avatarPosition === "right" && avatarElement, timestampElement] }));
9
10
  };
10
11
  ChatMessage.propTypes = {
11
12
  hasDiv: PropTypes.bool,
12
13
  text: PropTypes.string,
13
14
  avatarColor: PropTypes.string,
15
+ avatarImage: PropTypes.string,
14
16
  showAvatar: PropTypes.bool,
15
17
  avatarPosition: PropTypes.oneOf(["left", "right"]),
16
18
  };
@@ -6,18 +6,20 @@ interface Props {
6
6
  status: "play" | "pause";
7
7
  direction: "horizontal";
8
8
  isPlaying?: boolean;
9
+ isLoading?: boolean;
9
10
  togglePlayPause?: () => void;
10
11
  className: any;
11
12
  audioUrl?: string;
12
13
  audioReference: React.Ref<HTMLAudioElement | null>;
13
14
  }
14
15
  export declare const Player: {
15
- ({ withButton, size, status, direction, className, isPlaying, togglePlayPause, audioUrl, audioReference }: Props): React.JSX.Element;
16
+ ({ withButton, size, status, direction, className, isPlaying, isLoading, togglePlayPause, audioUrl, audioReference }: Props): React.JSX.Element;
16
17
  propTypes: {
17
18
  withButton: PropTypes.Requireable<boolean>;
18
19
  size: PropTypes.Requireable<string>;
19
20
  status: PropTypes.Requireable<string>;
20
21
  direction: PropTypes.Requireable<string>;
22
+ isLoading: PropTypes.Requireable<boolean>;
21
23
  audioUrl: PropTypes.Requireable<string>;
22
24
  };
23
25
  };
@@ -4,8 +4,9 @@ import { SingleSlider } from "../SingleSlider";
4
4
  import "./style.css";
5
5
  import { IconPlayerPlayFilled, IconPlayerPauseFilled } from "@tabler/icons-react";
6
6
  import { PrimaryButton } from "../PrimaryButton/PrimaryButton";
7
+ import { Loader } from "../Loader/Loader";
7
8
  import { useState, useEffect, useRef } from "react";
8
- export const Player = ({ withButton = true, size, status, direction, className, isPlaying, togglePlayPause, audioUrl, audioReference }) => {
9
+ export const Player = ({ withButton = true, size, status, direction, className, isPlaying, isLoading = false, togglePlayPause, audioUrl, audioReference }) => {
9
10
  const [volume, setVolume] = useState(100);
10
11
  const [currentTime, setCurrentTime] = useState(0);
11
12
  const [duration, setDuration] = useState(0);
@@ -59,14 +60,13 @@ export const Player = ({ withButton = true, size, status, direction, className,
59
60
  setAudioInstance(null);
60
61
  };
61
62
  }, [audioUrl]);
62
- return (_jsxs("div", { className: `player ${className}`, children: [withButton && (_jsx(PrimaryButton, { className: "primary-button", leftIcon: isPlaying ?
63
- _jsx(IconPlayerPauseFilled, { size: 20, color: "#F1F1F1" }) :
64
- _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 })), _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) })] }) }) })] }));
65
64
  };
66
65
  Player.propTypes = {
67
66
  withButton: PropTypes.bool,
68
67
  size: PropTypes.oneOf(["large"]),
69
68
  status: PropTypes.oneOf(["play"]),
70
69
  direction: PropTypes.oneOf(["horizontal"]),
70
+ isLoading: PropTypes.bool,
71
71
  audioUrl: PropTypes.string,
72
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ayseaistudio/ui-components",
3
- "version": "3.5.2",
3
+ "version": "3.5.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",