@ayseaistudio/ui-components 3.5.2 → 3.5.3

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
  };
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.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",