framepexls-ui-lib 0.1.33 → 0.2.1

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.
@@ -1,7 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  type Props = {
4
- sources: Array<string | null | undefined>;
4
+ sources?: Array<string | null | undefined>;
5
+ images?: Array<string | null | undefined>;
6
+ labels?: Array<string | null | undefined>;
5
7
  max?: number;
6
8
  size?: number;
7
9
  overlap?: boolean;
@@ -9,6 +11,6 @@ type Props = {
9
11
  className?: string;
10
12
  showCounter?: boolean;
11
13
  };
12
- declare function AvatarGroup({ sources, max, size, overlap, radiusClass, className, showCounter, }: Props): react_jsx_runtime.JSX.Element;
14
+ declare function AvatarGroup({ sources, images, labels, max, size, overlap, radiusClass, className, showCounter, }: Props): react_jsx_runtime.JSX.Element;
13
15
 
14
16
  export { AvatarGroup as default };
@@ -1,7 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  type Props = {
4
- sources: Array<string | null | undefined>;
4
+ sources?: Array<string | null | undefined>;
5
+ images?: Array<string | null | undefined>;
6
+ labels?: Array<string | null | undefined>;
5
7
  max?: number;
6
8
  size?: number;
7
9
  overlap?: boolean;
@@ -9,6 +11,6 @@ type Props = {
9
11
  className?: string;
10
12
  showCounter?: boolean;
11
13
  };
12
- declare function AvatarGroup({ sources, max, size, overlap, radiusClass, className, showCounter, }: Props): react_jsx_runtime.JSX.Element;
14
+ declare function AvatarGroup({ sources, images, labels, max, size, overlap, radiusClass, className, showCounter, }: Props): react_jsx_runtime.JSX.Element;
13
15
 
14
16
  export { AvatarGroup as default };
@@ -36,6 +36,8 @@ var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_AvatarSquare = __toESM(require("./AvatarSquare"));
37
37
  function AvatarGroup({
38
38
  sources,
39
+ images,
40
+ labels,
39
41
  max = 3,
40
42
  size = 28,
41
43
  overlap = true,
@@ -43,16 +45,20 @@ function AvatarGroup({
43
45
  className = "",
44
46
  showCounter = true
45
47
  }) {
46
- const imgs = (sources || []).filter(Boolean);
47
- const visible = imgs.slice(0, Math.max(0, max));
48
- const rest = Math.max(0, imgs.length - visible.length);
48
+ var _a;
49
+ const list = (_a = sources != null ? sources : images) != null ? _a : [];
50
+ const visible = list.slice(0, Math.max(0, max));
51
+ const rest = Math.max(0, list.length - visible.length);
49
52
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
50
53
  "div",
51
54
  {
52
55
  className: ["flex items-center", className].join(" "),
53
56
  "aria-label": "Grupo de avatares",
54
57
  children: [
55
- visible.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: i > 0 && overlap ? "-ml-2" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarSquare.default, { src, size, radiusClass }) }, `${src}-${i}`)),
58
+ visible.map((src, i) => {
59
+ var _a2;
60
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: i > 0 && overlap ? "-ml-2" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarSquare.default, { src: src != null ? src : void 0, size, radiusClass, alt: (_a2 = labels == null ? void 0 : labels[i]) != null ? _a2 : "", initials: computeInitials(labels == null ? void 0 : labels[i]) }) }, `${src}-${i}`);
61
+ }),
56
62
  showCounter && rest > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
57
63
  "div",
58
64
  {
@@ -75,3 +81,10 @@ function AvatarGroup({
75
81
  }
76
82
  );
77
83
  }
