@yakad/ui 1.3.152 → 1.3.154

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.
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ src?: string;
4
+ }
5
+ export declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
6
+ export default Avatar;
@@ -0,0 +1,23 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { forwardRef } from "react";
14
+ import classNames from "classnames";
15
+ import styles from "./Avatar.module.css";
16
+ import { Symbol } from "@yakad/symbols";
17
+ export const Avatar = forwardRef(function Avatar(_a, ref) {
18
+ var { src, className } = _a, restProps = __rest(_a, ["src", "className"]);
19
+ const joinedClassNames = classNames(styles.profileContainer, className);
20
+ const backgroundImage = src ? `url(${src})` : `url("./default-avatar.svg")`;
21
+ return (_jsx("div", Object.assign({ ref: ref }, restProps, { className: joinedClassNames, style: { backgroundImage }, children: _jsx("div", { className: styles.editOverlay, children: _jsx(Symbol, { icon: "edit" }) }) })));
22
+ });
23
+ export default Avatar;
@@ -0,0 +1,31 @@
1
+ .profileContainer {
2
+ position: relative;
3
+ width: 60px;
4
+ height: 60px;
5
+ cursor: pointer;
6
+ border-radius: 50%;
7
+ overflow: hidden;
8
+ display: inline-flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ background-size: cover;
12
+ background-position: center;
13
+ transition: all 0.3s ease;
14
+ }
15
+
16
+
17
+ .editOverlay {
18
+ position: absolute;
19
+ inset: 0;
20
+ background-color: rgba(0, 0, 0, 0.5);
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ opacity: 0;
25
+ transition: opacity 0.3s ease;
26
+ color: white;
27
+ }
28
+
29
+ .profileContainer:hover .editOverlay {
30
+ opacity: 1;
31
+ }
@@ -0,0 +1,8 @@
1
+ <!-- default-avatar.svg -->
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="Default avatar">
3
+ <rect width="100%" height="100%" rx="24" fill="#E6EEF8"/>
4
+ <g transform="translate(48,40)" fill="none" fill-rule="evenodd">
5
+ <circle cx="80" cy="56" r="40" fill="#CBDFF6"/>
6
+ <path d="M0 152c0-44.18 35.82-80 80-80s80 35.82 80 80v8H0v-8z" fill="#B6D0FB"/>
7
+ </g>
8
+ </svg>
@@ -29,7 +29,7 @@ export const WithOverlay = forwardRef(function WithOverlay(_a, forwardedRef) {
29
29
  };
30
30
  }, [showOverlay]);
31
31
  // Teleport Overlay to portalRoot or body
32
- const portalRoot = document.getElementsByClassName("portalRoot")[0] || document.body;
32
+ const portalRoot = document.getElementsByClassName("portalRoot")[0] || document;
33
33
  const teleport = overlay &&
34
34
  portalRoot &&
35
35
  createPortal(cloneElement(overlay, {
package/dist/index.d.ts CHANGED
@@ -34,3 +34,4 @@ export * from "./RenderByScroll/RenderByScroll";
34
34
  export * from "./ActiveOnVisible/ActiveOnVisible";
35
35
  export * from "./Dropdown/Dropdown";
36
36
  export * from "./Popup/Popup";
37
+ export * from "./Avatar/Avatar";
package/dist/index.js CHANGED
@@ -40,3 +40,4 @@ export * from "./ActiveOnVisible/ActiveOnVisible"; // Stack Based
40
40
  // Overlays
41
41
  export * from "./Dropdown/Dropdown"; // Card Based
42
42
  export * from "./Popup/Popup"; // Card Based
43
+ export * from "./Avatar/Avatar";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yakad/ui",
3
- "version": "1.3.152",
3
+ "version": "1.3.154",
4
4
  "private": false,
5
5
  "author": "Natiq",
6
6
  "description": "UI components for NextJS/React",
@@ -23,8 +23,9 @@
23
23
  "homepage": "https://yakad.natiq.net",
24
24
  "scripts": {
25
25
  "clean": "rimraf dist/",
26
- "copy-files": "copyfiles -u 1 src/*.css src/**/*.css dist/",
27
- "build": "npm run clean && tsc && npm run copy-files",
26
+ "copy-files:css": "copyfiles -u 1 src/*.css src/**/*.css dist/",
27
+ "copy-files:svg": "copyfiles -u 1 src/*.svg src/**/*.svg dist/",
28
+ "build": "npm run clean && tsc && npm run copy-files:css && npm run copy-files:svg",
28
29
  "typecheck": "tsc --noEmit",
29
30
  "lint": "eslint src/**/*.{ts,tsx}",
30
31
  "test": "echo \"No tests specified\" && exit 0",