@aseguragonzalez/ui 1.4.0 → 1.5.0

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/index.d.ts CHANGED
@@ -41,7 +41,7 @@ export type { NumberInputProps, NumberInputSize } from './primitives/NumberInput
41
41
  export { DateInput } from './primitives/DateInput/DateInput';
42
42
  export type { DateInputProps, DateInputSize } from './primitives/DateInput/DateInput';
43
43
  export { Avatar } from './primitives/Avatar/Avatar';
44
- export type { AvatarProps, AvatarSize, AvatarShape } from './primitives/Avatar/Avatar';
44
+ export type { AvatarProps, AvatarImgProps, AvatarSize, AvatarShape } from './primitives/Avatar/Avatar';
45
45
  export { Tabs, TabList, Tab, TabPanel } from './primitives/Tabs/Tabs';
46
46
  export type { TabsProps, TabListProps, TabProps, TabPanelProps } from './primitives/Tabs/Tabs';
47
47
  export { Tooltip } from './primitives/Tooltip/Tooltip';
@@ -1 +1 @@
1
- const e=require("./AuthLayout.module.css.cjs");let t=require("react/jsx-runtime");var n=()=>(0,t.jsxs)(`svg`,{width:`36`,height:`36`,viewBox:`0 0 36 36`,fill:`none`,"aria-hidden":`true`,children:[(0,t.jsx)(`rect`,{width:`36`,height:`36`,rx:`8`,fill:`var(--ds-color-action-primary)`}),(0,t.jsx)(`path`,{d:`M10 12h16M10 18h11M10 24h8`,stroke:`white`,strokeWidth:`2.5`,strokeLinecap:`round`})]});function r({children:r,branding:i,tagline:a,logo:o,brandingLabel:s=`Product branding`,footer:c}){let l=o??(0,t.jsx)(n,{});return(0,t.jsxs)(`div`,{className:[e.default.layout,c?e.default.withFooter:``].filter(Boolean).join(` `),children:[(0,t.jsx)(`aside`,{className:e.default.brandPanel,"aria-label":s,"aria-hidden":`true`,children:(0,t.jsx)(`div`,{className:e.default.brandContent,children:i??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(`div`,{className:e.default.brandLogo,children:l}),(0,t.jsx)(`p`,{className:e.default.brandTagline,children:a??(0,t.jsxs)(t.Fragment,{children:[`Build better products,`,(0,t.jsx)(`br`,{}),`together.`]})})]})})}),(0,t.jsx)(`main`,{className:e.default.formPanel,children:(0,t.jsxs)(`div`,{className:e.default.formContent,children:[(0,t.jsx)(`div`,{className:e.default.mobileLogo,"aria-hidden":`true`,children:l}),r]})}),c&&(0,t.jsx)(`footer`,{className:e.default.footer,children:c})]})}r.displayName=`AuthLayout`,exports.AuthLayout=r;
1
+ const e=require("./AuthLayout.module.css.cjs");let t=require("react/jsx-runtime");var n=()=>(0,t.jsxs)(`svg`,{width:`36`,height:`36`,viewBox:`0 0 36 36`,fill:`none`,"aria-hidden":`true`,children:[(0,t.jsx)(`rect`,{width:`36`,height:`36`,rx:`8`,fill:`var(--ds-color-action-primary)`}),(0,t.jsx)(`path`,{d:`M10 12h16M10 18h11M10 24h8`,stroke:`white`,strokeWidth:`2.5`,strokeLinecap:`round`})]});function r({children:r,branding:i,tagline:a,logo:o,brandingLabel:s=`Product branding`,footer:c}){let l=o??(0,t.jsx)(n,{});return(0,t.jsxs)(`div`,{className:[e.default.layout,c?e.default.withFooter:``].filter(Boolean).join(` `),children:[(0,t.jsx)(`aside`,{className:e.default.brandPanel,"aria-label":s,children:(0,t.jsx)(`div`,{className:e.default.brandContent,children:i??(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(`div`,{className:e.default.brandLogo,children:l}),(0,t.jsx)(`p`,{className:e.default.brandTagline,children:a??(0,t.jsxs)(t.Fragment,{children:[`Build better products,`,(0,t.jsx)(`br`,{}),`together.`]})})]})})}),(0,t.jsx)(`main`,{className:e.default.formPanel,children:(0,t.jsxs)(`div`,{className:e.default.formContent,children:[(0,t.jsx)(`div`,{className:e.default.mobileLogo,"aria-hidden":`true`,children:l}),r]})}),c&&(0,t.jsx)(`footer`,{className:e.default.footer,children:c})]})}r.displayName=`AuthLayout`,exports.AuthLayout=r;
@@ -8,7 +8,7 @@ export interface AuthLayoutProps {
8
8
  tagline?: ReactNode;
9
9
  /** Logo shown at the top of the form panel on mobile, and inside the branding panel on desktop. */
10
10
  logo?: ReactNode;
11
- /** Accessible label for the branding panel (hidden from visual display). */
11
+ /** Accessible name of the branding panel's complementary landmark. Default: `'Product branding'`. */
12
12
  brandingLabel?: string;
13
13
  /**
14
14
  * Page footer. Rendered in a `<footer>` after `<main>`, not inside it, so it is exposed as the
@@ -27,7 +27,6 @@ function a({ children: a, branding: o, tagline: s, logo: c, brandingLabel: l = "
27
27
  /* @__PURE__ */ n("aside", {
28
28
  className: e.brandPanel,
29
29
  "aria-label": l,
30
- "aria-hidden": "true",
31
30
  children: /* @__PURE__ */ n("div", {
32
31
  className: e.brandContent,
33
32
  children: o ?? /* @__PURE__ */ r(t, { children: [/* @__PURE__ */ n("div", {
@@ -1 +1 @@
1
- const e=require("./Avatar.module.css.cjs");let t=require("react"),n=require("react/jsx-runtime");function r(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0][0].toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var i=(0,t.forwardRef)(({name:i,src:a,size:o=`md`,shape:s=`circle`,className:c,...l},u)=>{let[d,f]=(0,t.useState)(!1);(0,t.useEffect)(()=>{f(!1)},[a]);let p=!!a&&!d,m=[e.default.avatar,e.default[o],e.default[s],c??``].filter(Boolean).join(` `);return(0,n.jsx)(`span`,{ref:u,role:`img`,"aria-label":i,className:m,...l,children:p?(0,n.jsx)(`img`,{src:a,alt:``,"aria-hidden":`true`,className:e.default.image,onError:()=>f(!0)}):(0,n.jsx)(`span`,{"aria-hidden":`true`,className:e.default.initials,children:r(i)})})});i.displayName=`Avatar`,exports.Avatar=i;
1
+ const e=require("./Avatar.module.css.cjs");let t=require("react"),n=require("react/jsx-runtime");function r(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0][0].toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var i=(0,t.forwardRef)(({name:i,src:a,size:o=`md`,shape:s=`circle`,decorative:c=!1,imgProps:l,className:u,...d},f)=>{let[p,m]=(0,t.useState)(!1);(0,t.useEffect)(()=>{m(!1)},[a]);let h=!!a&&!p,g=[e.default.avatar,e.default[o],e.default[s],u??``].filter(Boolean).join(` `);return(0,n.jsx)(`span`,{ref:f,role:c?void 0:`img`,"aria-label":c?void 0:i,"aria-hidden":c?!0:void 0,className:g,...d,children:h?(0,n.jsx)(`img`,{...l,src:a,alt:``,"aria-hidden":`true`,className:e.default.image,onError:e=>{m(!0),l?.onError?.(e)}}):(0,n.jsx)(`span`,{"aria-hidden":`true`,className:e.default.initials,children:r(i)})})});i.displayName=`Avatar`,exports.Avatar=i;
@@ -1,11 +1,16 @@
1
1
  export type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
2
2
  export type AvatarShape = 'circle' | 'square';
3
+ export type AvatarImgProps = Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'className'>;
3
4
  export interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {
4
5
  /** Full name — used for accessible label and to derive initials. */
5
6
  name: string;
6
7
  src?: string;
7
8
  size?: AvatarSize;
8
9
  shape?: AvatarShape;
10
+ /** When true, the avatar is hidden from assistive technology — use it next to the visible name. */
11
+ decorative?: boolean;
12
+ /** Attributes forwarded to the inner `<img>`, such as `referrerPolicy`. */
13
+ imgProps?: AvatarImgProps;
9
14
  }
10
15
  declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<HTMLSpanElement>>;
11
16
  export { Avatar };
@@ -6,29 +6,33 @@ function a(e) {
6
6
  let t = e.trim().split(/\s+/).filter(Boolean);
7
7
  return t.length === 0 ? "?" : t.length === 1 ? t[0][0].toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
8
8
  }
9
- var o = t(({ name: t, src: o, size: s = "md", shape: c = "circle", className: l, ...u }, d) => {
10
- let [f, p] = r(!1);
9
+ var o = t(({ name: t, src: o, size: s = "md", shape: c = "circle", decorative: l = !1, imgProps: u, className: d, ...f }, p) => {
10
+ let [m, h] = r(!1);
11
11
  n(() => {
12
- p(!1);
12
+ h(!1);
13
13
  }, [o]);
14
- let m = !!o && !f, h = [
14
+ let g = !!o && !m, _ = [
15
15
  e.avatar,
16
16
  e[s],
17
17
  e[c],
18
- l ?? ""
18
+ d ?? ""
19
19
  ].filter(Boolean).join(" ");
20
20
  return /* @__PURE__ */ i("span", {
21
- ref: d,
22
- role: "img",
23
- "aria-label": t,
24
- className: h,
25
- ...u,
26
- children: m ? /* @__PURE__ */ i("img", {
21
+ ref: p,
22
+ role: l ? void 0 : "img",
23
+ "aria-label": l ? void 0 : t,
24
+ "aria-hidden": l ? !0 : void 0,
25
+ className: _,
26
+ ...f,
27
+ children: g ? /* @__PURE__ */ i("img", {
28
+ ...u,
27
29
  src: o,
28
30
  alt: "",
29
31
  "aria-hidden": "true",
30
32
  className: e.image,
31
- onError: () => p(!0)
33
+ onError: (e) => {
34
+ h(!0), u?.onError?.(e);
35
+ }
32
36
  }) : /* @__PURE__ */ i("span", {
33
37
  "aria-hidden": "true",
34
38
  className: e.initials,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aseguragonzalez/ui",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Accessible, themeable design system for React SPAs",