84
+ function computeInitials(label) {
85
+ const s = (label != null ? label : "").trim();
86
+ if (!s) return "";
87
+ const parts = s.split(/\s+/).filter(Boolean);
88
+ if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
89
+ return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
90
+ }
@@ -3,6 +3,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import AvatarSquare from "./AvatarSquare";
4
4
  function AvatarGroup({
5
5
  sources,
6
+ images,
7
+ labels,
6
8
  max = 3,
7
9
  size = 28,
8
10
  overlap = true,
@@ -10,16 +12,20 @@ function AvatarGroup({
10
12
  className = "",
11
13
  showCounter = true
12
14
  }) {
13
- const imgs = (sources || []).filter(Boolean);
14
- const visible = imgs.slice(0, Math.max(0, max));
15
- const rest = Math.max(0, imgs.length - visible.length);
15
+ var _a;
16
+ const list = (_a = sources != null ? sources : images) != null ? _a : [];
17
+ const visible = list.slice(0, Math.max(0, max));
18
+ const rest = Math.max(0, list.length - visible.length);
16
19
  return /* @__PURE__ */ jsxs(
17
20
  "div",
18
21
  {
19
22
  className: ["flex items-center", className].join(" "),
20
23
  "aria-label": "Grupo de avatares",
21
24
  children: [
22
- visible.map((src, i) => /* @__PURE__ */ jsx("div", { className: i > 0 && overlap ? "-ml-2" : void 0, children: /* @__PURE__ */ jsx(AvatarSquare, { src, size, radiusClass }) }, `${src}-${i}`)),
25
+ visible.map((src, i) => {
26
+ var _a2;
27
+ return /* @__PURE__ */ jsx("div", { className: i > 0 && overlap ? "-ml-2" : void 0, children: /* @__PURE__ */ jsx(AvatarSquare, { src: src != null ? src : void 0, size, radiusClass, alt: (_a2 = labels == null ? void 0 : labels[i]) != null ? _a2 : "", initials: computeInitials(labels == null ? void 0 : labels[i]) }) }, `${src}-${i}`);
28
+ }),
23
29
  showCounter && rest > 0 && /* @__PURE__ */ jsxs(
24
30
  "div",
25
31
  {
@@ -42,6 +48,13 @@ function AvatarGroup({
42
48
  }
43
49
  );
44
50
  }
51
+ function computeInitials(label) {
52
+ const s = (label != null ? label : "").trim();
53
+ if (!s) return "";
54
+ const parts = s.split(/\s+/).filter(Boolean);
55
+ if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
56
+ return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
57
+ }
45
58
  export {
46
59
  AvatarGroup as default
47
60
  };
@@ -4,10 +4,11 @@ type Props = {
4
4
  size?: number;
5
5
  src?: string | null;
6
6
  alt?: string;
7
+ initials?: string | null;
7
8
  className?: string;
8
9
  radiusClass?: string;
9
10
  color?: "slate" | "gray" | "zinc" | "neutral" | "stone" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
10
11
  };
11
- declare function AvatarSquare({ size, src, alt, className, radiusClass, color, }: Props): react_jsx_runtime.JSX.Element;
12
+ declare function AvatarSquare({ size, src, alt, initials, className, radiusClass, color, }: Props): react_jsx_runtime.JSX.Element;
12
13
 
13
14
  export { AvatarSquare as default };
@@ -4,10 +4,11 @@ type Props = {
4
4
  size?: number;
5
5
  src?: string | null;
6
6
  alt?: string;
7
+ initials?: string | null;
7
8
  className?: string;
8
9
  radiusClass?: string;
9
10
  color?: "slate" | "gray" | "zinc" | "neutral" | "stone" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
10
11
  };
11
- declare function AvatarSquare({ size, src, alt, className, radiusClass, color, }: Props): react_jsx_runtime.JSX.Element;
12
+ declare function AvatarSquare({ size, src, alt, initials, className, radiusClass, color, }: Props): react_jsx_runtime.JSX.Element;
12
13
 
13
14
  export { AvatarSquare as default };
@@ -39,6 +39,7 @@ function AvatarSquare({
39
39
  size = 32,
40
40
  src,
41
41
  alt = "",
42
+ initials = null,
42
43
  className = "",
43
44
  radiusClass = "rounded-xl",
44
45
  color = "blue"
@@ -120,10 +121,13 @@ function AvatarSquare({
120
121
  "div",
121
122
  {
122
123
  className: [
123
- "h-full w-full",
124
+ "grid place-items-center h-full w-full text-[11px] font-semibold uppercase tracking-wide text-slate-700 dark:text-slate-200",
124
125
  radiusClass,
125
126
  GRADIENT[color]
126
- ].join(" ")
127
+ ].join(" "),
128
+ "aria-label": alt || initials || "avatar",
129
+ title: alt || initials || void 0,
130
+ children: typeof initials === "string" && initials.trim() ? initials.trim() : alt ? alt.split(/\s+/).slice(0, 2).map((s) => s[0]).join("") : ""
127
131
  }
128
132
  )
129
133
  }
@@ -6,6 +6,7 @@ function AvatarSquare({
6
6
  size = 32,
7
7
  src,
8
8
  alt = "",
9
+ initials = null,
9
10
  className = "",
10
11
  radiusClass = "rounded-xl",
11
12
  color = "blue"
@@ -87,10 +88,13 @@ function AvatarSquare({
87
88
  "div",
88
89
  {
89
90
  className: [
90
- "h-full w-full",
91
+ "grid place-items-center h-full w-full text-[11px] font-semibold uppercase tracking-wide text-slate-700 dark:text-slate-200",
91
92
  radiusClass,
92
93
  GRADIENT[color]
93
- ].join(" ")
94
+ ].join(" "),
95
+ "aria-label": alt || initials || "avatar",
96
+ title: alt || initials || void 0,
97
+ children: typeof initials === "string" && initials.trim() ? initials.trim() : alt ? alt.split(/\s+/).slice(0, 2).map((s) => s[0]).join("") : ""
94
98
  }
95
99
  )
96
100
  }
@@ -11,7 +11,7 @@ type CheckboxProps = Omit<React__default.InputHTMLAttributes<HTMLInputElement>,
11
11
  className?: string;
12
12
  inputClassName?: string;
13
13
  };
14
- declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> & {
14
+ declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "type" | "size"> & {
15
15
  label?: React__default.ReactNode;
16
16
  description?: React__default.ReactNode;
17
17
  error?: boolean;
@@ -11,7 +11,7 @@ type CheckboxProps = Omit<React__default.InputHTMLAttributes<HTMLInputElement>,
11
11
  className?: string;
12
12
  inputClassName?: string;
13
13
  };
14
- declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "size" | "type"> & {
14
+ declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "type" | "size"> & {
15
15
  label?: React__default.ReactNode;
16
16
  description?: React__default.ReactNode;
17
17
  error?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framepexls-ui-lib",
3
- "version": "0.1.33",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Componentes UI de Framepexls para React/Next.",
@@ -27,25 +27,25 @@
27
27
  "access": "public"
28
28
  },
29
29
  "peerDependencies": {
30
+ "framer-motion": "^12.23.0",
31
+ "next": "^16.0.0",
30
32
  "react": ">=18.2.0 || ^19",
31
33
  "react-dom": ">=18.2.0 || ^19",
32
- "next": "^15.0.0",
33
- "framer-motion": "^12.23.0",
34
34
  "recharts": ">=3.1.0 <4"
35
35
  },
36
36
  "devDependencies": {
37
- "typescript": "^5.6.3",
37
+ "@tailwindcss/postcss": "^4.1.16",
38
+ "@types/react": "^19.2.2",
39
+ "@types/react-dom": "^19.2.2",
40
+ "framer-motion": "^12.23.24",
41
+ "next": "16.0.0",
42
+ "react": "19.2.0",
43
+ "react-dom": "19.2.0",
44
+ "react-is": "^19.0.0",
45
+ "recharts": "^3.3.0",
46
+ "tailwindcss": "^4.1.16",
38
47
  "tsup": "^8.1.0",
39
- "@types/react": "^19",
40
- "@types/react-dom": "^19",
41
- "tailwindcss": "^4.1.13",
42
- "@tailwindcss/postcss": "^4.1.13",
43
- "framer-motion": "^12.23.20",
44
- "recharts": "^3.2.1",
45
- "next": "15.4.3",
46
- "react": "19.1.0",
47
- "react-dom": "19.1.0",
48
- "react-is": "^19.0.0"
48
+ "typescript": "^5.9.3"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup",
@@ -61,4 +61,4 @@
61
61
  "url": "https://github.com/cponce-framepexls/ui-lib/issues"
62
62
  },
63
63
  "homepage": "https://github.com/cponce-framepexls/ui-lib#readme"
64
- }
64
+ }